PageSourceSearch

https://my.lodgis.com/assets/js/main.js

js lodgis.com collected 2026-10-03 22:47:34 UTC 2,970,553 bytes, 68,788 lines download raw bytes

1/*!
2 * ============================================================
3 * lodgis v1.0.0
4 * (c) 2021 - Jeremy FAGIS - http://www.fagis.fr
5 * ============================================================
6 */
7
8(function () {
9    function r(e, n, t) {
10        function o(i, f) {
11            if (!n[i]) {
12                if (!e[i]) {
13                    var c = "function" == typeof require && require;
14                    if (!f && c) return c(i, !0);
15                    if (u) return u(i, !0);
16                    var a = new Error("Cannot find module '" + i + "'");
17                    throw a.code = "MODULE_NOT_FOUND", a
18                }
19                var p = n[i] = {exports: {}};
20                e[i][0].call(p.exports, function (r) {
21                    var n = e[i][1][r];
22                    return o(n || r)
23                }, p, p.exports, r, e, n, t)
24            }
25            return n[i].exports
26        }
27
28        for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) o(t[i]);
29        return o
30    }
31
32    return r
33})()({
34    1: [function (require, module, exports) {
35        !function (e, o) {
36            if ("function" == typeof define && define.amd) define(["exports"], o); else if ("undefined" != typeof exports) o(exports); else {
37                var t = {};
38                o(t), e.bodyScrollLock = t
39            }
40        }(this, function (exports) {
41            "use strict";
42            Object.defineProperty(exports, "__esModule", {value: !0});
43            var t = !1;
44            if ("undefined" != typeof window) {
45                var e = {
46                    get passive() {
47                        t = !0
48                    }
49                };
50                window.addEventListener("testPassive", null, e), window.removeEventListener("testPassive", null, e)
51            }
52
53            function l(o) {
54                return c.some(function (e) {
55                    return !(!e.options.allowTouchMove || !e.options.allowTouchMove(o))
56                })
57            }
58
59            function d(e) {
60                var o = e || window.event;
61                return !!l(o.target) || (1 < o.touches.length || (o.preventDefault && o.preventDefault(), !1))
62            }
63
64            function n() {
65                void 0 !== v && (document.body.style.paddingRight = v, v = void 0), void 0 !== s && (document.body.style.overflow = s, s = void 0)
66            }
67
68            var i = "undefined" != typeof window && window.navigator && window.navigator.platform && (/iP(ad|hone|od)/.test(window.navigator.platform) || "MacIntel" === window.navigator.platform && 1 < window.navigator.maxTouchPoints),
69                c = [], a = !1, u = -1, s = void 0, v = void 0;
70            exports.disableBodyScroll = function (r, e) {
71                if (r) {
72                    if (!c.some(function (e) {
73                        return e.targetElement === r
74                    })) {
75                        var o = {targetElement: r, options: e || {}};
76                        c = [].concat(function (e) {
77                            if (Array.isArray(e)) {
78                                for (var o = 0, t = Array(e.length); o < e.length; o++) t[o] = e[o];
79                                return t
80                            }
81                            return Array.from(e)
82                        }(c), [o]), i ? (r.ontouchstart = function (e) {
83                            1 === e.targetTouches.length && (u = e.targetTouches[0].clientY)
84                        }, r.ontouchmove = function (e) {
85                            var o, t, n, i;
86                            1 === e.targetTouches.length && (t = r, i = (o = e).targetTouches[0].clientY - u, l(o.target) || (t && 0 === t.scrollTop && 0 < i || (n = t) && n.scrollHeight - n.scrollTop <= n.clientHeight && i < 0 ? d(o) : o.stopPropagation()))
87                        }, a || (document.addEventListener("touchmove", d, t ? {passive: !1} : void 0), a = !0)) : function (e) {
88                            if (void 0 === v) {
89                                var o = !!e && !0 === e.reserveScrollBarGap,
90                                    t = window.innerWidth - document.documentElement.clientWidth;
91                                o && 0 < t && (v = document.body.style.paddingRight, document.body.style.paddingRight = t + "px")
92                            }
93                            void 0 === s && (s = document.body.style.overflow, document.body.style.overflow = "hidden")
94                        }(e)
95                    }
96                } else console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.")
97            }, exports.clearAllBodyScrollLocks = function () {
98                i ? (c.forEach(function (e) {
99                    e.targetElement.ontouchstart = null, e.targetElement.ontouchmove = null
100                }), a && (document.removeEventListener("touchmove", d, t ? {passive: !1} : void 0), a = !1), u = -1) : n(), c = []
101            }, exports.enableBodyScroll = function (o) {
102                o ? (c = c.filter(function (e) {
103                    return e.targetElement !== o
104                }), i ? (o.ontouchstart = null, o.ontouchmove = null, a && 0 === c.length && (document.removeEventListener("touchmove", d, t ? {passive: !1} : void 0), a = !1)) : c.length || n()) : console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.")
105            }
106        });
107
108    }, {}],
109    2: [function (require, module, exports) {
110        /*!
111 * Chart.js v2.9.4
112 * https://www.chartjs.org
113 * (c) 2020 Chart.js Contributors
114 * Released under the MIT License
115 */
116        (function (global, factory) {
117            typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(function () {
118                    try {
119                        return require('moment');
120                    } catch (e) {
121                    }
122                }()) :
123                typeof define === 'function' && define.amd ? define(['require'], function (require) {
124                        return factory(function () {
125                            try {
126                                return require('moment');
127                            } catch (e) {
128                            }
129                        }());
130                    }) :
131                    (global = global || self, global.Chart = factory(global.moment));
132        }(this, (function (moment) {
133            'use strict';
134
135            moment = moment && moment.hasOwnProperty('default') ? moment['default'] : moment;
136
137            function createCommonjsModule(fn, module) {
138                return module = {exports: {}}, fn(module, module.exports), module.exports;
139            }
140
141            function getCjsExportFromNamespace(n) {
142                return n && n['default'] || n;
143            }
144
145            var colorName = {
146                "aliceblue": [240, 248, 255],
147                "antiquewhite": [250, 235, 215],
148                "aqua": [0, 255, 255],
149                "aquamarine": [127, 255, 212],
150                "azure": [240, 255, 255],
151                "beige": [245, 245, 220],
152                "bisque": [255, 228, 196],
153                "black": [0, 0, 0],
154                "blanchedalmond": [255, 235, 205],
155                "blue": [0, 0, 255],
156                "blueviolet": [138, 43, 226],
157                "brown": [165, 42, 42],
158                "burlywood": [222, 184, 135],
159                "cadetblue": [95, 158, 160],
160                "chartreuse": [127, 255, 0],
161                "chocolate": [210, 105, 30],
162                "coral": [255, 127, 80],
163                "cornflowerblue": [100, 149, 237],
164                "cornsilk": [255, 248, 220],
165                "crimson": [220, 20, 60],
166                "cyan": [0, 255, 255],
167                "darkblue": [0, 0, 139],
168                "darkcyan": [0, 139, 139],
169                "darkgoldenrod": [184, 134, 11],
170                "darkgray": [169, 169, 169],
171                "darkgreen": [0, 100, 0],
172                "darkgrey": [169, 169, 169],
173                "darkkhaki": [189, 183, 107],
174                "darkmagenta": [139, 0, 139],
175                "darkolivegreen": [85, 107, 47],
176                "darkorange": [255, 140, 0],
177                "darkorchid": [153, 50, 204],
178                "darkred": [139, 0, 0],
179                "darksalmon": [233, 150, 122],
180                "darkseagreen": [143, 188, 143],
181                "darkslateblue": [72, 61, 139],
182                "darkslategray": [47, 79, 79],
183                "darkslategrey": [47, 79, 79],
184                "darkturquoise": [0, 206, 209],
185                "darkviolet": [148, 0, 211],
186                "deeppink": [255, 20, 147],
187                "deepskyblue": [0, 191, 255],
188                "dimgray": [105, 105, 105],
189                "dimgrey": [105, 105, 105],
190                "dodgerblue": [30, 144, 255],
191                "firebrick": [178, 34, 34],
192                "floralwhite": [255, 250, 240],
193                "forestgreen": [34, 139, 34],
194                "fuchsia": [255, 0, 255],
195                "gainsboro": [220, 220, 220],
196                "ghostwhite": [248, 248, 255],
197                "gold": [255, 215, 0],
198                "goldenrod": [218, 165, 32],
199                "gray": [128, 128, 128],
200                "green": [0, 128, 0],
201                "greenyellow": [173, 255, 47],
202                "grey": [128, 128, 128],
203                "honeydew": [240, 255, 240],
204                "hotpink": [255, 105, 180],
205                "indianred": [205, 92, 92],
206                "indigo": [75, 0, 130],
207                "ivory": [255, 255, 240],
208                "khaki": [240, 230, 140],
209                "lavender": [230, 230, 250],
210                "lavenderblush": [255, 240, 245],
211                "lawngreen": [124, 252, 0],
212                "lemonchiffon": [255, 250, 205],
213                "lightblue": [173, 216, 230],
214                "lightcoral": [240, 128, 128],
215                "lightcyan": [224, 255, 255],
216                "lightgoldenrodyellow": [250, 250, 210],
217                "lightgray": [211, 211, 211],
218                "lightgreen": [144, 238, 144],
219                "lightgrey": [211, 211, 211],
220                "lightpink": [255, 182, 193],
221                "lightsalmon": [255, 160, 122],
222                "lightseagreen": [32, 178, 170],
223                "lightskyblue": [135, 206, 250],
224                "lightslategray": [119, 136, 153],
225                "lightslategrey": [119, 136, 153],
226                "lightsteelblue": [176, 196, 222],
227                "lightyellow": [255, 255, 224],
228                "lime": [0, 255, 0],
229                "limegreen": [50, 205, 50],
230                "linen": [250, 240, 230],
231                "magenta": [255, 0, 255],
232                "maroon": [128, 0, 0],
233                "mediumaquamarine": [102, 205, 170],
234                "mediumblue": [0, 0, 205],
235                "mediumorchid": [186, 85, 211],
236                "mediumpurple": [147, 112, 219],
237                "mediumseagreen": [60, 179, 113],
238                "mediumslateblue": [123, 104, 238],
239                "mediumspringgreen": [0, 250, 154],
vendor: 136,662 bytes, lines 240-3776
240                "mediumturquoise": [72, 209, 204],
241                "mediumvioletred": [199, 21, 133],
242                "midnightblue": [25, 25, 112],
243                "mintcream": [245, 255, 250],
244                "mistyrose": [255, 228, 225],
245                "moccasin": [255, 228, 181],
246                "navajowhite": [255, 222, 173],
247                "navy": [0, 0, 128],
248                "oldlace": [253, 245, 230],
249                "olive": [128, 128, 0],
250                "olivedrab": [107, 142, 35],
251                "orange": [255, 165, 0],
252                "orangered": [255, 69, 0],
253                "orchid": [218, 112, 214],
254                "palegoldenrod": [238, 232, 170],
255                "palegreen": [152, 251, 152],
256                "paleturquoise": [175, 238, 238],
257                "palevioletred": [219, 112, 147],
258                "papayawhip": [255, 239, 213],
259                "peachpuff": [255, 218, 185],
260                "peru": [205, 133, 63],
261                "pink": [255, 192, 203],
262                "plum": [221, 160, 221],
263                "powderblue": [176, 224, 230],
264                "purple": [128, 0, 128],
265                "rebeccapurple": [102, 51, 153],
266                "red": [255, 0, 0],
267                "rosybrown": [188, 143, 143],
268                "royalblue": [65, 105, 225],
269                "saddlebrown": [139, 69, 19],
270                "salmon": [250, 128, 114],
271                "sandybrown": [244, 164, 96],
272                "seagreen": [46, 139, 87],
273                "seashell": [255, 245, 238],
274                "sienna": [160, 82, 45],
275                "silver": [192, 192, 192],
276                "skyblue": [135, 206, 235],
277                "slateblue": [106, 90, 205],
278                "slategray": [112, 128, 144],
279                "slategrey": [112, 128, 144],
280                "snow": [255, 250, 250],
281                "springgreen": [0, 255, 127],
282                "steelblue": [70, 130, 180],
283                "tan": [210, 180, 140],
284                "teal": [0, 128, 128],
285                "thistle": [216, 191, 216],
286                "tomato": [255, 99, 71],
287                "turquoise": [64, 224, 208],
288                "violet": [238, 130, 238],
289                "wheat": [245, 222, 179],
290                "white": [255, 255, 255],
291                "whitesmoke": [245, 245, 245],
292                "yellow": [255, 255, 0],
293                "yellowgreen": [154, 205, 50]
294            };
295
296            var conversions = createCommonjsModule(function (module) {
297                /* MIT license */
298
299
300// NOTE: conversions should only return primitive values (i.e. arrays, or
301//       values that give correct `typeof` results).
302//       do not use box values types (i.e. Number(), String(), etc.)
303
304                var reverseKeywords = {};
305                for (var key in colorName) {
306                    if (colorName.hasOwnProperty(key)) {
307                        reverseKeywords[colorName[key]] = key;
308                    }
309                }
310
311                var convert = module.exports = {
312                    rgb: {channels: 3, labels: 'rgb'},
313                    hsl: {channels: 3, labels: 'hsl'},
314                    hsv: {channels: 3, labels: 'hsv'},
315                    hwb: {channels: 3, labels: 'hwb'},
316                    cmyk: {channels: 4, labels: 'cmyk'},
317                    xyz: {channels: 3, labels: 'xyz'},
318                    lab: {channels: 3, labels: 'lab'},
319                    lch: {channels: 3, labels: 'lch'},
320                    hex: {channels: 1, labels: ['hex']},
321                    keyword: {channels: 1, labels: ['keyword']},
322                    ansi16: {channels: 1, labels: ['ansi16']},
323                    ansi256: {channels: 1, labels: ['ansi256']},
324                    hcg: {channels: 3, labels: ['h', 'c', 'g']},
325                    apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
326                    gray: {channels: 1, labels: ['gray']}
327                };
328
329// hide .channels and .labels properties
330                for (var model in convert) {
331                    if (convert.hasOwnProperty(model)) {
332                        if (!('channels' in convert[model])) {
333                            throw new Error('missing channels property: ' + model);
334                        }
335
336                        if (!('labels' in convert[model])) {
337                            throw new Error('missing channel labels property: ' + model);
338                        }
339
340                        if (convert[model].labels.length !== convert[model].channels) {
341                            throw new Error('channel and label counts mismatch: ' + model);
342                        }
343
344                        var channels = convert[model].channels;
345                        var labels = convert[model].labels;
346                        delete convert[model].channels;
347                        delete convert[model].labels;
348                        Object.defineProperty(convert[model], 'channels', {value: channels});
349                        Object.defineProperty(convert[model], 'labels', {value: labels});
350                    }
351                }
352
353                convert.rgb.hsl = function (rgb) {
354                    var r = rgb[0] / 255;
355                    var g = rgb[1] / 255;
356                    var b = rgb[2] / 255;
357                    var min = Math.min(r, g, b);
358                    var max = Math.max(r, g, b);
359                    var delta = max - min;
360                    var h;
361                    var s;
362                    var l;
363
364                    if (max === min) {
365                        h = 0;
366                    } else if (r === max) {
367                        h = (g - b) / delta;
368                    } else if (g === max) {
369                        h = 2 + (b - r) / delta;
370                    } else if (b === max) {
371                        h = 4 + (r - g) / delta;
372                    }
373
374                    h = Math.min(h * 60, 360);
375
376                    if (h < 0) {
377                        h += 360;
378                    }
379
380                    l = (min + max) / 2;
381
382                    if (max === min) {
383                        s = 0;
384                    } else if (l <= 0.5) {
385                        s = delta / (max + min);
386                    } else {
387                        s = delta / (2 - max - min);
388                    }
389
390                    return [h, s * 100, l * 100];
391                };
392
393                convert.rgb.hsv = function (rgb) {
394                    var rdif;
395                    var gdif;
396                    var bdif;
397                    var h;
398                    var s;
399
400                    var r = rgb[0] / 255;
401                    var g = rgb[1] / 255;
402                    var b = rgb[2] / 255;
403                    var v = Math.max(r, g, b);
404                    var diff = v - Math.min(r, g, b);
405                    var diffc = function (c) {
406                        return (v - c) / 6 / diff + 1 / 2;
407                    };
408
409                    if (diff === 0) {
410                        h = s = 0;
411                    } else {
412                        s = diff / v;
413                        rdif = diffc(r);
414                        gdif = diffc(g);
415                        bdif = diffc(b);
416
417                        if (r === v) {
418                            h = bdif - gdif;
419                        } else if (g === v) {
420                            h = (1 / 3) + rdif - bdif;
421                        } else if (b === v) {
422                            h = (2 / 3) + gdif - rdif;
423                        }
424                        if (h < 0) {
425                            h += 1;
426                        } else if (h > 1) {
427                            h -= 1;
428                        }
429                    }
430
431                    return [
432                        h * 360,
433                        s * 100,
434                        v * 100
435                    ];
436                };
437
438                convert.rgb.hwb = function (rgb) {
439                    var r = rgb[0];
440                    var g = rgb[1];
441                    var b = rgb[2];
442                    var h = convert.rgb.hsl(rgb)[0];
443                    var w = 1 / 255 * Math.min(r, Math.min(g, b));
444
445                    b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
446
447                    return [h, w * 100, b * 100];
448                };
449
450                convert.rgb.cmyk = function (rgb) {
451                    var r = rgb[0] / 255;
452                    var g = rgb[1] / 255;
453                    var b = rgb[2] / 255;
454                    var c;
455                    var m;
456                    var y;
457                    var k;
458
459                    k = Math.min(1 - r, 1 - g, 1 - b);
460                    c = (1 - r - k) / (1 - k) || 0;
461                    m = (1 - g - k) / (1 - k) || 0;
462                    y = (1 - b - k) / (1 - k) || 0;
463
464                    return [c * 100, m * 100, y * 100, k * 100];
465                };
466
467                /**
468                 * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
469                 * */
470                function comparativeDistance(x, y) {
471                    return (
472                        Math.pow(x[0] - y[0], 2) +
473                        Math.pow(x[1] - y[1], 2) +
474                        Math.pow(x[2] - y[2], 2)
475                    );
476                }
477
478                convert.rgb.keyword = function (rgb) {
479                    var reversed = reverseKeywords[rgb];
480                    if (reversed) {
481                        return reversed;
482                    }
483
484                    var currentClosestDistance = Infinity;
485                    var currentClosestKeyword;
486
487                    for (var keyword in colorName) {
488                        if (colorName.hasOwnProperty(keyword)) {
489                            var value = colorName[keyword];
490
491                            // Compute comparative distance
492                            var distance = comparativeDistance(rgb, value);
493
494                            // Check if its less, if so set as closest
495                            if (distance < currentClosestDistance) {
496                                currentClosestDistance = distance;
497                                currentClosestKeyword = keyword;
498                            }
499                        }
500                    }
501
502                    return currentClosestKeyword;
503                };
504
505                convert.keyword.rgb = function (keyword) {
506                    return colorName[keyword];
507                };
508
509                convert.rgb.xyz = function (rgb) {
510                    var r = rgb[0] / 255;
511                    var g = rgb[1] / 255;
512                    var b = rgb[2] / 255;
513
514                    // assume sRGB
515                    r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);
516                    g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
517                    b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
518
519                    var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
520                    var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
521                    var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
522
523                    return [x * 100, y * 100, z * 100];
524                };
525
526                convert.rgb.lab = function (rgb) {
527                    var xyz = convert.rgb.xyz(rgb);
528                    var x = xyz[0];
529                    var y = xyz[1];
530                    var z = xyz[2];
531                    var l;
532                    var a;
533                    var b;
534
535                    x /= 95.047;
536                    y /= 100;
537                    z /= 108.883;
538
539                    x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
540                    y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
541                    z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
542
543                    l = (116 * y) - 16;
544                    a = 500 * (x - y);
545                    b = 200 * (y - z);
546
547                    return [l, a, b];
548                };
549
550                convert.hsl.rgb = function (hsl) {
551                    var h = hsl[0] / 360;
552                    var s = hsl[1] / 100;
553                    var l = hsl[2] / 100;
554                    var t1;
555                    var t2;
556                    var t3;
557                    var rgb;
558                    var val;
559
560                    if (s === 0) {
561                        val = l * 255;
562                        return [val, val, val];
563                    }
564
565                    if (l < 0.5) {
566                        t2 = l * (1 + s);
567                    } else {
568                        t2 = l + s - l * s;
569                    }
570
571                    t1 = 2 * l - t2;
572
573                    rgb = [0, 0, 0];
574                    for (var i = 0; i < 3; i++) {
575                        t3 = h + 1 / 3 * -(i - 1);
576                        if (t3 < 0) {
577                            t3++;
578                        }
579                        if (t3 > 1) {
580                            t3--;
581                        }
582
583                        if (6 * t3 < 1) {
584                            val = t1 + (t2 - t1) * 6 * t3;
585                        } else if (2 * t3 < 1) {
586                            val = t2;
587                        } else if (3 * t3 < 2) {
588                            val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
589                        } else {
590                            val = t1;
591                        }
592
593                        rgb[i] = val * 255;
594                    }
595
596                    return rgb;
597                };
598
599                convert.hsl.hsv = function (hsl) {
600                    var h = hsl[0];
601                    var s = hsl[1] / 100;
602                    var l = hsl[2] / 100;
603                    var smin = s;
604                    var lmin = Math.max(l, 0.01);
605                    var sv;
606                    var v;
607
608                    l *= 2;
609                    s *= (l <= 1) ? l : 2 - l;
610                    smin *= lmin <= 1 ? lmin : 2 - lmin;
611                    v = (l + s) / 2;
612                    sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
613
614                    return [h, sv * 100, v * 100];
615                };
616
617                convert.hsv.rgb = function (hsv) {
618                    var h = hsv[0] / 60;
619                    var s = hsv[1] / 100;
620                    var v = hsv[2] / 100;
621                    var hi = Math.floor(h) % 6;
622
623                    var f = h - Math.floor(h);
624                    var p = 255 * v * (1 - s);
625                    var q = 255 * v * (1 - (s * f));
626                    var t = 255 * v * (1 - (s * (1 - f)));
627                    v *= 255;
628
629                    switch (hi) {
630                        case 0:
631                            return [v, t, p];
632                        case 1:
633                            return [q, v, p];
634                        case 2:
635                            return [p, v, t];
636                        case 3:
637                            return [p, q, v];
638                        case 4:
639                            return [t, p, v];
640                        case 5:
641                            return [v, p, q];
642                    }
643                };
644
645                convert.hsv.hsl = function (hsv) {
646                    var h = hsv[0];
647                    var s = hsv[1] / 100;
648                    var v = hsv[2] / 100;
649                    var vmin = Math.max(v, 0.01);
650                    var lmin;
651                    var sl;
652                    var l;
653
654                    l = (2 - s) * v;
655                    lmin = (2 - s) * vmin;
656                    sl = s * vmin;
657                    sl /= (lmin <= 1) ? lmin : 2 - lmin;
658                    sl = sl || 0;
659                    l /= 2;
660
661                    return [h, sl * 100, l * 100];
662                };
663
664// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
665                convert.hwb.rgb = function (hwb) {
666                    var h = hwb[0] / 360;
667                    var wh = hwb[1] / 100;
668                    var bl = hwb[2] / 100;
669                    var ratio = wh + bl;
670                    var i;
671                    var v;
672                    var f;
673                    var n;
674
675                    // wh + bl cant be > 1
676                    if (ratio > 1) {
677                        wh /= ratio;
678                        bl /= ratio;
679                    }
680
681                    i = Math.floor(6 * h);
682                    v = 1 - bl;
683                    f = 6 * h - i;
684
685                    if ((i & 0x01) !== 0) {
686                        f = 1 - f;
687                    }
688
689                    n = wh + f * (v - wh); // linear interpolation
690
691                    var r;
692                    var g;
693                    var b;
694                    switch (i) {
695                        default:
696                        case 6:
697                        case 0:
698                            r = v;
699                            g = n;
700                            b = wh;
701                            break;
702                        case 1:
703                            r = n;
704                            g = v;
705                            b = wh;
706                            break;
707                        case 2:
708                            r = wh;
709                            g = v;
710                            b = n;
711                            break;
712                        case 3:
713                            r = wh;
714                            g = n;
715                            b = v;
716                            break;
717                        case 4:
718                            r = n;
719                            g = wh;
720                            b = v;
721                            break;
722                        case 5:
723                            r = v;
724                            g = wh;
725                            b = n;
726                            break;
727                    }
728
729                    return [r * 255, g * 255, b * 255];
730                };
731
732                convert.cmyk.rgb = function (cmyk) {
733                    var c = cmyk[0] / 100;
734                    var m = cmyk[1] / 100;
735                    var y = cmyk[2] / 100;
736                    var k = cmyk[3] / 100;
737                    var r;
738                    var g;
739                    var b;
740
741                    r = 1 - Math.min(1, c * (1 - k) + k);
742                    g = 1 - Math.min(1, m * (1 - k) + k);
743                    b = 1 - Math.min(1, y * (1 - k) + k);
744
745                    return [r * 255, g * 255, b * 255];
746                };
747
748                convert.xyz.rgb = function (xyz) {
749                    var x = xyz[0] / 100;
750                    var y = xyz[1] / 100;
751                    var z = xyz[2] / 100;
752                    var r;
753                    var g;
754                    var b;
755
756                    r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
757                    g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
758                    b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
759
760                    // assume sRGB
761                    r = r > 0.0031308
762                        ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)
763                        : r * 12.92;
764
765                    g = g > 0.0031308
766                        ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)
767                        : g * 12.92;
768
769                    b = b > 0.0031308
770                        ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)
771                        : b * 12.92;
772
773                    r = Math.min(Math.max(0, r), 1);
774                    g = Math.min(Math.max(0, g), 1);
775                    b = Math.min(Math.max(0, b), 1);
776
777                    return [r * 255, g * 255, b * 255];
778                };
779
780                convert.xyz.lab = function (xyz) {
781                    var x = xyz[0];
782                    var y = xyz[1];
783                    var z = xyz[2];
784                    var l;
785                    var a;
786                    var b;
787
788                    x /= 95.047;
789                    y /= 100;
790                    z /= 108.883;
791
792                    x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
793                    y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
794                    z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
795
796                    l = (116 * y) - 16;
797                    a = 500 * (x - y);
798                    b = 200 * (y - z);
799
800                    return [l, a, b];
801                };
802
803                convert.lab.xyz = function (lab) {
804                    var l = lab[0];
805                    var a = lab[1];
806                    var b = lab[2];
807                    var x;
808                    var y;
809                    var z;
810
811                    y = (l + 16) / 116;
812                    x = a / 500 + y;
813                    z = y - b / 200;
814
815                    var y2 = Math.pow(y, 3);
816                    var x2 = Math.pow(x, 3);
817                    var z2 = Math.pow(z, 3);
818                    y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
819                    x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
820                    z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
821
822                    x *= 95.047;
823                    y *= 100;
824                    z *= 108.883;
825
826                    return [x, y, z];
827                };
828
829                convert.lab.lch = function (lab) {
830                    var l = lab[0];
831                    var a = lab[1];
832                    var b = lab[2];
833                    var hr;
834                    var h;
835                    var c;
836
837                    hr = Math.atan2(b, a);
838                    h = hr * 360 / 2 / Math.PI;
839
840                    if (h < 0) {
841                        h += 360;
842                    }
843
844                    c = Math.sqrt(a * a + b * b);
845
846                    return [l, c, h];
847                };
848
849                convert.lch.lab = function (lch) {
850                    var l = lch[0];
851                    var c = lch[1];
852                    var h = lch[2];
853                    var a;
854                    var b;
855                    var hr;
856
857                    hr = h / 360 * 2 * Math.PI;
858                    a = c * Math.cos(hr);
859                    b = c * Math.sin(hr);
860
861                    return [l, a, b];
862                };
863
864                convert.rgb.ansi16 = function (args) {
865                    var r = args[0];
866                    var g = args[1];
867                    var b = args[2];
868                    var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
869
870                    value = Math.round(value / 50);
871
872                    if (value === 0) {
873                        return 30;
874                    }
875
876                    var ansi = 30
877                        + ((Math.round(b / 255) << 2)
878                            | (Math.round(g / 255) << 1)
879                            | Math.round(r / 255));
880
881                    if (value === 2) {
882                        ansi += 60;
883                    }
884
885                    return ansi;
886                };
887
888                convert.hsv.ansi16 = function (args) {
889                    // optimization here; we already know the value and don't need to get
890                    // it converted for us.
891                    return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
892                };
893
894                convert.rgb.ansi256 = function (args) {
895                    var r = args[0];
896                    var g = args[1];
897                    var b = args[2];
898
899                    // we use the extended greyscale palette here, with the exception of
900                    // black and white. normal palette only has 4 greyscale shades.
901                    if (r === g && g === b) {
902                        if (r < 8) {
903                            return 16;
904                        }
905
906                        if (r > 248) {
907                            return 231;
908                        }
909
910                        return Math.round(((r - 8) / 247) * 24) + 232;
911                    }
912
913                    var ansi = 16
914                        + (36 * Math.round(r / 255 * 5))
915                        + (6 * Math.round(g / 255 * 5))
916                        + Math.round(b / 255 * 5);
917
918                    return ansi;
919                };
920
921                convert.ansi16.rgb = function (args) {
922                    var color = args % 10;
923
924                    // handle greyscale
925                    if (color === 0 || color === 7) {
926                        if (args > 50) {
927                            color += 3.5;
928                        }
929
930                        color = color / 10.5 * 255;
931
932                        return [color, color, color];
933                    }
934
935                    var mult = (~~(args > 50) + 1) * 0.5;
936                    var r = ((color & 1) * mult) * 255;
937                    var g = (((color >> 1) & 1) * mult) * 255;
938                    var b = (((color >> 2) & 1) * mult) * 255;
939
940                    return [r, g, b];
941                };
942
943                convert.ansi256.rgb = function (args) {
944                    // handle greyscale
945                    if (args >= 232) {
946                        var c = (args - 232) * 10 + 8;
947                        return [c, c, c];
948                    }
949
950                    args -= 16;
951
952                    var rem;
953                    var r = Math.floor(args / 36) / 5 * 255;
954                    var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
955                    var b = (rem % 6) / 5 * 255;
956
957                    return [r, g, b];
958                };
959
960                convert.rgb.hex = function (args) {
961                    var integer = ((Math.round(args[0]) & 0xFF) << 16)
962                        + ((Math.round(args[1]) & 0xFF) << 8)
963                        + (Math.round(args[2]) & 0xFF);
964
965                    var string = integer.toString(16).toUpperCase();
966                    return '000000'.substring(string.length) + string;
967                };
968
969                convert.hex.rgb = function (args) {
970                    var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
971                    if (!match) {
972                        return [0, 0, 0];
973                    }
974
975                    var colorString = match[0];
976
977                    if (match[0].length === 3) {
978                        colorString = colorString.split('').map(function (char) {
979                            return char + char;
980                        }).join('');
981                    }
982
983                    var integer = parseInt(colorString, 16);
984                    var r = (integer >> 16) & 0xFF;
985                    var g = (integer >> 8) & 0xFF;
986                    var b = integer & 0xFF;
987
988                    return [r, g, b];
989                };
990
991                convert.rgb.hcg = function (rgb) {
992                    var r = rgb[0] / 255;
993                    var g = rgb[1] / 255;
994                    var b = rgb[2] / 255;
995                    var max = Math.max(Math.max(r, g), b);
996                    var min = Math.min(Math.min(r, g), b);
997                    var chroma = (max - min);
998                    var grayscale;
999                    var hue;
1000
1001                    if (chroma < 1) {
1002                        grayscale = min / (1 - chroma);
1003                    } else {
1004                        grayscale = 0;
1005                    }
1006
1007                    if (chroma <= 0) {
1008                        hue = 0;
1009                    } else if (max === r) {
1010                        hue = ((g - b) / chroma) % 6;
1011                    } else if (max === g) {
1012                        hue = 2 + (b - r) / chroma;
1013                    } else {
1014                        hue = 4 + (r - g) / chroma + 4;
1015                    }
1016
1017                    hue /= 6;
1018                    hue %= 1;
1019
1020                    return [hue * 360, chroma * 100, grayscale * 100];
1021                };
1022
1023                convert.hsl.hcg = function (hsl) {
1024                    var s = hsl[1] / 100;
1025                    var l = hsl[2] / 100;
1026                    var c = 1;
1027                    var f = 0;
1028
1029                    if (l < 0.5) {
1030                        c = 2.0 * s * l;
1031                    } else {
1032                        c = 2.0 * s * (1.0 - l);
1033                    }
1034
1035                    if (c < 1.0) {
1036                        f = (l - 0.5 * c) / (1.0 - c);
1037                    }
1038
1039                    return [hsl[0], c * 100, f * 100];
1040                };
1041
1042                convert.hsv.hcg = function (hsv) {
1043                    var s = hsv[1] / 100;
1044                    var v = hsv[2] / 100;
1045
1046                    var c = s * v;
1047                    var f = 0;
1048
1049                    if (c < 1.0) {
1050                        f = (v - c) / (1 - c);
1051                    }
1052
1053                    return [hsv[0], c * 100, f * 100];
1054                };
1055
1056                convert.hcg.rgb = function (hcg) {
1057                    var h = hcg[0] / 360;
1058                    var c = hcg[1] / 100;
1059                    var g = hcg[2] / 100;
1060
1061                    if (c === 0.0) {
1062                        return [g * 255, g * 255, g * 255];
1063                    }
1064
1065                    var pure = [0, 0, 0];
1066                    var hi = (h % 1) * 6;
1067                    var v = hi % 1;
1068                    var w = 1 - v;
1069                    var mg = 0;
1070
1071                    switch (Math.floor(hi)) {
1072                        case 0:
1073                            pure[0] = 1;
1074                            pure[1] = v;
1075                            pure[2] = 0;
1076                            break;
1077                        case 1:
1078                            pure[0] = w;
1079                            pure[1] = 1;
1080                            pure[2] = 0;
1081                            break;
1082                        case 2:
1083                            pure[0] = 0;
1084                            pure[1] = 1;
1085                            pure[2] = v;
1086                            break;
1087                        case 3:
1088                            pure[0] = 0;
1089                            pure[1] = w;
1090                            pure[2] = 1;
1091                            break;
1092                        case 4:
1093                            pure[0] = v;
1094                            pure[1] = 0;
1095                            pure[2] = 1;
1096                            break;
1097                        default:
1098                            pure[0] = 1;
1099                            pure[1] = 0;
1100                            pure[2] = w;
1101                    }
1102
1103                    mg = (1.0 - c) * g;
1104
1105                    return [
1106                        (c * pure[0] + mg) * 255,
1107                        (c * pure[1] + mg) * 255,
1108                        (c * pure[2] + mg) * 255
1109                    ];
1110                };
1111
1112                convert.hcg.hsv = function (hcg) {
1113                    var c = hcg[1] / 100;
1114                    var g = hcg[2] / 100;
1115
1116                    var v = c + g * (1.0 - c);
1117                    var f = 0;
1118
1119                    if (v > 0.0) {
1120                        f = c / v;
1121                    }
1122
1123                    return [hcg[0], f * 100, v * 100];
1124                };
1125
1126                convert.hcg.hsl = function (hcg) {
1127                    var c = hcg[1] / 100;
1128                    var g = hcg[2] / 100;
1129
1130                    var l = g * (1.0 - c) + 0.5 * c;
1131                    var s = 0;
1132
1133                    if (l > 0.0 && l < 0.5) {
1134                        s = c / (2 * l);
1135                    } else if (l >= 0.5 && l < 1.0) {
1136                        s = c / (2 * (1 - l));
1137                    }
1138
1139                    return [hcg[0], s * 100, l * 100];
1140                };
1141
1142                convert.hcg.hwb = function (hcg) {
1143                    var c = hcg[1] / 100;
1144                    var g = hcg[2] / 100;
1145                    var v = c + g * (1.0 - c);
1146                    return [hcg[0], (v - c) * 100, (1 - v) * 100];
1147                };
1148
1149                convert.hwb.hcg = function (hwb) {
1150                    var w = hwb[1] / 100;
1151                    var b = hwb[2] / 100;
1152                    var v = 1 - b;
1153                    var c = v - w;
1154                    var g = 0;
1155
1156                    if (c < 1) {
1157                        g = (v - c) / (1 - c);
1158                    }
1159
1160                    return [hwb[0], c * 100, g * 100];
1161                };
1162
1163                convert.apple.rgb = function (apple) {
1164                    return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
1165                };
1166
1167                convert.rgb.apple = function (rgb) {
1168                    return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
1169                };
1170
1171                convert.gray.rgb = function (args) {
1172                    return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
1173                };
1174
1175                convert.gray.hsl = convert.gray.hsv = function (args) {
1176                    return [0, 0, args[0]];
1177                };
1178
1179                convert.gray.hwb = function (gray) {
1180                    return [0, 100, gray[0]];
1181                };
1182
1183                convert.gray.cmyk = function (gray) {
1184                    return [0, 0, 0, gray[0]];
1185                };
1186
1187                convert.gray.lab = function (gray) {
1188                    return [gray[0], 0, 0];
1189                };
1190
1191                convert.gray.hex = function (gray) {
1192                    var val = Math.round(gray[0] / 100 * 255) & 0xFF;
1193                    var integer = (val << 16) + (val << 8) + val;
1194
1195                    var string = integer.toString(16).toUpperCase();
1196                    return '000000'.substring(string.length) + string;
1197                };
1198
1199                convert.rgb.gray = function (rgb) {
1200                    var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
1201                    return [val / 255 * 100];
1202                };
1203            });
1204            var conversions_1 = conversions.rgb;
1205            var conversions_2 = conversions.hsl;
1206            var conversions_3 = conversions.hsv;
1207            var conversions_4 = conversions.hwb;
1208            var conversions_5 = conversions.cmyk;
1209            var conversions_6 = conversions.xyz;
1210            var conversions_7 = conversions.lab;
1211            var conversions_8 = conversions.lch;
1212            var conversions_9 = conversions.hex;
1213            var conversions_10 = conversions.keyword;
1214            var conversions_11 = conversions.ansi16;
1215            var conversions_12 = conversions.ansi256;
1216            var conversions_13 = conversions.hcg;
1217            var conversions_14 = conversions.apple;
1218            var conversions_15 = conversions.gray;
1219
1220            /*
1221	this function routes a model to all other models.
1222
1223	all functions that are routed have a property `.conversion` attached
1224	to the returned synthetic function. This property is an array
1225	of strings, each with the steps in between the 'from' and 'to'
1226	color models (inclusive).
1227
1228	conversions that are not possible simply are not included.
1229*/
1230
1231            function buildGraph() {
1232                var graph = {};
1233                // https://jsperf.com/object-keys-vs-for-in-with-closure/3
1234                var models = Object.keys(conversions);
1235
1236                for (var len = models.length, i = 0; i < len; i++) {
1237                    graph[models[i]] = {
1238                        // http://jsperf.com/1-vs-infinity
1239                        // micro-opt, but this is simple.
1240                        distance: -1,
1241                        parent: null
1242                    };
1243                }
1244
1245                return graph;
1246            }
1247
1248// https://en.wikipedia.org/wiki/Breadth-first_search
1249            function deriveBFS(fromModel) {
1250                var graph = buildGraph();
1251                var queue = [fromModel]; // unshift -> queue -> pop
1252
1253                graph[fromModel].distance = 0;
1254
1255                while (queue.length) {
1256                    var current = queue.pop();
1257                    var adjacents = Object.keys(conversions[current]);
1258
1259                    for (var len = adjacents.length, i = 0; i < len; i++) {
1260                        var adjacent = adjacents[i];
1261                        var node = graph[adjacent];
1262
1263                        if (node.distance === -1) {
1264                            node.distance = graph[current].distance + 1;
1265                            node.parent = current;
1266                            queue.unshift(adjacent);
1267                        }
1268                    }
1269                }
1270
1271                return graph;
1272            }
1273
1274            function link(from, to) {
1275                return function (args) {
1276                    return to(from(args));
1277                };
1278            }
1279
1280            function wrapConversion(toModel, graph) {
1281                var path = [graph[toModel].parent, toModel];
1282                var fn = conversions[graph[toModel].parent][toModel];
1283
1284                var cur = graph[toModel].parent;
1285                while (graph[cur].parent) {
1286                    path.unshift(graph[cur].parent);
1287                    fn = link(conversions[graph[cur].parent][cur], fn);
1288                    cur = graph[cur].parent;
1289                }
1290
1291                fn.conversion = path;
1292                return fn;
1293            }
1294
1295            var route = function (fromModel) {
1296                var graph = deriveBFS(fromModel);
1297                var conversion = {};
1298
1299                var models = Object.keys(graph);
1300                for (var len = models.length, i = 0; i < len; i++) {
1301                    var toModel = models[i];
1302                    var node = graph[toModel];
1303
1304                    if (node.parent === null) {
1305                        // no possible conversion, or this node is the source model.
1306                        continue;
1307                    }
1308
1309                    conversion[toModel] = wrapConversion(toModel, graph);
1310                }
1311
1312                return conversion;
1313            };
1314
1315            var convert = {};
1316
1317            var models = Object.keys(conversions);
1318
1319            function wrapRaw(fn) {
1320                var wrappedFn = function (args) {
1321                    if (args === undefined || args === null) {
1322                        return args;
1323                    }
1324
1325                    if (arguments.length > 1) {
1326                        args = Array.prototype.slice.call(arguments);
1327                    }
1328
1329                    return fn(args);
1330                };
1331
1332                // preserve .conversion property if there is one
1333                if ('conversion' in fn) {
1334                    wrappedFn.conversion = fn.conversion;
1335                }
1336
1337                return wrappedFn;
1338            }
1339
1340            function wrapRounded(fn) {
1341                var wrappedFn = function (args) {
1342                    if (args === undefined || args === null) {
1343                        return args;
1344                    }
1345
1346                    if (arguments.length > 1) {
1347                        args = Array.prototype.slice.call(arguments);
1348                    }
1349
1350                    var result = fn(args);
1351
1352                    // we're assuming the result is an array here.
1353                    // see notice in conversions.js; don't use box types
1354                    // in conversion functions.
1355                    if (typeof result === 'object') {
1356                        for (var len = result.length, i = 0; i < len; i++) {
1357                            result[i] = Math.round(result[i]);
1358                        }
1359                    }
1360
1361                    return result;
1362                };
1363
1364                // preserve .conversion property if there is one
1365                if ('conversion' in fn) {
1366                    wrappedFn.conversion = fn.conversion;
1367                }
1368
1369                return wrappedFn;
1370            }
1371
1372            models.forEach(function (fromModel) {
1373                convert[fromModel] = {};
1374
1375                Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
1376                Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
1377
1378                var routes = route(fromModel);
1379                var routeModels = Object.keys(routes);
1380
1381                routeModels.forEach(function (toModel) {
1382                    var fn = routes[toModel];
1383
1384                    convert[fromModel][toModel] = wrapRounded(fn);
1385                    convert[fromModel][toModel].raw = wrapRaw(fn);
1386                });
1387            });
1388
1389            var colorConvert = convert;
1390
1391            var colorName$1 = {
1392                "aliceblue": [240, 248, 255],
1393                "antiquewhite": [250, 235, 215],
1394                "aqua": [0, 255, 255],
1395                "aquamarine": [127, 255, 212],
1396                "azure": [240, 255, 255],
1397                "beige": [245, 245, 220],
1398                "bisque": [255, 228, 196],
1399                "black": [0, 0, 0],
1400                "blanchedalmond": [255, 235, 205],
1401                "blue": [0, 0, 255],
1402                "blueviolet": [138, 43, 226],
1403                "brown": [165, 42, 42],
1404                "burlywood": [222, 184, 135],
1405                "cadetblue": [95, 158, 160],
1406                "chartreuse": [127, 255, 0],
1407                "chocolate": [210, 105, 30],
1408                "coral": [255, 127, 80],
1409                "cornflowerblue": [100, 149, 237],
1410                "cornsilk": [255, 248, 220],
1411                "crimson": [220, 20, 60],
1412                "cyan": [0, 255, 255],
1413                "darkblue": [0, 0, 139],
1414                "darkcyan": [0, 139, 139],
1415                "darkgoldenrod": [184, 134, 11],
1416                "darkgray": [169, 169, 169],
1417                "darkgreen": [0, 100, 0],
1418                "darkgrey": [169, 169, 169],
1419                "darkkhaki": [189, 183, 107],
1420                "darkmagenta": [139, 0, 139],
1421                "darkolivegreen": [85, 107, 47],
1422                "darkorange": [255, 140, 0],
1423                "darkorchid": [153, 50, 204],
1424                "darkred": [139, 0, 0],
1425                "darksalmon": [233, 150, 122],
1426                "darkseagreen": [143, 188, 143],
1427                "darkslateblue": [72, 61, 139],
1428                "darkslategray": [47, 79, 79],
1429                "darkslategrey": [47, 79, 79],
1430                "darkturquoise": [0, 206, 209],
1431                "darkviolet": [148, 0, 211],
1432                "deeppink": [255, 20, 147],
1433                "deepskyblue": [0, 191, 255],
1434                "dimgray": [105, 105, 105],
1435                "dimgrey": [105, 105, 105],
1436                "dodgerblue": [30, 144, 255],
1437                "firebrick": [178, 34, 34],
1438                "floralwhite": [255, 250, 240],
1439                "forestgreen": [34, 139, 34],
1440                "fuchsia": [255, 0, 255],
1441                "gainsboro": [220, 220, 220],
1442                "ghostwhite": [248, 248, 255],
1443                "gold": [255, 215, 0],
1444                "goldenrod": [218, 165, 32],
1445                "gray": [128, 128, 128],
1446                "green": [0, 128, 0],
1447                "greenyellow": [173, 255, 47],
1448                "grey": [128, 128, 128],
1449                "honeydew": [240, 255, 240],
1450                "hotpink": [255, 105, 180],
1451                "indianred": [205, 92, 92],
1452                "indigo": [75, 0, 130],
1453                "ivory": [255, 255, 240],
1454                "khaki": [240, 230, 140],
1455                "lavender": [230, 230, 250],
1456                "lavenderblush": [255, 240, 245],
1457                "lawngreen": [124, 252, 0],
1458                "lemonchiffon": [255, 250, 205],
1459                "lightblue": [173, 216, 230],
1460                "lightcoral": [240, 128, 128],
1461                "lightcyan": [224, 255, 255],
1462                "lightgoldenrodyellow": [250, 250, 210],
1463                "lightgray": [211, 211, 211],
1464                "lightgreen": [144, 238, 144],
1465                "lightgrey": [211, 211, 211],
1466                "lightpink": [255, 182, 193],
1467                "lightsalmon": [255, 160, 122],
1468                "lightseagreen": [32, 178, 170],
1469                "lightskyblue": [135, 206, 250],
1470                "lightslategray": [119, 136, 153],
1471                "lightslategrey": [119, 136, 153],
1472                "lightsteelblue": [176, 196, 222],
1473                "lightyellow": [255, 255, 224],
1474                "lime": [0, 255, 0],
1475                "limegreen": [50, 205, 50],
1476                "linen": [250, 240, 230],
1477                "magenta": [255, 0, 255],
1478                "maroon": [128, 0, 0],
1479                "mediumaquamarine": [102, 205, 170],
1480                "mediumblue": [0, 0, 205],
1481                "mediumorchid": [186, 85, 211],
1482                "mediumpurple": [147, 112, 219],
1483                "mediumseagreen": [60, 179, 113],
1484                "mediumslateblue": [123, 104, 238],
1485                "mediumspringgreen": [0, 250, 154],
1486                "mediumturquoise": [72, 209, 204],
1487                "mediumvioletred": [199, 21, 133],
1488                "midnightblue": [25, 25, 112],
1489                "mintcream": [245, 255, 250],
1490                "mistyrose": [255, 228, 225],
1491                "moccasin": [255, 228, 181],
1492                "navajowhite": [255, 222, 173],
1493                "navy": [0, 0, 128],
1494                "oldlace": [253, 245, 230],
1495                "olive": [128, 128, 0],
1496                "olivedrab": [107, 142, 35],
1497                "orange": [255, 165, 0],
1498                "orangered": [255, 69, 0],
1499                "orchid": [218, 112, 214],
1500                "palegoldenrod": [238, 232, 170],
1501                "palegreen": [152, 251, 152],
1502                "paleturquoise": [175, 238, 238],
1503                "palevioletred": [219, 112, 147],
1504                "papayawhip": [255, 239, 213],
1505                "peachpuff": [255, 218, 185],
1506                "peru": [205, 133, 63],
1507                "pink": [255, 192, 203],
1508                "plum": [221, 160, 221],
1509                "powderblue": [176, 224, 230],
1510                "purple": [128, 0, 128],
1511                "rebeccapurple": [102, 51, 153],
1512                "red": [255, 0, 0],
1513                "rosybrown": [188, 143, 143],
1514                "royalblue": [65, 105, 225],
1515                "saddlebrown": [139, 69, 19],
1516                "salmon": [250, 128, 114],
1517                "sandybrown": [244, 164, 96],
1518                "seagreen": [46, 139, 87],
1519                "seashell": [255, 245, 238],
1520                "sienna": [160, 82, 45],
1521                "silver": [192, 192, 192],
1522                "skyblue": [135, 206, 235],
1523                "slateblue": [106, 90, 205],
1524                "slategray": [112, 128, 144],
1525                "slategrey": [112, 128, 144],
1526                "snow": [255, 250, 250],
1527                "springgreen": [0, 255, 127],
1528                "steelblue": [70, 130, 180],
1529                "tan": [210, 180, 140],
1530                "teal": [0, 128, 128],
1531                "thistle": [216, 191, 216],
1532                "tomato": [255, 99, 71],
1533                "turquoise": [64, 224, 208],
1534                "violet": [238, 130, 238],
1535                "wheat": [245, 222, 179],
1536                "white": [255, 255, 255],
1537                "whitesmoke": [245, 245, 245],
1538                "yellow": [255, 255, 0],
1539                "yellowgreen": [154, 205, 50]
1540            };
1541
1542            /* MIT license */
1543
1544
1545            var colorString = {
1546                getRgba: getRgba,
1547                getHsla: getHsla,
1548                getRgb: getRgb,
1549                getHsl: getHsl,
1550                getHwb: getHwb,
1551                getAlpha: getAlpha,
1552
1553                hexString: hexString,
1554                rgbString: rgbString,
1555                rgbaString: rgbaString,
1556                percentString: percentString,
1557                percentaString: percentaString,
1558                hslString: hslString,
1559                hslaString: hslaString,
1560                hwbString: hwbString,
1561                keyword: keyword
1562            };
1563
1564            function getRgba(string) {
1565                if (!string) {
1566                    return;
1567                }
1568                var abbr = /^#([a-fA-F0-9]{3,4})$/i,
1569                    hex = /^#([a-fA-F0-9]{6}([a-fA-F0-9]{2})?)$/i,
1570                    rgba = /^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i,
1571                    per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i,
1572                    keyword = /(\w+)/;
1573
1574                var rgb = [0, 0, 0],
1575                    a = 1,
1576                    match = string.match(abbr),
1577                    hexAlpha = "";
1578                if (match) {
1579                    match = match[1];
1580                    hexAlpha = match[3];
1581                    for (var i = 0; i < rgb.length; i++) {
1582                        rgb[i] = parseInt(match[i] + match[i], 16);
1583                    }
1584                    if (hexAlpha) {
1585                        a = Math.round((parseInt(hexAlpha + hexAlpha, 16) / 255) * 100) / 100;
1586                    }
1587                } else if (match = string.match(hex)) {
1588                    hexAlpha = match[2];
1589                    match = match[1];
1590                    for (var i = 0; i < rgb.length; i++) {
1591                        rgb[i] = parseInt(match.slice(i * 2, i * 2 + 2), 16);
1592                    }
1593                    if (hexAlpha) {
1594                        a = Math.round((parseInt(hexAlpha, 16) / 255) * 100) / 100;
1595                    }
1596                } else if (match = string.match(rgba)) {
1597                    for (var i = 0; i < rgb.length; i++) {
1598                        rgb[i] = parseInt(match[i + 1]);
1599                    }
1600                    a = parseFloat(match[4]);
1601                } else if (match = string.match(per)) {
1602                    for (var i = 0; i < rgb.length; i++) {
1603                        rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
1604                    }
1605                    a = parseFloat(match[4]);
1606                } else if (match = string.match(keyword)) {
1607                    if (match[1] == "transparent") {
1608                        return [0, 0, 0, 0];
1609                    }
1610                    rgb = colorName$1[match[1]];
1611                    if (!rgb) {
1612                        return;
1613                    }
1614                }
1615
1616                for (var i = 0; i < rgb.length; i++) {
1617                    rgb[i] = scale(rgb[i], 0, 255);
1618                }
1619                if (!a && a != 0) {
1620                    a = 1;
1621                } else {
1622                    a = scale(a, 0, 1);
1623                }
1624                rgb[3] = a;
1625                return rgb;
1626            }
1627
1628            function getHsla(string) {
1629                if (!string) {
1630                    return;
1631                }
1632                var hsl = /^hsla?\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/;
1633                var match = string.match(hsl);
1634                if (match) {
1635                    var alpha = parseFloat(match[4]);
1636                    var h = scale(parseInt(match[1]), 0, 360),
1637                        s = scale(parseFloat(match[2]), 0, 100),
1638                        l = scale(parseFloat(match[3]), 0, 100),
1639                        a = scale(isNaN(alpha) ? 1 : alpha, 0, 1);
1640                    return [h, s, l, a];
1641                }
1642            }
1643
1644            function getHwb(string) {
1645                if (!string) {
1646                    return;
1647                }
1648                var hwb = /^hwb\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/;
1649                var match = string.match(hwb);
1650                if (match) {
1651                    var alpha = parseFloat(match[4]);
1652                    var h = scale(parseInt(match[1]), 0, 360),
1653                        w = scale(parseFloat(match[2]), 0, 100),
1654                        b = scale(parseFloat(match[3]), 0, 100),
1655                        a = scale(isNaN(alpha) ? 1 : alpha, 0, 1);
1656                    return [h, w, b, a];
1657                }
1658            }
1659
1660            function getRgb(string) {
1661                var rgba = getRgba(string);
1662                return rgba && rgba.slice(0, 3);
1663            }
1664
1665            function getHsl(string) {
1666                var hsla = getHsla(string);
1667                return hsla && hsla.slice(0, 3);
1668            }
1669
1670            function getAlpha(string) {
1671                var vals = getRgba(string);
1672                if (vals) {
1673                    return vals[3];
1674                } else if (vals = getHsla(string)) {
1675                    return vals[3];
1676                } else if (vals = getHwb(string)) {
1677                    return vals[3];
1678                }
1679            }
1680
1681// generators
1682            function hexString(rgba, a) {
1683                var a = (a !== undefined && rgba.length === 3) ? a : rgba[3];
1684                return "#" + hexDouble(rgba[0])
1685                    + hexDouble(rgba[1])
1686                    + hexDouble(rgba[2])
1687                    + (
1688                        (a >= 0 && a < 1)
1689                            ? hexDouble(Math.round(a * 255))
1690                            : ""
1691                    );
1692            }
1693
1694            function rgbString(rgba, alpha) {
1695                if (alpha < 1 || (rgba[3] && rgba[3] < 1)) {
1696                    return rgbaString(rgba, alpha);
1697                }
1698                return "rgb(" + rgba[0] + ", " + rgba[1] + ", " + rgba[2] + ")";
1699            }
1700
1701            function rgbaString(rgba, alpha) {
1702                if (alpha === undefined) {
1703                    alpha = (rgba[3] !== undefined ? rgba[3] : 1);
1704                }
1705                return "rgba(" + rgba[0] + ", " + rgba[1] + ", " + rgba[2]
1706                    + ", " + alpha + ")";
1707            }
1708
1709            function percentString(rgba, alpha) {
1710                if (alpha < 1 || (rgba[3] && rgba[3] < 1)) {
1711                    return percentaString(rgba, alpha);
1712                }
1713                var r = Math.round(rgba[0] / 255 * 100),
1714                    g = Math.round(rgba[1] / 255 * 100),
1715                    b = Math.round(rgba[2] / 255 * 100);
1716
1717                return "rgb(" + r + "%, " + g + "%, " + b + "%)";
1718            }
1719
1720            function percentaString(rgba, alpha) {
1721                var r = Math.round(rgba[0] / 255 * 100),
1722                    g = Math.round(rgba[1] / 255 * 100),
1723                    b = Math.round(rgba[2] / 255 * 100);
1724                return "rgba(" + r + "%, " + g + "%, " + b + "%, " + (alpha || rgba[3] || 1) + ")";
1725            }
1726
1727            function hslString(hsla, alpha) {
1728                if (alpha < 1 || (hsla[3] && hsla[3] < 1)) {
1729                    return hslaString(hsla, alpha);
1730                }
1731                return "hsl(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%)";
1732            }
1733
1734            function hslaString(hsla, alpha) {
1735                if (alpha === undefined) {
1736                    alpha = (hsla[3] !== undefined ? hsla[3] : 1);
1737                }
1738                return "hsla(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%, "
1739                    + alpha + ")";
1740            }
1741
1742// hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax
1743// (hwb have alpha optional & 1 is default value)
1744            function hwbString(hwb, alpha) {
1745                if (alpha === undefined) {
1746                    alpha = (hwb[3] !== undefined ? hwb[3] : 1);
1747                }
1748                return "hwb(" + hwb[0] + ", " + hwb[1] + "%, " + hwb[2] + "%"
1749                    + (alpha !== undefined && alpha !== 1 ? ", " + alpha : "") + ")";
1750            }
1751
1752            function keyword(rgb) {
1753                return reverseNames[rgb.slice(0, 3)];
1754            }
1755
1756// helpers
1757            function scale(num, min, max) {
1758                return Math.min(Math.max(min, num), max);
1759            }
1760
1761            function hexDouble(num) {
1762                var str = num.toString(16).toUpperCase();
1763                return (str.length < 2) ? "0" + str : str;
1764            }
1765
1766
1767//create a list of reverse color names
1768            var reverseNames = {};
1769            for (var name in colorName$1) {
1770                reverseNames[colorName$1[name]] = name;
1771            }
1772
1773            /* MIT license */
1774
1775
1776            var Color = function (obj) {
1777                if (obj instanceof Color) {
1778                    return obj;
1779                }
1780                if (!(this instanceof Color)) {
1781                    return new Color(obj);
1782                }
1783
1784                this.valid = false;
1785                this.values = {
1786                    rgb: [0, 0, 0],
1787                    hsl: [0, 0, 0],
1788                    hsv: [0, 0, 0],
1789                    hwb: [0, 0, 0],
1790                    cmyk: [0, 0, 0, 0],
1791                    alpha: 1
1792                };
1793
1794                // parse Color() argument
1795                var vals;
1796                if (typeof obj === 'string') {
1797                    vals = colorString.getRgba(obj);
1798                    if (vals) {
1799                        this.setValues('rgb', vals);
1800                    } else if (vals = colorString.getHsla(obj)) {
1801                        this.setValues('hsl', vals);
1802                    } else if (vals = colorString.getHwb(obj)) {
1803                        this.setValues('hwb', vals);
1804                    }
1805                } else if (typeof obj === 'object') {
1806                    vals = obj;
1807                    if (vals.r !== undefined || vals.red !== undefined) {
1808                        this.setValues('rgb', vals);
1809                    } else if (vals.l !== undefined || vals.lightness !== undefined) {
1810                        this.setValues('hsl', vals);
1811                    } else if (vals.v !== undefined || vals.value !== undefined) {
1812                        this.setValues('hsv', vals);
1813                    } else if (vals.w !== undefined || vals.whiteness !== undefined) {
1814                        this.setValues('hwb', vals);
1815                    } else if (vals.c !== undefined || vals.cyan !== undefined) {
1816                        this.setValues('cmyk', vals);
1817                    }
1818                }
1819            };
1820
1821            Color.prototype = {
1822                isValid: function () {
1823                    return this.valid;
1824                },
1825                rgb: function () {
1826                    return this.setSpace('rgb', arguments);
1827                },
1828                hsl: function () {
1829                    return this.setSpace('hsl', arguments);
1830                },
1831                hsv: function () {
1832                    return this.setSpace('hsv', arguments);
1833                },
1834                hwb: function () {
1835                    return this.setSpace('hwb', arguments);
1836                },
1837                cmyk: function () {
1838                    return this.setSpace('cmyk', arguments);
1839                },
1840
1841                rgbArray: function () {
1842                    return this.values.rgb;
1843                },
1844                hslArray: function () {
1845                    return this.values.hsl;
1846                },
1847                hsvArray: function () {
1848                    return this.values.hsv;
1849                },
1850                hwbArray: function () {
1851                    var values = this.values;
1852                    if (values.alpha !== 1) {
1853                        return values.hwb.concat([values.alpha]);
1854                    }
1855                    return values.hwb;
1856                },
1857                cmykArray: function () {
1858                    return this.values.cmyk;
1859                },
1860                rgbaArray: function () {
1861                    var values = this.values;
1862                    return values.rgb.concat([values.alpha]);
1863                },
1864                hslaArray: function () {
1865                    var values = this.values;
1866                    return values.hsl.concat([values.alpha]);
1867                },
1868                alpha: function (val) {
1869                    if (val === undefined) {
1870                        return this.values.alpha;
1871                    }
1872                    this.setValues('alpha', val);
1873                    return this;
1874                },
1875
1876                red: function (val) {
1877                    return this.setChannel('rgb', 0, val);
1878                },
1879                green: function (val) {
1880                    return this.setChannel('rgb', 1, val);
1881                },
1882                blue: function (val) {
1883                    return this.setChannel('rgb', 2, val);
1884                },
1885                hue: function (val) {
1886                    if (val) {
1887                        val %= 360;
1888                        val = val < 0 ? 360 + val : val;
1889                    }
1890                    return this.setChannel('hsl', 0, val);
1891                },
1892                saturation: function (val) {
1893                    return this.setChannel('hsl', 1, val);
1894                },
1895                lightness: function (val) {
1896                    return this.setChannel('hsl', 2, val);
1897                },
1898                saturationv: function (val) {
1899                    return this.setChannel('hsv', 1, val);
1900                },
1901                whiteness: function (val) {
1902                    return this.setChannel('hwb', 1, val);
1903                },
1904                blackness: function (val) {
1905                    return this.setChannel('hwb', 2, val);
1906                },
1907                value: function (val) {
1908                    return this.setChannel('hsv', 2, val);
1909                },
1910                cyan: function (val) {
1911                    return this.setChannel('cmyk', 0, val);
1912                },
1913                magenta: function (val) {
1914                    return this.setChannel('cmyk', 1, val);
1915                },
1916                yellow: function (val) {
1917                    return this.setChannel('cmyk', 2, val);
1918                },
1919                black: function (val) {
1920                    return this.setChannel('cmyk', 3, val);
1921                },
1922
1923                hexString: function () {
1924                    return colorString.hexString(this.values.rgb);
1925                },
1926                rgbString: function () {
1927                    return colorString.rgbString(this.values.rgb, this.values.alpha);
1928                },
1929                rgbaString: function () {
1930                    return colorString.rgbaString(this.values.rgb, this.values.alpha);
1931                },
1932                percentString: function () {
1933                    return colorString.percentString(this.values.rgb, this.values.alpha);
1934                },
1935                hslString: function () {
1936                    return colorString.hslString(this.values.hsl, this.values.alpha);
1937                },
1938                hslaString: function () {
1939                    return colorString.hslaString(this.values.hsl, this.values.alpha);
1940                },
1941                hwbString: function () {
1942                    return colorString.hwbString(this.values.hwb, this.values.alpha);
1943                },
1944                keyword: function () {
1945                    return colorString.keyword(this.values.rgb, this.values.alpha);
1946                },
1947
1948                rgbNumber: function () {
1949                    var rgb = this.values.rgb;
1950                    return (rgb[0] << 16) | (rgb[1] << 8) | rgb[2];
1951                },
1952
1953                luminosity: function () {
1954                    // http://www.w3.org/TR/WCAG20/#relativeluminancedef
1955                    var rgb = this.values.rgb;
1956                    var lum = [];
1957                    for (var i = 0; i < rgb.length; i++) {
1958                        var chan = rgb[i] / 255;
1959                        lum[i] = (chan <= 0.03928) ? chan / 12.92 : Math.pow(((chan + 0.055) / 1.055), 2.4);
1960                    }
1961                    return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
1962                },
1963
1964                contrast: function (color2) {
1965                    // http://www.w3.org/TR/WCAG20/#contrast-ratiodef
1966                    var lum1 = this.luminosity();
1967                    var lum2 = color2.luminosity();
1968                    if (lum1 > lum2) {
1969                        return (lum1 + 0.05) / (lum2 + 0.05);
1970                    }
1971                    return (lum2 + 0.05) / (lum1 + 0.05);
1972                },
1973
1974                level: function (color2) {
1975                    var contrastRatio = this.contrast(color2);
1976                    if (contrastRatio >= 7.1) {
1977                        return 'AAA';
1978                    }
1979
1980                    return (contrastRatio >= 4.5) ? 'AA' : '';
1981                },
1982
1983                dark: function () {
1984                    // YIQ equation from http://24ways.org/2010/calculating-color-contrast
1985                    var rgb = this.values.rgb;
1986                    var yiq = (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000;
1987                    return yiq < 128;
1988                },
1989
1990                light: function () {
1991                    return !this.dark();
1992                },
1993
1994                negate: function () {
1995                    var rgb = [];
1996                    for (var i = 0; i < 3; i++) {
1997                        rgb[i] = 255 - this.values.rgb[i];
1998                    }
1999                    this.setValues('rgb', rgb);
2000                    return this;
2001                },
2002
2003                lighten: function (ratio) {
2004                    var hsl = this.values.hsl;
2005                    hsl[2] += hsl[2] * ratio;
2006                    this.setValues('hsl', hsl);
2007                    return this;
2008                },
2009
2010                darken: function (ratio) {
2011                    var hsl = this.values.hsl;
2012                    hsl[2] -= hsl[2] * ratio;
2013                    this.setValues('hsl', hsl);
2014                    return this;
2015                },
2016
2017                saturate: function (ratio) {
2018                    var hsl = this.values.hsl;
2019                    hsl[1] += hsl[1] * ratio;
2020                    this.setValues('hsl', hsl);
2021                    return this;
2022                },
2023
2024                desaturate: function (ratio) {
2025                    var hsl = this.values.hsl;
2026                    hsl[1] -= hsl[1] * ratio;
2027                    this.setValues('hsl', hsl);
2028                    return this;
2029                },
2030
2031                whiten: function (ratio) {
2032                    var hwb = this.values.hwb;
2033                    hwb[1] += hwb[1] * ratio;
2034                    this.setValues('hwb', hwb);
2035                    return this;
2036                },
2037
2038                blacken: function (ratio) {
2039                    var hwb = this.values.hwb;
2040                    hwb[2] += hwb[2] * ratio;
2041                    this.setValues('hwb', hwb);
2042                    return this;
2043                },
2044
2045                greyscale: function () {
2046                    var rgb = this.values.rgb;
2047                    // http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
2048                    var val = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
2049                    this.setValues('rgb', [val, val, val]);
2050                    return this;
2051                },
2052
2053                clearer: function (ratio) {
2054                    var alpha = this.values.alpha;
2055                    this.setValues('alpha', alpha - (alpha * ratio));
2056                    return this;
2057                },
2058
2059                opaquer: function (ratio) {
2060                    var alpha = this.values.alpha;
2061                    this.setValues('alpha', alpha + (alpha * ratio));
2062                    return this;
2063                },
2064
2065                rotate: function (degrees) {
2066                    var hsl = this.values.hsl;
2067                    var hue = (hsl[0] + degrees) % 360;
2068                    hsl[0] = hue < 0 ? 360 + hue : hue;
2069                    this.setValues('hsl', hsl);
2070                    return this;
2071                },
2072
2073                /**
2074                 * Ported from sass implementation in C
2075                 * https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
2076                 */
2077                mix: function (mixinColor, weight) {
2078                    var color1 = this;
2079                    var color2 = mixinColor;
2080                    var p = weight === undefined ? 0.5 : weight;
2081
2082                    var w = 2 * p - 1;
2083                    var a = color1.alpha() - color2.alpha();
2084
2085                    var w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
2086                    var w2 = 1 - w1;
2087
2088                    return this
2089                        .rgb(
2090                            w1 * color1.red() + w2 * color2.red(),
2091                            w1 * color1.green() + w2 * color2.green(),
2092                            w1 * color1.blue() + w2 * color2.blue()
2093                        )
2094                        .alpha(color1.alpha() * p + color2.alpha() * (1 - p));
2095                },
2096
2097                toJSON: function () {
2098                    return this.rgb();
2099                },
2100
2101                clone: function () {
2102                    // NOTE(SB): using node-clone creates a dependency to Buffer when using browserify,
2103                    // making the final build way to big to embed in Chart.js. So let's do it manually,
2104                    // assuming that values to clone are 1 dimension arrays containing only numbers,
2105                    // except 'alpha' which is a number.
2106                    var result = new Color();
2107                    var source = this.values;
2108                    var target = result.values;
2109                    var value, type;
2110
2111                    for (var prop in source) {
2112                        if (source.hasOwnProperty(prop)) {
2113                            value = source[prop];
2114                            type = ({}).toString.call(value);
2115                            if (type === '[object Array]') {
2116                                target[prop] = value.slice(0);
2117                            } else if (type === '[object Number]') {
2118                                target[prop] = value;
2119                            } else {
2120                                console.error('unexpected color value:', value);
2121                            }
2122                        }
2123                    }
2124
2125                    return result;
2126                }
2127            };
2128
2129            Color.prototype.spaces = {
2130                rgb: ['red', 'green', 'blue'],
2131                hsl: ['hue', 'saturation', 'lightness'],
2132                hsv: ['hue', 'saturation', 'value'],
2133                hwb: ['hue', 'whiteness', 'blackness'],
2134                cmyk: ['cyan', 'magenta', 'yellow', 'black']
2135            };
2136
2137            Color.prototype.maxes = {
2138                rgb: [255, 255, 255],
2139                hsl: [360, 100, 100],
2140                hsv: [360, 100, 100],
2141                hwb: [360, 100, 100],
2142                cmyk: [100, 100, 100, 100]
2143            };
2144
2145            Color.prototype.getValues = function (space) {
2146                var values = this.values;
2147                var vals = {};
2148
2149                for (var i = 0; i < space.length; i++) {
2150                    vals[space.charAt(i)] = values[space][i];
2151                }
2152
2153                if (values.alpha !== 1) {
2154                    vals.a = values.alpha;
2155                }
2156
2157                // {r: 255, g: 255, b: 255, a: 0.4}
2158                return vals;
2159            };
2160
2161            Color.prototype.setValues = function (space, vals) {
2162                var values = this.values;
2163                var spaces = this.spaces;
2164                var maxes = this.maxes;
2165                var alpha = 1;
2166                var i;
2167
2168                this.valid = true;
2169
2170                if (space === 'alpha') {
2171                    alpha = vals;
2172                } else if (vals.length) {
2173                    // [10, 10, 10]
2174                    values[space] = vals.slice(0, space.length);
2175                    alpha = vals[space.length];
2176                } else if (vals[space.charAt(0)] !== undefined) {
2177                    // {r: 10, g: 10, b: 10}
2178                    for (i = 0; i < space.length; i++) {
2179                        values[space][i] = vals[space.charAt(i)];
2180                    }
2181
2182                    alpha = vals.a;
2183                } else if (vals[spaces[space][0]] !== undefined) {
2184                    // {red: 10, green: 10, blue: 10}
2185                    var chans = spaces[space];
2186
2187                    for (i = 0; i < space.length; i++) {
2188                        values[space][i] = vals[chans[i]];
2189                    }
2190
2191                    alpha = vals.alpha;
2192                }
2193
2194                values.alpha = Math.max(0, Math.min(1, (alpha === undefined ? values.alpha : alpha)));
2195
2196                if (space === 'alpha') {
2197                    return false;
2198                }
2199
2200                var capped;
2201
2202                // cap values of the space prior converting all values
2203                for (i = 0; i < space.length; i++) {
2204                    capped = Math.max(0, Math.min(maxes[space][i], values[space][i]));
2205                    values[space][i] = Math.round(capped);
2206                }
2207
2208                // convert to all the other color spaces
2209                for (var sname in spaces) {
2210                    if (sname !== space) {
2211                        values[sname] = colorConvert[space][sname](values[space]);
2212                    }
2213                }
2214
2215                return true;
2216            };
2217
2218            Color.prototype.setSpace = function (space, args) {
2219                var vals = args[0];
2220
2221                if (vals === undefined) {
2222                    // color.rgb()
2223                    return this.getValues(space);
2224                }
2225
2226                // color.rgb(10, 10, 10)
2227                if (typeof vals === 'number') {
2228                    vals = Array.prototype.slice.call(args);
2229                }
2230
2231                this.setValues(space, vals);
2232                return this;
2233            };
2234
2235            Color.prototype.setChannel = function (space, index, val) {
2236                var svalues = this.values[space];
2237                if (val === undefined) {
2238                    // color.red()
2239                    return svalues[index];
2240                } else if (val === svalues[index]) {
2241                    // color.red(color.red())
2242                    return this;
2243                }
2244
2245                // color.red(100)
2246                svalues[index] = val;
2247                this.setValues(space, svalues);
2248
2249                return this;
2250            };
2251
2252            if (typeof window !== 'undefined') {
2253                window.Color = Color;
2254            }
2255
2256            var chartjsColor = Color;
2257
2258            function isValidKey(key) {
2259                return ['__proto__', 'prototype', 'constructor'].indexOf(key) === -1;
2260            }
2261
2262            /**
2263             * @namespace Chart.helpers
2264             */
2265            var helpers = {
2266                /**
2267                 * An empty function that can be used, for example, for optional callback.
2268                 */
2269                noop: function () {
2270                },
2271
2272                /**
2273                 * Returns a unique id, sequentially generated from a global variable.
2274                 * @returns {number}
2275                 * @function
2276                 */
2277                uid: (function () {
2278                    var id = 0;
2279                    return function () {
2280                        return id++;
2281                    };
2282                }()),
2283
2284                /**
2285                 * Returns true if `value` is neither null nor undefined, else returns false.
2286                 * @param {*} value - The value to test.
2287                 * @returns {boolean}
2288                 * @since 2.7.0
2289                 */
2290                isNullOrUndef: function (value) {
2291                    return value === null || typeof value === 'undefined';
2292                },
2293
2294                /**
2295                 * Returns true if `value` is an array (including typed arrays), else returns false.
2296                 * @param {*} value - The value to test.
2297                 * @returns {boolean}
2298                 * @function
2299                 */
2300                isArray: function (value) {
2301                    if (Array.isArray && Array.isArray(value)) {
2302                        return true;
2303                    }
2304                    var type = Object.prototype.toString.call(value);
2305                    if (type.substr(0, 7) === '[object' && type.substr(-6) === 'Array]') {
2306                        return true;
2307                    }
2308                    return false;
2309                },
2310
2311                /**
2312                 * Returns true if `value` is an object (excluding null), else returns false.
2313                 * @param {*} value - The value to test.
2314                 * @returns {boolean}
2315                 * @since 2.7.0
2316                 */
2317                isObject: function (value) {
2318                    return value !== null && Object.prototype.toString.call(value) === '[object Object]';
2319                },
2320
2321                /**
2322                 * Returns true if `value` is a finite number, else returns false
2323                 * @param {*} value  - The value to test.
2324                 * @returns {boolean}
2325                 */
2326                isFinite: function (value) {
2327                    return (typeof value === 'number' || value instanceof Number) && isFinite(value);
2328                },
2329
2330                /**
2331                 * Returns `value` if defined, else returns `defaultValue`.
2332                 * @param {*} value - The value to return if defined.
2333                 * @param {*} defaultValue - The value to return if `value` is undefined.
2334                 * @returns {*}
2335                 */
2336                valueOrDefault: function (value, defaultValue) {
2337                    return typeof value === 'undefined' ? defaultValue : value;
2338                },
2339
2340                /**
2341                 * Returns value at the given `index` in array if defined, else returns `defaultValue`.
2342                 * @param {Array} value - The array to lookup for value at `index`.
2343                 * @param {number} index - The index in `value` to lookup for value.
2344                 * @param {*} defaultValue - The value to return if `value[index]` is undefined.
2345                 * @returns {*}
2346                 */
2347                valueAtIndexOrDefault: function (value, index, defaultValue) {
2348                    return helpers.valueOrDefault(helpers.isArray(value) ? value[index] : value, defaultValue);
2349                },
2350
2351                /**
2352                 * Calls `fn` with the given `args` in the scope defined by `thisArg` and returns the
2353                 * value returned by `fn`. If `fn` is not a function, this method returns undefined.
2354                 * @param {function} fn - The function to call.
2355                 * @param {Array|undefined|null} args - The arguments with which `fn` should be called.
2356                 * @param {object} [thisArg] - The value of `this` provided for the call to `fn`.
2357                 * @returns {*}
2358                 */
2359                callback: function (fn, args, thisArg) {
2360                    if (fn && typeof fn.call === 'function') {
2361                        return fn.apply(thisArg, args);
2362                    }
2363                },
2364
2365                /**
2366                 * Note(SB) for performance sake, this method should only be used when loopable type
2367                 * is unknown or in none intensive code (not called often and small loopable). Else
2368                 * it's preferable to use a regular for() loop and save extra function calls.
2369                 * @param {object|Array} loopable - The object or array to be iterated.
2370                 * @param {function} fn - The function to call for each item.
2371                 * @param {object} [thisArg] - The value of `this` provided for the call to `fn`.
2372                 * @param {boolean} [reverse] - If true, iterates backward on the loopable.
2373                 */
2374                each: function (loopable, fn, thisArg, reverse) {
2375                    var i, len, keys;
2376                    if (helpers.isArray(loopable)) {
2377                        len = loopable.length;
2378                        if (reverse) {
2379                            for (i = len - 1; i >= 0; i--) {
2380                                fn.call(thisArg, loopable[i], i);
2381                            }
2382                        } else {
2383                            for (i = 0; i < len; i++) {
2384                                fn.call(thisArg, loopable[i], i);
2385                            }
2386                        }
2387                    } else if (helpers.isObject(loopable)) {
2388                        keys = Object.keys(loopable);
2389                        len = keys.length;
2390                        for (i = 0; i < len; i++) {
2391                            fn.call(thisArg, loopable[keys[i]], keys[i]);
2392                        }
2393                    }
2394                },
2395
2396                /**
2397                 * Returns true if the `a0` and `a1` arrays have the same content, else returns false.
2398                 * @see https://stackoverflow.com/a/14853974
2399                 * @param {Array} a0 - The array to compare
2400                 * @param {Array} a1 - The array to compare
2401                 * @returns {boolean}
2402                 */
2403                arrayEquals: function (a0, a1) {
2404                    var i, ilen, v0, v1;
2405
2406                    if (!a0 || !a1 || a0.length !== a1.length) {
2407                        return false;
2408                    }
2409
2410                    for (i = 0, ilen = a0.length; i < ilen; ++i) {
2411                        v0 = a0[i];
2412                        v1 = a1[i];
2413
2414                        if (v0 instanceof Array && v1 instanceof Array) {
2415                            if (!helpers.arrayEquals(v0, v1)) {
2416                                return false;
2417                            }
2418                        } else if (v0 !== v1) {
2419                            // NOTE: two different object instances will never be equal: {x:20} != {x:20}
2420                            return false;
2421                        }
2422                    }
2423
2424                    return true;
2425                },
2426
2427                /**
2428                 * Returns a deep copy of `source` without keeping references on objects and arrays.
2429                 * @param {*} source - The value to clone.
2430                 * @returns {*}
2431                 */
2432                clone: function (source) {
2433                    if (helpers.isArray(source)) {
2434                        return source.map(helpers.clone);
2435                    }
2436
2437                    if (helpers.isObject(source)) {
2438                        var target = Object.create(source);
2439                        var keys = Object.keys(source);
2440                        var klen = keys.length;
2441                        var k = 0;
2442
2443                        for (; k < klen; ++k) {
2444                            target[keys[k]] = helpers.clone(source[keys[k]]);
2445                        }
2446
2447                        return target;
2448                    }
2449
2450                    return source;
2451                },
2452
2453                /**
2454                 * The default merger when Chart.helpers.merge is called without merger option.
2455                 * Note(SB): also used by mergeConfig and mergeScaleConfig as fallback.
2456                 * @private
2457                 */
2458                _merger: function (key, target, source, options) {
2459                    if (!isValidKey(key)) {
2460                        // We want to ensure we do not copy prototypes over
2461                        // as this can pollute global namespaces
2462                        return;
2463                    }
2464
2465                    var tval = target[key];
2466                    var sval = source[key];
2467
2468                    if (helpers.isObject(tval) && helpers.isObject(sval)) {
2469                        helpers.merge(tval, sval, options);
2470                    } else {
2471                        target[key] = helpers.clone(sval);
2472                    }
2473                },
2474
2475                /**
2476                 * Merges source[key] in target[key] only if target[key] is undefined.
2477                 * @private
2478                 */
2479                _mergerIf: function (key, target, source) {
2480                    if (!isValidKey(key)) {
2481                        // We want to ensure we do not copy prototypes over
2482                        // as this can pollute global namespaces
2483                        return;
2484                    }
2485
2486                    var tval = target[key];
2487                    var sval = source[key];
2488
2489                    if (helpers.isObject(tval) && helpers.isObject(sval)) {
2490                        helpers.mergeIf(tval, sval);
2491                    } else if (!target.hasOwnProperty(key)) {
2492                        target[key] = helpers.clone(sval);
2493                    }
2494                },
2495
2496                /**
2497                 * Recursively deep copies `source` properties into `target` with the given `options`.
2498                 * IMPORTANT: `target` is not cloned and will be updated with `source` properties.
2499                 * @param {object} target - The target object in which all sources are merged into.
2500                 * @param {object|object[]} source - Object(s) to merge into `target`.
2501                 * @param {object} [options] - Merging options:
2502                 * @param {function} [options.merger] - The merge method (key, target, source, options)
2503                 * @returns {object} The `target` object.
2504                 */
2505                merge: function (target, source, options) {
2506                    var sources = helpers.isArray(source) ? source : [source];
2507                    var ilen = sources.length;
2508                    var merge, i, keys, klen, k;
2509
2510                    if (!helpers.isObject(target)) {
2511                        return target;
2512                    }
2513
2514                    options = options || {};
2515                    merge = options.merger || helpers._merger;
2516
2517                    for (i = 0; i < ilen; ++i) {
2518                        source = sources[i];
2519                        if (!helpers.isObject(source)) {
2520                            continue;
2521                        }
2522
2523                        keys = Object.keys(source);
2524                        for (k = 0, klen = keys.length; k < klen; ++k) {
2525                            merge(keys[k], target, source, options);
2526                        }
2527                    }
2528
2529                    return target;
2530                },
2531
2532                /**
2533                 * Recursively deep copies `source` properties into `target` *only* if not defined in target.
2534                 * IMPORTANT: `target` is not cloned and will be updated with `source` properties.
2535                 * @param {object} target - The target object in which all sources are merged into.
2536                 * @param {object|object[]} source - Object(s) to merge into `target`.
2537                 * @returns {object} The `target` object.
2538                 */
2539                mergeIf: function (target, source) {
2540                    return helpers.merge(target, source, {merger: helpers._mergerIf});
2541                },
2542
2543                /**
2544                 * Applies the contents of two or more objects together into the first object.
2545                 * @param {object} target - The target object in which all objects are merged into.
2546                 * @param {object} arg1 - Object containing additional properties to merge in target.
2547                 * @param {object} argN - Additional objects containing properties to merge in target.
2548                 * @returns {object} The `target` object.
2549                 */
2550                extend: Object.assign || function (target) {
2551                    return helpers.merge(target, [].slice.call(arguments, 1), {
2552                        merger: function (key, dst, src) {
2553                            dst[key] = src[key];
2554                        }
2555                    });
2556                },
2557
2558                /**
2559                 * Basic javascript inheritance based on the model created in Backbone.js
2560                 */
2561                inherits: function (extensions) {
2562                    var me = this;
2563                    var ChartElement = (extensions && extensions.hasOwnProperty('constructor')) ? extensions.constructor : function () {
2564                        return me.apply(this, arguments);
2565                    };
2566
2567                    var Surrogate = function () {
2568                        this.constructor = ChartElement;
2569                    };
2570
2571                    Surrogate.prototype = me.prototype;
2572                    ChartElement.prototype = new Surrogate();
2573                    ChartElement.extend = helpers.inherits;
2574
2575                    if (extensions) {
2576                        helpers.extend(ChartElement.prototype, extensions);
2577                    }
2578
2579                    ChartElement.__super__ = me.prototype;
2580                    return ChartElement;
2581                },
2582
2583                _deprecated: function (scope, value, previous, current) {
2584                    if (value !== undefined) {
2585                        console.warn(scope + ': "' + previous +
2586                            '" is deprecated. Please use "' + current + '" instead');
2587                    }
2588                }
2589            };
2590
2591            var helpers_core = helpers;
2592
2593// DEPRECATIONS
2594
2595            /**
2596             * Provided for backward compatibility, use Chart.helpers.callback instead.
2597             * @function Chart.helpers.callCallback
2598             * @deprecated since version 2.6.0
2599             * @todo remove at version 3
2600             * @private
2601             */
2602            helpers.callCallback = helpers.callback;
2603
2604            /**
2605             * Provided for backward compatibility, use Array.prototype.indexOf instead.
2606             * Array.prototype.indexOf compatibility: Chrome, Opera, Safari, FF1.5+, IE9+
2607             * @function Chart.helpers.indexOf
2608             * @deprecated since version 2.7.0
2609             * @todo remove at version 3
2610             * @private
2611             */
2612            helpers.indexOf = function (array, item, fromIndex) {
2613                return Array.prototype.indexOf.call(array, item, fromIndex);
2614            };
2615
2616            /**
2617             * Provided for backward compatibility, use Chart.helpers.valueOrDefault instead.
2618             * @function Chart.helpers.getValueOrDefault
2619             * @deprecated since version 2.7.0
2620             * @todo remove at version 3
2621             * @private
2622             */
2623            helpers.getValueOrDefault = helpers.valueOrDefault;
2624
2625            /**
2626             * Provided for backward compatibility, use Chart.helpers.valueAtIndexOrDefault instead.
2627             * @function Chart.helpers.getValueAtIndexOrDefault
2628             * @deprecated since version 2.7.0
2629             * @todo remove at version 3
2630             * @private
2631             */
2632            helpers.getValueAtIndexOrDefault = helpers.valueAtIndexOrDefault;
2633
2634            /**
2635             * Easing functions adapted from Robert Penner's easing equations.
2636             * @namespace Chart.helpers.easingEffects
2637             * @see http://www.robertpenner.com/easing/
2638             */
2639            var effects = {
2640                linear: function (t) {
2641                    return t;
2642                },
2643
2644                easeInQuad: function (t) {
2645                    return t * t;
2646                },
2647
2648                easeOutQuad: function (t) {
2649                    return -t * (t - 2);
2650                },
2651
2652                easeInOutQuad: function (t) {
2653                    if ((t /= 0.5) < 1) {
2654                        return 0.5 * t * t;
2655                    }
2656                    return -0.5 * ((--t) * (t - 2) - 1);
2657                },
2658
2659                easeInCubic: function (t) {
2660                    return t * t * t;
2661                },
2662
2663                easeOutCubic: function (t) {
2664                    return (t = t - 1) * t * t + 1;
2665                },
2666
2667                easeInOutCubic: function (t) {
2668                    if ((t /= 0.5) < 1) {
2669                        return 0.5 * t * t * t;
2670                    }
2671                    return 0.5 * ((t -= 2) * t * t + 2);
2672                },
2673
2674                easeInQuart: function (t) {
2675                    return t * t * t * t;
2676                },
2677
2678                easeOutQuart: function (t) {
2679                    return -((t = t - 1) * t * t * t - 1);
2680                },
2681
2682                easeInOutQuart: function (t) {
2683                    if ((t /= 0.5) < 1) {
2684                        return 0.5 * t * t * t * t;
2685                    }
2686                    return -0.5 * ((t -= 2) * t * t * t - 2);
2687                },
2688
2689                easeInQuint: function (t) {
2690                    return t * t * t * t * t;
2691                },
2692
2693                easeOutQuint: function (t) {
2694                    return (t = t - 1) * t * t * t * t + 1;
2695                },
2696
2697                easeInOutQuint: function (t) {
2698                    if ((t /= 0.5) < 1) {
2699                        return 0.5 * t * t * t * t * t;
2700                    }
2701                    return 0.5 * ((t -= 2) * t * t * t * t + 2);
2702                },
2703
2704                easeInSine: function (t) {
2705                    return -Math.cos(t * (Math.PI / 2)) + 1;
2706                },
2707
2708                easeOutSine: function (t) {
2709                    return Math.sin(t * (Math.PI / 2));
2710                },
2711
2712                easeInOutSine: function (t) {
2713                    return -0.5 * (Math.cos(Math.PI * t) - 1);
2714                },
2715
2716                easeInExpo: function (t) {
2717                    return (t === 0) ? 0 : Math.pow(2, 10 * (t - 1));
2718                },
2719
2720                easeOutExpo: function (t) {
2721                    return (t === 1) ? 1 : -Math.pow(2, -10 * t) + 1;
2722                },
2723
2724                easeInOutExpo: function (t) {
2725                    if (t === 0) {
2726                        return 0;
2727                    }
2728                    if (t === 1) {
2729                        return 1;
2730                    }
2731                    if ((t /= 0.5) < 1) {
2732                        return 0.5 * Math.pow(2, 10 * (t - 1));
2733                    }
2734                    return 0.5 * (-Math.pow(2, -10 * --t) + 2);
2735                },
2736
2737                easeInCirc: function (t) {
2738                    if (t >= 1) {
2739                        return t;
2740                    }
2741                    return -(Math.sqrt(1 - t * t) - 1);
2742                },
2743
2744                easeOutCirc: function (t) {
2745                    return Math.sqrt(1 - (t = t - 1) * t);
2746                },
2747
2748                easeInOutCirc: function (t) {
2749                    if ((t /= 0.5) < 1) {
2750                        return -0.5 * (Math.sqrt(1 - t * t) - 1);
2751                    }
2752                    return 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1);
2753                },
2754
2755                easeInElastic: function (t) {
2756                    var s = 1.70158;
2757                    var p = 0;
2758                    var a = 1;
2759                    if (t === 0) {
2760                        return 0;
2761                    }
2762                    if (t === 1) {
2763                        return 1;
2764                    }
2765                    if (!p) {
2766                        p = 0.3;
2767                    }
2768                    if (a < 1) {
2769                        a = 1;
2770                        s = p / 4;
2771                    } else {
2772                        s = p / (2 * Math.PI) * Math.asin(1 / a);
2773                    }
2774                    return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p));
2775                },
2776
2777                easeOutElastic: function (t) {
2778                    var s = 1.70158;
2779                    var p = 0;
2780                    var a = 1;
2781                    if (t === 0) {
2782                        return 0;
2783                    }
2784                    if (t === 1) {
2785                        return 1;
2786                    }
2787                    if (!p) {
2788                        p = 0.3;
2789                    }
2790                    if (a < 1) {
2791                        a = 1;
2792                        s = p / 4;
2793                    } else {
2794                        s = p / (2 * Math.PI) * Math.asin(1 / a);
2795                    }
2796                    return a * Math.pow(2, -10 * t) * Math.sin((t - s) * (2 * Math.PI) / p) + 1;
2797                },
2798
2799                easeInOutElastic: function (t) {
2800                    var s = 1.70158;
2801                    var p = 0;
2802                    var a = 1;
2803                    if (t === 0) {
2804                        return 0;
2805                    }
2806                    if ((t /= 0.5) === 2) {
2807                        return 1;
2808                    }
2809                    if (!p) {
2810                        p = 0.45;
2811                    }
2812                    if (a < 1) {
2813                        a = 1;
2814                        s = p / 4;
2815                    } else {
2816                        s = p / (2 * Math.PI) * Math.asin(1 / a);
2817                    }
2818                    if (t < 1) {
2819                        return -0.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p));
2820                    }
2821                    return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p) * 0.5 + 1;
2822                },
2823                easeInBack: function (t) {
2824                    var s = 1.70158;
2825                    return t * t * ((s + 1) * t - s);
2826                },
2827
2828                easeOutBack: function (t) {
2829                    var s = 1.70158;
2830                    return (t = t - 1) * t * ((s + 1) * t + s) + 1;
2831                },
2832
2833                easeInOutBack: function (t) {
2834                    var s = 1.70158;
2835                    if ((t /= 0.5) < 1) {
2836                        return 0.5 * (t * t * (((s *= (1.525)) + 1) * t - s));
2837                    }
2838                    return 0.5 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2);
2839                },
2840
2841                easeInBounce: function (t) {
2842                    return 1 - effects.easeOutBounce(1 - t);
2843                },
2844
2845                easeOutBounce: function (t) {
2846                    if (t < (1 / 2.75)) {
2847                        return 7.5625 * t * t;
2848                    }
2849                    if (t < (2 / 2.75)) {
2850                        return 7.5625 * (t -= (1.5 / 2.75)) * t + 0.75;
2851                    }
2852                    if (t < (2.5 / 2.75)) {
2853                        return 7.5625 * (t -= (2.25 / 2.75)) * t + 0.9375;
2854                    }
2855                    return 7.5625 * (t -= (2.625 / 2.75)) * t + 0.984375;
2856                },
2857
2858                easeInOutBounce: function (t) {
2859                    if (t < 0.5) {
2860                        return effects.easeInBounce(t * 2) * 0.5;
2861                    }
2862                    return effects.easeOutBounce(t * 2 - 1) * 0.5 + 0.5;
2863                }
2864            };
2865
2866            var helpers_easing = {
2867                effects: effects
2868            };
2869
2870// DEPRECATIONS
2871
2872            /**
2873             * Provided for backward compatibility, use Chart.helpers.easing.effects instead.
2874             * @function Chart.helpers.easingEffects
2875             * @deprecated since version 2.7.0
2876             * @todo remove at version 3
2877             * @private
2878             */
2879            helpers_core.easingEffects = effects;
2880
2881            var PI = Math.PI;
2882            var RAD_PER_DEG = PI / 180;
2883            var DOUBLE_PI = PI * 2;
2884            var HALF_PI = PI / 2;
2885            var QUARTER_PI = PI / 4;
2886            var TWO_THIRDS_PI = PI * 2 / 3;
2887
2888            /**
2889             * @namespace Chart.helpers.canvas
2890             */
2891            var exports$1 = {
2892                /**
2893                 * Clears the entire canvas associated to the given `chart`.
2894                 * @param {Chart} chart - The chart for which to clear the canvas.
2895                 */
2896                clear: function (chart) {
2897                    chart.ctx.clearRect(0, 0, chart.width, chart.height);
2898                },
2899
2900                /**
2901                 * Creates a "path" for a rectangle with rounded corners at position (x, y) with a
2902                 * given size (width, height) and the same `radius` for all corners.
2903                 * @param {CanvasRenderingContext2D} ctx - The canvas 2D Context.
2904                 * @param {number} x - The x axis of the coordinate for the rectangle starting point.
2905                 * @param {number} y - The y axis of the coordinate for the rectangle starting point.
2906                 * @param {number} width - The rectangle's width.
2907                 * @param {number} height - The rectangle's height.
2908                 * @param {number} radius - The rounded amount (in pixels) for the four corners.
2909                 * @todo handle `radius` as top-left, top-right, bottom-right, bottom-left array/object?
2910                 */
2911                roundedRect: function (ctx, x, y, width, height, radius) {
2912                    if (radius) {
2913                        var r = Math.min(radius, height / 2, width / 2);
2914                        var left = x + r;
2915                        var top = y + r;
2916                        var right = x + width - r;
2917                        var bottom = y + height - r;
2918
2919                        ctx.moveTo(x, top);
2920                        if (left < right && top < bottom) {
2921                            ctx.arc(left, top, r, -PI, -HALF_PI);
2922                            ctx.arc(right, top, r, -HALF_PI, 0);
2923                            ctx.arc(right, bottom, r, 0, HALF_PI);
2924                            ctx.arc(left, bottom, r, HALF_PI, PI);
2925                        } else if (left < right) {
2926                            ctx.moveTo(left, y);
2927                            ctx.arc(right, top, r, -HALF_PI, HALF_PI);
2928                            ctx.arc(left, top, r, HALF_PI, PI + HALF_PI);
2929                        } else if (top < bottom) {
2930                            ctx.arc(left, top, r, -PI, 0);
2931                            ctx.arc(left, bottom, r, 0, PI);
2932                        } else {
2933                            ctx.arc(left, top, r, -PI, PI);
2934                        }
2935                        ctx.closePath();
2936                        ctx.moveTo(x, y);
2937                    } else {
2938                        ctx.rect(x, y, width, height);
2939                    }
2940                },
2941
2942                drawPoint: function (ctx, style, radius, x, y, rotation) {
2943                    var type, xOffset, yOffset, size, cornerRadius;
2944                    var rad = (rotation || 0) * RAD_PER_DEG;
2945
2946                    if (style && typeof style === 'object') {
2947                        type = style.toString();
2948                        if (type === '[object HTMLImageElement]' || type === '[object HTMLCanvasElement]') {
2949                            ctx.save();
2950                            ctx.translate(x, y);
2951                            ctx.rotate(rad);
2952                            ctx.drawImage(style, -style.width / 2, -style.height / 2, style.width, style.height);
2953                            ctx.restore();
2954                            return;
2955                        }
2956                    }
2957
2958                    if (isNaN(radius) || radius <= 0) {
2959                        return;
2960                    }
2961
2962                    ctx.beginPath();
2963
2964                    switch (style) {
2965                        // Default includes circle
2966                        default:
2967                            ctx.arc(x, y, radius, 0, DOUBLE_PI);
2968                            ctx.closePath();
2969                            break;
2970                        case 'triangle':
2971                            ctx.moveTo(x + Math.sin(rad) * radius, y - Math.cos(rad) * radius);
2972                            rad += TWO_THIRDS_PI;
2973                            ctx.lineTo(x + Math.sin(rad) * radius, y - Math.cos(rad) * radius);
2974                            rad += TWO_THIRDS_PI;
2975                            ctx.lineTo(x + Math.sin(rad) * radius, y - Math.cos(rad) * radius);
2976                            ctx.closePath();
2977                            break;
2978                        case 'rectRounded':
2979                            // NOTE: the rounded rect implementation changed to use `arc` instead of
2980                            // `quadraticCurveTo` since it generates better results when rect is
2981                            // almost a circle. 0.516 (instead of 0.5) produces results with visually
2982                            // closer proportion to the previous impl and it is inscribed in the
2983                            // circle with `radius`. For more details, see the following PRs:
2984                            // https://github.com/chartjs/Chart.js/issues/5597
2985                            // https://github.com/chartjs/Chart.js/issues/5858
2986                            cornerRadius = radius * 0.516;
2987                            size = radius - cornerRadius;
2988                            xOffset = Math.cos(rad + QUARTER_PI) * size;
2989                            yOffset = Math.sin(rad + QUARTER_PI) * size;
2990                            ctx.arc(x - xOffset, y - yOffset, cornerRadius, rad - PI, rad - HALF_PI);
2991                            ctx.arc(x + yOffset, y - xOffset, cornerRadius, rad - HALF_PI, rad);
2992                            ctx.arc(x + xOffset, y + yOffset, cornerRadius, rad, rad + HALF_PI);
2993                            ctx.arc(x - yOffset, y + xOffset, cornerRadius, rad + HALF_PI, rad + PI);
2994                            ctx.closePath();
2995                            break;
2996                        case 'rect':
2997                            if (!rotation) {
2998                                size = Math.SQRT1_2 * radius;
2999                                ctx.rect(x - size, y - size, 2 * size, 2 * size);
3000                                break;
3001                            }
3002                            rad += QUARTER_PI;
3003                        /* falls through */
3004                        case 'rectRot':
3005                            xOffset = Math.cos(rad) * radius;
3006                            yOffset = Math.sin(rad) * radius;
3007                            ctx.moveTo(x - xOffset, y - yOffset);
3008                            ctx.lineTo(x + yOffset, y - xOffset);
3009                            ctx.lineTo(x + xOffset, y + yOffset);
3010                            ctx.lineTo(x - yOffset, y + xOffset);
3011                            ctx.closePath();
3012                            break;
3013                        case 'crossRot':
3014                            rad += QUARTER_PI;
3015                        /* falls through */
3016                        case 'cross':
3017                            xOffset = Math.cos(rad) * radius;
3018                            yOffset = Math.sin(rad) * radius;
3019                            ctx.moveTo(x - xOffset, y - yOffset);
3020                            ctx.lineTo(x + xOffset, y + yOffset);
3021                            ctx.moveTo(x + yOffset, y - xOffset);
3022                            ctx.lineTo(x - yOffset, y + xOffset);
3023                            break;
3024                        case 'star':
3025                            xOffset = Math.cos(rad) * radius;
3026                            yOffset = Math.sin(rad) * radius;
3027                            ctx.moveTo(x - xOffset, y - yOffset);
3028                            ctx.lineTo(x + xOffset, y + yOffset);
3029                            ctx.moveTo(x + yOffset, y - xOffset);
3030                            ctx.lineTo(x - yOffset, y + xOffset);
3031                            rad += QUARTER_PI;
3032                            xOffset = Math.cos(rad) * radius;
3033                            yOffset = Math.sin(rad) * radius;
3034                            ctx.moveTo(x - xOffset, y - yOffset);
3035                            ctx.lineTo(x + xOffset, y + yOffset);
3036                            ctx.moveTo(x + yOffset, y - xOffset);
3037                            ctx.lineTo(x - yOffset, y + xOffset);
3038                            break;
3039                        case 'line':
3040                            xOffset = Math.cos(rad) * radius;
3041                            yOffset = Math.sin(rad) * radius;
3042                            ctx.moveTo(x - xOffset, y - yOffset);
3043                            ctx.lineTo(x + xOffset, y + yOffset);
3044                            break;
3045                        case 'dash':
3046                            ctx.moveTo(x, y);
3047                            ctx.lineTo(x + Math.cos(rad) * radius, y + Math.sin(rad) * radius);
3048                            break;
3049                    }
3050
3051                    ctx.fill();
3052                    ctx.stroke();
3053                },
3054
3055                /**
3056                 * Returns true if the point is inside the rectangle
3057                 * @param {object} point - The point to test
3058                 * @param {object} area - The rectangle
3059                 * @returns {boolean}
3060                 * @private
3061                 */
3062                _isPointInArea: function (point, area) {
3063                    var epsilon = 1e-6; // 1e-6 is margin in pixels for accumulated error.
3064
3065                    return point.x > area.left - epsilon && point.x < area.right + epsilon &&
3066                        point.y > area.top - epsilon && point.y < area.bottom + epsilon;
3067                },
3068
3069                clipArea: function (ctx, area) {
3070                    ctx.save();
3071                    ctx.beginPath();
3072                    ctx.rect(area.left, area.top, area.right - area.left, area.bottom - area.top);
3073                    ctx.clip();
3074                },
3075
3076                unclipArea: function (ctx) {
3077                    ctx.restore();
3078                },
3079
3080                lineTo: function (ctx, previous, target, flip) {
3081                    var stepped = target.steppedLine;
3082                    if (stepped) {
3083                        if (stepped === 'middle') {
3084                            var midpoint = (previous.x + target.x) / 2.0;
3085                            ctx.lineTo(midpoint, flip ? target.y : previous.y);
3086                            ctx.lineTo(midpoint, flip ? previous.y : target.y);
3087                        } else if ((stepped === 'after' && !flip) || (stepped !== 'after' && flip)) {
3088                            ctx.lineTo(previous.x, target.y);
3089                        } else {
3090                            ctx.lineTo(target.x, previous.y);
3091                        }
3092                        ctx.lineTo(target.x, target.y);
3093                        return;
3094                    }
3095
3096                    if (!target.tension) {
3097                        ctx.lineTo(target.x, target.y);
3098                        return;
3099                    }
3100
3101                    ctx.bezierCurveTo(
3102                        flip ? previous.controlPointPreviousX : previous.controlPointNextX,
3103                        flip ? previous.controlPointPreviousY : previous.controlPointNextY,
3104                        flip ? target.controlPointNextX : target.controlPointPreviousX,
3105                        flip ? target.controlPointNextY : target.controlPointPreviousY,
3106                        target.x,
3107                        target.y);
3108                }
3109            };
3110
3111            var helpers_canvas = exports$1;
3112
3113// DEPRECATIONS
3114
3115            /**
3116             * Provided for backward compatibility, use Chart.helpers.canvas.clear instead.
3117             * @namespace Chart.helpers.clear
3118             * @deprecated since version 2.7.0
3119             * @todo remove at version 3
3120             * @private
3121             */
3122            helpers_core.clear = exports$1.clear;
3123
3124            /**
3125             * Provided for backward compatibility, use Chart.helpers.canvas.roundedRect instead.
3126             * @namespace Chart.helpers.drawRoundedRectangle
3127             * @deprecated since version 2.7.0
3128             * @todo remove at version 3
3129             * @private
3130             */
3131            helpers_core.drawRoundedRectangle = function (ctx) {
3132                ctx.beginPath();
3133                exports$1.roundedRect.apply(exports$1, arguments);
3134            };
3135
3136            var defaults = {
3137                /**
3138                 * @private
3139                 */
3140                _set: function (scope, values) {
3141                    return helpers_core.merge(this[scope] || (this[scope] = {}), values);
3142                }
3143            };
3144
3145// TODO(v3): remove 'global' from namespace.  all default are global and
3146// there's inconsistency around which options are under 'global'
3147            defaults._set('global', {
3148                defaultColor: 'rgba(0,0,0,0.1)',
3149                defaultFontColor: '#666',
3150                defaultFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
3151                defaultFontSize: 12,
3152                defaultFontStyle: 'normal',
3153                defaultLineHeight: 1.2,
3154                showLines: true
3155            });
3156
3157            var core_defaults = defaults;
3158
3159            var valueOrDefault = helpers_core.valueOrDefault;
3160
3161            /**
3162             * Converts the given font object into a CSS font string.
3163             * @param {object} font - A font object.
3164             * @return {string} The CSS font string. See https://developer.mozilla.org/en-US/docs/Web/CSS/font
3165             * @private
3166             */
3167            function toFontString(font) {
3168                if (!font || helpers_core.isNullOrUndef(font.size) || helpers_core.isNullOrUndef(font.family)) {
3169                    return null;
3170                }
3171
3172                return (font.style ? font.style + ' ' : '')
3173                    + (font.weight ? font.weight + ' ' : '')
3174                    + font.size + 'px '
3175                    + font.family;
3176            }
3177
3178            /**
3179             * @alias Chart.helpers.options
3180             * @namespace
3181             */
3182            var helpers_options = {
3183                /**
3184                 * Converts the given line height `value` in pixels for a specific font `size`.
3185                 * @param {number|string} value - The lineHeight to parse (eg. 1.6, '14px', '75%', '1.6em').
3186                 * @param {number} size - The font size (in pixels) used to resolve relative `value`.
3187                 * @returns {number} The effective line height in pixels (size * 1.2 if value is invalid).
3188                 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/line-height
3189                 * @since 2.7.0
3190                 */
3191                toLineHeight: function (value, size) {
3192                    var matches = ('' + value).match(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/);
3193                    if (!matches || matches[1] === 'normal') {
3194                        return size * 1.2;
3195                    }
3196
3197                    value = +matches[2];
3198
3199                    switch (matches[3]) {
3200                        case 'px':
3201                            return value;
3202                        case '%':
3203                            value /= 100;
3204                            break;
3205                    }
3206
3207                    return size * value;
3208                },
3209
3210                /**
3211                 * Converts the given value into a padding object with pre-computed width/height.
3212                 * @param {number|object} value - If a number, set the value to all TRBL component,
3213                 *  else, if and object, use defined properties and sets undefined ones to 0.
3214                 * @returns {object} The padding values (top, right, bottom, left, width, height)
3215                 * @since 2.7.0
3216                 */
3217                toPadding: function (value) {
3218                    var t, r, b, l;
3219
3220                    if (helpers_core.isObject(value)) {
3221                        t = +value.top || 0;
3222                        r = +value.right || 0;
3223                        b = +value.bottom || 0;
3224                        l = +value.left || 0;
3225                    } else {
3226                        t = r = b = l = +value || 0;
3227                    }
3228
3229                    return {
3230                        top: t,
3231                        right: r,
3232                        bottom: b,
3233                        left: l,
3234                        height: t + b,
3235                        width: l + r
3236                    };
3237                },
3238
3239                /**
3240                 * Parses font options and returns the font object.
3241                 * @param {object} options - A object that contains font options to be parsed.
3242                 * @return {object} The font object.
3243                 * @todo Support font.* options and renamed to toFont().
3244                 * @private
3245                 */
3246                _parseFont: function (options) {
3247                    var globalDefaults = core_defaults.global;
3248                    var size = valueOrDefault(options.fontSize, globalDefaults.defaultFontSize);
3249                    var font = {
3250                        family: valueOrDefault(options.fontFamily, globalDefaults.defaultFontFamily),
3251                        lineHeight: helpers_core.options.toLineHeight(valueOrDefault(options.lineHeight, globalDefaults.defaultLineHeight), size),
3252                        size: size,
3253                        style: valueOrDefault(options.fontStyle, globalDefaults.defaultFontStyle),
3254                        weight: null,
3255                        string: ''
3256                    };
3257
3258                    font.string = toFontString(font);
3259                    return font;
3260                },
3261
3262                /**
3263                 * Evaluates the given `inputs` sequentially and returns the first defined value.
3264                 * @param {Array} inputs - An array of values, falling back to the last value.
3265                 * @param {object} [context] - If defined and the current value is a function, the value
3266                 * is called with `context` as first argument and the result becomes the new input.
3267                 * @param {number} [index] - If defined and the current value is an array, the value
3268                 * at `index` become the new input.
3269                 * @param {object} [info] - object to return information about resolution in
3270                 * @param {boolean} [info.cacheable] - Will be set to `false` if option is not cacheable.
3271                 * @since 2.7.0
3272                 */
3273                resolve: function (inputs, context, index, info) {
3274                    var cacheable = true;
3275                    var i, ilen, value;
3276
3277                    for (i = 0, ilen = inputs.length; i < ilen; ++i) {
3278                        value = inputs[i];
3279                        if (value === undefined) {
3280                            continue;
3281                        }
3282                        if (context !== undefined && typeof value === 'function') {
3283                            value = value(context);
3284                            cacheable = false;
3285                        }
3286                        if (index !== undefined && helpers_core.isArray(value)) {
3287                            value = value[index];
3288                            cacheable = false;
3289                        }
3290                        if (value !== undefined) {
3291                            if (info && !cacheable) {
3292                                info.cacheable = false;
3293                            }
3294                            return value;
3295                        }
3296                    }
3297                }
3298            };
3299
3300            /**
3301             * @alias Chart.helpers.math
3302             * @namespace
3303             */
3304            var exports$2 = {
3305                /**
3306                 * Returns an array of factors sorted from 1 to sqrt(value)
3307                 * @private
3308                 */
3309                _factorize: function (value) {
3310                    var result = [];
3311                    var sqrt = Math.sqrt(value);
3312                    var i;
3313
3314                    for (i = 1; i < sqrt; i++) {
3315                        if (value % i === 0) {
3316                            result.push(i);
3317                            result.push(value / i);
3318                        }
3319                    }
3320                    if (sqrt === (sqrt | 0)) { // if value is a square number
3321                        result.push(sqrt);
3322                    }
3323
3324                    result.sort(function (a, b) {
3325                        return a - b;
3326                    }).pop();
3327                    return result;
3328                },
3329
3330                log10: Math.log10 || function (x) {
3331                    var exponent = Math.log(x) * Math.LOG10E; // Math.LOG10E = 1 / Math.LN10.
3332                    // Check for whole powers of 10,
3333                    // which due to floating point rounding error should be corrected.
3334                    var powerOf10 = Math.round(exponent);
3335                    var isPowerOf10 = x === Math.pow(10, powerOf10);
3336
3337                    return isPowerOf10 ? powerOf10 : exponent;
3338                }
3339            };
3340
3341            var helpers_math = exports$2;
3342
3343// DEPRECATIONS
3344
3345            /**
3346             * Provided for backward compatibility, use Chart.helpers.math.log10 instead.
3347             * @namespace Chart.helpers.log10
3348             * @deprecated since version 2.9.0
3349             * @todo remove at version 3
3350             * @private
3351             */
3352            helpers_core.log10 = exports$2.log10;
3353
3354            var getRtlAdapter = function (rectX, width) {
3355                return {
3356                    x: function (x) {
3357                        return rectX + rectX + width - x;
3358                    },
3359                    setWidth: function (w) {
3360                        width = w;
3361                    },
3362                    textAlign: function (align) {
3363                        if (align === 'center') {
3364                            return align;
3365                        }
3366                        return align === 'right' ? 'left' : 'right';
3367                    },
3368                    xPlus: function (x, value) {
3369                        return x - value;
3370                    },
3371                    leftForLtr: function (x, itemWidth) {
3372                        return x - itemWidth;
3373                    },
3374                };
3375            };
3376
3377            var getLtrAdapter = function () {
3378                return {
3379                    x: function (x) {
3380                        return x;
3381                    },
3382                    setWidth: function (w) { // eslint-disable-line no-unused-vars
3383                    },
3384                    textAlign: function (align) {
3385                        return align;
3386                    },
3387                    xPlus: function (x, value) {
3388                        return x + value;
3389                    },
3390                    leftForLtr: function (x, _itemWidth) { // eslint-disable-line no-unused-vars
3391                        return x;
3392                    },
3393                };
3394            };
3395
3396            var getAdapter = function (rtl, rectX, width) {
3397                return rtl ? getRtlAdapter(rectX, width) : getLtrAdapter();
3398            };
3399
3400            var overrideTextDirection = function (ctx, direction) {
3401                var style, original;
3402                if (direction === 'ltr' || direction === 'rtl') {
3403                    style = ctx.canvas.style;
3404                    original = [
3405                        style.getPropertyValue('direction'),
3406                        style.getPropertyPriority('direction'),
3407                    ];
3408
3409                    style.setProperty('direction', direction, 'important');
3410                    ctx.prevTextDirection = original;
3411                }
3412            };
3413
3414            var restoreTextDirection = function (ctx) {
3415                var original = ctx.prevTextDirection;
3416                if (original !== undefined) {
3417                    delete ctx.prevTextDirection;
3418                    ctx.canvas.style.setProperty('direction', original[0], original[1]);
3419                }
3420            };
3421
3422            var helpers_rtl = {
3423                getRtlAdapter: getAdapter,
3424                overrideTextDirection: overrideTextDirection,
3425                restoreTextDirection: restoreTextDirection,
3426            };
3427
3428            var helpers$1 = helpers_core;
3429            var easing = helpers_easing;
3430            var canvas = helpers_canvas;
3431            var options = helpers_options;
3432            var math = helpers_math;
3433            var rtl = helpers_rtl;
3434            helpers$1.easing = easing;
3435            helpers$1.canvas = canvas;
3436            helpers$1.options = options;
3437            helpers$1.math = math;
3438            helpers$1.rtl = rtl;
3439
3440            function interpolate(start, view, model, ease) {
3441                var keys = Object.keys(model);
3442                var i, ilen, key, actual, origin, target, type, c0, c1;
3443
3444                for (i = 0, ilen = keys.length; i < ilen; ++i) {
3445                    key = keys[i];
3446
3447                    target = model[key];
3448
3449                    // if a value is added to the model after pivot() has been called, the view
3450                    // doesn't contain it, so let's initialize the view to the target value.
3451                    if (!view.hasOwnProperty(key)) {
3452                        view[key] = target;
3453                    }
3454
3455                    actual = view[key];
3456
3457                    if (actual === target || key[0] === '_') {
3458                        continue;
3459                    }
3460
3461                    if (!start.hasOwnProperty(key)) {
3462                        start[key] = actual;
3463                    }
3464
3465                    origin = start[key];
3466
3467                    type = typeof target;
3468
3469                    if (type === typeof origin) {
3470                        if (type === 'string') {
3471                            c0 = chartjsColor(origin);
3472                            if (c0.valid) {
3473                                c1 = chartjsColor(target);
3474                                if (c1.valid) {
3475                                    view[key] = c1.mix(c0, ease).rgbString();
3476                                    continue;
3477                                }
3478                            }
3479                        } else if (helpers$1.isFinite(origin) && helpers$1.isFinite(target)) {
3480                            view[key] = origin + (target - origin) * ease;
3481                            continue;
3482                        }
3483                    }
3484
3485                    view[key] = target;
3486                }
3487            }
3488
3489            var Element = function (configuration) {
3490                helpers$1.extend(this, configuration);
3491                this.initialize.apply(this, arguments);
3492            };
3493
3494            helpers$1.extend(Element.prototype, {
3495                _type: undefined,
3496
3497                initialize: function () {
3498                    this.hidden = false;
3499                },
3500
3501                pivot: function () {
3502                    var me = this;
3503                    if (!me._view) {
3504                        me._view = helpers$1.extend({}, me._model);
3505                    }
3506                    me._start = {};
3507                    return me;
3508                },
3509
3510                transition: function (ease) {
3511                    var me = this;
3512                    var model = me._model;
3513                    var start = me._start;
3514                    var view = me._view;
3515
3516                    // No animation -> No Transition
3517                    if (!model || ease === 1) {
3518                        me._view = helpers$1.extend({}, model);
3519                        me._start = null;
3520                        return me;
3521                    }
3522
3523                    if (!view) {
3524                        view = me._view = {};
3525                    }
3526
3527                    if (!start) {
3528                        start = me._start = {};
3529                    }
3530
3531                    interpolate(start, view, model, ease);
3532
3533                    return me;
3534                },
3535
3536                tooltipPosition: function () {
3537                    return {
3538                        x: this._model.x,
3539                        y: this._model.y
3540                    };
3541                },
3542
3543                hasValue: function () {
3544                    return helpers$1.isNumber(this._model.x) && helpers$1.isNumber(this._model.y);
3545                }
3546            });
3547
3548            Element.extend = helpers$1.inherits;
3549
3550            var core_element = Element;
3551
3552            var exports$3 = core_element.extend({
3553                chart: null, // the animation associated chart instance
3554                currentStep: 0, // the current animation step
3555                numSteps: 60, // default number of steps
3556                easing: '', // the easing to use for this animation
3557                render: null, // render function used by the animation service
3558
3559                onAnimationProgress: null, // user specified callback to fire on each step of the animation
3560                onAnimationComplete: null, // user specified callback to fire when the animation finishes
3561            });
3562
3563            var core_animation = exports$3;
3564
3565// DEPRECATIONS
3566
3567            /**
3568             * Provided for backward compatibility, use Chart.Animation instead
3569             * @prop Chart.Animation#animationObject
3570             * @deprecated since version 2.6.0
3571             * @todo remove at version 3
3572             */
3573            Object.defineProperty(exports$3.prototype, 'animationObject', {
3574                get: function () {
3575                    return this;
3576                }
3577            });
3578
3579            /**
3580             * Provided for backward compatibility, use Chart.Animation#chart instead
3581             * @prop Chart.Animation#chartInstance
3582             * @deprecated since version 2.6.0
3583             * @todo remove at version 3
3584             */
3585            Object.defineProperty(exports$3.prototype, 'chartInstance', {
3586                get: function () {
3587                    return this.chart;
3588                },
3589                set: function (value) {
3590                    this.chart = value;
3591                }
3592            });
3593
3594            core_defaults._set('global', {
3595                animation: {
3596                    duration: 1000,
3597                    easing: 'easeOutQuart',
3598                    onProgress: helpers$1.noop,
3599                    onComplete: helpers$1.noop
3600                }
3601            });
3602
3603            var core_animations = {
3604                animations: [],
3605                request: null,
3606
3607                /**
3608                 * @param {Chart} chart - The chart to animate.
3609                 * @param {Chart.Animation} animation - The animation that we will animate.
3610                 * @param {number} duration - The animation duration in ms.
3611                 * @param {boolean} lazy - if true, the chart is not marked as animating to enable more responsive interactions
3612                 */
3613                addAnimation: function (chart, animation, duration, lazy) {
3614                    var animations = this.animations;
3615                    var i, ilen;
3616
3617                    animation.chart = chart;
3618                    animation.startTime = Date.now();
3619                    animation.duration = duration;
3620
3621                    if (!lazy) {
3622                        chart.animating = true;
3623                    }
3624
3625                    for (i = 0, ilen = animations.length; i < ilen; ++i) {
3626                        if (animations[i].chart === chart) {
3627                            animations[i] = animation;
3628                            return;
3629                        }
3630                    }
3631
3632                    animations.push(animation);
3633
3634                    // If there are no animations queued, manually kickstart a digest, for lack of a better word
3635                    if (animations.length === 1) {
3636                        this.requestAnimationFrame();
3637                    }
3638                },
3639
3640                cancelAnimation: function (chart) {
3641                    var index = helpers$1.findIndex(this.animations, function (animation) {
3642                        return animation.chart === chart;
3643                    });
3644
3645                    if (index !== -1) {
3646                        this.animations.splice(index, 1);
3647                        chart.animating = false;
3648                    }
3649                },
3650
3651                requestAnimationFrame: function () {
3652                    var me = this;
3653                    if (me.request === null) {
3654                        // Skip animation frame requests until the active one is executed.
3655                        // This can happen when processing mouse events, e.g. 'mousemove'
3656                        // and 'mouseout' events will trigger multiple renders.
3657                        me.request = helpers$1.requestAnimFrame.call(window, function () {
3658                            me.request = null;
3659                            me.startDigest();
3660                        });
3661                    }
3662                },
3663
3664                /**
3665                 * @private
3666                 */
3667                startDigest: function () {
3668                    var me = this;
3669
3670                    me.advance();
3671
3672                    // Do we have more stuff to animate?
3673                    if (me.animations.length > 0) {
3674                        me.requestAnimationFrame();
3675                    }
3676                },
3677
3678                /**
3679                 * @private
3680                 */
3681                advance: function () {
3682                    var animations = this.animations;
3683                    var animation, chart, numSteps, nextStep;
3684                    var i = 0;
3685
3686                    // 1 animation per chart, so we are looping charts here
3687                    while (i < animations.length) {
3688                        animation = animations[i];
3689                        chart = animation.chart;
3690                        numSteps = animation.numSteps;
3691
3692                        // Make sure that currentStep starts at 1
3693                        // https://github.com/chartjs/Chart.js/issues/6104
3694                        nextStep = Math.floor((Date.now() - animation.startTime) / animation.duration * numSteps) + 1;
3695                        animation.currentStep = Math.min(nextStep, numSteps);
3696
3697                        helpers$1.callback(animation.render, [chart, animation], chart);
3698                        helpers$1.callback(animation.onAnimationProgress, [animation], chart);
3699
3700                        if (animation.currentStep >= numSteps) {
3701                            helpers$1.callback(animation.onAnimationComplete, [animation], chart);
3702                            chart.animating = false;
3703                            animations.splice(i, 1);
3704                        } else {
3705                            ++i;
3706                        }
3707                    }
3708                }
3709            };
3710
3711            var resolve = helpers$1.options.resolve;
3712
3713            var arrayEvents = ['push', 'pop', 'shift', 'splice', 'unshift'];
3714
3715            /**
3716             * Hooks the array methods that add or remove values ('push', pop', 'shift', 'splice',
3717             * 'unshift') and notify the listener AFTER the array has been altered. Listeners are
3718             * called on the 'onData*' callbacks (e.g. onDataPush, etc.) with same arguments.
3719             */
3720            function listenArrayEvents(array, listener) {
3721                if (array._chartjs) {
3722                    array._chartjs.listeners.push(listener);
3723                    return;
3724                }
3725
3726                Object.defineProperty(array, '_chartjs', {
3727                    configurable: true,
3728                    enumerable: false,
3729                    value: {
3730                        listeners: [listener]
3731                    }
3732                });
3733
3734                arrayEvents.forEach(function (key) {
3735                    var method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);
3736                    var base = array[key];
3737
3738                    Object.defineProperty(array, key, {
3739                        configurable: true,
3740                        enumerable: false,
3741                        value: function () {
3742                            var args = Array.prototype.slice.call(arguments);
3743                            var res = base.apply(this, args);
3744
3745                            helpers$1.each(array._chartjs.listeners, function (object) {
3746                                if (typeof object[method] === 'function') {
3747                                    object[method].apply(object, args);
3748                                }
3749                            });
3750
3751                            return res;
3752                        }
3753                    });
3754                });
3755            }
3756
3757            /**
3758             * Removes the given array event listener and cleanup extra attached properties (such as
3759             * the _chartjs stub and overridden methods) if array doesn't have any more listeners.
3760             */
3761            function unlistenArrayEvents(array, listener) {
3762                var stub = array._chartjs;
3763                if (!stub) {
3764                    return;
3765                }
3766
3767                var listeners = stub.listeners;
3768                var index = listeners.indexOf(listener);
3769                if (index !== -1) {
3770                    listeners.splice(index, 1);
3771                }
3772
3773                if (listeners.length > 0) {
3774                    return;
3775                }
3776
3777                arrayEvents.forEach(function (key) {
3778                    delete array[key];
3779                });
3780
3781                delete array._chartjs;
3782            }
3783
3784// Base class for all dataset controllers (line, bar, etc)
3785            var DatasetController = function (chart, datasetIndex) {
3786                this.initialize(chart, datasetIndex);
3787            };
3788
3789            helpers$1.extend(DatasetController.prototype, {
3790
3791                /**
3792                 * Element type used to generate a meta dataset (e.g. Chart.element.Line).
3793                 * @type {Chart.core.element}
3794                 */
3795                datasetElementType: null,
3796
3797                /**
3798                 * Element type used to generate a meta data (e.g. Chart.element.Point).
3799                 * @type {Chart.core.element}
3800                 */
3801                dataElementType: null,
3802
3803                /**
3804                 * Dataset element option keys to be resolved in _resolveDatasetElementOptions.
3805                 * A derived controller may overri
vendor: 198,228 bytes, lines 3805-8478
3805de this to resolve controller-specific options.
3806                 * The keys defined here are for backward compatibility for legend styles.
3807                 * @private
3808                 */
3809                _datasetElementOptions: [
3810                    'backgroundColor',
3811                    'borderCapStyle',
3812                    'borderColor',
3813                    'borderDash',
3814                    'borderDashOffset',
3815                    'borderJoinStyle',
3816                    'borderWidth'
3817                ],
3818
3819                /**
3820                 * Data element option keys to be resolved in _resolveDataElementOptions.
3821                 * A derived controller may override this to resolve controller-specific options.
3822                 * The keys defined here are for backward compatibility for legend styles.
3823                 * @private
3824                 */
3825                _dataElementOptions: [
3826                    'backgroundColor',
3827                    'borderColor',
3828                    'borderWidth',
3829                    'pointStyle'
3830                ],
3831
3832                initialize: function (chart, datasetIndex) {
3833                    var me = this;
3834                    me.chart = chart;
3835                    me.index = datasetIndex;
3836                    me.linkScales();
3837                    me.addElements();
3838                    me._type = me.getMeta().type;
3839                },
3840
3841                updateIndex: function (datasetIndex) {
3842                    this.index = datasetIndex;
3843                },
3844
3845                linkScales: function () {
3846                    var me = this;
3847                    var meta = me.getMeta();
3848                    var chart = me.chart;
3849                    var scales = chart.scales;
3850                    var dataset = me.getDataset();
3851                    var scalesOpts = chart.options.scales;
3852
3853                    if (meta.xAxisID === null || !(meta.xAxisID in scales) || dataset.xAxisID) {
3854                        meta.xAxisID = dataset.xAxisID || scalesOpts.xAxes[0].id;
3855                    }
3856                    if (meta.yAxisID === null || !(meta.yAxisID in scales) || dataset.yAxisID) {
3857                        meta.yAxisID = dataset.yAxisID || scalesOpts.yAxes[0].id;
3858                    }
3859                },
3860
3861                getDataset: function () {
3862                    return this.chart.data.datasets[this.index];
3863                },
3864
3865                getMeta: function () {
3866                    return this.chart.getDatasetMeta(this.index);
3867                },
3868
3869                getScaleForId: function (scaleID) {
3870                    return this.chart.scales[scaleID];
3871                },
3872
3873                /**
3874                 * @private
3875                 */
3876                _getValueScaleId: function () {
3877                    return this.getMeta().yAxisID;
3878                },
3879
3880                /**
3881                 * @private
3882                 */
3883                _getIndexScaleId: function () {
3884                    return this.getMeta().xAxisID;
3885                },
3886
3887                /**
3888                 * @private
3889                 */
3890                _getValueScale: function () {
3891                    return this.getScaleForId(this._getValueScaleId());
3892                },
3893
3894                /**
3895                 * @private
3896                 */
3897                _getIndexScale: function () {
3898                    return this.getScaleForId(this._getIndexScaleId());
3899                },
3900
3901                reset: function () {
3902                    this._update(true);
3903                },
3904
3905                /**
3906                 * @private
3907                 */
3908                destroy: function () {
3909                    if (this._data) {
3910                        unlistenArrayEvents(this._data, this);
3911                    }
3912                },
3913
3914                createMetaDataset: function () {
3915                    var me = this;
3916                    var type = me.datasetElementType;
3917                    return type && new type({
3918                        _chart: me.chart,
3919                        _datasetIndex: me.index
3920                    });
3921                },
3922
3923                createMetaData: function (index) {
3924                    var me = this;
3925                    var type = me.dataElementType;
3926                    return type && new type({
3927                        _chart: me.chart,
3928                        _datasetIndex: me.index,
3929                        _index: index
3930                    });
3931                },
3932
3933                addElements: function () {
3934                    var me = this;
3935                    var meta = me.getMeta();
3936                    var data = me.getDataset().data || [];
3937                    var metaData = meta.data;
3938                    var i, ilen;
3939
3940                    for (i = 0, ilen = data.length; i < ilen; ++i) {
3941                        metaData[i] = metaData[i] || me.createMetaData(i);
3942                    }
3943
3944                    meta.dataset = meta.dataset || me.createMetaDataset();
3945                },
3946
3947                addElementAndReset: function (index) {
3948                    var element = this.createMetaData(index);
3949                    this.getMeta().data.splice(index, 0, element);
3950                    this.updateElement(element, index, true);
3951                },
3952
3953                buildOrUpdateElements: function () {
3954                    var me = this;
3955                    var dataset = me.getDataset();
3956                    var data = dataset.data || (dataset.data = []);
3957
3958                    // In order to correctly handle data addition/deletion animation (an thus simulate
3959                    // real-time charts), we need to monitor these data modifications and synchronize
3960                    // the internal meta data accordingly.
3961                    if (me._data !== data) {
3962                        if (me._data) {
3963                            // This case happens when the user replaced the data array instance.
3964                            unlistenArrayEvents(me._data, me);
3965                        }
3966
3967                        if (data && Object.isExtensible(data)) {
3968                            listenArrayEvents(data, me);
3969                        }
3970                        me._data = data;
3971                    }
3972
3973                    // Re-sync meta data in case the user replaced the data array or if we missed
3974                    // any updates and so make sure that we handle number of datapoints changing.
3975                    me.resyncElements();
3976                },
3977
3978                /**
3979                 * Returns the merged user-supplied and default dataset-level options
3980                 * @private
3981                 */
3982                _configure: function () {
3983                    var me = this;
3984                    me._config = helpers$1.merge(Object.create(null), [
3985                        me.chart.options.datasets[me._type],
3986                        me.getDataset(),
3987                    ], {
3988                        merger: function (key, target, source) {
3989                            if (key !== '_meta' && key !== 'data') {
3990                                helpers$1._merger(key, target, source);
3991                            }
3992                        }
3993                    });
3994                },
3995
3996                _update: function (reset) {
3997                    var me = this;
3998                    me._configure();
3999                    me._cachedDataOpts = null;
4000                    me.update(reset);
4001                },
4002
4003                update: helpers$1.noop,
4004
4005                transition: function (easingValue) {
4006                    var meta = this.getMeta();
4007                    var elements = meta.data || [];
4008                    var ilen = elements.length;
4009                    var i = 0;
4010
4011                    for (; i < ilen; ++i) {
4012                        elements[i].transition(easingValue);
4013                    }
4014
4015                    if (meta.dataset) {
4016                        meta.dataset.transition(easingValue);
4017                    }
4018                },
4019
4020                draw: function () {
4021                    var meta = this.getMeta();
4022                    var elements = meta.data || [];
4023                    var ilen = elements.length;
4024                    var i = 0;
4025
4026                    if (meta.dataset) {
4027                        meta.dataset.draw();
4028                    }
4029
4030                    for (; i < ilen; ++i) {
4031                        elements[i].draw();
4032                    }
4033                },
4034
4035                /**
4036                 * Returns a set of predefined style properties that should be used to represent the dataset
4037                 * or the data if the index is specified
4038                 * @param {number} index - data index
4039                 * @return {IStyleInterface} style object
4040                 */
4041                getStyle: function (index) {
4042                    var me = this;
4043                    var meta = me.getMeta();
4044                    var dataset = meta.dataset;
4045                    var style;
4046
4047                    me._configure();
4048                    if (dataset && index === undefined) {
4049                        style = me._resolveDatasetElementOptions(dataset || {});
4050                    } else {
4051                        index = index || 0;
4052                        style = me._resolveDataElementOptions(meta.data[index] || {}, index);
4053                    }
4054
4055                    if (style.fill === false || style.fill === null) {
4056                        style.backgroundColor = style.borderColor;
4057                    }
4058
4059                    return style;
4060                },
4061
4062                /**
4063                 * @private
4064                 */
4065                _resolveDatasetElementOptions: function (element, hover) {
4066                    var me = this;
4067                    var chart = me.chart;
4068                    var datasetOpts = me._config;
4069                    var custom = element.custom || {};
4070                    var options = chart.options.elements[me.datasetElementType.prototype._type] || {};
4071                    var elementOptions = me._datasetElementOptions;
4072                    var values = {};
4073                    var i, ilen, key, readKey;
4074
4075                    // Scriptable options
4076                    var context = {
4077                        chart: chart,
4078                        dataset: me.getDataset(),
4079                        datasetIndex: me.index,
4080                        hover: hover
4081                    };
4082
4083                    for (i = 0, ilen = elementOptions.length; i < ilen; ++i) {
4084                        key = elementOptions[i];
4085                        readKey = hover ? 'hover' + key.charAt(0).toUpperCase() + key.slice(1) : key;
4086                        values[key] = resolve([
4087                            custom[readKey],
4088                            datasetOpts[readKey],
4089                            options[readKey]
4090                        ], context);
4091                    }
4092
4093                    return values;
4094                },
4095
4096                /**
4097                 * @private
4098                 */
4099                _resolveDataElementOptions: function (element, index) {
4100                    var me = this;
4101                    var custom = element && element.custom;
4102                    var cached = me._cachedDataOpts;
4103                    if (cached && !custom) {
4104                        return cached;
4105                    }
4106                    var chart = me.chart;
4107                    var datasetOpts = me._config;
4108                    var options = chart.options.elements[me.dataElementType.prototype._type] || {};
4109                    var elementOptions = me._dataElementOptions;
4110                    var values = {};
4111
4112                    // Scriptable options
4113                    var context = {
4114                        chart: chart,
4115                        dataIndex: index,
4116                        dataset: me.getDataset(),
4117                        datasetIndex: me.index
4118                    };
4119
4120                    // `resolve` sets cacheable to `false` if any option is indexed or scripted
4121                    var info = {cacheable: !custom};
4122
4123                    var keys, i, ilen, key;
4124
4125                    custom = custom || {};
4126
4127                    if (helpers$1.isArray(elementOptions)) {
4128                        for (i = 0, ilen = elementOptions.length; i < ilen; ++i) {
4129                            key = elementOptions[i];
4130                            values[key] = resolve([
4131                                custom[key],
4132                                datasetOpts[key],
4133                                options[key]
4134                            ], context, index, info);
4135                        }
4136                    } else {
4137                        keys = Object.keys(elementOptions);
4138                        for (i = 0, ilen = keys.length; i < ilen; ++i) {
4139                            key = keys[i];
4140                            values[key] = resolve([
4141                                custom[key],
4142                                datasetOpts[elementOptions[key]],
4143                                datasetOpts[key],
4144                                options[key]
4145                            ], context, index, info);
4146                        }
4147                    }
4148
4149                    if (info.cacheable) {
4150                        me._cachedDataOpts = Object.freeze(values);
4151                    }
4152
4153                    return values;
4154                },
4155
4156                removeHoverStyle: function (element) {
4157                    helpers$1.merge(element._model, element.$previousStyle || {});
4158                    delete element.$previousStyle;
4159                },
4160
4161                setHoverStyle: function (element) {
4162                    var dataset = this.chart.data.datasets[element._datasetIndex];
4163                    var index = element._index;
4164                    var custom = element.custom || {};
4165                    var model = element._model;
4166                    var getHoverColor = helpers$1.getHoverColor;
4167
4168                    element.$previousStyle = {
4169                        backgroundColor: model.backgroundColor,
4170                        borderColor: model.borderColor,
4171                        borderWidth: model.borderWidth
4172                    };
4173
4174                    model.backgroundColor = resolve([custom.hoverBackgroundColor, dataset.hoverBackgroundColor, getHoverColor(model.backgroundColor)], undefined, index);
4175                    model.borderColor = resolve([custom.hoverBorderColor, dataset.hoverBorderColor, getHoverColor(model.borderColor)], undefined, index);
4176                    model.borderWidth = resolve([custom.hoverBorderWidth, dataset.hoverBorderWidth, model.borderWidth], undefined, index);
4177                },
4178
4179                /**
4180                 * @private
4181                 */
4182                _removeDatasetHoverStyle: function () {
4183                    var element = this.getMeta().dataset;
4184
4185                    if (element) {
4186                        this.removeHoverStyle(element);
4187                    }
4188                },
4189
4190                /**
4191                 * @private
4192                 */
4193                _setDatasetHoverStyle: function () {
4194                    var element = this.getMeta().dataset;
4195                    var prev = {};
4196                    var i, ilen, key, keys, hoverOptions, model;
4197
4198                    if (!element) {
4199                        return;
4200                    }
4201
4202                    model = element._model;
4203                    hoverOptions = this._resolveDatasetElementOptions(element, true);
4204
4205                    keys = Object.keys(hoverOptions);
4206                    for (i = 0, ilen = keys.length; i < ilen; ++i) {
4207                        key = keys[i];
4208                        prev[key] = model[key];
4209                        model[key] = hoverOptions[key];
4210                    }
4211
4212                    element.$previousStyle = prev;
4213                },
4214
4215                /**
4216                 * @private
4217                 */
4218                resyncElements: function () {
4219                    var me = this;
4220                    var meta = me.getMeta();
4221                    var data = me.getDataset().data;
4222                    var numMeta = meta.data.length;
4223                    var numData = data.length;
4224
4225                    if (numData < numMeta) {
4226                        meta.data.splice(numData, numMeta - numData);
4227                    } else if (numData > numMeta) {
4228                        me.insertElements(numMeta, numData - numMeta);
4229                    }
4230                },
4231
4232                /**
4233                 * @private
4234                 */
4235                insertElements: function (start, count) {
4236                    for (var i = 0; i < count; ++i) {
4237                        this.addElementAndReset(start + i);
4238                    }
4239                },
4240
4241                /**
4242                 * @private
4243                 */
4244                onDataPush: function () {
4245                    var count = arguments.length;
4246                    this.insertElements(this.getDataset().data.length - count, count);
4247                },
4248
4249                /**
4250                 * @private
4251                 */
4252                onDataPop: function () {
4253                    this.getMeta().data.pop();
4254                },
4255
4256                /**
4257                 * @private
4258                 */
4259                onDataShift: function () {
4260                    this.getMeta().data.shift();
4261                },
4262
4263                /**
4264                 * @private
4265                 */
4266                onDataSplice: function (start, count) {
4267                    this.getMeta().data.splice(start, count);
4268                    this.insertElements(start, arguments.length - 2);
4269                },
4270
4271                /**
4272                 * @private
4273                 */
4274                onDataUnshift: function () {
4275                    this.insertElements(0, arguments.length);
4276                }
4277            });
4278
4279            DatasetController.extend = helpers$1.inherits;
4280
4281            var core_datasetController = DatasetController;
4282
4283            var TAU = Math.PI * 2;
4284
4285            core_defaults._set('global', {
4286                elements: {
4287                    arc: {
4288                        backgroundColor: core_defaults.global.defaultColor,
4289                        borderColor: '#fff',
4290                        borderWidth: 2,
4291                        borderAlign: 'center'
4292                    }
4293                }
4294            });
4295
4296            function clipArc(ctx, arc) {
4297                var startAngle = arc.startAngle;
4298                var endAngle = arc.endAngle;
4299                var pixelMargin = arc.pixelMargin;
4300                var angleMargin = pixelMargin / arc.outerRadius;
4301                var x = arc.x;
4302                var y = arc.y;
4303
4304                // Draw an inner border by cliping the arc and drawing a double-width border
4305                // Enlarge the clipping arc by 0.33 pixels to eliminate glitches between borders
4306                ctx.beginPath();
4307                ctx.arc(x, y, arc.outerRadius, startAngle - angleMargin, endAngle + angleMargin);
4308                if (arc.innerRadius > pixelMargin) {
4309                    angleMargin = pixelMargin / arc.innerRadius;
4310                    ctx.arc(x, y, arc.innerRadius - pixelMargin, endAngle + angleMargin, startAngle - angleMargin, true);
4311                } else {
4312                    ctx.arc(x, y, pixelMargin, endAngle + Math.PI / 2, startAngle - Math.PI / 2);
4313                }
4314                ctx.closePath();
4315                ctx.clip();
4316            }
4317
4318            function drawFullCircleBorders(ctx, vm, arc, inner) {
4319                var endAngle = arc.endAngle;
4320                var i;
4321
4322                if (inner) {
4323                    arc.endAngle = arc.startAngle + TAU;
4324                    clipArc(ctx, arc);
4325                    arc.endAngle = endAngle;
4326                    if (arc.endAngle === arc.startAngle && arc.fullCircles) {
4327                        arc.endAngle += TAU;
4328                        arc.fullCircles--;
4329                    }
4330                }
4331
4332                ctx.beginPath();
4333                ctx.arc(arc.x, arc.y, arc.innerRadius, arc.startAngle + TAU, arc.startAngle, true);
4334                for (i = 0; i < arc.fullCircles; ++i) {
4335                    ctx.stroke();
4336                }
4337
4338                ctx.beginPath();
4339                ctx.arc(arc.x, arc.y, vm.outerRadius, arc.startAngle, arc.startAngle + TAU);
4340                for (i = 0; i < arc.fullCircles; ++i) {
4341                    ctx.stroke();
4342                }
4343            }
4344
4345            function drawBorder(ctx, vm, arc) {
4346                var inner = vm.borderAlign === 'inner';
4347
4348                if (inner) {
4349                    ctx.lineWidth = vm.borderWidth * 2;
4350                    ctx.lineJoin = 'round';
4351                } else {
4352                    ctx.lineWidth = vm.borderWidth;
4353                    ctx.lineJoin = 'bevel';
4354                }
4355
4356                if (arc.fullCircles) {
4357                    drawFullCircleBorders(ctx, vm, arc, inner);
4358                }
4359
4360                if (inner) {
4361                    clipArc(ctx, arc);
4362                }
4363
4364                ctx.beginPath();
4365                ctx.arc(arc.x, arc.y, vm.outerRadius, arc.startAngle, arc.endAngle);
4366                ctx.arc(arc.x, arc.y, arc.innerRadius, arc.endAngle, arc.startAngle, true);
4367                ctx.closePath();
4368                ctx.stroke();
4369            }
4370
4371            var element_arc = core_element.extend({
4372                _type: 'arc',
4373
4374                inLabelRange: function (mouseX) {
4375                    var vm = this._view;
4376
4377                    if (vm) {
4378                        return (Math.pow(mouseX - vm.x, 2) < Math.pow(vm.radius + vm.hoverRadius, 2));
4379                    }
4380                    return false;
4381                },
4382
4383                inRange: function (chartX, chartY) {
4384                    var vm = this._view;
4385
4386                    if (vm) {
4387                        var pointRelativePosition = helpers$1.getAngleFromPoint(vm, {x: chartX, y: chartY});
4388                        var angle = pointRelativePosition.angle;
4389                        var distance = pointRelativePosition.distance;
4390
4391                        // Sanitise angle range
4392                        var startAngle = vm.startAngle;
4393                        var endAngle = vm.endAngle;
4394                        while (endAngle < startAngle) {
4395                            endAngle += TAU;
4396                        }
4397                        while (angle > endAngle) {
4398                            angle -= TAU;
4399                        }
4400                        while (angle < startAngle) {
4401                            angle += TAU;
4402                        }
4403
4404                        // Check if within the range of the open/close angle
4405                        var betweenAngles = (angle >= startAngle && angle <= endAngle);
4406                        var withinRadius = (distance >= vm.innerRadius && distance <= vm.outerRadius);
4407
4408                        return (betweenAngles && withinRadius);
4409                    }
4410                    return false;
4411                },
4412
4413                getCenterPoint: function () {
4414                    var vm = this._view;
4415                    var halfAngle = (vm.startAngle + vm.endAngle) / 2;
4416                    var halfRadius = (vm.innerRadius + vm.outerRadius) / 2;
4417                    return {
4418                        x: vm.x + Math.cos(halfAngle) * halfRadius,
4419                        y: vm.y + Math.sin(halfAngle) * halfRadius
4420                    };
4421                },
4422
4423                getArea: function () {
4424                    var vm = this._view;
4425                    return Math.PI * ((vm.endAngle - vm.startAngle) / (2 * Math.PI)) * (Math.pow(vm.outerRadius, 2) - Math.pow(vm.innerRadius, 2));
4426                },
4427
4428                tooltipPosition: function () {
4429                    var vm = this._view;
4430                    var centreAngle = vm.startAngle + ((vm.endAngle - vm.startAngle) / 2);
4431                    var rangeFromCentre = (vm.outerRadius - vm.innerRadius) / 2 + vm.innerRadius;
4432
4433                    return {
4434                        x: vm.x + (Math.cos(centreAngle) * rangeFromCentre),
4435                        y: vm.y + (Math.sin(centreAngle) * rangeFromCentre)
4436                    };
4437                },
4438
4439                draw: function () {
4440                    var ctx = this._chart.ctx;
4441                    var vm = this._view;
4442                    var pixelMargin = (vm.borderAlign === 'inner') ? 0.33 : 0;
4443                    var arc = {
4444                        x: vm.x,
4445                        y: vm.y,
4446                        innerRadius: vm.innerRadius,
4447                        outerRadius: Math.max(vm.outerRadius - pixelMargin, 0),
4448                        pixelMargin: pixelMargin,
4449                        startAngle: vm.startAngle,
4450                        endAngle: vm.endAngle,
4451                        fullCircles: Math.floor(vm.circumference / TAU)
4452                    };
4453                    var i;
4454
4455                    ctx.save();
4456
4457                    ctx.fillStyle = vm.backgroundColor;
4458                    ctx.strokeStyle = vm.borderColor;
4459
4460                    if (arc.fullCircles) {
4461                        arc.endAngle = arc.startAngle + TAU;
4462                        ctx.beginPath();
4463                        ctx.arc(arc.x, arc.y, arc.outerRadius, arc.startAngle, arc.endAngle);
4464                        ctx.arc(arc.x, arc.y, arc.innerRadius, arc.endAngle, arc.startAngle, true);
4465                        ctx.closePath();
4466                        for (i = 0; i < arc.fullCircles; ++i) {
4467                            ctx.fill();
4468                        }
4469                        arc.endAngle = arc.startAngle + vm.circumference % TAU;
4470                    }
4471
4472                    ctx.beginPath();
4473                    ctx.arc(arc.x, arc.y, arc.outerRadius, arc.startAngle, arc.endAngle);
4474                    ctx.arc(arc.x, arc.y, arc.innerRadius, arc.endAngle, arc.startAngle, true);
4475                    ctx.closePath();
4476                    ctx.fill();
4477
4478                    if (vm.borderWidth) {
4479                        drawBorder(ctx, vm, arc);
4480                    }
4481
4482                    ctx.restore();
4483                }
4484            });
4485
4486            var valueOrDefault$1 = helpers$1.valueOrDefault;
4487
4488            var defaultColor = core_defaults.global.defaultColor;
4489
4490            core_defaults._set('global', {
4491                elements: {
4492                    line: {
4493                        tension: 0.4,
4494                        backgroundColor: defaultColor,
4495                        borderWidth: 3,
4496                        borderColor: defaultColor,
4497                        borderCapStyle: 'butt',
4498                        borderDash: [],
4499                        borderDashOffset: 0.0,
4500                        borderJoinStyle: 'miter',
4501                        capBezierPoints: true,
4502                        fill: true, // do we fill in the area between the line and its base axis
4503                    }
4504                }
4505            });
4506
4507            var element_line = core_element.extend({
4508                _type: 'line',
4509
4510                draw: function () {
4511                    var me = this;
4512                    var vm = me._view;
4513                    var ctx = me._chart.ctx;
4514                    var spanGaps = vm.spanGaps;
4515                    var points = me._children.slice(); // clone array
4516                    var globalDefaults = core_defaults.global;
4517                    var globalOptionLineElements = globalDefaults.elements.line;
4518                    var lastDrawnIndex = -1;
4519                    var closePath = me._loop;
4520                    var index, previous, currentVM;
4521
4522                    if (!points.length) {
4523                        return;
4524                    }
4525
4526                    if (me._loop) {
4527                        for (index = 0; index < points.length; ++index) {
4528                            previous = helpers$1.previousItem(points, index);
4529                            // If the line has an open path, shift the point array
4530                            if (!points[index]._view.skip && previous._view.skip) {
4531                                points = points.slice(index).concat(points.slice(0, index));
4532                                closePath = spanGaps;
4533                                break;
4534                            }
4535                        }
4536                        // If the line has a close path, add the first point again
4537                        if (closePath) {
4538                            points.push(points[0]);
4539                        }
4540                    }
4541
4542                    ctx.save();
4543
4544                    // Stroke Line Options
4545                    ctx.lineCap = vm.borderCapStyle || globalOptionLineElements.borderCapStyle;
4546
4547                    // IE 9 and 10 do not support line dash
4548                    if (ctx.setLineDash) {
4549                        ctx.setLineDash(vm.borderDash || globalOptionLineElements.borderDash);
4550                    }
4551
4552                    ctx.lineDashOffset = valueOrDefault$1(vm.borderDashOffset, globalOptionLineElements.borderDashOffset);
4553                    ctx.lineJoin = vm.borderJoinStyle || globalOptionLineElements.borderJoinStyle;
4554                    ctx.lineWidth = valueOrDefault$1(vm.borderWidth, globalOptionLineElements.borderWidth);
4555                    ctx.strokeStyle = vm.borderColor || globalDefaults.defaultColor;
4556
4557                    // Stroke Line
4558                    ctx.beginPath();
4559
4560                    // First point moves to it's starting position no matter what
4561                    currentVM = points[0]._view;
4562                    if (!currentVM.skip) {
4563                        ctx.moveTo(currentVM.x, currentVM.y);
4564                        lastDrawnIndex = 0;
4565                    }
4566
4567                    for (index = 1; index < points.length; ++index) {
4568                        currentVM = points[index]._view;
4569                        previous = lastDrawnIndex === -1 ? helpers$1.previousItem(points, index) : points[lastDrawnIndex];
4570
4571                        if (!currentVM.skip) {
4572                            if ((lastDrawnIndex !== (index - 1) && !spanGaps) || lastDrawnIndex === -1) {
4573                                // There was a gap and this is the first point after the gap
4574                                ctx.moveTo(currentVM.x, currentVM.y);
4575                            } else {
4576                                // Line to next point
4577                                helpers$1.canvas.lineTo(ctx, previous._view, currentVM);
4578                            }
4579                            lastDrawnIndex = index;
4580                        }
4581                    }
4582
4583                    if (closePath) {
4584                        ctx.closePath();
4585                    }
4586
4587                    ctx.stroke();
4588                    ctx.restore();
4589                }
4590            });
4591
4592            var valueOrDefault$2 = helpers$1.valueOrDefault;
4593
4594            var defaultColor$1 = core_defaults.global.defaultColor;
4595
4596            core_defaults._set('global', {
4597                elements: {
4598                    point: {
4599                        radius: 3,
4600                        pointStyle: 'circle',
4601                        backgroundColor: defaultColor$1,
4602                        borderColor: defaultColor$1,
4603                        borderWidth: 1,
4604                        // Hover
4605                        hitRadius: 1,
4606                        hoverRadius: 4,
4607                        hoverBorderWidth: 1
4608                    }
4609                }
4610            });
4611
4612            function xRange(mouseX) {
4613                var vm = this._view;
4614                return vm ? (Math.abs(mouseX - vm.x) < vm.radius + vm.hitRadius) : false;
4615            }
4616
4617            function yRange(mouseY) {
4618                var vm = this._view;
4619                return vm ? (Math.abs(mouseY - vm.y) < vm.radius + vm.hitRadius) : false;
4620            }
4621
4622            var element_point = core_element.extend({
4623                _type: 'point',
4624
4625                inRange: function (mouseX, mouseY) {
4626                    var vm = this._view;
4627                    return vm ? ((Math.pow(mouseX - vm.x, 2) + Math.pow(mouseY - vm.y, 2)) < Math.pow(vm.hitRadius + vm.radius, 2)) : false;
4628                },
4629
4630                inLabelRange: xRange,
4631                inXRange: xRange,
4632                inYRange: yRange,
4633
4634                getCenterPoint: function () {
4635                    var vm = this._view;
4636                    return {
4637                        x: vm.x,
4638                        y: vm.y
4639                    };
4640                },
4641
4642                getArea: function () {
4643                    return Math.PI * Math.pow(this._view.radius, 2);
4644                },
4645
4646                tooltipPosition: function () {
4647                    var vm = this._view;
4648                    return {
4649                        x: vm.x,
4650                        y: vm.y,
4651                        padding: vm.radius + vm.borderWidth
4652                    };
4653                },
4654
4655                draw: function (chartArea) {
4656                    var vm = this._view;
4657                    var ctx = this._chart.ctx;
4658                    var pointStyle = vm.pointStyle;
4659                    var rotation = vm.rotation;
4660                    var radius = vm.radius;
4661                    var x = vm.x;
4662                    var y = vm.y;
4663                    var globalDefaults = core_defaults.global;
4664                    var defaultColor = globalDefaults.defaultColor; // eslint-disable-line no-shadow
4665
4666                    if (vm.skip) {
4667                        return;
4668                    }
4669
4670                    // Clipping for Points.
4671                    if (chartArea === undefined || helpers$1.canvas._isPointInArea(vm, chartArea)) {
4672                        ctx.strokeStyle = vm.borderColor || defaultColor;
4673                        ctx.lineWidth = valueOrDefault$2(vm.borderWidth, globalDefaults.elements.point.borderWidth);
4674                        ctx.fillStyle = vm.backgroundColor || defaultColor;
4675                        helpers$1.canvas.drawPoint(ctx, pointStyle, radius, x, y, rotation);
4676                    }
4677                }
4678            });
4679
4680            var defaultColor$2 = core_defaults.global.defaultColor;
4681
4682            core_defaults._set('global', {
4683                elements: {
4684                    rectangle: {
4685                        backgroundColor: defaultColor$2,
4686                        borderColor: defaultColor$2,
4687                        borderSkipped: 'bottom',
4688                        borderWidth: 0
4689                    }
4690                }
4691            });
4692
4693            function isVertical(vm) {
4694                return vm && vm.width !== undefined;
4695            }
4696
4697            /**
4698             * Helper function to get the bounds of the bar regardless of the orientation
4699             * @param bar {Chart.Element.Rectangle} the bar
4700             * @return {Bounds} bounds of the bar
4701             * @private
4702             */
4703            function getBarBounds(vm) {
4704                var x1, x2, y1, y2, half;
4705
4706                if (isVertical(vm)) {
4707                    half = vm.width / 2;
4708                    x1 = vm.x - half;
4709                    x2 = vm.x + half;
4710                    y1 = Math.min(vm.y, vm.base);
4711                    y2 = Math.max(vm.y, vm.base);
4712                } else {
4713                    half = vm.height / 2;
4714                    x1 = Math.min(vm.x, vm.base);
4715                    x2 = Math.max(vm.x, vm.base);
4716                    y1 = vm.y - half;
4717                    y2 = vm.y + half;
4718                }
4719
4720                return {
4721                    left: x1,
4722                    top: y1,
4723                    right: x2,
4724                    bottom: y2
4725                };
4726            }
4727
4728            function swap(orig, v1, v2) {
4729                return orig === v1 ? v2 : orig === v2 ? v1 : orig;
4730            }
4731
4732            function parseBorderSkipped(vm) {
4733                var edge = vm.borderSkipped;
4734                var res = {};
4735
4736                if (!edge) {
4737                    return res;
4738                }
4739
4740                if (vm.horizontal) {
4741                    if (vm.base > vm.x) {
4742                        edge = swap(edge, 'left', 'right');
4743                    }
4744                } else if (vm.base < vm.y) {
4745                    edge = swap(edge, 'bottom', 'top');
4746                }
4747
4748                res[edge] = true;
4749                return res;
4750            }
4751
4752            function parseBorderWidth(vm, maxW, maxH) {
4753                var value = vm.borderWidth;
4754                var skip = parseBorderSkipped(vm);
4755                var t, r, b, l;
4756
4757                if (helpers$1.isObject(value)) {
4758                    t = +value.top || 0;
4759                    r = +value.right || 0;
4760                    b = +value.bottom || 0;
4761                    l = +value.left || 0;
4762                } else {
4763                    t = r = b = l = +value || 0;
4764                }
4765
4766                return {
4767                    t: skip.top || (t < 0) ? 0 : t > maxH ? maxH : t,
4768                    r: skip.right || (r < 0) ? 0 : r > maxW ? maxW : r,
4769                    b: skip.bottom || (b < 0) ? 0 : b > maxH ? maxH : b,
4770                    l: skip.left || (l < 0) ? 0 : l > maxW ? maxW : l
4771                };
4772            }
4773
4774            function boundingRects(vm) {
4775                var bounds = getBarBounds(vm);
4776                var width = bounds.right - bounds.left;
4777                var height = bounds.bottom - bounds.top;
4778                var border = parseBorderWidth(vm, width / 2, height / 2);
4779
4780                return {
4781                    outer: {
4782                        x: bounds.left,
4783                        y: bounds.top,
4784                        w: width,
4785                        h: height
4786                    },
4787                    inner: {
4788                        x: bounds.left + border.l,
4789                        y: bounds.top + border.t,
4790                        w: width - border.l - border.r,
4791                        h: height - border.t - border.b
4792                    }
4793                };
4794            }
4795
4796            function inRange(vm, x, y) {
4797                var skipX = x === null;
4798                var skipY = y === null;
4799                var bounds = !vm || (skipX && skipY) ? false : getBarBounds(vm);
4800
4801                return bounds
4802                    && (skipX || x >= bounds.left && x <= bounds.right)
4803                    && (skipY || y >= bounds.top && y <= bounds.bottom);
4804            }
4805
4806            var element_rectangle = core_element.extend({
4807                _type: 'rectangle',
4808
4809                draw: function () {
4810                    var ctx = this._chart.ctx;
4811                    var vm = this._view;
4812                    var rects = boundingRects(vm);
4813                    var outer = rects.outer;
4814                    var inner = rects.inner;
4815
4816                    ctx.fillStyle = vm.backgroundColor;
4817                    ctx.fillRect(outer.x, outer.y, outer.w, outer.h);
4818
4819                    if (outer.w === inner.w && outer.h === inner.h) {
4820                        return;
4821                    }
4822
4823                    ctx.save();
4824                    ctx.beginPath();
4825                    ctx.rect(outer.x, outer.y, outer.w, outer.h);
4826                    ctx.clip();
4827                    ctx.fillStyle = vm.borderColor;
4828                    ctx.rect(inner.x, inner.y, inner.w, inner.h);
4829                    ctx.fill('evenodd');
4830                    ctx.restore();
4831                },
4832
4833                height: function () {
4834                    var vm = this._view;
4835                    return vm.base - vm.y;
4836                },
4837
4838                inRange: function (mouseX, mouseY) {
4839                    return inRange(this._view, mouseX, mouseY);
4840                },
4841
4842                inLabelRange: function (mouseX, mouseY) {
4843                    var vm = this._view;
4844                    return isVertical(vm)
4845                        ? inRange(vm, mouseX, null)
4846                        : inRange(vm, null, mouseY);
4847                },
4848
4849                inXRange: function (mouseX) {
4850                    return inRange(this._view, mouseX, null);
4851                },
4852
4853                inYRange: function (mouseY) {
4854                    return inRange(this._view, null, mouseY);
4855                },
4856
4857                getCenterPoint: function () {
4858                    var vm = this._view;
4859                    var x, y;
4860                    if (isVertical(vm)) {
4861                        x = vm.x;
4862                        y = (vm.y + vm.base) / 2;
4863                    } else {
4864                        x = (vm.x + vm.base) / 2;
4865                        y = vm.y;
4866                    }
4867
4868                    return {x: x, y: y};
4869                },
4870
4871                getArea: function () {
4872                    var vm = this._view;
4873
4874                    return isVertical(vm)
4875                        ? vm.width * Math.abs(vm.y - vm.base)
4876                        : vm.height * Math.abs(vm.x - vm.base);
4877                },
4878
4879                tooltipPosition: function () {
4880                    var vm = this._view;
4881                    return {
4882                        x: vm.x,
4883                        y: vm.y
4884                    };
4885                }
4886            });
4887
4888            var elements = {};
4889            var Arc = element_arc;
4890            var Line = element_line;
4891            var Point = element_point;
4892            var Rectangle = element_rectangle;
4893            elements.Arc = Arc;
4894            elements.Line = Line;
4895            elements.Point = Point;
4896            elements.Rectangle = Rectangle;
4897
4898            var deprecated = helpers$1._deprecated;
4899            var valueOrDefault$3 = helpers$1.valueOrDefault;
4900
4901            core_defaults._set('bar', {
4902                hover: {
4903                    mode: 'label'
4904                },
4905
4906                scales: {
4907                    xAxes: [{
4908                        type: 'category',
4909                        offset: true,
4910                        gridLines: {
4911                            offsetGridLines: true
4912                        }
4913                    }],
4914
4915                    yAxes: [{
4916                        type: 'linear'
4917                    }]
4918                }
4919            });
4920
4921            core_defaults._set('global', {
4922                datasets: {
4923                    bar: {
4924                        categoryPercentage: 0.8,
4925                        barPercentage: 0.9
4926                    }
4927                }
4928            });
4929
4930            /**
4931             * Computes the "optimal" sample size to maintain bars equally sized while preventing overlap.
4932             * @private
4933             */
4934            function computeMinSampleSize(scale, pixels) {
4935                var min = scale._length;
4936                var prev, curr, i, ilen;
4937
4938                for (i = 1, ilen = pixels.length; i < ilen; ++i) {
4939                    min = Math.min(min, Math.abs(pixels[i] - pixels[i - 1]));
4940                }
4941
4942                for (i = 0, ilen = scale.getTicks().length; i < ilen; ++i) {
4943                    curr = scale.getPixelForTick(i);
4944                    min = i > 0 ? Math.min(min, Math.abs(curr - prev)) : min;
4945                    prev = curr;
4946                }
4947
4948                return min;
4949            }
4950
4951            /**
4952             * Computes an "ideal" category based on the absolute bar thickness or, if undefined or null,
4953             * uses the smallest interval (see computeMinSampleSize) that prevents bar overlapping. This
4954             * mode currently always generates bars equally sized (until we introduce scriptable options?).
4955             * @private
4956             */
4957            function computeFitCategoryTraits(index, ruler, options) {
4958                var thickness = options.barThickness;
4959                var count = ruler.stackCount;
4960                var curr = ruler.pixels[index];
4961                var min = helpers$1.isNullOrUndef(thickness)
4962                    ? computeMinSampleSize(ruler.scale, ruler.pixels)
4963                    : -1;
4964                var size, ratio;
4965
4966                if (helpers$1.isNullOrUndef(thickness)) {
4967                    size = min * options.categoryPercentage;
4968                    ratio = options.barPercentage;
4969                } else {
4970                    // When bar thickness is enforced, category and bar percentages are ignored.
4971                    // Note(SB): we could add support for relative bar thickness (e.g. barThickness: '50%')
4972                    // and deprecate barPercentage since this value is ignored when thickness is absolute.
4973                    size = thickness * count;
4974                    ratio = 1;
4975                }
4976
4977                return {
4978                    chunk: size / count,
4979                    ratio: ratio,
4980                    start: curr - (size / 2)
4981                };
4982            }
4983
4984            /**
4985             * Computes an "optimal" category that globally arranges bars side by side (no gap when
4986             * percentage options are 1), based on the previous and following categories. This mode
4987             * generates bars with different widths when data are not evenly spaced.
4988             * @private
4989             */
4990            function computeFlexCategoryTraits(index, ruler, options) {
4991                var pixels = ruler.pixels;
4992                var curr = pixels[index];
4993                var prev = index > 0 ? pixels[index - 1] : null;
4994                var next = index < pixels.length - 1 ? pixels[index + 1] : null;
4995                var percent = options.categoryPercentage;
4996                var start, size;
4997
4998                if (prev === null) {
4999                    // first data: its size is double based on the next point or,
5000                    // if it's also the last data, we use the scale size.
5001                    prev = curr - (next === null ? ruler.end - ruler.start : next - curr);
5002                }
5003
5004                if (next === null) {
5005                    // last data: its size is also double based on the previous point.
5006                    next = curr + curr - prev;
5007                }
5008
5009                start = curr - (curr - Math.min(prev, next)) / 2 * percent;
5010                size = Math.abs(next - prev) / 2 * percent;
5011
5012                return {
5013                    chunk: size / ruler.stackCount,
5014                    ratio: options.barPercentage,
5015                    start: start
5016                };
5017            }
5018
5019            var controller_bar = core_datasetController.extend({
5020
5021                dataElementType: elements.Rectangle,
5022
5023                /**
5024                 * @private
5025                 */
5026                _dataElementOptions: [
5027                    'backgroundColor',
5028                    'borderColor',
5029                    'borderSkipped',
5030                    'borderWidth',
5031                    'barPercentage',
5032                    'barThickness',
5033                    'categoryPercentage',
5034                    'maxBarThickness',
5035                    'minBarLength'
5036                ],
5037
5038                initialize: function () {
5039                    var me = this;
5040                    var meta, scaleOpts;
5041
5042                    core_datasetController.prototype.initialize.apply(me, arguments);
5043
5044                    meta = me.getMeta();
5045                    meta.stack = me.getDataset().stack;
5046                    meta.bar = true;
5047
5048                    scaleOpts = me._getIndexScale().options;
5049                    deprecated('bar chart', scaleOpts.barPercentage, 'scales.[x/y]Axes.barPercentage', 'dataset.barPercentage');
5050                    deprecated('bar chart', scaleOpts.barThickness, 'scales.[x/y]Axes.barThickness', 'dataset.barThickness');
5051                    deprecated('bar chart', scaleOpts.categoryPercentage, 'scales.[x/y]Axes.categoryPercentage', 'dataset.categoryPercentage');
5052                    deprecated('bar chart', me._getValueScale().options.minBarLength, 'scales.[x/y]Axes.minBarLength', 'dataset.minBarLength');
5053                    deprecated('bar chart', scaleOpts.maxBarThickness, 'scales.[x/y]Axes.maxBarThickness', 'dataset.maxBarThickness');
5054                },
5055
5056                update: function (reset) {
5057                    var me = this;
5058                    var rects = me.getMeta().data;
5059                    var i, ilen;
5060
5061                    me._ruler = me.getRuler();
5062
5063                    for (i = 0, ilen = rects.length; i < ilen; ++i) {
5064                        me.updateElement(rects[i], i, reset);
5065                    }
5066                },
5067
5068                updateElement: function (rectangle, index, reset) {
5069                    var me = this;
5070                    var meta = me.getMeta();
5071                    var dataset = me.getDataset();
5072                    var options = me._resolveDataElementOptions(rectangle, index);
5073
5074                    rectangle._xScale = me.getScaleForId(meta.xAxisID);
5075                    rectangle._yScale = me.getScaleForId(meta.yAxisID);
5076                    rectangle._datasetIndex = me.index;
5077                    rectangle._index = index;
5078                    rectangle._model = {
5079                        backgroundColor: options.backgroundColor,
5080                        borderColor: options.borderColor,
5081                        borderSkipped: options.borderSkipped,
5082                        borderWidth: options.borderWidth,
5083                        datasetLabel: dataset.label,
5084                        label: me.chart.data.labels[index]
5085                    };
5086
5087                    if (helpers$1.isArray(dataset.data[index])) {
5088                        rectangle._model.borderSkipped = null;
5089                    }
5090
5091                    me._updateElementGeometry(rectangle, index, reset, options);
5092
5093                    rectangle.pivot();
5094                },
5095
5096                /**
5097                 * @private
5098                 */
5099                _updateElementGeometry: function (rectangle, index, reset, options) {
5100                    var me = this;
5101                    var model = rectangle._model;
5102                    var vscale = me._getValueScale();
5103                    var base = vscale.getBasePixel();
5104                    var horizontal = vscale.isHorizontal();
5105                    var ruler = me._ruler || me.getRuler();
5106                    var vpixels = me.calculateBarValuePixels(me.index, index, options);
5107                    var ipixels = me.calculateBarIndexPixels(me.index, index, ruler, options);
5108
5109                    model.horizontal = horizontal;
5110                    model.base = reset ? base : vpixels.base;
5111                    model.x = horizontal ? reset ? base : vpixels.head : ipixels.center;
5112                    model.y = horizontal ? ipixels.center : reset ? base : vpixels.head;
5113                    model.height = horizontal ? ipixels.size : undefined;
5114                    model.width = horizontal ? undefined : ipixels.size;
5115                },
5116
5117                /**
5118                 * Returns the stacks based on groups and bar visibility.
5119                 * @param {number} [last] - The dataset index
5120                 * @returns {string[]} The list of stack IDs
5121                 * @private
5122                 */
5123                _getStacks: function (last) {
5124                    var me = this;
5125                    var scale = me._getIndexScale();
5126                    var metasets = scale._getMatchingVisibleMetas(me._type);
5127                    var stacked = scale.options.stacked;
5128                    var ilen = metasets.length;
5129                    var stacks = [];
5130                    var i, meta;
5131
5132                    for (i = 0; i < ilen; ++i) {
5133                        meta = metasets[i];
5134                        // stacked   | meta.stack
5135                        //           | found | not found | undefined
5136                        // false     |   x   |     x     |     x
5137                        // true      |       |     x     |
5138                        // undefined |       |     x     |     x
5139                        if (stacked === false || stacks.indexOf(meta.stack) === -1 ||
5140                            (stacked === undefined && meta.stack === undefined)) {
5141                            stacks.push(meta.stack);
5142                        }
5143                        if (meta.index === last) {
5144                            break;
5145                        }
5146                    }
5147
5148                    return stacks;
5149                },
5150
5151                /**
5152                 * Returns the effective number of stacks based on groups and bar visibility.
5153                 * @private
5154                 */
5155                getStackCount: function () {
5156                    return this._getStacks().length;
5157                },
5158
5159                /**
5160                 * Returns the stack index for the given dataset based on groups and bar visibility.
5161                 * @param {number} [datasetIndex] - The dataset index
5162                 * @param {string} [name] - The stack name to find
5163                 * @returns {number} The stack index
5164                 * @private
5165                 */
5166                getStackIndex: function (datasetIndex, name) {
5167                    var stacks = this._getStacks(datasetIndex);
5168                    var index = (name !== undefined)
5169                        ? stacks.indexOf(name)
5170                        : -1; // indexOf returns -1 if element is not present
5171
5172                    return (index === -1)
5173                        ? stacks.length - 1
5174                        : index;
5175                },
5176
5177                /**
5178                 * @private
5179                 */
5180                getRuler: function () {
5181                    var me = this;
5182                    var scale = me._getIndexScale();
5183                    var pixels = [];
5184                    var i, ilen;
5185
5186                    for (i = 0, ilen = me.getMeta().data.length; i < ilen; ++i) {
5187                        pixels.push(scale.getPixelForValue(null, i, me.index));
5188                    }
5189
5190                    return {
5191                        pixels: pixels,
5192                        start: scale._startPixel,
5193                        end: scale._endPixel,
5194                        stackCount: me.getStackCount(),
5195                        scale: scale
5196                    };
5197                },
5198
5199                /**
5200                 * Note: pixel values are not clamped to the scale area.
5201                 * @private
5202                 */
5203                calculateBarValuePixels: function (datasetIndex, index, options) {
5204                    var me = this;
5205                    var chart = me.chart;
5206                    var scale = me._getValueScale();
5207                    var isHorizontal = scale.isHorizontal();
5208                    var datasets = chart.data.datasets;
5209                    var metasets = scale._getMatchingVisibleMetas(me._type);
5210                    var value = scale._parseValue(datasets[datasetIndex].data[index]);
5211                    var minBarLength = options.minBarLength;
5212                    var stacked = scale.options.stacked;
5213                    var stack = me.getMeta().stack;
5214                    var start = value.start === undefined ? 0 : value.max >= 0 && value.min >= 0 ? value.min : value.max;
5215                    var length = value.start === undefined ? value.end : value.max >= 0 && value.min >= 0 ? value.max - value.min : value.min - value.max;
5216                    var ilen = metasets.length;
5217                    var i, imeta, ivalue, base, head, size, stackLength;
5218
5219                    if (stacked || (stacked === undefined && stack !== undefined)) {
5220                        for (i = 0; i < ilen; ++i) {
5221                            imeta = metasets[i];
5222
5223                            if (imeta.index === datasetIndex) {
5224                                break;
5225                            }
5226
5227                            if (imeta.stack === stack) {
5228                                stackLength = scale._parseValue(datasets[imeta.index].data[index]);
5229                                ivalue = stackLength.start === undefined ? stackLength.end : stackLength.min >= 0 && stackLength.max >= 0 ? stackLength.max : stackLength.min;
5230
5231                                if ((value.min < 0 && ivalue < 0) || (value.max >= 0 && ivalue > 0)) {
5232                                    start += ivalue;
5233                                }
5234                            }
5235                        }
5236                    }
5237
5238                    base = scale.getPixelForValue(start);
5239                    head = scale.getPixelForValue(start + length);
5240                    size = head - base;
5241
5242                    if (minBarLength !== undefined && Math.abs(size) < minBarLength) {
5243                        size = minBarLength;
5244                        if (length >= 0 && !isHorizontal || length < 0 && isHorizontal) {
5245                            head = base - minBarLength;
5246                        } else {
5247                            head = base + minBarLength;
5248                        }
5249                    }
5250
5251                    return {
5252                        size: size,
5253                        base: base,
5254                        head: head,
5255                        center: head + size / 2
5256                    };
5257                },
5258
5259                /**
5260                 * @private
5261                 */
5262                calculateBarIndexPixels: function (datasetIndex, index, ruler, options) {
5263                    var me = this;
5264                    var range = options.barThickness === 'flex'
5265                        ? computeFlexCategoryTraits(index, ruler, options)
5266                        : computeFitCategoryTraits(index, ruler, options);
5267
5268                    var stackIndex = me.getStackIndex(datasetIndex, me.getMeta().stack);
5269                    var center = range.start + (range.chunk * stackIndex) + (range.chunk / 2);
5270                    var size = Math.min(
5271                        valueOrDefault$3(options.maxBarThickness, Infinity),
5272                        range.chunk * range.ratio);
5273
5274                    return {
5275                        base: center - size / 2,
5276                        head: center + size / 2,
5277                        center: center,
5278                        size: size
5279                    };
5280                },
5281
5282                draw: function () {
5283                    var me = this;
5284                    var chart = me.chart;
5285                    var scale = me._getValueScale();
5286                    var rects = me.getMeta().data;
5287                    var dataset = me.getDataset();
5288                    var ilen = rects.length;
5289                    var i = 0;
5290
5291                    helpers$1.canvas.clipArea(chart.ctx, chart.chartArea);
5292
5293                    for (; i < ilen; ++i) {
5294                        var val = scale._parseValue(dataset.data[i]);
5295                        if (!isNaN(val.min) && !isNaN(val.max)) {
5296                            rects[i].draw();
5297                        }
5298                    }
5299
5300                    helpers$1.canvas.unclipArea(chart.ctx);
5301                },
5302
5303                /**
5304                 * @private
5305                 */
5306                _resolveDataElementOptions: function () {
5307                    var me = this;
5308                    var values = helpers$1.extend({}, core_datasetController.prototype._resolveDataElementOptions.apply(me, arguments));
5309                    var indexOpts = me._getIndexScale().options;
5310                    var valueOpts = me._getValueScale().options;
5311
5312                    values.barPercentage = valueOrDefault$3(indexOpts.barPercentage, values.barPercentage);
5313                    values.barThickness = valueOrDefault$3(indexOpts.barThickness, values.barThickness);
5314                    values.categoryPercentage = valueOrDefault$3(indexOpts.categoryPercentage, values.categoryPercentage);
5315                    values.maxBarThickness = valueOrDefault$3(indexOpts.maxBarThickness, values.maxBarThickness);
5316                    values.minBarLength = valueOrDefault$3(valueOpts.minBarLength, values.minBarLength);
5317
5318                    return values;
5319                }
5320
5321            });
5322
5323            var valueOrDefault$4 = helpers$1.valueOrDefault;
5324            var resolve$1 = helpers$1.options.resolve;
5325
5326            core_defaults._set('bubble', {
5327                hover: {
5328                    mode: 'single'
5329                },
5330
5331                scales: {
5332                    xAxes: [{
5333                        type: 'linear', // bubble should probably use a linear scale by default
5334                        position: 'bottom',
5335                        id: 'x-axis-0' // need an ID so datasets can reference the scale
5336                    }],
5337                    yAxes: [{
5338                        type: 'linear',
5339                        position: 'left',
5340                        id: 'y-axis-0'
5341                    }]
5342                },
5343
5344                tooltips: {
5345                    callbacks: {
5346                        title: function () {
5347                            // Title doesn't make sense for scatter since we format the data as a point
5348                            return '';
5349                        },
5350                        label: function (item, data) {
5351                            var datasetLabel = data.datasets[item.datasetIndex].label || '';
5352                            var dataPoint = data.datasets[item.datasetIndex].data[item.index];
5353                            return datasetLabel + ': (' + item.xLabel + ', ' + item.yLabel + ', ' + dataPoint.r + ')';
5354                        }
5355                    }
5356                }
5357            });
5358
5359            var controller_bubble = core_datasetController.extend({
5360                /**
5361                 * @protected
5362                 */
5363                dataElementType: elements.Point,
5364
5365                /**
5366                 * @private
5367                 */
5368                _dataElementOptions: [
5369                    'backgroundColor',
5370                    'borderColor',
5371                    'borderWidth',
5372                    'hoverBackgroundColor',
5373                    'hoverBorderColor',
5374                    'hoverBorderWidth',
5375                    'hoverRadius',
5376                    'hitRadius',
5377                    'pointStyle',
5378                    'rotation'
5379                ],
5380
5381                /**
5382                 * @protected
5383                 */
5384                update: function (reset) {
5385                    var me = this;
5386                    var meta = me.getMeta();
5387                    var points = meta.data;
5388
5389                    // Update Points
5390                    helpers$1.each(points, function (point, index) {
5391                        me.updateElement(point, index, reset);
5392                    });
5393                },
5394
5395                /**
5396                 * @protected
5397                 */
5398                updateElement: function (point, index, reset) {
5399                    var me = this;
5400                    var meta = me.getMeta();
5401                    var custom = point.custom || {};
5402                    var xScale = me.getScaleForId(meta.xAxisID);
5403                    var yScale = me.getScaleForId(meta.yAxisID);
5404                    var options = me._resolveDataElementOptions(point, index);
5405                    var data = me.getDataset().data[index];
5406                    var dsIndex = me.index;
5407
5408                    var x = reset ? xScale.getPixelForDecimal(0.5) : xScale.getPixelForValue(typeof data === 'object' ? data : NaN, index, dsIndex);
5409                    var y = reset ? yScale.getBasePixel() : yScale.getPixelForValue(data, index, dsIndex);
5410
5411                    point._xScale = xScale;
5412                    point._yScale = yScale;
5413                    point._options = options;
5414                    point._datasetIndex = dsIndex;
5415                    point._index = index;
5416                    point._model = {
5417                        backgroundColor: options.backgroundColor,
5418                        borderColor: options.borderColor,
5419                        borderWidth: options.borderWidth,
5420                        hitRadius: options.hitRadius,
5421                        pointStyle: options.pointStyle,
5422                        rotation: options.rotation,
5423                        radius: reset ? 0 : options.radius,
5424                        skip: custom.skip || isNaN(x) || isNaN(y),
5425                        x: x,
5426                        y: y,
5427                    };
5428
5429                    point.pivot();
5430                },
5431
5432                /**
5433                 * @protected
5434                 */
5435                setHoverStyle: function (point) {
5436                    var model = point._model;
5437                    var options = point._options;
5438                    var getHoverColor = helpers$1.getHoverColor;
5439
5440                    point.$previousStyle = {
5441                        backgroundColor: model.backgroundColor,
5442                        borderColor: model.borderColor,
5443                        borderWidth: model.borderWidth,
5444                        radius: model.radius
5445                    };
5446
5447                    model.backgroundColor = valueOrDefault$4(options.hoverBackgroundColor, getHoverColor(options.backgroundColor));
5448                    model.borderColor = valueOrDefault$4(options.hoverBorderColor, getHoverColor(options.borderColor));
5449                    model.borderWidth = valueOrDefault$4(options.hoverBorderWidth, options.borderWidth);
5450                    model.radius = options.radius + options.hoverRadius;
5451                },
5452
5453                /**
5454                 * @private
5455                 */
5456                _resolveDataElementOptions: function (point, index) {
5457                    var me = this;
5458                    var chart = me.chart;
5459                    var dataset = me.getDataset();
5460                    var custom = point.custom || {};
5461                    var data = dataset.data[index] || {};
5462                    var values = core_datasetController.prototype._resolveDataElementOptions.apply(me, arguments);
5463
5464                    // Scriptable options
5465                    var context = {
5466                        chart: chart,
5467                        dataIndex: index,
5468                        dataset: dataset,
5469                        datasetIndex: me.index
5470                    };
5471
5472                    // In case values were cached (and thus frozen), we need to clone the values
5473                    if (me._cachedDataOpts === values) {
5474                        values = helpers$1.extend({}, values);
5475                    }
5476
5477                    // Custom radius resolution
5478                    values.radius = resolve$1([
5479                        custom.radius,
5480                        data.r,
5481                        me._config.radius,
5482                        chart.options.elements.point.radius
5483                    ], context, index);
5484
5485                    return values;
5486                }
5487            });
5488
5489            var valueOrDefault$5 = helpers$1.valueOrDefault;
5490
5491            var PI$1 = Math.PI;
5492            var DOUBLE_PI$1 = PI$1 * 2;
5493            var HALF_PI$1 = PI$1 / 2;
5494
5495            core_defaults._set('doughnut', {
5496                animation: {
5497                    // Boolean - Whether we animate the rotation of the Doughnut
5498                    animateRotate: true,
5499                    // Boolean - Whether we animate scaling the Doughnut from the centre
5500                    animateScale: false
5501                },
5502                hover: {
5503                    mode: 'single'
5504                },
5505                legendCallback: function (chart) {
5506                    var list = document.createElement('ul');
5507                    var data = chart.data;
5508                    var datasets = data.datasets;
5509                    var labels = data.labels;
5510                    var i, ilen, listItem, listItemSpan;
5511
5512                    list.setAttribute('class', chart.id + '-legend');
5513                    if (datasets.length) {
5514                        for (i = 0, ilen = datasets[0].data.length; i < ilen; ++i) {
5515                            listItem = list.appendChild(document.createElement('li'));
5516                            listItemSpan = listItem.appendChild(document.createElement('span'));
5517                            listItemSpan.style.backgroundColor = datasets[0].backgroundColor[i];
5518                            if (labels[i]) {
5519                                listItem.appendChild(document.createTextNode(labels[i]));
5520                            }
5521                        }
5522                    }
5523
5524                    return list.outerHTML;
5525                },
5526                legend: {
5527                    labels: {
5528                        generateLabels: function (chart) {
5529                            var data = chart.data;
5530                            if (data.labels.length && data.datasets.length) {
5531                                return data.labels.map(function (label, i) {
5532                                    var meta = chart.getDatasetMeta(0);
5533                                    var style = meta.controller.getStyle(i);
5534
5535                                    return {
5536                                        text: label,
5537                                        fillStyle: style.backgroundColor,
5538                                        strokeStyle: style.borderColor,
5539                                        lineWidth: style.borderWidth,
5540                                        hidden: isNaN(data.datasets[0].data[i]) || meta.data[i].hidden,
5541
5542                                        // Extra data used for toggling the correct item
5543                                        index: i
5544                                    };
5545                                });
5546                            }
5547                            return [];
5548                        }
5549                    },
5550
5551                    onClick: function (e, legendItem) {
5552                        var index = legendItem.index;
5553                        var chart = this.chart;
5554                        var i, ilen, meta;
5555
5556                        for (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) {
5557                            meta = chart.getDatasetMeta(i);
5558                            // toggle visibility of index if exists
5559                            if (meta.data[index]) {
5560                                meta.data[index].hidden = !meta.data[index].hidden;
5561                            }
5562                        }
5563
5564                        chart.update();
5565                    }
5566                },
5567
5568                // The percentage of the chart that we cut out of the middle.
5569                cutoutPercentage: 50,
5570
5571                // The rotation of the chart, where the first data arc begins.
5572                rotation: -HALF_PI$1,
5573
5574                // The total circumference of the chart.
5575                circumference: DOUBLE_PI$1,
5576
5577                // Need to override these to give a nice default
5578                tooltips: {
5579                    callbacks: {
5580                        title: function () {
5581                            return '';
5582                        },
5583                        label: function (tooltipItem, data) {
5584                            var dataLabel = data.labels[tooltipItem.index];
5585                            var value = ': ' + data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index];
5586
5587                            if (helpers$1.isArray(dataLabel)) {
5588                                // show value on first line of multiline label
5589                                // need to clone because we are changing the value
5590                                dataLabel = dataLabel.slice();
5591                                dataLabel[0] += value;
5592                            } else {
5593                                dataLabel += value;
5594                            }
5595
5596                            return dataLabel;
5597                        }
5598                    }
5599                }
5600            });
5601
5602            var controller_doughnut = core_datasetController.extend({
5603
5604                dataElementType: elements.Arc,
5605
5606                linkScales: helpers$1.noop,
5607
5608                /**
5609                 * @private
5610                 */
5611                _dataElementOptions: [
5612                    'backgroundColor',
5613                    'borderColor',
5614                    'borderWidth',
5615                    'borderAlign',
5616                    'hoverBackgroundColor',
5617                    'hoverBorderColor',
5618                    'hoverBorderWidth',
5619                ],
5620
5621                // Get index of the dataset in relation to the visible datasets. This allows determining the inner and outer radius correctly
5622                getRingIndex: function (datasetIndex) {
5623                    var ringIndex = 0;
5624
5625                    for (var j = 0; j < datasetIndex; ++j) {
5626                        if (this.chart.isDatasetVisible(j)) {
5627                            ++ringIndex;
5628                        }
5629                    }
5630
5631                    return ringIndex;
5632                },
5633
5634                update: function (reset) {
5635                    var me = this;
5636                    var chart = me.chart;
5637                    var chartArea = chart.chartArea;
5638                    var opts = chart.options;
5639                    var ratioX = 1;
5640                    var ratioY = 1;
5641                    var offsetX = 0;
5642                    var offsetY = 0;
5643                    var meta = me.getMeta();
5644                    var arcs = meta.data;
5645                    var cutout = opts.cutoutPercentage / 100 || 0;
5646                    var circumference = opts.circumference;
5647                    var chartWeight = me._getRingWeight(me.index);
5648                    var maxWidth, maxHeight, i, ilen;
5649
5650                    // If the chart's circumference isn't a full circle, calculate size as a ratio of the width/height of the arc
5651                    if (circumference < DOUBLE_PI$1) {
5652                        var startAngle = opts.rotation % DOUBLE_PI$1;
5653                        startAngle += startAngle >= PI$1 ? -DOUBLE_PI$1 : startAngle < -PI$1 ? DOUBLE_PI$1 : 0;
5654                        var endAngle = startAngle + circumference;
5655                        var startX = Math.cos(startAngle);
5656                        var startY = Math.sin(startAngle);
5657                        var endX = Math.cos(endAngle);
5658                        var endY = Math.sin(endAngle);
5659                        var contains0 = (startAngle <= 0 && endAngle >= 0) || endAngle >= DOUBLE_PI$1;
5660                        var contains90 = (startAngle <= HALF_PI$1 && endAngle >= HALF_PI$1) || endAngle >= DOUBLE_PI$1 + HALF_PI$1;
5661                        var contains180 = startAngle === -PI$1 || endAngle >= PI$1;
5662                        var contains270 = (startAngle <= -HALF_PI$1 && endAngle >= -HALF_PI$1) || endAngle >= PI$1 + HALF_PI$1;
5663                        var minX = contains180 ? -1 : Math.min(startX, startX * cutout, endX, endX * cutout);
5664                        var minY = contains270 ? -1 : Math.min(startY, startY * cutout, endY, endY * cutout);
5665                        var maxX = contains0 ? 1 : Math.max(startX, startX * cutout, endX, endX * cutout);
5666                        var maxY = contains90 ? 1 : Math.max(startY, startY * cutout, endY, endY * cutout);
5667                        ratioX = (maxX - minX) / 2;
5668                        ratioY = (maxY - minY) / 2;
5669                        offsetX = -(maxX + minX) / 2;
5670                        offsetY = -(maxY + minY) / 2;
5671                    }
5672
5673                    for (i = 0, ilen = arcs.length; i < ilen; ++i) {
5674                        arcs[i]._options = me._resolveDataElementOptions(arcs[i], i);
5675                    }
5676
5677                    chart.borderWidth = me.getMaxBorderWidth();
5678                    maxWidth = (chartArea.right - chartArea.left - chart.borderWidth) / ratioX;
5679                    maxHeight = (chartArea.bottom - chartArea.top - chart.borderWidth) / ratioY;
5680                    chart.outerRadius = Math.max(Math.min(maxWidth, maxHeight) / 2, 0);
5681                    chart.innerRadius = Math.max(chart.outerRadius * cutout, 0);
5682                    chart.radiusLength = (chart.outerRadius - chart.innerRadius) / (me._getVisibleDatasetWeightTotal() || 1);
5683                    chart.offsetX = offsetX * chart.outerRadius;
5684                    chart.offsetY = offsetY * chart.outerRadius;
5685
5686                    meta.total = me.calculateTotal();
5687
5688                    me.outerRadius = chart.outerRadius - chart.radiusLength * me._getRingWeightOffset(me.index);
5689                    me.innerRadius = Math.max(me.outerRadius - chart.radiusLength * chartWeight, 0);
5690
5691                    for (i = 0, ilen = arcs.length; i < ilen; ++i) {
5692                        me.updateElement(arcs[i], i, reset);
5693                    }
5694                },
5695
5696                updateElement: function (arc, index, reset) {
5697                    var me = this;
5698                    var chart = me.chart;
5699                    var chartArea = chart.chartArea;
5700                    var opts = chart.options;
5701                    var animationOpts = opts.animation;
5702                    var centerX = (chartArea.left + chartArea.right) / 2;
5703                    var centerY = (chartArea.top + chartArea.bottom) / 2;
5704                    var startAngle = opts.rotation; // non reset case handled later
5705                    var endAngle = opts.rotation; // non reset case handled later
5706                    var dataset = me.getDataset();
5707                    var circumference = reset && animationOpts.animateRotate ? 0 : arc.hidden ? 0 : me.calculateCircumference(dataset.data[index]) * (opts.circumference / DOUBLE_PI$1);
5708                    var innerRadius = reset && animationOpts.animateScale ? 0 : me.innerRadius;
5709                    var outerRadius = reset && animationOpts.animateScale ? 0 : me.outerRadius;
5710                    var options = arc._options || {};
5711
5712                    helpers$1.extend(arc, {
5713                        // Utility
5714                        _datasetIndex: me.index,
5715                        _index: index,
5716
5717                        // Desired view properties
5718                        _model: {
5719                            backgroundColor: options.backgroundColor,
5720                            borderColor: options.borderColor,
5721                            borderWidth: options.borderWidth,
5722                            borderAlign: options.borderAlign,
5723                            x: centerX + chart.offsetX,
5724                            y: centerY + chart.offsetY,
5725                            startAngle: startAngle,
5726                            endAngle: endAngle,
5727                            circumference: circumference,
5728                            outerRadius: outerRadius,
5729                            innerRadius: innerRadius,
5730                            label: helpers$1.valueAtIndexOrDefault(dataset.label, index, chart.data.labels[index])
5731                        }
5732                    });
5733
5734                    var model = arc._model;
5735
5736                    // Set correct angles if not resetting
5737                    if (!reset || !animationOpts.animateRotate) {
5738                        if (index === 0) {
5739                            model.startAngle = opts.rotation;
5740                        } else {
5741                            model.startAngle = me.getMeta().data[index - 1]._model.endAngle;
5742                        }
5743
5744                        model.endAngle = model.startAngle + model.circumference;
5745                    }
5746
5747                    arc.pivot();
5748                },
5749
5750                calculateTotal: function () {
5751                    var dataset = this.getDataset();
5752                    var meta = this.getMeta();
5753                    var total = 0;
5754                    var value;
5755
5756                    helpers$1.each(meta.data, function (element, index) {
5757                        value = dataset.data[index];
5758                        if (!isNaN(value) && !element.hidden) {
5759                            total += Math.abs(value);
5760                        }
5761                    });
5762
5763                    /* if (total === 0) {
5764			total = NaN;
5765		}*/
5766
5767                    return total;
5768                },
5769
5770                calculateCircumference: function (value) {
5771                    var total = this.getMeta().total;
5772                    if (total > 0 && !isNaN(value)) {
5773                        return DOUBLE_PI$1 * (Math.abs(value) / total);
5774                    }
5775                    return 0;
5776                },
5777
5778                // gets the max border or hover width to properly scale pie charts
5779                getMaxBorderWidth: function (arcs) {
5780                    var me = this;
5781                    var max = 0;
5782                    var chart = me.chart;
5783                    var i, ilen, meta, arc, controller, options, borderWidth, hoverWidth;
5784
5785                    if (!arcs) {
5786                        // Find the outmost visible dataset
5787                        for (i = 0, ilen = chart.data.datasets.length; i < ilen; ++i) {
5788                            if (chart.isDatasetVisible(i)) {
5789                                meta = chart.getDatasetMeta(i);
5790                                arcs = meta.data;
5791                                if (i !== me.index) {
5792                                    controller = meta.controller;
5793                                }
5794                                break;
5795                            }
5796                        }
5797                    }
5798
5799                    if (!arcs) {
5800                        return 0;
5801                    }
5802
5803                    for (i = 0, ilen = arcs.length; i < ilen; ++i) {
5804                        arc = arcs[i];
5805                        if (controller) {
5806                            controller._configure();
5807                            options = controller._resolveDataElementOptions(arc, i);
5808                        } else {
5809                            options = arc._options;
5810                        }
5811                        if (options.borderAlign !== 'inner') {
5812                            borderWidth = options.borderWidth;
5813                            hoverWidth = options.hoverBorderWidth;
5814
5815                            max = borderWidth > max ? borderWidth : max;
5816                            max = hoverWidth > max ? hoverWidth : max;
5817                        }
5818                    }
5819                    return max;
5820                },
5821
5822                /**
5823                 * @protected
5824                 */
5825                setHoverStyle: function (arc) {
5826                    var model = arc._model;
5827                    var options = arc._options;
5828                    var getHoverColor = helpers$1.getHoverColor;
5829
5830                    arc.$previousStyle = {
5831                        backgroundColor: model.backgroundColor,
5832                        borderColor: model.borderColor,
5833                        borderWidth: model.borderWidth,
5834                    };
5835
5836                    model.backgroundColor = valueOrDefault$5(options.hoverBackgroundColor, getHoverColor(options.backgroundColor));
5837                    model.borderColor = valueOrDefault$5(options.hoverBorderColor, getHoverColor(options.borderColor));
5838                    model.borderWidth = valueOrDefault$5(options.hoverBorderWidth, options.borderWidth);
5839                },
5840
5841                /**
5842                 * Get radius length offset of the dataset in relation to the visible datasets weights. This allows determining the inner and outer radius correctly
5843                 * @private
5844                 */
5845                _getRingWeightOffset: function (datasetIndex) {
5846                    var ringWeightOffset = 0;
5847
5848                    for (var i = 0; i < datasetIndex; ++i) {
5849                        if (this.chart.isDatasetVisible(i)) {
5850                            ringWeightOffset += this._getRingWeight(i);
5851                        }
5852                    }
5853
5854                    return ringWeightOffset;
5855                },
5856
5857                /**
5858                 * @private
5859                 */
5860                _getRingWeight: function (dataSetIndex) {
5861                    return Math.max(valueOrDefault$5(this.chart.data.datasets[dataSetIndex].weight, 1), 0);
5862                },
5863
5864                /**
5865                 * Returns the sum of all visibile data set weights.  This value can be 0.
5866                 * @private
5867                 */
5868                _getVisibleDatasetWeightTotal: function () {
5869                    return this._getRingWeightOffset(this.chart.data.datasets.length);
5870                }
5871            });
5872
5873            core_defaults._set('horizontalBar', {
5874                hover: {
5875                    mode: 'index',
5876                    axis: 'y'
5877                },
5878
5879                scales: {
5880                    xAxes: [{
5881                        type: 'linear',
5882                        position: 'bottom'
5883                    }],
5884
5885                    yAxes: [{
5886                        type: 'category',
5887                        position: 'left',
5888                        offset: true,
5889                        gridLines: {
5890                            offsetGridLines: true
5891                        }
5892                    }]
5893                },
5894
5895                elements: {
5896                    rectangle: {
5897                        borderSkipped: 'left'
5898                    }
5899                },
5900
5901                tooltips: {
5902                    mode: 'index',
5903                    axis: 'y'
5904                }
5905            });
5906
5907            core_defaults._set('global', {
5908                datasets: {
5909                    horizontalBar: {
5910                        categoryPercentage: 0.8,
5911                        barPercentage: 0.9
5912                    }
5913                }
5914            });
5915
5916            var controller_horizontalBar = controller_bar.extend({
5917                /**
5918                 * @private
5919                 */
5920                _getValueScaleId: function () {
5921                    return this.getMeta().xAxisID;
5922                },
5923
5924                /**
5925                 * @private
5926                 */
5927                _getIndexScaleId: function () {
5928                    return this.getMeta().yAxisID;
5929                }
5930            });
5931
5932            var valueOrDefault$6 = helpers$1.valueOrDefault;
5933            var resolve$2 = helpers$1.options.resolve;
5934            var isPointInArea = helpers$1.canvas._isPointInArea;
5935
5936            core_defaults._set('line', {
5937                showLines: true,
5938                spanGaps: false,
5939
5940                hover: {
5941                    mode: 'label'
5942                },
5943
5944                scales: {
5945                    xAxes: [{
5946                        type: 'category',
5947                        id: 'x-axis-0'
5948                    }],
5949                    yAxes: [{
5950                        type: 'linear',
5951                        id: 'y-axis-0'
5952                    }]
5953                }
5954            });
5955
5956            function scaleClip(scale, halfBorderWidth) {
5957                var tickOpts = scale && scale.options.ticks || {};
5958                var reverse = tickOpts.reverse;
5959                var min = tickOpts.min === undefined ? halfBorderWidth : 0;
5960                var max = tickOpts.max === undefined ? halfBorderWidth : 0;
5961                return {
5962                    start: reverse ? max : min,
5963                    end: reverse ? min : max
5964                };
5965            }
5966
5967            function defaultClip(xScale, yScale, borderWidth) {
5968                var halfBorderWidth = borderWidth / 2;
5969                var x = scaleClip(xScale, halfBorderWidth);
5970                var y = scaleClip(yScale, halfBorderWidth);
5971
5972                return {
5973                    top: y.end,
5974                    right: x.end,
5975                    bottom: y.start,
5976                    left: x.start
5977                };
5978            }
5979
5980            function toClip(value) {
5981                var t, r, b, l;
5982
5983                if (helpers$1.isObject(value)) {
5984                    t = value.top;
5985                    r = value.right;
5986                    b = value.bottom;
5987                    l = value.left;
5988                } else {
5989                    t = r = b = l = value;
5990                }
5991
5992                return {
5993                    top: t,
5994                    right: r,
5995                    bottom: b,
5996                    left: l
5997                };
5998            }
5999
6000
6001            var controller_line = core_datasetController.extend({
6002
6003                datasetElementType: elements.Line,
6004
6005                dataElementType: elements.Point,
6006
6007                /**
6008                 * @private
6009                 */
6010                _datasetElementOptions: [
6011                    'backgroundColor',
6012                    'borderCapStyle',
6013                    'borderColor',
6014                    'borderDash',
6015                    'borderDashOffset',
6016                    'borderJoinStyle',
6017                    'borderWidth',
6018                    'cubicInterpolationMode',
6019                    'fill'
6020                ],
6021
6022                /**
6023                 * @private
6024                 */
6025                _dataElementOptions: {
6026                    backgroundColor: 'pointBackgroundColor',
6027                    borderColor: 'pointBorderColor',
6028                    borderWidth: 'pointBorderWidth',
6029                    hitRadius: 'pointHitRadius',
6030                    hoverBackgroundColor: 'pointHoverBackgroundColor',
6031                    hoverBorderColor: 'pointHoverBorderColor',
6032                    hoverBorderWidth: 'pointHoverBorderWidth',
6033                    hoverRadius: 'pointHoverRadius',
6034                    pointStyle: 'pointStyle',
6035                    radius: 'pointRadius',
6036                    rotation: 'pointRotation'
6037                },
6038
6039                update: function (reset) {
6040                    var me = this;
6041                    var meta = me.getMeta();
6042                    var line = meta.dataset;
6043                    var points = meta.data || [];
6044                    var options = me.chart.options;
6045                    var config = me._config;
6046                    var showLine = me._showLine = valueOrDefault$6(config.showLine, options.showLines);
6047                    var i, ilen;
6048
6049                    me._xScale = me.getScaleForId(meta.xAxisID);
6050                    me._yScale = me.getScaleForId(meta.yAxisID);
6051
6052                    // Update Line
6053                    if (showLine) {
6054                        // Compatibility: If the properties are defined with only the old name, use those values
6055                        if (config.tension !== undefined && config.lineTension === undefined) {
6056                            config.lineTension = config.tension;
6057                        }
6058
6059                        // Utility
6060                        line._scale = me._yScale;
6061                        line._datasetIndex = me.index;
6062                        // Data
6063                        line._children = points;
6064                        // Model
6065                        line._model = me._resolveDatasetElementOptions(line);
6066
6067                        line.pivot();
6068                    }
6069
6070                    // Update Points
6071                    for (i = 0, ilen = points.length; i < ilen; ++i) {
6072                        me.updateElement(points[i], i, reset);
6073                    }
6074
6075                    if (showLine && line._model.tension !== 0) {
6076                        me.updateBezierControlPoints();
6077                    }
6078
6079                    // Now pivot the point for animation
6080                    for (i = 0, ilen = points.length; i < ilen; ++i) {
6081                        points[i].pivot();
6082                    }
6083                },
6084
6085                updateElement: function (point, index, reset) {
6086                    var me = this;
6087                    var meta = me.getMeta();
6088                    var custom = point.custom || {};
6089                    var dataset = me.getDataset();
6090                    var datasetIndex = me.index;
6091                    var value = dataset.data[index];
6092                    var xScale = me._xScale;
6093                    var yScale = me._yScale;
6094                    var lineModel = meta.dataset._model;
6095                    var x, y;
6096
6097                    var options = me._resolveDataElementOptions(point, index);
6098
6099                    x = xScale.getPixelForValue(typeof value === 'object' ? value : NaN, index, datasetIndex);
6100                    y = reset ? yScale.getBasePixel() : me.calculatePointY(value, index, datasetIndex);
6101
6102                    // Utility
6103                    point._xScale = xScale;
6104                    point._yScale = yScale;
6105                    point._options = options;
6106                    point._datasetIndex = datasetIndex;
6107                    point._index = index;
6108
6109                    // Desired view properties
6110                    point._model = {
6111                        x: x,
6112                        y: y,
6113                        skip: custom.skip || isNaN(x) || isNaN(y),
6114                        // Appearance
6115                        radius: options.radius,
6116                        pointStyle: options.pointStyle,
6117                        rotation: options.rotation,
6118                        backgroundColor: options.backgroundColor,
6119                        borderColor: options.borderColor,
6120                        borderWidth: options.borderWidth,
6121                        tension: valueOrDefault$6(custom.tension, lineModel ? lineModel.tension : 0),
6122                        steppedLine: lineModel ? lineModel.steppedLine : false,
6123                        // Tooltip
6124                        hitRadius: options.hitRadius
6125                    };
6126                },
6127
6128                /**
6129                 * @private
6130                 */
6131                _resolveDatasetElementOptions: function (element) {
6132                    var me = this;
6133                    var config = me._config;
6134                    var custom = element.custom || {};
6135                    var options = me.chart.options;
6136                    var lineOptions = options.elements.line;
6137                    var values = core_datasetController.prototype._resolveDatasetElementOptions.apply(me, arguments);
6138
6139                    // The default behavior of lines is to break at null values, according
6140                    // to https://github.com/chartjs/Chart.js/issues/2435#issuecomment-216718158
6141                    // This option gives lines the ability to span gaps
6142                    values.spanGaps = valueOrDefault$6(config.spanGaps, options.spanGaps);
6143                    values.tension = valueOrDefault$6(config.lineTension, lineOptions.tension);
6144                    values.steppedLine = resolve$2([custom.steppedLine, config.steppedLine, lineOptions.stepped]);
6145                    values.clip = toClip(valueOrDefault$6(config.clip, defaultClip(me._xScale, me._yScale, values.borderWidth)));
6146
6147                    return values;
6148                },
6149
6150                calculatePointY: function (value, index, datasetIndex) {
6151                    var me = this;
6152                    var chart = me.chart;
6153                    var yScale = me._yScale;
6154                    var sumPos = 0;
6155                    var sumNeg = 0;
6156                    var i, ds, dsMeta, stackedRightValue, rightValue, metasets, ilen;
6157
6158                    if (yScale.options.stacked) {
6159                        rightValue = +yScale.getRightValue(value);
6160                        metasets = chart._getSortedVisibleDatasetMetas();
6161                        ilen = metasets.length;
6162
6163                        for (i = 0; i < ilen; ++i) {
6164                            dsMeta = metasets[i];
6165                            if (dsMeta.index === datasetIndex) {
6166                                break;
6167                            }
6168
6169                            ds = chart.data.datasets[dsMeta.index];
6170                            if (dsMeta.type === 'line' && dsMeta.yAxisID === yScale.id) {
6171                                stackedRightValue = +yScale.getRightValue(ds.data[index]);
6172                                if (stackedRightValue < 0) {
6173                                    sumNeg += stackedRightValue || 0;
6174                                } else {
6175                                    sumPos += stackedRightValue || 0;
6176                                }
6177                            }
6178                        }
6179
6180                        if (rightValue < 0) {
6181                            return yScale.getPixelForValue(sumNeg + rightValue);
6182                        }
6183                        return yScale.getPixelForValue(sumPos + rightValue);
6184                    }
6185                    return yScale.getPixelForValue(value);
6186                },
6187
6188                updateBezierControlPoints: function () {
6189                    var me = this;
6190                    var chart = me.chart;
6191                    var meta = me.getMeta();
6192                    var lineModel = meta.dataset._model;
6193                    var area = chart.chartArea;
6194                    var points = meta.data || [];
6195                    var i, ilen, model, controlPoints;
6196
6197                    // Only consider points that are drawn in case the spanGaps option is used
6198                    if (lineModel.spanGaps) {
6199                        points = points.filter(function (pt) {
6200                            return !pt._model.skip;
6201                        });
6202                    }
6203
6204                    function capControlPoint(pt, min, max) {
6205                        return Math.max(Math.min(pt, max), min);
6206                    }
6207
6208                    if (lineModel.cubicInterpolationMode === 'monotone') {
6209                        helpers$1.splineCurveMonotone(points);
6210                    } else {
6211                        for (i = 0, ilen = points.length; i < ilen; ++i) {
6212                            model = points[i]._model;
6213                            controlPoints = helpers$1.splineCurve(
6214                                helpers$1.previousItem(points, i)._model,
6215                                model,
6216                                helpers$1.nextItem(points, i)._model,
6217                                lineModel.tension
6218                            );
6219                            model.controlPointPreviousX = controlPoints.previous.x;
6220                            model.controlPointPreviousY = controlPoints.previous.y;
6221                            model.controlPointNextX = controlPoints.next.x;
6222                            model.controlPointNextY = controlPoints.next.y;
6223                        }
6224                    }
6225
6226                    if (chart.options.elements.line.capBezierPoints) {
6227                        for (i = 0, ilen = points.length; i < ilen; ++i) {
6228                            model = points[i]._model;
6229                            if (isPointInArea(model, area)) {
6230                                if (i > 0 && isPointInArea(points[i - 1]._model, area)) {
6231                                    model.controlPointPreviousX = capControlPoint(model.controlPointPreviousX, area.left, area.right);
6232                                    model.controlPointPreviousY = capControlPoint(model.controlPointPreviousY, area.top, area.bottom);
6233                                }
6234                                if (i < points.length - 1 && isPointInArea(points[i + 1]._model, area)) {
6235                                    model.controlPointNextX = capControlPoint(model.controlPointNextX, area.left, area.right);
6236                                    model.controlPointNextY = capControlPoint(model.controlPointNextY, area.top, area.bottom);
6237                                }
6238                            }
6239                        }
6240                    }
6241                },
6242
6243                draw: function () {
6244                    var me = this;
6245                    var chart = me.chart;
6246                    var meta = me.getMeta();
6247                    var points = meta.data || [];
6248                    var area = chart.chartArea;
6249                    var canvas = chart.canvas;
6250                    var i = 0;
6251                    var ilen = points.length;
6252                    var clip;
6253
6254                    if (me._showLine) {
6255                        clip = meta.dataset._model.clip;
6256
6257                        helpers$1.canvas.clipArea(chart.ctx, {
6258                            left: clip.left === false ? 0 : area.left - clip.left,
6259                            right: clip.right === false ? canvas.width : area.right + clip.right,
6260                            top: clip.top === false ? 0 : area.top - clip.top,
6261                            bottom: clip.bottom === false ? canvas.height : area.bottom + clip.bottom
6262                        });
6263
6264                        meta.dataset.draw();
6265
6266                        helpers$1.canvas.unclipArea(chart.ctx);
6267                    }
6268
6269                    // Draw the points
6270                    for (; i < ilen; ++i) {
6271                        points[i].draw(area);
6272                    }
6273                },
6274
6275                /**
6276                 * @protected
6277                 */
6278                setHoverStyle: function (point) {
6279                    var model = point._model;
6280                    var options = point._options;
6281                    var getHoverColor = helpers$1.getHoverColor;
6282
6283                    point.$previousStyle = {
6284                        backgroundColor: model.backgroundColor,
6285                        borderColor: model.borderColor,
6286                        borderWidth: model.borderWidth,
6287                        radius: model.radius
6288                    };
6289
6290                    model.backgroundColor = valueOrDefault$6(options.hoverBackgroundColor, getHoverColor(options.backgroundColor));
6291                    model.borderColor = valueOrDefault$6(options.hoverBorderColor, getHoverColor(options.borderColor));
6292                    model.borderWidth = valueOrDefault$6(options.hoverBorderWidth, options.borderWidth);
6293                    model.radius = valueOrDefault$6(options.hoverRadius, options.radius);
6294                },
6295            });
6296
6297            var resolve$3 = helpers$1.options.resolve;
6298
6299            core_defaults._set('polarArea', {
6300                scale: {
6301                    type: 'radialLinear',
6302                    angleLines: {
6303                        display: false
6304                    },
6305                    gridLines: {
6306                        circular: true
6307                    },
6308                    pointLabels: {
6309                        display: false
6310                    },
6311                    ticks: {
6312                        beginAtZero: true
6313                    }
6314                },
6315
6316                // Boolean - Whether to animate the rotation of the chart
6317                animation: {
6318                    animateRotate: true,
6319                    animateScale: true
6320                },
6321
6322                startAngle: -0.5 * Math.PI,
6323                legendCallback: function (chart) {
6324                    var list = document.createElement('ul');
6325                    var data = chart.data;
6326                    var datasets = data.datasets;
6327                    var labels = data.labels;
6328                    var i, ilen, listItem, listItemSpan;
6329
6330                    list.setAttribute('class', chart.id + '-legend');
6331                    if (datasets.length) {
6332                        for (i = 0, ilen = datasets[0].data.length; i < ilen; ++i) {
6333                            listItem = list.appendChild(document.createElement('li'));
6334                            listItemSpan = listItem.appendChild(document.createElement('span'));
6335                            listItemSpan.style.backgroundColor = datasets[0].backgroundColor[i];
6336                            if (labels[i]) {
6337                                listItem.appendChild(document.createTextNode(labels[i]));
6338                            }
6339                        }
6340                    }
6341
6342                    return list.outerHTML;
6343                },
6344                legend: {
6345                    labels: {
6346                        generateLabels: function (chart) {
6347                            var data = chart.data;
6348                            if (data.labels.length && data.datasets.length) {
6349                                return data.labels.map(function (label, i) {
6350                                    var meta = chart.getDatasetMeta(0);
6351                                    var style = meta.controller.getStyle(i);
6352
6353                                    return {
6354                                        text: label,
6355                                        fillStyle: style.backgroundColor,
6356                                        strokeStyle: style.borderColor,
6357                                        lineWidth: style.borderWidth,
6358                                        hidden: isNaN(data.datasets[0].data[i]) || meta.data[i].hidden,
6359
6360                                        // Extra data used for toggling the correct item
6361                                        index: i
6362                                    };
6363                                });
6364                            }
6365                            return [];
6366                        }
6367                    },
6368
6369                    onClick: function (e, legendItem) {
6370                        var index = legendItem.index;
6371                        var chart = this.chart;
6372                        var i, ilen, meta;
6373
6374                        for (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) {
6375                            meta = chart.getDatasetMeta(i);
6376                            meta.data[index].hidden = !meta.data[index].hidden;
6377                        }
6378
6379                        chart.update();
6380                    }
6381                },
6382
6383                // Need to override these to give a nice default
6384                tooltips: {
6385                    callbacks: {
6386                        title: function () {
6387                            return '';
6388                        },
6389                        label: function (item, data) {
6390                            return data.labels[item.index] + ': ' + item.yLabel;
6391                        }
6392                    }
6393                }
6394            });
6395
6396            var controller_polarArea = core_datasetController.extend({
6397
6398                dataElementType: elements.Arc,
6399
6400                linkScales: helpers$1.noop,
6401
6402                /**
6403                 * @private
6404                 */
6405                _dataElementOptions: [
6406                    'backgroundColor',
6407                    'borderColor',
6408                    'borderWidth',
6409                    'borderAlign',
6410                    'hoverBackgroundColor',
6411                    'hoverBorderColor',
6412                    'hoverBorderWidth',
6413                ],
6414
6415                /**
6416                 * @private
6417                 */
6418                _getIndexScaleId: function () {
6419                    return this.chart.scale.id;
6420                },
6421
6422                /**
6423                 * @private
6424                 */
6425                _getValueScaleId: function () {
6426                    return this.chart.scale.id;
6427                },
6428
6429                update: function (reset) {
6430                    var me = this;
6431                    var dataset = me.getDataset();
6432                    var meta = me.getMeta();
6433                    var start = me.chart.options.startAngle || 0;
6434                    var starts = me._starts = [];
6435                    var angles = me._angles = [];
6436                    var arcs = meta.data;
6437                    var i, ilen, angle;
6438
6439                    me._updateRadius();
6440
6441                    meta.count = me.countVisibleElements();
6442
6443                    for (i = 0, ilen = dataset.data.length; i < ilen; i++) {
6444                        starts[i] = start;
6445                        angle = me._computeAngle(i);
6446                        angles[i] = angle;
6447                        start += angle;
6448                    }
6449
6450                    for (i = 0, ilen = arcs.length; i < ilen; ++i) {
6451                        arcs[i]._options = me._resolveDataElementOptions(arcs[i], i);
6452                        me.updateElement(arcs[i], i, reset);
6453                    }
6454                },
6455
6456                /**
6457                 * @private
6458                 */
6459                _updateRadius: function () {
6460                    var me = this;
6461                    var chart = me.chart;
6462                    var chartArea = chart.chartArea;
6463                    var opts = chart.options;
6464                    var minSize = Math.min(chartArea.right - chartArea.left, chartArea.bottom - chartArea.top);
6465
6466                    chart.outerRadius = Math.max(minSize / 2, 0);
6467                    chart.innerRadius = Math.max(opts.cutoutPercentage ? (chart.outerRadius / 100) * (opts.cutoutPercentage) : 1, 0);
6468                    chart.radiusLength = (chart.outerRadius - chart.innerRadius) / chart.getVisibleDatasetCount();
6469
6470                    me.outerRadius = chart.outerRadius - (chart.radiusLength * me.index);
6471                    me.innerRadius = me.outerRadius - chart.radiusLength;
6472                },
6473
6474                updateElement: function (arc, index, reset) {
6475                    var me = this;
6476                    var chart = me.chart;
6477                    var dataset = me.getDataset();
6478                    var opts = chart.options;
6479                    var animationOpts = opts.animation;
6480                    var scale = chart.scale;
6481                    var labels = chart.data.labels;
6482
6483                    var centerX = scale.xCenter;
6484                    var centerY = scale.yCenter;
6485
6486                    // var negHalfPI = -0.5 * Math.PI;
6487                    var datasetStartAngle = opts.startAngle;
6488                    var distance = arc.hidden ? 0 : scale.getDistanceFromCenterForValue(dataset.data[index]);
6489                    var startAngle = me._starts[index];
6490                    var endAngle = startAngle + (arc.hidden ? 0 : me._angles[index]);
6491
6492                    var resetRadius = animationOpts.animateScale ? 0 : scale.getDistanceFromCenterForValue(dataset.data[index]);
6493                    var options = arc._options || {};
6494
6495                    helpers$1.extend(arc, {
6496                        // Utility
6497                        _datasetIndex: me.index,
6498                        _index: index,
6499                        _scale: scale,
6500
6501                        // Desired view properties
6502                        _model: {
6503                            backgroundColor: options.backgroundColor,
6504                            borderColor: options.borderColor,
6505                            borderWidth: options.borderWidth,
6506                            borderAlign: options.borderAlign,
6507                            x: centerX,
6508                            y: centerY,
6509                            innerRadius: 0,
6510                            outerRadius: reset ? resetRadius : distance,
6511                            startAngle: reset && animationOpts.animateRotate ? datasetStartAngle : startAngle,
6512                            endAngle: reset && animationOpts.animateRotate ? datasetStartAngle : endAngle,
6513                            label: helpers$1.valueAtIndexOrDefault(labels, index, labels[index])
6514                        }
6515                    });
6516
6517                    arc.pivot();
6518                },
6519
6520                countVisibleElements: function () {
6521                    var dataset = this.getDataset();
6522                    var meta = this.getMeta();
6523                    var count = 0;
6524
6525                    helpers$1.each(meta.data, function (element, index) {
6526                        if (!isNaN(dataset.data[index]) && !element.hidden) {
6527                            count++;
6528                        }
6529                    });
6530
6531                    return count;
6532                },
6533
6534                /**
6535                 * @protected
6536                 */
6537                setHoverStyle: function (arc) {
6538                    var model = arc._model;
6539                    var options = arc._options;
6540                    var getHoverColor = helpers$1.getHoverColor;
6541                    var valueOrDefault = helpers$1.valueOrDefault;
6542
6543                    arc.$previousStyle = {
6544                        backgroundColor: model.backgroundColor,
6545                        borderColor: model.borderColor,
6546                        borderWidth: model.borderWidth,
6547                    };
6548
6549                    model.backgroundColor = valueOrDefault(options.hoverBackgroundColor, getHoverColor(options.backgroundColor));
6550                    model.borderColor = valueOrDefault(options.hoverBorderColor, getHoverColor(options.borderColor));
6551                    model.borderWidth = valueOrDefault(options.hoverBorderWidth, options.borderWidth);
6552                },
6553
6554                /**
6555                 * @private
6556                 */
6557                _computeAngle: function (index) {
6558                    var me = this;
6559                    var count = this.getMeta().count;
6560                    var dataset = me.getDataset();
6561                    var meta = me.getMeta();
6562
6563                    if (isNaN(dataset.data[index]) || meta.data[index].hidden) {
6564                        return 0;
6565                    }
6566
6567                    // Scriptable options
6568                    var context = {
6569                        chart: me.chart,
6570                        dataIndex: index,
6571                        dataset: dataset,
6572                        datasetIndex: me.index
6573                    };
6574
6575                    return resolve$3([
6576                        me.chart.options.elements.arc.angle,
6577                        (2 * Math.PI) / count
6578                    ], context, index);
6579                }
6580            });
6581
6582            core_defaults._set('pie', helpers$1.clone(core_defaults.doughnut));
6583            core_defaults._set('pie', {
6584                cutoutPercentage: 0
6585            });
6586
6587// Pie charts are Doughnut chart with different defaults
6588            var controller_pie = controller_doughnut;
6589
6590            var valueOrDefault$7 = helpers$1.valueOrDefault;
6591
6592            core_defaults._set('radar', {
6593                spanGaps: false,
6594                scale: {
6595                    type: 'radialLinear'
6596                },
6597                elements: {
6598                    line: {
6599                        fill: 'start',
6600                        tension: 0 // no bezier in radar
6601                    }
6602                }
6603            });
6604
6605            var controller_radar = core_datasetController.extend({
6606                datasetElementType: elements.Line,
6607
6608                dataElementType: elements.Point,
6609
6610                linkScales: helpers$1.noop,
6611
6612                /**
6613                 * @private
6614                 */
6615                _datasetElementOptions: [
6616                    'backgroundColor',
6617                    'borderWidth',
6618                    'borderColor',
6619                    'borderCapStyle',
6620                    'borderDash',
6621                    'borderDashOffset',
6622                    'borderJoinStyle',
6623                    'fill'
6624                ],
6625
6626                /**
6627                 * @private
6628                 */
6629                _dataElementOptions: {
6630                    backgroundColor: 'pointBackgroundColor',
6631                    borderColor: 'pointBorderColor',
6632                    borderWidth: 'pointBorderWidth',
6633                    hitRadius: 'pointHitRadius',
6634                    hoverBackgroundColor: 'pointHoverBackgroundColor',
6635                    hoverBorderColor: 'pointHoverBorderColor',
6636                    hoverBorderWidth: 'pointHoverBorderWidth',
6637                    hoverRadius: 'pointHoverRadius',
6638                    pointStyle: 'pointStyle',
6639                    radius: 'pointRadius',
6640                    rotation: 'pointRotation'
6641                },
6642
6643                /**
6644                 * @private
6645                 */
6646                _getIndexScaleId: function () {
6647                    return this.chart.scale.id;
6648                },
6649
6650                /**
6651                 * @private
6652                 */
6653                _getValueScaleId: function () {
6654                    return this.chart.scale.id;
6655                },
6656
6657                update: function (reset) {
6658                    var me = this;
6659                    var meta = me.getMeta();
6660                    var line = meta.dataset;
6661                    var points = meta.data || [];
6662                    var scale = me.chart.scale;
6663                    var config = me._config;
6664                    var i, ilen;
6665
6666                    // Compatibility: If the properties are defined with only the old name, use those values
6667                    if (config.tension !== undefined && config.lineTension === undefined) {
6668                        config.lineTension = config.tension;
6669                    }
6670
6671                    // Utility
6672                    line._scale = scale;
6673                    line._datasetIndex = me.index;
6674                    // Data
6675                    line._children = points;
6676                    line._loop = true;
6677                    // Model
6678                    line._model = me._resolveDatasetElementOptions(line);
6679
6680                    line.pivot();
6681
6682                    // Update Points
6683                    for (i = 0, ilen = points.length; i < ilen; ++i) {
6684                        me.updateElement(points[i], i, reset);
6685                    }
6686
6687                    // Update bezier control points
6688                    me.updateBezierControlPoints();
6689
6690                    // Now pivot the point for animation
6691                    for (i = 0, ilen = points.length; i < ilen; ++i) {
6692                        points[i].pivot();
6693                    }
6694                },
6695
6696                updateElement: function (point, index, reset) {
6697                    var me = this;
6698                    var custom = point.custom || {};
6699                    var dataset = me.getDataset();
6700                    var scale = me.chart.scale;
6701                    var pointPosition = scale.getPointPositionForValue(index, dataset.data[index]);
6702                    var options = me._resolveDataElementOptions(point, index);
6703                    var lineModel = me.getMeta().dataset._model;
6704                    var x = reset ? scale.xCenter : pointPosition.x;
6705                    var y = reset ? scale.yCenter : pointPosition.y;
6706
6707                    // Utility
6708                    point._scale = scale;
6709                    point._options = options;
6710                    point._datasetIndex = me.index;
6711                    point._index = index;
6712
6713                    // Desired view properties
6714                    point._model = {
6715                        x: x, // value not used in dataset scale, but we want a consistent API between scales
6716                        y: y,
6717                        skip: custom.skip || isNaN(x) || isNaN(y),
6718                        // Appearance
6719                        radius: options.radius,
6720                        pointStyle: options.pointStyle,
6721                        rotation: options.rotation,
6722                        backgroundColor: options.backgroundColor,
6723                        borderColor: options.borderColor,
6724                        borderWidth: options.borderWidth,
6725                        tension: valueOrDefault$7(custom.tension, lineModel ? lineModel.tension : 0),
6726
6727                        // Tooltip
6728                        hitRadius: options.hitRadius
6729                    };
6730                },
6731
6732                /**
6733                 * @private
6734                 */
6735                _resolveDatasetElementOptions: function () {
6736                    var me = this;
6737                    var config = me._config;
6738                    var options = me.chart.options;
6739                    var values = core_datasetController.prototype._resolveDatasetElementOptions.apply(me, arguments);
6740
6741                    values.spanGaps = valueOrDefault$7(config.spanGaps, options.spanGaps);
6742                    values.tension = valueOrDefault$7(config.lineTension, options.elements.line.tension);
6743
6744                    return values;
6745                },
6746
6747                updateBezierControlPoints: function () {
6748                    var me = this;
6749                    var meta = me.getMeta();
6750                    var area = me.chart.chartArea;
6751                    var points = meta.data || [];
6752                    var i, ilen, model, controlPoints;
6753
6754                    // Only consider points that are drawn in case the spanGaps option is used
6755                    if (meta.dataset._model.spanGaps) {
6756                        points = points.filter(function (pt) {
6757                            return !pt._model.skip;
6758                        });
6759                    }
6760
6761                    function capControlPoint(pt, min, max) {
6762                        return Math.max(Math.min(pt, max), min);
6763                    }
6764
6765                    for (i = 0, ilen = points.length; i < ilen; ++i) {
6766                        model = points[i]._model;
6767                        controlPoints = helpers$1.splineCurve(
6768                            helpers$1.previousItem(points, i, true)._model,
6769                            model,
6770                            helpers$1.nextItem(points, i, true)._model,
6771                            model.tension
6772                        );
6773
6774                        // Prevent the bezier going outside of the bounds of the graph
6775                        model.controlPointPreviousX = capControlPoint(controlPoints.previous.x, area.left, area.right);
6776                        model.controlPointPreviousY = capControlPoint(controlPoints.previous.y, area.top, area.bottom);
6777                        model.controlPointNextX = capControlPoint(controlPoints.next.x, area.left, area.right);
6778                        model.controlPointNextY = capControlPoint(controlPoints.next.y, area.top, area.bottom);
6779                    }
6780                },
6781
6782                setHoverStyle: function (point) {
6783                    var model = point._model;
6784                    var options = point._options;
6785                    var getHoverColor = helpers$1.getHoverColor;
6786
6787                    point.$previousStyle = {
6788                        backgroundColor: model.backgroundColor,
6789                        borderColor: model.borderColor,
6790                        borderWidth: model.borderWidth,
6791                        radius: model.radius
6792                    };
6793
6794                    model.backgroundColor = valueOrDefault$7(options.hoverBackgroundColor, getHoverColor(options.backgroundColor));
6795                    model.borderColor = valueOrDefault$7(options.hoverBorderColor, getHoverColor(options.borderColor));
6796                    model.borderWidth = valueOrDefault$7(options.hoverBorderWidth, options.borderWidth);
6797                    model.radius = valueOrDefault$7(options.hoverRadius, options.radius);
6798                }
6799            });
6800
6801            core_defaults._set('scatter', {
6802                hover: {
6803                    mode: 'single'
6804                },
6805
6806                scales: {
6807                    xAxes: [{
6808                        id: 'x-axis-1',    // need an ID so datasets can reference the scale
6809                        type: 'linear',    // scatter should not use a category axis
6810                        position: 'bottom'
6811                    }],
6812                    yAxes: [{
6813                        id: 'y-axis-1',
6814                        type: 'linear',
6815                        position: 'left'
6816                    }]
6817                },
6818
6819                tooltips: {
6820                    callbacks: {
6821                        title: function () {
6822                            return '';     // doesn't make sense for scatter since data are formatted as a point
6823                        },
6824                        label: function (item) {
6825                            return '(' + item.xLabel + ', ' + item.yLabel + ')';
6826                        }
6827                    }
6828                }
6829            });
6830
6831            core_defaults._set('global', {
6832                datasets: {
6833                    scatter: {
6834                        showLine: false
6835                    }
6836                }
6837            });
6838
6839// Scatter charts use line controllers
6840            var controller_scatter = controller_line;
6841
6842// NOTE export a map in which the key represents the controller type, not
6843// the class, and so must be CamelCase in order to be correctly retrieved
6844// by the controller in core.controller.js (`controllers[meta.type]`).
6845
6846            var controllers = {
6847                bar: controller_bar,
6848                bubble: controller_bubble,
6849                doughnut: controller_doughnut,
6850                horizontalBar: controller_horizontalBar,
6851                line: controller_line,
6852                polarArea: controller_polarArea,
6853                pie: controller_pie,
6854                radar: controller_radar,
6855                scatter: controller_scatter
6856            };
6857
6858            /**
6859             * Helper function to get relative position for an event
6860             * @param {Event|IEvent} event - The event to get the position for
6861             * @param {Chart} chart - The chart
6862             * @returns {object} the event position
6863             */
6864            function getRelativePosition(e, chart) {
6865                if (e.native) {
6866                    return {
6867                        x: e.x,
6868                        y: e.y
6869                    };
6870                }
6871
6872                return helpers$1.getRelativePosition(e, chart);
6873            }
6874
6875            /**
6876             * Helper function to traverse all of the visible elements in the chart
6877             * @param {Chart} chart - the chart
6878             * @param {function} handler - the callback to execute for each visible item
6879             */
6880            function parseVisibleItems(chart, handler) {
6881                var metasets = chart._getSortedVisibleDatasetMetas();
6882                var metadata, i, j, ilen, jlen, element;
6883
6884                for (i = 0, ilen = metasets.length; i < ilen; ++i) {
6885                    metadata = metasets[i].data;
6886                    for (j = 0, jlen = metadata.length; j < jlen; ++j) {
6887                        element = metadata[j];
6888                        if (!element._view.skip) {
6889                            handler(element);
6890                        }
6891                    }
6892                }
6893            }
6894
6895            /**
6896             * Helper function to get the items that intersect the event position
6897             * @param {ChartElement[]} items - elements to filter
6898             * @param {object} position - the point to be nearest to
6899             * @return {ChartElement[]} the nearest items
6900             */
6901            function getIntersectItems(chart, position) {
6902                var elements = [];
6903
6904                parseVisibleItems(chart, function (element) {
6905                    if (element.inRange(position.x, position.y)) {
6906                        elements.push(element);
6907                    }
6908                });
6909
6910                return elements;
6911            }
6912
6913            /**
6914             * Helper function to get the items nearest to the event position considering all visible items in teh chart
6915             * @param {Chart} chart - the chart to look at elements from
6916             * @param {object} position - the point to be nearest to
6917             * @param {boolean} intersect - if true, only consider items that intersect the position
6918             * @param {function} distanceMetric - function to provide the distance between points
6919             * @return {ChartElement[]} the nearest items
6920             */
6921            function getNearestItems(chart, position, intersect, distanceMetric) {
6922                var minDistance = Number.POSITIVE_INFINITY;
6923                var nearestItems = [];
6924
6925                parseVisibleItems(chart, function (element) {
6926                    if (intersect && !element.inRange(position.x, position.y)) {
6927                        return;
6928                    }
6929
6930                    var center = element.getCenterPoint();
6931                    var distance = distanceMetric(position, center);
6932                    if (distance < minDistance) {
6933                        nearestItems = [element];
6934                        minDistance = distance;
6935                    } else if (distance === minDistance) {
6936                        // Can have multiple items at the same distance in which case we sort by size
6937                        nearestItems.push(element);
6938                    }
6939                });
6940
6941                return nearestItems;
6942            }
6943
6944            /**
6945             * Get a distance metric function for two points based on the
6946             * axis mode setting
6947             * @param {string} axis - the axis mode. x|y|xy
6948             */
6949            function getDistanceMetricForAxis(axis) {
6950                var useX = axis.indexOf('x') !== -1;
6951                var useY = axis.indexOf('y') !== -1;
6952
6953                return function (pt1, pt2) {
6954                    var deltaX = useX ? Math.abs(pt1.x - pt2.x) : 0;
6955                    var deltaY = useY ? Math.abs(pt1.y - pt2.y) : 0;
6956                    return Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));
6957                };
6958            }
6959
6960            function indexMode(chart, e, options) {
6961                var position = getRelativePosition(e, chart);
6962                // Default axis for index mode is 'x' to match old behaviour
6963                options.axis = options.axis || 'x';
6964                var distanceMetric = getDistanceMetricForAxis(options.axis);
6965                var items = options.intersect ? getIntersectItems(chart, position) : getNearestItems(chart, position, false, distanceMetric);
6966                var elements = [];
6967
6968                if (!items.length) {
6969                    return [];
6970                }
6971
6972                chart._getSortedVisibleDatasetMetas().forEach(function (meta) {
6973                    var element = meta.data[items[0]._index];
6974
6975                    // don't count items that are skipped (null data)
6976                    if (element && !element._view.skip) {
6977                        elements.push(element);
6978                    }
6979                });
6980
6981                return elements;
6982            }
6983
6984            /**
6985             * @interface IInteractionOptions
6986             */
6987            /**
6988             * If true, only consider items that intersect the point
6989             * @name IInterfaceOptions#boolean
6990             * @type Boolean
6991             */
6992
6993            /**
6994             * Contains interaction related functions
6995             * @namespace Chart.Interaction
6996             */
6997            var core_interaction = {
6998                // Helper function for different modes
6999                modes: {
7000                    single: function (chart, e) {
7001                        var position = getRelativePosition(e, chart);
7002                        var elements = [];
7003
7004                        parseVisibleItems(chart, function (element) {
7005                            if (element.inRange(position.x, position.y)) {
7006                                elements.push(element);
7007                                return elements;
7008                            }
7009                        });
7010
7011                        return elements.slice(0, 1);
7012                    },
7013
7014                    /**
7015                     * @function Chart.Interaction.modes.label
7016                     * @deprecated since version 2.4.0
7017                     * @todo remove at version 3
7018                     * @private
7019                     */
7020                    label: indexMode,
7021
7022                    /**
7023                     * Returns items at the same index. If the options.intersect parameter is true, we only return items if we intersect something
7024                     * If the options.intersect mode is false, we find the nearest item and return the items at the same index as that item
7025                     * @function Chart.Interaction.modes.index
7026                     * @since v2.4.0
7027                     * @param {Chart} chart - the chart we are returning items from
7028                     * @param {Event} e - the event we are find things at
7029                     * @param {IInteractionOptions} options - options to use during interaction
7030                     * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
7031                     */
7032                    index: indexMode,
7033
7034                    /**
7035                     * Returns items in the same dataset. If the options.intersect parameter is true, we only return items if we intersect something
7036                     * If the options.intersect is false, we find the nearest item and return the items in that dataset
7037                     * @function Chart.Interaction.modes.dataset
7038                     * @param {Chart} chart - the chart we are returning items from
7039                     * @param {Event} e - the event we are find things at
7040                     * @param {IInteractionOptions} options - options to use during interaction
7041                     * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
7042                     */
7043                    dataset: function (chart, e, options) {
7044                        var position = getRelativePosition(e, chart);
7045                        options.axis = options.axis || 'xy';
7046                        var distanceMetric = getDistanceMetricForAxis(options.axis);
7047                        var items = options.intersect ? getIntersectItems(chart, position) : getNearestItems(chart, position, false, distanceMetric);
7048
7049                        if (items.length > 0) {
7050                            items = chart.getDatasetMeta(items[0]._datasetIndex).data;
7051                        }
7052
7053                        return items;
7054                    },
7055
7056                    /**
7057                     * @function Chart.Interaction.modes.x-axis
7058                     * @deprecated since version 2.4.0. Use index mode and intersect == true
7059                     * @todo remove at version 3
7060                     * @private
7061                     */
7062                    'x-axis': function (chart, e) {
7063                        return indexMode(chart, e, {intersect: false});
7064                    },
7065
7066                    /**
7067                     * Point mode returns all elements that hit test based on the event position
7068                     * of the event
7069                     * @function Chart.Interaction.modes.intersect
7070                     * @param {Chart} chart - the chart we are returning items from
7071                     * @param {Event} e - the event we are find things at
7072                     * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
7073                     */
7074                    point: function (chart, e) {
7075                        var position = getRelativePosition(e, chart);
7076                        return getIntersectItems(chart, position);
7077                    },
7078
7079                    /**
7080                     * nearest mode returns the element closest to the point
7081                     * @function Chart.Interaction.modes.intersect
7082                     * @param {Chart} chart - the chart we are returning items from
7083                     * @param {Event} e - the event we are find things at
7084                     * @param {IInteractionOptions} options - options to use
7085                     * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
7086                     */
7087                    nearest: function (chart, e, options) {
7088                        var position = getRelativePosition(e, chart);
7089                        options.axis = options.axis || 'xy';
7090                        var distanceMetric = getDistanceMetricForAxis(options.axis);
7091                        return getNearestItems(chart, position, options.intersect, distanceMetric);
7092                    },
7093
7094                    /**
7095                     * x mode returns the elements that hit-test at the current x coordinate
7096                     * @function Chart.Interaction.modes.x
7097                     * @param {Chart} chart - the chart we are returning items from
7098                     * @param {Event} e - the event we are find things at
7099                     * @param {IInteractionOptions} options - options to use
7100                     * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
7101                     */
7102                    x: function (chart, e, options) {
7103                        var position = getRelativePosition(e, chart);
7104                        var items = [];
7105                        var intersectsItem = false;
7106
7107                        parseVisibleItems(chart, function (element) {
7108                            if (element.inXRange(position.x)) {
7109                                items.push(element);
7110                            }
7111
7112                            if (element.inRange(position.x, position.y)) {
7113                                intersectsItem = true;
7114                            }
7115                        });
7116
7117                        // If we want to trigger on an intersect and we don't have any items
7118                        // that intersect the position, return nothing
7119                        if (options.intersect && !intersectsItem) {
7120                            items = [];
7121                        }
7122                        return items;
7123                    },
7124
7125                    /**
7126                     * y mode returns the elements that hit-test at the current y coordinate
7127                     * @function Chart.Interaction.modes.y
7128                     * @param {Chart} chart - the chart we are returning items from
7129                     * @param {Event} e - the event we are find things at
7130                     * @param {IInteractionOptions} options - options to use
7131                     * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
7132                     */
7133                    y: function (chart, e, options) {
7134                        var position = getRelativePosition(e, chart);
7135                        var items = [];
7136                        var intersectsItem = false;
7137
7138                        parseVisibleItems(chart, function (element) {
7139                            if (element.inYRange(position.y)) {
7140                                items.push(element);
7141                            }
7142
7143                            if (element.inRange(position.x, position.y)) {
7144                                intersectsItem = true;
7145                            }
7146                        });
7147
7148                        // If we want to trigger on an intersect and we don't have any items
7149                        // that intersect the position, return nothing
7150                        if (options.intersect && !intersectsItem) {
7151                            items = [];
7152                        }
7153                        return items;
7154                    }
7155                }
7156            };
7157
7158            var extend = helpers$1.extend;
7159
7160            function filterByPosition(array, position) {
7161                return helpers$1.where(array, function (v) {
7162                    return v.pos === position;
7163                });
7164            }
7165
7166            function sortByWeight(array, reverse) {
7167                return array.sort(function (a, b) {
7168                    var v0 = reverse ? b : a;
7169                    var v1 = reverse ? a : b;
7170                    return v0.weight === v1.weight ?
7171                        v0.index - v1.index :
7172                        v0.weight - v1.weight;
7173                });
7174            }
7175
7176            function wrapBoxes(boxes) {
7177                var layoutBoxes = [];
7178                var i, ilen, box;
7179
7180                for (i = 0, ilen = (boxes || []).length; i < ilen; ++i) {
7181                    box = boxes[i];
7182                    layoutBoxes.push({
7183                        index: i,
7184                        box: box,
7185                        pos: box.position,
7186                        horizontal: box.isHorizontal(),
7187                        weight: box.weight
7188                    });
7189                }
7190                return layoutBoxes;
7191            }
7192
7193            function setLayoutDims(layouts, params) {
7194                var i, ilen, layout;
7195                for (i = 0, ilen = layouts.length; i < ilen; ++i) {
7196                    layout = layouts[i];
7197                    // store width used instead of chartArea.w in fitBoxes
7198                    layout.width = layout.horizontal
7199                        ? layout.box.fullWidth && params.availableWidth
7200                        : params.vBoxMaxWidth;
7201                    // store height used instead of chartArea.h in fitBoxes
7202                    layout.height = layout.horizontal && params.hBoxMaxHeight;
7203                }
7204            }
7205
7206            function buildLayoutBoxes(boxes) {
7207                var layoutBoxes = wrapBoxes(boxes);
7208                var left = sortByWeight(filterByPosition(layoutBoxes, 'left'), true);
7209                var right = sortByWeight(filterByPosition(layoutBoxes, 'right'));
7210                var top = sortByWeight(filterByPosition(layoutBoxes, 'top'), true);
7211                var bottom = sortByWeight(filterByPosition(layoutBoxes, 'bottom'));
7212
7213                return {
7214                    leftAndTop: left.concat(top),
7215                    rightAndBottom: right.concat(bottom),
7216                    chartArea: filterByPosition(layoutBoxes, 'chartArea'),
7217                    vertical: left.concat(right),
7218                    horizontal: top.concat(bottom)
7219                };
7220            }
7221
7222            function getCombinedMax(maxPadding, chartArea, a, b) {
7223                return Math.max(maxPadding[a], chartArea[a]) + Math.max(maxPadding[b], chartArea[b]);
7224            }
7225
7226            function updateDims(chartArea, params, layout) {
7227                var box = layout.box;
7228                var maxPadding = chartArea.maxPadding;
7229                var newWidth, newHeight;
7230
7231                if (layout.size) {
7232                    // this layout was already counted for, lets first reduce old size
7233                    chartArea[layout.pos] -= layout.size;
7234                }
7235                layout.size = layout.horizontal ? box.height : box.width;
7236                chartArea[layout.pos] += layout.size;
7237
7238                if (box.getPadding) {
7239                    var boxPadding = box.getPadding();
7240                    maxPadding.top = Math.max(maxPadding.top, boxPadding.top);
7241                    maxPadding.left = Math.max(maxPadding.left, boxPadding.left);
7242                    maxPadding.bottom = Math.max(maxPadding.bottom, boxPadding.bottom);
7243                    maxPadding.right = Math.max(maxPadding.right, boxPadding.right);
7244                }
7245
7246                newWidth = params.outerWidth - getCombinedMax(maxPadding, chartArea, 'left', 'right');
7247                newHeight = params.outerHeight - getCombinedMax(maxPadding, chartArea, 'top', 'bottom');
7248
7249                if (newWidth !== chartArea.w || newHeight !== chartArea.h) {
7250                    chartArea.w = newWidth;
7251                    chartArea.h = newHeight;
7252
7253                    // return true if chart area changed in layout's direction
7254                    var sizes = layout.horizontal ? [newWidth, chartArea.w] : [newHeight, chartArea.h];
7255                    return sizes[0] !== sizes[1] && (!isNaN(sizes[0]) || !isNaN(sizes[1]));
7256                }
7257            }
7258
7259            function handleMaxPadding(chartArea) {
7260                var maxPadding = chartArea.maxPadding;
7261
7262                function updatePos(pos) {
7263                    var change = Math.max(maxPadding[pos] - chartArea[pos], 0);
7264                    chartArea[pos] += change;
7265                    return change;
7266                }
7267
7268                chartArea.y += updatePos('top');
7269                chartArea.x += updatePos('left');
7270                updatePos('right');
7271                updatePos('bottom');
7272            }
7273
7274            function getMargins(horizontal, chartArea) {
7275                var maxPadding = chartArea.maxPadding;
7276
7277                function marginForPositions(positions) {
7278                    var margin = {left: 0, top: 0, right: 0, bottom: 0};
7279                    positions.forEach(function (pos) {
7280                        margin[pos] = Math.max(chartArea[pos], maxPadding[pos]);
7281                    });
7282                    return margin;
7283                }
7284
7285                return horizontal
7286                    ? marginForPositions(['left', 'right'])
7287                    : marginForPositions(['top', 'bottom']);
7288            }
7289
7290            function fitBoxes(boxes, chartArea, params) {
7291                var refitBoxes = [];
7292                var i, ilen, layout, box, refit, changed;
7293
7294                for (i = 0, ilen = boxes.length; i < ilen; ++i) {
7295                    layout = boxes[i];
7296                    box = layout.box;
7297
7298                    box.update(
7299                        layout.width || chartArea.w,
7300                        layout.height || chartArea.h,
7301                        getMargins(layout.horizontal, chartArea)
7302                    );
7303                    if (updateDims(chartArea, params, layout)) {
7304                        changed = true;
7305                        if (refitBoxes.length) {
7306                            // Dimensions changed and there were non full width boxes before this
7307                            // -> we have to refit those
7308                            refit = true;
7309                        }
7310                    }
7311                    if (!box.fullWidth) { // fullWidth boxes don't need to be re-fitted in any case
7312                        refitBoxes.push(layout);
7313                    }
7314                }
7315
7316                return refit ? fitBoxes(refitBoxes, chartArea, params) || changed : changed;
7317            }
7318
7319            function placeBoxes(boxes, chartArea, params) {
7320                var userPadding = params.padding;
7321                var x = chartArea.x;
7322                var y = chartArea.y;
7323                var i, ilen, layout, box;
7324
7325                for (i = 0, ilen = boxes.length; i < ilen; ++i) {
7326                    layout = boxes[i];
7327                    box = layout.box;
7328                    if (layout.horizontal) {
7329                        box.left = box.fullWidth ? userPadding.left : chartArea.left;
7330                        box.right = box.fullWidth ? params.outerWidth - userPadding.right : chartArea.left + chartArea.w;
7331                        box.top = y;
7332                        box.bottom = y + box.height;
7333                        box.width = box.right - box.left;
7334                        y = box.bottom;
7335                    } else {
7336                        box.left = x;
7337                        box.right = x + box.width;
7338                        box.top = chartArea.top;
7339                        box.bottom = chartArea.top + chartArea.h;
7340                        box.height = box.bottom - box.top;
7341                        x = box.right;
7342                    }
7343                }
7344
7345                chartArea.x = x;
7346                chartArea.y = y;
7347            }
7348
7349            core_defaults._set('global', {
7350                layout: {
7351                    padding: {
7352                        top: 0,
7353                        right: 0,
7354                        bottom: 0,
7355                        left: 0
7356                    }
7357                }
7358            });
7359
7360            /**
7361             * @interface ILayoutItem
7362             * @prop {string} position - The position of the item in the chart layout. Possible values are
7363             * 'left', 'top', 'right', 'bottom', and 'chartArea'
7364             * @prop {number} weight - The weight used to sort the item. Higher weights are further away from the chart area
7365             * @prop {boolean} fullWidth - if true, and the item is horizontal, then push vertical boxes down
7366             * @prop {function} isHorizontal - returns true if the layout item is horizontal (ie. top or bottom)
7367             * @prop {function} update - Takes two parameters: width and height. Returns size of item
7368             * @prop {function} getPadding -  Returns an object with padding on the edges
7369             * @prop {number} width - Width of item. Must be valid after update()
7370             * @prop {number} height - Height of item. Must be valid after update()
7371             * @prop {number} left - Left edge of the item. Set by layout system and cannot be used in update
7372             * @prop {number} top - Top edge of the item. Set by layout system and cannot be used in update
7373             * @prop {number} right - Right edge of the item. Set by layout system and cannot be used in update
7374             * @prop {number} bottom - Bottom edge of the item. Set by layout system and cannot be used in update
7375             */
7376
7377// The layout service is very self explanatory.  It's responsible for the layout within a chart.
7378// Scales, Legends and Plugins all rely on the layout service and can easily register to be placed anywhere they need
7379// It is this service's responsibility of carrying out that layout.
7380            var core_layouts = {
7381                defaults: {},
7382
7383                /**
7384                 * Register a box to a chart.
7385                 * A box is simply a reference to an object that requires layout. eg. Scales, Legend, Title.
7386                 * @param {Chart} chart - the chart to use
7387                 * @param {ILayoutItem} item - the item to add to be layed out
7388                 */
7389                addBox: function (chart, item) {
7390                    if (!chart.boxes) {
7391                        chart.boxes = [];
7392                    }
7393
7394                    // initialize item with default values
7395                    item.fullWidth = item.fullWidth || false;
7396                    item.position = item.position || 'top';
7397                    item.weight = item.weight || 0;
7398                    item._layers = item._layers || function () {
7399                        return [{
7400                            z: 0,
7401                            draw: function () {
7402                                item.draw.apply(item, arguments);
7403                            }
7404                        }];
7405                    };
7406
7407                    chart.boxes.push(item);
7408                },
7409
7410                /**
7411                 * Remove a layoutItem from a chart
7412                 * @param {Chart} chart - the chart to remove the box from
7413                 * @param {ILayoutItem} layoutItem - the item to remove from the layout
7414                 */
7415                removeBox: function (chart, layoutItem) {
7416                    var index = chart.boxes ? chart.boxes.indexOf(layoutItem) : -1;
7417                    if (index !== -1) {
7418                        chart.boxes.splice(index, 1);
7419                    }
7420                },
7421
7422                /**
7423                 * Sets (or updates) options on the given `item`.
7424                 * @param {Chart} chart - the chart in which the item lives (or will be added to)
7425                 * @param {ILayoutItem} item - the item to configure with the given options
7426                 * @param {object} options - the new item options.
7427                 */
7428                configure: function (chart, item, options) {
7429                    var props = ['fullWidth', 'position', 'weight'];
7430                    var ilen = props.length;
7431                    var i = 0;
7432                    var prop;
7433
7434                    for (; i < ilen; ++i) {
7435                        prop = props[i];
7436                        if (options.hasOwnProperty(prop)) {
7437                            item[prop] = options[prop];
7438                        }
7439                    }
7440                },
7441
7442                /**
7443                 * Fits boxes of the given chart into the given size by having each box measure itself
7444                 * then running a fitting algorithm
7445                 * @param {Chart} chart - the chart
7446                 * @param {number} width - the width to fit into
7447                 * @param {number} height - the height to fit into
7448                 */
7449                update: function (chart, width, height) {
7450                    if (!chart) {
7451                        return;
7452                    }
7453
7454                    var layoutOptions = chart.options.layout || {};
7455                    var padding = helpers$1.options.toPadding(layoutOptions.padding);
7456
7457                    var availableWidth = width - padding.width;
7458                    var availableHeight = height - padding.height;
7459                    var boxes = buildLayoutBoxes(chart.boxes);
7460                    var verticalBoxes = boxes.vertical;
7461                    var horizontalBoxes = boxes.horizontal;
7462
7463                    // Essentially we now have any number of boxes on each of the 4 sides.
7464                    // Our canvas looks like the following.
7465                    // The areas L1 and L2 are the left axes. R1 is the right axis, T1 is the top axis and
7466                    // B1 is the bottom axis
7467                    // There are also 4 quadrant-like locations (left to right instead of clockwise) reserved for chart overlays
7468                    // These locations are single-box locations only, when trying to register a chartArea location that is already taken,
7469                    // an error will be thrown.
7470                    //
7471                    // |----------------------------------------------------|
7472                    // |                  T1 (Full Width)                   |
7473                    // |----------------------------------------------------|
7474                    // |    |    |                 T2                  |    |
7475                    // |    |----|-------------------------------------|----|
7476                    // |    |    | C1 |                           | C2 |    |
7477                    // |    |    |----|                           |----|    |
7478                    // |    |    |                                     |    |
7479                    // | L1 | L2 |           ChartArea (C0)            | R1 |
7480                    // |    |    |                                     |    |
7481                    // |    |    |----|                           |----|    |
7482                    // |    |    | C3 |                           | C4 |    |
7483                    // |    |----|-------------------------------------|----|
7484                    // |    |    |                 B1                  |    |
7485                    // |----------------------------------------------------|
7486                    // |                  B2 (Full Width)                   |
7487                    // |----------------------------------------------------|
7488                    //
7489
7490                    var params = Object.freeze({
7491                        outerWidth: width,
7492                        outerHeight: height,
7493                        padding: padding,
7494                        availableWidth: availableWidth,
7495                        vBoxMaxWidth: availableWidth / 2 / verticalBoxes.length,
7496                        hBoxMaxHeight: availableHeight / 2
7497                    });
7498                    var chartArea = extend({
7499                        maxPadding: extend({}, padding),
7500                        w: availableWidth,
7501                        h: availableHeight,
7502                        x: padding.left,
7503                        y: padding.top
7504                    }, padding);
7505
7506                    setLayoutDims(verticalBoxes.concat(horizontalBoxes), params);
7507
7508                    // First fit vertical boxes
7509                    fitBoxes(verticalBoxes, chartArea, params);
7510
7511                    // Then fit horizontal boxes
7512                    if (fitBoxes(horizontalBoxes, chartArea, params)) {
7513                        // if the area changed, re-fit vertical boxes
7514                        fitBoxes(verticalBoxes, chartArea, params);
7515                    }
7516
7517                    handleMaxPadding(chartArea);
7518
7519                    // Finally place the boxes to correct coordinates
7520                    placeBoxes(boxes.leftAndTop, chartArea, params);
7521
7522                    // Move to opposite side of chart
7523                    chartArea.x += chartArea.w;
7524                    chartArea.y += chartArea.h;
7525
7526                    placeBoxes(boxes.rightAndBottom, chartArea, params);
7527
7528                    chart.chartArea = {
7529                        left: chartArea.left,
7530                        top: chartArea.top,
7531                        right: chartArea.left + chartArea.w,
7532                        bottom: chartArea.top + chartArea.h
7533                    };
7534
7535                    // Finally update boxes in chartArea (radial scale for example)
7536                    helpers$1.each(boxes.chartArea, function (layout) {
7537                        var box = layout.box;
7538                        extend(box, chart.chartArea);
7539                        box.update(chartArea.w, chartArea.h);
7540                    });
7541                }
7542            };
7543
7544            /**
7545             * Platform fallback implementation (minimal).
7546             * @see https://github.com/chartjs/Chart.js/pull/4591#issuecomment-319575939
7547             */
7548
7549            var platform_basic = {
7550                acquireContext: function (item) {
7551                    if (item && item.canvas) {
7552                        // Support for any object associated to a canvas (including a context2d)
7553                        item = item.canvas;
7554                    }
7555
7556                    return item && item.getContext('2d') || null;
7557                }
7558            };
7559
7560            var platform_dom = "/*\r\n * DOM element rendering detection\r\n * https://davidwalsh.name/detect-node-insertion\r\n */\r\n@keyframes chartjs-render-animation {\r\n\tfrom { opacity: 0.99; }\r\n\tto { opacity: 1; }\r\n}\r\n\r\n.chartjs-render-monitor {\r\n\tanimation: chartjs-render-animation 0.001s;\r\n}\r\n\r\n/*\r\n * DOM element resizing detection\r\n * https://github.com/marcj/css-element-queries\r\n */\r\n.chartjs-size-monitor,\r\n.chartjs-size-monitor-expand,\r\n.chartjs-size-monitor-shrink {\r\n\tposition: absolute;\r\n\tdirection: ltr;\r\n\tleft: 0;\r\n\ttop: 0;\r\n\tright: 0;\r\n\tbottom: 0;\r\n\toverflow: hidden;\r\n\tpointer-events: none;\r\n\tvisibility: hidden;\r\n\tz-index: -1;\r\n}\r\n\r\n.chartjs-size-monitor-expand > div {\r\n\tposition: absolute;\r\n\twidth: 1000000px;\r\n\theight: 1000000px;\r\n\tleft: 0;\r\n\ttop: 0;\r\n}\r\n\r\n.chartjs-size-monitor-shrink > div {\r\n\tposition: absolute;\r\n\twidth: 200%;\r\n\theight: 200%;\r\n\tleft: 0;\r\n\ttop: 0;\r\n}\r\n";
7561
7562            var platform_dom$1 = /*#__PURE__*/Object.freeze({
7563                __proto__: null,
7564                'default': platform_dom
7565            });
7566
7567            var stylesheet = getCjsExportFromNamespace(platform_dom$1);
7568
7569            var EXPANDO_KEY = '$chartjs';
7570            var CSS_PREFIX = 'chartjs-';
7571            var CSS_SIZE_MONITOR = CSS_PREFIX + 'size-monitor';
7572            var CSS_RENDER_MONITOR = CSS_PREFIX + 'render-monitor';
7573            var CSS_RENDER_ANIMATION = CSS_PREFIX + 'render-animation';
7574            var ANIMATION_START_EVENTS = ['animationstart', 'webkitAnimationStart'];
7575
7576            /**
7577             * DOM event types -> Chart.js event types.
7578             * Note: only events with different types are mapped.
7579             * @see https://developer.mozilla.org/en-US/docs/Web/Events
7580             */
7581            var EVENT_TYPES = {
7582                touchstart: 'mousedown',
7583                touchmove: 'mousemove',
7584                touchend: 'mouseup',
7585                pointerenter: 'mouseenter',
7586                pointerdown: 'mousedown',
7587                pointermove: 'mousemove',
7588                pointerup: 'mouseup',
7589                pointerleave: 'mouseout',
7590                pointerout: 'mouseout'
7591            };
7592
7593            /**
7594             * The "used" size is the final value of a dimension property after all calculations have
7595             * been performed. This method uses the computed style of `element` but returns undefined
7596             * if the computed style is not expressed in pixels. That can happen in some cases where
7597             * `element` has a size relative to its parent and this last one is not yet displayed,
7598             * for example because of `display: none` on a parent node.
7599             * @see https://developer.mozilla.org/en-US/docs/Web/CSS/used_value
7600             * @returns {number} Size in pixels or undefined if unknown.
7601             */
7602            function readUsedSize(element, property) {
7603                var value = helpers$1.getStyle(element, property);
7604                var matches = value && value.match(/^(\d+)(\.\d+)?px$/);
7605                return matches ? Number(matches[1]) : undefined;
7606            }
7607
7608            /**
7609             * Initializes the canvas style and render size without modifying the canvas display size,
7610             * since responsiveness is handled by the controller.resize() method. The config is used
7611             * to determine the aspect ratio to apply in case no explicit height has been specified.
7612             */
7613            function initCanvas(canvas, config) {
7614                var style = canvas.style;
7615
7616                // NOTE(SB) canvas.getAttribute('width') !== canvas.width: in the first case it
7617                // returns null or '' if no explicit value has been set to the canvas attribute.
7618                var renderHeight = canvas.getAttribute('height');
7619                var renderWidth = canvas.getAttribute('width');
7620
7621                // Chart.js modifies some canvas values that we want to restore on destroy
7622                canvas[EXPANDO_KEY] = {
7623                    initial: {
7624                        height: renderHeight,
7625                        width: renderWidth,
7626                        style: {
7627                            display: style.display,
7628                            height: style.height,
7629                            width: style.width
7630                        }
7631                    }
7632                };
7633
7634                // Force canvas to display as block to avoid extra space caused by inline
7635                // elements, which would interfere with the responsive resize process.
7636                // https://github.com/chartjs/Chart.js/issues/2538
7637                style.display = style.display || 'block';
7638
7639                if (renderWidth === null || renderWidth === '') {
7640                    var displayWidth = readUsedSize(canvas, 'width');
7641                    if (displayWidth !== undefined) {
7642                        canvas.width = displayWidth;
7643                    }
7644                }
7645
7646                if (renderHeight === null || renderHeight === '') {
7647                    if (canvas.style.height === '') {
7648                        // If no explicit render height and style height, let's apply the aspect ratio,
7649                        // which one can be specified by the user but also by charts as default option
7650                        // (i.e. options.aspectRatio). If not specified, use canvas aspect ratio of 2.
7651                        canvas.height = canvas.width / (config.options.aspectRatio || 2);
7652                    } else {
7653                        var displayHeight = readUsedSize(canvas, 'height');
7654                        if (displayWidth !== undefined) {
7655                            canvas.height = displayHeight;
7656                        }
7657                    }
7658                }
7659
7660                return canvas;
7661            }
7662
7663            /**
7664             * Detects support for options object argument in addEventListener.
7665             * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Safely_detecting_option_support
7666             * @private
7667             */
7668            var supportsEventListenerOptions = (function () {
7669                var supports = false;
7670                try {
7671                    var options = Object.defineProperty({}, 'passive', {
7672                        // eslint-disable-next-line getter-return
7673                        get: function () {
7674                            supports = true;
7675                        }
7676                    });
7677                    window.addEventListener('e', null, options);
7678                } catch (e) {
7679                    // continue regardless of error
7680                }
7681                return supports;
7682            }());
7683
7684// Default passive to true as expected by Chrome for 'touchstart' and 'touchend' events.
7685// https://github.com/chartjs/Chart.js/issues/4287
7686            var eventListenerOptions = supportsEventListenerOptions ? {passive: true} : false;
7687
7688            function addListener(node, type, listener) {
7689                node.addEventListener(type, listener, eventListenerOptions);
7690            }
7691
7692            function removeListener(node, type, listener) {
7693                node.removeEventListener(type, listener, eventListenerOptions);
7694            }
7695
7696            function createEvent(type, chart, x, y, nativeEvent) {
7697                return {
7698                    type: type,
7699                    chart: chart,
7700                    native: nativeEvent || null,
7701                    x: x !== undefined ? x : null,
7702                    y: y !== undefined ? y : null,
7703                };
7704            }
7705
7706            function fromNativeEvent(event, chart) {
7707                var type = EVENT_TYPES[event.type] || event.type;
7708                var pos = helpers$1.getRelativePosition(event, chart);
7709                return createEvent(type, chart, pos.x, pos.y, event);
7710            }
7711
7712            function throttled(fn, thisArg) {
7713                var ticking = false;
7714                var args = [];
7715
7716                return function () {
7717                    args = Array.prototype.slice.call(arguments);
7718                    thisArg = thisArg || this;
7719
7720                    if (!ticking) {
7721                        ticking = true;
7722                        helpers$1.requestAnimFrame.call(window, function () {
7723                            ticking = false;
7724                            fn.apply(thisArg, args);
7725                        });
7726                    }
7727                };
7728            }
7729
7730            function createDiv(cls) {
7731                var el = document.createElement('div');
7732                el.className = cls || '';
7733                return el;
7734            }
7735
7736// Implementation based on https://github.com/marcj/css-element-queries
7737            function createResizer(handler) {
7738                var maxSize = 1000000;
7739
7740                // NOTE(SB) Don't use innerHTML because it could be considered unsafe.
7741                // https://github.com/chartjs/Chart.js/issues/5902
7742                var resizer = createDiv(CSS_SIZE_MONITOR);
7743                var expand = createDiv(CSS_SIZE_MONITOR + '-expand');
7744                var shrink = createDiv(CSS_SIZE_MONITOR + '-shrink');
7745
7746                expand.appendChild(createDiv());
7747                shrink.appendChild(createDiv());
7748
7749                resizer.appendChild(expand);
7750                resizer.appendChild(shrink);
7751                resizer._reset = function () {
7752                    expand.scrollLeft = maxSize;
7753                    expand.scrollTop = maxSize;
7754                    shrink.scrollLeft = maxSize;
7755                    shrink.scrollTop = maxSize;
7756                };
7757
7758                var onScroll = function () {
7759                    resizer._reset();
7760                    handler();
7761                };
7762
7763                addListener(expand, 'scroll', onScroll.bind(expand, 'expand'));
7764                addListener(shrink, 'scroll', onScroll.bind(shrink, 'shrink'));
7765
7766                return resizer;
7767            }
7768
7769// https://davidwalsh.name/detect-node-insertion
7770            function watchForRender(node, handler) {
7771                var expando = node[EXPANDO_KEY] || (node[EXPANDO_KEY] = {});
7772                var proxy = expando.renderProxy = function (e) {
7773                    if (e.animationName === CSS_RENDER_ANIMATION) {
7774                        handler();
7775                    }
7776                };
7777
7778                helpers$1.each(ANIMATION_START_EVENTS, function (type) {
7779                    addListener(node, type, proxy);
7780                });
7781
7782                // #4737: Chrome might skip the CSS animation when the CSS_RENDER_MONITOR class
7783                // is removed then added back immediately (same animation frame?). Accessing the
7784                // `offsetParent` property will force a reflow and re-evaluate the CSS animation.
7785                // https://gist.github.com/paulirish/5d52fb081b3570c81e3a#box-metrics
7786                // https://github.com/chartjs/Chart.js/issues/4737
7787                expando.reflow = !!node.offsetParent;
7788
7789                node.classList.add(CSS_RENDER_MONITOR);
7790            }
7791
7792            function unwatchForRender(node) {
7793                var expando = node[EXPANDO_KEY] || {};
7794                var proxy = expando.renderProxy;
7795
7796                if (proxy) {
7797                    helpers$1.each(ANIMATION_START_EVENTS, function (type) {
7798                        removeListener(node, type, proxy);
7799                    });
7800
7801                    delete expando.renderProxy;
7802                }
7803
7804                node.classList.remove(CSS_RENDER_MONITOR);
7805            }
7806
7807            function addResizeListener(node, listener, chart) {
7808                var expando = node[EXPANDO_KEY] || (node[EXPANDO_KEY] = {});
7809
7810                // Let's keep track of this added resizer and thus avoid DOM query when removing it.
7811                var resizer = expando.resizer = createResizer(throttled(function () {
7812                    if (expando.resizer) {
7813                        var container = chart.options.maintainAspectRatio && node.parentNode;
7814                        var w = container ? container.clientWidth : 0;
7815                        listener(createEvent('resize', chart));
7816                        if (container && container.clientWidth < w && chart.canvas) {
7817                            // If the container size shrank during chart resize, let's assume
7818                            // scrollbar appeared. So we resize again with the scrollbar visible -
7819                            // effectively making chart smaller and the scrollbar hidden again.
7820                            // Because we are inside `throttled`, and currently `ticking`, scroll
7821                            // events are ignored during this whole 2 resize process.
7822                            // If we assumed wrong and something else happened, we are resizing
7823                            // twice in a frame (potential performance issue)
7824                            listener(createEvent('resize', chart));
7825                        }
7826                    }
7827                }));
7828
7829                // The resizer needs to be attached to the node parent, so we first need to be
7830                // sure that `node` is attached to the DOM before injecting the resizer element.
7831                watchForRender(node, function () {
7832                    if (expando.resizer) {
7833                        var container = node.parentNode;
7834                        if (container && container !== resizer.parentNode) {
7835                            container.insertBefore(resizer, container.firstChild);
7836                        }
7837
7838                        // The container size might have changed, let's reset the resizer state.
7839                        resizer._reset();
7840                    }
7841                });
7842            }
7843
7844            function removeResizeListener(node) {
7845                var expando = node[EXPANDO_KEY] || {};
7846                var resizer = expando.resizer;
7847
7848                delete expando.resizer;
7849                unwatchForRender(node);
7850
7851                if (resizer && resizer.parentNode) {
7852                    resizer.parentNode.removeChild(resizer);
7853                }
7854            }
7855
7856            /**
7857             * Injects CSS styles inline if the styles are not already present.
7858             * @param {HTMLDocument|ShadowRoot} rootNode - the node to contain the <style>.
7859             * @param {string} css - the CSS to be injected.
7860             */
7861            function injectCSS(rootNode, css) {
7862                // https://stackoverflow.com/q/3922139
7863                var expando = rootNode[EXPANDO_KEY] || (rootNode[EXPANDO_KEY] = {});
7864                if (!expando.containsStyles) {
7865                    expando.containsStyles = true;
7866                    css = '/* Chart.js */\n' + css;
7867                    var style = document.createElement('style');
7868                    style.setAttribute('type', 'text/css');
7869                    style.appendChild(document.createTextNode(css));
7870                    rootNode.appendChild(style);
7871                }
7872            }
7873
7874            var platform_dom$2 = {
7875                /**
7876                 * When `true`, prevents the automatic injection of the stylesheet required to
7877                 * correctly detect when the chart is added to the DOM and then resized. This
7878                 * switch has been added to allow external stylesheet (`dist/Chart(.min)?.js`)
7879                 * to be manually imported to make this library compatible with any CSP.
7880                 * See https://github.com/chartjs/Chart.js/issues/5208
7881                 */
7882                disableCSSInjection: false,
7883
7884                /**
7885                 * This property holds whether this platform is enabled for the current environment.
7886                 * Currently used by platform.js to select the proper implementation.
7887                 * @private
7888                 */
7889                _enabled: typeof window !== 'undefined' && typeof document !== 'undefined',
7890
7891                /**
7892                 * Initializes resources that depend on platform options.
7893                 * @param {HTMLCanvasElement} canvas - The Canvas element.
7894                 * @private
7895                 */
7896                _ensureLoaded: function (canvas) {
7897                    if (!this.disableCSSInjection) {
7898                        // If the canvas is in a shadow DOM, then the styles must also be inserted
7899                        // into the same shadow DOM.
7900                        // https://github.com/chartjs/Chart.js/issues/5763
7901                        var root = canvas.getRootNode ? canvas.getRootNode() : document;
7902                        var targetNode = root.host ? root : document.head;
7903                        injectCSS(targetNode, stylesheet);
7904                    }
7905                },
7906
7907                acquireContext: function (item, config) {
7908                    if (typeof item === 'string') {
7909                        item = document.getElementById(item);
7910                    } else if (item.length) {
7911                        // Support for array based queries (such as jQuery)
7912                        item = item[0];
7913                    }
7914
7915                    if (item && item.canvas) {
7916                        // Support for any object associated to a canvas (including a context2d)
7917                        item = item.canvas;
7918                    }
7919
7920                    // To prevent canvas fingerprinting, some add-ons undefine the getContext
7921                    // method, for example: https://github.com/kkapsner/CanvasBlocker
7922                    // https://github.com/chartjs/Chart.js/issues/2807
7923                    var context = item && item.getContext && item.getContext('2d');
7924
7925                    // `instanceof HTMLCanvasElement/CanvasRenderingContext2D` fails when the item is
7926                    // inside an iframe or when running in a protected environment. We could guess the
7927                    // types from their toString() value but let's keep things flexible and assume it's
7928                    // a sufficient condition if the item has a context2D which has item as `canvas`.
7929                    // https://github.com/chartjs/Chart.js/issues/3887
7930                    // https://github.com/chartjs/Chart.js/issues/4102
7931                    // https://github.com/chartjs/Chart.js/issues/4152
7932                    if (context && context.canvas === item) {
7933                        // Load platform resources on first chart creation, to make it possible to
7934                        // import the library before setting platform options.
7935                        this._ensureLoaded(item);
7936                        initCanvas(item, config);
7937                        return context;
7938                    }
7939
7940                    return null;
7941                },
7942
7943                releaseContext: function (context) {
7944                    var canvas = context.canvas;
7945                    if (!canvas[EXPANDO_KEY]) {
7946                        return;
7947                    }
7948
7949                    var initial = canvas[EXPANDO_KEY].initial;
7950                    ['height', 'width'].forEach(function (prop) {
7951                        var value = initial[prop];
7952                        if (helpers$1.isNullOrUndef(value)) {
7953                            canvas.removeAttribute(prop);
7954                        } else {
7955                            canvas.setAttribute(prop, value);
7956                        }
7957                    });
7958
7959                    helpers$1.each(initial.style || {}, function (value, key) {
7960                        canvas.style[key] = value;
7961                    });
7962
7963                    // The canvas render size might have been changed (and thus the state stack discarded),
7964                    // we can't use save() and restore() to restore the initial state. So make sure that at
7965                    // least the canvas context is reset to the default state by setting the canvas width.
7966                    // https://www.w3.org/TR/2011/WD-html5-20110525/the-canvas-element.html
7967                    // eslint-disable-next-line no-self-assign
7968                    canvas.width = canvas.width;
7969
7970                    delete canvas[EXPANDO_KEY];
7971                },
7972
7973                addEventListener: function (chart, type, listener) {
7974                    var canvas = chart.canvas;
7975                    if (type === 'resize') {
7976                        // Note: the resize event is not supported on all browsers.
7977                        addResizeListener(canvas, listener, chart);
7978                        return;
7979                    }
7980
7981                    var expando = listener[EXPANDO_KEY] || (listener[EXPANDO_KEY] = {});
7982                    var proxies = expando.proxies || (expando.proxies = {});
7983                    var proxy = proxies[chart.id + '_' + type] = function (event) {
7984                        listener(fromNativeEvent(event, chart));
7985                    };
7986
7987                    addListener(canvas, type, proxy);
7988                },
7989
7990                removeEventListener: function (chart, type, listener) {
7991                    var canvas = chart.canvas;
7992                    if (type === 'resize') {
7993                        // Note: the resize event is not supported on all browsers.
7994                        removeResizeListener(canvas);
7995                        return;
7996                    }
7997
7998                    var expando = listener[EXPANDO_KEY] || {};
7999                    var proxies = expando.proxies || {};
8000                    var proxy = proxies[chart.id + '_' + type];
8001                    if (!proxy) {
8002                        return;
8003                    }
8004
8005                    removeListener(canvas, type, proxy);
8006                }
8007            };
8008
8009// DEPRECATIONS
8010
8011            /**
8012             * Provided for backward compatibility, use EventTarget.addEventListener instead.
8013             * EventTarget.addEventListener compatibility: Chrome, Opera 7, Safari, FF1.5+, IE9+
8014             * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
8015             * @function Chart.helpers.addEvent
8016             * @deprecated since version 2.7.0
8017             * @todo remove at version 3
8018             * @private
8019             */
8020            helpers$1.addEvent = addListener;
8021
8022            /**
8023             * Provided for backward compatibility, use EventTarget.removeEventListener instead.
8024             * EventTarget.removeEventListener compatibility: Chrome, Opera 7, Safari, FF1.5+, IE9+
8025             * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener
8026             * @function Chart.helpers.removeEvent
8027             * @deprecated since version 2.7.0
8028             * @todo remove at version 3
8029             * @private
8030             */
8031            helpers$1.removeEvent = removeListener;
8032
8033// @TODO Make possible to select another platform at build time.
8034            var implementation = platform_dom$2._enabled ? platform_dom$2 : platform_basic;
8035
8036            /**
8037             * @namespace Chart.platform
8038             * @see https://chartjs.gitbooks.io/proposals/content/Platform.html
8039             * @since 2.4.0
8040             */
8041            var platform = helpers$1.extend({
8042                /**
8043                 * @since 2.7.0
8044                 */
8045                initialize: function () {
8046                },
8047
8048                /**
8049                 * Called at chart construction time, returns a context2d instance implementing
8050                 * the [W3C Canvas 2D Context API standard]{@link https://www.w3.org/TR/2dcontext/}.
8051                 * @param {*} item - The native item from which to acquire context (platform specific)
8052                 * @param {object} options - The chart options
8053                 * @returns {CanvasRenderingContext2D} context2d instance
8054                 */
8055                acquireContext: function () {
8056                },
8057
8058                /**
8059                 * Called at chart destruction time, releases any resources associated to the context
8060                 * previously returned by the acquireContext() method.
8061                 * @param {CanvasRenderingContext2D} context - The context2d instance
8062                 * @returns {boolean} true if the method succeeded, else false
8063                 */
8064                releaseContext: function () {
8065                },
8066
8067                /**
8068                 * Registers the specified listener on the given chart.
8069                 * @param {Chart} chart - Chart from which to listen for event
8070                 * @param {string} type - The ({@link IEvent}) type to listen for
8071                 * @param {function} listener - Receives a notification (an object that implements
8072                 * the {@link IEvent} interface) when an event of the specified type occurs.
8073                 */
8074                addEventListener: function () {
8075                },
8076
8077                /**
8078                 * Removes the specified listener previously registered with addEventListener.
8079                 * @param {Chart} chart - Chart from which to remove the listener
8080                 * @param {string} type - The ({@link IEvent}) type to remove
8081                 * @param {function} listener - The listener function to remove from the event target.
8082                 */
8083                removeEventListener: function () {
8084                }
8085
8086            }, implementation);
8087
8088            core_defaults._set('global', {
8089                plugins: {}
8090            });
8091
8092            /**
8093             * The plugin service singleton
8094             * @namespace Chart.plugins
8095             * @since 2.1.0
8096             */
8097            var core_plugins = {
8098                /**
8099                 * Globally registered plugins.
8100                 * @private
8101                 */
8102                _plugins: [],
8103
8104                /**
8105                 * This identifier is used to invalidate the descriptors cache attached to each chart
8106                 * when a global plugin is registered or unregistered. In this case, the cache ID is
8107                 * incremented and descriptors are regenerated during following API calls.
8108                 * @private
8109                 */
8110                _cacheId: 0,
8111
8112                /**
8113                 * Registers the given plugin(s) if not already registered.
8114                 * @param {IPlugin[]|IPlugin} plugins plugin instance(s).
8115                 */
8116                register: function (plugins) {
8117                    var p = this._plugins;
8118                    ([]).concat(plugins).forEach(function (plugin) {
8119                        if (p.indexOf(plugin) === -1) {
8120                            p.push(plugin);
8121                        }
8122                    });
8123
8124                    this._cacheId++;
8125                },
8126
8127                /**
8128                 * Unregisters the given plugin(s) only if registered.
8129                 * @param {IPlugin[]|IPlugin} plugins plugin instance(s).
8130                 */
8131                unregister: function (plugins) {
8132                    var p = this._plugins;
8133                    ([]).concat(plugins).forEach(function (plugin) {
8134                        var idx = p.indexOf(plugin);
8135                        if (idx !== -1) {
8136                            p.splice(idx, 1);
8137                        }
8138                    });
8139
8140                    this._cacheId++;
8141                },
8142
8143                /**
8144                 * Remove all registered plugins.
8145                 * @since 2.1.5
8146                 */
8147                clear: function () {
8148                    this._plugins = [];
8149                    this._cacheId++;
8150                },
8151
8152                /**
8153                 * Returns the number of registered plugins?
8154                 * @returns {number}
8155                 * @since 2.1.5
8156                 */
8157                count: function () {
8158                    return this._plugins.length;
8159                },
8160
8161                /**
8162                 * Returns all registered plugin instances.
8163                 * @returns {IPlugin[]} array of plugin objects.
8164                 * @since 2.1.5
8165                 */
8166                getAll: function () {
8167                    return this._plugins;
8168                },
8169
8170                /**
8171                 * Calls enabled plugins for `chart` on the specified hook and with the given args.
8172                 * This method immediately returns as soon as a plugin explicitly returns false. The
8173                 * returned value can be used, for instance, to interrupt the current action.
8174                 * @param {Chart} chart - The chart instance for which plugins should be called.
8175                 * @param {string} hook - The name of the plugin method to call (e.g. 'beforeUpdate').
8176                 * @param {Array} [args] - Extra arguments to apply to the hook call.
8177                 * @returns {boolean} false if any of the plugins return false, else returns true.
8178                 */
8179                notify: function (chart, hook, args) {
8180                    var descriptors = this.descriptors(chart);
8181                    var ilen = descriptors.length;
8182                    var i, descriptor, plugin, params, method;
8183
8184                    for (i = 0; i < ilen; ++i) {
8185                        descriptor = descriptors[i];
8186                        plugin = descriptor.plugin;
8187                        method = plugin[hook];
8188                        if (typeof method === 'function') {
8189                            params = [chart].concat(args || []);
8190                            params.push(descriptor.options);
8191                            if (method.apply(plugin, params) === false) {
8192                                return false;
8193                            }
8194                        }
8195                    }
8196
8197                    return true;
8198                },
8199
8200                /**
8201                 * Returns descriptors of enabled plugins for the given chart.
8202                 * @returns {object[]} [{ plugin, options }]
8203                 * @private
8204                 */
8205                descriptors: function (chart) {
8206                    var cache = chart.$plugins || (chart.$plugins = {});
8207                    if (cache.id === this._cacheId) {
8208                        return cache.descriptors;
8209                    }
8210
8211                    var plugins = [];
8212                    var descriptors = [];
8213                    var config = (chart && chart.config) || {};
8214                    var options = (config.options && config.options.plugins) || {};
8215
8216                    this._plugins.concat(config.plugins || []).forEach(function (plugin) {
8217                        var idx = plugins.indexOf(plugin);
8218                        if (idx !== -1) {
8219                            return;
8220                        }
8221
8222                        var id = plugin.id;
8223                        var opts = options[id];
8224                        if (opts === false) {
8225                            return;
8226                        }
8227
8228                        if (opts === true) {
8229                            opts = helpers$1.clone(core_defaults.global.plugins[id]);
8230                        }
8231
8232                        plugins.push(plugin);
8233                        descriptors.push({
8234                            plugin: plugin,
8235                            options: opts || {}
8236                        });
8237                    });
8238
8239                    cache.descriptors = descriptors;
8240                    cache.id = this._cacheId;
8241                    return descriptors;
8242                },
8243
8244                /**
8245                 * Invalidates cache for the given chart: descriptors hold a reference on plugin option,
8246                 * but in some cases, this reference can be changed by the user when updating options.
8247                 * https://github.com/chartjs/Chart.js/issues/5111#issuecomment-355934167
8248                 * @private
8249                 */
8250                _invalidate: function (chart) {
8251                    delete chart.$plugins;
8252                }
8253            };
8254
8255            var core_scaleService = {
8256                // Scale registration object. Extensions can register new scale types (such as log or DB scales) and then
8257                // use the new chart options to grab the correct scale
8258                constructors: {},
8259                // Use a registration function so that we can move to an ES6 map when we no longer need to support
8260                // old browsers
8261
8262                // Scale config defaults
8263                defaults: {},
8264                registerScaleType: function (type, scaleConstructor, scaleDefaults) {
8265                    this.constructors[type] = scaleConstructor;
8266                    this.defaults[type] = helpers$1.clone(scaleDefaults);
8267                },
8268                getScaleConstructor: function (type) {
8269                    return this.constructors.hasOwnProperty(type) ? this.constructors[type] : undefined;
8270                },
8271                getScaleDefaults: function (type) {
8272                    // Return the scale defaults merged with the global settings so that we always use the latest ones
8273                    return this.defaults.hasOwnProperty(type) ? helpers$1.merge(Object.create(null), [core_defaults.scale, this.defaults[type]]) : {};
8274                },
8275                updateScaleDefaults: function (type, additions) {
8276                    var me = this;
8277                    if (me.defaults.hasOwnProperty(type)) {
8278                        me.defaults[type] = helpers$1.extend(me.defaults[type], additions);
8279                    }
8280                },
8281                addScalesToLayout: function (chart) {
8282                    // Adds each scale to the chart.boxes array to be sized accordingly
8283                    helpers$1.each(chart.scales, function (scale) {
8284                        // Set ILayoutItem parameters for backwards compatibility
8285                        scale.fullWidth = scale.options.fullWidth;
8286                        scale.position = scale.options.position;
8287                        scale.weight = scale.options.weight;
8288                        core_layouts.addBox(chart, scale);
8289                    });
8290                }
8291            };
8292
8293            var valueOrDefault$8 = helpers$1.valueOrDefault;
8294            var getRtlHelper = helpers$1.rtl.getRtlAdapter;
8295
8296            core_defaults._set('global', {
8297                tooltips: {
8298                    enabled: true,
8299                    custom: null,
8300                    mode: 'nearest',
8301                    position: 'average',
8302                    intersect: true,
8303                    backgroundColor: 'rgba(0,0,0,0.8)',
8304                    titleFontStyle: 'bold',
8305                    titleSpacing: 2,
8306                    titleMarginBottom: 6,
8307                    titleFontColor: '#fff',
8308                    titleAlign: 'left',
8309                    bodySpacing: 2,
8310                    bodyFontColor: '#fff',
8311                    bodyAlign: 'left',
8312                    footerFontStyle: 'bold',
8313                    footerSpacing: 2,
8314                    footerMarginTop: 6,
8315                    footerFontColor: '#fff',
8316                    footerAlign: 'left',
8317                    yPadding: 6,
8318                    xPadding: 6,
8319                    caretPadding: 2,
8320                    caretSize: 5,
8321                    cornerRadius: 6,
8322                    multiKeyBackground: '#fff',
8323                    displayColors: true,
8324                    borderColor: 'rgba(0,0,0,0)',
8325                    borderWidth: 0,
8326                    callbacks: {
8327                        // Args are: (tooltipItems, data)
8328                        beforeTitle: helpers$1.noop,
8329                        title: function (tooltipItems, data) {
8330                            var title = '';
8331                            var labels = data.labels;
8332                            var labelCount = labels ? labels.length : 0;
8333
8334                            if (tooltipItems.length > 0) {
8335                                var item = tooltipItems[0];
8336                                if (item.label) {
8337                                    title = item.label;
8338                                } else if (item.xLabel) {
8339                                    title = item.xLabel;
8340                                } else if (labelCount > 0 && item.index < labelCount) {
8341                                    title = labels[item.index];
8342                                }
8343                            }
8344
8345                            return title;
8346                        },
8347                        afterTitle: helpers$1.noop,
8348
8349                        // Args are: (tooltipItems, data)
8350                        beforeBody: helpers$1.noop,
8351
8352                        // Args are: (tooltipItem, data)
8353                        beforeLabel: helpers$1.noop,
8354                        label: function (tooltipItem, data) {
8355                            var label = data.datasets[tooltipItem.datasetIndex].label || '';
8356
8357                            if (label) {
8358                                label += ': ';
8359                            }
8360                            if (!helpers$1.isNullOrUndef(tooltipItem.value)) {
8361                                label += tooltipItem.value;
8362                            } else {
8363                                label += tooltipItem.yLabel;
8364                            }
8365                            return label;
8366                        },
8367                        labelColor: function (tooltipItem, chart) {
8368                            var meta = chart.getDatasetMeta(tooltipItem.datasetIndex);
8369                            var activeElement = meta.data[tooltipItem.index];
8370                            var view = activeElement._view;
8371                            return {
8372                                borderColor: view.borderColor,
8373                                backgroundColor: view.backgroundColor
8374                            };
8375                        },
8376                        labelTextColor: function () {
8377                            return this._options.bodyFontColor;
8378                        },
8379                        afterLabel: helpers$1.noop,
8380
8381                        // Args are: (tooltipItems, data)
8382                        afterBody: helpers$1.noop,
8383
8384                        // Args are: (tooltipItems, data)
8385                        beforeFooter: helpers$1.noop,
8386                        footer: helpers$1.noop,
8387                        afterFooter: helpers$1.noop
8388                    }
8389                }
8390            });
8391
8392            var positioners = {
8393                /**
8394                 * Average mode places the tooltip at the average position of the elements shown
8395                 * @function Chart.Tooltip.positioners.average
8396                 * @param elements {ChartElement[]} the elements being displayed in the tooltip
8397                 * @returns {object} tooltip position
8398                 */
8399                average: function (elements) {
8400                    if (!elements.length) {
8401                        return false;
8402                    }
8403
8404                    var i, len;
8405                    var x = 0;
8406                    var y = 0;
8407                    var count = 0;
8408
8409                    for (i = 0, len = elements.length; i < len; ++i) {
8410                        var el = elements[i];
8411                        if (el && el.hasValue()) {
8412                            var pos = el.tooltipPosition();
8413                            x += pos.x;
8414                            y += pos.y;
8415                            ++count;
8416                        }
8417                    }
8418
8419                    return {
8420                        x: x / count,
8421                        y: y / count
8422                    };
8423                },
8424
8425                /**
8426                 * Gets the tooltip position nearest of the item nearest to the event position
8427                 * @function Chart.Tooltip.positioners.nearest
8428                 * @param elements {Chart.Element[]} the tooltip elements
8429                 * @param eventPosition {object} the position of the event in canvas coordinates
8430                 * @returns {object} the tooltip position
8431                 */
8432                nearest: function (elements, eventPosition) {
8433                    var x = eventPosition.x;
8434                    var y = eventPosition.y;
8435                    var minDistance = Number.POSITIVE_INFINITY;
8436                    var i, len, nearestElement;
8437
8438                    for (i = 0, len = elements.length; i < len; ++i) {
8439                        var el = elements[i];
8440                        if (el && el.hasValue()) {
8441                            var center = el.getCenterPoint();
8442                            var d = helpers$1.distanceBetweenPoints(eventPosition, center);
8443
8444                            if (d < minDistance) {
8445                                minDistance = d;
8446                                nearestElement = el;
8447                            }
8448                        }
8449                    }
8450
8451                    if (nearestElement) {
8452                        var tp = nearestElement.tooltipPosition();
8453                        x = tp.x;
8454                        y = tp.y;
8455                    }
8456
8457                    return {
8458                        x: x,
8459                        y: y
8460                    };
8461                }
8462            };
8463
8464// Helper to push or concat based on if the 2nd parameter is an array or not
8465            function pushOrConcat(base, toPush) {
8466                if (toPush) {
8467                    if (helpers$1.isArray(toPush)) {
8468                        // base = base.concat(toPush);
8469                        Array.prototype.push.apply(base, toPush);
8470                    } else {
8471                        base.push(toPush);
8472                    }
8473                }
8474
8475                return base;
8476            }
8477
8478            /**
8479             * Returns array of strings split by newline
8480             * @param {string} value - The value to split by newline.
8481             * @returns {string[]} value if newline present - Returned from String split() method
8482             * @function
8483             */
8484            function splitNewlines(str) {
8485                if ((typeof str === 'string' || str instanceof String) && str.indexOf('\n') > -1) {
8486                    return str.split('\n');
8487                }
8488                return str;
8489            }
8490
8491
8492            /**
8493             * Private helper to create a tooltip item model
8494             * @param element - the chart element (point, arc, bar) to create the tooltip item for
8495             * @return new tooltip item
8496             */
8497            function createTooltipItem(element) {
8498                var xScale = element._xScale;
8499                var yScale = element._yScale || element._scale; // handle radar || polarArea charts
8500                var index = element._index;
8501                var datasetIndex = element._datasetIndex;
8502                var controller = element._chart.getDatasetMeta(datasetIndex).controller;
8503                var indexScale = controller._getIndexScale();
8504                var valueScale = controller._getValueScale();
8505
8506                return {
8507                    xLabel: xScale ? xScale.getLabelForIndex(index, datasetIndex) : '',
8508                    yLabel: yScale ? yScale.getLabelForIndex(index, datasetIndex) : '',
8509                    label: indexScale ? '' + indexScale.getLabelForIndex(index, datasetIndex) : '',
8510                    value: valueScale ? '' + valueScale.getLabelForIndex(index, datasetIndex) : '',
8511                    index: index,
8512                    datasetIndex: datasetIndex,
8513                    x: element._model.x,
8514                    y: element._model.y
8515                };
8516            }
8517
8518            /**
8519             * Helper to get the reset model for the tooltip
8520             * @param tooltipOpts {object} the tooltip options
8521             */
8522            function getBaseModel(tooltipOpts) {
8523                var globalDefaults = core_defaults.global;
8524
8525                return {
8526                    // Positioning
8527                    xPadding: tooltipOpts.xPadding,
8528                    yPadding: tooltipOpts.yPadding,
8529                    xAlign: tooltipOpts.xAlign,
8530                    yAlign: tooltipOpts.yAlign,
8531
8532                    // Drawing direction and text direction
8533                    rtl: tooltipOpts.rtl,
8534                    textDirection: tooltipOpts.textDirection,
8535
8536                    // Body
8537                    bodyFontColor: tooltipOpts.bodyFontColor,
8538                    _bodyFontFamily: valueOrDefault$8(tooltipOpts.bodyFontFamily, globalDefaults.defaultFontFamily),
8539                    _bodyFontStyle: valueOrDefault$8(tooltipOpts.bodyFontStyle, globalDefaults.defaultFontStyle),
8540                    _bodyAlign: tooltipOpts.bodyAlign,
8541                    bodyFontSize: valueOrDefault$8(tooltipOpts.bodyFontSize, globalDefaults.defaultFontSize),
8542                    bodySpacing: tooltipOpts.bodySpacing,
8543
8544                    // Title
8545                    titleFontColor: tooltipOpts.titleFontColor,
8546                    _titleFontFamily: valueOrDefault$8(tooltipOpts.titleFontFamily, globalDefaults.defaultFontFamily),
8547                    _titleFontStyle: valueOrDefault$8(tooltipOpts.titleFontStyle, globalDefaults.defaultFontStyle),
8548                    titleFontSize: valueOrDefault$8(tooltipOpts.titleFontSize, globalDefaults.defaultFontSize),
8549                    _titleAlign: tooltipOpts.titleAlign,
8550                    titleSpacing: tooltipOpts.titleSpacing,
8551                    titleMarginBottom: tooltipOpts.titleMarginBottom,
8552
8553                    // Footer
8554                    footerFontColor: tooltipOpts.footerFontColor,
8555                    _footerFontFamily: valueOrDefault$8(tooltipOpts.footerFontFamily, globalDefaults.defaultFontFamily),
8556                    _footerFontStyle: valueOrDefault$8(tooltipOpts.footerFontStyle, globalDefaults.defaultFontStyle),
8557                    footerFontSize: valueOrDefault$8(tooltipOpts.footerFontSize, globalDefaults.defaultFontSize),
8558                    _footerAlign: tooltipOpts.footerAlign,
8559                    footerSpacing: tooltipOpts.footerSpacing,
8560                    footerMarginTop: tooltipOpts.footerMarginTop,
8561
8562                    // Appearance
8563                    caretSize: tooltipOpts.caretSize,
8564                    cornerRadius: tooltipOpts.cornerRadius,
8565                    backgroundColor: tooltipOpts.backgroundColor,
8566                    opacity: 0,
vendor: 328,469 bytes, lines 8567-16337
8567                    legendColorBackground: tooltipOpts.multiKeyBackground,
8568                    displayColors: tooltipOpts.displayColors,
8569                    borderColor: tooltipOpts.borderColor,
8570                    borderWidth: tooltipOpts.borderWidth
8571                };
8572            }
8573
8574            /**
8575             * Get the size of the tooltip
8576             */
8577            function getTooltipSize(tooltip, model) {
8578                var ctx = tooltip._chart.ctx;
8579
8580                var height = model.yPadding * 2; // Tooltip Padding
8581                var width = 0;
8582
8583                // Count of all lines in the body
8584                var body = model.body;
8585                var combinedBodyLength = body.reduce(function (count, bodyItem) {
8586                    return count + bodyItem.before.length + bodyItem.lines.length + bodyItem.after.length;
8587                }, 0);
8588                combinedBodyLength += model.beforeBody.length + model.afterBody.length;
8589
8590                var titleLineCount = model.title.length;
8591                var footerLineCount = model.footer.length;
8592                var titleFontSize = model.titleFontSize;
8593                var bodyFontSize = model.bodyFontSize;
8594                var footerFontSize = model.footerFontSize;
8595
8596                height += titleLineCount * titleFontSize; // Title Lines
8597                height += titleLineCount ? (titleLineCount - 1) * model.titleSpacing : 0; // Title Line Spacing
8598                height += titleLineCount ? model.titleMarginBottom : 0; // Title's bottom Margin
8599                height += combinedBodyLength * bodyFontSize; // Body Lines
8600                height += combinedBodyLength ? (combinedBodyLength - 1) * model.bodySpacing : 0; // Body Line Spacing
8601                height += footerLineCount ? model.footerMarginTop : 0; // Footer Margin
8602                height += footerLineCount * (footerFontSize); // Footer Lines
8603                height += footerLineCount ? (footerLineCount - 1) * model.footerSpacing : 0; // Footer Line Spacing
8604
8605                // Title width
8606                var widthPadding = 0;
8607                var maxLineWidth = function (line) {
8608                    width = Math.max(width, ctx.measureText(line).width + widthPadding);
8609                };
8610
8611                ctx.font = helpers$1.fontString(titleFontSize, model._titleFontStyle, model._titleFontFamily);
8612                helpers$1.each(model.title, maxLineWidth);
8613
8614                // Body width
8615                ctx.font = helpers$1.fontString(bodyFontSize, model._bodyFontStyle, model._bodyFontFamily);
8616                helpers$1.each(model.beforeBody.concat(model.afterBody), maxLineWidth);
8617
8618                // Body lines may include some extra width due to the color box
8619                widthPadding = model.displayColors ? (bodyFontSize + 2) : 0;
8620                helpers$1.each(body, function (bodyItem) {
8621                    helpers$1.each(bodyItem.before, maxLineWidth);
8622                    helpers$1.each(bodyItem.lines, maxLineWidth);
8623                    helpers$1.each(bodyItem.after, maxLineWidth);
8624                });
8625
8626                // Reset back to 0
8627                widthPadding = 0;
8628
8629                // Footer width
8630                ctx.font = helpers$1.fontString(footerFontSize, model._footerFontStyle, model._footerFontFamily);
8631                helpers$1.each(model.footer, maxLineWidth);
8632
8633                // Add padding
8634                width += 2 * model.xPadding;
8635
8636                return {
8637                    width: width,
8638                    height: height
8639                };
8640            }
8641
8642            /**
8643             * Helper to get the alignment of a tooltip given the size
8644             */
8645            function determineAlignment(tooltip, size) {
8646                var model = tooltip._model;
8647                var chart = tooltip._chart;
8648                var chartArea = tooltip._chart.chartArea;
8649                var xAlign = 'center';
8650                var yAlign = 'center';
8651
8652                if (model.y < size.height) {
8653                    yAlign = 'top';
8654                } else if (model.y > (chart.height - size.height)) {
8655                    yAlign = 'bottom';
8656                }
8657
8658                var lf, rf; // functions to determine left, right alignment
8659                var olf, orf; // functions to determine if left/right alignment causes tooltip to go outside chart
8660                var yf; // function to get the y alignment if the tooltip goes outside of the left or right edges
8661                var midX = (chartArea.left + chartArea.right) / 2;
8662                var midY = (chartArea.top + chartArea.bottom) / 2;
8663
8664                if (yAlign === 'center') {
8665                    lf = function (x) {
8666                        return x <= midX;
8667                    };
8668                    rf = function (x) {
8669                        return x > midX;
8670                    };
8671                } else {
8672                    lf = function (x) {
8673                        return x <= (size.width / 2);
8674                    };
8675                    rf = function (x) {
8676                        return x >= (chart.width - (size.width / 2));
8677                    };
8678                }
8679
8680                olf = function (x) {
8681                    return x + size.width + model.caretSize + model.caretPadding > chart.width;
8682                };
8683                orf = function (x) {
8684                    return x - size.width - model.caretSize - model.caretPadding < 0;
8685                };
8686                yf = function (y) {
8687                    return y <= midY ? 'top' : 'bottom';
8688                };
8689
8690                if (lf(model.x)) {
8691                    xAlign = 'left';
8692
8693                    // Is tooltip too wide and goes over the right side of the chart.?
8694                    if (olf(model.x)) {
8695                        xAlign = 'center';
8696                        yAlign = yf(model.y);
8697                    }
8698                } else if (rf(model.x)) {
8699                    xAlign = 'right';
8700
8701                    // Is tooltip too wide and goes outside left edge of canvas?
8702                    if (orf(model.x)) {
8703                        xAlign = 'center';
8704                        yAlign = yf(model.y);
8705                    }
8706                }
8707
8708                var opts = tooltip._options;
8709                return {
8710                    xAlign: opts.xAlign ? opts.xAlign : xAlign,
8711                    yAlign: opts.yAlign ? opts.yAlign : yAlign
8712                };
8713            }
8714
8715            /**
8716             * Helper to get the location a tooltip needs to be placed at given the initial position (via the vm) and the size and alignment
8717             */
8718            function getBackgroundPoint(vm, size, alignment, chart) {
8719                // Background Position
8720                var x = vm.x;
8721                var y = vm.y;
8722
8723                var caretSize = vm.caretSize;
8724                var caretPadding = vm.caretPadding;
8725                var cornerRadius = vm.cornerRadius;
8726                var xAlign = alignment.xAlign;
8727                var yAlign = alignment.yAlign;
8728                var paddingAndSize = caretSize + caretPadding;
8729                var radiusAndPadding = cornerRadius + caretPadding;
8730
8731                if (xAlign === 'right') {
8732                    x -= size.width;
8733                } else if (xAlign === 'center') {
8734                    x -= (size.width / 2);
8735                    if (x + size.width > chart.width) {
8736                        x = chart.width - size.width;
8737                    }
8738                    if (x < 0) {
8739                        x = 0;
8740                    }
8741                }
8742
8743                if (yAlign === 'top') {
8744                    y += paddingAndSize;
8745                } else if (yAlign === 'bottom') {
8746                    y -= size.height + paddingAndSize;
8747                } else {
8748                    y -= (size.height / 2);
8749                }
8750
8751                if (yAlign === 'center') {
8752                    if (xAlign === 'left') {
8753                        x += paddingAndSize;
8754                    } else if (xAlign === 'right') {
8755                        x -= paddingAndSize;
8756                    }
8757                } else if (xAlign === 'left') {
8758                    x -= radiusAndPadding;
8759                } else if (xAlign === 'right') {
8760                    x += radiusAndPadding;
8761                }
8762
8763                return {
8764                    x: x,
8765                    y: y
8766                };
8767            }
8768
8769            function getAlignedX(vm, align) {
8770                return align === 'center'
8771                    ? vm.x + vm.width / 2
8772                    : align === 'right'
8773                        ? vm.x + vm.width - vm.xPadding
8774                        : vm.x + vm.xPadding;
8775            }
8776
8777            /**
8778             * Helper to build before and after body lines
8779             */
8780            function getBeforeAfterBodyLines(callback) {
8781                return pushOrConcat([], splitNewlines(callback));
8782            }
8783
8784            var exports$4 = core_element.extend({
8785                initialize: function () {
8786                    this._model = getBaseModel(this._options);
8787                    this._lastActive = [];
8788                },
8789
8790                // Get the title
8791                // Args are: (tooltipItem, data)
8792                getTitle: function () {
8793                    var me = this;
8794                    var opts = me._options;
8795                    var callbacks = opts.callbacks;
8796
8797                    var beforeTitle = callbacks.beforeTitle.apply(me, arguments);
8798                    var title = callbacks.title.apply(me, arguments);
8799                    var afterTitle = callbacks.afterTitle.apply(me, arguments);
8800
8801                    var lines = [];
8802                    lines = pushOrConcat(lines, splitNewlines(beforeTitle));
8803                    lines = pushOrConcat(lines, splitNewlines(title));
8804                    lines = pushOrConcat(lines, splitNewlines(afterTitle));
8805
8806                    return lines;
8807                },
8808
8809                // Args are: (tooltipItem, data)
8810                getBeforeBody: function () {
8811                    return getBeforeAfterBodyLines(this._options.callbacks.beforeBody.apply(this, arguments));
8812                },
8813
8814                // Args are: (tooltipItem, data)
8815                getBody: function (tooltipItems, data) {
8816                    var me = this;
8817                    var callbacks = me._options.callbacks;
8818                    var bodyItems = [];
8819
8820                    helpers$1.each(tooltipItems, function (tooltipItem) {
8821                        var bodyItem = {
8822                            before: [],
8823                            lines: [],
8824                            after: []
8825                        };
8826                        pushOrConcat(bodyItem.before, splitNewlines(callbacks.beforeLabel.call(me, tooltipItem, data)));
8827                        pushOrConcat(bodyItem.lines, callbacks.label.call(me, tooltipItem, data));
8828                        pushOrConcat(bodyItem.after, splitNewlines(callbacks.afterLabel.call(me, tooltipItem, data)));
8829
8830                        bodyItems.push(bodyItem);
8831                    });
8832
8833                    return bodyItems;
8834                },
8835
8836                // Args are: (tooltipItem, data)
8837                getAfterBody: function () {
8838                    return getBeforeAfterBodyLines(this._options.callbacks.afterBody.apply(this, arguments));
8839                },
8840
8841                // Get the footer and beforeFooter and afterFooter lines
8842                // Args are: (tooltipItem, data)
8843                getFooter: function () {
8844                    var me = this;
8845                    var callbacks = me._options.callbacks;
8846
8847                    var beforeFooter = callbacks.beforeFooter.apply(me, arguments);
8848                    var footer = callbacks.footer.apply(me, arguments);
8849                    var afterFooter = callbacks.afterFooter.apply(me, arguments);
8850
8851                    var lines = [];
8852                    lines = pushOrConcat(lines, splitNewlines(beforeFooter));
8853                    lines = pushOrConcat(lines, splitNewlines(footer));
8854                    lines = pushOrConcat(lines, splitNewlines(afterFooter));
8855
8856                    return lines;
8857                },
8858
8859                update: function (changed) {
8860                    var me = this;
8861                    var opts = me._options;
8862
8863                    // Need to regenerate the model because its faster than using extend and it is necessary due to the optimization in Chart.Element.transition
8864                    // that does _view = _model if ease === 1. This causes the 2nd tooltip update to set properties in both the view and model at the same time
8865                    // which breaks any animations.
8866                    var existingModel = me._model;
8867                    var model = me._model = getBaseModel(opts);
8868                    var active = me._active;
8869
8870                    var data = me._data;
8871
8872                    // In the case where active.length === 0 we need to keep these at existing values for good animations
8873                    var alignment = {
8874                        xAlign: existingModel.xAlign,
8875                        yAlign: existingModel.yAlign
8876                    };
8877                    var backgroundPoint = {
8878                        x: existingModel.x,
8879                        y: existingModel.y
8880                    };
8881                    var tooltipSize = {
8882                        width: existingModel.width,
8883                        height: existingModel.height
8884                    };
8885                    var tooltipPosition = {
8886                        x: existingModel.caretX,
8887                        y: existingModel.caretY
8888                    };
8889
8890                    var i, len;
8891
8892                    if (active.length) {
8893                        model.opacity = 1;
8894
8895                        var labelColors = [];
8896                        var labelTextColors = [];
8897                        tooltipPosition = positioners[opts.position].call(me, active, me._eventPosition);
8898
8899                        var tooltipItems = [];
8900                        for (i = 0, len = active.length; i < len; ++i) {
8901                            tooltipItems.push(createTooltipItem(active[i]));
8902                        }
8903
8904                        // If the user provided a filter function, use it to modify the tooltip items
8905                        if (opts.filter) {
8906                            tooltipItems = tooltipItems.filter(function (a) {
8907                                return opts.filter(a, data);
8908                            });
8909                        }
8910
8911                        // If the user provided a sorting function, use it to modify the tooltip items
8912                        if (opts.itemSort) {
8913                            tooltipItems = tooltipItems.sort(function (a, b) {
8914                                return opts.itemSort(a, b, data);
8915                            });
8916                        }
8917
8918                        // Determine colors for boxes
8919                        helpers$1.each(tooltipItems, function (tooltipItem) {
8920                            labelColors.push(opts.callbacks.labelColor.call(me, tooltipItem, me._chart));
8921                            labelTextColors.push(opts.callbacks.labelTextColor.call(me, tooltipItem, me._chart));
8922                        });
8923
8924
8925                        // Build the Text Lines
8926                        model.title = me.getTitle(tooltipItems, data);
8927                        model.beforeBody = me.getBeforeBody(tooltipItems, data);
8928                        model.body = me.getBody(tooltipItems, data);
8929                        model.afterBody = me.getAfterBody(tooltipItems, data);
8930                        model.footer = me.getFooter(tooltipItems, data);
8931
8932                        // Initial positioning and colors
8933                        model.x = tooltipPosition.x;
8934                        model.y = tooltipPosition.y;
8935                        model.caretPadding = opts.caretPadding;
8936                        model.labelColors = labelColors;
8937                        model.labelTextColors = labelTextColors;
8938
8939                        // data points
8940                        model.dataPoints = tooltipItems;
8941
8942                        // We need to determine alignment of the tooltip
8943                        tooltipSize = getTooltipSize(this, model);
8944                        alignment = determineAlignment(this, tooltipSize);
8945                        // Final Size and Position
8946                        backgroundPoint = getBackgroundPoint(model, tooltipSize, alignment, me._chart);
8947                    } else {
8948                        model.opacity = 0;
8949                    }
8950
8951                    model.xAlign = alignment.xAlign;
8952                    model.yAlign = alignment.yAlign;
8953                    model.x = backgroundPoint.x;
8954                    model.y = backgroundPoint.y;
8955                    model.width = tooltipSize.width;
8956                    model.height = tooltipSize.height;
8957
8958                    // Point where the caret on the tooltip points to
8959                    model.caretX = tooltipPosition.x;
8960                    model.caretY = tooltipPosition.y;
8961
8962                    me._model = model;
8963
8964                    if (changed && opts.custom) {
8965                        opts.custom.call(me, model);
8966                    }
8967
8968                    return me;
8969                },
8970
8971                drawCaret: function (tooltipPoint, size) {
8972                    var ctx = this._chart.ctx;
8973                    var vm = this._view;
8974                    var caretPosition = this.getCaretPosition(tooltipPoint, size, vm);
8975
8976                    ctx.lineTo(caretPosition.x1, caretPosition.y1);
8977                    ctx.lineTo(caretPosition.x2, caretPosition.y2);
8978                    ctx.lineTo(caretPosition.x3, caretPosition.y3);
8979                },
8980                getCaretPosition: function (tooltipPoint, size, vm) {
8981                    var x1, x2, x3, y1, y2, y3;
8982                    var caretSize = vm.caretSize;
8983                    var cornerRadius = vm.cornerRadius;
8984                    var xAlign = vm.xAlign;
8985                    var yAlign = vm.yAlign;
8986                    var ptX = tooltipPoint.x;
8987                    var ptY = tooltipPoint.y;
8988                    var width = size.width;
8989                    var height = size.height;
8990
8991                    if (yAlign === 'center') {
8992                        y2 = ptY + (height / 2);
8993
8994                        if (xAlign === 'left') {
8995                            x1 = ptX;
8996                            x2 = x1 - caretSize;
8997                            x3 = x1;
8998
8999                            y1 = y2 + caretSize;
9000                            y3 = y2 - caretSize;
9001                        } else {
9002                            x1 = ptX + width;
9003                            x2 = x1 + caretSize;
9004                            x3 = x1;
9005
9006                            y1 = y2 - caretSize;
9007                            y3 = y2 + caretSize;
9008                        }
9009                    } else {
9010                        if (xAlign === 'left') {
9011                            x2 = ptX + cornerRadius + (caretSize);
9012                            x1 = x2 - caretSize;
9013                            x3 = x2 + caretSize;
9014                        } else if (xAlign === 'right') {
9015                            x2 = ptX + width - cornerRadius - caretSize;
9016                            x1 = x2 - caretSize;
9017                            x3 = x2 + caretSize;
9018                        } else {
9019                            x2 = vm.caretX;
9020                            x1 = x2 - caretSize;
9021                            x3 = x2 + caretSize;
9022                        }
9023                        if (yAlign === 'top') {
9024                            y1 = ptY;
9025                            y2 = y1 - caretSize;
9026                            y3 = y1;
9027                        } else {
9028                            y1 = ptY + height;
9029                            y2 = y1 + caretSize;
9030                            y3 = y1;
9031                            // invert drawing order
9032                            var tmp = x3;
9033                            x3 = x1;
9034                            x1 = tmp;
9035                        }
9036                    }
9037                    return {x1: x1, x2: x2, x3: x3, y1: y1, y2: y2, y3: y3};
9038                },
9039
9040                drawTitle: function (pt, vm, ctx) {
9041                    var title = vm.title;
9042                    var length = title.length;
9043                    var titleFontSize, titleSpacing, i;
9044
9045                    if (length) {
9046                        var rtlHelper = getRtlHelper(vm.rtl, vm.x, vm.width);
9047
9048                        pt.x = getAlignedX(vm, vm._titleAlign);
9049
9050                        ctx.textAlign = rtlHelper.textAlign(vm._titleAlign);
9051                        ctx.textBaseline = 'middle';
9052
9053                        titleFontSize = vm.titleFontSize;
9054                        titleSpacing = vm.titleSpacing;
9055
9056                        ctx.fillStyle = vm.titleFontColor;
9057                        ctx.font = helpers$1.fontString(titleFontSize, vm._titleFontStyle, vm._titleFontFamily);
9058
9059                        for (i = 0; i < length; ++i) {
9060                            ctx.fillText(title[i], rtlHelper.x(pt.x), pt.y + titleFontSize / 2);
9061                            pt.y += titleFontSize + titleSpacing; // Line Height and spacing
9062
9063                            if (i + 1 === length) {
9064                                pt.y += vm.titleMarginBottom - titleSpacing; // If Last, add margin, remove spacing
9065                            }
9066                        }
9067                    }
9068                },
9069
9070                drawBody: function (pt, vm, ctx) {
9071                    var bodyFontSize = vm.bodyFontSize;
9072                    var bodySpacing = vm.bodySpacing;
9073                    var bodyAlign = vm._bodyAlign;
9074                    var body = vm.body;
9075                    var drawColorBoxes = vm.displayColors;
9076                    var xLinePadding = 0;
9077                    var colorX = drawColorBoxes ? getAlignedX(vm, 'left') : 0;
9078
9079                    var rtlHelper = getRtlHelper(vm.rtl, vm.x, vm.width);
9080
9081                    var fillLineOfText = function (line) {
9082                        ctx.fillText(line, rtlHelper.x(pt.x + xLinePadding), pt.y + bodyFontSize / 2);
9083                        pt.y += bodyFontSize + bodySpacing;
9084                    };
9085
9086                    var bodyItem, textColor, labelColors, lines, i, j, ilen, jlen;
9087                    var bodyAlignForCalculation = rtlHelper.textAlign(bodyAlign);
9088
9089                    ctx.textAlign = bodyAlign;
9090                    ctx.textBaseline = 'middle';
9091                    ctx.font = helpers$1.fontString(bodyFontSize, vm._bodyFontStyle, vm._bodyFontFamily);
9092
9093                    pt.x = getAlignedX(vm, bodyAlignForCalculation);
9094
9095                    // Before body lines
9096                    ctx.fillStyle = vm.bodyFontColor;
9097                    helpers$1.each(vm.beforeBody, fillLineOfText);
9098
9099                    xLinePadding = drawColorBoxes && bodyAlignForCalculation !== 'right'
9100                        ? bodyAlign === 'center' ? (bodyFontSize / 2 + 1) : (bodyFontSize + 2)
9101                        : 0;
9102
9103                    // Draw body lines now
9104                    for (i = 0, ilen = body.length; i < ilen; ++i) {
9105                        bodyItem = body[i];
9106                        textColor = vm.labelTextColors[i];
9107                        labelColors = vm.labelColors[i];
9108
9109                        ctx.fillStyle = textColor;
9110                        helpers$1.each(bodyItem.before, fillLineOfText);
9111
9112                        lines = bodyItem.lines;
9113                        for (j = 0, jlen = lines.length; j < jlen; ++j) {
9114                            // Draw Legend-like boxes if needed
9115                            if (drawColorBoxes) {
9116                                var rtlColorX = rtlHelper.x(colorX);
9117
9118                                // Fill a white rect so that colours merge nicely if the opacity is < 1
9119                                ctx.fillStyle = vm.legendColorBackground;
9120                                ctx.fillRect(rtlHelper.leftForLtr(rtlColorX, bodyFontSize), pt.y, bodyFontSize, bodyFontSize);
9121
9122                                // Border
9123                                ctx.lineWidth = 1;
9124                                ctx.strokeStyle = labelColors.borderColor;
9125                                ctx.strokeRect(rtlHelper.leftForLtr(rtlColorX, bodyFontSize), pt.y, bodyFontSize, bodyFontSize);
9126
9127                                // Inner square
9128                                ctx.fillStyle = labelColors.backgroundColor;
9129                                ctx.fillRect(rtlHelper.leftForLtr(rtlHelper.xPlus(rtlColorX, 1), bodyFontSize - 2), pt.y + 1, bodyFontSize - 2, bodyFontSize - 2);
9130                                ctx.fillStyle = textColor;
9131                            }
9132
9133                            fillLineOfText(lines[j]);
9134                        }
9135
9136                        helpers$1.each(bodyItem.after, fillLineOfText);
9137                    }
9138
9139                    // Reset back to 0 for after body
9140                    xLinePadding = 0;
9141
9142                    // After body lines
9143                    helpers$1.each(vm.afterBody, fillLineOfText);
9144                    pt.y -= bodySpacing; // Remove last body spacing
9145                },
9146
9147                drawFooter: function (pt, vm, ctx) {
9148                    var footer = vm.footer;
9149                    var length = footer.length;
9150                    var footerFontSize, i;
9151
9152                    if (length) {
9153                        var rtlHelper = getRtlHelper(vm.rtl, vm.x, vm.width);
9154
9155                        pt.x = getAlignedX(vm, vm._footerAlign);
9156                        pt.y += vm.footerMarginTop;
9157
9158                        ctx.textAlign = rtlHelper.textAlign(vm._footerAlign);
9159                        ctx.textBaseline = 'middle';
9160
9161                        footerFontSize = vm.footerFontSize;
9162
9163                        ctx.fillStyle = vm.footerFontColor;
9164                        ctx.font = helpers$1.fontString(footerFontSize, vm._footerFontStyle, vm._footerFontFamily);
9165
9166                        for (i = 0; i < length; ++i) {
9167                            ctx.fillText(footer[i], rtlHelper.x(pt.x), pt.y + footerFontSize / 2);
9168                            pt.y += footerFontSize + vm.footerSpacing;
9169                        }
9170                    }
9171                },
9172
9173                drawBackground: function (pt, vm, ctx, tooltipSize) {
9174                    ctx.fillStyle = vm.backgroundColor;
9175                    ctx.strokeStyle = vm.borderColor;
9176                    ctx.lineWidth = vm.borderWidth;
9177                    var xAlign = vm.xAlign;
9178                    var yAlign = vm.yAlign;
9179                    var x = pt.x;
9180                    var y = pt.y;
9181                    var width = tooltipSize.width;
9182                    var height = tooltipSize.height;
9183                    var radius = vm.cornerRadius;
9184
9185                    ctx.beginPath();
9186                    ctx.moveTo(x + radius, y);
9187                    if (yAlign === 'top') {
9188                        this.drawCaret(pt, tooltipSize);
9189                    }
9190                    ctx.lineTo(x + width - radius, y);
9191                    ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
9192                    if (yAlign === 'center' && xAlign === 'right') {
9193                        this.drawCaret(pt, tooltipSize);
9194                    }
9195                    ctx.lineTo(x + width, y + height - radius);
9196                    ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
9197                    if (yAlign === 'bottom') {
9198                        this.drawCaret(pt, tooltipSize);
9199                    }
9200                    ctx.lineTo(x + radius, y + height);
9201                    ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
9202                    if (yAlign === 'center' && xAlign === 'left') {
9203                        this.drawCaret(pt, tooltipSize);
9204                    }
9205                    ctx.lineTo(x, y + radius);
9206                    ctx.quadraticCurveTo(x, y, x + radius, y);
9207                    ctx.closePath();
9208
9209                    ctx.fill();
9210
9211                    if (vm.borderWidth > 0) {
9212                        ctx.stroke();
9213                    }
9214                },
9215
9216                draw: function () {
9217                    var ctx = this._chart.ctx;
9218                    var vm = this._view;
9219
9220                    if (vm.opacity === 0) {
9221                        return;
9222                    }
9223
9224                    var tooltipSize = {
9225                        width: vm.width,
9226                        height: vm.height
9227                    };
9228                    var pt = {
9229                        x: vm.x,
9230                        y: vm.y
9231                    };
9232
9233                    // IE11/Edge does not like very small opacities, so snap to 0
9234                    var opacity = Math.abs(vm.opacity < 1e-3) ? 0 : vm.opacity;
9235
9236                    // Truthy/falsey value for empty tooltip
9237                    var hasTooltipContent = vm.title.length || vm.beforeBody.length || vm.body.length || vm.afterBody.length || vm.footer.length;
9238
9239                    if (this._options.enabled && hasTooltipContent) {
9240                        ctx.save();
9241                        ctx.globalAlpha = opacity;
9242
9243                        // Draw Background
9244                        this.drawBackground(pt, vm, ctx, tooltipSize);
9245
9246                        // Draw Title, Body, and Footer
9247                        pt.y += vm.yPadding;
9248
9249                        helpers$1.rtl.overrideTextDirection(ctx, vm.textDirection);
9250
9251                        // Titles
9252                        this.drawTitle(pt, vm, ctx);
9253
9254                        // Body
9255                        this.drawBody(pt, vm, ctx);
9256
9257                        // Footer
9258                        this.drawFooter(pt, vm, ctx);
9259
9260                        helpers$1.rtl.restoreTextDirection(ctx, vm.textDirection);
9261
9262                        ctx.restore();
9263                    }
9264                },
9265
9266                /**
9267                 * Handle an event
9268                 * @private
9269                 * @param {IEvent} event - The event to handle
9270                 * @returns {boolean} true if the tooltip changed
9271                 */
9272                handleEvent: function (e) {
9273                    var me = this;
9274                    var options = me._options;
9275                    var changed = false;
9276
9277                    me._lastActive = me._lastActive || [];
9278
9279                    // Find Active Elements for tooltips
9280                    if (e.type === 'mouseout') {
9281                        me._active = [];
9282                    } else {
9283                        me._active = me._chart.getElementsAtEventForMode(e, options.mode, options);
9284                        if (options.reverse) {
9285                            me._active.reverse();
9286                        }
9287                    }
9288
9289                    // Remember Last Actives
9290                    changed = !helpers$1.arrayEquals(me._active, me._lastActive);
9291
9292                    // Only handle target event on tooltip change
9293                    if (changed) {
9294                        me._lastActive = me._active;
9295
9296                        if (options.enabled || options.custom) {
9297                            me._eventPosition = {
9298                                x: e.x,
9299                                y: e.y
9300                            };
9301
9302                            me.update(true);
9303                            me.pivot();
9304                        }
9305                    }
9306
9307                    return changed;
9308                }
9309            });
9310
9311            /**
9312             * @namespace Chart.Tooltip.positioners
9313             */
9314            var positioners_1 = positioners;
9315
9316            var core_tooltip = exports$4;
9317            core_tooltip.positioners = positioners_1;
9318
9319            var valueOrDefault$9 = helpers$1.valueOrDefault;
9320
9321            core_defaults._set('global', {
9322                elements: {},
9323                events: [
9324                    'mousemove',
9325                    'mouseout',
9326                    'click',
9327                    'touchstart',
9328                    'touchmove'
9329                ],
9330                hover: {
9331                    onHover: null,
9332                    mode: 'nearest',
9333                    intersect: true,
9334                    animationDuration: 400
9335                },
9336                onClick: null,
9337                maintainAspectRatio: true,
9338                responsive: true,
9339                responsiveAnimationDuration: 0
9340            });
9341
9342            /**
9343             * Recursively merge the given config objects representing the `scales` option
9344             * by incorporating scale defaults in `xAxes` and `yAxes` array items, then
9345             * returns a deep copy of the result, thus doesn't alter inputs.
9346             */
9347            function mergeScaleConfig(/* config objects ... */) {
9348                return helpers$1.merge(Object.create(null), [].slice.call(arguments), {
9349                    merger: function (key, target, source, options) {
9350                        if (key === 'xAxes' || key === 'yAxes') {
9351                            var slen = source[key].length;
9352                            var i, type, scale;
9353
9354                            if (!target[key]) {
9355                                target[key] = [];
9356                            }
9357
9358                            for (i = 0; i < slen; ++i) {
9359                                scale = source[key][i];
9360                                type = valueOrDefault$9(scale.type, key === 'xAxes' ? 'category' : 'linear');
9361
9362                                if (i >= target[key].length) {
9363                                    target[key].push({});
9364                                }
9365
9366                                if (!target[key][i].type || (scale.type && scale.type !== target[key][i].type)) {
9367                                    // new/untyped scale or type changed: let's apply the new defaults
9368                                    // then merge source scale to correctly overwrite the defaults.
9369                                    helpers$1.merge(target[key][i], [core_scaleService.getScaleDefaults(type), scale]);
9370                                } else {
9371                                    // scales type are the same
9372                                    helpers$1.merge(target[key][i], scale);
9373                                }
9374                            }
9375                        } else {
9376                            helpers$1._merger(key, target, source, options);
9377                        }
9378                    }
9379                });
9380            }
9381
9382            /**
9383             * Recursively merge the given config objects as the root options by handling
9384             * default scale options for the `scales` and `scale` properties, then returns
9385             * a deep copy of the result, thus doesn't alter inputs.
9386             */
9387            function mergeConfig(/* config objects ... */) {
9388                return helpers$1.merge(Object.create(null), [].slice.call(arguments), {
9389                    merger: function (key, target, source, options) {
9390                        var tval = target[key] || Object.create(null);
9391                        var sval = source[key];
9392
9393                        if (key === 'scales') {
9394                            // scale config merging is complex. Add our own function here for that
9395                            target[key] = mergeScaleConfig(tval, sval);
9396                        } else if (key === 'scale') {
9397                            // used in polar area & radar charts since there is only one scale
9398                            target[key] = helpers$1.merge(tval, [core_scaleService.getScaleDefaults(sval.type), sval]);
9399                        } else {
9400                            helpers$1._merger(key, target, source, options);
9401                        }
9402                    }
9403                });
9404            }
9405
9406            function initConfig(config) {
9407                config = config || Object.create(null);
9408
9409                // Do NOT use mergeConfig for the data object because this method merges arrays
9410                // and so would change references to labels and datasets, preventing data updates.
9411                var data = config.data = config.data || {};
9412                data.datasets = data.datasets || [];
9413                data.labels = data.labels || [];
9414
9415                config.options = mergeConfig(
9416                    core_defaults.global,
9417                    core_defaults[config.type],
9418                    config.options || {});
9419
9420                return config;
9421            }
9422
9423            function updateConfig(chart) {
9424                var newOptions = chart.options;
9425
9426                helpers$1.each(chart.scales, function (scale) {
9427                    core_layouts.removeBox(chart, scale);
9428                });
9429
9430                newOptions = mergeConfig(
9431                    core_defaults.global,
9432                    core_defaults[chart.config.type],
9433                    newOptions);
9434
9435                chart.options = chart.config.options = newOptions;
9436                chart.ensureScalesHaveIDs();
9437                chart.buildOrUpdateScales();
9438
9439                // Tooltip
9440                chart.tooltip._options = newOptions.tooltips;
9441                chart.tooltip.initialize();
9442            }
9443
9444            function nextAvailableScaleId(axesOpts, prefix, index) {
9445                var id;
9446                var hasId = function (obj) {
9447                    return obj.id === id;
9448                };
9449
9450                do {
9451                    id = prefix + index++;
9452                } while (helpers$1.findIndex(axesOpts, hasId) >= 0);
9453
9454                return id;
9455            }
9456
9457            function positionIsHorizontal(position) {
9458                return position === 'top' || position === 'bottom';
9459            }
9460
9461            function compare2Level(l1, l2) {
9462                return function (a, b) {
9463                    return a[l1] === b[l1]
9464                        ? a[l2] - b[l2]
9465                        : a[l1] - b[l1];
9466                };
9467            }
9468
9469            var Chart = function (item, config) {
9470                this.construct(item, config);
9471                return this;
9472            };
9473
9474            helpers$1.extend(Chart.prototype, /** @lends Chart */ {
9475                /**
9476                 * @private
9477                 */
9478                construct: function (item, config) {
9479                    var me = this;
9480
9481                    config = initConfig(config);
9482
9483                    var context = platform.acquireContext(item, config);
9484                    var canvas = context && context.canvas;
9485                    var height = canvas && canvas.height;
9486                    var width = canvas && canvas.width;
9487
9488                    me.id = helpers$1.uid();
9489                    me.ctx = context;
9490                    me.canvas = canvas;
9491                    me.config = config;
9492                    me.width = width;
9493                    me.height = height;
9494                    me.aspectRatio = height ? width / height : null;
9495                    me.options = config.options;
9496                    me._bufferedRender = false;
9497                    me._layers = [];
9498
9499                    /**
9500                     * Provided for backward compatibility, Chart and Chart.Controller have been merged,
9501                     * the "instance" still need to be defined since it might be called from plugins.
9502                     * @prop Chart#chart
9503                     * @deprecated since version 2.6.0
9504                     * @todo remove at version 3
9505                     * @private
9506                     */
9507                    me.chart = me;
9508                    me.controller = me; // chart.chart.controller #inception
9509
9510                    // Add the chart instance to the global namespace
9511                    Chart.instances[me.id] = me;
9512
9513                    // Define alias to the config data: `chart.data === chart.config.data`
9514                    Object.defineProperty(me, 'data', {
9515                        get: function () {
9516                            return me.config.data;
9517                        },
9518                        set: function (value) {
9519                            me.config.data = value;
9520                        }
9521                    });
9522
9523                    if (!context || !canvas) {
9524                        // The given item is not a compatible context2d element, let's return before finalizing
9525                        // the chart initialization but after setting basic chart / controller properties that
9526                        // can help to figure out that the chart is not valid (e.g chart.canvas !== null);
9527                        // https://github.com/chartjs/Chart.js/issues/2807
9528                        console.error("Failed to create chart: can't acquire context from the given item");
9529                        return;
9530                    }
9531
9532                    me.initialize();
9533                    me.update();
9534                },
9535
9536                /**
9537                 * @private
9538                 */
9539                initialize: function () {
9540                    var me = this;
9541
9542                    // Before init plugin notification
9543                    core_plugins.notify(me, 'beforeInit');
9544
9545                    helpers$1.retinaScale(me, me.options.devicePixelRatio);
9546
9547                    me.bindEvents();
9548
9549                    if (me.options.responsive) {
9550                        // Initial resize before chart draws (must be silent to preserve initial animations).
9551                        me.resize(true);
9552                    }
9553
9554                    me.initToolTip();
9555
9556                    // After init plugin notification
9557                    core_plugins.notify(me, 'afterInit');
9558
9559                    return me;
9560                },
9561
9562                clear: function () {
9563                    helpers$1.canvas.clear(this);
9564                    return this;
9565                },
9566
9567                stop: function () {
9568                    // Stops any current animation loop occurring
9569                    core_animations.cancelAnimation(this);
9570                    return this;
9571                },
9572
9573                resize: function (silent) {
9574                    var me = this;
9575                    var options = me.options;
9576                    var canvas = me.canvas;
9577                    var aspectRatio = (options.maintainAspectRatio && me.aspectRatio) || null;
9578
9579                    // the canvas render width and height will be casted to integers so make sure that
9580                    // the canvas display style uses the same integer values to avoid blurring effect.
9581
9582                    // Set to 0 instead of canvas.size because the size defaults to 300x150 if the element is collapsed
9583                    var newWidth = Math.max(0, Math.floor(helpers$1.getMaximumWidth(canvas)));
9584                    var newHeight = Math.max(0, Math.floor(aspectRatio ? newWidth / aspectRatio : helpers$1.getMaximumHeight(canvas)));
9585
9586                    if (me.width === newWidth && me.height === newHeight) {
9587                        return;
9588                    }
9589
9590                    canvas.width = me.width = newWidth;
9591                    canvas.height = me.height = newHeight;
9592                    canvas.style.width = newWidth + 'px';
9593                    canvas.style.height = newHeight + 'px';
9594
9595                    helpers$1.retinaScale(me, options.devicePixelRatio);
9596
9597                    if (!silent) {
9598                        // Notify any plugins about the resize
9599                        var newSize = {width: newWidth, height: newHeight};
9600                        core_plugins.notify(me, 'resize', [newSize]);
9601
9602                        // Notify of resize
9603                        if (options.onResize) {
9604                            options.onResize(me, newSize);
9605                        }
9606
9607                        me.stop();
9608                        me.update({
9609                            duration: options.responsiveAnimationDuration
9610                        });
9611                    }
9612                },
9613
9614                ensureScalesHaveIDs: function () {
9615                    var options = this.options;
9616                    var scalesOptions = options.scales || {};
9617                    var scaleOptions = options.scale;
9618
9619                    helpers$1.each(scalesOptions.xAxes, function (xAxisOptions, index) {
9620                        if (!xAxisOptions.id) {
9621                            xAxisOptions.id = nextAvailableScaleId(scalesOptions.xAxes, 'x-axis-', index);
9622                        }
9623                    });
9624
9625                    helpers$1.each(scalesOptions.yAxes, function (yAxisOptions, index) {
9626                        if (!yAxisOptions.id) {
9627                            yAxisOptions.id = nextAvailableScaleId(scalesOptions.yAxes, 'y-axis-', index);
9628                        }
9629                    });
9630
9631                    if (scaleOptions) {
9632                        scaleOptions.id = scaleOptions.id || 'scale';
9633                    }
9634                },
9635
9636                /**
9637                 * Builds a map of scale ID to scale object for future lookup.
9638                 */
9639                buildOrUpdateScales: function () {
9640                    var me = this;
9641                    var options = me.options;
9642                    var scales = me.scales || {};
9643                    var items = [];
9644                    var updated = Object.keys(scales).reduce(function (obj, id) {
9645                        obj[id] = false;
9646                        return obj;
9647                    }, {});
9648
9649                    if (options.scales) {
9650                        items = items.concat(
9651                            (options.scales.xAxes || []).map(function (xAxisOptions) {
9652                                return {options: xAxisOptions, dtype: 'category', dposition: 'bottom'};
9653                            }),
9654                            (options.scales.yAxes || []).map(function (yAxisOptions) {
9655                                return {options: yAxisOptions, dtype: 'linear', dposition: 'left'};
9656                            })
9657                        );
9658                    }
9659
9660                    if (options.scale) {
9661                        items.push({
9662                            options: options.scale,
9663                            dtype: 'radialLinear',
9664                            isDefault: true,
9665                            dposition: 'chartArea'
9666                        });
9667                    }
9668
9669                    helpers$1.each(items, function (item) {
9670                        var scaleOptions = item.options;
9671                        var id = scaleOptions.id;
9672                        var scaleType = valueOrDefault$9(scaleOptions.type, item.dtype);
9673
9674                        if (positionIsHorizontal(scaleOptions.position) !== positionIsHorizontal(item.dposition)) {
9675                            scaleOptions.position = item.dposition;
9676                        }
9677
9678                        updated[id] = true;
9679                        var scale = null;
9680                        if (id in scales && scales[id].type === scaleType) {
9681                            scale = scales[id];
9682                            scale.options = scaleOptions;
9683                            scale.ctx = me.ctx;
9684                            scale.chart = me;
9685                        } else {
9686                            var scaleClass = core_scaleService.getScaleConstructor(scaleType);
9687                            if (!scaleClass) {
9688                                return;
9689                            }
9690                            scale = new scaleClass({
9691                                id: id,
9692                                type: scaleType,
9693                                options: scaleOptions,
9694                                ctx: me.ctx,
9695                                chart: me
9696                            });
9697                            scales[scale.id] = scale;
9698                        }
9699
9700                        scale.mergeTicksOptions();
9701
9702                        // TODO(SB): I think we should be able to remove this custom case (options.scale)
9703                        // and consider it as a regular scale part of the "scales"" map only! This would
9704                        // make the logic easier and remove some useless? custom code.
9705                        if (item.isDefault) {
9706                            me.scale = scale;
9707                        }
9708                    });
9709                    // clear up discarded scales
9710                    helpers$1.each(updated, function (hasUpdated, id) {
9711                        if (!hasUpdated) {
9712                            delete scales[id];
9713                        }
9714                    });
9715
9716                    me.scales = scales;
9717
9718                    core_scaleService.addScalesToLayout(this);
9719                },
9720
9721                buildOrUpdateControllers: function () {
9722                    var me = this;
9723                    var newControllers = [];
9724                    var datasets = me.data.datasets;
9725                    var i, ilen;
9726
9727                    for (i = 0, ilen = datasets.length; i < ilen; i++) {
9728                        var dataset = datasets[i];
9729                        var meta = me.getDatasetMeta(i);
9730                        var type = dataset.type || me.config.type;
9731
9732                        if (meta.type && meta.type !== type) {
9733                            me.destroyDatasetMeta(i);
9734                            meta = me.getDatasetMeta(i);
9735                        }
9736                        meta.type = type;
9737                        meta.order = dataset.order || 0;
9738                        meta.index = i;
9739
9740                        if (meta.controller) {
9741                            meta.controller.updateIndex(i);
9742                            meta.controller.linkScales();
9743                        } else {
9744                            var ControllerClass = controllers[meta.type];
9745                            if (ControllerClass === undefined) {
9746                                throw new Error('"' + meta.type + '" is not a chart type.');
9747                            }
9748
9749                            meta.controller = new ControllerClass(me, i);
9750                            newControllers.push(meta.controller);
9751                        }
9752                    }
9753
9754                    return newControllers;
9755                },
9756
9757                /**
9758                 * Reset the elements of all datasets
9759                 * @private
9760                 */
9761                resetElements: function () {
9762                    var me = this;
9763                    helpers$1.each(me.data.datasets, function (dataset, datasetIndex) {
9764                        me.getDatasetMeta(datasetIndex).controller.reset();
9765                    }, me);
9766                },
9767
9768                /**
9769                 * Resets the chart back to it's state before the initial animation
9770                 */
9771                reset: function () {
9772                    this.resetElements();
9773                    this.tooltip.initialize();
9774                },
9775
9776                update: function (config) {
9777                    var me = this;
9778                    var i, ilen;
9779
9780                    if (!config || typeof config !== 'object') {
9781                        // backwards compatibility
9782                        config = {
9783                            duration: config,
9784                            lazy: arguments[1]
9785                        };
9786                    }
9787
9788                    updateConfig(me);
9789
9790                    // plugins options references might have change, let's invalidate the cache
9791                    // https://github.com/chartjs/Chart.js/issues/5111#issuecomment-355934167
9792                    core_plugins._invalidate(me);
9793
9794                    if (core_plugins.notify(me, 'beforeUpdate') === false) {
9795                        return;
9796                    }
9797
9798                    // In case the entire data object changed
9799                    me.tooltip._data = me.data;
9800
9801                    // Make sure dataset controllers are updated and new controllers are reset
9802                    var newControllers = me.buildOrUpdateControllers();
9803
9804                    // Make sure all dataset controllers have correct meta data counts
9805                    for (i = 0, ilen = me.data.datasets.length; i < ilen; i++) {
9806                        me.getDatasetMeta(i).controller.buildOrUpdateElements();
9807                    }
9808
9809                    me.updateLayout();
9810
9811                    // Can only reset the new controllers after the scales have been updated
9812                    if (me.options.animation && me.options.animation.duration) {
9813                        helpers$1.each(newControllers, function (controller) {
9814                            controller.reset();
9815                        });
9816                    }
9817
9818                    me.updateDatasets();
9819
9820                    // Need to reset tooltip in case it is displayed with elements that are removed
9821                    // after update.
9822                    me.tooltip.initialize();
9823
9824                    // Last active contains items that were previously in the tooltip.
9825                    // When we reset the tooltip, we need to clear it
9826                    me.lastActive = [];
9827
9828                    // Do this before render so that any plugins that need final scale updates can use it
9829                    core_plugins.notify(me, 'afterUpdate');
9830
9831                    me._layers.sort(compare2Level('z', '_idx'));
9832
9833                    if (me._bufferedRender) {
9834                        me._bufferedRequest = {
9835                            duration: config.duration,
9836                            easing: config.easing,
9837                            lazy: config.lazy
9838                        };
9839                    } else {
9840                        me.render(config);
9841                    }
9842                },
9843
9844                /**
9845                 * Updates the chart layout unless a plugin returns `false` to the `beforeLayout`
9846                 * hook, in which case, plugins will not be called on `afterLayout`.
9847                 * @private
9848                 */
9849                updateLayout: function () {
9850                    var me = this;
9851
9852                    if (core_plugins.notify(me, 'beforeLayout') === false) {
9853                        return;
9854                    }
9855
9856                    core_layouts.update(this, this.width, this.height);
9857
9858                    me._layers = [];
9859                    helpers$1.each(me.boxes, function (box) {
9860                        // _configure is called twice, once in core.scale.update and once here.
9861                        // Here the boxes are fully updated and at their final positions.
9862                        if (box._configure) {
9863                            box._configure();
9864                        }
9865                        me._layers.push.apply(me._layers, box._layers());
9866                    }, me);
9867
9868                    me._layers.forEach(function (item, index) {
9869                        item._idx = index;
9870                    });
9871
9872                    /**
9873                     * Provided for backward compatibility, use `afterLayout` instead.
9874                     * @method IPlugin#afterScaleUpdate
9875                     * @deprecated since version 2.5.0
9876                     * @todo remove at version 3
9877                     * @private
9878                     */
9879                    core_plugins.notify(me, 'afterScaleUpdate');
9880                    core_plugins.notify(me, 'afterLayout');
9881                },
9882
9883                /**
9884                 * Updates all datasets unless a plugin returns `false` to the `beforeDatasetsUpdate`
9885                 * hook, in which case, plugins will not be called on `afterDatasetsUpdate`.
9886                 * @private
9887                 */
9888                updateDatasets: function () {
9889                    var me = this;
9890
9891                    if (core_plugins.notify(me, 'beforeDatasetsUpdate') === false) {
9892                        return;
9893                    }
9894
9895                    for (var i = 0, ilen = me.data.datasets.length; i < ilen; ++i) {
9896                        me.updateDataset(i);
9897                    }
9898
9899                    core_plugins.notify(me, 'afterDatasetsUpdate');
9900                },
9901
9902                /**
9903                 * Updates dataset at index unless a plugin returns `false` to the `beforeDatasetUpdate`
9904                 * hook, in which case, plugins will not be called on `afterDatasetUpdate`.
9905                 * @private
9906                 */
9907                updateDataset: function (index) {
9908                    var me = this;
9909                    var meta = me.getDatasetMeta(index);
9910                    var args = {
9911                        meta: meta,
9912                        index: index
9913                    };
9914
9915                    if (core_plugins.notify(me, 'beforeDatasetUpdate', [args]) === false) {
9916                        return;
9917                    }
9918
9919                    meta.controller._update();
9920
9921                    core_plugins.notify(me, 'afterDatasetUpdate', [args]);
9922                },
9923
9924                render: function (config) {
9925                    var me = this;
9926
9927                    if (!config || typeof config !== 'object') {
9928                        // backwards compatibility
9929                        config = {
9930                            duration: config,
9931                            lazy: arguments[1]
9932                        };
9933                    }
9934
9935                    var animationOptions = me.options.animation;
9936                    var duration = valueOrDefault$9(config.duration, animationOptions && animationOptions.duration);
9937                    var lazy = config.lazy;
9938
9939                    if (core_plugins.notify(me, 'beforeRender') === false) {
9940                        return;
9941                    }
9942
9943                    var onComplete = function (animation) {
9944                        core_plugins.notify(me, 'afterRender');
9945                        helpers$1.callback(animationOptions && animationOptions.onComplete, [animation], me);
9946                    };
9947
9948                    if (animationOptions && duration) {
9949                        var animation = new core_animation({
9950                            numSteps: duration / 16.66, // 60 fps
9951                            easing: config.easing || animationOptions.easing,
9952
9953                            render: function (chart, animationObject) {
9954                                var easingFunction = helpers$1.easing.effects[animationObject.easing];
9955                                var currentStep = animationObject.currentStep;
9956                                var stepDecimal = currentStep / animationObject.numSteps;
9957
9958                                chart.draw(easingFunction(stepDecimal), stepDecimal, currentStep);
9959                            },
9960
9961                            onAnimationProgress: animationOptions.onProgress,
9962                            onAnimationComplete: onComplete
9963                        });
9964
9965                        core_animations.addAnimation(me, animation, duration, lazy);
9966                    } else {
9967                        me.draw();
9968
9969                        // See https://github.com/chartjs/Chart.js/issues/3781
9970                        onComplete(new core_animation({numSteps: 0, chart: me}));
9971                    }
9972
9973                    return me;
9974                },
9975
9976                draw: function (easingValue) {
9977                    var me = this;
9978                    var i, layers;
9979
9980                    me.clear();
9981
9982                    if (helpers$1.isNullOrUndef(easingValue)) {
9983                        easingValue = 1;
9984                    }
9985
9986                    me.transition(easingValue);
9987
9988                    if (me.width <= 0 || me.height <= 0) {
9989                        return;
9990                    }
9991
9992                    if (core_plugins.notify(me, 'beforeDraw', [easingValue]) === false) {
9993                        return;
9994                    }
9995
9996                    // Because of plugin hooks (before/afterDatasetsDraw), datasets can't
9997                    // currently be part of layers. Instead, we draw
9998                    // layers <= 0 before(default, backward compat), and the rest after
9999                    layers = me._layers;
10000                    for (i = 0; i < layers.length && layers[i].z <= 0; ++i) {
10001                        layers[i].draw(me.chartArea);
10002                    }
10003
10004                    me.drawDatasets(easingValue);
10005
10006                    // Rest of layers
10007                    for (; i < layers.length; ++i) {
10008                        layers[i].draw(me.chartArea);
10009                    }
10010
10011                    me._drawTooltip(easingValue);
10012
10013                    core_plugins.notify(me, 'afterDraw', [easingValue]);
10014                },
10015
10016                /**
10017                 * @private
10018                 */
10019                transition: function (easingValue) {
10020                    var me = this;
10021
10022                    for (var i = 0, ilen = (me.data.datasets || []).length; i < ilen; ++i) {
10023                        if (me.isDatasetVisible(i)) {
10024                            me.getDatasetMeta(i).controller.transition(easingValue);
10025                        }
10026                    }
10027
10028                    me.tooltip.transition(easingValue);
10029                },
10030
10031                /**
10032                 * @private
10033                 */
10034                _getSortedDatasetMetas: function (filterVisible) {
10035                    var me = this;
10036                    var datasets = me.data.datasets || [];
10037                    var result = [];
10038                    var i, ilen;
10039
10040                    for (i = 0, ilen = datasets.length; i < ilen; ++i) {
10041                        if (!filterVisible || me.isDatasetVisible(i)) {
10042                            result.push(me.getDatasetMeta(i));
10043                        }
10044                    }
10045
10046                    result.sort(compare2Level('order', 'index'));
10047
10048                    return result;
10049                },
10050
10051                /**
10052                 * @private
10053                 */
10054                _getSortedVisibleDatasetMetas: function () {
10055                    return this._getSortedDatasetMetas(true);
10056                },
10057
10058                /**
10059                 * Draws all datasets unless a plugin returns `false` to the `beforeDatasetsDraw`
10060                 * hook, in which case, plugins will not be called on `afterDatasetsDraw`.
10061                 * @private
10062                 */
10063                drawDatasets: function (easingValue) {
10064                    var me = this;
10065                    var metasets, i;
10066
10067                    if (core_plugins.notify(me, 'beforeDatasetsDraw', [easingValue]) === false) {
10068                        return;
10069                    }
10070
10071                    metasets = me._getSortedVisibleDatasetMetas();
10072                    for (i = metasets.length - 1; i >= 0; --i) {
10073                        me.drawDataset(metasets[i], easingValue);
10074                    }
10075
10076                    core_plugins.notify(me, 'afterDatasetsDraw', [easingValue]);
10077                },
10078
10079                /**
10080                 * Draws dataset at index unless a plugin returns `false` to the `beforeDatasetDraw`
10081                 * hook, in which case, plugins will not be called on `afterDatasetDraw`.
10082                 * @private
10083                 */
10084                drawDataset: function (meta, easingValue) {
10085                    var me = this;
10086                    var args = {
10087                        meta: meta,
10088                        index: meta.index,
10089                        easingValue: easingValue
10090                    };
10091
10092                    if (core_plugins.notify(me, 'beforeDatasetDraw', [args]) === false) {
10093                        return;
10094                    }
10095
10096                    meta.controller.draw(easingValue);
10097
10098                    core_plugins.notify(me, 'afterDatasetDraw', [args]);
10099                },
10100
10101                /**
10102                 * Draws tooltip unless a plugin returns `false` to the `beforeTooltipDraw`
10103                 * hook, in which case, plugins will not be called on `afterTooltipDraw`.
10104                 * @private
10105                 */
10106                _drawTooltip: function (easingValue) {
10107                    var me = this;
10108                    var tooltip = me.tooltip;
10109                    var args = {
10110                        tooltip: tooltip,
10111                        easingValue: easingValue
10112                    };
10113
10114                    if (core_plugins.notify(me, 'beforeTooltipDraw', [args]) === false) {
10115                        return;
10116                    }
10117
10118                    tooltip.draw();
10119
10120                    core_plugins.notify(me, 'afterTooltipDraw', [args]);
10121                },
10122
10123                /**
10124                 * Get the single element that was clicked on
10125                 * @return An object containing the dataset index and element index of the matching element. Also contains the rectangle that was draw
10126                 */
10127                getElementAtEvent: function (e) {
10128                    return core_interaction.modes.single(this, e);
10129                },
10130
10131                getElementsAtEvent: function (e) {
10132                    return core_interaction.modes.label(this, e, {intersect: true});
10133                },
10134
10135                getElementsAtXAxis: function (e) {
10136                    return core_interaction.modes['x-axis'](this, e, {intersect: true});
10137                },
10138
10139                getElementsAtEventForMode: function (e, mode, options) {
10140                    var method = core_interaction.modes[mode];
10141                    if (typeof method === 'function') {
10142                        return method(this, e, options);
10143                    }
10144
10145                    return [];
10146                },
10147
10148                getDatasetAtEvent: function (e) {
10149                    return core_interaction.modes.dataset(this, e, {intersect: true});
10150                },
10151
10152                getDatasetMeta: function (datasetIndex) {
10153                    var me = this;
10154                    var dataset = me.data.datasets[datasetIndex];
10155                    if (!dataset._meta) {
10156                        dataset._meta = {};
10157                    }
10158
10159                    var meta = dataset._meta[me.id];
10160                    if (!meta) {
10161                        meta = dataset._meta[me.id] = {
10162                            type: null,
10163                            data: [],
10164                            dataset: null,
10165                            controller: null,
10166                            hidden: null,			// See isDatasetVisible() comment
10167                            xAxisID: null,
10168                            yAxisID: null,
10169                            order: dataset.order || 0,
10170                            index: datasetIndex
10171                        };
10172                    }
10173
10174                    return meta;
10175                },
10176
10177                getVisibleDatasetCount: function () {
10178                    var count = 0;
10179                    for (var i = 0, ilen = this.data.datasets.length; i < ilen; ++i) {
10180                        if (this.isDatasetVisible(i)) {
10181                            count++;
10182                        }
10183                    }
10184                    return count;
10185                },
10186
10187                isDatasetVisible: function (datasetIndex) {
10188                    var meta = this.getDatasetMeta(datasetIndex);
10189
10190                    // meta.hidden is a per chart dataset hidden flag override with 3 states: if true or false,
10191                    // the dataset.hidden value is ignored, else if null, the dataset hidden state is returned.
10192                    return typeof meta.hidden === 'boolean' ? !meta.hidden : !this.data.datasets[datasetIndex].hidden;
10193                },
10194
10195                generateLegend: function () {
10196                    return this.options.legendCallback(this);
10197                },
10198
10199                /**
10200                 * @private
10201                 */
10202                destroyDatasetMeta: function (datasetIndex) {
10203                    var id = this.id;
10204                    var dataset = this.data.datasets[datasetIndex];
10205                    var meta = dataset._meta && dataset._meta[id];
10206
10207                    if (meta) {
10208                        meta.controller.destroy();
10209                        delete dataset._meta[id];
10210                    }
10211                },
10212
10213                destroy: function () {
10214                    var me = this;
10215                    var canvas = me.canvas;
10216                    var i, ilen;
10217
10218                    me.stop();
10219
10220                    // dataset controllers need to cleanup associated data
10221                    for (i = 0, ilen = me.data.datasets.length; i < ilen; ++i) {
10222                        me.destroyDatasetMeta(i);
10223                    }
10224
10225                    if (canvas) {
10226                        me.unbindEvents();
10227                        helpers$1.canvas.clear(me);
10228                        platform.releaseContext(me.ctx);
10229                        me.canvas = null;
10230                        me.ctx = null;
10231                    }
10232
10233                    core_plugins.notify(me, 'destroy');
10234
10235                    delete Chart.instances[me.id];
10236                },
10237
10238                toBase64Image: function () {
10239                    return this.canvas.toDataURL.apply(this.canvas, arguments);
10240                },
10241
10242                initToolTip: function () {
10243                    var me = this;
10244                    me.tooltip = new core_tooltip({
10245                        _chart: me,
10246                        _chartInstance: me, // deprecated, backward compatibility
10247                        _data: me.data,
10248                        _options: me.options.tooltips
10249                    }, me);
10250                },
10251
10252                /**
10253                 * @private
10254                 */
10255                bindEvents: function () {
10256                    var me = this;
10257                    var listeners = me._listeners = {};
10258                    var listener = function () {
10259                        me.eventHandler.apply(me, arguments);
10260                    };
10261
10262                    helpers$1.each(me.options.events, function (type) {
10263                        platform.addEventListener(me, type, listener);
10264                        listeners[type] = listener;
10265                    });
10266
10267                    // Elements used to detect size change should not be injected for non responsive charts.
10268                    // See https://github.com/chartjs/Chart.js/issues/2210
10269                    if (me.options.responsive) {
10270                        listener = function () {
10271                            me.resize();
10272                        };
10273
10274                        platform.addEventListener(me, 'resize', listener);
10275                        listeners.resize = listener;
10276                    }
10277                },
10278
10279                /**
10280                 * @private
10281                 */
10282                unbindEvents: function () {
10283                    var me = this;
10284                    var listeners = me._listeners;
10285                    if (!listeners) {
10286                        return;
10287                    }
10288
10289                    delete me._listeners;
10290                    helpers$1.each(listeners, function (listener, type) {
10291                        platform.removeEventListener(me, type, listener);
10292                    });
10293                },
10294
10295                updateHoverStyle: function (elements, mode, enabled) {
10296                    var prefix = enabled ? 'set' : 'remove';
10297                    var element, i, ilen;
10298
10299                    for (i = 0, ilen = elements.length; i < ilen; ++i) {
10300                        element = elements[i];
10301                        if (element) {
10302                            this.getDatasetMeta(element._datasetIndex).controller[prefix + 'HoverStyle'](element);
10303                        }
10304                    }
10305
10306                    if (mode === 'dataset') {
10307                        this.getDatasetMeta(elements[0]._datasetIndex).controller['_' + prefix + 'DatasetHoverStyle']();
10308                    }
10309                },
10310
10311                /**
10312                 * @private
10313                 */
10314                eventHandler: function (e) {
10315                    var me = this;
10316                    var tooltip = me.tooltip;
10317
10318                    if (core_plugins.notify(me, 'beforeEvent', [e]) === false) {
10319                        return;
10320                    }
10321
10322                    // Buffer any update calls so that renders do not occur
10323                    me._bufferedRender = true;
10324                    me._bufferedRequest = null;
10325
10326                    var changed = me.handleEvent(e);
10327                    // for smooth tooltip animations issue #4989
10328                    // the tooltip should be the source of change
10329                    // Animation check workaround:
10330                    // tooltip._start will be null when tooltip isn't animating
10331                    if (tooltip) {
10332                        changed = tooltip._start
10333                            ? tooltip.handleEvent(e)
10334                            : changed | tooltip.handleEvent(e);
10335                    }
10336
10337                    core_plugins.notify(me, 'afterEvent', [e]);
10338
10339                    var bufferedRequest = me._bufferedRequest;
10340                    if (bufferedRequest) {
10341                        // If we have an update that was triggered, we need to do a normal render
10342                        me.render(bufferedRequest);
10343                    } else if (changed && !me.animating) {
10344                        // If entering, leaving, or changing elements, animate the change via pivot
10345                        me.stop();
10346
10347                        // We only need to render at this point. Updating will cause scales to be
10348                        // recomputed generating flicker & using more memory than necessary.
10349                        me.render({
10350                            duration: me.options.hover.animationDuration,
10351                            lazy: true
10352                        });
10353                    }
10354
10355                    me._bufferedRender = false;
10356                    me._bufferedRequest = null;
10357
10358                    return me;
10359                },
10360
10361                /**
10362                 * Handle an event
10363                 * @private
10364                 * @param {IEvent} event the event to handle
10365                 * @return {boolean} true if the chart needs to re-render
10366                 */
10367                handleEvent: function (e) {
10368                    var me = this;
10369                    var options = me.options || {};
10370                    var hoverOptions = options.hover;
10371                    var changed = false;
10372
10373                    me.lastActive = me.lastActive || [];
10374
10375                    // Find Active Elements for hover and tooltips
10376                    if (e.type === 'mouseout') {
10377                        me.active = [];
10378                    } else {
10379                        me.active = me.getElementsAtEventForMode(e, hoverOptions.mode, hoverOptions);
10380                    }
10381
10382                    // Invoke onHover hook
10383                    // Need to call with native event here to not break backwards compatibility
10384                    helpers$1.callback(options.onHover || options.hover.onHover, [e.native, me.active], me);
10385
10386                    if (e.type === 'mouseup' || e.type === 'click') {
10387                        if (options.onClick) {
10388                            // Use e.native here for backwards compatibility
10389                            options.onClick.call(me, e.native, me.active);
10390                        }
10391                    }
10392
10393                    // Remove styling for last active (even if it may still be active)
10394                    if (me.lastActive.length) {
10395                        me.updateHoverStyle(me.lastActive, hoverOptions.mode, false);
10396                    }
10397
10398                    // Built in hover styling
10399                    if (me.active.length && hoverOptions.mode) {
10400                        me.updateHoverStyle(me.active, hoverOptions.mode, true);
10401                    }
10402
10403                    changed = !helpers$1.arrayEquals(me.active, me.lastActive);
10404
10405                    // Remember Last Actives
10406                    me.lastActive = me.active;
10407
10408                    return changed;
10409                }
10410            });
10411
10412            /**
10413             * NOTE(SB) We actually don't use this container anymore but we need to keep it
10414             * for backward compatibility. Though, it can still be useful for plugins that
10415             * would need to work on multiple charts?!
10416             */
10417            Chart.instances = {};
10418
10419            var core_controller = Chart;
10420
10421// DEPRECATIONS
10422
10423            /**
10424             * Provided for backward compatibility, use Chart instead.
10425             * @class Chart.Controller
10426             * @deprecated since version 2.6
10427             * @todo remove at version 3
10428             * @private
10429             */
10430            Chart.Controller = Chart;
10431
10432            /**
10433             * Provided for backward compatibility, not available anymore.
10434             * @namespace Chart
10435             * @deprecated since version 2.8
10436             * @todo remove at version 3
10437             * @private
10438             */
10439            Chart.types = {};
10440
10441            /**
10442             * Provided for backward compatibility, not available anymore.
10443             * @namespace Chart.helpers.configMerge
10444             * @deprecated since version 2.8.0
10445             * @todo remove at version 3
10446             * @private
10447             */
10448            helpers$1.configMerge = mergeConfig;
10449
10450            /**
10451             * Provided for backward compatibility, not available anymore.
10452             * @namespace Chart.helpers.scaleMerge
10453             * @deprecated since version 2.8.0
10454             * @todo remove at version 3
10455             * @private
10456             */
10457            helpers$1.scaleMerge = mergeScaleConfig;
10458
10459            var core_helpers = function () {
10460
10461                // -- Basic js utility methods
10462
10463                helpers$1.where = function (collection, filterCallback) {
10464                    if (helpers$1.isArray(collection) && Array.prototype.filter) {
10465                        return collection.filter(filterCallback);
10466                    }
10467                    var filtered = [];
10468
10469                    helpers$1.each(collection, function (item) {
10470                        if (filterCallback(item)) {
10471                            filtered.push(item);
10472                        }
10473                    });
10474
10475                    return filtered;
10476                };
10477                helpers$1.findIndex = Array.prototype.findIndex ?
10478                    function (array, callback, scope) {
10479                        return array.findIndex(callback, scope);
10480                    } :
10481                    function (array, callback, scope) {
10482                        scope = scope === undefined ? array : scope;
10483                        for (var i = 0, ilen = array.length; i < ilen; ++i) {
10484                            if (callback.call(scope, array[i], i, array)) {
10485                                return i;
10486                            }
10487                        }
10488                        return -1;
10489                    };
10490                helpers$1.findNextWhere = function (arrayToSearch, filterCallback, startIndex) {
10491                    // Default to start of the array
10492                    if (helpers$1.isNullOrUndef(startIndex)) {
10493                        startIndex = -1;
10494                    }
10495                    for (var i = startIndex + 1; i < arrayToSearch.length; i++) {
10496                        var currentItem = arrayToSearch[i];
10497                        if (filterCallback(currentItem)) {
10498                            return currentItem;
10499                        }
10500                    }
10501                };
10502                helpers$1.findPreviousWhere = function (arrayToSearch, filterCallback, startIndex) {
10503                    // Default to end of the array
10504                    if (helpers$1.isNullOrUndef(startIndex)) {
10505                        startIndex = arrayToSearch.length;
10506                    }
10507                    for (var i = startIndex - 1; i >= 0; i--) {
10508                        var currentItem = arrayToSearch[i];
10509                        if (filterCallback(currentItem)) {
10510                            return currentItem;
10511                        }
10512                    }
10513                };
10514
10515                // -- Math methods
10516                helpers$1.isNumber = function (n) {
10517                    return !isNaN(parseFloat(n)) && isFinite(n);
10518                };
10519                helpers$1.almostEquals = function (x, y, epsilon) {
10520                    return Math.abs(x - y) < epsilon;
10521                };
10522                helpers$1.almostWhole = function (x, epsilon) {
10523                    var rounded = Math.round(x);
10524                    return ((rounded - epsilon) <= x) && ((rounded + epsilon) >= x);
10525                };
10526                helpers$1.max = function (array) {
10527                    return array.reduce(function (max, value) {
10528                        if (!isNaN(value)) {
10529                            return Math.max(max, value);
10530                        }
10531                        return max;
10532                    }, Number.NEGATIVE_INFINITY);
10533                };
10534                helpers$1.min = function (array) {
10535                    return array.reduce(function (min, value) {
10536                        if (!isNaN(value)) {
10537                            return Math.min(min, value);
10538                        }
10539                        return min;
10540                    }, Number.POSITIVE_INFINITY);
10541                };
10542                helpers$1.sign = Math.sign ?
10543                    function (x) {
10544                        return Math.sign(x);
10545                    } :
10546                    function (x) {
10547                        x = +x; // convert to a number
10548                        if (x === 0 || isNaN(x)) {
10549                            return x;
10550                        }
10551                        return x > 0 ? 1 : -1;
10552                    };
10553                helpers$1.toRadians = function (degrees) {
10554                    return degrees * (Math.PI / 180);
10555                };
10556                helpers$1.toDegrees = function (radians) {
10557                    return radians * (180 / Math.PI);
10558                };
10559
10560                /**
10561                 * Returns the number of decimal places
10562                 * i.e. the number of digits after the decimal point, of the value of this Number.
10563                 * @param {number} x - A number.
10564                 * @returns {number} The number of decimal places.
10565                 * @private
10566                 */
10567                helpers$1._decimalPlaces = function (x) {
10568                    if (!helpers$1.isFinite(x)) {
10569                        return;
10570                    }
10571                    var e = 1;
10572                    var p = 0;
10573                    while (Math.round(x * e) / e !== x) {
10574                        e *= 10;
10575                        p++;
10576                    }
10577                    return p;
10578                };
10579
10580                // Gets the angle from vertical upright to the point about a centre.
10581                helpers$1.getAngleFromPoint = function (centrePoint, anglePoint) {
10582                    var distanceFromXCenter = anglePoint.x - centrePoint.x;
10583                    var distanceFromYCenter = anglePoint.y - centrePoint.y;
10584                    var radialDistanceFromCenter = Math.sqrt(distanceFromXCenter * distanceFromXCenter + distanceFromYCenter * distanceFromYCenter);
10585
10586                    var angle = Math.atan2(distanceFromYCenter, distanceFromXCenter);
10587
10588                    if (angle < (-0.5 * Math.PI)) {
10589                        angle += 2.0 * Math.PI; // make sure the returned angle is in the range of (-PI/2, 3PI/2]
10590                    }
10591
10592                    return {
10593                        angle: angle,
10594                        distance: radialDistanceFromCenter
10595                    };
10596                };
10597                helpers$1.distanceBetweenPoints = function (pt1, pt2) {
10598                    return Math.sqrt(Math.pow(pt2.x - pt1.x, 2) + Math.pow(pt2.y - pt1.y, 2));
10599                };
10600
10601                /**
10602                 * Provided for backward compatibility, not available anymore
10603                 * @function Chart.helpers.aliasPixel
10604                 * @deprecated since version 2.8.0
10605                 * @todo remove at version 3
10606                 */
10607                helpers$1.aliasPixel = function (pixelWidth) {
10608                    return (pixelWidth % 2 === 0) ? 0 : 0.5;
10609                };
10610
10611                /**
10612                 * Returns the aligned pixel value to avoid anti-aliasing blur
10613                 * @param {Chart} chart - The chart instance.
10614                 * @param {number} pixel - A pixel value.
10615                 * @param {number} width - The width of the element.
10616                 * @returns {number} The aligned pixel value.
10617                 * @private
10618                 */
10619                helpers$1._alignPixel = function (chart, pixel, width) {
10620                    var devicePixelRatio = chart.currentDevicePixelRatio;
10621                    var halfWidth = width / 2;
10622                    return Math.round((pixel - halfWidth) * devicePixelRatio) / devicePixelRatio + halfWidth;
10623                };
10624
10625                helpers$1.splineCurve = function (firstPoint, middlePoint, afterPoint, t) {
10626                    // Props to Rob Spencer at scaled innovation for his post on splining between points
10627                    // http://scaledinnovation.com/analytics/splines/aboutSplines.html
10628
10629                    // This function must also respect "skipped" points
10630
10631                    var previous = firstPoint.skip ? middlePoint : firstPoint;
10632                    var current = middlePoint;
10633                    var next = afterPoint.skip ? middlePoint : afterPoint;
10634
10635                    var d01 = Math.sqrt(Math.pow(current.x - previous.x, 2) + Math.pow(current.y - previous.y, 2));
10636                    var d12 = Math.sqrt(Math.pow(next.x - current.x, 2) + Math.pow(next.y - current.y, 2));
10637
10638                    var s01 = d01 / (d01 + d12);
10639                    var s12 = d12 / (d01 + d12);
10640
10641                    // If all points are the same, s01 & s02 will be inf
10642                    s01 = isNaN(s01) ? 0 : s01;
10643                    s12 = isNaN(s12) ? 0 : s12;
10644
10645                    var fa = t * s01; // scaling factor for triangle Ta
10646                    var fb = t * s12;
10647
10648                    return {
10649                        previous: {
10650                            x: current.x - fa * (next.x - previous.x),
10651                            y: current.y - fa * (next.y - previous.y)
10652                        },
10653                        next: {
10654                            x: current.x + fb * (next.x - previous.x),
10655                            y: current.y + fb * (next.y - previous.y)
10656                        }
10657                    };
10658                };
10659                helpers$1.EPSILON = Number.EPSILON || 1e-14;
10660                helpers$1.splineCurveMonotone = function (points) {
10661                    // This function calculates Bézier control points in a similar way than |splineCurve|,
10662                    // but preserves monotonicity of the provided data and ensures no local extremums are added
10663                    // between the dataset discrete points due to the interpolation.
10664                    // See : https://en.wikipedia.org/wiki/Monotone_cubic_interpolation
10665
10666                    var pointsWithTangents = (points || []).map(function (point) {
10667                        return {
10668                            model: point._model,
10669                            deltaK: 0,
10670                            mK: 0
10671                        };
10672                    });
10673
10674                    // Calculate slopes (deltaK) and initialize tangents (mK)
10675                    var pointsLen = pointsWithTangents.length;
10676                    var i, pointBefore, pointCurrent, pointAfter;
10677                    for (i = 0; i < pointsLen; ++i) {
10678                        pointCurrent = pointsWithTangents[i];
10679                        if (pointCurrent.model.skip) {
10680                            continue;
10681                        }
10682
10683                        pointBefore = i > 0 ? pointsWithTangents[i - 1] : null;
10684                        pointAfter = i < pointsLen - 1 ? pointsWithTangents[i + 1] : null;
10685                        if (pointAfter && !pointAfter.model.skip) {
10686                            var slopeDeltaX = (pointAfter.model.x - pointCurrent.model.x);
10687
10688                            // In the case of two points that appear at the same x pixel, slopeDeltaX is 0
10689                            pointCurrent.deltaK = slopeDeltaX !== 0 ? (pointAfter.model.y - pointCurrent.model.y) / slopeDeltaX : 0;
10690                        }
10691
10692                        if (!pointBefore || pointBefore.model.skip) {
10693                            pointCurrent.mK = pointCurrent.deltaK;
10694                        } else if (!pointAfter || pointAfter.model.skip) {
10695                            pointCurrent.mK = pointBefore.deltaK;
10696                        } else if (this.sign(pointBefore.deltaK) !== this.sign(pointCurrent.deltaK)) {
10697                            pointCurrent.mK = 0;
10698                        } else {
10699                            pointCurrent.mK = (pointBefore.deltaK + pointCurrent.deltaK) / 2;
10700                        }
10701                    }
10702
10703                    // Adjust tangents to ensure monotonic properties
10704                    var alphaK, betaK, tauK, squaredMagnitude;
10705                    for (i = 0; i < pointsLen - 1; ++i) {
10706                        pointCurrent = pointsWithTangents[i];
10707                        pointAfter = pointsWithTangents[i + 1];
10708                        if (pointCurrent.model.skip || pointAfter.model.skip) {
10709                            continue;
10710                        }
10711
10712                        if (helpers$1.almostEquals(pointCurrent.deltaK, 0, this.EPSILON)) {
10713                            pointCurrent.mK = pointAfter.mK = 0;
10714                            continue;
10715                        }
10716
10717                        alphaK = pointCurrent.mK / pointCurrent.deltaK;
10718                        betaK = pointAfter.mK / pointCurrent.deltaK;
10719                        squaredMagnitude = Math.pow(alphaK, 2) + Math.pow(betaK, 2);
10720                        if (squaredMagnitude <= 9) {
10721                            continue;
10722                        }
10723
10724                        tauK = 3 / Math.sqrt(squaredMagnitude);
10725                        pointCurrent.mK = alphaK * tauK * pointCurrent.deltaK;
10726                        pointAfter.mK = betaK * tauK * pointCurrent.deltaK;
10727                    }
10728
10729                    // Compute control points
10730                    var deltaX;
10731                    for (i = 0; i < pointsLen; ++i) {
10732                        pointCurrent = pointsWithTangents[i];
10733                        if (pointCurrent.model.skip) {
10734                            continue;
10735                        }
10736
10737                        pointBefore = i > 0 ? pointsWithTangents[i - 1] : null;
10738                        pointAfter = i < pointsLen - 1 ? pointsWithTangents[i + 1] : null;
10739                        if (pointBefore && !pointBefore.model.skip) {
10740                            deltaX = (pointCurrent.model.x - pointBefore.model.x) / 3;
10741                            pointCurrent.model.controlPointPreviousX = pointCurrent.model.x - deltaX;
10742                            pointCurrent.model.controlPointPreviousY = pointCurrent.model.y - deltaX * pointCurrent.mK;
10743                        }
10744                        if (pointAfter && !pointAfter.model.skip) {
10745                            deltaX = (pointAfter.model.x - pointCurrent.model.x) / 3;
10746                            pointCurrent.model.controlPointNextX = pointCurrent.model.x + deltaX;
10747                            pointCurrent.model.controlPointNextY = pointCurrent.model.y + deltaX * pointCurrent.mK;
10748                        }
10749                    }
10750                };
10751                helpers$1.nextItem = function (collection, index, loop) {
10752                    if (loop) {
10753                        return index >= collection.length - 1 ? collection[0] : collection[index + 1];
10754                    }
10755                    return index >= collection.length - 1 ? collection[collection.length - 1] : collection[index + 1];
10756                };
10757                helpers$1.previousItem = function (collection, index, loop) {
10758                    if (loop) {
10759                        return index <= 0 ? collection[collection.length - 1] : collection[index - 1];
10760                    }
10761                    return index <= 0 ? collection[0] : collection[index - 1];
10762                };
10763                // Implementation of the nice number algorithm used in determining where axis labels will go
10764                helpers$1.niceNum = function (range, round) {
10765                    var exponent = Math.floor(helpers$1.log10(range));
10766                    var fraction = range / Math.pow(10, exponent);
10767                    var niceFraction;
10768
10769                    if (round) {
10770                        if (fraction < 1.5) {
10771                            niceFraction = 1;
10772                        } else if (fraction < 3) {
10773                            niceFraction = 2;
10774                        } else if (fraction < 7) {
10775                            niceFraction = 5;
10776                        } else {
10777                            niceFraction = 10;
10778                        }
10779                    } else if (fraction <= 1.0) {
10780                        niceFraction = 1;
10781                    } else if (fraction <= 2) {
10782                        niceFraction = 2;
10783                    } else if (fraction <= 5) {
10784                        niceFraction = 5;
10785                    } else {
10786                        niceFraction = 10;
10787                    }
10788
10789                    return niceFraction * Math.pow(10, exponent);
10790                };
10791                // Request animation polyfill - https://www.paulirish.com/2011/requestanimationframe-for-smart-animating/
10792                helpers$1.requestAnimFrame = (function () {
10793                    if (typeof window === 'undefined') {
10794                        return function (callback) {
10795                            callback();
10796                        };
10797                    }
10798                    return window.requestAnimationFrame ||
10799                        window.webkitRequestAnimationFrame ||
10800                        window.mozRequestAnimationFrame ||
10801                        window.oRequestAnimationFrame ||
10802                        window.msRequestAnimationFrame ||
10803                        function (callback) {
10804                            return window.setTimeout(callback, 1000 / 60);
10805                        };
10806                }());
10807                // -- DOM methods
10808                helpers$1.getRelativePosition = function (evt, chart) {
10809                    var mouseX, mouseY;
10810                    var e = evt.originalEvent || evt;
10811                    var canvas = evt.target || evt.srcElement;
10812                    var boundingRect = canvas.getBoundingClientRect();
10813
10814                    var touches = e.touches;
10815                    if (touches && touches.length > 0) {
10816                        mouseX = touches[0].clientX;
10817                        mouseY = touches[0].clientY;
10818
10819                    } else {
10820                        mouseX = e.clientX;
10821                        mouseY = e.clientY;
10822                    }
10823
10824                    // Scale mouse coordinates into canvas coordinates
10825                    // by following the pattern laid out by 'jerryj' in the comments of
10826                    // https://www.html5canvastutorials.com/advanced/html5-canvas-mouse-coordinates/
10827                    var paddingLeft = parseFloat(helpers$1.getStyle(canvas, 'padding-left'));
10828                    var paddingTop = parseFloat(helpers$1.getStyle(canvas, 'padding-top'));
10829                    var paddingRight = parseFloat(helpers$1.getStyle(canvas, 'padding-right'));
10830                    var paddingBottom = parseFloat(helpers$1.getStyle(canvas, 'padding-bottom'));
10831                    var width = boundingRect.right - boundingRect.left - paddingLeft - paddingRight;
10832                    var height = boundingRect.bottom - boundingRect.top - paddingTop - paddingBottom;
10833
10834                    // We divide by the current device pixel ratio, because the canvas is scaled up by that amount in each direction. However
10835                    // the backend model is in unscaled coordinates. Since we are going to deal with our model coordinates, we go back here
10836                    mouseX = Math.round((mouseX - boundingRect.left - paddingLeft) / (width) * canvas.width / chart.currentDevicePixelRatio);
10837                    mouseY = Math.round((mouseY - boundingRect.top - paddingTop) / (height) * canvas.height / chart.currentDevicePixelRatio);
10838
10839                    return {
10840                        x: mouseX,
10841                        y: mouseY
10842                    };
10843
10844                };
10845
10846                // Private helper function to convert max-width/max-height values that may be percentages into a number
10847                function parseMaxStyle(styleValue, node, parentProperty) {
10848                    var valueInPixels;
10849                    if (typeof styleValue === 'string') {
10850                        valueInPixels = parseInt(styleValue, 10);
10851
10852                        if (styleValue.indexOf('%') !== -1) {
10853                            // percentage * size in dimension
10854                            valueInPixels = valueInPixels / 100 * node.parentNode[parentProperty];
10855                        }
10856                    } else {
10857                        valueInPixels = styleValue;
10858                    }
10859
10860                    return valueInPixels;
10861                }
10862
10863                /**
10864                 * Returns if the given value contains an effective constraint.
10865                 * @private
10866                 */
10867                function isConstrainedValue(value) {
10868                    return value !== undefined && value !== null && value !== 'none';
10869                }
10870
10871                /**
10872                 * Returns the max width or height of the given DOM node in a cross-browser compatible fashion
10873                 * @param {HTMLElement} domNode - the node to check the constraint on
10874                 * @param {string} maxStyle - the style that defines the maximum for the direction we are using ('max-width' / 'max-height')
10875                 * @param {string} percentageProperty - property of parent to use when calculating width as a percentage
10876                 * @see {@link https://www.nathanaeljones.com/blog/2013/reading-max-width-cross-browser}
10877                 */
10878                function getConstraintDimension(domNode, maxStyle, percentageProperty) {
10879                    var view = document.defaultView;
10880                    var parentNode = helpers$1._getParentNode(domNode);
10881                    var constrainedNode = view.getComputedStyle(domNode)[maxStyle];
10882                    var constrainedContainer = view.getComputedStyle(parentNode)[maxStyle];
10883                    var hasCNode = isConstrainedValue(constrainedNode);
10884                    var hasCContainer = isConstrainedValue(constrainedContainer);
10885                    var infinity = Number.POSITIVE_INFINITY;
10886
10887                    if (hasCNode || hasCContainer) {
10888                        return Math.min(
10889                            hasCNode ? parseMaxStyle(constrainedNode, domNode, percentageProperty) : infinity,
10890                            hasCContainer ? parseMaxStyle(constrainedContainer, parentNode, percentageProperty) : infinity);
10891                    }
10892
10893                    return 'none';
10894                }
10895
10896                // returns Number or undefined if no constraint
10897                helpers$1.getConstraintWidth = function (domNode) {
10898                    return getConstraintDimension(domNode, 'max-width', 'clientWidth');
10899                };
10900                // returns Number or undefined if no constraint
10901                helpers$1.getConstraintHeight = function (domNode) {
10902                    return getConstraintDimension(domNode, 'max-height', 'clientHeight');
10903                };
10904                /**
10905                 * @private
10906                 */
10907                helpers$1._calculatePadding = function (container, padding, parentDimension) {
10908                    padding = helpers$1.getStyle(container, padding);
10909
10910                    return padding.indexOf('%') > -1 ? parentDimension * parseInt(padding, 10) / 100 : parseInt(padding, 10);
10911                };
10912                /**
10913                 * @private
10914                 */
10915                helpers$1._getParentNode = function (domNode) {
10916                    var parent = domNode.parentNode;
10917                    if (parent && parent.toString() === '[object ShadowRoot]') {
10918                        parent = parent.host;
10919                    }
10920                    return parent;
10921                };
10922                helpers$1.getMaximumWidth = function (domNode) {
10923                    var container = helpers$1._getParentNode(domNode);
10924                    if (!container) {
10925                        return domNode.clientWidth;
10926                    }
10927
10928                    var clientWidth = container.clientWidth;
10929                    var paddingLeft = helpers$1._calculatePadding(container, 'padding-left', clientWidth);
10930                    var paddingRight = helpers$1._calculatePadding(container, 'padding-right', clientWidth);
10931
10932                    var w = clientWidth - paddingLeft - paddingRight;
10933                    var cw = helpers$1.getConstraintWidth(domNode);
10934                    return isNaN(cw) ? w : Math.min(w, cw);
10935                };
10936                helpers$1.getMaximumHeight = function (domNode) {
10937                    var container = helpers$1._getParentNode(domNode);
10938                    if (!container) {
10939                        return domNode.clientHeight;
10940                    }
10941
10942                    var clientHeight = container.clientHeight;
10943                    var paddingTop = helpers$1._calculatePadding(container, 'padding-top', clientHeight);
10944                    var paddingBottom = helpers$1._calculatePadding(container, 'padding-bottom', clientHeight);
10945
10946                    var h = clientHeight - paddingTop - paddingBottom;
10947                    var ch = helpers$1.getConstraintHeight(domNode);
10948                    return isNaN(ch) ? h : Math.min(h, ch);
10949                };
10950                helpers$1.getStyle = function (el, property) {
10951                    return el.currentStyle ?
10952                        el.currentStyle[property] :
10953                        document.defaultView.getComputedStyle(el, null).getPropertyValue(property);
10954                };
10955                helpers$1.retinaScale = function (chart, forceRatio) {
10956                    var pixelRatio = chart.currentDevicePixelRatio = forceRatio || (typeof window !== 'undefined' && window.devicePixelRatio) || 1;
10957                    if (pixelRatio === 1) {
10958                        return;
10959                    }
10960
10961                    var canvas = chart.canvas;
10962                    var height = chart.height;
10963                    var width = chart.width;
10964
10965                    canvas.height = height * pixelRatio;
10966                    canvas.width = width * pixelRatio;
10967                    chart.ctx.scale(pixelRatio, pixelRatio);
10968
10969                    // If no style has been set on the canvas, the render size is used as display size,
10970                    // making the chart visually bigger, so let's enforce it to the "correct" values.
10971                    // See https://github.com/chartjs/Chart.js/issues/3575
10972                    if (!canvas.style.height && !canvas.style.width) {
10973                        canvas.style.height = height + 'px';
10974                        canvas.style.width = width + 'px';
10975                    }
10976                };
10977                // -- Canvas methods
10978                helpers$1.fontString = function (pixelSize, fontStyle, fontFamily) {
10979                    return fontStyle + ' ' + pixelSize + 'px ' + fontFamily;
10980                };
10981                helpers$1.longestText = function (ctx, font, arrayOfThings, cache) {
10982                    cache = cache || {};
10983                    var data = cache.data = cache.data || {};
10984                    var gc = cache.garbageCollect = cache.garbageCollect || [];
10985
10986                    if (cache.font !== font) {
10987                        data = cache.data = {};
10988                        gc = cache.garbageCollect = [];
10989                        cache.font = font;
10990                    }
10991
10992                    ctx.font = font;
10993                    var longest = 0;
10994                    var ilen = arrayOfThings.length;
10995                    var i, j, jlen, thing, nestedThing;
10996                    for (i = 0; i < ilen; i++) {
10997                        thing = arrayOfThings[i];
10998
10999                        // Undefined strings and arrays should not be measured
11000                        if (thing !== undefined && thing !== null && helpers$1.isArray(thing) !== true) {
11001                            longest = helpers$1.measureText(ctx, data, gc, longest, thing);
11002                        } else if (helpers$1.isArray(thing)) {
11003                            // if it is an array lets measure each element
11004                            // to do maybe simplify this function a bit so we can do this more recursively?
11005                            for (j = 0, jlen = thing.length; j < jlen; j++) {
11006                                nestedThing = thing[j];
11007                                // Undefined strings and arrays should not be measured
11008                                if (nestedThing !== undefined && nestedThing !== null && !helpers$1.isArray(nestedThing)) {
11009                                    longest = helpers$1.measureText(ctx, data, gc, longest, nestedThing);
11010                                }
11011                            }
11012                        }
11013                    }
11014
11015                    var gcLen = gc.length / 2;
11016                    if (gcLen > arrayOfThings.length) {
11017                        for (i = 0; i < gcLen; i++) {
11018                            delete data[gc[i]];
11019                        }
11020                        gc.splice(0, gcLen);
11021                    }
11022                    return longest;
11023                };
11024                helpers$1.measureText = function (ctx, data, gc, longest, string) {
11025                    var textWidth = data[string];
11026                    if (!textWidth) {
11027                        textWidth = data[string] = ctx.measureText(string).width;
11028                        gc.push(string);
11029                    }
11030                    if (textWidth > longest) {
11031                        longest = textWidth;
11032                    }
11033                    return longest;
11034                };
11035
11036                /**
11037                 * @deprecated
11038                 */
11039                helpers$1.numberOfLabelLines = function (arrayOfThings) {
11040                    var numberOfLines = 1;
11041                    helpers$1.each(arrayOfThings, function (thing) {
11042                        if (helpers$1.isArray(thing)) {
11043                            if (thing.length > numberOfLines) {
11044                                numberOfLines = thing.length;
11045                            }
11046                        }
11047                    });
11048                    return numberOfLines;
11049                };
11050
11051                helpers$1.color = !chartjsColor ?
11052                    function (value) {
11053                        console.error('Color.js not found!');
11054                        return value;
11055                    } :
11056                    function (value) {
11057                        /* global CanvasGradient */
11058                        if (value instanceof CanvasGradient) {
11059                            value = core_defaults.global.defaultColor;
11060                        }
11061
11062                        return chartjsColor(value);
11063                    };
11064
11065                helpers$1.getHoverColor = function (colorValue) {
11066                    /* global CanvasPattern */
11067                    return (colorValue instanceof CanvasPattern || colorValue instanceof CanvasGradient) ?
11068                        colorValue :
11069                        helpers$1.color(colorValue).saturate(0.5).darken(0.1).rgbString();
11070                };
11071            };
11072
11073            function abstract() {
11074                throw new Error(
11075                    'This method is not implemented: either no adapter can ' +
11076                    'be found or an incomplete integration was provided.'
11077                );
11078            }
11079
11080            /**
11081             * Date adapter (current used by the time scale)
11082             * @namespace Chart._adapters._date
11083             * @memberof Chart._adapters
11084             * @private
11085             */
11086
11087            /**
11088             * Currently supported unit string values.
11089             * @typedef {('millisecond'|'second'|'minute'|'hour'|'day'|'week'|'month'|'quarter'|'year')}
11090             * @memberof Chart._adapters._date
11091             * @name Unit
11092             */
11093
11094            /**
11095             * @class
11096             */
11097            function DateAdapter(options) {
11098                this.options = options || {};
11099            }
11100
11101            helpers$1.extend(DateAdapter.prototype, /** @lends DateAdapter */ {
11102                /**
11103                 * Returns a map of time formats for the supported formatting units defined
11104                 * in Unit as well as 'datetime' representing a detailed date/time string.
11105                 * @returns {{string: string}}
11106                 */
11107                formats: abstract,
11108
11109                /**
11110                 * Parses the given `value` and return the associated timestamp.
11111                 * @param {any} value - the value to parse (usually comes from the data)
11112                 * @param {string} [format] - the expected data format
11113                 * @returns {(number|null)}
11114                 * @function
11115                 */
11116                parse: abstract,
11117
11118                /**
11119                 * Returns the formatted date in the specified `format` for a given `timestamp`.
11120                 * @param {number} timestamp - the timestamp to format
11121                 * @param {string} format - the date/time token
11122                 * @return {string}
11123                 * @function
11124                 */
11125                format: abstract,
11126
11127                /**
11128                 * Adds the specified `amount` of `unit` to the given `timestamp`.
11129                 * @param {number} timestamp - the input timestamp
11130                 * @param {number} amount - the amount to add
11131                 * @param {Unit} unit - the unit as string
11132                 * @return {number}
11133                 * @function
11134                 */
11135                add: abstract,
11136
11137                /**
11138                 * Returns the number of `unit` between the given timestamps.
11139                 * @param {number} max - the input timestamp (reference)
11140                 * @param {number} min - the timestamp to substract
11141                 * @param {Unit} unit - the unit as string
11142                 * @return {number}
11143                 * @function
11144                 */
11145                diff: abstract,
11146
11147                /**
11148                 * Returns start of `unit` for the given `timestamp`.
11149                 * @param {number} timestamp - the input timestamp
11150                 * @param {Unit} unit - the unit as string
11151                 * @param {number} [weekday] - the ISO day of the week with 1 being Monday
11152                 * and 7 being Sunday (only needed if param *unit* is `isoWeek`).
11153                 * @function
11154                 */
11155                startOf: abstract,
11156
11157                /**
11158                 * Returns end of `unit` for the given `timestamp`.
11159                 * @param {number} timestamp - the input timestamp
11160                 * @param {Unit} unit - the unit as string
11161                 * @function
11162                 */
11163                endOf: abstract,
11164
11165                // DEPRECATIONS
11166
11167                /**
11168                 * Provided for backward compatibility for scale.getValueForPixel(),
11169                 * this method should be overridden only by the moment adapter.
11170                 * @deprecated since version 2.8.0
11171                 * @todo remove at version 3
11172                 * @private
11173                 */
11174                _create: function (value) {
11175                    return value;
11176                }
11177            });
11178
11179            DateAdapter.override = function (members) {
11180                helpers$1.extend(DateAdapter.prototype, members);
11181            };
11182
11183            var _date = DateAdapter;
11184
11185            var core_adapters = {
11186                _date: _date
11187            };
11188
11189            /**
11190             * Namespace to hold static tick generation functions
11191             * @namespace Chart.Ticks
11192             */
11193            var core_ticks = {
11194                /**
11195                 * Namespace to hold formatters for different types of ticks
11196                 * @namespace Chart.Ticks.formatters
11197                 */
11198                formatters: {
11199                    /**
11200                     * Formatter for value labels
11201                     * @method Chart.Ticks.formatters.values
11202                     * @param value the value to display
11203                     * @return {string|string[]} the label to display
11204                     */
11205                    values: function (value) {
11206                        return helpers$1.isArray(value) ? value : '' + value;
11207                    },
11208
11209                    /**
11210                     * Formatter for linear numeric ticks
11211                     * @method Chart.Ticks.formatters.linear
11212                     * @param tickValue {number} the value to be formatted
11213                     * @param index {number} the position of the tickValue parameter in the ticks array
11214                     * @param ticks {number[]} the list of ticks being converted
11215                     * @return {string} string representation of the tickValue parameter
11216                     */
11217                    linear: function (tickValue, index, ticks) {
11218                        // If we have lots of ticks, don't use the ones
11219                        var delta = ticks.length > 3 ? ticks[2] - ticks[1] : ticks[1] - ticks[0];
11220
11221                        // If we have a number like 2.5 as the delta, figure out how many decimal places we need
11222                        if (Math.abs(delta) > 1) {
11223                            if (tickValue !== Math.floor(tickValue)) {
11224                                // not an integer
11225                                delta = tickValue - Math.floor(tickValue);
11226                            }
11227                        }
11228
11229                        var logDelta = helpers$1.log10(Math.abs(delta));
11230                        var tickString = '';
11231
11232                        if (tickValue !== 0) {
11233                            var maxTick = Math.max(Math.abs(ticks[0]), Math.abs(ticks[ticks.length - 1]));
11234                            if (maxTick < 1e-4) { // all ticks are small numbers; use scientific notation
11235                                var logTick = helpers$1.log10(Math.abs(tickValue));
11236                                var numExponential = Math.floor(logTick) - Math.floor(logDelta);
11237                                numExponential = Math.max(Math.min(numExponential, 20), 0);
11238                                tickString = tickValue.toExponential(numExponential);
11239                            } else {
11240                                var numDecimal = -1 * Math.floor(logDelta);
11241                                numDecimal = Math.max(Math.min(numDecimal, 20), 0); // toFixed has a max of 20 decimal places
11242                                tickString = tickValue.toFixed(numDecimal);
11243                            }
11244                        } else {
11245                            tickString = '0'; // never show decimal places for 0
11246                        }
11247
11248                        return tickString;
11249                    },
11250
11251                    logarithmic: function (tickValue, index, ticks) {
11252                        var remain = tickValue / (Math.pow(10, Math.floor(helpers$1.log10(tickValue))));
11253
11254                        if (tickValue === 0) {
11255                            return '0';
11256                        } else if (remain === 1 || remain === 2 || remain === 5 || index === 0 || index === ticks.length - 1) {
11257                            return tickValue.toExponential();
11258                        }
11259                        return '';
11260                    }
11261                }
11262            };
11263
11264            var isArray = helpers$1.isArray;
11265            var isNullOrUndef = helpers$1.isNullOrUndef;
11266            var valueOrDefault$a = helpers$1.valueOrDefault;
11267            var valueAtIndexOrDefault = helpers$1.valueAtIndexOrDefault;
11268
11269            core_defaults._set('scale', {
11270                display: true,
11271                position: 'left',
11272                offset: false,
11273
11274                // grid line settings
11275                gridLines: {
11276                    display: true,
11277                    color: 'rgba(0,0,0,0.1)',
11278                    lineWidth: 1,
11279                    drawBorder: true,
11280                    drawOnChartArea: true,
11281                    drawTicks: true,
11282                    tickMarkLength: 10,
11283                    zeroLineWidth: 1,
11284                    zeroLineColor: 'rgba(0,0,0,0.25)',
11285                    zeroLineBorderDash: [],
11286                    zeroLineBorderDashOffset: 0.0,
11287                    offsetGridLines: false,
11288                    borderDash: [],
11289                    borderDashOffset: 0.0
11290                },
11291
11292                // scale label
11293                scaleLabel: {
11294                    // display property
11295                    display: false,
11296
11297                    // actual label
11298                    labelString: '',
11299
11300                    // top/bottom padding
11301                    padding: {
11302                        top: 4,
11303                        bottom: 4
11304                    }
11305                },
11306
11307                // label settings
11308                ticks: {
11309                    beginAtZero: false,
11310                    minRotation: 0,
11311                    maxRotation: 50,
11312                    mirror: false,
11313                    padding: 0,
11314                    reverse: false,
11315                    display: true,
11316                    autoSkip: true,
11317                    autoSkipPadding: 0,
11318                    labelOffset: 0,
11319                    // We pass through arrays to be rendered as multiline labels, we convert Others to strings here.
11320                    callback: core_ticks.formatters.values,
11321                    minor: {},
11322                    major: {}
11323                }
11324            });
11325
11326            /** Returns a new array containing numItems from arr */
11327            function sample(arr, numItems) {
11328                var result = [];
11329                var increment = arr.length / numItems;
11330                var i = 0;
11331                var len = arr.length;
11332
11333                for (; i < len; i += increment) {
11334                    result.push(arr[Math.floor(i)]);
11335                }
11336                return result;
11337            }
11338
11339            function getPixelForGridLine(scale, index, offsetGridLines) {
11340                var length = scale.getTicks().length;
11341                var validIndex = Math.min(index, length - 1);
11342                var lineValue = scale.getPixelForTick(validIndex);
11343                var start = scale._startPixel;
11344                var end = scale._endPixel;
11345                var epsilon = 1e-6; // 1e-6 is margin in pixels for accumulated error.
11346                var offset;
11347
11348                if (offsetGridLines) {
11349                    if (length === 1) {
11350                        offset = Math.max(lineValue - start, end - lineValue);
11351                    } else if (index === 0) {
11352                        offset = (scale.getPixelForTick(1) - lineValue) / 2;
11353                    } else {
11354                        offset = (lineValue - scale.getPixelForTick(validIndex - 1)) / 2;
11355                    }
11356                    lineValue += validIndex < index ? offset : -offset;
11357
11358                    // Return undefined if the pixel is out of the range
11359                    if (lineValue < start - epsilon || lineValue > end + epsilon) {
11360                        return;
11361                    }
11362                }
11363                return lineValue;
11364            }
11365
11366            function garbageCollect(caches, length) {
11367                helpers$1.each(caches, function (cache) {
11368                    var gc = cache.gc;
11369                    var gcLen = gc.length / 2;
11370                    var i;
11371                    if (gcLen > length) {
11372                        for (i = 0; i < gcLen; ++i) {
11373                            delete cache.data[gc[i]];
11374                        }
11375                        gc.splice(0, gcLen);
11376                    }
11377                });
11378            }
11379
11380            /**
11381             * Returns {width, height, offset} objects for the first, last, widest, highest tick
11382             * labels where offset indicates the anchor point offset from the top in pixels.
11383             */
11384            function computeLabelSizes(ctx, tickFonts, ticks, caches) {
11385                var length = ticks.length;
11386                var widths = [];
11387                var heights = [];
11388                var offsets = [];
11389                var widestLabelSize = 0;
11390                var highestLabelSize = 0;
11391                var i, j, jlen, label, tickFont, fontString, cache, lineHeight, width, height, nestedLabel, widest,
11392                    highest;
11393
11394                for (i = 0; i < length; ++i) {
11395                    label = ticks[i].label;
11396                    tickFont = ticks[i].major ? tickFonts.major : tickFonts.minor;
11397                    ctx.font = fontString = tickFont.string;
11398                    cache = caches[fontString] = caches[fontString] || {data: {}, gc: []};
11399                    lineHeight = tickFont.lineHeight;
11400                    width = height = 0;
11401                    // Undefined labels and arrays should not be measured
11402                    if (!isNullOrUndef(label) && !isArray(label)) {
11403                        width = helpers$1.measureText(ctx, cache.data, cache.gc, width, label);
11404                        height = lineHeight;
11405                    } else if (isArray(label)) {
11406                        // if it is an array let's measure each element
11407                        for (j = 0, jlen = label.length; j < jlen; ++j) {
11408                            nestedLabel = label[j];
11409                            // Undefined labels and arrays should not be measured
11410                            if (!isNullOrUndef(nestedLabel) && !isArray(nestedLabel)) {
11411                                width = helpers$1.measureText(ctx, cache.data, cache.gc, width, nestedLabel);
11412                                height += lineHeight;
11413                            }
11414                        }
11415                    }
11416                    widths.push(width);
11417                    heights.push(height);
11418                    offsets.push(lineHeight / 2);
11419                    widestLabelSize = Math.max(width, widestLabelSize);
11420                    highestLabelSize = Math.max(height, highestLabelSize);
11421                }
11422                garbageCollect(caches, length);
11423
11424                widest = widths.indexOf(widestLabelSize);
11425                highest = heights.indexOf(highestLabelSize);
11426
11427                function valueAt(idx) {
11428                    return {
11429                        width: widths[idx] || 0,
11430                        height: heights[idx] || 0,
11431                        offset: offsets[idx] || 0
11432                    };
11433                }
11434
11435                return {
11436                    first: valueAt(0),
11437                    last: valueAt(length - 1),
11438                    widest: valueAt(widest),
11439                    highest: valueAt(highest)
11440                };
11441            }
11442
11443            function getTickMarkLength(options) {
11444                return options.drawTicks ? options.tickMarkLength : 0;
11445            }
11446
11447            function getScaleLabelHeight(options) {
11448                var font, padding;
11449
11450                if (!options.display) {
11451                    return 0;
11452                }
11453
11454                font = helpers$1.options._parseFont(options);
11455                padding = helpers$1.options.toPadding(options.padding);
11456
11457                return font.lineHeight + padding.height;
11458            }
11459
11460            function parseFontOptions(options, nestedOpts) {
11461                return helpers$1.extend(helpers$1.options._parseFont({
11462                    fontFamily: valueOrDefault$a(nestedOpts.fontFamily, options.fontFamily),
11463                    fontSize: valueOrDefault$a(nestedOpts.fontSize, options.fontSize),
11464                    fontStyle: valueOrDefault$a(nestedOpts.fontStyle, options.fontStyle),
11465                    lineHeight: valueOrDefault$a(nestedOpts.lineHeight, options.lineHeight)
11466                }), {
11467                    color: helpers$1.options.resolve([nestedOpts.fontColor, options.fontColor, core_defaults.global.defaultFontColor])
11468                });
11469            }
11470
11471            function parseTickFontOptions(options) {
11472                var minor = parseFontOptions(options, options.minor);
11473                var major = options.major.enabled ? parseFontOptions(options, options.major) : minor;
11474
11475                return {minor: minor, major: major};
11476            }
11477
11478            function nonSkipped(ticksToFilter) {
11479                var filtered = [];
11480                var item, index, len;
11481                for (index = 0, len = ticksToFilter.length; index < len; ++index) {
11482                    item = ticksToFilter[index];
11483                    if (typeof item._index !== 'undefined') {
11484                        filtered.push(item);
11485                    }
11486                }
11487                return filtered;
11488            }
11489
11490            function getEvenSpacing(arr) {
11491                var len = arr.length;
11492                var i, diff;
11493
11494                if (len < 2) {
11495                    return false;
11496                }
11497
11498                for (diff = arr[0], i = 1; i < len; ++i) {
11499                    if (arr[i] - arr[i - 1] !== diff) {
11500                        return false;
11501                    }
11502                }
11503                return diff;
11504            }
11505
11506            function calculateSpacing(majorIndices, ticks, axisLength, ticksLimit) {
11507                var evenMajorSpacing = getEvenSpacing(majorIndices);
11508                var spacing = (ticks.length - 1) / ticksLimit;
11509                var factors, factor, i, ilen;
11510
11511                // If the major ticks are evenly spaced apart, place the minor ticks
11512                // so that they divide the major ticks into even chunks
11513                if (!evenMajorSpacing) {
11514                    return Math.max(spacing, 1);
11515                }
11516
11517                factors = helpers$1.math._factorize(evenMajorSpacing);
11518                for (i = 0, ilen = factors.length - 1; i < ilen; i++) {
11519                    factor = factors[i];
11520                    if (factor > spacing) {
11521                        return factor;
11522                    }
11523                }
11524                return Math.max(spacing, 1);
11525            }
11526
11527            function getMajorIndices(ticks) {
11528                var result = [];
11529                var i, ilen;
11530                for (i = 0, ilen = ticks.length; i < ilen; i++) {
11531                    if (ticks[i].major) {
11532                        result.push(i);
11533                    }
11534                }
11535                return result;
11536            }
11537
11538            function skipMajors(ticks, majorIndices, spacing) {
11539                var count = 0;
11540                var next = majorIndices[0];
11541                var i, tick;
11542
11543                spacing = Math.ceil(spacing);
11544                for (i = 0; i < ticks.length; i++) {
11545                    tick = ticks[i];
11546                    if (i === next) {
11547                        tick._index = i;
11548                        count++;
11549                        next = majorIndices[count * spacing];
11550                    } else {
11551                        delete tick.label;
11552                    }
11553                }
11554            }
11555
11556            function skip(ticks, spacing, majorStart, majorEnd) {
11557                var start = valueOrDefault$a(majorStart, 0);
11558                var end = Math.min(valueOrDefault$a(majorEnd, ticks.length), ticks.length);
11559                var count = 0;
11560                var length, i, tick, next;
11561
11562                spacing = Math.ceil(spacing);
11563                if (majorEnd) {
11564                    length = majorEnd - majorStart;
11565                    spacing = length / Math.floor(length / spacing);
11566                }
11567
11568                next = start;
11569
11570                while (next < 0) {
11571                    count++;
11572                    next = Math.round(start + count * spacing);
11573                }
11574
11575                for (i = Math.max(start, 0); i < end; i++) {
11576                    tick = ticks[i];
11577                    if (i === next) {
11578                        tick._index = i;
11579                        count++;
11580                        next = Math.round(start + count * spacing);
11581                    } else {
11582                        delete tick.label;
11583                    }
11584                }
11585            }
11586
11587            var Scale = core_element.extend({
11588
11589                zeroLineIndex: 0,
11590
11591                /**
11592                 * Get the padding needed for the scale
11593                 * @method getPadding
11594                 * @private
11595                 * @returns {Padding} the necessary padding
11596                 */
11597                getPadding: function () {
11598                    var me = this;
11599                    return {
11600                        left: me.paddingLeft || 0,
11601                        top: me.paddingTop || 0,
11602                        right: me.paddingRight || 0,
11603                        bottom: me.paddingBottom || 0
11604                    };
11605                },
11606
11607                /**
11608                 * Returns the scale tick objects ({label, major})
11609                 * @since 2.7
11610                 */
11611                getTicks: function () {
11612                    return this._ticks;
11613                },
11614
11615                /**
11616                 * @private
11617                 */
11618                _getLabels: function () {
11619                    var data = this.chart.data;
11620                    return this.options.labels || (this.isHorizontal() ? data.xLabels : data.yLabels) || data.labels || [];
11621                },
11622
11623                // These methods are ordered by lifecyle. Utilities then follow.
11624                // Any function defined here is inherited by all scale types.
11625                // Any function can be extended by the scale type
11626
11627                /**
11628                 * Provided for backward compatibility, not available anymore
11629                 * @function Chart.Scale.mergeTicksOptions
11630                 * @deprecated since version 2.8.0
11631                 * @todo remove at version 3
11632                 */
11633                mergeTicksOptions: function () {
11634                    // noop
11635                },
11636
11637                beforeUpdate: function () {
11638                    helpers$1.callback(this.options.beforeUpdate, [this]);
11639                },
11640
11641                /**
11642                 * @param {number} maxWidth - the max width in pixels
11643                 * @param {number} maxHeight - the max height in pixels
11644                 * @param {object} margins - the space between the edge of the other scales and edge of the chart
11645                 *   This space comes from two sources:
11646                 *     - padding - space that's required to show the labels at the edges of the scale
11647                 *     - thickness of scales or legends in another orientation
11648                 */
11649                update: function (maxWidth, maxHeight, margins) {
11650                    var me = this;
11651                    var tickOpts = me.options.ticks;
11652                    var sampleSize = tickOpts.sampleSize;
11653                    var i, ilen, labels, ticks, samplingEnabled;
11654
11655                    // Update Lifecycle - Probably don't want to ever extend or overwrite this function ;)
11656                    me.beforeUpdate();
11657
11658                    // Absorb the master measurements
11659                    me.maxWidth = maxWidth;
11660                    me.maxHeight = maxHeight;
11661                    me.margins = helpers$1.extend({
11662                        left: 0,
11663                        right: 0,
11664                        top: 0,
11665                        bottom: 0
11666                    }, margins);
11667
11668                    me._ticks = null;
11669                    me.ticks = null;
11670                    me._labelSizes = null;
11671                    me._maxLabelLines = 0;
11672                    me.longestLabelWidth = 0;
11673                    me.longestTextCache = me.longestTextCache || {};
11674                    me._gridLineItems = null;
11675                    me._labelItems = null;
11676
11677                    // Dimensions
11678                    me.beforeSetDimensions();
11679                    me.setDimensions();
11680                    me.afterSetDimensions();
11681
11682                    // Data min/max
11683                    me.beforeDataLimits();
11684                    me.determineDataLimits();
11685                    me.afterDataLimits();
11686
11687                    // Ticks - `this.ticks` is now DEPRECATED!
11688                    // Internal ticks are now stored as objects in the PRIVATE `this._ticks` member
11689                    // and must not be accessed directly from outside this class. `this.ticks` being
11690                    // around for long time and not marked as private, we can't change its structure
11691                    // without unexpected breaking changes. If you need to access the scale ticks,
11692                    // use scale.getTicks() instead.
11693
11694                    me.beforeBuildTicks();
11695
11696                    // New implementations should return an array of objects but for BACKWARD COMPAT,
11697                    // we still support no return (`this.ticks` internally set by calling this method).
11698                    ticks = me.buildTicks() || [];
11699
11700                    // Allow modification of ticks in callback.
11701                    ticks = me.afterBuildTicks(ticks) || ticks;
11702
11703                    // Ensure ticks contains ticks in new tick format
11704                    if ((!ticks || !ticks.length) && me.ticks) {
11705                        ticks = [];
11706                        for (i = 0, ilen = me.ticks.length; i < ilen; ++i) {
11707                            ticks.push({
11708                                value: me.ticks[i],
11709                                major: false
11710                            });
11711                        }
11712                    }
11713
11714                    me._ticks = ticks;
11715
11716                    // Compute tick rotation and fit using a sampled subset of labels
11717                    // We generally don't need to compute the size of every single label for determining scale size
11718                    samplingEnabled = sampleSize < ticks.length;
11719                    labels = me._convertTicksToLabels(samplingEnabled ? sample(ticks, sampleSize) : ticks);
11720
11721                    // _configure is called twice, once here, once from core.controller.updateLayout.
11722                    // Here we haven't been positioned yet, but dimensions are correct.
11723                    // Variables set in _configure are needed for calculateTickRotation, and
11724                    // it's ok that coordinates are not correct there, only dimensions matter.
11725                    me._configure();
11726
11727                    // Tick Rotation
11728                    me.beforeCalculateTickRotation();
11729                    me.calculateTickRotation();
11730                    me.afterCalculateTickRotation();
11731
11732                    me.beforeFit();
11733                    me.fit();
11734                    me.afterFit();
11735
11736                    // Auto-skip
11737                    me._ticksToDraw = tickOpts.display && (tickOpts.autoSkip || tickOpts.source === 'auto') ? me._autoSkip(ticks) : ticks;
11738
11739                    if (samplingEnabled) {
11740                        // Generate labels using all non-skipped ticks
11741                        labels = me._convertTicksToLabels(me._ticksToDraw);
11742                    }
11743
11744                    me.ticks = labels;   // BACKWARD COMPATIBILITY
11745
11746                    // IMPORTANT: after this point, we consider that `this.ticks` will NEVER change!
11747
11748                    me.afterUpdate();
11749
11750                    // TODO(v3): remove minSize as a public property and return value from all layout boxes. It is unused
11751                    // make maxWidth and maxHeight private
11752                    return me.minSize;
11753                },
11754
11755                /**
11756                 * @private
11757                 */
11758                _configure: function () {
11759                    var me = this;
11760                    var reversePixels = me.options.ticks.reverse;
11761                    var startPixel, endPixel;
11762
11763                    if (me.isHorizontal()) {
11764                        startPixel = me.left;
11765                        endPixel = me.right;
11766                    } else {
11767                        startPixel = me.top;
11768                        endPixel = me.bottom;
11769                        // by default vertical scales are from bottom to top, so pixels are reversed
11770                        reversePixels = !reversePixels;
11771                    }
11772                    me._startPixel = startPixel;
11773                    me._endPixel = endPixel;
11774                    me._reversePixels = reversePixels;
11775                    me._length = endPixel - startPixel;
11776                },
11777
11778                afterUpdate: function () {
11779                    helpers$1.callback(this.options.afterUpdate, [this]);
11780                },
11781
11782                //
11783
11784                beforeSetDimensions: function () {
11785                    helpers$1.callback(this.options.beforeSetDimensions, [this]);
11786                },
11787                setDimensions: function () {
11788                    var me = this;
11789                    // Set the unconstrained dimension before label rotation
11790                    if (me.isHorizontal()) {
11791                        // Reset position before calculating rotation
11792                        me.width = me.maxWidth;
11793                        me.left = 0;
11794                        me.right = me.width;
11795                    } else {
11796                        me.height = me.maxHeight;
11797
11798                        // Reset position before calculating rotation
11799                        me.top = 0;
11800                        me.bottom = me.height;
11801                    }
11802
11803                    // Reset padding
11804                    me.paddingLeft = 0;
11805                    me.paddingTop = 0;
11806                    me.paddingRight = 0;
11807                    me.paddingBottom = 0;
11808                },
11809                afterSetDimensions: function () {
11810                    helpers$1.callback(this.options.afterSetDimensions, [this]);
11811                },
11812
11813                // Data limits
11814                beforeDataLimits: function () {
11815                    helpers$1.callback(this.options.beforeDataLimits, [this]);
11816                },
11817                determineDataLimits: helpers$1.noop,
11818                afterDataLimits: function () {
11819                    helpers$1.callback(this.options.afterDataLimits, [this]);
11820                },
11821
11822                //
11823                beforeBuildTicks: function () {
11824                    helpers$1.callback(this.options.beforeBuildTicks, [this]);
11825                },
11826                buildTicks: helpers$1.noop,
11827                afterBuildTicks: function (ticks) {
11828                    var me = this;
11829                    // ticks is empty for old axis implementations here
11830                    if (isArray(ticks) && ticks.length) {
11831                        return helpers$1.callback(me.options.afterBuildTicks, [me, ticks]);
11832                    }
11833                    // Support old implementations (that modified `this.ticks` directly in buildTicks)
11834                    me.ticks = helpers$1.callback(me.options.afterBuildTicks, [me, me.ticks]) || me.ticks;
11835                    return ticks;
11836                },
11837
11838                beforeTickToLabelConversion: function () {
11839                    helpers$1.callback(this.options.beforeTickToLabelConversion, [this]);
11840                },
11841                convertTicksToLabels: function () {
11842                    var me = this;
11843                    // Convert ticks to strings
11844                    var tickOpts = me.options.ticks;
11845                    me.ticks = me.ticks.map(tickOpts.userCallback || tickOpts.callback, this);
11846                },
11847                afterTickToLabelConversion: function () {
11848                    helpers$1.callback(this.options.afterTickToLabelConversion, [this]);
11849                },
11850
11851                //
11852
11853                beforeCalculateTickRotation: function () {
11854                    helpers$1.callback(this.options.beforeCalculateTickRotation, [this]);
11855                },
11856                calculateTickRotation: function () {
11857                    var me = this;
11858                    var options = me.options;
11859                    var tickOpts = options.ticks;
11860                    var numTicks = me.getTicks().length;
11861                    var minRotation = tickOpts.minRotation || 0;
11862                    var maxRotation = tickOpts.maxRotation;
11863                    var labelRotation = minRotation;
11864                    var labelSizes, maxLabelWidth, maxLabelHeight, maxWidth, tickWidth, maxHeight, maxLabelDiagonal;
11865
11866                    if (!me._isVisible() || !tickOpts.display || minRotation >= maxRotation || numTicks <= 1 || !me.isHorizontal()) {
11867                        me.labelRotation = minRotation;
11868                        return;
11869                    }
11870
11871                    labelSizes = me._getLabelSizes();
11872                    maxLabelWidth = labelSizes.widest.width;
11873                    maxLabelHeight = labelSizes.highest.height - labelSizes.highest.offset;
11874
11875                    // Estimate the width of each grid based on the canvas width, the maximum
11876                    // label width and the number of tick intervals
11877                    maxWidth = Math.min(me.maxWidth, me.chart.width - maxLabelWidth);
11878                    tickWidth = options.offset ? me.maxWidth / numTicks : maxWidth / (numTicks - 1);
11879
11880                    // Allow 3 pixels x2 padding either side for label readability
11881                    if (maxLabelWidth + 6 > tickWidth) {
11882                        tickWidth = maxWidth / (numTicks - (options.offset ? 0.5 : 1));
11883                        maxHeight = me.maxHeight - getTickMarkLength(options.gridLines)
11884                            - tickOpts.padding - getScaleLabelHeight(options.scaleLabel);
11885                        maxLabelDiagonal = Math.sqrt(maxLabelWidth * maxLabelWidth + maxLabelHeight * maxLabelHeight);
11886                        labelRotation = helpers$1.toDegrees(Math.min(
11887                            Math.asin(Math.min((labelSizes.highest.height + 6) / tickWidth, 1)),
11888                            Math.asin(Math.min(maxHeight / maxLabelDiagonal, 1)) - Math.asin(maxLabelHeight / maxLabelDiagonal)
11889                        ));
11890                        labelRotation = Math.max(minRotation, Math.min(maxRotation, labelRotation));
11891                    }
11892
11893                    me.labelRotation = labelRotation;
11894                },
11895                afterCalculateTickRotation: function () {
11896                    helpers$1.callback(this.options.afterCalculateTickRotation, [this]);
11897                },
11898
11899                //
11900
11901                beforeFit: function () {
11902                    helpers$1.callback(this.options.beforeFit, [this]);
11903                },
11904                fit: function () {
11905                    var me = this;
11906                    // Reset
11907                    var minSize = me.minSize = {
11908                        width: 0,
11909                        height: 0
11910                    };
11911
11912                    var chart = me.chart;
11913                    var opts = me.options;
11914                    var tickOpts = opts.ticks;
11915                    var scaleLabelOpts = opts.scaleLabel;
11916                    var gridLineOpts = opts.gridLines;
11917                    var display = me._isVisible();
11918                    var isBottom = opts.position === 'bottom';
11919                    var isHorizontal = me.isHorizontal();
11920
11921                    // Width
11922                    if (isHorizontal) {
11923                        minSize.width = me.maxWidth;
11924                    } else if (display) {
11925                        minSize.width = getTickMarkLength(gridLineOpts) + getScaleLabelHeight(scaleLabelOpts);
11926                    }
11927
11928                    // height
11929                    if (!isHorizontal) {
11930                        minSize.height = me.maxHeight; // fill all the height
11931                    } else if (display) {
11932                        minSize.height = getTickMarkLength(gridLineOpts) + getScaleLabelHeight(scaleLabelOpts);
11933                    }
11934
11935                    // Don't bother fitting the ticks if we are not showing the labels
11936                    if (tickOpts.display && display) {
11937                        var tickFonts = parseTickFontOptions(tickOpts);
11938                        var labelSizes = me._getLabelSizes();
11939                        var firstLabelSize = labelSizes.first;
11940                        var lastLabelSize = labelSizes.last;
11941                        var widestLabelSize = labelSizes.widest;
11942                        var highestLabelSize = labelSizes.highest;
11943                        var lineSpace = tickFonts.minor.lineHeight * 0.4;
11944                        var tickPadding = tickOpts.padding;
11945
11946                        if (isHorizontal) {
11947                            // A horizontal axis is more constrained by the height.
11948                            var isRotated = me.labelRotation !== 0;
11949                            var angleRadians = helpers$1.toRadians(me.labelRotation);
11950                            var cosRotation = Math.cos(angleRadians);
11951                            var sinRotation = Math.sin(angleRadians);
11952
11953                            var labelHeight = sinRotation * widestLabelSize.width
11954                                + cosRotation * (highestLabelSize.height - (isRotated ? highestLabelSize.offset : 0))
11955                                + (isRotated ? 0 : lineSpace); // padding
11956
11957                            minSize.height = Math.min(me.maxHeight, minSize.height + labelHeight + tickPadding);
11958
11959                            var offsetLeft = me.getPixelForTick(0) - me.left;
11960                            var offsetRight = me.right - me.getPixelForTick(me.getTicks().length - 1);
11961                            var paddingLeft, paddingRight;
11962
11963                            // Ensure that our ticks are always inside the canvas. When rotated, ticks are right aligned
11964                            // which means that the right padding is dominated by the font height
11965                            if (isRotated) {
11966                                paddingLeft = isBottom ?
11967                                    cosRotation * firstLabelSize.width + sinRotation * firstLabelSize.offset :
11968                                    sinRotation * (firstLabelSize.height - firstLabelSize.offset);
11969                                paddingRight = isBottom ?
11970                                    sinRotation * (lastLabelSize.height - lastLabelSize.offset) :
11971                                    cosRotation * lastLabelSize.width + sinRotation * lastLabelSize.offset;
11972                            } else {
11973                                paddingLeft = firstLabelSize.width / 2;
11974                                paddingRight = lastLabelSize.width / 2;
11975                            }
11976
11977                            // Adjust padding taking into account changes in offsets
11978                            // and add 3 px to move away from canvas edges
11979                            me.paddingLeft = Math.max((paddingLeft - offsetLeft) * me.width / (me.width - offsetLeft), 0) + 3;
11980                            me.paddingRight = Math.max((paddingRight - offsetRight) * me.width / (me.width - offsetRight), 0) + 3;
11981                        } else {
11982                            // A vertical axis is more constrained by the width. Labels are the
11983                            // dominant factor here, so get that length first and account for padding
11984                            var labelWidth = tickOpts.mirror ? 0 :
11985                                // use lineSpace for consistency with horizontal axis
11986                                // tickPadding is not implemented for horizontal
11987                                widestLabelSize.width + tickPadding + lineSpace;
11988
11989                            minSize.width = Math.min(me.maxWidth, minSize.width + labelWidth);
11990
11991                            me.paddingTop = firstLabelSize.height / 2;
11992                            me.paddingBottom = lastLabelSize.height / 2;
11993                        }
11994                    }
11995
11996                    me.handleMargins();
11997
11998                    if (isHorizontal) {
11999                        me.width = me._length = chart.width - me.margins.left - me.margins.right;
12000                        me.height = minSize.height;
12001                    } else {
12002                        me.width = minSize.width;
12003                        me.height = me._length = chart.height - me.margins.top - me.margins.bottom;
12004                    }
12005                },
12006
12007                /**
12008                 * Handle margins and padding interactions
12009                 * @private
12010                 */
12011                handleMargins: function () {
12012                    var me = this;
12013                    if (me.margins) {
12014                        me.margins.left = Math.max(me.paddingLeft, me.margins.left);
12015                        me.margins.top = Math.max(me.paddingTop, me.margins.top);
12016                        me.margins.right = Math.max(me.paddingRight, me.margins.right);
12017                        me.margins.bottom = Math.max(me.paddingBottom, me.margins.bottom);
12018                    }
12019                },
12020
12021                afterFit: function () {
12022                    helpers$1.callback(this.options.afterFit, [this]);
12023                },
12024
12025                // Shared Methods
12026                isHorizontal: function () {
12027                    var pos = this.options.position;
12028                    return pos === 'top' || pos === 'bottom';
12029                },
12030                isFullWidth: function () {
12031                    return this.options.fullWidth;
12032                },
12033
12034                // Get the correct value. NaN bad inputs, If the value type is object get the x or y based on whether we are horizontal or not
12035                getRightValue: function (rawValue) {
12036                    // Null and undefined values first
12037                    if (isNullOrUndef(rawValue)) {
12038                        return NaN;
12039                    }
12040                    // isNaN(object) returns true, so make sure NaN is checking for a number; Discard Infinite values
12041                    if ((typeof rawValue === 'number' || rawValue instanceof Number) && !isFinite(rawValue)) {
12042                        return NaN;
12043                    }
12044
12045                    // If it is in fact an object, dive in one more level
12046                    if (rawValue) {
12047                        if (this.isHorizontal()) {
12048                            if (rawValue.x !== undefined) {
12049                                return this.getRightValue(rawValue.x);
12050                            }
12051                        } else if (rawValue.y !== undefined) {
12052                            return this.getRightValue(rawValue.y);
12053                        }
12054                    }
12055
12056                    // Value is good, return it
12057                    return rawValue;
12058                },
12059
12060                _convertTicksToLabels: function (ticks) {
12061                    var me = this;
12062                    var labels, i, ilen;
12063
12064                    me.ticks = ticks.map(function (tick) {
12065                        return tick.value;
12066                    });
12067
12068                    me.beforeTickToLabelConversion();
12069
12070                    // New implementations should return the formatted tick labels but for BACKWARD
12071                    // COMPAT, we still support no return (`this.ticks` internally changed by calling
12072                    // this method and supposed to contain only string values).
12073                    labels = me.convertTicksToLabels(ticks) || me.ticks;
12074
12075                    me.afterTickToLabelConversion();
12076
12077                    // BACKWARD COMPAT: synchronize `_ticks` with labels (so potentially `this.ticks`)
12078                    for (i = 0, ilen = ticks.length; i < ilen; ++i) {
12079                        ticks[i].label = labels[i];
12080                    }
12081
12082                    return labels;
12083                },
12084
12085                /**
12086                 * @private
12087                 */
12088                _getLabelSizes: function () {
12089                    var me = this;
12090                    var labelSizes = me._labelSizes;
12091
12092                    if (!labelSizes) {
12093                        me._labelSizes = labelSizes = computeLabelSizes(me.ctx, parseTickFontOptions(me.options.ticks), me.getTicks(), me.longestTextCache);
12094                        me.longestLabelWidth = labelSizes.widest.width;
12095                    }
12096
12097                    return labelSizes;
12098                },
12099
12100                /**
12101                 * @private
12102                 */
12103                _parseValue: function (value) {
12104                    var start, end, min, max;
12105
12106                    if (isArray(value)) {
12107                        start = +this.getRightValue(value[0]);
12108                        end = +this.getRightValue(value[1]);
12109                        min = Math.min(start, end);
12110                        max = Math.max(start, end);
12111                    } else {
12112                        value = +this.getRightValue(value);
12113                        start = undefined;
12114                        end = value;
12115                        min = value;
12116                        max = value;
12117                    }
12118
12119                    return {
12120                        min: min,
12121                        max: max,
12122                        start: start,
12123                        end: end
12124                    };
12125                },
12126
12127                /**
12128                 * @private
12129                 */
12130                _getScaleLabel: function (rawValue) {
12131                    var v = this._parseValue(rawValue);
12132                    if (v.start !== undefined) {
12133                        return '[' + v.start + ', ' + v.end + ']';
12134                    }
12135
12136                    return +this.getRightValue(rawValue);
12137                },
12138
12139                /**
12140                 * Used to get the value to display in the tooltip for the data at the given index
12141                 * @param index
12142                 * @param datasetIndex
12143                 */
12144                getLabelForIndex: helpers$1.noop,
12145
12146                /**
12147                 * Returns the location of the given data point. Value can either be an index or a numerical value
12148                 * The coordinate (0, 0) is at the upper-left corner of the canvas
12149                 * @param value
12150                 * @param index
12151                 * @param datasetIndex
12152                 */
12153                getPixelForValue: helpers$1.noop,
12154
12155                /**
12156                 * Used to get the data value from a given pixel. This is the inverse of getPixelForValue
12157                 * The coordinate (0, 0) is at the upper-left corner of the canvas
12158                 * @param pixel
12159                 */
12160                getValueForPixel: helpers$1.noop,
12161
12162                /**
12163                 * Returns the location of the tick at the given index
12164                 * The coordinate (0, 0) is at the upper-left corner of the canvas
12165                 */
12166                getPixelForTick: function (index) {
12167                    var me = this;
12168                    var offset = me.options.offset;
12169                    var numTicks = me._ticks.length;
12170                    var tickWidth = 1 / Math.max(numTicks - (offset ? 0 : 1), 1);
12171
12172                    return index < 0 || index > numTicks - 1
12173                        ? null
12174                        : me.getPixelForDecimal(index * tickWidth + (offset ? tickWidth / 2 : 0));
12175                },
12176
12177                /**
12178                 * Utility for getting the pixel location of a percentage of scale
12179                 * The coordinate (0, 0) is at the upper-left corner of the canvas
12180                 */
12181                getPixelForDecimal: function (decimal) {
12182                    var me = this;
12183
12184                    if (me._reversePixels) {
12185                        decimal = 1 - decimal;
12186                    }
12187
12188                    return me._startPixel + decimal * me._length;
12189                },
12190
12191                getDecimalForPixel: function (pixel) {
12192                    var decimal = (pixel - this._startPixel) / this._length;
12193                    return this._reversePixels ? 1 - decimal : decimal;
12194                },
12195
12196                /**
12197                 * Returns the pixel for the minimum chart value
12198                 * The coordinate (0, 0) is at the upper-left corner of the canvas
12199                 */
12200                getBasePixel: function () {
12201                    return this.getPixelForValue(this.getBaseValue());
12202                },
12203
12204                getBaseValue: function () {
12205                    var me = this;
12206                    var min = me.min;
12207                    var max = me.max;
12208
12209                    return me.beginAtZero ? 0 :
12210                        min < 0 && max < 0 ? max :
12211                            min > 0 && max > 0 ? min :
12212                                0;
12213                },
12214
12215                /**
12216                 * Returns a subset of ticks to be plotted to avoid overlapping labels.
12217                 * @private
12218                 */
12219                _autoSkip: function (ticks) {
12220                    var me = this;
12221                    var tickOpts = me.options.ticks;
12222                    var axisLength = me._length;
12223                    var ticksLimit = tickOpts.maxTicksLimit || axisLength / me._tickSize() + 1;
12224                    var majorIndices = tickOpts.major.enabled ? getMajorIndices(ticks) : [];
12225                    var numMajorIndices = majorIndices.length;
12226                    var first = majorIndices[0];
12227                    var last = majorIndices[numMajorIndices - 1];
12228                    var i, ilen, spacing, avgMajorSpacing;
12229
12230                    // If there are too many major ticks to display them all
12231                    if (numMajorIndices > ticksLimit) {
12232                        skipMajors(ticks, majorIndices, numMajorIndices / ticksLimit);
12233                        return nonSkipped(ticks);
12234                    }
12235
12236                    spacing = calculateSpacing(majorIndices, ticks, axisLength, ticksLimit);
12237
12238                    if (numMajorIndices > 0) {
12239                        for (i = 0, ilen = numMajorIndices - 1; i < ilen; i++) {
12240                            skip(ticks, spacing, majorIndices[i], majorIndices[i + 1]);
12241                        }
12242                        avgMajorSpacing = numMajorIndices > 1 ? (last - first) / (numMajorIndices - 1) : null;
12243                        skip(ticks, spacing, helpers$1.isNullOrUndef(avgMajorSpacing) ? 0 : first - avgMajorSpacing, first);
12244                        skip(ticks, spacing, last, helpers$1.isNullOrUndef(avgMajorSpacing) ? ticks.length : last + avgMajorSpacing);
12245                        return nonSkipped(ticks);
12246                    }
12247                    skip(ticks, spacing);
12248                    return nonSkipped(ticks);
12249                },
12250
12251                /**
12252                 * @private
12253                 */
12254                _tickSize: function () {
12255                    var me = this;
12256                    var optionTicks = me.options.ticks;
12257
12258                    // Calculate space needed by label in axis direction.
12259                    var rot = helpers$1.toRadians(me.labelRotation);
12260                    var cos = Math.abs(Math.cos(rot));
12261                    var sin = Math.abs(Math.sin(rot));
12262
12263                    var labelSizes = me._getLabelSizes();
12264                    var padding = optionTicks.autoSkipPadding || 0;
12265                    var w = labelSizes ? labelSizes.widest.width + padding : 0;
12266                    var h = labelSizes ? labelSizes.highest.height + padding : 0;
12267
12268                    // Calculate space needed for 1 tick in axis direction.
12269                    return me.isHorizontal()
12270                        ? h * cos > w * sin ? w / cos : h / sin
12271                        : h * sin < w * cos ? h / cos : w / sin;
12272                },
12273
12274                /**
12275                 * @private
12276                 */
12277                _isVisible: function () {
12278                    var me = this;
12279                    var chart = me.chart;
12280                    var display = me.options.display;
12281                    var i, ilen, meta;
12282
12283                    if (display !== 'auto') {
12284                        return !!display;
12285                    }
12286
12287                    // When 'auto', the scale is visible if at least one associated dataset is visible.
12288                    for (i = 0, ilen = chart.data.datasets.length; i < ilen; ++i) {
12289                        if (chart.isDatasetVisible(i)) {
12290                            meta = chart.getDatasetMeta(i);
12291                            if (meta.xAxisID === me.id || meta.yAxisID === me.id) {
12292                                return true;
12293                            }
12294                        }
12295                    }
12296
12297                    return false;
12298                },
12299
12300                /**
12301                 * @private
12302                 */
12303                _computeGridLineItems: function (chartArea) {
12304                    var me = this;
12305                    var chart = me.chart;
12306                    var options = me.options;
12307                    var gridLines = options.gridLines;
12308                    var position = options.position;
12309                    var offsetGridLines = gridLines.offsetGridLines;
12310                    var isHorizontal = me.isHorizontal();
12311                    var ticks = me._ticksToDraw;
12312                    var ticksLength = ticks.length + (offsetGridLines ? 1 : 0);
12313
12314                    var tl = getTickMarkLength(gridLines);
12315                    var items = [];
12316                    var axisWidth = gridLines.drawBorder ? valueAtIndexOrDefault(gridLines.lineWidth, 0, 0) : 0;
12317                    var axisHalfWidth = axisWidth / 2;
12318                    var alignPixel = helpers$1._alignPixel;
12319                    var alignBorderValue = function (pixel) {
12320                        return alignPixel(chart, pixel, axisWidth);
12321                    };
12322                    var borderValue, i, tick, lineValue, alignedLineValue;
12323                    var tx1, ty1, tx2, ty2, x1, y1, x2, y2, lineWidth, lineColor, borderDash, borderDashOffset;
12324
12325                    if (position === 'top') {
12326                        borderValue = alignBorderValue(me.bottom);
12327                        ty1 = me.bottom - tl;
12328                        ty2 = borderValue - axisHalfWidth;
12329                        y1 = alignBorderValue(chartArea.top) + axisHalfWidth;
12330                        y2 = chartArea.bottom;
12331                    } else if (position === 'bottom') {
12332                        borderValue = alignBorderValue(me.top);
12333                        y1 = chartArea.top;
12334                        y2 = alignBorderValue(chartArea.bottom) - axisHalfWidth;
12335                        ty1 = borderValue + axisHalfWidth;
12336                        ty2 = me.top + tl;
12337                    } else if (position === 'left') {
12338                        borderValue = alignBorderValue(me.right);
12339                        tx1 = me.right - tl;
12340                        tx2 = borderValue - axisHalfWidth;
12341                        x1 = alignBorderValue(chartArea.left) + axisHalfWidth;
12342                        x2 = chartArea.right;
12343                    } else {
12344                        borderValue = alignBorderValue(me.left);
12345                        x1 = chartArea.left;
12346                        x2 = alignBorderValue(chartArea.right) - axisHalfWidth;
12347                        tx1 = borderValue + axisHalfWidth;
12348                        tx2 = me.left + tl;
12349                    }
12350
12351                    for (i = 0; i < ticksLength; ++i) {
12352                        tick = ticks[i] || {};
12353
12354                        // autoskipper skipped this tick (#4635)
12355                        if (isNullOrUndef(tick.label) && i < ticks.length) {
12356                            continue;
12357                        }
12358
12359                        if (i === me.zeroLineIndex && options.offset === offsetGridLines) {
12360                            // Draw the first index specially
12361                            lineWidth = gridLines.zeroLineWidth;
12362                            lineColor = gridLines.zeroLineColor;
12363                            borderDash = gridLines.zeroLineBorderDash || [];
12364                            borderDashOffset = gridLines.zeroLineBorderDashOffset || 0.0;
12365                        } else {
12366                            lineWidth = valueAtIndexOrDefault(gridLines.lineWidth, i, 1);
12367                            lineColor = valueAtIndexOrDefault(gridLines.color, i, 'rgba(0,0,0,0.1)');
12368                            borderDash = gridLines.borderDash || [];
12369                            borderDashOffset = gridLines.borderDashOffset || 0.0;
12370                        }
12371
12372                        lineValue = getPixelForGridLine(me, tick._index || i, offsetGridLines);
12373
12374                        // Skip if the pixel is out of the range
12375                        if (lineValue === undefined) {
12376                            continue;
12377                        }
12378
12379                        alignedLineValue = alignPixel(chart, lineValue, lineWidth);
12380
12381                        if (isHorizontal) {
12382                            tx1 = tx2 = x1 = x2 = alignedLineValue;
12383                        } else {
12384                            ty1 = ty2 = y1 = y2 = alignedLineValue;
12385                        }
12386
12387                        items.push({
12388                            tx1: tx1,
12389                            ty1: ty1,
12390                            tx2: tx2,
12391                            ty2: ty2,
12392                            x1: x1,
12393                            y1: y1,
12394                            x2: x2,
12395                            y2: y2,
12396                            width: lineWidth,
12397                            color: lineColor,
12398                            borderDash: borderDash,
12399                            borderDashOffset: borderDashOffset,
12400                        });
12401                    }
12402
12403                    items.ticksLength = ticksLength;
12404                    items.borderValue = borderValue;
12405
12406                    return items;
12407                },
12408
12409                /**
12410                 * @private
12411                 */
12412                _computeLabelItems: function () {
12413                    var me = this;
12414                    var options = me.options;
12415                    var optionTicks = options.ticks;
12416                    var position = options.position;
12417                    var isMirrored = optionTicks.mirror;
12418                    var isHorizontal = me.isHorizontal();
12419                    var ticks = me._ticksToDraw;
12420                    var fonts = parseTickFontOptions(optionTicks);
12421                    var tickPadding = optionTicks.padding;
12422                    var tl = getTickMarkLength(options.gridLines);
12423                    var rotation = -helpers$1.toRadians(me.labelRotation);
12424                    var items = [];
12425                    var i, ilen, tick, label, x, y, textAlign, pixel, font, lineHeight, lineCount, textOffset;
12426
12427                    if (position === 'top') {
12428                        y = me.bottom - tl - tickPadding;
12429                        textAlign = !rotation ? 'center' : 'left';
12430                    } else if (position === 'bottom') {
12431                        y = me.top + tl + tickPadding;
12432                        textAlign = !rotation ? 'center' : 'right';
12433                    } else if (position === 'left') {
12434                        x = me.right - (isMirrored ? 0 : tl) - tickPadding;
12435                        textAlign = isMirrored ? 'left' : 'right';
12436                    } else {
12437                        x = me.left + (isMirrored ? 0 : tl) + tickPadding;
12438                        textAlign = isMirrored ? 'right' : 'left';
12439                    }
12440
12441                    for (i = 0, ilen = ticks.length; i < ilen; ++i) {
12442                        tick = ticks[i];
12443                        label = tick.label;
12444
12445                        // autoskipper skipped this tick (#4635)
12446                        if (isNullOrUndef(label)) {
12447                            continue;
12448                        }
12449
12450                        pixel = me.getPixelForTick(tick._index || i) + optionTicks.labelOffset;
12451                        font = tick.major ? fonts.major : fonts.minor;
12452                        lineHeight = font.lineHeight;
12453                        lineCount = isArray(label) ? label.length : 1;
12454
12455                        if (isHorizontal) {
12456                            x = pixel;
12457                            textOffset = position === 'top'
12458                                ? ((!rotation ? 0.5 : 1) - lineCount) * lineHeight
12459                                : (!rotation ? 0.5 : 0) * lineHeight;
12460                        } else {
12461                            y = pixel;
12462                            textOffset = (1 - lineCount) * lineHeight / 2;
12463                        }
12464
12465                        items.push({
12466                            x: x,
12467                            y: y,
12468                            rotation: rotation,
12469                            label: label,
12470                            font: font,
12471                            textOffset: textOffset,
12472                            textAlign: textAlign
12473                        });
12474                    }
12475
12476                    return items;
12477                },
12478
12479                /**
12480                 * @private
12481                 */
12482                _drawGrid: function (chartArea) {
12483                    var me = this;
12484                    var gridLines = me.options.gridLines;
12485
12486                    if (!gridLines.display) {
12487                        return;
12488                    }
12489
12490                    var ctx = me.ctx;
12491                    var chart = me.chart;
12492                    var alignPixel = helpers$1._alignPixel;
12493                    var axisWidth = gridLines.drawBorder ? valueAtIndexOrDefault(gridLines.lineWidth, 0, 0) : 0;
12494                    var items = me._gridLineItems || (me._gridLineItems = me._computeGridLineItems(chartArea));
12495                    var width, color, i, ilen, item;
12496
12497                    for (i = 0, ilen = items.length; i < ilen; ++i) {
12498                        item = items[i];
12499                        width = item.width;
12500                        color = item.color;
12501
12502                        if (width && color) {
12503                            ctx.save();
12504                            ctx.lineWidth = width;
12505                            ctx.strokeStyle = color;
12506                            if (ctx.setLineDash) {
12507                                ctx.setLineDash(item.borderDash);
12508                                ctx.lineDashOffset = item.borderDashOffset;
12509                            }
12510
12511                            ctx.beginPath();
12512
12513                            if (gridLines.drawTicks) {
12514                                ctx.moveTo(item.tx1, item.ty1);
12515                                ctx.lineTo(item.tx2, item.ty2);
12516                            }
12517
12518                            if (gridLines.drawOnChartArea) {
12519                                ctx.moveTo(item.x1, item.y1);
12520                                ctx.lineTo(item.x2, item.y2);
12521                            }
12522
12523                            ctx.stroke();
12524                            ctx.restore();
12525                        }
12526                    }
12527
12528                    if (axisWidth) {
12529                        // Draw the line at the edge of the axis
12530                        var firstLineWidth = axisWidth;
12531                        var lastLineWidth = valueAtIndexOrDefault(gridLines.lineWidth, items.ticksLength - 1, 1);
12532                        var borderValue = items.borderValue;
12533                        var x1, x2, y1, y2;
12534
12535                        if (me.isHorizontal()) {
12536                            x1 = alignPixel(chart, me.left, firstLineWidth) - firstLineWidth / 2;
12537                            x2 = alignPixel(chart, me.right, lastLineWidth) + lastLineWidth / 2;
12538                            y1 = y2 = borderValue;
12539                        } else {
12540                            y1 = alignPixel(chart, me.top, firstLineWidth) - firstLineWidth / 2;
12541                            y2 = alignPixel(chart, me.bottom, lastLineWidth) + lastLineWidth / 2;
12542                            x1 = x2 = borderValue;
12543                        }
12544
12545                        ctx.lineWidth = axisWidth;
12546                        ctx.strokeStyle = valueAtIndexOrDefault(gridLines.color, 0);
12547                        ctx.beginPath();
12548                        ctx.moveTo(x1, y1);
12549                        ctx.lineTo(x2, y2);
12550                        ctx.stroke();
12551                    }
12552                },
12553
12554                /**
12555                 * @private
12556                 */
12557                _drawLabels: function () {
12558                    var me = this;
12559                    var optionTicks = me.options.ticks;
12560
12561                    if (!optionTicks.display) {
12562                        return;
12563                    }
12564
12565                    var ctx = me.ctx;
12566                    var items = me._labelItems || (me._labelItems = me._computeLabelItems());
12567                    var i, j, ilen, jlen, item, tickFont, label, y;
12568
12569                    for (i = 0, ilen = items.length; i < ilen; ++i) {
12570                        item = items[i];
12571                        tickFont = item.font;
12572
12573                        // Make sure we draw text in the correct color and font
12574                        ctx.save();
12575                        ctx.translate(item.x, item.y);
12576                        ctx.rotate(item.rotation);
12577                        ctx.font = tickFont.string;
12578                        ctx.fillStyle = tickFont.color;
12579                        ctx.textBaseline = 'middle';
12580                        ctx.textAlign = item.textAlign;
12581
12582                        label = item.label;
12583                        y = item.textOffset;
12584                        if (isArray(label)) {
12585                            for (j = 0, jlen = label.length; j < jlen; ++j) {
12586                                // We just make sure the multiline element is a string here..
12587                                ctx.fillText('' + label[j], 0, y);
12588                                y += tickFont.lineHeight;
12589                            }
12590                        } else {
12591                            ctx.fillText(label, 0, y);
12592                        }
12593                        ctx.restore();
12594                    }
12595                },
12596
12597                /**
12598                 * @private
12599                 */
12600                _drawTitle: function () {
12601                    var me = this;
12602                    var ctx = me.ctx;
12603                    var options = me.options;
12604                    var scaleLabel = options.scaleLabel;
12605
12606                    if (!scaleLabel.display) {
12607                        return;
12608                    }
12609
12610                    var scaleLabelFontColor = valueOrDefault$a(scaleLabel.fontColor, core_defaults.global.defaultFontColor);
12611                    var scaleLabelFont = helpers$1.options._parseFont(scaleLabel);
12612                    var scaleLabelPadding = helpers$1.options.toPadding(scaleLabel.padding);
12613                    var halfLineHeight = scaleLabelFont.lineHeight / 2;
12614                    var position = options.position;
12615                    var rotation = 0;
12616                    var scaleLabelX, scaleLabelY;
12617
12618                    if (me.isHorizontal()) {
12619                        scaleLabelX = me.left + me.width / 2; // midpoint of the width
12620                        scaleLabelY = position === 'bottom'
12621                            ? me.bottom - halfLineHeight - scaleLabelPadding.bottom
12622                            : me.top + halfLineHeight + scaleLabelPadding.top;
12623                    } else {
12624                        var isLeft = position === 'left';
12625                        scaleLabelX = isLeft
12626                            ? me.left + halfLineHeight + scaleLabelPadding.top
12627                            : me.right - halfLineHeight - scaleLabelPadding.top;
12628                        scaleLabelY = me.top + me.height / 2;
12629                        rotation = isLeft ? -0.5 * Math.PI : 0.5 * Math.PI;
12630                    }
12631
12632                    ctx.save();
12633                    ctx.translate(scaleLabelX, scaleLabelY);
12634                    ctx.rotate(rotation);
12635                    ctx.textAlign = 'center';
12636                    ctx.textBaseline = 'middle';
12637                    ctx.fillStyle = scaleLabelFontColor; // render in correct colour
12638                    ctx.font = scaleLabelFont.string;
12639                    ctx.fillText(scaleLabel.labelString, 0, 0);
12640                    ctx.restore();
12641                },
12642
12643                draw: function (chartArea) {
12644                    var me = this;
12645
12646                    if (!me._isVisible()) {
12647                        return;
12648                    }
12649
12650                    me._drawGrid(chartArea);
12651                    me._drawTitle();
12652                    me._drawLabels();
12653                },
12654
12655                /**
12656                 * @private
12657                 */
12658                _layers: function () {
12659                    var me = this;
12660                    var opts = me.options;
12661                    var tz = opts.ticks && opts.ticks.z || 0;
12662                    var gz = opts.gridLines && opts.gridLines.z || 0;
12663
12664                    if (!me._isVisible() || tz === gz || me.draw !== me._draw) {
12665                        // backward compatibility: draw has been overridden by custom scale
12666                        return [{
12667                            z: tz,
12668                            draw: function () {
12669                                me.draw.apply(me, arguments);
12670                            }
12671                        }];
12672                    }
12673
12674                    return [{
12675                        z: gz,
12676                        draw: function () {
12677                            me._drawGrid.apply(me, arguments);
12678                            me._drawTitle.apply(me, arguments);
12679                        }
12680                    }, {
12681                        z: tz,
12682                        draw: function () {
12683                            me._drawLabels.apply(me, arguments);
12684                        }
12685                    }];
12686                },
12687
12688                /**
12689                 * @private
12690                 */
12691                _getMatchingVisibleMetas: function (type) {
12692                    var me = this;
12693                    var isHorizontal = me.isHorizontal();
12694                    return me.chart._getSortedVisibleDatasetMetas()
12695                        .filter(function (meta) {
12696                            return (!type || meta.type === type)
12697                                && (isHorizontal ? meta.xAxisID === me.id : meta.yAxisID === me.id);
12698                        });
12699                }
12700            });
12701
12702            Scale.prototype._draw = Scale.prototype.draw;
12703
12704            var core_scale = Scale;
12705
12706            var isNullOrUndef$1 = helpers$1.isNullOrUndef;
12707
12708            var defaultConfig = {
12709                position: 'bottom'
12710            };
12711
12712            var scale_category = core_scale.extend({
12713                determineDataLimits: function () {
12714                    var me = this;
12715                    var labels = me._getLabels();
12716                    var ticksOpts = me.options.ticks;
12717                    var min = ticksOpts.min;
12718                    var max = ticksOpts.max;
12719                    var minIndex = 0;
12720                    var maxIndex = labels.length - 1;
12721                    var findIndex;
12722
12723                    if (min !== undefined) {
12724                        // user specified min value
12725                        findIndex = labels.indexOf(min);
12726                        if (findIndex >= 0) {
12727                            minIndex = findIndex;
12728                        }
12729                    }
12730
12731                    if (max !== undefined) {
12732                        // user specified max value
12733                        findIndex = labels.indexOf(max);
12734                        if (findIndex >= 0) {
12735                            maxIndex = findIndex;
12736                        }
12737                    }
12738
12739                    me.minIndex = minIndex;
12740                    me.maxIndex = maxIndex;
12741                    me.min = labels[minIndex];
12742                    me.max = labels[maxIndex];
12743                },
12744
12745                buildTicks: function () {
12746                    var me = this;
12747                    var labels = me._getLabels();
12748                    var minIndex = me.minIndex;
12749                    var maxIndex = me.maxIndex;
12750
12751                    // If we are viewing some subset of labels, slice the original array
12752                    me.ticks = (minIndex === 0 && maxIndex === labels.length - 1) ? labels : labels.slice(minIndex, maxIndex + 1);
12753                },
12754
12755                getLabelForIndex: function (index, datasetIndex) {
12756                    var me = this;
12757                    var chart = me.chart;
12758
12759                    if (chart.getDatasetMeta(datasetIndex).controller._getValueScaleId() === me.id) {
12760                        return me.getRightValue(chart.data.datasets[datasetIndex].data[index]);
12761                    }
12762
12763                    return me._getLabels()[index];
12764                },
12765
12766                _configure: function () {
12767                    var me = this;
12768                    var offset = me.options.offset;
12769                    var ticks = me.ticks;
12770
12771                    core_scale.prototype._configure.call(me);
12772
12773                    if (!me.isHorizontal()) {
12774                        // For backward compatibility, vertical category scale reverse is inverted.
12775                        me._reversePixels = !me._reversePixels;
12776                    }
12777
12778                    if (!ticks) {
12779                        return;
12780                    }
12781
12782                    me._startValue = me.minIndex - (offset ? 0.5 : 0);
12783                    me._valueRange = Math.max(ticks.length - (offset ? 0 : 1), 1);
12784                },
12785
12786                // Used to get data value locations.  Value can either be an index or a numerical value
12787                getPixelForValue: function (value, index, datasetIndex) {
12788                    var me = this;
12789                    var valueCategory, labels, idx;
12790
12791                    if (!isNullOrUndef$1(index) && !isNullOrUndef$1(datasetIndex)) {
12792                        value = me.chart.data.datasets[datasetIndex].data[index];
12793                    }
12794
12795                    // If value is a data object, then index is the index in the data array,
12796                    // not the index of the scale. We need to change that.
12797                    if (!isNullOrUndef$1(value)) {
12798                        valueCategory = me.isHorizontal() ? value.x : value.y;
12799                    }
12800                    if (valueCategory !== undefined || (value !== undefined && isNaN(index))) {
12801                        labels = me._getLabels();
12802                        value = helpers$1.valueOrDefault(valueCategory, value);
12803                        idx = labels.indexOf(value);
12804                        index = idx !== -1 ? idx : index;
12805                        if (isNaN(index)) {
12806                            index = value;
12807                        }
12808                    }
12809                    return me.getPixelForDecimal((index - me._startValue) / me._valueRange);
12810                },
12811
12812                getPixelForTick: function (index) {
12813                    var ticks = this.ticks;
12814                    return index < 0 || index > ticks.length - 1
12815                        ? null
12816                        : this.getPixelForValue(ticks[index], index + this.minIndex);
12817                },
12818
12819                getValueForPixel: function (pixel) {
12820                    var me = this;
12821                    var value = Math.round(me._startValue + me.getDecimalForPixel(pixel) * me._valueRange);
12822                    return Math.min(Math.max(value, 0), me.ticks.length - 1);
12823                },
12824
12825                getBasePixel: function () {
12826                    return this.bottom;
12827                }
12828            });
12829
12830// INTERNAL: static default options, registered in src/index.js
12831            var _defaults = defaultConfig;
12832            scale_category._defaults = _defaults;
12833
12834            var noop = helpers$1.noop;
12835            var isNullOrUndef$2 = helpers$1.isNullOrUndef;
12836
12837            /**
12838             * Generate a set of linear ticks
12839             * @param generationOptions the options used to generate the ticks
12840             * @param dataRange the range of the data
12841             * @returns {number[]} array of tick values
12842             */
12843            function generateTicks(generationOptions, dataRange) {
12844                var ticks = [];
12845                // To get a "nice" value for the tick spacing, we will use the appropriately named
12846                // "nice number" algorithm. See https://stackoverflow.com/questions/8506881/nice-label-algorithm-for-charts-with-minimum-ticks
12847                // for details.
12848
12849                var MIN_SPACING = 1e-14;
12850                var stepSize = generationOptions.stepSize;
12851                var unit = stepSize || 1;
12852                var maxNumSpaces = generationOptions.maxTicks - 1;
12853                var min = generationOptions.min;
12854                var max = generationOptions.max;
12855                var precision = generationOptions.precision;
12856                var rmin = dataRange.min;
12857                var rmax = dataRange.max;
12858                var spacing = helpers$1.niceNum((rmax - rmin) / maxNumSpaces / unit) * unit;
12859                var factor, niceMin, niceMax, numSpaces;
12860
12861                // Beyond MIN_SPACING floating point numbers being to lose precision
12862                // such that we can't do the math necessary to generate ticks
12863                if (spacing < MIN_SPACING && isNullOrUndef$2(min) && isNullOrUndef$2(max)) {
12864                    return [rmin, rmax];
12865                }
12866
12867                numSpaces = Math.ceil(rmax / spacing) - Math.floor(rmin / spacing);
12868                if (numSpaces > maxNumSpaces) {
12869                    // If the calculated num of spaces exceeds maxNumSpaces, recalculate it
12870                    spacing = helpers$1.niceNum(numSpaces * spacing / maxNumSpaces / unit) * unit;
12871                }
12872
12873                if (stepSize || isNullOrUndef$2(precision)) {
12874                    // If a precision is not specified, calculate factor based on spacing
12875                    factor = Math.pow(10, helpers$1._decimalPlaces(spacing));
12876                } else {
12877                    // If the user specified a precision, round to that number of decimal places
12878                    factor = Math.pow(10, precision);
12879                    spacing = Math.ceil(spacing * factor) / factor;
12880                }
12881
12882                niceMin = Math.floor(rmin / spacing) * spacing;
12883                niceMax = Math.ceil(rmax / spacing) * spacing;
12884
12885                // If min, max and stepSize is set and they make an evenly spaced scale use it.
12886                if (stepSize) {
12887                    // If very close to our whole number, use it.
12888                    if (!isNullOrUndef$2(min) && helpers$1.almostWhole(min / spacing, spacing / 1000)) {
12889                        niceMin = min;
12890                    }
12891                    if (!isNullOrUndef$2(max) && helpers$1.almostWhole(max / spacing, spacing / 1000)) {
12892                        niceMax = max;
12893                    }
12894                }
12895
12896                numSpaces = (niceMax - niceMin) / spacing;
12897                // If very close to our rounded value, use it.
12898                if (helpers$1.almostEquals(numSpaces, Math.round(numSpaces), spacing / 1000)) {
12899                    numSpaces = Math.round(numSpaces);
12900                } else {
12901                    numSpaces = Math.ceil(numSpaces);
12902                }
12903
12904                niceMin = Math.round(niceMin * factor) / factor;
12905                niceMax = Math.round(niceMax * factor) / factor;
12906                ticks.push(isNullOrUndef$2(min) ? niceMin : min);
12907                for (var j = 1; j < numSpaces; ++j) {
12908                    ticks.push(Math.round((niceMin + j * spacing) * factor) / factor);
12909                }
12910                ticks.push(isNullOrUndef$2(max) ? niceMax : max);
12911
12912                return ticks;
12913            }
12914
12915            var scale_linearbase = core_scale.extend({
12916                getRightValue: function (value) {
12917                    if (typeof value === 'string') {
12918                        return +value;
12919                    }
12920                    return core_scale.prototype.getRightValue.call(this, value);
12921                },
12922
12923                handleTickRangeOptions: function () {
12924                    var me = this;
12925                    var opts = me.options;
12926                    var tickOpts = opts.ticks;
12927
12928                    // If we are forcing it to begin at 0, but 0 will already be rendered on the chart,
12929                    // do nothing since that would make the chart weird. If the user really wants a weird chart
12930                    // axis, they can manually override it
12931                    if (tickOpts.beginAtZero) {
12932                        var minSign = helpers$1.sign(me.min);
12933                        var maxSign = helpers$1.sign(me.max);
12934
12935                        if (minSign < 0 && maxSign < 0) {
12936                            // move the top up to 0
12937                            me.max = 0;
12938                        } else if (minSign > 0 && maxSign > 0) {
12939                            // move the bottom down to 0
12940                            me.min = 0;
12941                        }
12942                    }
12943
12944                    var setMin = tickOpts.min !== undefined || tickOpts.suggestedMin !== undefined;
12945                    var setMax = tickOpts.max !== undefined || tickOpts.suggestedMax !== undefined;
12946
12947                    if (tickOpts.min !== undefined) {
12948                        me.min = tickOpts.min;
12949                    } else if (tickOpts.suggestedMin !== undefined) {
12950                        if (me.min === null) {
12951                            me.min = tickOpts.suggestedMin;
12952                        } else {
12953                            me.min = Math.min(me.min, tickOpts.suggestedMin);
12954                        }
12955                    }
12956
12957                    if (tickOpts.max !== undefined) {
12958                        me.max = tickOpts.max;
12959                    } else if (tickOpts.suggestedMax !== undefined) {
12960                        if (me.max === null) {
12961                            me.max = tickOpts.suggestedMax;
12962                        } else {
12963                            me.max = Math.max(me.max, tickOpts.suggestedMax);
12964                        }
12965                    }
12966
12967                    if (setMin !== setMax) {
12968                        // We set the min or the max but not both.
12969                        // So ensure that our range is good
12970                        // Inverted or 0 length range can happen when
12971                        // ticks.min is set, and no datasets are visible
12972                        if (me.min >= me.max) {
12973                            if (setMin) {
12974                                me.max = me.min + 1;
12975                            } else {
12976                                me.min = me.max - 1;
12977                            }
12978                        }
12979                    }
12980
12981                    if (me.min === me.max) {
12982                        me.max++;
12983
12984                        if (!tickOpts.beginAtZero) {
12985                            me.min--;
12986                        }
12987                    }
12988                },
12989
12990                getTickLimit: function () {
12991                    var me = this;
12992                    var tickOpts = me.options.ticks;
12993                    var stepSize = tickOpts.stepSize;
12994                    var maxTicksLimit = tickOpts.maxTicksLimit;
12995                    var maxTicks;
12996
12997                    if (stepSize) {
12998                        maxTicks = Math.ceil(me.max / stepSize) - Math.floor(me.min / stepSize) + 1;
12999                    } else {
13000                        maxTicks = me._computeTickLimit();
13001                        maxTicksLimit = maxTicksLimit || 11;
13002                    }
13003
13004                    if (maxTicksLimit) {
13005                        maxTicks = Math.min(maxTicksLimit, maxTicks);
13006                    }
13007
13008                    return maxTicks;
13009                },
13010
13011                _computeTickLimit: function () {
13012                    return Number.POSITIVE_INFINITY;
13013                },
13014
13015                handleDirectionalChanges: noop,
13016
13017                buildTicks: function () {
13018                    var me = this;
13019                    var opts = me.options;
13020                    var tickOpts = opts.ticks;
13021
13022                    // Figure out what the max number of ticks we can support it is based on the size of
13023                    // the axis area. For now, we say that the minimum tick spacing in pixels must be 40
13024                    // We also limit the maximum number of ticks to 11 which gives a nice 10 squares on
13025                    // the graph. Make sure we always have at least 2 ticks
13026                    var maxTicks = me.getTickLimit();
13027                    maxTicks = Math.max(2, maxTicks);
13028
13029                    var numericGeneratorOptions = {
13030                        maxTicks: maxTicks,
13031                        min: tickOpts.min,
13032                        max: tickOpts.max,
13033                        precision: tickOpts.precision,
13034                        stepSize: helpers$1.valueOrDefault(tickOpts.fixedStepSize, tickOpts.stepSize)
13035                    };
13036                    var ticks = me.ticks = generateTicks(numericGeneratorOptions, me);
13037
13038                    me.handleDirectionalChanges();
13039
13040                    // At this point, we need to update our max and min given the tick values since we have expanded the
13041                    // range of the scale
13042                    me.max = helpers$1.max(ticks);
13043                    me.min = helpers$1.min(ticks);
13044
13045                    if (tickOpts.reverse) {
13046                        ticks.reverse();
13047
13048                        me.start = me.max;
13049                        me.end = me.min;
13050                    } else {
13051                        me.start = me.min;
13052                        me.end = me.max;
13053                    }
13054                },
13055
13056                convertTicksToLabels: function () {
13057                    var me = this;
13058                    me.ticksAsNumbers = me.ticks.slice();
13059                    me.zeroLineIndex = me.ticks.indexOf(0);
13060
13061                    core_scale.prototype.convertTicksToLabels.call(me);
13062                },
13063
13064                _configure: function () {
13065                    var me = this;
13066                    var ticks = me.getTicks();
13067                    var start = me.min;
13068                    var end = me.max;
13069                    var offset;
13070
13071                    core_scale.prototype._configure.call(me);
13072
13073                    if (me.options.offset && ticks.length) {
13074                        offset = (end - start) / Math.max(ticks.length - 1, 1) / 2;
13075                        start -= offset;
13076                        end += offset;
13077                    }
13078                    me._startValue = start;
13079                    me._endValue = end;
13080                    me._valueRange = end - start;
13081                }
13082            });
13083
13084            var defaultConfig$1 = {
13085                position: 'left',
13086                ticks: {
13087                    callback: core_ticks.formatters.linear
13088                }
13089            };
13090
13091            var DEFAULT_MIN = 0;
13092            var DEFAULT_MAX = 1;
13093
13094            function getOrCreateStack(stacks, stacked, meta) {
13095                var key = [
13096                    meta.type,
13097                    // we have a separate stack for stack=undefined datasets when the opts.stacked is undefined
13098                    stacked === undefined && meta.stack === undefined ? meta.index : '',
13099                    meta.stack
13100                ].join('.');
13101
13102                if (stacks[key] === undefined) {
13103                    stacks[key] = {
13104                        pos: [],
13105                        neg: []
13106                    };
13107                }
13108
13109                return stacks[key];
13110            }
13111
13112            function stackData(scale, stacks, meta, data) {
13113                var opts = scale.options;
13114                var stacked = opts.stacked;
13115                var stack = getOrCreateStack(stacks, stacked, meta);
13116                var pos = stack.pos;
13117                var neg = stack.neg;
13118                var ilen = data.length;
13119                var i, value;
13120
13121                for (i = 0; i < ilen; ++i) {
13122                    value = scale._parseValue(data[i]);
13123                    if (isNaN(value.min) || isNaN(value.max) || meta.data[i].hidden) {
13124                        continue;
13125                    }
13126
13127                    pos[i] = pos[i] || 0;
13128                    neg[i] = neg[i] || 0;
13129
13130                    if (opts.relativePoints) {
13131                        pos[i] = 100;
13132                    } else if (value.min < 0 || value.max < 0) {
13133                        neg[i] += value.min;
13134                    } else {
13135                        pos[i] += value.max;
13136                    }
13137                }
13138            }
13139
13140            function updateMinMax(scale, meta, data) {
13141                var ilen = data.length;
13142                var i, value;
13143
13144                for (i = 0; i < ilen; ++i) {
13145                    value = scale._parseValue(data[i]);
13146                    if (isNaN(value.min) || isNaN(value.max) || meta.data[i].hidden) {
13147                        continue;
13148                    }
13149
13150                    scale.min = Math.min(scale.min, value.min);
13151                    scale.max = Math.max(scale.max, value.max);
13152                }
13153            }
13154
13155            var scale_linear = scale_linearbase.extend({
13156                determineDataLimits: function () {
13157                    var me = this;
13158                    var opts = me.options;
13159                    var chart = me.chart;
13160                    var datasets = chart.data.datasets;
13161                    var metasets = me._getMatchingVisibleMetas();
13162                    var hasStacks = opts.stacked;
13163                    var stacks = {};
13164                    var ilen = metasets.length;
13165                    var i, meta, data, values;
13166
13167                    me.min = Number.POSITIVE_INFINITY;
13168                    me.max = Number.NEGATIVE_INFINITY;
13169
13170                    if (hasStacks === undefined) {
13171                        for (i = 0; !hasStacks && i < ilen; ++i) {
13172                            meta = metasets[i];
13173                            hasStacks = meta.stack !== undefined;
13174                        }
13175                    }
13176
13177                    for (i = 0; i < ilen; ++i) {
13178                        meta = metasets[i];
13179                        data = datasets[meta.index].data;
13180                        if (hasStacks) {
13181                            stackData(me, stacks, meta, data);
13182                        } else {
13183                            updateMinMax(me, meta, data);
13184                        }
13185                    }
13186
13187                    helpers$1.each(stacks, function (stackValues) {
13188                        values = stackValues.pos.concat(stackValues.neg);
13189                        me.min = Math.min(me.min, helpers$1.min(values));
13190                        me.max = Math.max(me.max, helpers$1.max(values));
13191                    });
13192
13193                    me.min = helpers$1.isFinite(me.min) && !isNaN(me.min) ? me.min : DEFAULT_MIN;
13194                    me.max = helpers$1.isFinite(me.max) && !isNaN(me.max) ? me.max : DEFAULT_MAX;
13195
13196                    // Common base implementation to handle ticks.min, ticks.max, ticks.beginAtZero
13197                    me.handleTickRangeOptions();
13198                },
13199
13200                // Returns the maximum number of ticks based on the scale dimension
13201                _computeTickLimit: function () {
13202                    var me = this;
13203                    var tickFont;
13204
13205                    if (me.isHorizontal()) {
13206                        return Math.ceil(me.width / 40);
13207                    }
13208                    tickFont = helpers$1.options._parseFont(me.options.ticks);
13209                    return Math.ceil(me.height / tickFont.lineHeight);
13210                },
13211
13212                // Called after the ticks are built. We need
13213                handleDirectionalChanges: function () {
13214                    if (!this.isHorizontal()) {
13215                        // We are in a vertical orientation. The top value is the highest. So reverse the array
13216                        this.ticks.reverse();
13217                    }
13218                },
13219
13220                getLabelForIndex: function (index, datasetIndex) {
13221                    return this._getScaleLabel(this.chart.data.datasets[datasetIndex].data[index]);
13222                },
13223
13224                // Utils
13225                getPixelForValue: function (value) {
13226                    var me = this;
13227                    return me.getPixelForDecimal((+me.getRightValue(value) - me._startValue) / me._valueRange);
13228                },
13229
13230                getValueForPixel: function (pixel) {
13231                    return this._startValue + this.getDecimalForPixel(pixel) * this._valueRange;
13232                },
13233
13234                getPixelForTick: function (index) {
13235                    var ticks = this.ticksAsNumbers;
13236                    if (index < 0 || index > ticks.length - 1) {
13237                        return null;
13238                    }
13239                    return this.getPixelForValue(ticks[index]);
13240                }
13241            });
13242
13243// INTERNAL: static default options, registered in src/index.js
13244            var _defaults$1 = defaultConfig$1;
13245            scale_linear._defaults = _defaults$1;
13246
13247            var valueOrDefault$b = helpers$1.valueOrDefault;
13248            var log10 = helpers$1.math.log10;
13249
13250            /**
13251             * Generate a set of logarithmic ticks
13252             * @param generationOptions the options used to generate the ticks
13253             * @param dataRange the range of the data
13254             * @returns {number[]} array of tick values
13255             */
13256            function generateTicks$1(generationOptions, dataRange) {
13257                var ticks = [];
13258
13259                var tickVal = valueOrDefault$b(generationOptions.min, Math.pow(10, Math.floor(log10(dataRange.min))));
13260
13261                var endExp = Math.floor(log10(dataRange.max));
13262                var endSignificand = Math.ceil(dataRange.max / Math.pow(10, endExp));
13263                var exp, significand;
13264
13265                if (tickVal === 0) {
13266                    exp = Math.floor(log10(dataRange.minNotZero));
13267                    significand = Math.floor(dataRange.minNotZero / Math.pow(10, exp));
13268
13269                    ticks.push(tickVal);
13270                    tickVal = significand * Math.pow(10, exp);
13271                } else {
13272                    exp = Math.floor(log10(tickVal));
13273                    significand = Math.floor(tickVal / Math.pow(10, exp));
13274                }
13275                var precision = exp < 0 ? Math.pow(10, Math.abs(exp)) : 1;
13276
13277                do {
13278                    ticks.push(tickVal);
13279
13280                    ++significand;
13281                    if (significand === 10) {
13282                        significand = 1;
13283                        ++exp;
13284                        precision = exp >= 0 ? 1 : precision;
13285                    }
13286
13287                    tickVal = Math.round(significand * Math.pow(10, exp) * precision) / precision;
13288                } while (exp < endExp || (exp === endExp && significand < endSignificand));
13289
13290                var lastTick = valueOrDefault$b(generationOptions.max, tickVal);
13291                ticks.push(lastTick);
13292
13293                return ticks;
13294            }
13295
13296            var defaultConfig$2 = {
13297                position: 'left',
13298
13299                // label settings
13300                ticks: {
13301                    callback: core_ticks.formatters.logarithmic
13302                }
13303            };
13304
13305// TODO(v3): change this to positiveOrDefault
13306            function nonNegativeOrDefault(value, defaultValue) {
13307                return helpers$1.isFinite(value) && value >= 0 ? value : defaultValue;
13308            }
13309
13310            var scale_logarithmic = core_scale.extend({
13311                determineDataLimits: function () {
13312                    var me = this;
13313                    var opts = me.options;
13314                    var chart = me.chart;
13315                    var datasets = chart.data.datasets;
13316                    var isHorizontal = me.isHorizontal();
13317
13318                    function IDMatches(meta) {
13319                        return isHorizontal ? meta.xAxisID === me.id : meta.yAxisID === me.id;
13320                    }
13321
13322                    var datasetIndex, meta, value, data, i, ilen;
13323
13324                    // Calculate Range
13325                    me.min = Number.POSITIVE_INFINITY;
13326                    me.max = Number.NEGATIVE_INFINITY;
13327                    me.minNotZero = Number.POSITIVE_INFINITY;
13328
13329                    var hasStacks = opts.stacked;
13330                    if (hasStacks === undefined) {
13331                        for (datasetIndex = 0; datasetIndex < datasets.length; datasetIndex++) {
13332                            meta = chart.getDatasetMeta(datasetIndex);
13333                            if (chart.isDatasetVisible(datasetIndex) && IDMatches(meta) &&
13334                                meta.stack !== undefined) {
13335                                hasStacks = true;
13336                                break;
13337                            }
13338                        }
13339                    }
13340
13341                    if (opts.stacked || hasStacks) {
13342                        var valuesPerStack = {};
13343
13344                        for (datasetIndex = 0; datasetIndex < datasets.length; datasetIndex++) {
13345                            meta = chart.getDatasetMeta(datasetIndex);
13346                            var key = [
13347                                meta.type,
13348                                // we have a separate stack for stack=undefined datasets when the opts.stacked is undefined
13349                                ((opts.stacked === undefined && meta.stack === undefined) ? datasetIndex : ''),
13350                                meta.stack
13351                            ].join('.');
13352
13353                            if (chart.isDatasetVisible(datasetIndex) && IDMatches(meta)) {
13354                                if (valuesPerStack[key] === undefined) {
13355                                    valuesPerStack[key] = [];
13356                                }
13357
13358                                data = datasets[datasetIndex].data;
13359                                for (i = 0, ilen = data.length; i < ilen; i++) {
13360                                    var values = valuesPerStack[key];
13361                                    value = me._parseValue(data[i]);
13362                                    // invalid, hidden and negative values are ignored
13363                                    if (isNaN(value.min) || isNaN(value.max) || meta.data[i].hidden || value.min < 0 || value.max < 0) {
13364                                        continue;
13365                                    }
13366                                    values[i] = values[i] || 0;
13367                                    values[i] += value.max;
13368                                }
13369                            }
13370                        }
13371
13372                        helpers$1.each(valuesPerStack, function (valuesForType) {
13373                            if (valuesForType.length > 0) {
13374                                var minVal = helpers$1.min(valuesForType);
13375                                var maxVal = helpers$1.max(valuesForType);
13376                                me.min = Math.min(me.min, minVal);
13377                                me.max = Math.max(me.max, maxVal);
13378                            }
13379                        });
13380
13381                    } else {
13382                        for (datasetIndex = 0; datasetIndex < datasets.length; datasetIndex++) {
13383                            meta = chart.getDatasetMeta(datasetIndex);
13384                            if (chart.isDatasetVisible(datasetIndex) && IDMatches(meta)) {
13385                                data = datasets[datasetIndex].data;
13386                                for (i = 0, ilen = data.length; i < ilen; i++) {
13387                                    value = me._parseValue(data[i]);
13388                                    // invalid, hidden and negative values are ignored
13389                                    if (isNaN(value.min) || isNaN(value.max) || meta.data[i].hidden || value.min < 0 || value.max < 0) {
13390                                        continue;
13391                                    }
13392
13393                                    me.min = Math.min(value.min, me.min);
13394                                    me.max = Math.max(value.max, me.max);
13395
13396                                    if (value.min !== 0) {
13397                                        me.minNotZero = Math.min(value.min, me.minNotZero);
13398                                    }
13399                                }
13400                            }
13401                        }
13402                    }
13403
13404                    me.min = helpers$1.isFinite(me.min) ? me.min : null;
13405                    me.max = helpers$1.isFinite(me.max) ? me.max : null;
13406                    me.minNotZero = helpers$1.isFinite(me.minNotZero) ? me.minNotZero : null;
13407
13408                    // Common base implementation to handle ticks.min, ticks.max
13409                    this.handleTickRangeOptions();
13410                },
13411
13412                handleTickRangeOptions: function () {
13413                    var me = this;
13414                    var tickOpts = me.options.ticks;
13415                    var DEFAULT_MIN = 1;
13416                    var DEFAULT_MAX = 10;
13417
13418                    me.min = nonNegativeOrDefault(tickOpts.min, me.min);
13419                    me.max = nonNegativeOrDefault(tickOpts.max, me.max);
13420
13421                    if (me.min === me.max) {
13422                        if (me.min !== 0 && me.min !== null) {
13423                            me.min = Math.pow(10, Math.floor(log10(me.min)) - 1);
13424                            me.max = Math.pow(10, Math.floor(log10(me.max)) + 1);
13425                        } else {
13426                            me.min = DEFAULT_MIN;
13427                            me.max = DEFAULT_MAX;
13428                        }
13429                    }
13430                    if (me.min === null) {
13431                        me.min = Math.pow(10, Math.floor(log10(me.max)) - 1);
13432                    }
13433                    if (me.max === null) {
13434                        me.max = me.min !== 0
13435                            ? Math.pow(10, Math.floor(log10(me.min)) + 1)
13436                            : DEFAULT_MAX;
13437                    }
13438                    if (me.minNotZero === null) {
13439                        if (me.min > 0) {
13440                            me.minNotZero = me.min;
13441                        } else if (me.max < 1) {
13442                            me.minNotZero = Math.pow(10, Math.floor(log10(me.max)));
13443                        } else {
13444                            me.minNotZero = DEFAULT_MIN;
13445                        }
13446                    }
13447                },
13448
13449                buildTicks: function () {
13450                    var me = this;
13451                    var tickOpts = me.options.ticks;
13452                    var reverse = !me.isHorizontal();
13453
13454                    var generationOptions = {
13455                        min: nonNegativeOrDefault(tickOpts.min),
13456                        max: nonNegativeOrDefault(tickOpts.max)
13457                    };
13458                    var ticks = me.ticks = generateTicks$1(generationOptions, me);
13459
13460                    // At this point, we need to update our max and min given the tick values since we have expanded the
13461                    // range of the scale
13462                    me.max = helpers$1.max(ticks);
13463                    me.min = helpers$1.min(ticks);
13464
13465                    if (tickOpts.reverse) {
13466                        reverse = !reverse;
13467                        me.start = me.max;
13468                        me.end = me.min;
13469                    } else {
13470                        me.start = me.min;
13471                        me.end = me.max;
13472                    }
13473                    if (reverse) {
13474                        ticks.reverse();
13475                    }
13476                },
13477
13478                convertTicksToLabels: function () {
13479                    this.tickValues = this.ticks.slice();
13480
13481                    core_scale.prototype.convertTicksToLabels.call(this);
13482                },
13483
13484                // Get the correct tooltip label
13485                getLabelForIndex: function (index, datasetIndex) {
13486                    return this._getScaleLabel(this.chart.data.datasets[datasetIndex].data[index]);
13487                },
13488
13489                getPixelForTick: function (index) {
13490                    var ticks = this.tickValues;
13491                    if (index < 0 || index > ticks.length - 1) {
13492                        return null;
13493                    }
13494                    return this.getPixelForValue(ticks[index]);
13495                },
13496
13497                /**
13498                 * Returns the value of the first tick.
13499                 * @param {number} value - The minimum not zero value.
13500                 * @return {number} The first tick value.
13501                 * @private
13502                 */
13503                _getFirstTickValue: function (value) {
13504                    var exp = Math.floor(log10(value));
13505                    var significand = Math.floor(value / Math.pow(10, exp));
13506
13507                    return significand * Math.pow(10, exp);
13508                },
13509
13510                _configure: function () {
13511                    var me = this;
13512                    var start = me.min;
13513                    var offset = 0;
13514
13515                    core_scale.prototype._configure.call(me);
13516
13517                    if (start === 0) {
13518                        start = me._getFirstTickValue(me.minNotZero);
13519                        offset = valueOrDefault$b(me.options.ticks.fontSize, core_defaults.global.defaultFontSize) / me._length;
13520                    }
13521
13522                    me._startValue = log10(start);
13523                    me._valueOffset = offset;
13524                    me._valueRange = (log10(me.max) - log10(start)) / (1 - offset);
13525                },
13526
13527                getPixelForValue: function (value) {
13528                    var me = this;
13529                    var decimal = 0;
13530
13531                    value = +me.getRightValue(value);
13532
13533                    if (value > me.min && value > 0) {
13534                        decimal = (log10(value) - me._startValue) / me._valueRange + me._valueOffset;
13535                    }
13536                    return me.getPixelForDecimal(decimal);
13537                },
13538
13539                getValueForPixel: function (pixel) {
13540                    var me = this;
13541                    var decimal = me.getDecimalForPixel(pixel);
13542                    return decimal === 0 && me.min === 0
13543                        ? 0
13544                        : Math.pow(10, me._startValue + (decimal - me._valueOffset) * me._valueRange);
13545                }
13546            });
13547
13548// INTERNAL: static default options, registered in src/index.js
13549            var _defaults$2 = defaultConfig$2;
13550            scale_logarithmic._defaults = _defaults$2;
13551
13552            var valueOrDefault$c = helpers$1.valueOrDefault;
13553            var valueAtIndexOrDefault$1 = helpers$1.valueAtIndexOrDefault;
13554            var resolve$4 = helpers$1.options.resolve;
13555
13556            var defaultConfig$3 = {
13557                display: true,
13558
13559                // Boolean - Whether to animate scaling the chart from the centre
13560                animate: true,
13561                position: 'chartArea',
13562
13563                angleLines: {
13564                    display: true,
13565                    color: 'rgba(0,0,0,0.1)',
13566                    lineWidth: 1,
13567                    borderDash: [],
13568                    borderDashOffset: 0.0
13569                },
13570
13571                gridLines: {
13572                    circular: false
13573                },
13574
13575                // label settings
13576                ticks: {
13577                    // Boolean - Show a backdrop to the scale label
13578                    showLabelBackdrop: true,
13579
13580                    // String - The colour of the label backdrop
13581                    backdropColor: 'rgba(255,255,255,0.75)',
13582
13583                    // Number - The backdrop padding above & below the label in pixels
13584                    backdropPaddingY: 2,
13585
13586                    // Number - The backdrop padding to the side of the label in pixels
13587                    backdropPaddingX: 2,
13588
13589                    callback: core_ticks.formatters.linear
13590                },
13591
13592                pointLabels: {
13593                    // Boolean - if true, show point labels
13594                    display: true,
13595
13596                    // Number - Point label font size in pixels
13597                    fontSize: 10,
13598
13599                    // Function - Used to convert point labels
13600                    callback: function (label) {
13601                        return label;
13602                    }
13603                }
13604            };
13605
13606            function getTickBackdropHeight(opts) {
13607                var tickOpts = opts.ticks;
13608
13609                if (tickOpts.display && opts.display) {
13610                    return valueOrDefault$c(tickOpts.fontSize, core_defaults.global.defaultFontSize) + tickOpts.backdropPaddingY * 2;
13611                }
13612                return 0;
13613            }
13614
13615            function measureLabelSize(ctx, lineHeight, label) {
13616                if (helpers$1.isArray(label)) {
13617                    return {
13618                        w: helpers$1.longestText(ctx, ctx.font, label),
13619                        h: label.length * lineHeight
13620                    };
13621                }
13622
13623                return {
13624                    w: ctx.measureText(label).width,
13625                    h: lineHeight
13626                };
13627            }
13628
13629            function determineLimits(angle, pos, size, min, max) {
13630                if (angle === min || angle === max) {
13631                    return {
13632                        start: pos - (size / 2),
13633                        end: pos + (size / 2)
13634                    };
13635                } else if (angle < min || angle > max) {
13636                    return {
13637                        start: pos - size,
13638                        end: pos
13639                    };
13640                }
13641
13642                return {
13643                    start: pos,
13644                    end: pos + size
13645                };
13646            }
13647
13648            /**
13649             * Helper function to fit a radial linear scale with point labels
13650             */
13651            function fitWithPointLabels(scale) {
13652
13653                // Right, this is really confusing and there is a lot of maths going on here
13654                // The gist of the problem is here: https://gist.github.com/nnnick/696cc9c55f4b0beb8fe9
13655                //
13656                // Reaction: https://dl.dropboxusercontent.com/u/34601363/toomuchscience.gif
13657                //
13658                // Solution:
13659                //
13660                // We assume the radius of the polygon is half the size of the canvas at first
13661                // at each index we check if the text overlaps.
13662                //
13663                // Where it does, we store that angle and that index.
13664                //
13665                // After finding the largest index and angle we calculate how much we need to remove
13666                // from the shape radius to move the point inwards by that x.
13667                //
13668                // We average the left and right distances to get the maximum shape radius that can fit in the box
13669                // along with labels.
13670                //
13671                // Once we have that, we can find the centre point for the chart, by taking the x text protrusion
13672                // on each side, removing that from the size, halving it and adding the left x protrusion width.
13673                //
13674                // This will mean we have a shape fitted to the canvas, as large as it can be with the labels
13675                // and position it in the most space efficient manner
13676                //
13677                // https://dl.dropboxusercontent.com/u/34601363/yeahscience.gif
13678
13679                var plFont = helpers$1.options._parseFont(scale.options.pointLabels);
13680
13681                // Get maximum radius of the polygon. Either half the height (minus the text width) or half the width.
13682                // Use this to calculate the offset + change. - Make sure L/R protrusion is at least 0 to stop issues with centre points
13683                var furthestLimits = {
13684                    l: 0,
13685                    r: scale.width,
13686                    t: 0,
13687                    b: scale.height - scale.paddingTop
13688                };
13689                var furthestAngles = {};
13690                var i, textSize, pointPosition;
13691
13692                scale.ctx.font = plFont.string;
13693                scale._pointLabelSizes = [];
13694
13695                var valueCount = scale.chart.data.labels.length;
13696                for (i = 0; i < valueCount; i++) {
13697                    pointPosition = scale.getPointPosition(i, scale.drawingArea + 5);
13698                    textSize = measureLabelSize(scale.ctx, plFont.lineHeight, scale.pointLabels[i]);
13699                    scale._pointLabelSizes[i] = textSize;
13700
13701                    // Add quarter circle to make degree 0 mean top of circle
13702                    var angleRadians = scale.getIndexAngle(i);
13703                    var angle = helpers$1.toDegrees(angleRadians) % 360;
13704                    var hLimits = determineLimits(angle, pointPosition.x, textSize.w, 0, 180);
13705                    var vLimits = determineLimits(angle, pointPosition.y, textSize.h, 90, 270);
13706
13707                    if (hLimits.start < furthestLimits.l) {
13708                        furthestLimits.l = hLimits.start;
13709                        furthestAngles.l = angleRadians;
13710                    }
13711
13712                    if (hLimits.end > furthestLimits.r) {
13713                        furthestLimits.r = hLimits.end;
13714                        furthestAngles.r = angleRadians;
13715                    }
13716
13717                    if (vLimits.start < furthestLimits.t) {
13718                        furthestLimits.t = vLimits.start;
13719                        furthestAngles.t = angleRadians;
13720                    }
13721
13722                    if (vLimits.end > furthestLimits.b) {
13723                        furthestLimits.b = vLimits.end;
13724                        furthestAngles.b = angleRadians;
13725                    }
13726                }
13727
13728                scale.setReductions(scale.drawingArea, furthestLimits, furthestAngles);
13729            }
13730
13731            function getTextAlignForAngle(angle) {
13732                if (angle === 0 || angle === 180) {
13733                    return 'center';
13734                } else if (angle < 180) {
13735                    return 'left';
13736                }
13737
13738                return 'right';
13739            }
13740
13741            function fillText(ctx, text, position, lineHeight) {
13742                var y = position.y + lineHeight / 2;
13743                var i, ilen;
13744
13745                if (helpers$1.isArray(text)) {
13746                    for (i = 0, ilen = text.length; i < ilen; ++i) {
13747                        ctx.fillText(text[i], position.x, y);
13748                        y += lineHeight;
13749                    }
13750                } else {
13751                    ctx.fillText(text, position.x, y);
13752                }
13753            }
13754
13755            function adjustPointPositionForLabelHeight(angle, textSize, position) {
13756                if (angle === 90 || angle === 270) {
13757                    position.y -= (textSize.h / 2);
13758                } else if (angle > 270 || angle < 90) {
13759                    position.y -= textSize.h;
13760                }
13761            }
13762
13763            function drawPointLabels(scale) {
13764                var ctx = scale.ctx;
13765                var opts = scale.options;
13766                var pointLabelOpts = opts.pointLabels;
13767                var tickBackdropHeight = getTickBackdropHeight(opts);
13768                var outerDistance = scale.getDistanceFromCenterForValue(opts.ticks.reverse ? scale.min : scale.max);
13769                var plFont = helpers$1.options._parseFont(pointLabelOpts);
13770
13771                ctx.save();
13772
13773                ctx.font = plFont.string;
13774                ctx.textBaseline = 'middle';
13775
13776                for (var i = scale.chart.data.labels.length - 1; i >= 0; i--) {
13777                    // Extra pixels out for some label spacing
13778                    var extra = (i === 0 ? tickBackdropHeight / 2 : 0);
13779                    var pointLabelPosition = scale.getPointPosition(i, outerDistance + extra + 5);
13780
13781                    // Keep this in loop since we may support array properties here
13782                    var pointLabelFontColor = valueAtIndexOrDefault$1(pointLabelOpts.fontColor, i, core_defaults.global.defaultFontColor);
13783                    ctx.fillStyle = pointLabelFontColor;
13784
13785                    var angleRadians = scale.getIndexAngle(i);
13786                    var angle = helpers$1.toDegrees(angleRadians);
13787                    ctx.textAlign = getTextAlignForAngle(angle);
13788                    adjustPointPositionForLabelHeight(angle, scale._pointLabelSizes[i], pointLabelPosition);
13789                    fillText(ctx, scale.pointLabels[i], pointLabelPosition, plFont.lineHeight);
13790                }
13791                ctx.restore();
13792            }
13793
13794            function drawRadiusLine(scale, gridLineOpts, radius, index) {
13795                var ctx = scale.ctx;
13796                var circular = gridLineOpts.circular;
13797                var valueCount = scale.chart.data.labels.length;
13798                var lineColor = valueAtIndexOrDefault$1(gridLineOpts.color, index - 1);
13799                var lineWidth = valueAtIndexOrDefault$1(gridLineOpts.lineWidth, index - 1);
13800                var pointPosition;
13801
13802                if ((!circular && !valueCount) || !lineColor || !lineWidth) {
13803                    return;
13804                }
13805
13806                ctx.save();
13807                ctx.strokeStyle = lineColor;
13808                ctx.lineWidth = lineWidth;
13809                if (ctx.setLineDash) {
13810                    ctx.setLineDash(gridLineOpts.borderDash || []);
13811                    ctx.lineDashOffset = gridLineOpts.borderDashOffset || 0.0;
13812                }
13813
13814                ctx.beginPath();
13815                if (circular) {
13816                    // Draw circular arcs between the points
13817                    ctx.arc(scale.xCenter, scale.yCenter, radius, 0, Math.PI * 2);
13818                } else {
13819                    // Draw straight lines connecting each index
13820                    pointPosition = scale.getPointPosition(0, radius);
13821                    ctx.moveTo(pointPosition.x, pointPosition.y);
13822
13823                    for (var i = 1; i < valueCount; i++) {
13824                        pointPosition = scale.getPointPosition(i, radius);
13825                        ctx.lineTo(pointPosition.x, pointPosition.y);
13826                    }
13827                }
13828                ctx.closePath();
13829                ctx.stroke();
13830                ctx.restore();
13831            }
13832
13833            function numberOrZero(param) {
13834                return helpers$1.isNumber(param) ? param : 0;
13835            }
13836
13837            var scale_radialLinear = scale_linearbase.extend({
13838                setDimensions: function () {
13839                    var me = this;
13840
13841                    // Set the unconstrained dimension before label rotation
13842                    me.width = me.maxWidth;
13843                    me.height = me.maxHeight;
13844                    me.paddingTop = getTickBackdropHeight(me.options) / 2;
13845                    me.xCenter = Math.floor(me.width / 2);
13846                    me.yCenter = Math.floor((me.height - me.paddingTop) / 2);
13847                    me.drawingArea = Math.min(me.height - me.paddingTop, me.width) / 2;
13848                },
13849
13850                determineDataLimits: function () {
13851                    var me = this;
13852                    var chart = me.chart;
13853                    var min = Number.POSITIVE_INFINITY;
13854                    var max = Number.NEGATIVE_INFINITY;
13855
13856                    helpers$1.each(chart.data.datasets, function (dataset, datasetIndex) {
13857                        if (chart.isDatasetVisible(datasetIndex)) {
13858                            var meta = chart.getDatasetMeta(datasetIndex);
13859
13860                            helpers$1.each(dataset.data, function (rawValue, index) {
13861                                var value = +me.getRightValue(rawValue);
13862                                if (isNaN(value) || meta.data[index].hidden) {
13863                                    return;
13864                                }
13865
13866                                min = Math.min(value, min);
13867                                max = Math.max(value, max);
13868                            });
13869                        }
13870                    });
13871
13872                    me.min = (min === Number.POSITIVE_INFINITY ? 0 : min);
13873                    me.max = (max === Number.NEGATIVE_INFINITY ? 0 : max);
13874
13875                    // Common base implementation to handle ticks.min, ticks.max, ticks.beginAtZero
13876                    me.handleTickRangeOptions();
13877                },
13878
13879                // Returns the maximum number of ticks based on the scale dimension
13880                _computeTickLimit: function () {
13881                    return Math.ceil(this.drawingArea / getTickBackdropHeight(this.options));
13882                },
13883
13884                convertTicksToLabels: function () {
13885                    var me = this;
13886
13887                    scale_linearbase.prototype.convertTicksToLabels.call(me);
13888
13889                    // Point labels
13890                    me.pointLabels = me.chart.data.labels.map(function () {
13891                        var label = helpers$1.callback(me.options.pointLabels.callback, arguments, me);
13892                        return label || label === 0 ? label : '';
13893                    });
13894                },
13895
13896                getLabelForIndex: function (index, datasetIndex) {
13897                    return +this.getRightValue(this.chart.data.datasets[datasetIndex].data[index]);
13898                },
13899
13900                fit: function () {
13901                    var me = this;
13902                    var opts = me.options;
13903
13904                    if (opts.display && opts.pointLabels.display) {
13905                        fitWithPointLabels(me);
13906                    } else {
13907                        me.setCenterPoint(0, 0, 0, 0);
13908                    }
13909                },
13910
13911                /**
13912                 * Set radius reductions and determine new radius and center point
13913                 * @private
13914                 */
13915                setReductions: function (largestPossibleRadius, furthestLimits, furthestAngles) {
13916                    var me = this;
13917                    var radiusReductionLeft = furthestLimits.l / Math.sin(furthestAngles.l);
13918                    var radiusReductionRight = Math.max(furthestLimits.r - me.width, 0) / Math.sin(furthestAngles.r);
13919                    var radiusReductionTop = -furthestLimits.t / Math.cos(furthestAngles.t);
13920                    var radiusReductionBottom = -Math.max(furthestLimits.b - (me.height - me.paddingTop), 0) / Math.cos(furthestAngles.b);
13921
13922                    radiusReductionLeft = numberOrZero(radiusReductionLeft);
13923                    radiusReductionRight = numberOrZero(radiusReductionRight);
13924                    radiusReductionTop = numberOrZero(radiusReductionTop);
13925                    radiusReductionBottom = numberOrZero(radiusReductionBottom);
13926
13927                    me.drawingArea = Math.min(
13928                        Math.floor(largestPossibleRadius - (radiusReductionLeft + radiusReductionRight) / 2),
13929                        Math.floor(largestPossibleRadius - (radiusReductionTop + radiusReductionBottom) / 2));
13930                    me.setCenterPoint(radiusReductionLeft, radiusReductionRight, radiusReductionTop, radiusReductionBottom);
13931                },
13932
13933                setCenterPoint: function (leftMovement, rightMovement, topMovement, bottomMovement) {
13934                    var me = this;
13935                    var maxRight = me.width - rightMovement - me.drawingArea;
13936                    var maxLeft = leftMovement + me.drawingArea;
13937                    var maxTop = topMovement + me.drawingArea;
13938                    var maxBottom = (me.height - me.paddingTop) - bottomMovement - me.drawingArea;
13939
13940                    me.xCenter = Math.floor(((maxLeft + maxRight) / 2) + me.left);
13941                    me.yCenter = Math.floor(((maxTop + maxBottom) / 2) + me.top + me.paddingTop);
13942                },
13943
13944                getIndexAngle: function (index) {
13945                    var chart = this.chart;
13946                    var angleMultiplier = 360 / chart.data.labels.length;
13947                    var options = chart.options || {};
13948                    var startAngle = options.startAngle || 0;
13949
13950                    // Start from the top instead of right, so remove a quarter of the circle
13951                    var angle = (index * angleMultiplier + startAngle) % 360;
13952
13953                    return (angle < 0 ? angle + 360 : angle) * Math.PI * 2 / 360;
13954                },
13955
13956                getDistanceFromCenterForValue: function (value) {
13957                    var me = this;
13958
13959                    if (helpers$1.isNullOrUndef(value)) {
13960                        return NaN;
13961                    }
13962
13963                    // Take into account half font size + the yPadding of the top value
13964                    var scalingFactor = me.drawingArea / (me.max - me.min);
13965                    if (me.options.ticks.reverse) {
13966                        return (me.max - value) * scalingFactor;
13967                    }
13968                    return (value - me.min) * scalingFactor;
13969                },
13970
13971                getPointPosition: function (index, distanceFromCenter) {
13972                    var me = this;
13973                    var thisAngle = me.getIndexAngle(index) - (Math.PI / 2);
13974                    return {
13975                        x: Math.cos(thisAngle) * distanceFromCenter + me.xCenter,
13976                        y: Math.sin(thisAngle) * distanceFromCenter + me.yCenter
13977                    };
13978                },
13979
13980                getPointPositionForValue: function (index, value) {
13981                    return this.getPointPosition(index, this.getDistanceFromCenterForValue(value));
13982                },
13983
13984                getBasePosition: function (index) {
13985                    var me = this;
13986                    var min = me.min;
13987                    var max = me.max;
13988
13989                    return me.getPointPositionForValue(index || 0,
13990                        me.beginAtZero ? 0 :
13991                            min < 0 && max < 0 ? max :
13992                                min > 0 && max > 0 ? min :
13993                                    0);
13994                },
13995
13996                /**
13997                 * @private
13998                 */
13999                _drawGrid: function () {
14000                    var me = this;
14001                    var ctx = me.ctx;
14002                    var opts = me.options;
14003                    var gridLineOpts = opts.gridLines;
14004                    var angleLineOpts = opts.angleLines;
14005                    var lineWidth = valueOrDefault$c(angleLineOpts.lineWidth, gridLineOpts.lineWidth);
14006                    var lineColor = valueOrDefault$c(angleLineOpts.color, gridLineOpts.color);
14007                    var i, offset, position;
14008
14009                    if (opts.pointLabels.display) {
14010                        drawPointLabels(me);
14011                    }
14012
14013                    if (gridLineOpts.display) {
14014                        helpers$1.each(me.ticks, function (label, index) {
14015                            if (index !== 0) {
14016                                offset = me.getDistanceFromCenterForValue(me.ticksAsNumbers[index]);
14017                                drawRadiusLine(me, gridLineOpts, offset, index);
14018                            }
14019                        });
14020                    }
14021
14022                    if (angleLineOpts.display && lineWidth && lineColor) {
14023                        ctx.save();
14024                        ctx.lineWidth = lineWidth;
14025                        ctx.strokeStyle = lineColor;
14026                        if (ctx.setLineDash) {
14027                            ctx.setLineDash(resolve$4([angleLineOpts.borderDash, gridLineOpts.borderDash, []]));
14028                            ctx.lineDashOffset = resolve$4([angleLineOpts.borderDashOffset, gridLineOpts.borderDashOffset, 0.0]);
14029                        }
14030
14031                        for (i = me.chart.data.labels.length - 1; i >= 0; i--) {
14032                            offset = me.getDistanceFromCenterForValue(opts.ticks.reverse ? me.min : me.max);
14033                            position = me.getPointPosition(i, offset);
14034                            ctx.beginPath();
14035                            ctx.moveTo(me.xCenter, me.yCenter);
14036                            ctx.lineTo(position.x, position.y);
14037                            ctx.stroke();
14038                        }
14039
14040                        ctx.restore();
14041                    }
14042                },
14043
14044                /**
14045                 * @private
14046                 */
14047                _drawLabels: function () {
14048                    var me = this;
14049                    var ctx = me.ctx;
14050                    var opts = me.options;
14051                    var tickOpts = opts.ticks;
14052
14053                    if (!tickOpts.display) {
14054                        return;
14055                    }
14056
14057                    var startAngle = me.getIndexAngle(0);
14058                    var tickFont = helpers$1.options._parseFont(tickOpts);
14059                    var tickFontColor = valueOrDefault$c(tickOpts.fontColor, core_defaults.global.defaultFontColor);
14060                    var offset, width;
14061
14062                    ctx.save();
14063                    ctx.font = tickFont.string;
14064                    ctx.translate(me.xCenter, me.yCenter);
14065                    ctx.rotate(startAngle);
14066                    ctx.textAlign = 'center';
14067                    ctx.textBaseline = 'middle';
14068
14069                    helpers$1.each(me.ticks, function (label, index) {
14070                        if (index === 0 && !tickOpts.reverse) {
14071                            return;
14072                        }
14073
14074                        offset = me.getDistanceFromCenterForValue(me.ticksAsNumbers[index]);
14075
14076                        if (tickOpts.showLabelBackdrop) {
14077                            width = ctx.measureText(label).width;
14078                            ctx.fillStyle = tickOpts.backdropColor;
14079
14080                            ctx.fillRect(
14081                                -width / 2 - tickOpts.backdropPaddingX,
14082                                -offset - tickFont.size / 2 - tickOpts.backdropPaddingY,
14083                                width + tickOpts.backdropPaddingX * 2,
14084                                tickFont.size + tickOpts.backdropPaddingY * 2
14085                            );
14086                        }
14087
14088                        ctx.fillStyle = tickFontColor;
14089                        ctx.fillText(label, 0, -offset);
14090                    });
14091
14092                    ctx.restore();
14093                },
14094
14095                /**
14096                 * @private
14097                 */
14098                _drawTitle: helpers$1.noop
14099            });
14100
14101// INTERNAL: static default options, registered in src/index.js
14102            var _defaults$3 = defaultConfig$3;
14103            scale_radialLinear._defaults = _defaults$3;
14104
14105            var deprecated$1 = helpers$1._deprecated;
14106            var resolve$5 = helpers$1.options.resolve;
14107            var valueOrDefault$d = helpers$1.valueOrDefault;
14108
14109// Integer constants are from the ES6 spec.
14110            var MIN_INTEGER = Number.MIN_SAFE_INTEGER || -9007199254740991;
14111            var MAX_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
14112
14113            var INTERVALS = {
14114                millisecond: {
14115                    common: true,
14116                    size: 1,
14117                    steps: 1000
14118                },
14119                second: {
14120                    common: true,
14121                    size: 1000,
14122                    steps: 60
14123                },
14124                minute: {
14125                    common: true,
14126                    size: 60000,
14127                    steps: 60
14128                },
14129                hour: {
14130                    common: true,
14131                    size: 3600000,
14132                    steps: 24
14133                },
14134                day: {
14135                    common: true,
14136                    size: 86400000,
14137                    steps: 30
14138                },
14139                week: {
14140                    common: false,
14141                    size: 604800000,
14142                    steps: 4
14143                },
14144                month: {
14145                    common: true,
14146                    size: 2.628e9,
14147                    steps: 12
14148                },
14149                quarter: {
14150                    common: false,
14151                    size: 7.884e9,
14152                    steps: 4
14153                },
14154                year: {
14155                    common: true,
14156                    size: 3.154e10
14157                }
14158            };
14159
14160            var UNITS = Object.keys(INTERVALS);
14161
14162            function sorter(a, b) {
14163                return a - b;
14164            }
14165
14166            function arrayUnique(items) {
14167                var hash = {};
14168                var out = [];
14169                var i, ilen, item;
14170
14171                for (i = 0, ilen = items.length; i < ilen; ++i) {
14172                    item = items[i];
14173                    if (!hash[item]) {
14174                        hash[item] = true;
14175                        out.push(item);
14176                    }
14177                }
14178
14179                return out;
14180            }
14181
14182            function getMin(options) {
14183                return helpers$1.valueOrDefault(options.time.min, options.ticks.min);
14184            }
14185
14186            function getMax(options) {
14187                return helpers$1.valueOrDefault(options.time.max, options.ticks.max);
14188            }
14189
14190            /**
14191             * Returns an array of {time, pos} objects used to interpolate a specific `time` or position
14192             * (`pos`) on the scale, by searching entries before and after the requested value. `pos` is
14193             * a decimal between 0 and 1: 0 being the start of the scale (left or top) and 1 the other
14194             * extremity (left + width or top + height). Note that it would be more optimized to directly
14195             * store pre-computed pixels, but the scale dimensions are not guaranteed at the time we need
14196             * to create the lookup table. The table ALWAYS contains at least two items: min and max.
14197             *
14198             * @param {number[]} timestamps - timestamps sorted from lowest to highest.
14199             * @param {string} distribution - If 'linear', timestamps will be spread linearly along the min
14200             * and max range, so basically, the table will contains only two items: {min, 0} and {max, 1}.
14201             * If 'series', timestamps will be positioned at the same distance from each other. In this
14202             * case, only timestamps that break the time linearity are registered, meaning that in the
14203             * best case, all timestamps are linear, the table contains only min and max.
14204             */
14205            function buildLookupTable(timestamps, min, max, distribution) {
14206                if (distribution === 'linear' || !timestamps.length) {
14207                    return [
14208                        {time: min, pos: 0},
14209                        {time: max, pos: 1}
14210                    ];
14211                }
14212
14213                var table = [];
14214                var items = [min];
14215                var i, ilen, prev, curr, next;
14216
14217                for (i = 0, ilen = timestamps.length; i < ilen; ++i) {
14218                    curr = timestamps[i];
14219                    if (curr > min && curr < max) {
14220                        items.push(curr);
14221                    }
14222                }
14223
14224                items.push(max);
14225
14226                for (i = 0, ilen = items.length; i < ilen; ++i) {
14227                    next = items[i + 1];
14228                    prev = items[i - 1];
14229                    curr = items[i];
14230
14231                    // only add points that breaks the scale linearity
14232                    if (prev === undefined || next === undefined || Math.round((next + prev) / 2) !== curr) {
14233                        table.push({time: curr, pos: i / (ilen - 1)});
14234                    }
14235                }
14236
14237                return table;
14238            }
14239
14240// @see adapted from https://www.anujgakhar.com/2014/03/01/binary-search-in-javascript/
14241            function lookup(table, key, value) {
14242                var lo = 0;
14243                var hi = table.length - 1;
14244                var mid, i0, i1;
14245
14246                while (lo >= 0 && lo <= hi) {
14247                    mid = (lo + hi) >> 1;
14248                    i0 = table[mid - 1] || null;
14249                    i1 = table[mid];
14250
14251                    if (!i0) {
14252                        // given value is outside table (before first item)
14253                        return {lo: null, hi: i1};
14254                    } else if (i1[key] < value) {
14255                        lo = mid + 1;
14256                    } else if (i0[key] > value) {
14257                        hi = mid - 1;
14258                    } else {
14259                        return {lo: i0, hi: i1};
14260                    }
14261                }
14262
14263                // given value is outside table (after last item)
14264                return {lo: i1, hi: null};
14265            }
14266
14267            /**
14268             * Linearly interpolates the given source `value` using the table items `skey` values and
14269             * returns the associated `tkey` value. For example, interpolate(table, 'time', 42, 'pos')
14270             * returns the position for a timestamp equal to 42. If value is out of bounds, values at
14271             * index [0, 1] or [n - 1, n] are used for the interpolation.
14272             */
14273            function interpolate$1(table, skey, sval, tkey) {
14274                var range = lookup(table, skey, sval);
14275
14276                // Note: the lookup table ALWAYS contains at least 2 items (min and max)
14277                var prev = !range.lo ? table[0] : !range.hi ? table[table.length - 2] : range.lo;
14278                var next = !range.lo ? table[1] : !range.hi ? table[table.length - 1] : range.hi;
14279
14280                var span = next[skey] - prev[skey];
14281                var ratio = span ? (sval - prev[skey]) / span : 0;
14282                var offset = (next[tkey] - prev[tkey]) * ratio;
14283
14284                return prev[tkey] + offset;
14285            }
14286
14287            function toTimestamp(scale, input) {
14288                var adapter = scale._adapter;
14289                var options = scale.options.time;
14290                var parser = options.parser;
14291                var format = parser || options.format;
14292                var value = input;
14293
14294                if (typeof parser === 'function') {
14295                    value = parser(value);
14296                }
14297
14298                // Only parse if its not a timestamp already
14299                if (!helpers$1.isFinite(value)) {
14300                    value = typeof format === 'string'
14301                        ? adapter.parse(value, format)
14302                        : adapter.parse(value);
14303                }
14304
14305                if (value !== null) {
14306                    return +value;
14307                }
14308
14309                // Labels are in an incompatible format and no `parser` has been provided.
14310                // The user might still use the deprecated `format` option for parsing.
14311                if (!parser && typeof format === 'function') {
14312                    value = format(input);
14313
14314                    // `format` could return something else than a timestamp, if so, parse it
14315                    if (!helpers$1.isFinite(value)) {
14316                        value = adapter.parse(value);
14317                    }
14318                }
14319
14320                return value;
14321            }
14322
14323            function parse(scale, input) {
14324                if (helpers$1.isNullOrUndef(input)) {
14325                    return null;
14326                }
14327
14328                var options = scale.options.time;
14329                var value = toTimestamp(scale, scale.getRightValue(input));
14330                if (value === null) {
14331                    return value;
14332                }
14333
14334                if (options.round) {
14335                    value = +scale._adapter.startOf(value, options.round);
14336                }
14337
14338                return value;
14339            }
14340
14341            /**
14342             * Figures out what unit results in an appropriate number of auto-generated ticks
14343             */
14344            function determineUnitForAutoTicks(minUnit, min, max, capacity) {
14345                var ilen = UNITS.length;
14346                var i, interval, factor;
14347
14348                for (i = UNITS.indexOf(minUnit); i < ilen - 1; ++i) {
14349                    interval = INTERVALS[UNITS[i]];
14350                    factor = interval.steps ? interval.steps : MAX_INTEGER;
14351
14352                    if (interval.common && Math.ceil((max - min) / (factor * interval.size)) <= capacity) {
14353                        return UNITS[i];
14354                    }
14355                }
14356
14357                return UNITS[ilen - 1];
14358            }
14359
14360            /**
14361             * Figures out what unit to format a set of ticks with
14362             */
14363            function determineUnitForFormatting(scale, numTicks, minUnit, min, max) {
14364                var i, unit;
14365
14366                for (i = UNITS.length - 1; i >= UNITS.indexOf(minUnit); i--) {
14367                    unit = UNITS[i];
14368                    if (INTERVALS[unit].common && scale._adapter.diff(max, min, unit) >= numTicks - 1) {
14369                        return unit;
14370                    }
14371                }
14372
14373                return UNITS[minUnit ? UNITS.indexOf(minUnit) : 0];
14374            }
14375
14376            function determineMajorUnit(unit) {
14377                for (var i = UNITS.indexOf(unit) + 1, ilen = UNITS.length; i < ilen; ++i) {
14378                    if (INTERVALS[UNITS[i]].common) {
14379                        return UNITS[i];
14380                    }
14381                }
14382            }
14383
14384            /**
14385             * Generates a maximum of `capacity` timestamps between min and max, rounded to the
14386             * `minor` unit using the given scale time `options`.
14387             * Important: this method can return ticks outside the min and max range, it's the
14388             * responsibility of the calling code to clamp values if needed.
14389             */
14390            function generate(scale, min, max, capacity) {
14391                var adapter = scale._adapter;
14392                var options = scale.options;
14393                var timeOpts = options.time;
14394                var minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);
14395                var stepSize = resolve$5([timeOpts.stepSize, timeOpts.unitStepSize, 1]);
14396                var weekday = minor === 'week' ? timeOpts.isoWeekday : false;
14397                var first = min;
14398                var ticks = [];
14399                var time;
14400
14401                // For 'week' unit, handle the first day of week option
14402                if (weekday) {
14403                    first = +adapter.startOf(first, 'isoWeek', weekday);
14404                }
14405
14406                // Align first ticks on unit
14407                first = +adapter.startOf(first, weekday ? 'day' : minor);
14408
14409                // Prevent browser from freezing in case user options request millions of milliseconds
14410                if (adapter.diff(max, min, minor) > 100000 * stepSize) {
14411                    throw min + ' and ' + max + ' are too far apart with stepSize of ' + stepSize + ' ' + minor;
14412                }
14413
14414                for (time = first; time < max; time = +adapter.add(time, stepSize, minor)) {
14415                    ticks.push(time);
14416                }
14417
14418                if (time === max || options.bounds === 'ticks') {
14419                    ticks.push(time);
14420                }
14421
14422                return ticks;
14423            }
14424
14425            /**
14426             * Returns the start and end offsets from edges in the form of {start, end}
14427             * where each value is a relative width to the scale and ranges between 0 and 1.
14428             * They add extra margins on the both sides by scaling down the original scale.
14429             * Offsets are added when the `offset` option is true.
14430             */
14431            function computeOffsets(table, ticks, min, max, options) {
14432                var start = 0;
14433                var end = 0;
14434                var first, last;
14435
14436                if (options.offset && ticks.length) {
14437                    first = interpolate$1(table, 'time', ticks[0], 'pos');
14438                    if (ticks.length === 1) {
14439                        start = 1 - first;
14440                    } else {
14441                        start = (interpolate$1(table, 'time', ticks[1], 'pos') - first) / 2;
14442                    }
14443                    last = interpolate$1(table, 'time', ticks[ticks.length - 1], 'pos');
14444                    if (ticks.length === 1) {
14445                        end = last;
14446                    } else {
14447                        end = (last - interpolate$1(table, 'time', ticks[ticks.length - 2], 'pos')) / 2;
14448                    }
14449                }
14450
14451                return {start: start, end: end, factor: 1 / (start + 1 + end)};
14452            }
14453
14454            function setMajorTicks(scale, ticks, map, majorUnit) {
14455                var adapter = scale._adapter;
14456                var first = +adapter.startOf(ticks[0].value, majorUnit);
14457                var last = ticks[ticks.length - 1].value;
14458                var major, index;
14459
14460                for (major = first; major <= last; major = +adapter.add(major, 1, majorUnit)) {
14461                    index = map[major];
14462                    if (index >= 0) {
14463                        ticks[index].major = true;
14464                    }
14465                }
14466                return ticks;
14467            }
14468
14469            function ticksFromTimestamps(scale, values, majorUnit) {
14470                var ticks = [];
14471                var map = {};
14472                var ilen = values.length;
14473                var i, value;
14474
14475                for (i = 0; i < ilen; ++i) {
14476                    value = values[i];
14477                    map[value] = i;
14478
14479                    ticks.push({
14480                        value: value,
14481                        major: false
14482                    });
14483                }
14484
14485                // We set the major ticks separately from the above loop because calling startOf for every tick
14486                // is expensive when there is a large number of ticks
14487                return (ilen === 0 || !majorUnit) ? ticks : setMajorTicks(scale, ticks, map, majorUnit);
14488            }
14489
14490            var defaultConfig$4 = {
14491                position: 'bottom',
14492
14493                /**
14494                 * Data distribution along the scale:
14495                 * - 'linear': data are spread according to their time (distances can vary),
14496                 * - 'series': data are spread at the same distance from each other.
14497                 * @see https://github.com/chartjs/Chart.js/pull/4507
14498                 * @since 2.7.0
14499                 */
14500                distribution: 'linear',
14501
14502                /**
14503                 * Scale boundary strategy (bypassed by min/max time options)
14504                 * - `data`: make sure data are fully visible, ticks outside are removed
14505                 * - `ticks`: make sure ticks are fully visible, data outside are truncated
14506                 * @see https://github.com/chartjs/Chart.js/pull/4556
14507                 * @since 2.7.0
14508                 */
14509                bounds: 'data',
14510
14511                adapters: {},
14512                time: {
14513                    parser: false, // false == a pattern string from https://momentjs.com/docs/#/parsing/string-format/ or a custom callback that converts its argument to a moment
14514                    unit: false, // false == automatic or override with week, month, year, etc.
14515                    round: false, // none, or override with week, month, year, etc.
14516                    displayFormat: false, // DEPRECATED
14517                    isoWeekday: false, // override week start day - see https://momentjs.com/docs/#/get-set/iso-weekday/
14518                    minUnit: 'millisecond',
14519                    displayFormats: {}
14520                },
14521                ticks: {
14522                    autoSkip: false,
14523
14524                    /**
14525                     * Ticks generation input values:
14526                     * - 'auto': generates "optimal" ticks based on scale size and time options.
14527                     * - 'data': generates ticks from data (including labels from data {t|x|y} objects).
14528                     * - 'labels': generates ticks from user given `data.labels` values ONLY.
14529                     * @see https://github.com/chartjs/Chart.js/pull/4507
14530                     * @since 2.7.0
14531                     */
14532                    source: 'auto',
14533
14534                    major: {
14535                        enabled: false
14536                    }
14537                }
14538            };
14539
14540            var scale_time = core_scale.extend({
14541                initialize: function () {
14542                    this.mergeTicksOptions();
14543                    core_scale.prototype.initialize.call(this);
14544                },
14545
14546                update: function () {
14547                    var me = this;
14548                    var options = me.options;
14549                    var time = options.time || (options.time = {});
14550                    var adapter = me._adapter = new core_adapters._date(options.adapters.date);
14551
14552                    // DEPRECATIONS: output a message only one time per update
14553                    deprecated$1('time scale', time.format, 'time.format', 'time.parser');
14554                    deprecated$1('time scale', time.min, 'time.min', 'ticks.min');
14555                    deprecated$1('time scale', time.max, 'time.max', 'ticks.max');
14556
14557                    // Backward compatibility: before introducing adapter, `displayFormats` was
14558                    // supposed to contain *all* unit/string pairs but this can't be resolved
14559                    // when loading the scale (adapters are loaded afterward), so let's populate
14560                    // missing formats on update
14561                    helpers$1.mergeIf(time.displayFormats, adapter.formats());
14562
14563                    return core_scale.prototype.update.apply(me, arguments);
14564                },
14565
14566                /**
14567                 * Allows data to be referenced via 't' attribute
14568                 */
14569                getRightValue: function (rawValue) {
14570                    if (rawValue && rawValue.t !== undefined) {
14571                        rawValue = rawValue.t;
14572                    }
14573                    return core_scale.prototype.getRightValue.call(this, rawValue);
14574                },
14575
14576                determineDataLimits: function () {
14577                    var me = this;
14578                    var chart = me.chart;
14579                    var adapter = me._adapter;
14580                    var options = me.options;
14581                    var unit = options.time.unit || 'day';
14582                    var min = MAX_INTEGER;
14583                    var max = MIN_INTEGER;
14584                    var timestamps = [];
14585                    var datasets = [];
14586                    var labels = [];
14587                    var i, j, ilen, jlen, data, timestamp, labelsAdded;
14588                    var dataLabels = me._getLabels();
14589
14590                    for (i = 0, ilen = dataLabels.length; i < ilen; ++i) {
14591                        labels.push(parse(me, dataLabels[i]));
14592                    }
14593
14594                    for (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) {
14595                        if (chart.isDatasetVisible(i)) {
14596                            data = chart.data.datasets[i].data;
14597
14598                            // Let's consider that all data have the same format.
14599                            if (helpers$1.isObject(data[0])) {
14600                                datasets[i] = [];
14601
14602                                for (j = 0, jlen = data.length; j < jlen; ++j) {
14603                                    timestamp = parse(me, data[j]);
14604                                    timestamps.push(timestamp);
14605                                    datasets[i][j] = timestamp;
14606                                }
14607                            } else {
14608                                datasets[i] = labels.slice(0);
14609                                if (!labelsAdded) {
14610                                    timestamps = timestamps.concat(labels);
14611                                    labelsAdded = true;
14612                                }
14613                            }
14614                        } else {
14615                            datasets[i] = [];
14616                        }
14617                    }
14618
14619                    if (labels.length) {
14620                        min = Math.min(min, labels[0]);
14621                        max = Math.max(max, labels[labels.length - 1]);
14622                    }
14623
14624                    if (timestamps.length) {
14625                        timestamps = ilen > 1 ? arrayUnique(timestamps).sort(sorter) : timestamps.sort(sorter);
14626                        min = Math.min(min, timestamps[0]);
14627                        max = Math.max(max, timestamps[timestamps.length - 1]);
14628                    }
14629
14630                    min = parse(me, getMin(options)) || min;
14631                    max = parse(me, getMax(options)) || max;
14632
14633                    // In case there is no valid min/max, set limits based on unit time option
14634                    min = min === MAX_INTEGER ? +adapter.startOf(Date.now(), unit) : min;
14635                    max = max === MIN_INTEGER ? +adapter.endOf(Date.now(), unit) + 1 : max;
14636
14637                    // Make sure that max is strictly higher than min (required by the lookup table)
14638                    me.min = Math.min(min, max);
14639                    me.max = Math.max(min + 1, max);
14640
14641                    // PRIVATE
14642                    me._table = [];
14643                    me._timestamps = {
14644                        data: timestamps,
14645                        datasets: datasets,
14646                        labels: labels
14647                    };
14648                },
14649
14650                buildTicks: function () {
14651                    var me = this;
14652                    var min = me.min;
14653                    var max = me.max;
14654                    var options = me.options;
14655                    var tickOpts = options.ticks;
14656                    var timeOpts = options.time;
14657                    var timestamps = me._timestamps;
14658                    var ticks = [];
14659                    var capacity = me.getLabelCapacity(min);
14660                    var source = tickOpts.source;
14661                    var distribution = options.distribution;
14662                    var i, ilen, timestamp;
14663
14664                    if (source === 'data' || (source === 'auto' && distribution === 'series')) {
14665                        timestamps = timestamps.data;
14666                    } else if (source === 'labels') {
14667                        timestamps = timestamps.labels;
14668                    } else {
14669                        timestamps = generate(me, min, max, capacity);
14670                    }
14671
14672                    if (options.bounds === 'ticks' && timestamps.length) {
14673                        min = timestamps[0];
14674                        max = timestamps[timestamps.length - 1];
14675                    }
14676
14677                    // Enforce limits with user min/max options
14678                    min = parse(me, getMin(options)) || min;
14679                    max = parse(me, getMax(options)) || max;
14680
14681                    // Remove ticks outside the min/max range
14682                    for (i = 0, ilen = timestamps.length; i < ilen; ++i) {
14683                        timestamp = timestamps[i];
14684                        if (timestamp >= min && timestamp <= max) {
14685                            ticks.push(timestamp);
14686                        }
14687                    }
14688
14689                    me.min = min;
14690                    me.max = max;
14691
14692                    // PRIVATE
14693                    // determineUnitForFormatting relies on the number of ticks so we don't use it when
14694                    // autoSkip is enabled because we don't yet know what the final number of ticks will be
14695                    me._unit = timeOpts.unit || (tickOpts.autoSkip
14696                        ? determineUnitForAutoTicks(timeOpts.minUnit, me.min, me.max, capacity)
14697                        : determineUnitForFormatting(me, ticks.length, timeOpts.minUnit, me.min, me.max));
14698                    me._majorUnit = !tickOpts.major.enabled || me._unit === 'year' ? undefined
14699                        : determineMajorUnit(me._unit);
14700                    me._table = buildLookupTable(me._timestamps.data, min, max, distribution);
14701                    me._offsets = computeOffsets(me._table, ticks, min, max, options);
14702
14703                    if (tickOpts.reverse) {
14704                        ticks.reverse();
14705                    }
14706
14707                    return ticksFromTimestamps(me, ticks, me._majorUnit);
14708                },
14709
14710                getLabelForIndex: function (index, datasetIndex) {
14711                    var me = this;
14712                    var adapter = me._adapter;
14713                    var data = me.chart.data;
14714                    var timeOpts = me.options.time;
14715                    var label = data.labels && index < data.labels.length ? data.labels[index] : '';
14716                    var value = data.datasets[datasetIndex].data[index];
14717
14718                    if (helpers$1.isObject(value)) {
14719                        label = me.getRightValue(value);
14720                    }
14721                    if (timeOpts.tooltipFormat) {
14722                        return adapter.format(toTimestamp(me, label), timeOpts.tooltipFormat);
14723                    }
14724                    if (typeof label === 'string') {
14725                        return label;
14726                    }
14727                    return adapter.format(toTimestamp(me, label), timeOpts.displayFormats.datetime);
14728                },
14729
14730                /**
14731                 * Function to format an individual tick mark
14732                 * @private
14733                 */
14734                tickFormatFunction: function (time, index, ticks, format) {
14735                    var me = this;
14736                    var adapter = me._adapter;
14737                    var options = me.options;
14738                    var formats = options.time.displayFormats;
14739                    var minorFormat = formats[me._unit];
14740                    var majorUnit = me._majorUnit;
14741                    var majorFormat = formats[majorUnit];
14742                    var tick = ticks[index];
14743                    var tickOpts = options.ticks;
14744                    var major = majorUnit && majorFormat && tick && tick.major;
14745                    var label = adapter.format(time, format ? format : major ? majorFormat : minorFormat);
14746                    var nestedTickOpts = major ? tickOpts.major : tickOpts.minor;
14747                    var formatter = resolve$5([
14748                        nestedTickOpts.callback,
14749                        nestedTickOpts.userCallback,
14750                        tickOpts.callback,
14751                        tickOpts.userCallback
14752                    ]);
14753
14754                    return formatter ? formatter(label, index, ticks) : label;
14755                },
14756
14757                convertTicksToLabels: function (ticks) {
14758                    var labels = [];
14759                    var i, ilen;
14760
14761                    for (i = 0, ilen = ticks.length; i < ilen; ++i) {
14762                        labels.push(this.tickFormatFunction(ticks[i].value, i, ticks));
14763                    }
14764
14765                    return labels;
14766                },
14767
14768                /**
14769                 * @private
14770                 */
14771                getPixelForOffset: function (time) {
14772                    var me = this;
14773                    var offsets = me._offsets;
14774                    var pos = interpolate$1(me._table, 'time', time, 'pos');
14775                    return me.getPixelForDecimal((offsets.start + pos) * offsets.factor);
14776                },
14777
14778                getPixelForValue: function (value, index, datasetIndex) {
14779                    var me = this;
14780                    var time = null;
14781
14782                    if (index !== undefined && datasetIndex !== undefined) {
14783                        time = me._timestamps.datasets[datasetIndex][index];
14784                    }
14785
14786                    if (time === null) {
14787                        time = parse(me, value);
14788                    }
14789
14790                    if (time !== null) {
14791                        return me.getPixelForOffset(time);
14792                    }
14793                },
14794
14795                getPixelForTick: function (index) {
14796                    var ticks = this.getTicks();
14797                    return index >= 0 && index < ticks.length ?
14798                        this.getPixelForOffset(ticks[index].value) :
14799                        null;
14800                },
14801
14802                getValueForPixel: function (pixel) {
14803                    var me = this;
14804                    var offsets = me._offsets;
14805                    var pos = me.getDecimalForPixel(pixel) / offsets.factor - offsets.end;
14806                    var time = interpolate$1(me._table, 'pos', pos, 'time');
14807
14808                    // DEPRECATION, we should return time directly
14809                    return me._adapter._create(time);
14810                },
14811
14812                /**
14813                 * @private
14814                 */
14815                _getLabelSize: function (label) {
14816                    var me = this;
14817                    var ticksOpts = me.options.ticks;
14818                    var tickLabelWidth = me.ctx.measureText(label).width;
14819                    var angle = helpers$1.toRadians(me.isHorizontal() ? ticksOpts.maxRotation : ticksOpts.minRotation);
14820                    var cosRotation = Math.cos(angle);
14821                    var sinRotation = Math.sin(angle);
14822                    var tickFontSize = valueOrDefault$d(ticksOpts.fontSize, core_defaults.global.defaultFontSize);
14823
14824                    return {
14825                        w: (tickLabelWidth * cosRotation) + (tickFontSize * sinRotation),
14826                        h: (tickLabelWidth * sinRotation) + (tickFontSize * cosRotation)
14827                    };
14828                },
14829
14830                /**
14831                 * Crude approximation of what the label width might be
14832                 * @private
14833                 */
14834                getLabelWidth: function (label) {
14835                    return this._getLabelSize(label).w;
14836                },
14837
14838                /**
14839                 * @private
14840                 */
14841                getLabelCapacity: function (exampleTime) {
14842                    var me = this;
14843                    var timeOpts = me.options.time;
14844                    var displayFormats = timeOpts.displayFormats;
14845
14846                    // pick the longest format (milliseconds) for guestimation
14847                    var format = displayFormats[timeOpts.unit] || displayFormats.millisecond;
14848                    var exampleLabel = me.tickFormatFunction(exampleTime, 0, ticksFromTimestamps(me, [exampleTime], me._majorUnit), format);
14849                    var size = me._getLabelSize(exampleLabel);
14850                    var capacity = Math.floor(me.isHorizontal() ? me.width / size.w : me.height / size.h);
14851
14852                    if (me.options.offset) {
14853                        capacity--;
14854                    }
14855
14856                    return capacity > 0 ? capacity : 1;
14857                }
14858            });
14859
14860// INTERNAL: static default options, registered in src/index.js
14861            var _defaults$4 = defaultConfig$4;
14862            scale_time._defaults = _defaults$4;
14863
14864            var scales = {
14865                category: scale_category,
14866                linear: scale_linear,
14867                logarithmic: scale_logarithmic,
14868                radialLinear: scale_radialLinear,
14869                time: scale_time
14870            };
14871
14872            var FORMATS = {
14873                datetime: 'MMM D, YYYY, h:mm:ss a',
14874                millisecond: 'h:mm:ss.SSS a',
14875                second: 'h:mm:ss a',
14876                minute: 'h:mm a',
14877                hour: 'hA',
14878                day: 'MMM D',
14879                week: 'll',
14880                month: 'MMM YYYY',
14881                quarter: '[Q]Q - YYYY',
14882                year: 'YYYY'
14883            };
14884
14885            core_adapters._date.override(typeof moment === 'function' ? {
14886                _id: 'moment', // DEBUG ONLY
14887
14888                formats: function () {
14889                    return FORMATS;
14890                },
14891
14892                parse: function (value, format) {
14893                    if (typeof value === 'string' && typeof format === 'string') {
14894                        value = moment(value, format);
14895                    } else if (!(value instanceof moment)) {
14896                        value = moment(value);
14897                    }
14898                    return value.isValid() ? value.valueOf() : null;
14899                },
14900
14901                format: function (time, format) {
14902                    return moment(time).format(format);
14903                },
14904
14905                add: function (time, amount, unit) {
14906                    return moment(time).add(amount, unit).valueOf();
14907                },
14908
14909                diff: function (max, min, unit) {
14910                    return moment(max).diff(moment(min), unit);
14911                },
14912
14913                startOf: function (time, unit, weekday) {
14914                    time = moment(time);
14915                    if (unit === 'isoWeek') {
14916                        return time.isoWeekday(weekday).valueOf();
14917                    }
14918                    return time.startOf(unit).valueOf();
14919                },
14920
14921                endOf: function (time, unit) {
14922                    return moment(time).endOf(unit).valueOf();
14923                },
14924
14925                // DEPRECATIONS
14926
14927                /**
14928                 * Provided for backward compatibility with scale.getValueForPixel().
14929                 * @deprecated since version 2.8.0
14930                 * @todo remove at version 3
14931                 * @private
14932                 */
14933                _create: function (time) {
14934                    return moment(time);
14935                },
14936            } : {});
14937
14938            core_defaults._set('global', {
14939                plugins: {
14940                    filler: {
14941                        propagate: true
14942                    }
14943                }
14944            });
14945
14946            var mappers = {
14947                dataset: function (source) {
14948                    var index = source.fill;
14949                    var chart = source.chart;
14950                    var meta = chart.getDatasetMeta(index);
14951                    var visible = meta && chart.isDatasetVisible(index);
14952                    var points = (visible && meta.dataset._children) || [];
14953                    var length = points.length || 0;
14954
14955                    return !length ? null : function (point, i) {
14956                        return (i < length && points[i]._view) || null;
14957                    };
14958                },
14959
14960                boundary: function (source) {
14961                    var boundary = source.boundary;
14962                    var x = boundary ? boundary.x : null;
14963                    var y = boundary ? boundary.y : null;
14964
14965                    if (helpers$1.isArray(boundary)) {
14966                        return function (point, i) {
14967                            return boundary[i];
14968                        };
14969                    }
14970
14971                    return function (point) {
14972                        return {
14973                            x: x === null ? point.x : x,
14974                            y: y === null ? point.y : y,
14975                        };
14976                    };
14977                }
14978            };
14979
14980// @todo if (fill[0] === '#')
14981            function decodeFill(el, index, count) {
14982                var model = el._model || {};
14983                var fill = model.fill;
14984                var target;
14985
14986                if (fill === undefined) {
14987                    fill = !!model.backgroundColor;
14988                }
14989
14990                if (fill === false || fill === null) {
14991                    return false;
14992                }
14993
14994                if (fill === true) {
14995                    return 'origin';
14996                }
14997
14998                target = parseFloat(fill, 10);
14999                if (isFinite(target) && Math.floor(target) === target) {
15000                    if (fill[0] === '-' || fill[0] === '+') {
15001                        target = index + target;
15002                    }
15003
15004                    if (target === index || target < 0 || target >= count) {
15005                        return false;
15006                    }
15007
15008                    return target;
15009                }
15010
15011                switch (fill) {
15012                    // compatibility
15013                    case 'bottom':
15014                        return 'start';
15015                    case 'top':
15016                        return 'end';
15017                    case 'zero':
15018                        return 'origin';
15019                    // supported boundaries
15020                    case 'origin':
15021                    case 'start':
15022                    case 'end':
15023                        return fill;
15024                    // invalid fill values
15025                    default:
15026                        return false;
15027                }
15028            }
15029
15030            function computeLinearBoundary(source) {
15031                var model = source.el._model || {};
15032                var scale = source.el._scale || {};
15033                var fill = source.fill;
15034                var target = null;
15035                var horizontal;
15036
15037                if (isFinite(fill)) {
15038                    return null;
15039                }
15040
15041                // Backward compatibility: until v3, we still need to support boundary values set on
15042                // the model (scaleTop, scaleBottom and scaleZero) because some external plugins and
15043                // controllers might still use it (e.g. the Smith chart).
15044
15045                if (fill === 'start') {
15046                    target = model.scaleBottom === undefined ? scale.bottom : model.scaleBottom;
15047                } else if (fill === 'end') {
15048                    target = model.scaleTop === undefined ? scale.top : model.scaleTop;
15049                } else if (model.scaleZero !== undefined) {
15050                    target = model.scaleZero;
15051                } else if (scale.getBasePixel) {
15052                    target = scale.getBasePixel();
15053                }
15054
15055                if (target !== undefined && target !== null) {
15056                    if (target.x !== undefined && target.y !== undefined) {
15057                        return target;
15058                    }
15059
15060                    if (helpers$1.isFinite(target)) {
15061                        horizontal = scale.isHorizontal();
15062                        return {
15063                            x: horizontal ? target : null,
15064                            y: horizontal ? null : target
15065                        };
15066                    }
15067                }
15068
15069                return null;
15070            }
15071
15072            function computeCircularBoundary(source) {
15073                var scale = source.el._scale;
15074                var options = scale.options;
15075                var length = scale.chart.data.labels.length;
15076                var fill = source.fill;
15077                var target = [];
15078                var start, end, center, i, point;
15079
15080                if (!length) {
15081                    return null;
15082                }
15083
15084                start = options.ticks.reverse ? scale.max : scale.min;
15085                end = options.ticks.reverse ? scale.min : scale.max;
15086                center = scale.getPointPositionForValue(0, start);
15087                for (i = 0; i < length; ++i) {
15088                    point = fill === 'start' || fill === 'end'
15089                        ? scale.getPointPositionForValue(i, fill === 'start' ? start : end)
15090                        : scale.getBasePosition(i);
15091                    if (options.gridLines.circular) {
15092                        point.cx = center.x;
15093                        point.cy = center.y;
15094                        point.angle = scale.getIndexAngle(i) - Math.PI / 2;
15095                    }
15096                    target.push(point);
15097                }
15098                return target;
15099            }
15100
15101            function computeBoundary(source) {
15102                var scale = source.el._scale || {};
15103
15104                if (scale.getPointPositionForValue) {
15105                    return computeCircularBoundary(source);
15106                }
15107                return computeLinearBoundary(source);
15108            }
15109
15110            function resolveTarget(sources, index, propagate) {
15111                var source = sources[index];
15112                var fill = source.fill;
15113                var visited = [index];
15114                var target;
15115
15116                if (!propagate) {
15117                    return fill;
15118                }
15119
15120                while (fill !== false && visited.indexOf(fill) === -1) {
15121                    if (!isFinite(fill)) {
15122                        return fill;
15123                    }
15124
15125                    target = sources[fill];
15126                    if (!target) {
15127                        return false;
15128                    }
15129
15130                    if (target.visible) {
15131                        return fill;
15132                    }
15133
15134                    visited.push(fill);
15135                    fill = target.fill;
15136                }
15137
15138                return false;
15139            }
15140
15141            function createMapper(source) {
15142                var fill = source.fill;
15143                var type = 'dataset';
15144
15145                if (fill === false) {
15146                    return null;
15147                }
15148
15149                if (!isFinite(fill)) {
15150                    type = 'boundary';
15151                }
15152
15153                return mappers[type](source);
15154            }
15155
15156            function isDrawable(point) {
15157                return point && !point.skip;
15158            }
15159
15160            function drawArea(ctx, curve0, curve1, len0, len1) {
15161                var i, cx, cy, r;
15162
15163                if (!len0 || !len1) {
15164                    return;
15165                }
15166
15167                // building first area curve (normal)
15168                ctx.moveTo(curve0[0].x, curve0[0].y);
15169                for (i = 1; i < len0; ++i) {
15170                    helpers$1.canvas.lineTo(ctx, curve0[i - 1], curve0[i]);
15171                }
15172
15173                if (curve1[0].angle !== undefined) {
15174                    cx = curve1[0].cx;
15175                    cy = curve1[0].cy;
15176                    r = Math.sqrt(Math.pow(curve1[0].x - cx, 2) + Math.pow(curve1[0].y - cy, 2));
15177                    for (i = len1 - 1; i > 0; --i) {
15178                        ctx.arc(cx, cy, r, curve1[i].angle, curve1[i - 1].angle, true);
15179                    }
15180                    return;
15181                }
15182
15183                // joining the two area curves
15184                ctx.lineTo(curve1[len1 - 1].x, curve1[len1 - 1].y);
15185
15186                // building opposite area curve (reverse)
15187                for (i = len1 - 1; i > 0; --i) {
15188                    helpers$1.canvas.lineTo(ctx, curve1[i], curve1[i - 1], true);
15189                }
15190            }
15191
15192            function doFill(ctx, points, mapper, view, color, loop) {
15193                var count = points.length;
15194                var span = view.spanGaps;
15195                var curve0 = [];
15196                var curve1 = [];
15197                var len0 = 0;
15198                var len1 = 0;
15199                var i, ilen, index, p0, p1, d0, d1, loopOffset;
15200
15201                ctx.beginPath();
15202
15203                for (i = 0, ilen = count; i < ilen; ++i) {
15204                    index = i % count;
15205                    p0 = points[index]._view;
15206                    p1 = mapper(p0, index, view);
15207                    d0 = isDrawable(p0);
15208                    d1 = isDrawable(p1);
15209
15210                    if (loop && loopOffset === undefined && d0) {
15211                        loopOffset = i + 1;
15212                        ilen = count + loopOffset;
15213                    }
15214
15215                    if (d0 && d1) {
15216                        len0 = curve0.push(p0);
15217                        len1 = curve1.push(p1);
15218                    } else if (len0 && len1) {
15219                        if (!span) {
15220                            drawArea(ctx, curve0, curve1, len0, len1);
15221                            len0 = len1 = 0;
15222                            curve0 = [];
15223                            curve1 = [];
15224                        } else {
15225                            if (d0) {
15226                                curve0.push(p0);
15227                            }
15228                            if (d1) {
15229                                curve1.push(p1);
15230                            }
15231                        }
15232                    }
15233                }
15234
15235                drawArea(ctx, curve0, curve1, len0, len1);
15236
15237                ctx.closePath();
15238                ctx.fillStyle = color;
15239                ctx.fill();
15240            }
15241
15242            var plugin_filler = {
15243                id: 'filler',
15244
15245                afterDatasetsUpdate: function (chart, options) {
15246                    var count = (chart.data.datasets || []).length;
15247                    var propagate = options.propagate;
15248                    var sources = [];
15249                    var meta, i, el, source;
15250
15251                    for (i = 0; i < count; ++i) {
15252                        meta = chart.getDatasetMeta(i);
15253                        el = meta.dataset;
15254                        source = null;
15255
15256                        if (el && el._model && el instanceof elements.Line) {
15257                            source = {
15258                                visible: chart.isDatasetVisible(i),
15259                                fill: decodeFill(el, i, count),
15260                                chart: chart,
15261                                el: el
15262                            };
15263                        }
15264
15265                        meta.$filler = source;
15266                        sources.push(source);
15267                    }
15268
15269                    for (i = 0; i < count; ++i) {
15270                        source = sources[i];
15271                        if (!source) {
15272                            continue;
15273                        }
15274
15275                        source.fill = resolveTarget(sources, i, propagate);
15276                        source.boundary = computeBoundary(source);
15277                        source.mapper = createMapper(source);
15278                    }
15279                },
15280
15281                beforeDatasetsDraw: function (chart) {
15282                    var metasets = chart._getSortedVisibleDatasetMetas();
15283                    var ctx = chart.ctx;
15284                    var meta, i, el, view, points, mapper, color;
15285
15286                    for (i = metasets.length - 1; i >= 0; --i) {
15287                        meta = metasets[i].$filler;
15288
15289                        if (!meta || !meta.visible) {
15290                            continue;
15291                        }
15292
15293                        el = meta.el;
15294                        view = el._view;
15295                        points = el._children || [];
15296                        mapper = meta.mapper;
15297                        color = view.backgroundColor || core_defaults.global.defaultColor;
15298
15299                        if (mapper && color && points.length) {
15300                            helpers$1.canvas.clipArea(ctx, chart.chartArea);
15301                            doFill(ctx, points, mapper, view, color, el._loop);
15302                            helpers$1.canvas.unclipArea(ctx);
15303                        }
15304                    }
15305                }
15306            };
15307
15308            var getRtlHelper$1 = helpers$1.rtl.getRtlAdapter;
15309            var noop$1 = helpers$1.noop;
15310            var valueOrDefault$e = helpers$1.valueOrDefault;
15311
15312            core_defaults._set('global', {
15313                legend: {
15314                    display: true,
15315                    position: 'top',
15316                    align: 'center',
15317                    fullWidth: true,
15318                    reverse: false,
15319                    weight: 1000,
15320
15321                    // a callback that will handle
15322                    onClick: function (e, legendItem) {
15323                        var index = legendItem.datasetIndex;
15324                        var ci = this.chart;
15325                        var meta = ci.getDatasetMeta(index);
15326
15327                        // See controller.isDatasetVisible comment
15328                        meta.hidden = meta.hidden === null ? !ci.data.datasets[index].hidden : null;
15329
15330                        // We hid a dataset ... rerender the chart
15331                        ci.update();
15332                    },
15333
15334                    onHover: null,
15335                    onLeave: null,
15336
15337                    labels: {
15338                        boxWidth: 40,
15339                        padding: 10,
15340                        // Generates labels shown in the legend
15341                        // Valid properties to return:
15342                        // text : text to display
15343                        // fillStyle : fill of coloured box
15344                        // strokeStyle: stroke of coloured box
15345                        // hidden : if this legend item refers to a hidden item
15346                        // lineCap : cap style for line
15347                        // lineDash
15348                        // lineDashOffset :
15349                        // lineJoin :
15350                        // lineWidth :
15351                        generateLabels: function (chart) {
15352                            var datasets = chart.data.datasets;
15353                            var options = chart.options.legend || {};
15354                            var usePointStyle = options.labels && options.labels.usePointStyle;
15355
15356                            return chart._getSortedDatasetMetas().map(function (meta) {
15357                                var style = meta.controller.getStyle(usePointStyle ? 0 : undefined);
15358
15359                                return {
15360                                    text: datasets[meta.index].label,
15361                                    fillStyle: style.backgroundColor,
15362                                    hidden: !chart.isDatasetVisible(meta.index),
15363                                    lineCap: style.borderCapStyle,
15364                                    lineDash: style.borderDash,
15365                                    lineDashOffset: style.borderDashOffset,
15366                                    lineJoin: style.borderJoinStyle,
15367                                    lineWidth: style.borderWidth,
15368                                    strokeStyle: style.borderColor,
15369                                    pointStyle: style.pointStyle,
15370                                    rotation: style.rotation,
15371
15372                                    // Below is extra data used for toggling the datasets
15373                                    datasetIndex: meta.index
15374                                };
15375                            }, this);
15376                        }
15377                    }
15378                },
15379
15380                legendCallback: function (chart) {
15381                    var list = document.createElement('ul');
15382                    var datasets = chart.data.datasets;
15383                    var i, ilen, listItem, listItemSpan;
15384
15385                    list.setAttribute('class', chart.id + '-legend');
15386
15387                    for (i = 0, ilen = datasets.length; i < ilen; i++) {
15388                        listItem = list.appendChild(document.createElement('li'));
15389                        listItemSpan = listItem.appendChild(document.createElement('span'));
15390                        listItemSpan.style.backgroundColor = datasets[i].backgroundColor;
15391                        if (datasets[i].label) {
15392                            listItem.appendChild(document.createTextNode(datasets[i].label));
15393                        }
15394                    }
15395
15396                    return list.outerHTML;
15397                }
15398            });
15399
15400            /**
15401             * Helper function to get the box width based on the usePointStyle option
15402             * @param {object} labelopts - the label options on the legend
15403             * @param {number} fontSize - the label font size
15404             * @return {number} width of the color box area
15405             */
15406            function getBoxWidth(labelOpts, fontSize) {
15407                return labelOpts.usePointStyle && labelOpts.boxWidth > fontSize ?
15408                    fontSize :
15409                    labelOpts.boxWidth;
15410            }
15411
15412            /**
15413             * IMPORTANT: this class is exposed publicly as Chart.Legend, backward compatibility required!
15414             */
15415            var Legend = core_element.extend({
15416
15417                initialize: function (config) {
15418                    var me = this;
15419                    helpers$1.extend(me, config);
15420
15421                    // Contains hit boxes for each dataset (in dataset order)
15422                    me.legendHitBoxes = [];
15423
15424                    /**
15425                     * @private
15426                     */
15427                    me._hoveredItem = null;
15428
15429                    // Are we in doughnut mode which has a different data type
15430                    me.doughnutMode = false;
15431                },
15432
15433                // These methods are ordered by lifecycle. Utilities then follow.
15434                // Any function defined here is inherited by all legend types.
15435                // Any function can be extended by the legend type
15436
15437                beforeUpdate: noop$1,
15438                update: function (maxWidth, maxHeight, margins) {
15439                    var me = this;
15440
15441                    // Update Lifecycle - Probably don't want to ever extend or overwrite this function ;)
15442                    me.beforeUpdate();
15443
15444                    // Absorb the master measurements
15445                    me.maxWidth = maxWidth;
15446                    me.maxHeight = maxHeight;
15447                    me.margins = margins;
15448
15449                    // Dimensions
15450                    me.beforeSetDimensions();
15451                    me.setDimensions();
15452                    me.afterSetDimensions();
15453                    // Labels
15454                    me.beforeBuildLabels();
15455                    me.buildLabels();
15456                    me.afterBuildLabels();
15457
15458                    // Fit
15459                    me.beforeFit();
15460                    me.fit();
15461                    me.afterFit();
15462                    //
15463                    me.afterUpdate();
15464
15465                    return me.minSize;
15466                },
15467                afterUpdate: noop$1,
15468
15469                //
15470
15471                beforeSetDimensions: noop$1,
15472                setDimensions: function () {
15473                    var me = this;
15474                    // Set the unconstrained dimension before label rotation
15475                    if (me.isHorizontal()) {
15476                        // Reset position before calculating rotation
15477                        me.width = me.maxWidth;
15478                        me.left = 0;
15479                        me.right = me.width;
15480                    } else {
15481                        me.height = me.maxHeight;
15482
15483                        // Reset position before calculating rotation
15484                        me.top = 0;
15485                        me.bottom = me.height;
15486                    }
15487
15488                    // Reset padding
15489                    me.paddingLeft = 0;
15490                    me.paddingTop = 0;
15491                    me.paddingRight = 0;
15492                    me.paddingBottom = 0;
15493
15494                    // Reset minSize
15495                    me.minSize = {
15496                        width: 0,
15497                        height: 0
15498                    };
15499                },
15500                afterSetDimensions: noop$1,
15501
15502                //
15503
15504                beforeBuildLabels: noop$1,
15505                buildLabels: function () {
15506                    var me = this;
15507                    var labelOpts = me.options.labels || {};
15508                    var legendItems = helpers$1.callback(labelOpts.generateLabels, [me.chart], me) || [];
15509
15510                    if (labelOpts.filter) {
15511                        legendItems = legendItems.filter(function (item) {
15512                            return labelOpts.filter(item, me.chart.data);
15513                        });
15514                    }
15515
15516                    if (me.options.reverse) {
15517                        legendItems.reverse();
15518                    }
15519
15520                    me.legendItems = legendItems;
15521                },
15522                afterBuildLabels: noop$1,
15523
15524                //
15525
15526                beforeFit: noop$1,
15527                fit: function () {
15528                    var me = this;
15529                    var opts = me.options;
15530                    var labelOpts = opts.labels;
15531                    var display = opts.display;
15532
15533                    var ctx = me.ctx;
15534
15535                    var labelFont = helpers$1.options._parseFont(labelOpts);
15536                    var fontSize = labelFont.size;
15537
15538                    // Reset hit boxes
15539                    var hitboxes = me.legendHitBoxes = [];
15540
15541                    var minSize = me.minSize;
15542                    var isHorizontal = me.isHorizontal();
15543
15544                    if (isHorizontal) {
15545                        minSize.width = me.maxWidth; // fill all the width
15546                        minSize.height = display ? 10 : 0;
15547                    } else {
15548                        minSize.width = display ? 10 : 0;
15549                        minSize.height = me.maxHeight; // fill all the height
15550                    }
15551
15552                    // Increase sizes here
15553                    if (!display) {
15554                        me.width = minSize.width = me.height = minSize.height = 0;
15555                        return;
15556                    }
15557                    ctx.font = labelFont.string;
15558
15559                    if (isHorizontal) {
15560                        // Labels
15561
15562                        // Width of each line of legend boxes. Labels wrap onto multiple lines when there are too many to fit on one
15563                        var lineWidths = me.lineWidths = [0];
15564                        var totalHeight = 0;
15565
15566                        ctx.textAlign = 'left';
15567                        ctx.textBaseline = 'middle';
15568
15569                        helpers$1.each(me.legendItems, function (legendItem, i) {
15570                            var boxWidth = getBoxWidth(labelOpts, fontSize);
15571                            var width = boxWidth + (fontSize / 2) + ctx.measureText(legendItem.text).width;
15572
15573                            if (i === 0 || lineWidths[lineWidths.length - 1] + width + 2 * labelOpts.padding > minSize.width) {
15574                                totalHeight += fontSize + labelOpts.padding;
15575                                lineWidths[lineWidths.length - (i > 0 ? 0 : 1)] = 0;
15576                            }
15577
15578                            // Store the hitbox width and height here. Final position will be updated in `draw`
15579                            hitboxes[i] = {
15580                                left: 0,
15581                                top: 0,
15582                                width: width,
15583                                height: fontSize
15584                            };
15585
15586                            lineWidths[lineWidths.length - 1] += width + labelOpts.padding;
15587                        });
15588
15589                        minSize.height += totalHeight;
15590
15591                    } else {
15592                        var vPadding = labelOpts.padding;
15593                        var columnWidths = me.columnWidths = [];
15594                        var columnHeights = me.columnHeights = [];
15595                        var totalWidth = labelOpts.padding;
15596                        var currentColWidth = 0;
15597                        var currentColHeight = 0;
15598
15599                        helpers$1.each(me.legendItems, function (legendItem, i) {
15600                            var boxWidth = getBoxWidth(labelOpts, fontSize);
15601                            var itemWidth = boxWidth + (fontSize / 2) + ctx.measureText(legendItem.text).width;
15602
15603                            // If too tall, go to new column
15604                            if (i > 0 && currentColHeight + fontSize + 2 * vPadding > minSize.height) {
15605                                totalWidth += currentColWidth + labelOpts.padding;
15606                                columnWidths.push(currentColWidth); // previous column width
15607                                columnHeights.push(currentColHeight);
15608                                currentColWidth = 0;
15609                                currentColHeight = 0;
15610                            }
15611
15612                            // Get max width
15613                            currentColWidth = Math.max(currentColWidth, itemWidth);
15614                            currentColHeight += fontSize + vPadding;
15615
15616                            // Store the hitbox width and height here. Final position will be updated in `draw`
15617                            hitboxes[i] = {
15618                                left: 0,
15619                                top: 0,
15620                                width: itemWidth,
15621                                height: fontSize
15622                            };
15623                        });
15624
15625                        totalWidth += currentColWidth;
15626                        columnWidths.push(currentColWidth);
15627                        columnHeights.push(currentColHeight);
15628                        minSize.width += totalWidth;
15629                    }
15630
15631                    me.width = minSize.width;
15632                    me.height = minSize.height;
15633                },
15634                afterFit: noop$1,
15635
15636                // Shared Methods
15637                isHorizontal: function () {
15638                    return this.options.position === 'top' || this.options.position === 'bottom';
15639                },
15640
15641                // Actually draw the legend on the canvas
15642                draw: function () {
15643                    var me = this;
15644                    var opts = me.options;
15645                    var labelOpts = opts.labels;
15646                    var globalDefaults = core_defaults.global;
15647                    var defaultColor = globalDefaults.defaultColor;
15648                    var lineDefault = globalDefaults.elements.line;
15649                    var legendHeight = me.height;
15650                    var columnHeights = me.columnHeights;
15651                    var legendWidth = me.width;
15652                    var lineWidths = me.lineWidths;
15653
15654                    if (!opts.display) {
15655                        return;
15656                    }
15657
15658                    var rtlHelper = getRtlHelper$1(opts.rtl, me.left, me.minSize.width);
15659                    var ctx = me.ctx;
15660                    var fontColor = valueOrDefault$e(labelOpts.fontColor, globalDefaults.defaultFontColor);
15661                    var labelFont = helpers$1.options._parseFont(labelOpts);
15662                    var fontSize = labelFont.size;
15663                    var cursor;
15664
15665                    // Canvas setup
15666                    ctx.textAlign = rtlHelper.textAlign('left');
15667                    ctx.textBaseline = 'middle';
15668                    ctx.lineWidth = 0.5;
15669                    ctx.strokeStyle = fontColor; // for strikethrough effect
15670                    ctx.fillStyle = fontColor; // render in correct colour
15671                    ctx.font = labelFont.string;
15672
15673                    var boxWidth = getBoxWidth(labelOpts, fontSize);
15674                    var hitboxes = me.legendHitBoxes;
15675
15676                    // current position
15677                    var drawLegendBox = function (x, y, legendItem) {
15678                        if (isNaN(boxWidth) || boxWidth <= 0) {
15679                            return;
15680                        }
15681
15682                        // Set the ctx for the box
15683                        ctx.save();
15684
15685                        var lineWidth = valueOrDefault$e(legendItem.lineWidth, lineDefault.borderWidth);
15686                        ctx.fillStyle = valueOrDefault$e(legendItem.fillStyle, defaultColor);
15687                        ctx.lineCap = valueOrDefault$e(legendItem.lineCap, lineDefault.borderCapStyle);
15688                        ctx.lineDashOffset = valueOrDefault$e(legendItem.lineDashOffset, lineDefault.borderDashOffset);
15689                        ctx.lineJoin = valueOrDefault$e(legendItem.lineJoin, lineDefault.borderJoinStyle);
15690                        ctx.lineWidth = lineWidth;
15691                        ctx.strokeStyle = valueOrDefault$e(legendItem.strokeStyle, defaultColor);
15692
15693                        if (ctx.setLineDash) {
15694                            // IE 9 and 10 do not support line dash
15695                            ctx.setLineDash(valueOrDefault$e(legendItem.lineDash, lineDefault.borderDash));
15696                        }
15697
15698                        if (labelOpts && labelOpts.usePointStyle) {
15699                            // Recalculate x and y for drawPoint() because its expecting
15700                            // x and y to be center of figure (instead of top left)
15701                            var radius = boxWidth * Math.SQRT2 / 2;
15702                            var centerX = rtlHelper.xPlus(x, boxWidth / 2);
15703                            var centerY = y + fontSize / 2;
15704
15705                            // Draw pointStyle as legend symbol
15706                            helpers$1.canvas.drawPoint(ctx, legendItem.pointStyle, radius, centerX, centerY, legendItem.rotation);
15707                        } else {
15708                            // Draw box as legend symbol
15709                            ctx.fillRect(rtlHelper.leftForLtr(x, boxWidth), y, boxWidth, fontSize);
15710                            if (lineWidth !== 0) {
15711                                ctx.strokeRect(rtlHelper.leftForLtr(x, boxWidth), y, boxWidth, fontSize);
15712                            }
15713                        }
15714
15715                        ctx.restore();
15716                    };
15717
15718                    var fillText = function (x, y, legendItem, textWidth) {
15719                        var halfFontSize = fontSize / 2;
15720                        var xLeft = rtlHelper.xPlus(x, boxWidth + halfFontSize);
15721                        var yMiddle = y + halfFontSize;
15722
15723                        ctx.fillText(legendItem.text, xLeft, yMiddle);
15724
15725                        if (legendItem.hidden) {
15726                            // Strikethrough the text if hidden
15727                            ctx.beginPath();
15728                            ctx.lineWidth = 2;
15729                            ctx.moveTo(xLeft, yMiddle);
15730                            ctx.lineTo(rtlHelper.xPlus(xLeft, textWidth), yMiddle);
15731                            ctx.stroke();
15732                        }
15733                    };
15734
15735                    var alignmentOffset = function (dimension, blockSize) {
15736                        switch (opts.align) {
15737                            case 'start':
15738                                return labelOpts.padding;
15739                            case 'end':
15740                                return dimension - blockSize;
15741                            default: // center
15742                                return (dimension - blockSize + labelOpts.padding) / 2;
15743                        }
15744                    };
15745
15746                    // Horizontal
15747                    var isHorizontal = me.isHorizontal();
15748                    if (isHorizontal) {
15749                        cursor = {
15750                            x: me.left + alignmentOffset(legendWidth, lineWidths[0]),
15751                            y: me.top + labelOpts.padding,
15752                            line: 0
15753                        };
15754                    } else {
15755                        cursor = {
15756                            x: me.left + labelOpts.padding,
15757                            y: me.top + alignmentOffset(legendHeight, columnHeights[0]),
15758                            line: 0
15759                        };
15760                    }
15761
15762                    helpers$1.rtl.overrideTextDirection(me.ctx, opts.textDirection);
15763
15764                    var itemHeight = fontSize + labelOpts.padding;
15765                    helpers$1.each(me.legendItems, function (legendItem, i) {
15766                        var textWidth = ctx.measureText(legendItem.text).width;
15767                        var width = boxWidth + (fontSize / 2) + textWidth;
15768                        var x = cursor.x;
15769                        var y = cursor.y;
15770
15771                        rtlHelper.setWidth(me.minSize.width);
15772
15773                        // Use (me.left + me.minSize.width) and (me.top + me.minSize.height)
15774                        // instead of me.right and me.bottom because me.width and me.height
15775                        // may have been changed since me.minSize was calculated
15776                        if (isHorizontal) {
15777                            if (i > 0 && x + width + labelOpts.padding > me.left + me.minSize.width) {
15778                                y = cursor.y += itemHeight;
15779                                cursor.line++;
15780                                x = cursor.x = me.left + alignmentOffset(legendWidth, lineWidths[cursor.line]);
15781                            }
15782                        } else if (i > 0 && y + itemHeight > me.top + me.minSize.height) {
15783                            x = cursor.x = x + me.columnWidths[cursor.line] + labelOpts.padding;
15784                            cursor.line++;
15785                            y = cursor.y = me.top + alignmentOffset(legendHeight, columnHeights[cursor.line]);
15786                        }
15787
15788                        var realX = rtlHelper.x(x);
15789
15790                        drawLegendBox(realX, y, legendItem);
15791
15792                        hitboxes[i].left = rtlHelper.leftForLtr(realX, hitboxes[i].width);
15793                        hitboxes[i].top = y;
15794
15795                        // Fill the actual label
15796                        fillText(realX, y, legendItem, textWidth);
15797
15798                        if (isHorizontal) {
15799                            cursor.x += width + labelOpts.padding;
15800                        } else {
15801                            cursor.y += itemHeight;
15802                        }
15803                    });
15804
15805                    helpers$1.rtl.restoreTextDirection(me.ctx, opts.textDirection);
15806                },
15807
15808                /**
15809                 * @private
15810                 */
15811                _getLegendItemAt: function (x, y) {
15812                    var me = this;
15813                    var i, hitBox, lh;
15814
15815                    if (x >= me.left && x <= me.right && y >= me.top && y <= me.bottom) {
15816                        // See if we are touching one of the dataset boxes
15817                        lh = me.legendHitBoxes;
15818                        for (i = 0; i < lh.length; ++i) {
15819                            hitBox = lh[i];
15820
15821                            if (x >= hitBox.left && x <= hitBox.left + hitBox.width && y >= hitBox.top && y <= hitBox.top + hitBox.height) {
15822                                // Touching an element
15823                                return me.legendItems[i];
15824                            }
15825                        }
15826                    }
15827
15828                    return null;
15829                },
15830
15831                /**
15832                 * Handle an event
15833                 * @private
15834                 * @param {IEvent} event - The event to handle
15835                 */
15836                handleEvent: function (e) {
15837                    var me = this;
15838                    var opts = me.options;
15839                    var type = e.type === 'mouseup' ? 'click' : e.type;
15840                    var hoveredItem;
15841
15842                    if (type === 'mousemove') {
15843                        if (!opts.onHover && !opts.onLeave) {
15844                            return;
15845                        }
15846                    } else if (type === 'click') {
15847                        if (!opts.onClick) {
15848                            return;
15849                        }
15850                    } else {
15851                        return;
15852                    }
15853
15854                    // Chart event already has relative position in it
15855                    hoveredItem = me._getLegendItemAt(e.x, e.y);
15856
15857                    if (type === 'click') {
15858                        if (hoveredItem && opts.onClick) {
15859                            // use e.native for backwards compatibility
15860                            opts.onClick.call(me, e.native, hoveredItem);
15861                        }
15862                    } else {
15863                        if (opts.onLeave && hoveredItem !== me._hoveredItem) {
15864                            if (me._hoveredItem) {
15865                                opts.onLeave.call(me, e.native, me._hoveredItem);
15866                            }
15867                            me._hoveredItem = hoveredItem;
15868                        }
15869
15870                        if (opts.onHover && hoveredItem) {
15871                            // use e.native for backwards compatibility
15872                            opts.onHover.call(me, e.native, hoveredItem);
15873                        }
15874                    }
15875                }
15876            });
15877
15878            function createNewLegendAndAttach(chart, legendOpts) {
15879                var legend = new Legend({
15880                    ctx: chart.ctx,
15881                    options: legendOpts,
15882                    chart: chart
15883                });
15884
15885                core_layouts.configure(chart, legend, legendOpts);
15886                core_layouts.addBox(chart, legend);
15887                chart.legend = legend;
15888            }
15889
15890            var plugin_legend = {
15891                id: 'legend',
15892
15893                /**
15894                 * Backward compatibility: since 2.1.5, the legend is registered as a plugin, making
15895                 * Chart.Legend obsolete. To avoid a breaking change, we export the Legend as part of
15896                 * the plugin, which one will be re-exposed in the chart.js file.
15897                 * https://github.com/chartjs/Chart.js/pull/2640
15898                 * @private
15899                 */
15900                _element: Legend,
15901
15902                beforeInit: function (chart) {
15903                    var legendOpts = chart.options.legend;
15904
15905                    if (legendOpts) {
15906                        createNewLegendAndAttach(chart, legendOpts);
15907                    }
15908                },
15909
15910                beforeUpdate: function (chart) {
15911                    var legendOpts = chart.options.legend;
15912                    var legend = chart.legend;
15913
15914                    if (legendOpts) {
15915                        helpers$1.mergeIf(legendOpts, core_defaults.global.legend);
15916
15917                        if (legend) {
15918                            core_layouts.configure(chart, legend, legendOpts);
15919                            legend.options = legendOpts;
15920                        } else {
15921                            createNewLegendAndAttach(chart, legendOpts);
15922                        }
15923                    } else if (legend) {
15924                        core_layouts.removeBox(chart, legend);
15925                        delete chart.legend;
15926                    }
15927                },
15928
15929                afterEvent: function (chart, e) {
15930                    var legend = chart.legend;
15931                    if (legend) {
15932                        legend.handleEvent(e);
15933                    }
15934                }
15935            };
15936
15937            var noop$2 = helpers$1.noop;
15938
15939            core_defaults._set('global', {
15940                title: {
15941                    display: false,
15942                    fontStyle: 'bold',
15943                    fullWidth: true,
15944                    padding: 10,
15945                    position: 'top',
15946                    text: '',
15947                    weight: 2000         // by default greater than legend (1000) to be above
15948                }
15949            });
15950
15951            /**
15952             * IMPORTANT: this class is exposed publicly as Chart.Legend, backward compatibility required!
15953             */
15954            var Title = core_element.extend({
15955                initialize: function (config) {
15956                    var me = this;
15957                    helpers$1.extend(me, config);
15958
15959                    // Contains hit boxes for each dataset (in dataset order)
15960                    me.legendHitBoxes = [];
15961                },
15962
15963                // These methods are ordered by lifecycle. Utilities then follow.
15964
15965                beforeUpdate: noop$2,
15966                update: function (maxWidth, maxHeight, margins) {
15967                    var me = this;
15968
15969                    // Update Lifecycle - Probably don't want to ever extend or overwrite this function ;)
15970                    me.beforeUpdate();
15971
15972                    // Absorb the master measurements
15973                    me.maxWidth = maxWidth;
15974                    me.maxHeight = maxHeight;
15975                    me.margins = margins;
15976
15977                    // Dimensions
15978                    me.beforeSetDimensions();
15979                    me.setDimensions();
15980                    me.afterSetDimensions();
15981                    // Labels
15982                    me.beforeBuildLabels();
15983                    me.buildLabels();
15984                    me.afterBuildLabels();
15985
15986                    // Fit
15987                    me.beforeFit();
15988                    me.fit();
15989                    me.afterFit();
15990                    //
15991                    me.afterUpdate();
15992
15993                    return me.minSize;
15994
15995                },
15996                afterUpdate: noop$2,
15997
15998                //
15999
16000                beforeSetDimensions: noop$2,
16001                setDimensions: function () {
16002                    var me = this;
16003                    // Set the unconstrained dimension before label rotation
16004                    if (me.isHorizontal()) {
16005                        // Reset position before calculating rotation
16006                        me.width = me.maxWidth;
16007                        me.left = 0;
16008                        me.right = me.width;
16009                    } else {
16010                        me.height = me.maxHeight;
16011
16012                        // Reset position before calculating rotation
16013                        me.top = 0;
16014                        me.bottom = me.height;
16015                    }
16016
16017                    // Reset padding
16018                    me.paddingLeft = 0;
16019                    me.paddingTop = 0;
16020                    me.paddingRight = 0;
16021                    me.paddingBottom = 0;
16022
16023                    // Reset minSize
16024                    me.minSize = {
16025                        width: 0,
16026                        height: 0
16027                    };
16028                },
16029                afterSetDimensions: noop$2,
16030
16031                //
16032
16033                beforeBuildLabels: noop$2,
16034                buildLabels: noop$2,
16035                afterBuildLabels: noop$2,
16036
16037                //
16038
16039                beforeFit: noop$2,
16040                fit: function () {
16041                    var me = this;
16042                    var opts = me.options;
16043                    var minSize = me.minSize = {};
16044                    var isHorizontal = me.isHorizontal();
16045                    var lineCount, textSize;
16046
16047                    if (!opts.display) {
16048                        me.width = minSize.width = me.height = minSize.height = 0;
16049                        return;
16050                    }
16051
16052                    lineCount = helpers$1.isArray(opts.text) ? opts.text.length : 1;
16053                    textSize = lineCount * helpers$1.options._parseFont(opts).lineHeight + opts.padding * 2;
16054
16055                    me.width = minSize.width = isHorizontal ? me.maxWidth : textSize;
16056                    me.height = minSize.height = isHorizontal ? textSize : me.maxHeight;
16057                },
16058                afterFit: noop$2,
16059
16060                // Shared Methods
16061                isHorizontal: function () {
16062                    var pos = this.options.position;
16063                    return pos === 'top' || pos === 'bottom';
16064                },
16065
16066                // Actually draw the title block on the canvas
16067                draw: function () {
16068                    var me = this;
16069                    var ctx = me.ctx;
16070                    var opts = me.options;
16071
16072                    if (!opts.display) {
16073                        return;
16074                    }
16075
16076                    var fontOpts = helpers$1.options._parseFont(opts);
16077                    var lineHeight = fontOpts.lineHeight;
16078                    var offset = lineHeight / 2 + opts.padding;
16079                    var rotation = 0;
16080                    var top = me.top;
16081                    var left = me.left;
16082                    var bottom = me.bottom;
16083                    var right = me.right;
16084                    var maxWidth, titleX, titleY;
16085
16086                    ctx.fillStyle = helpers$1.valueOrDefault(opts.fontColor, core_defaults.global.defaultFontColor); // render in correct colour
16087                    ctx.font = fontOpts.string;
16088
16089                    // Horizontal
16090                    if (me.isHorizontal()) {
16091                        titleX = left + ((right - left) / 2); // midpoint of the width
16092                        titleY = top + offset;
16093                        maxWidth = right - left;
16094                    } else {
16095                        titleX = opts.position === 'left' ? left + offset : right - offset;
16096                        titleY = top + ((bottom - top) / 2);
16097                        maxWidth = bottom - top;
16098                        rotation = Math.PI * (opts.position === 'left' ? -0.5 : 0.5);
16099                    }
16100
16101                    ctx.save();
16102                    ctx.translate(titleX, titleY);
16103                    ctx.rotate(rotation);
16104                    ctx.textAlign = 'center';
16105                    ctx.textBaseline = 'middle';
16106
16107                    var text = opts.text;
16108                    if (helpers$1.isArray(text)) {
16109                        var y = 0;
16110                        for (var i = 0; i < text.length; ++i) {
16111                            ctx.fillText(text[i], 0, y, maxWidth);
16112                            y += lineHeight;
16113                        }
16114                    } else {
16115                        ctx.fillText(text, 0, 0, maxWidth);
16116                    }
16117
16118                    ctx.restore();
16119                }
16120            });
16121
16122            function createNewTitleBlockAndAttach(chart, titleOpts) {
16123                var title = new Title({
16124                    ctx: chart.ctx,
16125                    options: titleOpts,
16126                    chart: chart
16127                });
16128
16129                core_layouts.configure(chart, title, titleOpts);
16130                core_layouts.addBox(chart, title);
16131                chart.titleBlock = title;
16132            }
16133
16134            var plugin_title = {
16135                id: 'title',
16136
16137                /**
16138                 * Backward compatibility: since 2.1.5, the title is registered as a plugin, making
16139                 * Chart.Title obsolete. To avoid a breaking change, we export the Title as part of
16140                 * the plugin, which one will be re-exposed in the chart.js file.
16141                 * https://github.com/chartjs/Chart.js/pull/2640
16142                 * @private
16143                 */
16144                _element: Title,
16145
16146                beforeInit: function (chart) {
16147                    var titleOpts = chart.options.title;
16148
16149                    if (titleOpts) {
16150                        createNewTitleBlockAndAttach(chart, titleOpts);
16151                    }
16152                },
16153
16154                beforeUpdate: function (chart) {
16155                    var titleOpts = chart.options.title;
16156                    var titleBlock = chart.titleBlock;
16157
16158                    if (titleOpts) {
16159                        helpers$1.mergeIf(titleOpts, core_defaults.global.title);
16160
16161                        if (titleBlock) {
16162                            core_layouts.configure(chart, titleBlock, titleOpts);
16163                            titleBlock.options = titleOpts;
16164                        } else {
16165                            createNewTitleBlockAndAttach(chart, titleOpts);
16166                        }
16167                    } else if (titleBlock) {
16168                        core_layouts.removeBox(chart, titleBlock);
16169                        delete chart.titleBlock;
16170                    }
16171                }
16172            };
16173
16174            var plugins = {};
16175            var filler = plugin_filler;
16176            var legend = plugin_legend;
16177            var title = plugin_title;
16178            plugins.filler = filler;
16179            plugins.legend = legend;
16180            plugins.title = title;
16181
16182            /**
16183             * @namespace Chart
16184             */
16185
16186
16187            core_controller.helpers = helpers$1;
16188
16189// @todo dispatch these helpers into appropriated helpers/helpers.* file and write unit tests!
16190            core_helpers();
16191
16192            core_controller._adapters = core_adapters;
16193            core_controller.Animation = core_animation;
16194            core_controller.animationService = core_animations;
16195            core_controller.controllers = controllers;
16196            core_controller.DatasetController = core_datasetController;
16197            core_controller.defaults = core_defaults;
16198            core_controller.Element = core_element;
16199            core_controller.elements = elements;
16200            core_controller.Interaction = core_interaction;
16201            core_controller.layouts = core_layouts;
16202            core_controller.platform = platform;
16203            core_controller.plugins = core_plugins;
16204            core_controller.Scale = core_scale;
16205            core_controller.scaleService = core_scaleService;
16206            core_controller.Ticks = core_ticks;
16207            core_controller.Tooltip = core_tooltip;
16208
16209// Register built-in scales
16210
16211            core_controller.helpers.each(scales, function (scale, type) {
16212                core_controller.scaleService.registerScaleType(type, scale, scale._defaults);
16213            });
16214
16215// Load to register built-in adapters (as side effects)
16216
16217
16218// Loading built-in plugins
16219
16220            for (var k in plugins) {
16221                if (plugins.hasOwnProperty(k)) {
16222                    core_controller.plugins.register(plugins[k]);
16223                }
16224            }
16225
16226            core_controller.platform.initialize();
16227
16228            var src = core_controller;
16229            if (typeof window !== 'undefined') {
16230                window.Chart = core_controller;
16231            }
16232
16233// DEPRECATIONS
16234
16235            /**
16236             * Provided for backward compatibility, not available anymore
16237             * @namespace Chart.Chart
16238             * @deprecated since version 2.8.0
16239             * @todo remove at version 3
16240             * @private
16241             */
16242            core_controller.Chart = core_controller;
16243
16244            /**
16245             * Provided for backward compatibility, not available anymore
16246             * @namespace Chart.Legend
16247             * @deprecated since version 2.1.5
16248             * @todo remove at version 3
16249             * @private
16250             */
16251            core_controller.Legend = plugins.legend._element;
16252
16253            /**
16254             * Provided for backward compatibility, not available anymore
16255             * @namespace Chart.Title
16256             * @deprecated since version 2.1.5
16257             * @todo remove at version 3
16258             * @private
16259             */
16260            core_controller.Title = plugins.title._element;
16261
16262            /**
16263             * Provided for backward compatibility, use Chart.plugins instead
16264             * @namespace Chart.pluginService
16265             * @deprecated since version 2.1.5
16266             * @todo remove at version 3
16267             * @private
16268             */
16269            core_controller.pluginService = core_controller.plugins;
16270
16271            /**
16272             * Provided for backward compatibility, inheriting from Chart.PlugingBase has no
16273             * effect, instead simply create/register plugins via plain JavaScript objects.
16274             * @interface Chart.PluginBase
16275             * @deprecated since version 2.5.0
16276             * @todo remove at version 3
16277             * @private
16278             */
16279            core_controller.PluginBase = core_controller.Element.extend({});
16280
16281            /**
16282             * Provided for backward compatibility, use Chart.helpers.canvas instead.
16283             * @namespace Chart.canvasHelpers
16284             * @deprecated since version 2.6.0
16285             * @todo remove at version 3
16286             * @private
16287             */
16288            core_controller.canvasHelpers = core_controller.helpers.canvas;
16289
16290            /**
16291             * Provided for backward compatibility, use Chart.layouts instead.
16292             * @namespace Chart.layoutService
16293             * @deprecated since version 2.7.3
16294             * @todo remove at version 3
16295             * @private
16296             */
16297            core_controller.layoutService = core_controller.layouts;
16298
16299            /**
16300             * Provided for backward compatibility, not available anymore.
16301             * @namespace Chart.LinearScaleBase
16302             * @deprecated since version 2.8
16303             * @todo remove at version 3
16304             * @private
16305             */
16306            core_controller.LinearScaleBase = scale_linearbase;
16307
16308            /**
16309             * Provided for backward compatibility, instead we should create a new Chart
16310             * by setting the type in the config (`new Chart(id, {type: '{chart-type}'}`).
16311             * @deprecated since version 2.8.0
16312             * @todo remove at version 3
16313             */
16314            core_controller.helpers.each(
16315                [
16316                    'Bar',
16317                    'Bubble',
16318                    'Doughnut',
16319                    'Line',
16320                    'PolarArea',
16321                    'Radar',
16322                    'Scatter'
16323                ],
16324                function (klass) {
16325                    core_controller[klass] = function (ctx, cfg) {
16326                        return new core_controller(ctx, core_controller.helpers.merge(cfg || {}, {
16327                            type: klass.charAt(0).toLowerCase() + klass.slice(1)
16328                        }));
16329                    };
16330                }
16331            );
16332
16333            return src;
16334
16335        })));
16336
16337    }, {"moment": 9}],
vendor: 76,885 bytes, lines 16338-17926
16338    3: [function (require, module, exports) {
16339        /**
16340         * @version: 3.1
16341         * @author: Dan Grossman http://www.dangrossman.info/
16342         * @copyright: Copyright (c) 2012-2019 Dan Grossman. All rights reserved.
16343         * @license: Licensed under the MIT license. See http://www.opensource.org/licenses/mit-license.php
16344         * @website: http://www.daterangepicker.com/
16345         */
16346// Following the UMD template https://github.com/umdjs/umd/blob/master/templates/returnExportsGlobal.js
16347        (function (root, factory) {
16348            if (typeof define === 'function' && define.amd) {
16349                // AMD. Make globaly available as well
16350                define(['moment', 'jquery'], function (moment, jquery) {
16351                    if (!jquery.fn) jquery.fn = {}; // webpack server rendering
16352                    if (typeof moment !== 'function' && moment.hasOwnProperty('default')) moment = moment['default']
16353                    return factory(moment, jquery);
16354                });
16355            } else if (typeof module === 'object' && module.exports) {
16356                // Node / Browserify
16357                //isomorphic issue
16358                var jQuery = (typeof window != 'undefined') ? window.jQuery : undefined;
16359                if (!jQuery) {
16360                    jQuery = require('jquery');
16361                    if (!jQuery.fn) jQuery.fn = {};
16362                }
16363                var moment = (typeof window != 'undefined' && typeof window.moment != 'undefined') ? window.moment : require('moment');
16364                module.exports = factory(moment, jQuery);
16365            } else {
16366                // Browser globals
16367                root.daterangepicker = factory(root.moment, root.jQuery);
16368            }
16369        }(this, function (moment, $) {
16370            var DateRangePicker = function (element, options, cb) {
16371
16372                //default settings for options
16373                this.parentEl = 'body';
16374                this.element = $(element);
16375                this.startDate = moment().startOf('day');
16376                this.endDate = moment().endOf('day');
16377                this.minDate = false;
16378                this.maxDate = false;
16379                this.maxSpan = false;
16380                this.autoApply = false;
16381                this.singleDatePicker = false;
16382                this.showDropdowns = false;
16383                this.minYear = moment().subtract(100, 'year').format('YYYY');
16384                this.maxYear = moment().add(100, 'year').format('YYYY');
16385                this.showWeekNumbers = false;
16386                this.showISOWeekNumbers = false;
16387                this.showCustomRangeLabel = true;
16388                this.timePicker = false;
16389                this.timePicker24Hour = false;
16390                this.timePickerIncrement = 1;
16391                this.timePickerSeconds = false;
16392                this.linkedCalendars = true;
16393                this.autoUpdateInput = true;
16394                this.alwaysShowCalendars = false;
16395                this.ranges = {};
16396
16397                this.opens = 'right';
16398                if (this.element.hasClass('pull-right'))
16399                    this.opens = 'left';
16400
16401                this.drops = 'down';
16402                if (this.element.hasClass('dropup'))
16403                    this.drops = 'up';
16404
16405                this.buttonClasses = 'btn btn-sm';
16406                this.applyButtonClasses = 'btn-primary';
16407                this.cancelButtonClasses = 'btn-default';
16408
16409                this.locale = {
16410                    direction: 'ltr',
16411                    format: moment.localeData().longDateFormat('L'),
16412                    separator: ' - ',
16413                    applyLabel: 'Apply',
16414                    cancelLabel: 'Cancel',
16415                    weekLabel: 'W',
16416                    customRangeLabel: 'Custom Range',
16417                    daysOfWeek: moment.weekdaysMin(),
16418                    monthNames: moment.monthsShort(),
16419                    firstDay: moment.localeData().firstDayOfWeek()
16420                };
16421
16422                this.callback = function () {
16423                };
16424
16425                //some state information
16426                this.isShowing = false;
16427                this.leftCalendar = {};
16428                this.rightCalendar = {};
16429
16430                //custom options from user
16431                if (typeof options !== 'object' || options === null)
16432                    options = {};
16433
16434                //allow setting options with data attributes
16435                //data-api options will be overwritten with custom javascript options
16436                options = $.extend(this.element.data(), options);
16437
16438                //html template for the picker UI
16439                if (typeof options.template !== 'string' && !(options.template instanceof $))
16440                    options.template =
16441                        '<div class="daterangepicker">' +
16442                        '<div class="ranges"></div>' +
16443                        '<div class="drp-calendar left">' +
16444                        '<div class="calendar-table"></div>' +
16445                        '<div class="calendar-time"></div>' +
16446                        '</div>' +
16447                        '<div class="drp-calendar right">' +
16448                        '<div class="calendar-table"></div>' +
16449                        '<div class="calendar-time"></div>' +
16450                        '</div>' +
16451                        '<div class="drp-buttons">' +
16452                        '<span class="drp-selected"></span>' +
16453                        '<button class="cancelBtn" type="button"></button>' +
16454                        '<button class="applyBtn" disabled="disabled" type="button"></button> ' +
16455                        '</div>' +
16456                        '</div>';
16457
16458                this.parentEl = (options.parentEl && $(options.parentEl).length) ? $(options.parentEl) : $(this.parentEl);
16459                this.container = $(options.template).appendTo(this.parentEl);
16460
16461                //
16462                // handle all the possible options overriding defaults
16463                //
16464
16465                if (typeof options.locale === 'object') {
16466
16467                    if (typeof options.locale.direction === 'string')
16468                        this.locale.direction = options.locale.direction;
16469
16470                    if (typeof options.locale.format === 'string')
16471                        this.locale.format = options.locale.format;
16472
16473                    if (typeof options.locale.separator === 'string')
16474                        this.locale.separator = options.locale.separator;
16475
16476                    if (typeof options.locale.daysOfWeek === 'object')
16477                        this.locale.daysOfWeek = options.locale.daysOfWeek.slice();
16478
16479                    if (typeof options.locale.monthNames === 'object')
16480                        this.locale.monthNames = options.locale.monthNames.slice();
16481
16482                    if (typeof options.locale.firstDay === 'number')
16483                        this.locale.firstDay = options.locale.firstDay;
16484
16485                    if (typeof options.locale.applyLabel === 'string')
16486                        this.locale.applyLabel = options.locale.applyLabel;
16487
16488                    if (typeof options.locale.cancelLabel === 'string')
16489                        this.locale.cancelLabel = options.locale.cancelLabel;
16490
16491                    if (typeof options.locale.weekLabel === 'string')
16492                        this.locale.weekLabel = options.locale.weekLabel;
16493
16494                    if (typeof options.locale.customRangeLabel === 'string') {
16495                        //Support unicode chars in the custom range name.
16496                        var elem = document.createElement('textarea');
16497                        elem.innerHTML = options.locale.customRangeLabel;
16498                        var rangeHtml = elem.value;
16499                        this.locale.customRangeLabel = rangeHtml;
16500                    }
16501                }
16502                this.container.addClass(this.locale.direction);
16503
16504                if (typeof options.startDate === 'string')
16505                    this.startDate = moment(options.startDate, this.locale.format);
16506
16507                if (typeof options.endDate === 'string')
16508                    this.endDate = moment(options.endDate, this.locale.format);
16509
16510                if (typeof options.minDate === 'string')
16511                    this.minDate = moment(options.minDate, this.locale.format);
16512
16513                if (typeof options.maxDate === 'string')
16514                    this.maxDate = moment(options.maxDate, this.locale.format);
16515
16516                if (typeof options.startDate === 'object')
16517                    this.startDate = moment(options.startDate);
16518
16519                if (typeof options.endDate === 'object')
16520                    this.endDate = moment(options.endDate);
16521
16522                if (typeof options.minDate === 'object')
16523                    this.minDate = moment(options.minDate);
16524
16525                if (typeof options.maxDate === 'object')
16526                    this.maxDate = moment(options.maxDate);
16527
16528                // sanity check for bad options
16529                if (this.minDate && this.startDate.isBefore(this.minDate))
16530                    this.startDate = this.minDate.clone();
16531
16532                // sanity check for bad options
16533                if (this.maxDate && this.endDate.isAfter(this.maxDate))
16534                    this.endDate = this.maxDate.clone();
16535
16536                if (typeof options.applyButtonClasses === 'string')
16537                    this.applyButtonClasses = options.applyButtonClasses;
16538
16539                if (typeof options.applyClass === 'string') //backwards compat
16540                    this.applyButtonClasses = options.applyClass;
16541
16542                if (typeof options.cancelButtonClasses === 'string')
16543                    this.cancelButtonClasses = options.cancelButtonClasses;
16544
16545                if (typeof options.cancelClass === 'string') //backwards compat
16546                    this.cancelButtonClasses = options.cancelClass;
16547
16548                if (typeof options.maxSpan === 'object')
16549                    this.maxSpan = options.maxSpan;
16550
16551                if (typeof options.dateLimit === 'object') //backwards compat
16552                    this.maxSpan = options.dateLimit;
16553
16554                if (typeof options.opens === 'string')
16555                    this.opens = options.opens;
16556
16557                if (typeof options.drops === 'string')
16558                    this.drops = options.drops;
16559
16560                if (typeof options.showWeekNumbers === 'boolean')
16561                    this.showWeekNumbers = options.showWeekNumbers;
16562
16563                if (typeof options.showISOWeekNumbers === 'boolean')
16564                    this.showISOWeekNumbers = options.showISOWeekNumbers;
16565
16566                if (typeof options.buttonClasses === 'string')
16567                    this.buttonClasses = options.buttonClasses;
16568
16569                if (typeof options.buttonClasses === 'object')
16570                    this.buttonClasses = options.buttonClasses.join(' ');
16571
16572                if (typeof options.showDropdowns === 'boolean')
16573                    this.showDropdowns = options.showDropdowns;
16574
16575                if (typeof options.minYear === 'number')
16576                    this.minYear = options.minYear;
16577
16578                if (typeof options.maxYear === 'number')
16579                    this.maxYear = options.maxYear;
16580
16581                if (typeof options.showCustomRangeLabel === 'boolean')
16582                    this.showCustomRangeLabel = options.showCustomRangeLabel;
16583
16584                if (typeof options.singleDatePicker === 'boolean') {
16585                    this.singleDatePicker = options.singleDatePicker;
16586                    if (this.singleDatePicker)
16587                        this.endDate = this.startDate.clone();
16588                }
16589
16590                if (typeof options.timePicker === 'boolean')
16591                    this.timePicker = options.timePicker;
16592
16593                if (typeof options.timePickerSeconds === 'boolean')
16594                    this.timePickerSeconds = options.timePickerSeconds;
16595
16596                if (typeof options.timePickerIncrement === 'number')
16597                    this.timePickerIncrement = options.timePickerIncrement;
16598
16599                if (typeof options.timePicker24Hour === 'boolean')
16600                    this.timePicker24Hour = options.timePicker24Hour;
16601
16602                if (typeof options.autoApply === 'boolean')
16603                    this.autoApply = options.autoApply;
16604
16605                if (typeof options.autoUpdateInput === 'boolean')
16606                    this.autoUpdateInput = options.autoUpdateInput;
16607
16608                if (typeof options.linkedCalendars === 'boolean')
16609                    this.linkedCalendars = options.linkedCalendars;
16610
16611                if (typeof options.isInvalidDate === 'function')
16612                    this.isInvalidDate = options.isInvalidDate;
16613
16614                if (typeof options.isCustomDate === 'function')
16615                    this.isCustomDate = options.isCustomDate;
16616
16617                if (typeof options.alwaysShowCalendars === 'boolean')
16618                    this.alwaysShowCalendars = options.alwaysShowCalendars;
16619
16620                // update day names order to firstDay
16621                if (this.locale.firstDay != 0) {
16622                    var iterator = this.locale.firstDay;
16623                    while (iterator > 0) {
16624                        this.locale.daysOfWeek.push(this.locale.daysOfWeek.shift());
16625                        iterator--;
16626                    }
16627                }
16628
16629                var start, end, range;
16630
16631                //if no start/end dates set, check if an input element contains initial values
16632                if (typeof options.startDate === 'undefined' && typeof options.endDate === 'undefined') {
16633                    if ($(this.element).is(':text')) {
16634                        var val = $(this.element).val(),
16635                            split = val.split(this.locale.separator);
16636
16637                        start = end = null;
16638
16639                        if (split.length == 2) {
16640                            start = moment(split[0], this.locale.format);
16641                            end = moment(split[1], this.locale.format);
16642                        } else if (this.singleDatePicker && val !== "") {
16643                            start = moment(val, this.locale.format);
16644                            end = moment(val, this.locale.format);
16645                        }
16646                        if (start !== null && end !== null) {
16647                            this.setStartDate(start);
16648                            this.setEndDate(end);
16649                        }
16650                    }
16651                }
16652
16653                if (typeof options.ranges === 'object') {
16654                    for (range in options.ranges) {
16655
16656                        if (typeof options.ranges[range][0] === 'string')
16657                            start = moment(options.ranges[range][0], this.locale.format);
16658                        else
16659                            start = moment(options.ranges[range][0]);
16660
16661                        if (typeof options.ranges[range][1] === 'string')
16662                            end = moment(options.ranges[range][1], this.locale.format);
16663                        else
16664                            end = moment(options.ranges[range][1]);
16665
16666                        // If the start or end date exceed those allowed by the minDate or maxSpan
16667                        // options, shorten the range to the allowable period.
16668                        if (this.minDate && start.isBefore(this.minDate))
16669                            start = this.minDate.clone();
16670
16671                        var maxDate = this.maxDate;
16672                        if (this.maxSpan && maxDate && start.clone().add(this.maxSpan).isAfter(maxDate))
16673                            maxDate = start.clone().add(this.maxSpan);
16674                        if (maxDate && end.isAfter(maxDate))
16675                            end = maxDate.clone();
16676
16677                        // If the end of the range is before the minimum or the start of the range is
16678                        // after the maximum, don't display this range option at all.
16679                        if ((this.minDate && end.isBefore(this.minDate, this.timepicker ? 'minute' : 'day'))
16680                            || (maxDate && start.isAfter(maxDate, this.timepicker ? 'minute' : 'day')))
16681                            continue;
16682
16683                        //Support unicode chars in the range names.
16684                        var elem = document.createElement('textarea');
16685                        elem.innerHTML = range;
16686                        var rangeHtml = elem.value;
16687
16688                        this.ranges[rangeHtml] = [start, end];
16689                    }
16690
16691                    var list = '<ul>';
16692                    for (range in this.ranges) {
16693                        list += '<li data-range-key="' + range + '">' + range + '</li>';
16694                    }
16695                    if (this.showCustomRangeLabel) {
16696                        list += '<li data-range-key="' + this.locale.customRangeLabel + '">' + this.locale.customRangeLabel + '</li>';
16697                    }
16698                    list += '</ul>';
16699                    this.container.find('.ranges').prepend(list);
16700                }
16701
16702                if (typeof cb === 'function') {
16703                    this.callback = cb;
16704                }
16705
16706                if (!this.timePicker) {
16707                    this.startDate = this.startDate.startOf('day');
16708                    this.endDate = this.endDate.endOf('day');
16709                    this.container.find('.calendar-time').hide();
16710                }
16711
16712                //can't be used together for now
16713                if (this.timePicker && this.autoApply)
16714                    this.autoApply = false;
16715
16716                if (this.autoApply) {
16717                    this.container.addClass('auto-apply');
16718                }
16719
16720                if (typeof options.ranges === 'object')
16721                    this.container.addClass('show-ranges');
16722
16723                if (this.singleDatePicker) {
16724                    this.container.addClass('single');
16725                    this.container.find('.drp-calendar.left').addClass('single');
16726                    this.container.find('.drp-calendar.left').show();
16727                    this.container.find('.drp-calendar.right').hide();
16728                    if (!this.timePicker && this.autoApply) {
16729                        this.container.addClass('auto-apply');
16730                    }
16731                }
16732
16733                if ((typeof options.ranges === 'undefined' && !this.singleDatePicker) || this.alwaysShowCalendars) {
16734                    this.container.addClass('show-calendar');
16735                }
16736
16737                this.container.addClass('opens' + this.opens);
16738
16739                //apply CSS classes and labels to buttons
16740                this.container.find('.applyBtn, .cancelBtn').addClass(this.buttonClasses);
16741                if (this.applyButtonClasses.length)
16742                    this.container.find('.applyBtn').addClass(this.applyButtonClasses);
16743                if (this.cancelButtonClasses.length)
16744                    this.container.find('.cancelBtn').addClass(this.cancelButtonClasses);
16745                this.container.find('.applyBtn').html(this.locale.applyLabel);
16746                this.container.find('.cancelBtn').html(this.locale.cancelLabel);
16747
16748                //
16749                // event listeners
16750                //
16751
16752                this.container.find('.drp-calendar')
16753                    .on('click.daterangepicker', '.prev', $.proxy(this.clickPrev, this))
16754                    .on('click.daterangepicker', '.next', $.proxy(this.clickNext, this))
16755                    .on('mousedown.daterangepicker', 'td.available', $.proxy(this.clickDate, this))
16756                    .on('mouseenter.daterangepicker', 'td.available', $.proxy(this.hoverDate, this))
16757                    .on('change.daterangepicker', 'select.yearselect', $.proxy(this.monthOrYearChanged, this))
16758                    .on('change.daterangepicker', 'select.monthselect', $.proxy(this.monthOrYearChanged, this))
16759                    .on('change.daterangepicker', 'select.hourselect,select.minuteselect,select.secondselect,select.ampmselect', $.proxy(this.timeChanged, this));
16760
16761                this.container.find('.ranges')
16762                    .on('click.daterangepicker', 'li', $.proxy(this.clickRange, this));
16763
16764                this.container.find('.drp-buttons')
16765                    .on('click.daterangepicker', 'button.applyBtn', $.proxy(this.clickApply, this))
16766                    .on('click.daterangepicker', 'button.cancelBtn', $.proxy(this.clickCancel, this));
16767
16768                if (this.element.is('input') || this.element.is('button')) {
16769                    this.element.on({
16770                        'click.daterangepicker': $.proxy(this.show, this),
16771                        'focus.daterangepicker': $.proxy(this.show, this),
16772                        'keyup.daterangepicker': $.proxy(this.elementChanged, this),
16773                        'keydown.daterangepicker': $.proxy(this.keydown, this) //IE 11 compatibility
16774                    });
16775                } else {
16776                    this.element.on('click.daterangepicker', $.proxy(this.toggle, this));
16777                    this.element.on('keydown.daterangepicker', $.proxy(this.toggle, this));
16778                }
16779
16780                //
16781                // if attached to a text input, set the initial value
16782                //
16783
16784                this.updateElement();
16785
16786            };
16787
16788            DateRangePicker.prototype = {
16789
16790                constructor: DateRangePicker,
16791
16792                setStartDate: function (startDate) {
16793                    if (typeof startDate === 'string')
16794                        this.startDate = moment(startDate, this.locale.format);
16795
16796                    if (typeof startDate === 'object')
16797                        this.startDate = moment(startDate);
16798
16799                    if (!this.timePicker)
16800                        this.startDate = this.startDate.startOf('day');
16801
16802                    if (this.timePicker && this.timePickerIncrement)
16803                        this.startDate.minute(Math.round(this.startDate.minute() / this.timePickerIncrement) * this.timePickerIncrement);
16804
16805                    if (this.minDate && this.startDate.isBefore(this.minDate)) {
16806                        this.startDate = this.minDate.clone();
16807                        if (this.timePicker && this.timePickerIncrement)
16808                            this.startDate.minute(Math.round(this.startDate.minute() / this.timePickerIncrement) * this.timePickerIncrement);
16809                    }
16810
16811                    if (this.maxDate && this.startDate.isAfter(this.maxDate)) {
16812                        this.startDate = this.maxDate.clone();
16813                        if (this.timePicker && this.timePickerIncrement)
16814                            this.startDate.minute(Math.floor(this.startDate.minute() / this.timePickerIncrement) * this.timePickerIncrement);
16815                    }
16816
16817                    if (!this.isShowing)
16818                        this.updateElement();
16819
16820                    this.updateMonthsInView();
16821                },
16822
16823                setEndDate: function (endDate) {
16824                    if (typeof endDate === 'string')
16825                        this.endDate = moment(endDate, this.locale.format);
16826
16827                    if (typeof endDate === 'object')
16828                        this.endDate = moment(endDate);
16829
16830                    if (!this.timePicker)
16831                        this.endDate = this.endDate.endOf('day');
16832
16833                    if (this.timePicker && this.timePickerIncrement)
16834                        this.endDate.minute(Math.round(this.endDate.minute() / this.timePickerIncrement) * this.timePickerIncrement);
16835
16836                    if (this.endDate.isBefore(this.startDate))
16837                        this.endDate = this.startDate.clone();
16838
16839                    if (this.maxDate && this.endDate.isAfter(this.maxDate))
16840                        this.endDate = this.maxDate.clone();
16841
16842                    if (this.maxSpan && this.startDate.clone().add(this.maxSpan).isBefore(this.endDate))
16843                        this.endDate = this.startDate.clone().add(this.maxSpan);
16844
16845                    this.previousRightTime = this.endDate.clone();
16846
16847                    this.container.find('.drp-selected').html(this.startDate.format(this.locale.format) + this.locale.separator + this.endDate.format(this.locale.format));
16848
16849                    if (!this.isShowing)
16850                        this.updateElement();
16851
16852                    this.updateMonthsInView();
16853                },
16854
16855                isInvalidDate: function () {
16856                    return false;
16857                },
16858
16859                isCustomDate: function () {
16860                    return false;
16861                },
16862
16863                updateView: function () {
16864                    if (this.timePicker) {
16865                        this.renderTimePicker('left');
16866                        this.renderTimePicker('right');
16867                        if (!this.endDate) {
16868                            this.container.find('.right .calendar-time select').prop('disabled', true).addClass('disabled');
16869                        } else {
16870                            this.container.find('.right .calendar-time select').prop('disabled', false).removeClass('disabled');
16871                        }
16872                    }
16873                    if (this.endDate)
16874                        this.container.find('.drp-selected').html(this.startDate.format(this.locale.format) + this.locale.separator + this.endDate.format(this.locale.format));
16875                    this.updateMonthsInView();
16876                    this.updateCalendars();
16877                    this.updateFormInputs();
16878                },
16879
16880                updateMonthsInView: function () {
16881                    if (this.endDate) {
16882
16883                        //if both dates are visible already, do nothing
16884                        if (!this.singleDatePicker && this.leftCalendar.month && this.rightCalendar.month &&
16885                            (this.startDate.format('YYYY-MM') == this.leftCalendar.month.format('YYYY-MM') || this.startDate.format('YYYY-MM') == this.rightCalendar.month.format('YYYY-MM'))
16886                            &&
16887                            (this.endDate.format('YYYY-MM') == this.leftCalendar.month.format('YYYY-MM') || this.endDate.format('YYYY-MM') == this.rightCalendar.month.format('YYYY-MM'))
16888                        ) {
16889                            return;
16890                        }
16891
16892                        this.leftCalendar.month = this.startDate.clone().date(2);
16893                        if (!this.linkedCalendars && (this.endDate.month() != this.startDate.month() || this.endDate.year() != this.startDate.year())) {
16894                            this.rightCalendar.month = this.endDate.clone().date(2);
16895                        } else {
16896                            this.rightCalendar.month = this.startDate.clone().date(2).add(1, 'month');
16897                        }
16898
16899                    } else {
16900                        if (this.leftCalendar.month.format('YYYY-MM') != this.startDate.format('YYYY-MM') && this.rightCalendar.month.format('YYYY-MM') != this.startDate.format('YYYY-MM')) {
16901                            this.leftCalendar.month = this.startDate.clone().date(2);
16902                            this.rightCalendar.month = this.startDate.clone().date(2).add(1, 'month');
16903                        }
16904                    }
16905                    if (this.maxDate && this.linkedCalendars && !this.singleDatePicker && this.rightCalendar.month > this.maxDate) {
16906                        this.rightCalendar.month = this.maxDate.clone().date(2);
16907                        this.leftCalendar.month = this.maxDate.clone().date(2).subtract(1, 'month');
16908                    }
16909                },
16910
16911                updateCalendars: function () {
16912
16913                    if (this.timePicker) {
16914                        var hour, minute, second;
16915                        if (this.endDate) {
16916                            hour = parseInt(this.container.find('.left .hourselect').val(), 10);
16917                            minute = parseInt(this.container.find('.left .minuteselect').val(), 10);
16918                            if (isNaN(minute)) {
16919                                minute = parseInt(this.container.find('.left .minuteselect option:last').val(), 10);
16920                            }
16921                            second = this.timePickerSeconds ? parseInt(this.container.find('.left .secondselect').val(), 10) : 0;
16922                            if (!this.timePicker24Hour) {
16923                                var ampm = this.container.find('.left .ampmselect').val();
16924                                if (ampm === 'PM' && hour < 12)
16925                                    hour += 12;
16926                                if (ampm === 'AM' && hour === 12)
16927                                    hour = 0;
16928                            }
16929                        } else {
16930                            hour = parseInt(this.container.find('.right .hourselect').val(), 10);
16931                            minute = parseInt(this.container.find('.right .minuteselect').val(), 10);
16932                            if (isNaN(minute)) {
16933                                minute = parseInt(this.container.find('.right .minuteselect option:last').val(), 10);
16934                            }
16935                            second = this.timePickerSeconds ? parseInt(this.container.find('.right .secondselect').val(), 10) : 0;
16936                            if (!this.timePicker24Hour) {
16937                                var ampm = this.container.find('.right .ampmselect').val();
16938                                if (ampm === 'PM' && hour < 12)
16939                                    hour += 12;
16940                                if (ampm === 'AM' && hour === 12)
16941                                    hour = 0;
16942                            }
16943                        }
16944                        this.leftCalendar.month.hour(hour).minute(minute).second(second);
16945                        this.rightCalendar.month.hour(hour).minute(minute).second(second);
16946                    }
16947
16948                    this.renderCalendar('left');
16949                    this.renderCalendar('right');
16950
16951                    //highlight any predefined range matching the current start and end dates
16952                    this.container.find('.ranges li').removeClass('active');
16953                    if (this.endDate == null) return;
16954
16955                    this.calculateChosenLabel();
16956                },
16957
16958                renderCalendar: function (side) {
16959
16960                    //
16961                    // Build the matrix of dates that will populate the calendar
16962                    //
16963
16964                    var calendar = side == 'left' ? this.leftCalendar : this.rightCalendar;
16965                    var month = calendar.month.month();
16966                    var year = calendar.month.year();
16967                    var hour = calendar.month.hour();
16968                    var minute = calendar.month.minute();
16969                    var second = calendar.month.second();
16970                    var daysInMonth = moment([year, month]).daysInMonth();
16971                    var firstDay = moment([year, month, 1]);
16972                    var lastDay = moment([year, month, daysInMonth]);
16973                    var lastMonth = moment(firstDay).subtract(1, 'month').month();
16974                    var lastYear = moment(firstDay).subtract(1, 'month').year();
16975                    var daysInLastMonth = moment([lastYear, lastMonth]).daysInMonth();
16976                    var dayOfWeek = firstDay.day();
16977
16978                    //initialize a 6 rows x 7 columns array for the calendar
16979                    var calendar = [];
16980                    calendar.firstDay = firstDay;
16981                    calendar.lastDay = lastDay;
16982
16983                    for (var i = 0; i < 6; i++) {
16984                        calendar[i] = [];
16985                    }
16986
16987                    //populate the calendar with date objects
16988                    var startDay = daysInLastMonth - dayOfWeek + this.locale.firstDay + 1;
16989                    if (startDay > daysInLastMonth)
16990                        startDay -= 7;
16991
16992                    if (dayOfWeek == this.locale.firstDay)
16993                        startDay = daysInLastMonth - 6;
16994
16995                    var curDate = moment([lastYear, lastMonth, startDay, 12, minute, second]);
16996
16997                    var col, row;
16998                    for (var i = 0, col = 0, row = 0; i < 42; i++, col++, curDate = moment(curDate).add(24, 'hour')) {
16999                        if (i > 0 && col % 7 === 0) {
17000                            col = 0;
17001                            row++;
17002                        }
17003                        calendar[row][col] = curDate.clone().hour(hour).minute(minute).second(second);
17004                        curDate.hour(12);
17005
17006                        if (this.minDate && calendar[row][col].format('YYYY-MM-DD') == this.minDate.format('YYYY-MM-DD') && calendar[row][col].isBefore(this.minDate) && side == 'left') {
17007                            calendar[row][col] = this.minDate.clone();
17008                        }
17009
17010                        if (this.maxDate && calendar[row][col].format('YYYY-MM-DD') == this.maxDate.format('YYYY-MM-DD') && calendar[row][col].isAfter(this.maxDate) && side == 'right') {
17011                            calendar[row][col] = this.maxDate.clone();
17012                        }
17013
17014                    }
17015
17016                    //make the calendar object available to hoverDate/clickDate
17017                    if (side == 'left') {
17018                        this.leftCalendar.calendar = calendar;
17019                    } else {
17020                        this.rightCalendar.calendar = calendar;
17021                    }
17022
17023                    //
17024                    // Display the calendar
17025                    //
17026
17027                    var minDate = side == 'left' ? this.minDate : this.startDate;
17028                    var maxDate = this.maxDate;
17029                    var selected = side == 'left' ? this.startDate : this.endDate;
17030                    var arrow = this.locale.direction == 'ltr' ? {
17031                        left: 'chevron-left',
17032                        right: 'chevron-right'
17033                    } : {left: 'chevron-right', right: 'chevron-left'};
17034
17035                    var html = '<table class="table-condensed">';
17036                    html += '<thead>';
17037                    html += '<tr>';
17038
17039                    // add empty cell for week number
17040                    if (this.showWeekNumbers || this.showISOWeekNumbers)
17041                        html += '<th></th>';
17042
17043                    if ((!minDate || minDate.isBefore(calendar.firstDay)) && (!this.linkedCalendars || side == 'left')) {
17044                        html += '<th class="prev available"><span></span></th>';
17045                    } else {
17046                        html += '<th></th>';
17047                    }
17048
17049                    var dateHtml = this.locale.monthNames[calendar[1][1].month()] + calendar[1][1].format(" YYYY");
17050
17051                    if (this.showDropdowns) {
17052                        var currentMonth = calendar[1][1].month();
17053                        var currentYear = calendar[1][1].year();
17054                        var maxYear = (maxDate && maxDate.year()) || (this.maxYear);
17055                        var minYear = (minDate && minDate.year()) || (this.minYear);
17056                        var inMinYear = currentYear == minYear;
17057                        var inMaxYear = currentYear == maxYear;
17058
17059                        var monthHtml = '<select class="monthselect">';
17060                        for (var m = 0; m < 12; m++) {
17061                            if ((!inMinYear || (minDate && m >= minDate.month())) && (!inMaxYear || (maxDate && m <= maxDate.month()))) {
17062                                monthHtml += "<option value='" + m + "'" +
17063                                    (m === currentMonth ? " selected='selected'" : "") +
17064                                    ">" + this.locale.monthNames[m] + "</option>";
17065                            } else {
17066                                monthHtml += "<option value='" + m + "'" +
17067                                    (m === currentMonth ? " selected='selected'" : "") +
17068                                    " disabled='disabled'>" + this.locale.monthNames[m] + "</option>";
17069                            }
17070                        }
17071                        monthHtml += "</select>";
17072
17073                        var yearHtml = '<select class="yearselect">';
17074                        for (var y = minYear; y <= maxYear; y++) {
17075                            yearHtml += '<option value="' + y + '"' +
17076                                (y === currentYear ? ' selected="selected"' : '') +
17077                                '>' + y + '</option>';
17078                        }
17079                        yearHtml += '</select>';
17080
17081                        dateHtml = monthHtml + yearHtml;
17082                    }
17083
17084                    html += '<th colspan="5" class="month">' + dateHtml + '</th>';
17085                    if ((!maxDate || maxDate.isAfter(calendar.lastDay)) && (!this.linkedCalendars || side == 'right' || this.singleDatePicker)) {
17086                        html += '<th class="next available"><span></span></th>';
17087                    } else {
17088                        html += '<th></th>';
17089                    }
17090
17091                    html += '</tr>';
17092                    html += '<tr>';
17093
17094                    // add week number label
17095                    if (this.showWeekNumbers || this.showISOWeekNumbers)
17096                        html += '<th class="week">' + this.locale.weekLabel + '</th>';
17097
17098                    $.each(this.locale.daysOfWeek, function (index, dayOfWeek) {
17099                        html += '<th>' + dayOfWeek + '</th>';
17100                    });
17101
17102                    html += '</tr>';
17103                    html += '</thead>';
17104                    html += '<tbody>';
17105
17106                    //adjust maxDate to reflect the maxSpan setting in order to
17107                    //grey out end dates beyond the maxSpan
17108                    if (this.endDate == null && this.maxSpan) {
17109                        var maxLimit = this.startDate.clone().add(this.maxSpan).endOf('day');
17110                        if (!maxDate || maxLimit.isBefore(maxDate)) {
17111                            maxDate = maxLimit;
17112                        }
17113                    }
17114
17115                    for (var row = 0; row < 6; row++) {
17116                        html += '<tr>';
17117
17118                        // add week number
17119                        if (this.showWeekNumbers)
17120                            html += '<td class="week">' + calendar[row][0].week() + '</td>';
17121                        else if (this.showISOWeekNumbers)
17122                            html += '<td class="week">' + calendar[row][0].isoWeek() + '</td>';
17123
17124                        for (var col = 0; col < 7; col++) {
17125
17126                            var classes = [];
17127
17128                            //highlight today's date
17129                            if (calendar[row][col].isSame(new Date(), "day"))
17130                                classes.push('today');
17131
17132                            //highlight weekends
17133                            if (calendar[row][col].isoWeekday() > 5)
17134                                classes.push('weekend');
17135
17136                            //grey out the dates in other months displayed at beginning and end of this calendar
17137                            if (calendar[row][col].month() != calendar[1][1].month())
17138                                classes.push('off', 'ends');
17139
17140                            //don't allow selection of dates before the minimum date
17141                            if (this.minDate && calendar[row][col].isBefore(this.minDate, 'day'))
17142                                classes.push('off', 'disabled');
17143
17144                            //don't allow selection of dates after the maximum date
17145                            if (maxDate && calendar[row][col].isAfter(maxDate, 'day'))
17146                                classes.push('off', 'disabled');
17147
17148                            //don't allow selection of date if a custom function decides it's invalid
17149                            if (this.isInvalidDate(calendar[row][col]))
17150                                classes.push('off', 'disabled');
17151
17152                            //highlight the currently selected start date
17153                            if (calendar[row][col].format('YYYY-MM-DD') == this.startDate.format('YYYY-MM-DD'))
17154                                classes.push('active', 'start-date');
17155
17156                            //highlight the currently selected end date
17157                            if (this.endDate != null && calendar[row][col].format('YYYY-MM-DD') == this.endDate.format('YYYY-MM-DD'))
17158                                classes.push('active', 'end-date');
17159
17160                            //highlight dates in-between the selected dates
17161                            if (this.endDate != null && calendar[row][col] > this.startDate && calendar[row][col] < this.endDate)
17162                                classes.push('in-range');
17163
17164                            //apply custom classes for this date
17165                            var isCustom = this.isCustomDate(calendar[row][col]);
17166                            if (isCustom !== false) {
17167                                if (typeof isCustom === 'string')
17168                                    classes.push(isCustom);
17169                                else
17170                                    Array.prototype.push.apply(classes, isCustom);
17171                            }
17172
17173                            var cname = '', disabled = false;
17174                            for (var i = 0; i < classes.length; i++) {
17175                                cname += classes[i] + ' ';
17176                                if (classes[i] == 'disabled')
17177                                    disabled = true;
17178                            }
17179                            if (!disabled)
17180                                cname += 'available';
17181
17182                            html += '<td class="' + cname.replace(/^\s+|\s+$/g, '') + '" data-title="' + 'r' + row + 'c' + col + '">' + calendar[row][col].date() + '</td>';
17183
17184                        }
17185                        html += '</tr>';
17186                    }
17187
17188                    html += '</tbody>';
17189                    html += '</table>';
17190
17191                    this.container.find('.drp-calendar.' + side + ' .calendar-table').html(html);
17192
17193                },
17194
17195                renderTimePicker: function (side) {
17196
17197                    // Don't bother updating the time picker if it's currently disabled
17198                    // because an end date hasn't been clicked yet
17199                    if (side == 'right' && !this.endDate) return;
17200
17201                    var html, selected, minDate, maxDate = this.maxDate;
17202
17203                    if (this.maxSpan && (!this.maxDate || this.startDate.clone().add(this.maxSpan).isBefore(this.maxDate)))
17204                        maxDate = this.startDate.clone().add(this.maxSpan);
17205
17206                    if (side == 'left') {
17207                        selected = this.startDate.clone();
17208                        minDate = this.minDate;
17209                    } else if (side == 'right') {
17210                        selected = this.endDate.clone();
17211                        minDate = this.startDate;
17212
17213                        //Preserve the time already selected
17214                        var timeSelector = this.container.find('.drp-calendar.right .calendar-time');
17215                        if (timeSelector.html() != '') {
17216
17217                            selected.hour(!isNaN(selected.hour()) ? selected.hour() : timeSelector.find('.hourselect option:selected').val());
17218                            selected.minute(!isNaN(selected.minute()) ? selected.minute() : timeSelector.find('.minuteselect option:selected').val());
17219                            selected.second(!isNaN(selected.second()) ? selected.second() : timeSelector.find('.secondselect option:selected').val());
17220
17221                            if (!this.timePicker24Hour) {
17222                                var ampm = timeSelector.find('.ampmselect option:selected').val();
17223                                if (ampm === 'PM' && selected.hour() < 12)
17224                                    selected.hour(selected.hour() + 12);
17225                                if (ampm === 'AM' && selected.hour() === 12)
17226                                    selected.hour(0);
17227                            }
17228
17229                        }
17230
17231                        if (selected.isBefore(this.startDate))
17232                            selected = this.startDate.clone();
17233
17234                        if (maxDate && selected.isAfter(maxDate))
17235                            selected = maxDate.clone();
17236
17237                    }
17238
17239                    //
17240                    // hours
17241                    //
17242
17243                    html = '<select class="hourselect">';
17244
17245                    var start = this.timePicker24Hour ? 0 : 1;
17246                    var end = this.timePicker24Hour ? 23 : 12;
17247
17248                    for (var i = start; i <= end; i++) {
17249                        var i_in_24 = i;
17250                        if (!this.timePicker24Hour)
17251                            i_in_24 = selected.hour() >= 12 ? (i == 12 ? 12 : i + 12) : (i == 12 ? 0 : i);
17252
17253                        var time = selected.clone().hour(i_in_24);
17254                        var disabled = false;
17255                        if (minDate && time.minute(59).isBefore(minDate))
17256                            disabled = true;
17257                        if (maxDate && time.minute(0).isAfter(maxDate))
17258                            disabled = true;
17259
17260                        if (i_in_24 == selected.hour() && !disabled) {
17261                            html += '<option value="' + i + '" selected="selected">' + i + '</option>';
17262                        } else if (disabled) {
17263                            html += '<option value="' + i + '" disabled="disabled" class="disabled">' + i + '</option>';
17264                        } else {
17265                            html += '<option value="' + i + '">' + i + '</option>';
17266                        }
17267                    }
17268
17269                    html += '</select> ';
17270
17271                    //
17272                    // minutes
17273                    //
17274
17275                    html += ': <select class="minuteselect">';
17276
17277                    for (var i = 0; i < 60; i += this.timePickerIncrement) {
17278                        var padded = i < 10 ? '0' + i : i;
17279                        var time = selected.clone().minute(i);
17280
17281                        var disabled = false;
17282                        if (minDate && time.second(59).isBefore(minDate))
17283                            disabled = true;
17284                        if (maxDate && time.second(0).isAfter(maxDate))
17285                            disabled = true;
17286
17287                        if (selected.minute() == i && !disabled) {
17288                            html += '<option value="' + i + '" selected="selected">' + padded + '</option>';
17289                        } else if (disabled) {
17290                            html += '<option value="' + i + '" disabled="disabled" class="disabled">' + padded + '</option>';
17291                        } else {
17292                            html += '<option value="' + i + '">' + padded + '</option>';
17293                        }
17294                    }
17295
17296                    html += '</select> ';
17297
17298                    //
17299                    // seconds
17300                    //
17301
17302                    if (this.timePickerSeconds) {
17303                        html += ': <select class="secondselect">';
17304
17305                        for (var i = 0; i < 60; i++) {
17306                            var padded = i < 10 ? '0' + i : i;
17307                            var time = selected.clone().second(i);
17308
17309                            var disabled = false;
17310                            if (minDate && time.isBefore(minDate))
17311                                disabled = true;
17312                            if (maxDate && time.isAfter(maxDate))
17313                                disabled = true;
17314
17315                            if (selected.second() == i && !disabled) {
17316                                html += '<option value="' + i + '" selected="selected">' + padded + '</option>';
17317                            } else if (disabled) {
17318                                html += '<option value="' + i + '" disabled="disabled" class="disabled">' + padded + '</option>';
17319                            } else {
17320                                html += '<option value="' + i + '">' + padded + '</option>';
17321                            }
17322                        }
17323
17324                        html += '</select> ';
17325                    }
17326
17327                    //
17328                    // AM/PM
17329                    //
17330
17331                    if (!this.timePicker24Hour) {
17332                        html += '<select class="ampmselect">';
17333
17334                        var am_html = '';
17335                        var pm_html = '';
17336
17337                        if (minDate && selected.clone().hour(12).minute(0).second(0).isBefore(minDate))
17338                            am_html = ' disabled="disabled" class="disabled"';
17339
17340                        if (maxDate && selected.clone().hour(0).minute(0).second(0).isAfter(maxDate))
17341                            pm_html = ' disabled="disabled" class="disabled"';
17342
17343                        if (selected.hour() >= 12) {
17344                            html += '<option value="AM"' + am_html + '>AM</option><option value="PM" selected="selected"' + pm_html + '>PM</option>';
17345                        } else {
17346                            html += '<option value="AM" selected="selected"' + am_html + '>AM</option><option value="PM"' + pm_html + '>PM</option>';
17347                        }
17348
17349                        html += '</select>';
17350                    }
17351
17352                    this.container.find('.drp-calendar.' + side + ' .calendar-time').html(html);
17353
17354                },
17355
17356                updateFormInputs: function () {
17357
17358                    if (this.singleDatePicker || (this.endDate && (this.startDate.isBefore(this.endDate) || this.startDate.isSame(this.endDate)))) {
17359                        this.container.find('button.applyBtn').prop('disabled', false);
17360                    } else {
17361                        this.container.find('button.applyBtn').prop('disabled', true);
17362                    }
17363
17364                },
17365
17366                move: function () {
17367                    var parentOffset = {top: 0, left: 0},
17368                        containerTop,
17369                        drops = this.drops;
17370
17371                    var parentRightEdge = $(window).width();
17372                    if (!this.parentEl.is('body')) {
17373                        parentOffset = {
17374                            top: this.parentEl.offset().top - this.parentEl.scrollTop(),
17375                            left: this.parentEl.offset().left - this.parentEl.scrollLeft()
17376                        };
17377                        parentRightEdge = this.parentEl[0].clientWidth + this.parentEl.offset().left;
17378                    }
17379
17380                    switch (drops) {
17381                        case 'auto':
17382                            containerTop = this.element.offset().top + this.element.outerHeight() - parentOffset.top;
17383                            if (containerTop + this.container.outerHeight() >= this.parentEl[0].scrollHeight) {
17384                                containerTop = this.element.offset().top - this.container.outerHeight() - parentOffset.top;
17385                                drops = 'up';
17386                            }
17387                            break;
17388                        case 'up':
17389                            containerTop = this.element.offset().top - this.container.outerHeight() - parentOffset.top;
17390                            break;
17391                        default:
17392                            containerTop = this.element.offset().top + this.element.outerHeight() - parentOffset.top;
17393                            break;
17394                    }
17395
17396                    // Force the container to it's actual width
17397                    this.container.css({
17398                        top: 0,
17399                        left: 0,
17400                        right: 'auto'
17401                    });
17402                    var containerWidth = this.container.outerWidth();
17403
17404                    this.container.toggleClass('drop-up', drops == 'up');
17405
17406                    if (this.opens == 'left') {
17407                        var containerRight = parentRightEdge - this.element.offset().left - this.element.outerWidth();
17408                        if (containerWidth + containerRight > $(window).width()) {
17409                            this.container.css({
17410                                top: containerTop,
17411                                right: 'auto',
17412                                left: 9
17413                            });
17414                        } else {
17415                            this.container.css({
17416                                top: containerTop,
17417                                right: containerRight,
17418                                left: 'auto'
17419                            });
17420                        }
17421                    } else if (this.opens == 'center') {
17422                        var containerLeft = this.element.offset().left - parentOffset.left + this.element.outerWidth() / 2
17423                            - containerWidth / 2;
17424                        if (containerLeft < 0) {
17425                            this.container.css({
17426                                top: containerTop,
17427                                right: 'auto',
17428                                left: 9
17429                            });
17430                        } else if (containerLeft + containerWidth > $(window).width()) {
17431                            this.container.css({
17432                                top: containerTop,
17433                                left: 'auto',
17434                                right: 0
17435                            });
17436                        } else {
17437                            this.container.css({
17438                                top: containerTop,
17439                                left: containerLeft,
17440                                right: 'auto'
17441                            });
17442                        }
17443                    } else {
17444                        var containerLeft = this.element.offset().left - parentOffset.left;
17445                        if (containerLeft + containerWidth > $(window).width()) {
17446                            this.container.css({
17447                                top: containerTop,
17448                                left: 'auto',
17449                                right: 0
17450                            });
17451                        } else {
17452                            this.container.css({
17453                                top: containerTop,
17454                                left: containerLeft,
17455                                right: 'auto'
17456                            });
17457                        }
17458                    }
17459                },
17460
17461                show: function (e) {
17462                    if (this.isShowing) return;
17463
17464                    // Create a click proxy that is private to this instance of datepicker, for unbinding
17465                    this._outsideClickProxy = $.proxy(function (e) {
17466                        this.outsideClick(e);
17467                    }, this);
17468
17469                    // Bind global datepicker mousedown for hiding and
17470                    $(document)
17471                        .on('mousedown.daterangepicker', this._outsideClickProxy)
17472                        // also support mobile devices
17473                        .on('touchend.daterangepicker', this._outsideClickProxy)
17474                        // also explicitly play nice with Bootstrap dropdowns, which stopPropagation when clicking them
17475                        .on('click.daterangepicker', '[data-toggle=dropdown]', this._outsideClickProxy)
17476                        // and also close when focus changes to outside the picker (eg. tabbing between controls)
17477                        .on('focusin.daterangepicker', this._outsideClickProxy);
17478
17479                    // Reposition the picker if the window is resized while it's open
17480                    $(window).on('resize.daterangepicker', $.proxy(function (e) {
17481                        this.move(e);
17482                    }, this));
17483
17484                    this.oldStartDate = this.startDate.clone();
17485                    this.oldEndDate = this.endDate.clone();
17486                    this.previousRightTime = this.endDate.clone();
17487
17488                    this.updateView();
17489                    this.container.show();
17490                    this.move();
17491                    this.element.trigger('show.daterangepicker', this);
17492                    this.isShowing = true;
17493                },
17494
17495                hide: function (e) {
17496                    if (!this.isShowing) return;
17497
17498                    //incomplete date selection, revert to last values
17499                    if (!this.endDate) {
17500                        this.startDate = this.oldStartDate.clone();
17501                        this.endDate = this.oldEndDate.clone();
17502                    }
17503
17504                    //if a new date range was selected, invoke the user callback function
17505                    if (!this.startDate.isSame(this.oldStartDate) || !this.endDate.isSame(this.oldEndDate))
17506                        this.callback(this.startDate.clone(), this.endDate.clone(), this.chosenLabel);
17507
17508                    //if picker is attached to a text input, update it
17509                    this.updateElement();
17510
17511                    $(document).off('.daterangepicker');
17512                    $(window).off('.daterangepicker');
17513                    this.container.hide();
17514                    this.element.trigger('hide.daterangepicker', this);
17515                    this.isShowing = false;
17516                },
17517
17518                toggle: function (e) {
17519                    if (this.isShowing) {
17520                        this.hide();
17521                    } else {
17522                        this.show();
17523                    }
17524                },
17525
17526                outsideClick: function (e) {
17527                    var target = $(e.target);
17528                    // if the page is clicked anywhere except within the daterangerpicker/button
17529                    // itself then call this.hide()
17530                    if (
17531                        // ie modal dialog fix
17532                        e.type == "focusin" ||
17533                        target.closest(this.element).length ||
17534                        target.closest(this.container).length ||
17535                        target.closest('.calendar-table').length
17536                    ) return;
17537                    this.hide();
17538                    this.element.trigger('outsideClick.daterangepicker', this);
17539                },
17540
17541                showCalendars: function () {
17542                    this.container.addClass('show-calendar');
17543                    this.move();
17544                    this.element.trigger('showCalendar.daterangepicker', this);
17545                },
17546
17547                hideCalendars: function () {
17548                    this.container.removeClass('show-calendar');
17549                    this.element.trigger('hideCalendar.daterangepicker', this);
17550                },
17551
17552                clickRange: function (e) {
17553                    var label = e.target.getAttribute('data-range-key');
17554                    this.chosenLabel = label;
17555                    if (label == this.locale.customRangeLabel) {
17556                        this.showCalendars();
17557                    } else {
17558                        var dates = this.ranges[label];
17559                        this.startDate = dates[0];
17560                        this.endDate = dates[1];
17561
17562                        if (!this.timePicker) {
17563                            this.startDate.startOf('day');
17564                            this.endDate.endOf('day');
17565                        }
17566
17567                        if (!this.alwaysShowCalendars)
17568                            this.hideCalendars();
17569                        this.clickApply();
17570                    }
17571                },
17572
17573                clickPrev: function (e) {
17574                    var cal = $(e.target).parents('.drp-calendar');
17575                    if (cal.hasClass('left')) {
17576                        this.leftCalendar.month.subtract(1, 'month');
17577                        if (this.linkedCalendars)
17578                            this.rightCalendar.month.subtract(1, 'month');
17579                    } else {
17580                        this.rightCalendar.month.subtract(1, 'month');
17581                    }
17582                    this.updateCalendars();
17583                },
17584
17585                clickNext: function (e) {
17586                    var cal = $(e.target).parents('.drp-calendar');
17587                    if (cal.hasClass('left')) {
17588                        this.leftCalendar.month.add(1, 'month');
17589                    } else {
17590                        this.rightCalendar.month.add(1, 'month');
17591                        if (this.linkedCalendars)
17592                            this.leftCalendar.month.add(1, 'month');
17593                    }
17594                    this.updateCalendars();
17595                },
17596
17597                hoverDate: function (e) {
17598
17599                    //ignore dates that can't be selected
17600                    if (!$(e.target).hasClass('available')) return;
17601
17602                    var title = $(e.target).attr('data-title');
17603                    var row = title.substr(1, 1);
17604                    var col = title.substr(3, 1);
17605                    var cal = $(e.target).parents('.drp-calendar');
17606                    var date = cal.hasClass('left') ? this.leftCalendar.calendar[row][col] : this.rightCalendar.calendar[row][col];
17607
17608                    //highlight the dates between the start date and the date being hovered as a potential end date
17609                    var leftCalendar = this.leftCalendar;
17610                    var rightCalendar = this.rightCalendar;
17611                    var startDate = this.startDate;
17612                    if (!this.endDate) {
17613                        this.container.find('.drp-calendar tbody td').each(function (index, el) {
17614
17615                            //skip week numbers, only look at dates
17616                            if ($(el).hasClass('week')) return;
17617
17618                            var title = $(el).attr('data-title');
17619                            var row = title.substr(1, 1);
17620                            var col = title.substr(3, 1);
17621                            var cal = $(el).parents('.drp-calendar');
17622                            var dt = cal.hasClass('left') ? leftCalendar.calendar[row][col] : rightCalendar.calendar[row][col];
17623
17624                            if ((dt.isAfter(startDate) && dt.isBefore(date)) || dt.isSame(date, 'day')) {
17625                                $(el).addClass('in-range');
17626                            } else {
17627                                $(el).removeClass('in-range');
17628                            }
17629
17630                        });
17631                    }
17632
17633                },
17634
17635                clickDate: function (e) {
17636
17637                    if (!$(e.target).hasClass('available')) return;
17638
17639                    var title = $(e.target).attr('data-title');
17640                    var row = title.substr(1, 1);
17641                    var col = title.substr(3, 1);
17642                    var cal = $(e.target).parents('.drp-calendar');
17643                    var date = cal.hasClass('left') ? this.leftCalendar.calendar[row][col] : this.rightCalendar.calendar[row][col];
17644
17645                    //
17646                    // this function needs to do a few things:
17647                    // * alternate between selecting a start and end date for the range,
17648                    // * if the time picker is enabled, apply the hour/minute/second from the select boxes to the clicked date
17649                    // * if autoapply is enabled, and an end date was chosen, apply the selection
17650                    // * if single date picker mode, and time picker isn't enabled, apply the selection immediately
17651                    // * if one of the inputs above the calendars was focused, cancel that manual input
17652                    //
17653
17654                    if (this.endDate || date.isBefore(this.startDate, 'day')) { //picking start
17655                        if (this.timePicker) {
17656                            var hour = parseInt(this.container.find('.left .hourselect').val(), 10);
17657                            if (!this.timePicker24Hour) {
17658                                var ampm = this.container.find('.left .ampmselect').val();
17659                                if (ampm === 'PM' && hour < 12)
17660                                    hour += 12;
17661                                if (ampm === 'AM' && hour === 12)
17662                                    hour = 0;
17663                            }
17664                            var minute = parseInt(this.container.find('.left .minuteselect').val(), 10);
17665                            if (isNaN(minute)) {
17666                                minute = parseInt(this.container.find('.left .minuteselect option:last').val(), 10);
17667                            }
17668                            var second = this.timePickerSeconds ? parseInt(this.container.find('.left .secondselect').val(), 10) : 0;
17669                            date = date.clone().hour(hour).minute(minute).second(second);
17670                        }
17671                        this.endDate = null;
17672                        this.setStartDate(date.clone());
17673                    } else if (!this.endDate && date.isBefore(this.startDate)) {
17674                        //special case: clicking the same date for start/end,
17675                        //but the time of the end date is before the start date
17676                        this.setEndDate(this.startDate.clone());
17677                    } else { // picking end
17678                        if (this.timePicker) {
17679                            var hour = parseInt(this.container.find('.right .hourselect').val(), 10);
17680                            if (!this.timePicker24Hour) {
17681                                var ampm = this.container.find('.right .ampmselect').val();
17682                                if (ampm === 'PM' && hour < 12)
17683                                    hour += 12;
17684                                if (ampm === 'AM' && hour === 12)
17685                                    hour = 0;
17686                            }
17687                            var minute = parseInt(this.container.find('.right .minuteselect').val(), 10);
17688                            if (isNaN(minute)) {
17689                                minute = parseInt(this.container.find('.right .minuteselect option:last').val(), 10);
17690                            }
17691                            var second = this.timePickerSeconds ? parseInt(this.container.find('.right .secondselect').val(), 10) : 0;
17692                            date = date.clone().hour(hour).minute(minute).second(second);
17693                        }
17694                        this.setEndDate(date.clone());
17695                        if (this.autoApply) {
17696                            this.calculateChosenLabel();
17697                            this.clickApply();
17698                        }
17699                    }
17700
17701                    if (this.singleDatePicker) {
17702                        this.setEndDate(this.startDate);
17703                        if (!this.timePicker && this.autoApply)
17704                            this.clickApply();
17705                    }
17706
17707                    this.updateView();
17708
17709                    //This is to cancel the blur event handler if the mouse was in one of the inputs
17710                    e.stopPropagation();
17711
17712                },
17713
17714                calculateChosenLabel: function () {
17715                    var customRange = true;
17716                    var i = 0;
17717                    for (var range in this.ranges) {
17718                        if (this.timePicker) {
17719                            var format = this.timePickerSeconds ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD HH:mm";
17720                            //ignore times when comparing dates if time picker seconds is not enabled
17721                            if (this.startDate.format(format) == this.ranges[range][0].format(format) && this.endDate.format(format) == this.ranges[range][1].format(format)) {
17722                                customRange = false;
17723                                this.chosenLabel = this.container.find('.ranges li:eq(' + i + ')').addClass('active').attr('data-range-key');
17724                                break;
17725                            }
17726                        } else {
17727                            //ignore times when comparing dates if time picker is not enabled
17728                            if (this.startDate.format('YYYY-MM-DD') == this.ranges[range][0].format('YYYY-MM-DD') && this.endDate.format('YYYY-MM-DD') == this.ranges[range][1].format('YYYY-MM-DD')) {
17729                                customRange = false;
17730                                this.chosenLabel = this.container.find('.ranges li:eq(' + i + ')').addClass('active').attr('data-range-key');
17731                                break;
17732                            }
17733                        }
17734                        i++;
17735                    }
17736                    if (customRange) {
17737                        if (this.showCustomRangeLabel) {
17738                            this.chosenLabel = this.container.find('.ranges li:last').addClass('active').attr('data-range-key');
17739                        } else {
17740                            this.chosenLabel = null;
17741                        }
17742                        this.showCalendars();
17743                    }
17744                },
17745
17746                clickApply: function (e) {
17747                    this.hide();
17748                    this.element.trigger('apply.daterangepicker', this);
17749                },
17750
17751                clickCancel: function (e) {
17752                    this.startDate = this.oldStartDate;
17753                    this.endDate = this.oldEndDate;
17754                    this.hide();
17755                    this.element.trigger('cancel.daterangepicker', this);
17756                },
17757
17758                monthOrYearChanged: function (e) {
17759                    var isLeft = $(e.target).closest('.drp-calendar').hasClass('left'),
17760                        leftOrRight = isLeft ? 'left' : 'right',
17761                        cal = this.container.find('.drp-calendar.' + leftOrRight);
17762
17763                    // Month must be Number for new moment versions
17764                    var month = parseInt(cal.find('.monthselect').val(), 10);
17765                    var year = cal.find('.yearselect').val();
17766
17767                    if (!isLeft) {
17768                        if (year < this.startDate.year() || (year == this.startDate.year() && month < this.startDate.month())) {
17769                            month = this.startDate.month();
17770                            year = this.startDate.year();
17771                        }
17772                    }
17773
17774                    if (this.minDate) {
17775                        if (year < this.minDate.year() || (year == this.minDate.year() && month < this.minDate.month())) {
17776                            month = this.minDate.month();
17777                            year = this.minDate.year();
17778                        }
17779                    }
17780
17781                    if (this.maxDate) {
17782                        if (year > this.maxDate.year() || (year == this.maxDate.year() && month > this.maxDate.month())) {
17783                            month = this.maxDate.month();
17784                            year = this.maxDate.year();
17785                        }
17786                    }
17787
17788                    if (isLeft) {
17789                        this.leftCalendar.month.month(month).year(year);
17790                        if (this.linkedCalendars)
17791                            this.rightCalendar.month = this.leftCalendar.month.clone().add(1, 'month');
17792                    } else {
17793                        this.rightCalendar.month.month(month).year(year);
17794                        if (this.linkedCalendars)
17795                            this.leftCalendar.month = this.rightCalendar.month.clone().subtract(1, 'month');
17796                    }
17797                    this.updateCalendars();
17798                },
17799
17800                timeChanged: function (e) {
17801
17802                    var cal = $(e.target).closest('.drp-calendar'),
17803                        isLeft = cal.hasClass('left');
17804
17805                    var hour = parseInt(cal.find('.hourselect').val(), 10);
17806                    var minute = parseInt(cal.find('.minuteselect').val(), 10);
17807                    if (isNaN(minute)) {
17808                        minute = parseInt(cal.find('.minuteselect option:last').val(), 10);
17809                    }
17810                    var second = this.timePickerSeconds ? parseInt(cal.find('.secondselect').val(), 10) : 0;
17811
17812                    if (!this.timePicker24Hour) {
17813                        var ampm = cal.find('.ampmselect').val();
17814                        if (ampm === 'PM' && hour < 12)
17815                            hour += 12;
17816                        if (ampm === 'AM' && hour === 12)
17817                            hour = 0;
17818                    }
17819
17820                    if (isLeft) {
17821                        var start = this.startDate.clone();
17822                        start.hour(hour);
17823                        start.minute(minute);
17824                        start.second(second);
17825                        this.setStartDate(start);
17826                        if (this.singleDatePicker) {
17827                            this.endDate = this.startDate.clone();
17828                        } else if (this.endDate && this.endDate.format('YYYY-MM-DD') == start.format('YYYY-MM-DD') && this.endDate.isBefore(start)) {
17829                            this.setEndDate(start.clone());
17830                        }
17831                    } else if (this.endDate) {
17832                        var end = this.endDate.clone();
17833                        end.hour(hour);
17834                        end.minute(minute);
17835                        end.second(second);
17836                        this.setEndDate(end);
17837                    }
17838
17839                    //update the calendars so all clickable dates reflect the new time component
17840                    this.updateCalendars();
17841
17842                    //update the form inputs above the calendars with the new time
17843                    this.updateFormInputs();
17844
17845                    //re-render the time pickers because changing one selection can affect what's enabled in another
17846                    this.renderTimePicker('left');
17847                    this.renderTimePicker('right');
17848
17849                },
17850
17851                elementChanged: function () {
17852                    if (!this.element.is('input')) return;
17853                    if (!this.element.val().length) return;
17854
17855                    var dateString = this.element.val().split(this.locale.separator),
17856                        start = null,
17857                        end = null;
17858
17859                    if (dateString.length === 2) {
17860                        start = moment(dateString[0], this.locale.format);
17861                        end = moment(dateString[1], this.locale.format);
17862                    }
17863
17864                    if (this.singleDatePicker || start === null || end === null) {
17865                        start = moment(this.element.val(), this.locale.format);
17866                        end = start;
17867                    }
17868
17869                    if (!start.isValid() || !end.isValid()) return;
17870
17871                    this.setStartDate(start);
17872                    this.setEndDate(end);
17873                    this.updateView();
17874                },
17875
17876                keydown: function (e) {
17877                    //hide on tab or enter
17878                    if ((e.keyCode === 9) || (e.keyCode === 13)) {
17879                        this.hide();
17880                    }
17881
17882                    //hide on esc and prevent propagation
17883                    if (e.keyCode === 27) {
17884                        e.preventDefault();
17885                        e.stopPropagation();
17886
17887                        this.hide();
17888                    }
17889                },
17890
17891                updateElement: function () {
17892                    if (this.element.is('input') && this.autoUpdateInput) {
17893                        var newValue = this.startDate.format(this.locale.format);
17894                        if (!this.singleDatePicker) {
17895                            newValue += this.locale.separator + this.endDate.format(this.locale.format);
17896                        }
17897                        if (newValue !== this.element.val()) {
17898                            this.element.val(newValue).trigger('change');
17899                        }
17900                    }
17901                },
17902
17903                remove: function () {
17904                    this.container.remove();
17905                    this.element.off('.daterangepicker');
17906                    this.element.removeData();
17907                }
17908
17909            };
17910
17911            $.fn.daterangepicker = function (options, callback) {
17912                var implementOptions = $.extend(true, {}, $.fn.daterangepicker.defaultOptions, options);
17913                this.each(function () {
17914                    var el = $(this);
17915                    if (el.data('daterangepicker'))
17916                        el.data('daterangepicker').remove();
17917                    el.data('daterangepicker', new DateRangePicker(el, implementOptions, callback));
17918                });
17919                return this;
17920            };
17921
17922            return DateRangePicker;
17923
17924        }));
17925
17926    }, {"jquery": 6, "moment": 9}],
vendor: 55,244 bytes, lines 17927-19595
17927    4: [function (require, module, exports) {
17928        /**
17929         * Dom7 3.0.0-alpha.9
17930         * Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API
17931         * https://framework7.io/docs/dom7.html
17932         *
17933         * Copyright 2020, Vladimir Kharlampidi
17934         *
17935         * Licensed under MIT
17936         *
17937         * Released on: August 25, 2020
17938         */
17939        'use strict';
17940
17941        Object.defineProperty(exports, '__esModule', {value: true});
17942
17943        var ssrWindow = require('ssr-window');
17944
17945        function _inheritsLoose(subClass, superClass) {
17946            subClass.prototype = Object.create(superClass.prototype);
17947            subClass.prototype.constructor = subClass;
17948            subClass.__proto__ = superClass;
17949        }
17950
17951        function _getPrototypeOf(o) {
17952            _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
17953                return o.__proto__ || Object.getPrototypeOf(o);
17954            };
17955            return _getPrototypeOf(o);
17956        }
17957
17958        function _setPrototypeOf(o, p) {
17959            _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
17960                o.__proto__ = p;
17961                return o;
17962            };
17963
17964            return _setPrototypeOf(o, p);
17965        }
17966
17967        function _isNativeReflectConstruct() {
17968            if (typeof Reflect === "undefined" || !Reflect.construct) return false;
17969            if (Reflect.construct.sham) return false;
17970            if (typeof Proxy === "function") return true;
17971
17972            try {
17973                Date.prototype.toString.call(Reflect.construct(Date, [], function () {
17974                }));
17975                return true;
17976            } catch (e) {
17977                return false;
17978            }
17979        }
17980
17981        function _construct(Parent, args, Class) {
17982            if (_isNativeReflectConstruct()) {
17983                _construct = Reflect.construct;
17984            } else {
17985                _construct = function _construct(Parent, args, Class) {
17986                    var a = [null];
17987                    a.push.apply(a, args);
17988                    var Constructor = Function.bind.apply(Parent, a);
17989                    var instance = new Constructor();
17990                    if (Class) _setPrototypeOf(instance, Class.prototype);
17991                    return instance;
17992                };
17993            }
17994
17995            return _construct.apply(null, arguments);
17996        }
17997
17998        function _isNativeFunction(fn) {
17999            return Function.toString.call(fn).indexOf("[native code]") !== -1;
18000        }
18001
18002        function _wrapNativeSuper(Class) {
18003            var _cache = typeof Map === "function" ? new Map() : undefined;
18004
18005            _wrapNativeSuper = function _wrapNativeSuper(Class) {
18006                if (Class === null || !_isNativeFunction(Class)) return Class;
18007
18008                if (typeof Class !== "function") {
18009                    throw new TypeError("Super expression must either be null or a function");
18010                }
18011
18012                if (typeof _cache !== "undefined") {
18013                    if (_cache.has(Class)) return _cache.get(Class);
18014
18015                    _cache.set(Class, Wrapper);
18016                }
18017
18018                function Wrapper() {
18019                    return _construct(Class, arguments, _getPrototypeOf(this).constructor);
18020                }
18021
18022                Wrapper.prototype = Object.create(Class.prototype, {
18023                    constructor: {
18024                        value: Wrapper,
18025                        enumerable: false,
18026                        writable: true,
18027                        configurable: true
18028                    }
18029                });
18030                return _setPrototypeOf(Wrapper, Class);
18031            };
18032
18033            return _wrapNativeSuper(Class);
18034        }
18035
18036        function _assertThisInitialized(self) {
18037            if (self === void 0) {
18038                throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
18039            }
18040
18041            return self;
18042        }
18043
18044        /* eslint-disable no-proto */
18045        function makeReactive(obj) {
18046            var proto = obj.__proto__;
18047            Object.defineProperty(obj, '__proto__', {
18048                get: function get() {
18049                    return proto;
18050                },
18051                set: function set(value) {
18052                    proto.__proto__ = value;
18053                }
18054            });
18055        }
18056
18057        var Dom7 = /*#__PURE__*/function (_Array) {
18058            _inheritsLoose(Dom7, _Array);
18059
18060            function Dom7(items) {
18061                var _this;
18062
18063                _this = _Array.call.apply(_Array, [this].concat(items)) || this;
18064                makeReactive(_assertThisInitialized(_this));
18065                return _this;
18066            }
18067
18068            return Dom7;
18069        }( /*#__PURE__*/_wrapNativeSuper(Array));
18070
18071        function arrayFlat(arr) {
18072            if (arr === void 0) {
18073                arr = [];
18074            }
18075
18076            var res = [];
18077            arr.forEach(function (el) {
18078                if (Array.isArray(el)) {
18079                    res.push.apply(res, arrayFlat(el));
18080                } else {
18081                    res.push(el);
18082                }
18083            });
18084            return res;
18085        }
18086
18087        function arrayFilter(arr, callback) {
18088            return Array.prototype.filter.call(arr, callback);
18089        }
18090
18091        function arrayUnique(arr) {
18092            var uniqueArray = [];
18093
18094            for (var i = 0; i < arr.length; i += 1) {
18095                if (uniqueArray.indexOf(arr[i]) === -1) uniqueArray.push(arr[i]);
18096            }
18097
18098            return uniqueArray;
18099        }
18100
18101        function toCamelCase(string) {
18102            return string.toLowerCase().replace(/-(.)/g, function (match, group) {
18103                return group.toUpperCase();
18104            });
18105        }
18106
18107        function qsa(selector, context) {
18108            if (typeof selector !== 'string') {
18109                return [selector];
18110            }
18111
18112            var a = [];
18113            var res = context.querySelectorAll(selector);
18114
18115            for (var i = 0; i < res.length; i += 1) {
18116                a.push(res[i]);
18117            }
18118
18119            return a;
18120        }
18121
18122        function $(selector, context) {
18123            var window = ssrWindow.getWindow();
18124            var document = ssrWindow.getDocument();
18125            var arr = [];
18126
18127            if (!context && selector instanceof Dom7) {
18128                return selector;
18129            }
18130
18131            if (!selector) {
18132                return new Dom7(arr);
18133            }
18134
18135            if (typeof selector === 'string') {
18136                var html = selector.trim();
18137
18138                if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) {
18139                    var toCreate = 'div';
18140                    if (html.indexOf('<li') === 0) toCreate = 'ul';
18141                    if (html.indexOf('<tr') === 0) toCreate = 'tbody';
18142                    if (html.indexOf('<td') === 0 || html.indexOf('<th') === 0) toCreate = 'tr';
18143                    if (html.indexOf('<tbody') === 0) toCreate = 'table';
18144                    if (html.indexOf('<option') === 0) toCreate = 'select';
18145                    var tempParent = document.createElement(toCreate);
18146                    tempParent.innerHTML = html;
18147
18148                    for (var i = 0; i < tempParent.childNodes.length; i += 1) {
18149                        arr.push(tempParent.childNodes[i]);
18150                    }
18151                } else {
18152                    arr = qsa(selector.trim(), context || document);
18153                } // arr = qsa(selector, document);
18154
18155            } else if (selector.nodeType || selector === window || selector === document) {
18156                arr.push(selector);
18157            } else if (Array.isArray(selector)) {
18158                if (selector instanceof Dom7) return selector;
18159                arr = selector;
18160            }
18161
18162            return new Dom7(arrayUnique(arr));
18163        }
18164
18165        $.fn = Dom7.prototype;
18166
18167        function addClass() {
18168            for (var _len = arguments.length, classes = new Array(_len), _key = 0; _key < _len; _key++) {
18169                classes[_key] = arguments[_key];
18170            }
18171
18172            var classNames = arrayFlat(classes.map(function (c) {
18173                return c.split(' ');
18174            }));
18175            this.forEach(function (el) {
18176                var _el$classList;
18177
18178                (_el$classList = el.classList).add.apply(_el$classList, classNames);
18179            });
18180            return this;
18181        }
18182
18183        function removeClass() {
18184            for (var _len2 = arguments.length, classes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
18185                classes[_key2] = arguments[_key2];
18186            }
18187
18188            var classNames = arrayFlat(classes.map(function (c) {
18189                return c.split(' ');
18190            }));
18191            this.forEach(function (el) {
18192                var _el$classList2;
18193
18194                (_el$classList2 = el.classList).remove.apply(_el$classList2, classNames);
18195            });
18196            return this;
18197        }
18198
18199        function toggleClass() {
18200            for (var _len3 = arguments.length, classes = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
18201                classes[_key3] = arguments[_key3];
18202            }
18203
18204            var classNames = arrayFlat(classes.map(function (c) {
18205                return c.split(' ');
18206            }));
18207            this.forEach(function (el) {
18208                classNames.forEach(function (className) {
18209                    el.classList.toggle(className);
18210                });
18211            });
18212        }
18213
18214        function hasClass() {
18215            for (var _len4 = arguments.length, classes = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
18216                classes[_key4] = arguments[_key4];
18217            }
18218
18219            var classNames = arrayFlat(classes.map(function (c) {
18220                return c.split(' ');
18221            }));
18222            return arrayFilter(this, function (el) {
18223                return classNames.filter(function (className) {
18224                    return el.classList.contains(className);
18225                }).length > 0;
18226            }).length > 0;
18227        }
18228
18229        function attr(attrs, value) {
18230            if (arguments.length === 1 && typeof attrs === 'string') {
18231                // Get attr
18232                if (this[0]) return this[0].getAttribute(attrs);
18233                return undefined;
18234            } // Set attrs
18235
18236
18237            for (var i = 0; i < this.length; i += 1) {
18238                if (arguments.length === 2) {
18239                    // String
18240                    this[i].setAttribute(attrs, value);
18241                } else {
18242                    // Object
18243                    for (var attrName in attrs) {
18244                        this[i][attrName] = attrs[attrName];
18245                        this[i].setAttribute(attrName, attrs[attrName]);
18246                    }
18247                }
18248            }
18249
18250            return this;
18251        }
18252
18253        function removeAttr(attr) {
18254            for (var i = 0; i < this.length; i += 1) {
18255                this[i].removeAttribute(attr);
18256            }
18257
18258            return this;
18259        }
18260
18261        function prop(props, value) {
18262            if (arguments.length === 1 && typeof props === 'string') {
18263                // Get prop
18264                if (this[0]) return this[0][props];
18265            } else {
18266                // Set props
18267                for (var i = 0; i < this.length; i += 1) {
18268                    if (arguments.length === 2) {
18269                        // String
18270                        this[i][props] = value;
18271                    } else {
18272                        // Object
18273                        for (var propName in props) {
18274                            this[i][propName] = props[propName];
18275                        }
18276                    }
18277                }
18278
18279                return this;
18280            }
18281
18282            return this;
18283        }
18284
18285        function data(key, value) {
18286            var el;
18287
18288            if (typeof value === 'undefined') {
18289                el = this[0];
18290                if (!el) return undefined; // Get value
18291
18292                if (el.dom7ElementDataStorage && key in el.dom7ElementDataStorage) {
18293                    return el.dom7ElementDataStorage[key];
18294                }
18295
18296                var dataKey = el.getAttribute("data-" + key);
18297
18298                if (dataKey) {
18299                    return dataKey;
18300                }
18301
18302                return undefined;
18303            } // Set value
18304
18305
18306            for (var i = 0; i < this.length; i += 1) {
18307                el = this[i];
18308                if (!el.dom7ElementDataStorage) el.dom7ElementDataStorage = {};
18309                el.dom7ElementDataStorage[key] = value;
18310            }
18311
18312            return this;
18313        }
18314
18315        function removeData(key) {
18316            for (var i = 0; i < this.length; i += 1) {
18317                var el = this[i];
18318
18319                if (el.dom7ElementDataStorage && el.dom7ElementDataStorage[key]) {
18320                    el.dom7ElementDataStorage[key] = null;
18321                    delete el.dom7ElementDataStorage[key];
18322                }
18323            }
18324        }
18325
18326        function dataset() {
18327            var el = this[0];
18328            if (!el) return undefined;
18329            var dataset = {}; // eslint-disable-line
18330
18331            if (el.dataset) {
18332                for (var dataKey in el.dataset) {
18333                    dataset[dataKey] = el.dataset[dataKey];
18334                }
18335            } else {
18336                for (var i = 0; i < el.attributes.length; i += 1) {
18337                    var _attr = el.attributes[i];
18338
18339                    if (_attr.name.indexOf('data-') >= 0) {
18340                        dataset[toCamelCase(_attr.name.split('data-')[1])] = _attr.value;
18341                    }
18342                }
18343            }
18344
18345            for (var key in dataset) {
18346                if (dataset[key] === 'false') dataset[key] = false; else if (dataset[key] === 'true') dataset[key] = true; else if (parseFloat(dataset[key]) === dataset[key] * 1) dataset[key] *= 1;
18347            }
18348
18349            return dataset;
18350        }
18351
18352        function val(value) {
18353            if (typeof value === 'undefined') {
18354                // get value
18355                var el = this[0];
18356                if (!el) return undefined;
18357
18358                if (el.multiple && el.nodeName.toLowerCase() === 'select') {
18359                    var values = [];
18360
18361                    for (var i = 0; i < el.selectedOptions.length; i += 1) {
18362                        values.push(el.selectedOptions[i].value);
18363                    }
18364
18365                    return values;
18366                }
18367
18368                return el.value;
18369            } // set value
18370
18371
18372            for (var _i = 0; _i < this.length; _i += 1) {
18373                var _el = this[_i];
18374
18375                if (Array.isArray(value) && _el.multiple && _el.nodeName.toLowerCase() === 'select') {
18376                    for (var j = 0; j < _el.options.length; j += 1) {
18377                        _el.options[j].selected = value.indexOf(_el.options[j].value) >= 0;
18378                    }
18379                } else {
18380                    _el.value = value;
18381                }
18382            }
18383
18384            return this;
18385        }
18386
18387        function value(value) {
18388            return this.val(value);
18389        }
18390
18391        function transform(transform) {
18392            for (var i = 0; i < this.length; i += 1) {
18393                this[i].style.transform = transform;
18394            }
18395
18396            return this;
18397        }
18398
18399        function transition(duration) {
18400            for (var i = 0; i < this.length; i += 1) {
18401                this[i].style.transition = typeof duration !== 'string' ? duration + "ms" : duration;
18402            }
18403
18404            return this;
18405        }
18406
18407        function on() {
18408            for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
18409                args[_key5] = arguments[_key5];
18410            }
18411
18412            var eventType = args[0],
18413                targetSelector = args[1],
18414                listener = args[2],
18415                capture = args[3];
18416
18417            if (typeof args[1] === 'function') {
18418                eventType = args[0];
18419                listener = args[1];
18420                capture = args[2];
18421                targetSelector = undefined;
18422            }
18423
18424            if (!capture) capture = false;
18425
18426            function handleLiveEvent(e) {
18427                var target = e.target;
18428                if (!target) return;
18429                var eventData = e.target.dom7EventData || [];
18430
18431                if (eventData.indexOf(e) < 0) {
18432                    eventData.unshift(e);
18433                }
18434
18435                if ($(target).is(targetSelector)) listener.apply(target, eventData); else {
18436                    var _parents = $(target).parents(); // eslint-disable-line
18437
18438
18439                    for (var k = 0; k < _parents.length; k += 1) {
18440                        if ($(_parents[k]).is(targetSelector)) listener.apply(_parents[k], eventData);
18441                    }
18442                }
18443            }
18444
18445            function handleEvent(e) {
18446                var eventData = e && e.target ? e.target.dom7EventData || [] : [];
18447
18448                if (eventData.indexOf(e) < 0) {
18449                    eventData.unshift(e);
18450                }
18451
18452                listener.apply(this, eventData);
18453            }
18454
18455            var events = eventType.split(' ');
18456            var j;
18457
18458            for (var i = 0; i < this.length; i += 1) {
18459                var el = this[i];
18460
18461                if (!targetSelector) {
18462                    for (j = 0; j < events.length; j += 1) {
18463                        var event = events[j];
18464                        if (!el.dom7Listeners) el.dom7Listeners = {};
18465                        if (!el.dom7Listeners[event]) el.dom7Listeners[event] = [];
18466                        el.dom7Listeners[event].push({
18467                            listener: listener,
18468                            proxyListener: handleEvent
18469                        });
18470                        el.addEventListener(event, handleEvent, capture);
18471                    }
18472                } else {
18473                    // Live events
18474                    for (j = 0; j < events.length; j += 1) {
18475                        var _event = events[j];
18476                        if (!el.dom7LiveListeners) el.dom7LiveListeners = {};
18477                        if (!el.dom7LiveListeners[_event]) el.dom7LiveListeners[_event] = [];
18478
18479                        el.dom7LiveListeners[_event].push({
18480                            listener: listener,
18481                            proxyListener: handleLiveEvent
18482                        });
18483
18484                        el.addEventListener(_event, handleLiveEvent, capture);
18485                    }
18486                }
18487            }
18488
18489            return this;
18490        }
18491
18492        function off() {
18493            for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
18494                args[_key6] = arguments[_key6];
18495            }
18496
18497            var eventType = args[0],
18498                targetSelector = args[1],
18499                listener = args[2],
18500                capture = args[3];
18501
18502            if (typeof args[1] === 'function') {
18503                eventType = args[0];
18504                listener = args[1];
18505                capture = args[2];
18506                targetSelector = undefined;
18507            }
18508
18509            if (!capture) capture = false;
18510            var events = eventType.split(' ');
18511
18512            for (var i = 0; i < events.length; i += 1) {
18513                var event = events[i];
18514
18515                for (var j = 0; j < this.length; j += 1) {
18516                    var el = this[j];
18517                    var handlers = void 0;
18518
18519                    if (!targetSelector && el.dom7Listeners) {
18520                        handlers = el.dom7Listeners[event];
18521                    } else if (targetSelector && el.dom7LiveListeners) {
18522                        handlers = el.dom7LiveListeners[event];
18523                    }
18524
18525                    if (handlers && handlers.length) {
18526                        for (var k = handlers.length - 1; k >= 0; k -= 1) {
18527                            var handler = handlers[k];
18528
18529                            if (listener && handler.listener === listener) {
18530                                el.removeEventListener(event, handler.proxyListener, capture);
18531                                handlers.splice(k, 1);
18532                            } else if (listener && handler.listener && handler.listener.dom7proxy && handler.listener.dom7proxy === listener) {
18533                                el.removeEventListener(event, handler.proxyListener, capture);
18534                                handlers.splice(k, 1);
18535                            } else if (!listener) {
18536                                el.removeEventListener(event, handler.proxyListener, capture);
18537                                handlers.splice(k, 1);
18538                            }
18539                        }
18540                    }
18541                }
18542            }
18543
18544            return this;
18545        }
18546
18547        function once() {
18548            var dom = this;
18549
18550            for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
18551                args[_key7] = arguments[_key7];
18552            }
18553
18554            var eventName = args[0],
18555                targetSelector = args[1],
18556                listener = args[2],
18557                capture = args[3];
18558
18559            if (typeof args[1] === 'function') {
18560                eventName = args[0];
18561                listener = args[1];
18562                capture = args[2];
18563                targetSelector = undefined;
18564            }
18565
18566            function onceHandler() {
18567                for (var _len8 = arguments.length, eventArgs = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
18568                    eventArgs[_key8] = arguments[_key8];
18569                }
18570
18571                listener.apply(this, eventArgs);
18572                dom.off(eventName, targetSelector, onceHandler, capture);
18573
18574                if (onceHandler.dom7proxy) {
18575                    delete onceHandler.dom7proxy;
18576                }
18577            }
18578
18579            onceHandler.dom7proxy = listener;
18580            return dom.on(eventName, targetSelector, onceHandler, capture);
18581        }
18582
18583        function trigger() {
18584            var window = ssrWindow.getWindow();
18585
18586            for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
18587                args[_key9] = arguments[_key9];
18588            }
18589
18590            var events = args[0].split(' ');
18591            var eventData = args[1];
18592
18593            for (var i = 0; i < events.length; i += 1) {
18594                var event = events[i];
18595
18596                for (var j = 0; j < this.length; j += 1) {
18597                    var el = this[j];
18598
18599                    if (window.CustomEvent) {
18600                        var evt = new window.CustomEvent(event, {
18601                            detail: eventData,
18602                            bubbles: true,
18603                            cancelable: true
18604                        });
18605                        el.dom7EventData = args.filter(function (data, dataIndex) {
18606                            return dataIndex > 0;
18607                        });
18608                        el.dispatchEvent(evt);
18609                        el.dom7EventData = [];
18610                        delete el.dom7EventData;
18611                    }
18612                }
18613            }
18614
18615            return this;
18616        }
18617
18618        function transitionEnd(callback) {
18619            var dom = this;
18620
18621            function fireCallBack(e) {
18622                if (e.target !== this) return;
18623                callback.call(this, e);
18624                dom.off('transitionend', fireCallBack);
18625            }
18626
18627            if (callback) {
18628                dom.on('transitionend', fireCallBack);
18629            }
18630
18631            return this;
18632        }
18633
18634        function animationEnd(callback) {
18635            var dom = this;
18636
18637            function fireCallBack(e) {
18638                if (e.target !== this) return;
18639                callback.call(this, e);
18640                dom.off('animationend', fireCallBack);
18641            }
18642
18643            if (callback) {
18644                dom.on('animationend', fireCallBack);
18645            }
18646
18647            return this;
18648        }
18649
18650        function width() {
18651            var window = ssrWindow.getWindow();
18652
18653            if (this[0] === window) {
18654                return window.innerWidth;
18655            }
18656
18657            if (this.length > 0) {
18658                return parseFloat(this.css('width'));
18659            }
18660
18661            return null;
18662        }
18663
18664        function outerWidth(includeMargins) {
18665            if (this.length > 0) {
18666                if (includeMargins) {
18667                    var _styles = this.styles();
18668
18669                    return this[0].offsetWidth + parseFloat(_styles.getPropertyValue('margin-right')) + parseFloat(_styles.getPropertyValue('margin-left'));
18670                }
18671
18672                return this[0].offsetWidth;
18673            }
18674
18675            return null;
18676        }
18677
18678        function height() {
18679            var window = ssrWindow.getWindow();
18680
18681            if (this[0] === window) {
18682                return window.innerHeight;
18683            }
18684
18685            if (this.length > 0) {
18686                return parseFloat(this.css('height'));
18687            }
18688
18689            return null;
18690        }
18691
18692        function outerHeight(includeMargins) {
18693            if (this.length > 0) {
18694                if (includeMargins) {
18695                    var _styles2 = this.styles();
18696
18697                    return this[0].offsetHeight + parseFloat(_styles2.getPropertyValue('margin-top')) + parseFloat(_styles2.getPropertyValue('margin-bottom'));
18698                }
18699
18700                return this[0].offsetHeight;
18701            }
18702
18703            return null;
18704        }
18705
18706        function offset() {
18707            if (this.length > 0) {
18708                var window = ssrWindow.getWindow();
18709                var document = ssrWindow.getDocument();
18710                var el = this[0];
18711                var box = el.getBoundingClientRect();
18712                var body = document.body;
18713                var clientTop = el.clientTop || body.clientTop || 0;
18714                var clientLeft = el.clientLeft || body.clientLeft || 0;
18715                var scrollTop = el === window ? window.scrollY : el.scrollTop;
18716                var scrollLeft = el === window ? window.scrollX : el.scrollLeft;
18717                return {
18718                    top: box.top + scrollTop - clientTop,
18719                    left: box.left + scrollLeft - clientLeft
18720                };
18721            }
18722
18723            return null;
18724        }
18725
18726        function hide() {
18727            for (var i = 0; i < this.length; i += 1) {
18728                this[i].style.display = 'none';
18729            }
18730
18731            return this;
18732        }
18733
18734        function show() {
18735            var window = ssrWindow.getWindow();
18736
18737            for (var i = 0; i < this.length; i += 1) {
18738                var el = this[i];
18739
18740                if (el.style.display === 'none') {
18741                    el.style.display = '';
18742                }
18743
18744                if (window.getComputedStyle(el, null).getPropertyValue('display') === 'none') {
18745                    // Still not visible
18746                    el.style.display = 'block';
18747                }
18748            }
18749
18750            return this;
18751        }
18752
18753        function styles() {
18754            var window = ssrWindow.getWindow();
18755            if (this[0]) return window.getComputedStyle(this[0], null);
18756            return {};
18757        }
18758
18759        function css(props, value) {
18760            var window = ssrWindow.getWindow();
18761            var i;
18762
18763            if (arguments.length === 1) {
18764                if (typeof props === 'string') {
18765                    // .css('width')
18766                    if (this[0]) return window.getComputedStyle(this[0], null).getPropertyValue(props);
18767                } else {
18768                    // .css({ width: '100px' })
18769                    for (i = 0; i < this.length; i += 1) {
18770                        for (var _prop in props) {
18771                            this[i].style[_prop] = props[_prop];
18772                        }
18773                    }
18774
18775                    return this;
18776                }
18777            }
18778
18779            if (arguments.length === 2 && typeof props === 'string') {
18780                // .css('width', '100px')
18781                for (i = 0; i < this.length; i += 1) {
18782                    this[i].style[props] = value;
18783                }
18784
18785                return this;
18786            }
18787
18788            return this;
18789        }
18790
18791        function each(callback) {
18792            if (!callback) return this;
18793            this.forEach(function (el, index) {
18794                callback.apply(el, [el, index]);
18795            });
18796            return this;
18797        }
18798
18799        function filter(callback) {
18800            var result = arrayFilter(this, callback);
18801            return $(result);
18802        }
18803
18804        function html(html) {
18805            if (typeof html === 'undefined') {
18806                return this[0] ? this[0].innerHTML : null;
18807            }
18808
18809            for (var i = 0; i < this.length; i += 1) {
18810                this[i].innerHTML = html;
18811            }
18812
18813            return this;
18814        }
18815
18816        function text(text) {
18817            if (typeof text === 'undefined') {
18818                return this[0] ? this[0].textContent.trim() : null;
18819            }
18820
18821            for (var i = 0; i < this.length; i += 1) {
18822                this[i].textContent = text;
18823            }
18824
18825            return this;
18826        }
18827
18828        function is(selector) {
18829            var window = ssrWindow.getWindow();
18830            var document = ssrWindow.getDocument();
18831            var el = this[0];
18832            var compareWith;
18833            var i;
18834            if (!el || typeof selector === 'undefined') return false;
18835
18836            if (typeof selector === 'string') {
18837                if (el.matches) return el.matches(selector);
18838                if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector);
18839                if (el.msMatchesSelector) return el.msMatchesSelector(selector);
18840                compareWith = $(selector);
18841
18842                for (i = 0; i < compareWith.length; i += 1) {
18843                    if (compareWith[i] === el) return true;
18844                }
18845
18846                return false;
18847            }
18848
18849            if (selector === document) {
18850                return el === document;
18851            }
18852
18853            if (selector === window) {
18854                return el === window;
18855            }
18856
18857            if (selector.nodeType || selector instanceof Dom7) {
18858                compareWith = selector.nodeType ? [selector] : selector;
18859
18860                for (i = 0; i < compareWith.length; i += 1) {
18861                    if (compareWith[i] === el) return true;
18862                }
18863
18864                return false;
18865            }
18866
18867            return false;
18868        }
18869
18870        function index() {
18871            var child = this[0];
18872            var i;
18873
18874            if (child) {
18875                i = 0; // eslint-disable-next-line
18876
18877                while ((child = child.previousSibling) !== null) {
18878                    if (child.nodeType === 1) i += 1;
18879                }
18880
18881                return i;
18882            }
18883
18884            return undefined;
18885        }
18886
18887        function eq(index) {
18888            if (typeof index === 'undefined') return this;
18889            var length = this.length;
18890
18891            if (index > length - 1) {
18892                return $([]);
18893            }
18894
18895            if (index < 0) {
18896                var returnIndex = length + index;
18897                if (returnIndex < 0) return $([]);
18898                return $([this[returnIndex]]);
18899            }
18900
18901            return $([this[index]]);
18902        }
18903
18904        function append() {
18905            var newChild;
18906            var document = ssrWindow.getDocument();
18907
18908            for (var k = 0; k < arguments.length; k += 1) {
18909                newChild = k < 0 || arguments.length <= k ? undefined : arguments[k];
18910
18911                for (var i = 0; i < this.length; i += 1) {
18912                    if (typeof newChild === 'string') {
18913                        var tempDiv = document.createElement('div');
18914                        tempDiv.innerHTML = newChild;
18915
18916                        while (tempDiv.firstChild) {
18917                            this[i].appendChild(tempDiv.firstChild);
18918                        }
18919                    } else if (newChild instanceof Dom7) {
18920                        for (var j = 0; j < newChild.length; j += 1) {
18921                            this[i].appendChild(newChild[j]);
18922                        }
18923                    } else {
18924                        this[i].appendChild(newChild);
18925                    }
18926                }
18927            }
18928
18929            return this;
18930        }
18931
18932        function appendTo(parent) {
18933            $(parent).append(this);
18934            return this;
18935        }
18936
18937        function prepend(newChild) {
18938            var document = ssrWindow.getDocument();
18939            var i;
18940            var j;
18941
18942            for (i = 0; i < this.length; i += 1) {
18943                if (typeof newChild === 'string') {
18944                    var tempDiv = document.createElement('div');
18945                    tempDiv.innerHTML = newChild;
18946
18947                    for (j = tempDiv.childNodes.length - 1; j >= 0; j -= 1) {
18948                        this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]);
18949                    }
18950                } else if (newChild instanceof Dom7) {
18951                    for (j = 0; j < newChild.length; j += 1) {
18952                        this[i].insertBefore(newChild[j], this[i].childNodes[0]);
18953                    }
18954                } else {
18955                    this[i].insertBefore(newChild, this[i].childNodes[0]);
18956                }
18957            }
18958
18959            return this;
18960        }
18961
18962        function prependTo(parent) {
18963            $(parent).prepend(this);
18964            return this;
18965        }
18966
18967        function insertBefore(selector) {
18968            var before = $(selector);
18969
18970            for (var i = 0; i < this.length; i += 1) {
18971                if (before.length === 1) {
18972                    before[0].parentNode.insertBefore(this[i], before[0]);
18973                } else if (before.length > 1) {
18974                    for (var j = 0; j < before.length; j += 1) {
18975                        before[j].parentNode.insertBefore(this[i].cloneNode(true), before[j]);
18976                    }
18977                }
18978            }
18979        }
18980
18981        function insertAfter(selector) {
18982            var after = $(selector);
18983
18984            for (var i = 0; i < this.length; i += 1) {
18985                if (after.length === 1) {
18986                    after[0].parentNode.insertBefore(this[i], after[0].nextSibling);
18987                } else if (after.length > 1) {
18988                    for (var j = 0; j < after.length; j += 1) {
18989                        after[j].parentNode.insertBefore(this[i].cloneNode(true), after[j].nextSibling);
18990                    }
18991                }
18992            }
18993        }
18994
18995        function next(selector) {
18996            if (this.length > 0) {
18997                if (selector) {
18998                    if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector)) {
18999                        return $([this[0].nextElementSibling]);
19000                    }
19001
19002                    return $([]);
19003                }
19004
19005                if (this[0].nextElementSibling) return $([this[0].nextElementSibling]);
19006                return $([]);
19007            }
19008
19009            return $([]);
19010        }
19011
19012        function nextAll(selector) {
19013            var nextEls = [];
19014            var el = this[0];
19015            if (!el) return $([]);
19016
19017            while (el.nextElementSibling) {
19018                var _next = el.nextElementSibling; // eslint-disable-line
19019
19020                if (selector) {
19021                    if ($(_next).is(selector)) nextEls.push(_next);
19022                } else nextEls.push(_next);
19023
19024                el = _next;
19025            }
19026
19027            return $(nextEls);
19028        }
19029
19030        function prev(selector) {
19031            if (this.length > 0) {
19032                var el = this[0];
19033
19034                if (selector) {
19035                    if (el.previousElementSibling && $(el.previousElementSibling).is(selector)) {
19036                        return $([el.previousElementSibling]);
19037                    }
19038
19039                    return $([]);
19040                }
19041
19042                if (el.previousElementSibling) return $([el.previousElementSibling]);
19043                return $([]);
19044            }
19045
19046            return $([]);
19047        }
19048
19049        function prevAll(selector) {
19050            var prevEls = [];
19051            var el = this[0];
19052            if (!el) return $([]);
19053
19054            while (el.previousElementSibling) {
19055                var _prev = el.previousElementSibling; // eslint-disable-line
19056
19057                if (selector) {
19058                    if ($(_prev).is(selector)) prevEls.push(_prev);
19059                } else prevEls.push(_prev);
19060
19061                el = _prev;
19062            }
19063
19064            return $(prevEls);
19065        }
19066
19067        function siblings(selector) {
19068            return this.nextAll(selector).add(this.prevAll(selector));
19069        }
19070
19071        function parent(selector) {
19072            var parents = []; // eslint-disable-line
19073
19074            for (var i = 0; i < this.length; i += 1) {
19075                if (this[i].parentNode !== null) {
19076                    if (selector) {
19077                        if ($(this[i].parentNode).is(selector)) parents.push(this[i].parentNode);
19078                    } else {
19079                        parents.push(this[i].parentNode);
19080                    }
19081                }
19082            }
19083
19084            return $(parents);
19085        }
19086
19087        function parents(selector) {
19088            var parents = []; // eslint-disable-line
19089
19090            for (var i = 0; i < this.length; i += 1) {
19091                var _parent = this[i].parentNode; // eslint-disable-line
19092
19093                while (_parent) {
19094                    if (selector) {
19095                        if ($(_parent).is(selector)) parents.push(_parent);
19096                    } else {
19097                        parents.push(_parent);
19098                    }
19099
19100                    _parent = _parent.parentNode;
19101                }
19102            }
19103
19104            return $(parents);
19105        }
19106
19107        function closest(selector) {
19108            var closest = this; // eslint-disable-line
19109
19110            if (typeof selector === 'undefined') {
19111                return $([]);
19112            }
19113
19114            if (!closest.is(selector)) {
19115                closest = closest.parents(selector).eq(0);
19116            }
19117
19118            return closest;
19119        }
19120
19121        function find(selector) {
19122            var foundElements = [];
19123
19124            for (var i = 0; i < this.length; i += 1) {
19125                var found = this[i].querySelectorAll(selector);
19126
19127                for (var j = 0; j < found.length; j += 1) {
19128                    foundElements.push(found[j]);
19129                }
19130            }
19131
19132            return $(foundElements);
19133        }
19134
19135        function children(selector) {
19136            var children = []; // eslint-disable-line
19137
19138            for (var i = 0; i < this.length; i += 1) {
19139                var childNodes = this[i].children;
19140
19141                for (var j = 0; j < childNodes.length; j += 1) {
19142                    if (!selector || $(childNodes[j]).is(selector)) {
19143                        children.push(childNodes[j]);
19144                    }
19145                }
19146            }
19147
19148            return $(children);
19149        }
19150
19151        function remove() {
19152            for (var i = 0; i < this.length; i += 1) {
19153                if (this[i].parentNode) this[i].parentNode.removeChild(this[i]);
19154            }
19155
19156            return this;
19157        }
19158
19159        function detach() {
19160            return this.remove();
19161        }
19162
19163        function add() {
19164            var dom = this;
19165            var i;
19166            var j;
19167
19168            for (var _len10 = arguments.length, els = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
19169                els[_key10] = arguments[_key10];
19170            }
19171
19172            for (i = 0; i < els.length; i += 1) {
19173                var toAdd = $(els[i]);
19174
19175                for (j = 0; j < toAdd.length; j += 1) {
19176                    dom.push(toAdd[j]);
19177                }
19178            }
19179
19180            return dom;
19181        }
19182
19183        function empty() {
19184            for (var i = 0; i < this.length; i += 1) {
19185                var el = this[i];
19186
19187                if (el.nodeType === 1) {
19188                    for (var j = 0; j < el.childNodes.length; j += 1) {
19189                        if (el.childNodes[j].parentNode) {
19190                            el.childNodes[j].parentNode.removeChild(el.childNodes[j]);
19191                        }
19192                    }
19193
19194                    el.textContent = '';
19195                }
19196            }
19197
19198            return this;
19199        }
19200
19201        function scrollTo() {
19202            var window = ssrWindow.getWindow();
19203
19204            for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
19205                args[_key] = arguments[_key];
19206            }
19207
19208            var left = args[0],
19209                top = args[1],
19210                duration = args[2],
19211                easing = args[3],
19212                callback = args[4];
19213
19214            if (args.length === 4 && typeof easing === 'function') {
19215                callback = easing;
19216                left = args[0];
19217                top = args[1];
19218                duration = args[2];
19219                callback = args[3];
19220                easing = args[4];
19221            }
19222
19223            if (typeof easing === 'undefined') easing = 'swing';
19224            return this.each(function animate() {
19225                var el = this;
19226                var currentTop;
19227                var currentLeft;
19228                var maxTop;
19229                var maxLeft;
19230                var newTop;
19231                var newLeft;
19232                var scrollTop; // eslint-disable-line
19233
19234                var scrollLeft; // eslint-disable-line
19235
19236                var animateTop = top > 0 || top === 0;
19237                var animateLeft = left > 0 || left === 0;
19238
19239                if (typeof easing === 'undefined') {
19240                    easing = 'swing';
19241                }
19242
19243                if (animateTop) {
19244                    currentTop = el.scrollTop;
19245
19246                    if (!duration) {
19247                        el.scrollTop = top;
19248                    }
19249                }
19250
19251                if (animateLeft) {
19252                    currentLeft = el.scrollLeft;
19253
19254                    if (!duration) {
19255                        el.scrollLeft = left;
19256                    }
19257                }
19258
19259                if (!duration) return;
19260
19261                if (animateTop) {
19262                    maxTop = el.scrollHeight - el.offsetHeight;
19263                    newTop = Math.max(Math.min(top, maxTop), 0);
19264                }
19265
19266                if (animateLeft) {
19267                    maxLeft = el.scrollWidth - el.offsetWidth;
19268                    newLeft = Math.max(Math.min(left, maxLeft), 0);
19269                }
19270
19271                var startTime = null;
19272                if (animateTop && newTop === currentTop) animateTop = false;
19273                if (animateLeft && newLeft === currentLeft) animateLeft = false;
19274
19275                function render(time) {
19276                    if (time === void 0) {
19277                        time = new Date().getTime();
19278                    }
19279
19280                    if (startTime === null) {
19281                        startTime = time;
19282                    }
19283
19284                    var progress = Math.max(Math.min((time - startTime) / duration, 1), 0);
19285                    var easeProgress = easing === 'linear' ? progress : 0.5 - Math.cos(progress * Math.PI) / 2;
19286                    var done;
19287                    if (animateTop) scrollTop = currentTop + easeProgress * (newTop - currentTop);
19288                    if (animateLeft) scrollLeft = currentLeft + easeProgress * (newLeft - currentLeft);
19289
19290                    if (animateTop && newTop > currentTop && scrollTop >= newTop) {
19291                        el.scrollTop = newTop;
19292                        done = true;
19293                    }
19294
19295                    if (animateTop && newTop < currentTop && scrollTop <= newTop) {
19296                        el.scrollTop = newTop;
19297                        done = true;
19298                    }
19299
19300                    if (animateLeft && newLeft > currentLeft && scrollLeft >= newLeft) {
19301                        el.scrollLeft = newLeft;
19302                        done = true;
19303                    }
19304
19305                    if (animateLeft && newLeft < currentLeft && scrollLeft <= newLeft) {
19306                        el.scrollLeft = newLeft;
19307                        done = true;
19308                    }
19309
19310                    if (done) {
19311                        if (callback) callback();
19312                        return;
19313                    }
19314
19315                    if (animateTop) el.scrollTop = scrollTop;
19316                    if (animateLeft) el.scrollLeft = scrollLeft;
19317                    window.requestAnimationFrame(render);
19318                }
19319
19320                window.requestAnimationFrame(render);
19321            });
19322        } // scrollTop(top, duration, easing, callback) {
19323
19324
19325        function scrollTop() {
19326            for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
19327                args[_key2] = arguments[_key2];
19328            }
19329
19330            var top = args[0],
19331                duration = args[1],
19332                easing = args[2],
19333                callback = args[3];
19334
19335            if (args.length === 3 && typeof easing === 'function') {
19336                top = args[0];
19337                duration = args[1];
19338                callback = args[2];
19339                easing = args[3];
19340            }
19341
19342            var dom = this;
19343
19344            if (typeof top === 'undefined') {
19345                if (dom.length > 0) return dom[0].scrollTop;
19346                return null;
19347            }
19348
19349            return dom.scrollTo(undefined, top, duration, easing, callback);
19350        }
19351
19352        function scrollLeft() {
19353            for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
19354                args[_key3] = arguments[_key3];
19355            }
19356
19357            var left = args[0],
19358                duration = args[1],
19359                easing = args[2],
19360                callback = args[3];
19361
19362            if (args.length === 3 && typeof easing === 'function') {
19363                left = args[0];
19364                duration = args[1];
19365                callback = args[2];
19366                easing = args[3];
19367            }
19368
19369            var dom = this;
19370
19371            if (typeof left === 'undefined') {
19372                if (dom.length > 0) return dom[0].scrollLeft;
19373                return null;
19374            }
19375
19376            return dom.scrollTo(left, undefined, duration, easing, callback);
19377        }
19378
19379        function animate(initialProps, initialParams) {
19380            var window = ssrWindow.getWindow();
19381            var els = this;
19382            var a = {
19383                props: Object.assign({}, initialProps),
19384                params: Object.assign({
19385                    duration: 300,
19386                    easing: 'swing' // or 'linear'
19387
19388                    /* Callbacks
19389      begin(elements)
19390      complete(elements)
19391      progress(elements, complete, remaining, start, tweenValue)
19392      */
19393
19394                }, initialParams),
19395                elements: els,
19396                animating: false,
19397                que: [],
19398                easingProgress: function easingProgress(easing, progress) {
19399                    if (easing === 'swing') {
19400                        return 0.5 - Math.cos(progress * Math.PI) / 2;
19401                    }
19402
19403                    if (typeof easing === 'function') {
19404                        return easing(progress);
19405                    }
19406
19407                    return progress;
19408                },
19409                stop: function stop() {
19410                    if (a.frameId) {
19411                        window.cancelAnimationFrame(a.frameId);
19412                    }
19413
19414                    a.animating = false;
19415                    a.elements.each(function (el) {
19416                        var element = el;
19417                        delete element.dom7AnimateInstance;
19418                    });
19419                    a.que = [];
19420                },
19421                done: function done(complete) {
19422                    a.animating = false;
19423                    a.elements.each(function (el) {
19424                        var element = el;
19425                        delete element.dom7AnimateInstance;
19426                    });
19427                    if (complete) complete(els);
19428
19429                    if (a.que.length > 0) {
19430                        var que = a.que.shift();
19431                        a.animate(que[0], que[1]);
19432                    }
19433                },
19434                animate: function animate(props, params) {
19435                    if (a.animating) {
19436                        a.que.push([props, params]);
19437                        return a;
19438                    }
19439
19440                    var elements = []; // Define & Cache Initials & Units
19441
19442                    a.elements.each(function (el, index) {
19443                        var initialFullValue;
19444                        var initialValue;
19445                        var unit;
19446                        var finalValue;
19447                        var finalFullValue;
19448                        if (!el.dom7AnimateInstance) a.elements[index].dom7AnimateInstance = a;
19449                        elements[index] = {
19450                            container: el
19451                        };
19452                        Object.keys(props).forEach(function (prop) {
19453                            initialFullValue = window.getComputedStyle(el, null).getPropertyValue(prop).replace(',', '.');
19454                            initialValue = parseFloat(initialFullValue);
19455                            unit = initialFullValue.replace(initialValue, '');
19456                            finalValue = parseFloat(props[prop]);
19457                            finalFullValue = props[prop] + unit;
19458                            elements[index][prop] = {
19459                                initialFullValue: initialFullValue,
19460                                initialValue: initialValue,
19461                                unit: unit,
19462                                finalValue: finalValue,
19463                                finalFullValue: finalFullValue,
19464                                currentValue: initialValue
19465                            };
19466                        });
19467                    });
19468                    var startTime = null;
19469                    var time;
19470                    var elementsDone = 0;
19471                    var propsDone = 0;
19472                    var done;
19473                    var began = false;
19474                    a.animating = true;
19475
19476                    function render() {
19477                        time = new Date().getTime();
19478                        var progress;
19479                        var easeProgress; // let el;
19480
19481                        if (!began) {
19482                            began = true;
19483                            if (params.begin) params.begin(els);
19484                        }
19485
19486                        if (startTime === null) {
19487                            startTime = time;
19488                        }
19489
19490                        if (params.progress) {
19491                            // eslint-disable-next-line
19492                            params.progress(els, Math.max(Math.min((time - startTime) / params.duration, 1), 0), startTime + params.duration - time < 0 ? 0 : startTime + params.duration - time, startTime);
19493                        }
19494
19495                        elements.forEach(function (element) {
19496                            var el = element;
19497                            if (done || el.done) return;
19498                            Object.keys(props).forEach(function (prop) {
19499                                if (done || el.done) return;
19500                                progress = Math.max(Math.min((time - startTime) / params.duration, 1), 0);
19501                                easeProgress = a.easingProgress(params.easing, progress);
19502                                var _el$prop = el[prop],
19503                                    initialValue = _el$prop.initialValue,
19504                                    finalValue = _el$prop.finalValue,
19505                                    unit = _el$prop.unit;
19506                                el[prop].currentValue = initialValue + easeProgress * (finalValue - initialValue);
19507                                var currentValue = el[prop].currentValue;
19508
19509                                if (finalValue > initialValue && currentValue >= finalValue || finalValue < initialValue && currentValue <= finalValue) {
19510                                    el.container.style[prop] = finalValue + unit;
19511                                    propsDone += 1;
19512
19513                                    if (propsDone === Object.keys(props).length) {
19514                                        el.done = true;
19515                                        elementsDone += 1;
19516                                    }
19517
19518                                    if (elementsDone === elements.length) {
19519                                        done = true;
19520                                    }
19521                                }
19522
19523                                if (done) {
19524                                    a.done(params.complete);
19525                                    return;
19526                                }
19527
19528                                el.container.style[prop] = currentValue + unit;
19529                            });
19530                        });
19531                        if (done) return; // Then call
19532
19533                        a.frameId = window.requestAnimationFrame(render);
19534                    }
19535
19536                    a.frameId = window.requestAnimationFrame(render);
19537                    return a;
19538                }
19539            };
19540
19541            if (a.elements.length === 0) {
19542                return els;
19543            }
19544
19545            var animateInstance;
19546
19547            for (var i = 0; i < a.elements.length; i += 1) {
19548                if (a.elements[i].dom7AnimateInstance) {
19549                    animateInstance = a.elements[i].dom7AnimateInstance;
19550                } else a.elements[i].dom7AnimateInstance = a;
19551            }
19552
19553            if (!animateInstance) {
19554                animateInstance = a;
19555            }
19556
19557            if (initialProps === 'stop') {
19558                animateInstance.stop();
19559            } else {
19560                animateInstance.animate(a.props, a.params);
19561            }
19562
19563            return els;
19564        }
19565
19566        function stop() {
19567            var els = this;
19568
19569            for (var i = 0; i < els.length; i += 1) {
19570                if (els[i].dom7AnimateInstance) {
19571                    els[i].dom7AnimateInstance.stop();
19572                }
19573            }
19574        }
19575
19576        var noTrigger = 'resize scroll'.split(' ');
19577
19578        function shortcut(name) {
19579            function eventHandler() {
19580                for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
19581                    args[_key] = arguments[_key];
19582                }
19583
19584                if (typeof args[0] === 'undefined') {
19585                    for (var i = 0; i < this.length; i += 1) {
19586                        if (noTrigger.indexOf(name) < 0) {
19587                            if (name in this[i]) this[i][name](); else {
19588                                $(this[i]).trigger(name);
19589                            }
19590                        }
19591                    }
19592
19593                    return this;
19594                }
19595
vendor: 7,836 bytes, lines 19596-19804
19596                return this.on.apply(this, [name].concat(args));
19597            }
19598
19599            return eventHandler;
19600        }
19601
19602        var click = shortcut('click');
19603        var blur = shortcut('blur');
19604        var focus = shortcut('focus');
19605        var focusin = shortcut('focusin');
19606        var focusout = shortcut('focusout');
19607        var keyup = shortcut('keyup');
19608        var keydown = shortcut('keydown');
19609        var keypress = shortcut('keypress');
19610        var submit = shortcut('submit');
19611        var change = shortcut('change');
19612        var mousedown = shortcut('mousedown');
19613        var mousemove = shortcut('mousemove');
19614        var mouseup = shortcut('mouseup');
19615        var mouseenter = shortcut('mouseenter');
19616        var mouseleave = shortcut('mouseleave');
19617        var mouseout = shortcut('mouseout');
19618        var mouseover = shortcut('mouseover');
19619        var touchstart = shortcut('touchstart');
19620        var touchend = shortcut('touchend');
19621        var touchmove = shortcut('touchmove');
19622        var resize = shortcut('resize');
19623        var scroll = shortcut('scroll');
19624
19625        exports.$ = $;
19626        exports.add = add;
19627        exports.addClass = addClass;
19628        exports.animate = animate;
19629        exports.animationEnd = animationEnd;
19630        exports.append = append;
19631        exports.appendTo = appendTo;
19632        exports.attr = attr;
19633        exports.blur = blur;
19634        exports.change = change;
19635        exports.children = children;
19636        exports.click = click;
19637        exports.closest = closest;
19638        exports.css = css;
19639        exports.data = data;
19640        exports.dataset = dataset;
19641        exports.default = $;
19642        exports.detach = detach;
19643        exports.each = each;
19644        exports.empty = empty;
19645        exports.eq = eq;
19646        exports.filter = filter;
19647        exports.find = find;
19648        exports.focus = focus;
19649        exports.focusin = focusin;
19650        exports.focusout = focusout;
19651        exports.hasClass = hasClass;
19652        exports.height = height;
19653        exports.hide = hide;
19654        exports.html = html;
19655        exports.index = index;
19656        exports.insertAfter = insertAfter;
19657        exports.insertBefore = insertBefore;
19658        exports.is = is;
19659        exports.keydown = keydown;
19660        exports.keypress = keypress;
19661        exports.keyup = keyup;
19662        exports.mousedown = mousedown;
19663        exports.mouseenter = mouseenter;
19664        exports.mouseleave = mouseleave;
19665        exports.mousemove = mousemove;
19666        exports.mouseout = mouseout;
19667        exports.mouseover = mouseover;
19668        exports.mouseup = mouseup;
19669        exports.next = next;
19670        exports.nextAll = nextAll;
19671        exports.off = off;
19672        exports.offset = offset;
19673        exports.on = on;
19674        exports.once = once;
19675        exports.outerHeight = outerHeight;
19676        exports.outerWidth = outerWidth;
19677        exports.parent = parent;
19678        exports.parents = parents;
19679        exports.prepend = prepend;
19680        exports.prependTo = prependTo;
19681        exports.prev = prev;
19682        exports.prevAll = prevAll;
19683        exports.prop = prop;
19684        exports.remove = remove;
19685        exports.removeAttr = removeAttr;
19686        exports.removeClass = removeClass;
19687        exports.removeData = removeData;
19688        exports.resize = resize;
19689        exports.scroll = scroll;
19690        exports.scrollLeft = scrollLeft;
19691        exports.scrollTo = scrollTo;
19692        exports.scrollTop = scrollTop;
19693        exports.show = show;
19694        exports.siblings = siblings;
19695        exports.stop = stop;
19696        exports.styles = styles;
19697        exports.submit = submit;
19698        exports.text = text;
19699        exports.toggleClass = toggleClass;
19700        exports.touchend = touchend;
19701        exports.touchmove = touchmove;
19702        exports.touchstart = touchstart;
19703        exports.transform = transform;
19704        exports.transition = transition;
19705        exports.transitionEnd = transitionEnd;
19706        exports.trigger = trigger;
19707        exports.val = val;
19708        exports.value = value;
19709        exports.width = width;
19710
19711    }, {"ssr-window": 10}],
19712    5: [function (require, module, exports) {
19713        (function (global, factory) {
19714            typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
19715                typeof define === 'function' && define.amd ? define(['exports'], factory) :
19716                    (global = global || self, factory(global.window = global.window || {}));
19717        }(this, (function (exports) {
19718            'use strict';
19719
19720            function _inheritsLoose(subClass, superClass) {
19721                subClass.prototype = Object.create(superClass.prototype);
19722                subClass.prototype.constructor = subClass;
19723                subClass.__proto__ = superClass;
19724            }
19725
19726            function _assertThisInitialized(self) {
19727                if (self === void 0) {
19728                    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
19729                }
19730
19731                return self;
19732            }
19733
19734            /*!
19735   * GSAP 3.5.1
19736   * https://greensock.com
19737   *
19738   * @license Copyright 2008-2020, GreenSock. All rights reserved.
19739   * Subject to the terms at https://greensock.com/standard-license or for
19740   * Club GreenSock members, the agreement issued with that membership.
19741   * @author: Jack Doyle, [email protected]
19742  */
19743            var _config = {
19744                    autoSleep: 120,
19745                    force3D: "auto",
19746                    nullTargetWarn: 1,
19747                    units: {
19748                        lineHeight: ""
19749                    }
19750                },
19751                _defaults = {
19752                    duration: .5,
19753                    overwrite: false,
19754                    delay: 0
19755                },
19756                _bigNum = 1e8,
19757                _tinyNum = 1 / _bigNum,
19758                _2PI = Math.PI * 2,
19759                _HALF_PI = _2PI / 4,
19760                _gsID = 0,
19761                _sqrt = Math.sqrt,
19762                _cos = Math.cos,
19763                _sin = Math.sin,
19764                _isString = function _isString(value) {
19765                    return typeof value === "string";
19766                },
19767                _isFunction = function _isFunction(value) {
19768                    return typeof value === "function";
19769                },
19770                _isNumber = function _isNumber(value) {
19771                    return typeof value === "number";
19772                },
19773                _isUndefined = function _isUndefined(value) {
19774                    return typeof value === "undefined";
19775                },
19776                _isObject = function _isObject(value) {
19777                    return typeof value === "object";
19778                },
19779                _isNotFalse = function _isNotFalse(value) {
19780                    return value !== false;
19781                },
19782                _windowExists = function _windowExists() {
19783                    return typeof window !== "undefined";
19784                },
19785                _isFuncOrString = function _isFuncOrString(value) {
19786                    return _isFunction(value) || _isString(value);
19787                },
19788                _isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView || function () {
19789                },
19790                _isArray = Array.isArray,
19791                _strictNumExp = /(?:-?\.?\d|\.)+/gi,
19792                _numExp = /[-+=.]*\d+[.e\-+]*\d*[e\-\+]*\d*/g,
19793                _numWithUnitExp = /[-+=.]*\d+[.e-]*\d*[a-z%]*/g,
19794                _complexStringNumExp = /[-+=.]*\d+(?:\.|e-|e)*\d*/gi,
19795                _relExp = /[+-]=-?[\.\d]+/,
19796                _delimitedValueExp = /[#\-+.]*\b[a-z\d-=+%.]+/gi,
19797                _globalTimeline,
19798                _win,
19799                _coreInitted,
19800                _doc,
19801                _globals = {},
19802                _installScope = {},
19803                _coreReady,
19804                _install = function _install(scope) {
vendor: 13,492 bytes, lines 19805-20121
19805                    return (_installScope = _merge(scope, _globals)) && gsap;
19806                },
19807                _missingPlugin = function _missingPlugin(property, value) {
19808                    return console.warn("Invalid property", property, "set to", value, "Missing plugin? gsap.registerPlugin()");
19809                },
19810                _warn = function _warn(message, suppress) {
19811                    return !suppress && console.warn(message);
19812                },
19813                _addGlobal = function _addGlobal(name, obj) {
19814                    return name && (_globals[name] = obj) && _installScope && (_installScope[name] = obj) || _globals;
19815                },
19816                _emptyFunc = function _emptyFunc() {
19817                    return 0;
19818                },
19819                _reservedProps = {},
19820                _lazyTweens = [],
19821                _lazyLookup = {},
19822                _lastRenderedFrame,
19823                _plugins = {},
19824                _effects = {},
19825                _nextGCFrame = 30,
19826                _harnessPlugins = [],
19827                _callbackNames = "",
19828                _harness = function _harness(targets) {
19829                    var target = targets[0],
19830                        harnessPlugin,
19831                        i;
19832                    _isObject(target) || _isFunction(target) || (targets = [targets]);
19833
19834                    if (!(harnessPlugin = (target._gsap || {}).harness)) {
19835                        i = _harnessPlugins.length;
19836
19837                        while (i-- && !_harnessPlugins[i].targetTest(target)) {
19838                        }
19839
19840                        harnessPlugin = _harnessPlugins[i];
19841                    }
19842
19843                    i = targets.length;
19844
19845                    while (i--) {
19846                        targets[i] && (targets[i]._gsap || (targets[i]._gsap = new GSCache(targets[i], harnessPlugin))) || targets.splice(i, 1);
19847                    }
19848
19849                    return targets;
19850                },
19851                _getCache = function _getCache(target) {
19852                    return target._gsap || _harness(toArray(target))[0]._gsap;
19853                },
19854                _getProperty = function _getProperty(target, property, v) {
19855                    return (v = target[property]) && _isFunction(v) ? target[property]() : _isUndefined(v) && target.getAttribute && target.getAttribute(property) || v;
19856                },
19857                _forEachName = function _forEachName(names, func) {
19858                    return (names = names.split(",")).forEach(func) || names;
19859                },
19860                _round = function _round(value) {
19861                    return Math.round(value * 100000) / 100000 || 0;
19862                },
19863                _arrayContainsAny = function _arrayContainsAny(toSearch, toFind) {
19864                    var l = toFind.length,
19865                        i = 0;
19866
19867                    for (; toSearch.indexOf(toFind[i]) < 0 && ++i < l;) {
19868                    }
19869
19870                    return i < l;
19871                },
19872                _parseVars = function _parseVars(params, type, parent) {
19873                    var isLegacy = _isNumber(params[1]),
19874                        varsIndex = (isLegacy ? 2 : 1) + (type < 2 ? 0 : 1),
19875                        vars = params[varsIndex],
19876                        irVars;
19877
19878                    isLegacy && (vars.duration = params[1]);
19879                    vars.parent = parent;
19880
19881                    if (type) {
19882                        irVars = vars;
19883
19884                        while (parent && !("immediateRender" in irVars)) {
19885                            irVars = parent.vars.defaults || {};
19886                            parent = _isNotFalse(parent.vars.inherit) && parent.parent;
19887                        }
19888
19889                        vars.immediateRender = _isNotFalse(irVars.immediateRender);
19890                        type < 2 ? vars.runBackwards = 1 : vars.startAt = params[varsIndex - 1];
19891                    }
19892
19893                    return vars;
19894                },
19895                _lazyRender = function _lazyRender() {
19896                    var l = _lazyTweens.length,
19897                        a = _lazyTweens.slice(0),
19898                        i,
19899                        tween;
19900
19901                    _lazyLookup = {};
19902                    _lazyTweens.length = 0;
19903
19904                    for (i = 0; i < l; i++) {
19905                        tween = a[i];
19906                        tween && tween._lazy && (tween.render(tween._lazy[0], tween._lazy[1], true)._lazy = 0);
19907                    }
19908                },
19909                _lazySafeRender = function _lazySafeRender(animation, time, suppressEvents, force) {
19910                    _lazyTweens.length && _lazyRender();
19911                    animation.render(time, suppressEvents, force);
19912                    _lazyTweens.length && _lazyRender();
19913                },
19914                _numericIfPossible = function _numericIfPossible(value) {
19915                    var n = parseFloat(value);
19916                    return (n || n === 0) && (value + "").match(_delimitedValueExp).length < 2 ? n : _isString(value) ? value.trim() : value;
19917                },
19918                _passThrough = function _passThrough(p) {
19919                    return p;
19920                },
19921                _setDefaults = function _setDefaults(obj, defaults) {
19922                    for (var p in defaults) {
19923                        p in obj || (obj[p] = defaults[p]);
19924                    }
19925
19926                    return obj;
19927                },
19928                _setKeyframeDefaults = function _setKeyframeDefaults(obj, defaults) {
19929                    for (var p in defaults) {
19930                        p in obj || p === "duration" || p === "ease" || (obj[p] = defaults[p]);
19931                    }
19932                },
19933                _merge = function _merge(base, toMerge) {
19934                    for (var p in toMerge) {
19935                        base[p] = toMerge[p];
19936                    }
19937
19938                    return base;
19939                },
19940                _mergeDeep = function _mergeDeep(base, toMerge) {
19941                    for (var p in toMerge) {
19942                        base[p] = _isObject(toMerge[p]) ? _mergeDeep(base[p] || (base[p] = {}), toMerge[p]) : toMerge[p];
19943                    }
19944
19945                    return base;
19946                },
19947                _copyExcluding = function _copyExcluding(obj, excluding) {
19948                    var copy = {},
19949                        p;
19950
19951                    for (p in obj) {
19952                        p in excluding || (copy[p] = obj[p]);
19953                    }
19954
19955                    return copy;
19956                },
19957                _inheritDefaults = function _inheritDefaults(vars) {
19958                    var parent = vars.parent || _globalTimeline,
19959                        func = vars.keyframes ? _setKeyframeDefaults : _setDefaults;
19960
19961                    if (_isNotFalse(vars.inherit)) {
19962                        while (parent) {
19963                            func(vars, parent.vars.defaults);
19964                            parent = parent.parent || parent._dp;
19965                        }
19966                    }
19967
19968                    return vars;
19969                },
19970                _arraysMatch = function _arraysMatch(a1, a2) {
19971                    var i = a1.length,
19972                        match = i === a2.length;
19973
19974                    while (match && i-- && a1[i] === a2[i]) {
19975                    }
19976
19977                    return i < 0;
19978                },
19979                _addLinkedListItem = function _addLinkedListItem(parent, child, firstProp, lastProp, sortBy) {
19980                    if (firstProp === void 0) {
19981                        firstProp = "_first";
19982                    }
19983
19984                    if (lastProp === void 0) {
19985                        lastProp = "_last";
19986                    }
19987
19988                    var prev = parent[lastProp],
19989                        t;
19990
19991                    if (sortBy) {
19992                        t = child[sortBy];
19993
19994                        while (prev && prev[sortBy] > t) {
19995                            prev = prev._prev;
19996                        }
19997                    }
19998
19999                    if (prev) {
20000                        child._next = prev._next;
20001                        prev._next = child;
20002                    } else {
20003                        child._next = parent[firstProp];
20004                        parent[firstProp] = child;
20005                    }
20006
20007                    if (child._next) {
20008                        child._next._prev = child;
20009                    } else {
20010                        parent[lastProp] = child;
20011                    }
20012
20013                    child._prev = prev;
20014                    child.parent = child._dp = parent;
20015                    return child;
20016                },
20017                _removeLinkedListItem = function _removeLinkedListItem(parent, child, firstProp, lastProp) {
20018                    if (firstProp === void 0) {
20019                        firstProp = "_first";
20020                    }
20021
20022                    if (lastProp === void 0) {
20023                        lastProp = "_last";
20024                    }
20025
20026                    var prev = child._prev,
20027                        next = child._next;
20028
20029                    if (prev) {
20030                        prev._next = next;
20031                    } else if (parent[firstProp] === child) {
20032                        parent[firstProp] = next;
20033                    }
20034
20035                    if (next) {
20036                        next._prev = prev;
20037                    } else if (parent[lastProp] === child) {
20038                        parent[lastProp] = prev;
20039                    }
20040
20041                    child._next = child._prev = child.parent = null;
20042                },
20043                _removeFromParent = function _removeFromParent(child, onlyIfParentHasAutoRemove) {
20044                    child.parent && (!onlyIfParentHasAutoRemove || child.parent.autoRemoveChildren) && child.parent.remove(child);
20045                    child._act = 0;
20046                },
20047                _uncache = function _uncache(animation, child) {
20048                    if (animation && (!child || child._end > animation._dur || child._start < 0)) {
20049                        var a = animation;
20050
20051                        while (a) {
20052                            a._dirty = 1;
20053                            a = a.parent;
20054                        }
20055                    }
20056
20057                    return animation;
20058                },
20059                _recacheAncestors = function _recacheAncestors(animation) {
20060                    var parent = animation.parent;
20061
20062                    while (parent && parent.parent) {
20063                        parent._dirty = 1;
20064                        parent.totalDuration();
20065                        parent = parent.parent;
20066                    }
20067
20068                    return animation;
20069                },
20070                _hasNoPausedAncestors = function _hasNoPausedAncestors(animation) {
20071                    return !animation || animation._ts && _hasNoPausedAncestors(animation.parent);
20072                },
20073                _elapsedCycleDuration = function _elapsedCycleDuration(animation) {
20074                    return animation._repeat ? _animationCycle(animation._tTime, animation = animation.duration() + animation._rDelay) * animation : 0;
20075                },
20076                _animationCycle = function _animationCycle(tTime, cycleDuration) {
20077                    return (tTime /= cycleDuration) && ~~tTime === tTime ? ~~tTime - 1 : ~~tTime;
20078                },
20079                _parentToChildTotalTime = function _parentToChildTotalTime(parentTime, child) {
20080                    return (parentTime - child._start) * child._ts + (child._ts >= 0 ? 0 : child._dirty ? child.totalDuration() : child._tDur);
20081                },
20082                _setEnd = function _setEnd(animation) {
20083                    return animation._end = _round(animation._start + (animation._tDur / Math.abs(animation._ts || animation._rts || _tinyNum) || 0));
20084                },
20085                _alignPlayhead = function _alignPlayhead(animation, totalTime) {
20086                    var parent = animation._dp;
20087
20088                    if (parent && parent.smoothChildTiming && animation._ts) {
20089                        animation._start = _round(animation._dp._time - (animation._ts > 0 ? totalTime / animation._ts : ((animation._dirty ? animation.totalDuration() : animation._tDur) - totalTime) / -animation._ts));
20090
20091                        _setEnd(animation);
20092
20093                        parent._dirty || _uncache(parent, animation);
20094                    }
20095
20096                    return animation;
20097                },
20098                _postAddChecks = function _postAddChecks(timeline, child) {
20099                    var t;
20100
20101                    if (child._time || child._initted && !child._dur) {
20102                        t = _parentToChildTotalTime(timeline.rawTime(), child);
20103
20104                        if (!child._dur || _clamp(0, child.totalDuration(), t) - child._tTime > _tinyNum) {
20105                            child.render(t, true);
20106                        }
20107                    }
20108
20109                    if (_uncache(timeline, child)._dp && timeline._initted && timeline._time >= timeline._dur && timeline._ts) {
20110                        if (timeline._dur < timeline.duration()) {
20111                            t = timeline;
20112
20113                            while (t._dp) {
20114                                t.rawTime() >= 0 && t.totalTime(t._tTime);
20115                                t = t._dp;
20116                            }
20117                        }
20118
20119                        timeline._zTime = -_tinyNum;
20120                    }
20121                },
20122                _addToTimeline = function _addToTimeline(timeline, child, position, skipChecks) {
20123                    child.parent && _removeFromParent(child);
20124                    child._start = _round(position + child._delay);
20125                    child._end = _round(child._start + (child.totalDuration() / Math.abs(child.timeScale()) || 0));
20126
20127                    _addLinkedListItem(timeline, child, "_first", "_last", timeline._sort ? "_start" : 0);
20128
20129                    timeline._recent = child;
20130                    skipChecks || _postAddChecks(timeline, child);
20131                    return timeline;
20132                },
20133                _scrollTrigger = function _scrollTrigger(animation, trigger) {
20134                    return (_globals.ScrollTrigger || _missingPlugin("scrollTrigger", trigger)) && _globals.ScrollTrigger.create(trigger, animation);
20135                },
20136                _attemptInitTween = function _attemptInitTween(tween, totalTime, force, suppressEvents) {
20137                    _initTween(tween, totalTime);
20138
20139                    if (!tween._initted) {
20140                        return 1;
20141                    }
20142
20143                    if (!force && tween._pt && (tween._dur && tween.vars.lazy !== false || !tween._dur && tween.vars.lazy) && _lastRenderedFrame !== _ticker.frame) {
20144                        _lazyTweens.push(tween);
20145
20146                        tween._lazy = [totalTime, suppressEvents];
20147                        return 1;
20148                    }
20149                },
20150                _renderZeroDurationTween = function _renderZeroDurationTween(tween, totalTime, suppressEvents, force) {
20151                    var prevRatio = tween.ratio,
20152                        ratio = totalTime < 0 || !totalTime && prevRatio && !tween._start && tween._zTime > _tinyNum && !tween._dp._lock || (tween._ts < 0 || tween._dp._ts < 0) && tween.data !== "isFromStart" && tween.data !== "isStart" ? 0 : 1,
20153                        repeatDelay = tween._rDelay,
20154                        tTime = 0,
20155                        pt,
20156                        iteration,
20157                        prevIteration;
20158
20159                    if (repeatDelay && tween._repeat) {
20160                        tTime = _clamp(0, tween._tDur, totalTime);
20161                        iteration = _animationCycle(tTime, repeatDelay);
20162                        prevIteration = _animationCycle(tween._tTime, repeatDelay);
20163
20164                        if (iteration !== prevIteration) {
20165                            prevRatio = 1 - ratio;
20166                            tween.vars.repeatRefresh && tween._initted && tween.invalidate();
20167                        }
20168                    }
20169
20170                    if (ratio !== prevRatio || force || tween._zTime === _tinyNum || !totalTime && tween._zTime) {
20171                        if (!tween._initted && _attemptInitTween(tween, totalTime, force, suppressEvents)) {
20172                            return;
20173                        }
20174
20175                        prevIteration = tween._zTime;
20176                        tween._zTime = totalTime || (suppressEvents ? _tinyNum : 0);
20177                        suppressEvents || (suppressEvents = totalTime && !prevIteration);
20178                        tween.ratio = ratio;
20179                        tween._from && (ratio = 1 - ratio);
20180                        tween._time = 0;
20181                        tween._tTime = tTime;
20182                        suppressEvents || _callback(tween, "onStart");
20183                        pt = tween._pt;
20184
20185                        while (pt) {
20186                            pt.r(ratio, pt.d);
20187                            pt = pt._next;
20188                        }
20189
20190                        tween._startAt && totalTime < 0 && tween._startAt.render(totalTime, true, true);
20191                        tween._onUpdate && !suppressEvents && _c
vendor: 12,845 bytes, lines 20191-20453
20191allback(tween, "onUpdate");
20192                        tTime && tween._repeat && !suppressEvents && tween.parent && _callback(tween, "onRepeat");
20193
20194                        if ((totalTime >= tween._tDur || totalTime < 0) && tween.ratio === ratio) {
20195                            ratio && _removeFromParent(tween, 1);
20196
20197                            if (!suppressEvents) {
20198                                _callback(tween, ratio ? "onComplete" : "onReverseComplete", true);
20199
20200                                tween._prom && tween._prom();
20201                            }
20202                        }
20203                    } else if (!tween._zTime) {
20204                        tween._zTime = totalTime;
20205                    }
20206                },
20207                _findNextPauseTween = function _findNextPauseTween(animation, prevTime, time) {
20208                    var child;
20209
20210                    if (time > prevTime) {
20211                        child = animation._first;
20212
20213                        while (child && child._start <= time) {
20214                            if (!child._dur && child.data === "isPause" && child._start > prevTime) {
20215                                return child;
20216                            }
20217
20218                            child = child._next;
20219                        }
20220                    } else {
20221                        child = animation._last;
20222
20223                        while (child && child._start >= time) {
20224                            if (!child._dur && child.data === "isPause" && child._start < prevTime) {
20225                                return child;
20226                            }
20227
20228                            child = child._prev;
20229                        }
20230                    }
20231                },
20232                _setDuration = function _setDuration(animation, duration, skipUncache, leavePlayhead) {
20233                    var repeat = animation._repeat,
20234                        dur = _round(duration) || 0,
20235                        totalProgress = animation._tTime / animation._tDur;
20236                    totalProgress && !leavePlayhead && (animation._time *= dur / animation._dur);
20237                    animation._dur = dur;
20238                    animation._tDur = !repeat ? dur : repeat < 0 ? 1e10 : _round(dur * (repeat + 1) + animation._rDelay * repeat);
20239                    totalProgress && !leavePlayhead ? _alignPlayhead(animation, animation._tTime = animation._tDur * totalProgress) : animation.parent && _setEnd(animation);
20240                    skipUncache || _uncache(animation.parent, animation);
20241                    return animation;
20242                },
20243                _onUpdateTotalDuration = function _onUpdateTotalDuration(animation) {
20244                    return animation instanceof Timeline ? _uncache(animation) : _setDuration(animation, animation._dur);
20245                },
20246                _zeroPosition = {
20247                    _start: 0,
20248                    endTime: _emptyFunc
20249                },
20250                _parsePosition = function _parsePosition(animation, position) {
20251                    var labels = animation.labels,
20252                        recent = animation._recent || _zeroPosition,
20253                        clippedDuration = animation.duration() >= _bigNum ? recent.endTime(false) : animation._dur,
20254                        i,
20255                        offset;
20256
20257                    if (_isString(position) && (isNaN(position) || position in labels)) {
20258                        i = position.charAt(0);
20259
20260                        if (i === "<" || i === ">") {
20261                            return (i === "<" ? recent._start : recent.endTime(recent._repeat >= 0)) + (parseFloat(position.substr(1)) || 0);
20262                        }
20263
20264                        i = position.indexOf("=");
20265
20266                        if (i < 0) {
20267                            position in labels || (labels[position] = clippedDuration);
20268                            return labels[position];
20269                        }
20270
20271                        offset = +(position.charAt(i - 1) + position.substr(i + 1));
20272                        return i > 1 ? _parsePosition(animation, position.substr(0, i - 1)) + offset : clippedDuration + offset;
20273                    }
20274
20275                    return position == null ? clippedDuration : +position;
20276                },
20277                _conditionalReturn = function _conditionalReturn(value, func) {
20278                    return value || value === 0 ? func(value) : func;
20279                },
20280                _clamp = function _clamp(min, max, value) {
20281                    return value < min ? min : value > max ? max : value;
20282                },
20283                getUnit = function getUnit(value) {
20284                    return (value = (value + "").substr((parseFloat(value) + "").length)) && isNaN(value) ? value : "";
20285                },
20286                clamp = function clamp(min, max, value) {
20287                    return _conditionalReturn(value, function (v) {
20288                        return _clamp(min, max, v);
20289                    });
20290                },
20291                _slice = [].slice,
20292                _isArrayLike = function _isArrayLike(value, nonEmpty) {
20293                    return value && _isObject(value) && "length" in value && (!nonEmpty && !value.length || value.length - 1 in value && _isObject(value[0])) && !value.nodeType && value !== _win;
20294                },
20295                _flatten = function _flatten(ar, leaveStrings, accumulator) {
20296                    if (accumulator === void 0) {
20297                        accumulator = [];
20298                    }
20299
20300                    return ar.forEach(function (value) {
20301                        var _accumulator;
20302
20303                        return _isString(value) && !leaveStrings || _isArrayLike(value, 1) ? (_accumulator = accumulator).push.apply(_accumulator, toArray(value)) : accumulator.push(value);
20304                    }) || accumulator;
20305                },
20306                toArray = function toArray(value, leaveStrings) {
20307                    return _isString(value) && !leaveStrings && (_coreInitted || !_wake()) ? _slice.call(_doc.querySelectorAll(value), 0) : _isArray(value) ? _flatten(value, leaveStrings) : _isArrayLike(value) ? _slice.call(value, 0) : value ? [value] : [];
20308                },
20309                shuffle = function shuffle(a) {
20310                    return a.sort(function () {
20311                        return .5 - Math.random();
20312                    });
20313                },
20314                distribute = function distribute(v) {
20315                    if (_isFunction(v)) {
20316                        return v;
20317                    }
20318
20319                    var vars = _isObject(v) ? v : {
20320                            each: v
20321                        },
20322                        ease = _parseEase(vars.ease),
20323                        from = vars.from || 0,
20324                        base = parseFloat(vars.base) || 0,
20325                        cache = {},
20326                        isDecimal = from > 0 && from < 1,
20327                        ratios = isNaN(from) || isDecimal,
20328                        axis = vars.axis,
20329                        ratioX = from,
20330                        ratioY = from;
20331
20332                    if (_isString(from)) {
20333                        ratioX = ratioY = {
20334                            center: .5,
20335                            edges: .5,
20336                            end: 1
20337                        }[from] || 0;
20338                    } else if (!isDecimal && ratios) {
20339                        ratioX = from[0];
20340                        ratioY = from[1];
20341                    }
20342
20343                    return function (i, target, a) {
20344                        var l = (a || vars).length,
20345                            distances = cache[l],
20346                            originX,
20347                            originY,
20348                            x,
20349                            y,
20350                            d,
20351                            j,
20352                            max,
20353                            min,
20354                            wrapAt;
20355
20356                        if (!distances) {
20357                            wrapAt = vars.grid === "auto" ? 0 : (vars.grid || [1, _bigNum])[1];
20358
20359                            if (!wrapAt) {
20360                                max = -_bigNum;
20361
20362                                while (max < (max = a[wrapAt++].getBoundingClientRect().left) && wrapAt < l) {
20363                                }
20364
20365                                wrapAt--;
20366                            }
20367
20368                            distances = cache[l] = [];
20369                            originX = ratios ? Math.min(wrapAt, l) * ratioX - .5 : from % wrapAt;
20370                            originY = ratios ? l * ratioY / wrapAt - .5 : from / wrapAt | 0;
20371                            max = 0;
20372                            min = _bigNum;
20373
20374                            for (j = 0; j < l; j++) {
20375                                x = j % wrapAt - originX;
20376                                y = originY - (j / wrapAt | 0);
20377                                distances[j] = d = !axis ? _sqrt(x * x + y * y) : Math.abs(axis === "y" ? y : x);
20378                                d > max && (max = d);
20379                                d < min && (min = d);
20380                            }
20381
20382                            from === "random" && shuffle(distances);
20383                            distances.max = max - min;
20384                            distances.min = min;
20385                            distances.v = l = (parseFloat(vars.amount) || parseFloat(vars.each) * (wrapAt > l ? l - 1 : !axis ? Math.max(wrapAt, l / wrapAt) : axis === "y" ? l / wrapAt : wrapAt) || 0) * (from === "edges" ? -1 : 1);
20386                            distances.b = l < 0 ? base - l : base;
20387                            distances.u = getUnit(vars.amount || vars.each) || 0;
20388                            ease = ease && l < 0 ? _invertEase(ease) : ease;
20389                        }
20390
20391                        l = (distances[i] - distances.min) / distances.max || 0;
20392                        return _round(distances.b + (ease ? ease(l) : l) * distances.v) + distances.u;
20393                    };
20394                },
20395                _roundModifier = function _roundModifier(v) {
20396                    var p = v < 1 ? Math.pow(10, (v + "").length - 2) : 1;
20397                    return function (raw) {
20398                        return Math.floor(Math.round(parseFloat(raw) / v) * v * p) / p + (_isNumber(raw) ? 0 : getUnit(raw));
20399                    };
20400                },
20401                snap = function snap(snapTo, value) {
20402                    var isArray = _isArray(snapTo),
20403                        radius,
20404                        is2D;
20405
20406                    if (!isArray && _isObject(snapTo)) {
20407                        radius = isArray = snapTo.radius || _bigNum;
20408
20409                        if (snapTo.values) {
20410                            snapTo = toArray(snapTo.values);
20411
20412                            if (is2D = !_isNumber(snapTo[0])) {
20413                                radius *= radius;
20414                            }
20415                        } else {
20416                            snapTo = _roundModifier(snapTo.increment);
20417                        }
20418                    }
20419
20420                    return _conditionalReturn(value, !isArray ? _roundModifier(snapTo) : _isFunction(snapTo) ? function (raw) {
20421                        is2D = snapTo(raw);
20422                        return Math.abs(is2D - raw) <= radius ? is2D : raw;
20423                    } : function (raw) {
20424                        var x = parseFloat(is2D ? raw.x : raw),
20425                            y = parseFloat(is2D ? raw.y : 0),
20426                            min = _bigNum,
20427                            closest = 0,
20428                            i = snapTo.length,
20429                            dx,
20430                            dy;
20431
20432                        while (i--) {
20433                            if (is2D) {
20434                                dx = snapTo[i].x - x;
20435                                dy = snapTo[i].y - y;
20436                                dx = dx * dx + dy * dy;
20437                            } else {
20438                                dx = Math.abs(snapTo[i] - x);
20439                            }
20440
20441                            if (dx < min) {
20442                                min = dx;
20443                                closest = i;
20444                            }
20445                        }
20446
20447                        closest = !radius || min <= radius ? snapTo[closest] : raw;
20448                        return is2D || closest === raw || _isNumber(raw) ? closest : closest + getUnit(raw);
20449                    });
20450                },
20451                random = function random(min, max, roundingIncrement, returnFunction) {
20452                    return _conditionalReturn(_isArray(min) ? !max : roundingIncrement === true ? !!(roundingIncrement = 0) : !returnFunction, function () {
20453                        return _isArray(min) ? min[~~(Math.random() * min.length)] : (roundingIncrement = roundingIncrement || 1e
vendor: 5,061 bytes, lines 20453-20560
20453-5) && (returnFunction = roundingIncrement < 1 ? Math.pow(10, (roundingIncrement + "").length - 2) : 1) && Math.floor(Math.round((min + Math.random() * (max - min)) / roundingIncrement) * roundingIncrement * returnFunction) / returnFunction;
20454                    });
20455                },
20456                pipe = function pipe() {
20457                    for (var _len = arguments.length, functions = new Array(_len), _key = 0; _key < _len; _key++) {
20458                        functions[_key] = arguments[_key];
20459                    }
20460
20461                    return function (value) {
20462                        return functions.reduce(function (v, f) {
20463                            return f(v);
20464                        }, value);
20465                    };
20466                },
20467                unitize = function unitize(func, unit) {
20468                    return function (value) {
20469                        return func(parseFloat(value)) + (unit || getUnit(value));
20470                    };
20471                },
20472                normalize = function normalize(min, max, value) {
20473                    return mapRange(min, max, 0, 1, value);
20474                },
20475                _wrapArray = function _wrapArray(a, wrapper, value) {
20476                    return _conditionalReturn(value, function (index) {
20477                        return a[~~wrapper(index)];
20478                    });
20479                },
20480                wrap = function wrap(min, max, value) {
20481                    var range = max - min;
20482                    return _isArray(min) ? _wrapArray(min, wrap(0, min.length), max) : _conditionalReturn(value, function (value) {
20483                        return (range + (value - min) % range) % range + min;
20484                    });
20485                },
20486                wrapYoyo = function wrapYoyo(min, max, value) {
20487                    var range = max - min,
20488                        total = range * 2;
20489                    return _isArray(min) ? _wrapArray(min, wrapYoyo(0, min.length - 1), max) : _conditionalReturn(value, function (value) {
20490                        value = (total + (value - min) % total) % total || 0;
20491                        return min + (value > range ? total - value : value);
20492                    });
20493                },
20494                _replaceRandom = function _replaceRandom(value) {
20495                    var prev = 0,
20496                        s = "",
20497                        i,
20498                        nums,
20499                        end,
20500                        isArray;
20501
20502                    while (~(i = value.indexOf("random(", prev))) {
20503                        end = value.indexOf(")", i);
20504                        isArray = value.charAt(i + 7) === "[";
20505                        nums = value.substr(i + 7, end - i - 7).match(isArray ? _delimitedValueExp : _strictNumExp);
20506                        s += value.substr(prev, i - prev) + random(isArray ? nums : +nums[0], isArray ? 0 : +nums[1], +nums[2] || 1e-5);
20507                        prev = end + 1;
20508                    }
20509
20510                    return s + value.substr(prev, value.length - prev);
20511                },
20512                mapRange = function mapRange(inMin, inMax, outMin, outMax, value) {
20513                    var inRange = inMax - inMin,
20514                        outRange = outMax - outMin;
20515                    return _conditionalReturn(value, function (value) {
20516                        return outMin + ((value - inMin) / inRange * outRange || 0);
20517                    });
20518                },
20519                interpolate = function interpolate(start, end, progress, mutate) {
20520                    var func = isNaN(start + end) ? 0 : function (p) {
20521                        return (1 - p) * start + p * end;
20522                    };
20523
20524                    if (!func) {
20525                        var isString = _isString(start),
20526                            master = {},
20527                            p,
20528                            i,
20529                            interpolators,
20530                            l,
20531                            il;
20532
20533                        progress === true && (mutate = 1) && (progress = null);
20534
20535                        if (isString) {
20536                            start = {
20537                                p: start
20538                            };
20539                            end = {
20540                                p: end
20541                            };
20542                        } else if (_isArray(start) && !_isArray(end)) {
20543                            interpolators = [];
20544                            l = start.length;
20545                            il = l - 2;
20546
20547                            for (i = 1; i < l; i++) {
20548                                interpolators.push(interpolate(start[i - 1], start[i]));
20549                            }
20550
20551                            l--;
20552
20553                            func = function func(p) {
20554                                p *= l;
20555                                var i = Math.min(il, ~~p);
20556                                return interpolators[i](p - i);
20557                            };
20558
20559                            progress = end;
20560                        } else if (!mutate) {
vendor: 17,909 bytes, lines 20561-20984
20561                            start = _merge(_isArray(start) ? [] : {}, start);
20562                        }
20563
20564                        if (!interpolators) {
20565                            for (p in end) {
20566                                _addPropTween.call(master, start, p, "get", end[p]);
20567                            }
20568
20569                            func = function func(p) {
20570                                return _renderPropTweens(p, master) || (isString ? start.p : start);
20571                            };
20572                        }
20573                    }
20574
20575                    return _conditionalReturn(progress, func);
20576                },
20577                _getLabelInDirection = function _getLabelInDirection(timeline, fromTime, backward) {
20578                    var labels = timeline.labels,
20579                        min = _bigNum,
20580                        p,
20581                        distance,
20582                        label;
20583
20584                    for (p in labels) {
20585                        distance = labels[p] - fromTime;
20586
20587                        if (distance < 0 === !!backward && distance && min > (distance = Math.abs(distance))) {
20588                            label = p;
20589                            min = distance;
20590                        }
20591                    }
20592
20593                    return label;
20594                },
20595                _callback = function _callback(animation, type, executeLazyFirst) {
20596                    var v = animation.vars,
20597                        callback = v[type],
20598                        params,
20599                        scope;
20600
20601                    if (!callback) {
20602                        return;
20603                    }
20604
20605                    params = v[type + "Params"];
20606                    scope = v.callbackScope || animation;
20607                    executeLazyFirst && _lazyTweens.length && _lazyRender();
20608                    return params ? callback.apply(scope, params) : callback.call(scope);
20609                },
20610                _interrupt = function _interrupt(animation) {
20611                    _removeFromParent(animation);
20612
20613                    animation.progress() < 1 && _callback(animation, "onInterrupt");
20614                    return animation;
20615                },
20616                _quickTween,
20617                _createPlugin = function _createPlugin(config) {
20618                    config = !config.name && config["default"] || config;
20619
20620                    var name = config.name,
20621                        isFunc = _isFunction(config),
20622                        Plugin = name && !isFunc && config.init ? function () {
20623                            this._props = [];
20624                        } : config,
20625                        instanceDefaults = {
20626                            init: _emptyFunc,
20627                            render: _renderPropTweens,
20628                            add: _addPropTween,
20629                            kill: _killPropTweensOf,
20630                            modifier: _addPluginModifier,
20631                            rawVars: 0
20632                        },
20633                        statics = {
20634                            targetTest: 0,
20635                            get: 0,
20636                            getSetter: _getSetter,
20637                            aliases: {},
20638                            register: 0
20639                        };
20640
20641                    _wake();
20642
20643                    if (config !== Plugin) {
20644                        if (_plugins[name]) {
20645                            return;
20646                        }
20647
20648                        _setDefaults(Plugin, _setDefaults(_copyExcluding(config, instanceDefaults), statics));
20649
20650                        _merge(Plugin.prototype, _merge(instanceDefaults, _copyExcluding(config, statics)));
20651
20652                        _plugins[Plugin.prop = name] = Plugin;
20653
20654                        if (config.targetTest) {
20655                            _harnessPlugins.push(Plugin);
20656
20657                            _reservedProps[name] = 1;
20658                        }
20659
20660                        name = (name === "css" ? "CSS" : name.charAt(0).toUpperCase() + name.substr(1)) + "Plugin";
20661                    }
20662
20663                    _addGlobal(name, Plugin);
20664
20665                    config.register && config.register(gsap, Plugin, PropTween);
20666                },
20667                _255 = 255,
20668                _colorLookup = {
20669                    aqua: [0, _255, _255],
20670                    lime: [0, _255, 0],
20671                    silver: [192, 192, 192],
20672                    black: [0, 0, 0],
20673                    maroon: [128, 0, 0],
20674                    teal: [0, 128, 128],
20675                    blue: [0, 0, _255],
20676                    navy: [0, 0, 128],
20677                    white: [_255, _255, _255],
20678                    olive: [128, 128, 0],
20679                    yellow: [_255, _255, 0],
20680                    orange: [_255, 165, 0],
20681                    gray: [128, 128, 128],
20682                    purple: [128, 0, 128],
20683                    green: [0, 128, 0],
20684                    red: [_255, 0, 0],
20685                    pink: [_255, 192, 203],
20686                    cyan: [0, _255, _255],
20687                    transparent: [_255, _255, _255, 0]
20688                },
20689                _hue = function _hue(h, m1, m2) {
20690                    h = h < 0 ? h + 1 : h > 1 ? h - 1 : h;
20691                    return (h * 6 < 1 ? m1 + (m2 - m1) * h * 6 : h < .5 ? m2 : h * 3 < 2 ? m1 + (m2 - m1) * (2 / 3 - h) * 6 : m1) * _255 + .5 | 0;
20692                },
20693                splitColor = function splitColor(v, toHSL, forceAlpha) {
20694                    var a = !v ? _colorLookup.black : _isNumber(v) ? [v >> 16, v >> 8 & _255, v & _255] : 0,
20695                        r,
20696                        g,
20697                        b,
20698                        h,
20699                        s,
20700                        l,
20701                        max,
20702                        min,
20703                        d,
20704                        wasHSL;
20705
20706                    if (!a) {
20707                        if (v.substr(-1) === ",") {
20708                            v = v.substr(0, v.length - 1);
20709                        }
20710
20711                        if (_colorLookup[v]) {
20712                            a = _colorLookup[v];
20713                        } else if (v.charAt(0) === "#") {
20714                            if (v.length === 4) {
20715                                r = v.charAt(1);
20716                                g = v.charAt(2);
20717                                b = v.charAt(3);
20718                                v = "#" + r + r + g + g + b + b;
20719                            }
20720
20721                            v = parseInt(v.substr(1), 16);
20722                            a = [v >> 16, v >> 8 & _255, v & _255];
20723                        } else if (v.substr(0, 3) === "hsl") {
20724                            a = wasHSL = v.match(_strictNumExp);
20725
20726                            if (!toHSL) {
20727                                h = +a[0] % 360 / 360;
20728                                s = +a[1] / 100;
20729                                l = +a[2] / 100;
20730                                g = l <= .5 ? l * (s + 1) : l + s - l * s;
20731                                r = l * 2 - g;
20732                                a.length > 3 && (a[3] *= 1);
20733                                a[0] = _hue(h + 1 / 3, r, g);
20734                                a[1] = _hue(h, r, g);
20735                                a[2] = _hue(h - 1 / 3, r, g);
20736                            } else if (~v.indexOf("=")) {
20737                                a = v.match(_numExp);
20738                                forceAlpha && a.length < 4 && (a[3] = 1);
20739                                return a;
20740                            }
20741                        } else {
20742                            a = v.match(_strictNumExp) || _colorLookup.transparent;
20743                        }
20744
20745                        a = a.map(Number);
20746                    }
20747
20748                    if (toHSL && !wasHSL) {
20749                        r = a[0] / _255;
20750                        g = a[1] / _255;
20751                        b = a[2] / _255;
20752                        max = Math.max(r, g, b);
20753                        min = Math.min(r, g, b);
20754                        l = (max + min) / 2;
20755
20756                        if (max === min) {
20757                            h = s = 0;
20758                        } else {
20759                            d = max - min;
20760                            s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
20761                            h = max === r ? (g - b) / d + (g < b ? 6 : 0) : max === g ? (b - r) / d + 2 : (r - g) / d + 4;
20762                            h *= 60;
20763                        }
20764
20765                        a[0] = ~~(h + .5);
20766                        a[1] = ~~(s * 100 + .5);
20767                        a[2] = ~~(l * 100 + .5);
20768                    }
20769
20770                    forceAlpha && a.length < 4 && (a[3] = 1);
20771                    return a;
20772                },
20773                _colorOrderData = function _colorOrderData(v) {
20774                    var values = [],
20775                        c = [],
20776                        i = -1;
20777                    v.split(_colorExp).forEach(function (v) {
20778                        var a = v.match(_numWithUnitExp) || [];
20779                        values.push.apply(values, a);
20780                        c.push(i += a.length + 1);
20781                    });
20782                    values.c = c;
20783                    return values;
20784                },
20785                _formatColors = function _formatColors(s, toHSL, orderMatchData) {
20786                    var result = "",
20787                        colors = (s + result).match(_colorExp),
20788                        type = toHSL ? "hsla(" : "rgba(",
20789                        i = 0,
20790                        c,
20791                        shell,
20792                        d,
20793                        l;
20794
20795                    if (!colors) {
20796                        return s;
20797                    }
20798
20799                    colors = colors.map(function (color) {
20800                        return (color = splitColor(color, toHSL, 1)) && type + (toHSL ? color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : color.join(",")) + ")";
20801                    });
20802
20803                    if (orderMatchData) {
20804                        d = _colorOrderData(s);
20805                        c = orderMatchData.c;
20806
20807                        if (c.join(result) !== d.c.join(result)) {
20808                            shell = s.replace(_colorExp, "1").split(_numWithUnitExp);
20809                            l = shell.length - 1;
20810
20811                            for (; i < l; i++) {
20812                                result += shell[i] + (~c.indexOf(i) ? colors.shift() || type + "0,0,0,0)" : (d.length ? d : colors.length ? colors : orderMatchData).shift());
20813                            }
20814                        }
20815                    }
20816
20817                    if (!shell) {
20818                        shell = s.split(_colorExp);
20819                        l = shell.length - 1;
20820
20821                        for (; i < l; i++) {
20822                            result += shell[i] + colors[i];
20823                        }
20824                    }
20825
20826                    return result + shell[l];
20827                },
20828                _colorExp = function () {
20829                    var s = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3}){1,2}\\b",
20830                        p;
20831
20832                    for (p in _colorLookup) {
20833                        s += "|" + p + "\\b";
20834                    }
20835
20836                    return new RegExp(s + ")", "gi");
20837                }(),
20838                _hslExp = /hsl[a]?\(/,
20839                _colorStringFilter = function _colorStringFilter(a) {
20840                    var combined = a.join(" "),
20841                        toHSL;
20842                    _colorExp.lastIndex = 0;
20843
20844                    if (_colorExp.test(combined)) {
20845                        toHSL = _hslExp.test(combined);
20846                        a[1] = _formatColors(a[1], toHSL);
20847                        a[0] = _formatColors(a[0], toHSL, _colorOrderData(a[1]));
20848                        return true;
20849                    }
20850                },
20851                _tickerActive,
20852                _ticker = function () {
20853                    var _getTime = Date.now,
20854                        _lagThreshold = 500,
20855                        _adjustedLag = 33,
20856                        _startTime = _getTime(),
20857                        _lastUpdate = _startTime,
20858                        _gap = 1000 / 240,
20859                        _nextTime = _gap,
20860                        _listeners = [],
20861                        _id,
20862                        _req,
20863                        _raf,
20864                        _self,
20865                        _delta,
20866                        _i,
20867                        _tick = function _tick(v) {
20868                            var elapsed = _getTime() - _lastUpdate,
20869                                manual = v === true,
20870                                overlap,
20871                                dispatch,
20872                                time,
20873                                frame;
20874
20875                            elapsed > _lagThreshold && (_startTime += elapsed - _adjustedLag);
20876                            _lastUpdate += elapsed;
20877                            time = _lastUpdate - _startTime;
20878                            overlap = time - _nextTime;
20879
20880                            if (overlap > 0 || manual) {
20881                                frame = ++_self.frame;
20882                                _delta = time - _self.time * 1000;
20883                                _self.time = time = time / 1000;
20884                                _nextTime += overlap + (overlap >= _gap ? 4 : _gap - overlap);
20885                                dispatch = 1;
20886                            }
20887
20888                            manual || (_id = _req(_tick));
20889
20890                            if (dispatch) {
20891                                for (_i = 0; _i < _listeners.length; _i++) {
20892                                    _listeners[_i](time, _delta, frame, v);
20893                                }
20894                            }
20895                        };
20896
20897                    _self = {
20898                        time: 0,
20899                        frame: 0,
20900                        tick: function tick() {
20901                            _tick(true);
20902                        },
20903                        deltaRatio: function deltaRatio(fps) {
20904                            return _delta / (1000 / (fps || 60));
20905                        },
20906                        wake: function wake() {
20907                            if (_coreReady) {
20908                                if (!_coreInitted && _windowExists()) {
20909                                    _win = _coreInitted = window;
20910                                    _doc = _win.document || {};
20911                                    _globals.gsap = gsap;
20912                                    (_win.gsapVersions || (_win.gsapVersions = [])).push(gsap.version);
20913
20914                                    _install(_installScope || _win.GreenSockGlobals || !_win.gsap && _win || {});
20915
20916                                    _raf = _win.requestAnimationFrame;
20917                                }
20918
20919                                _id && _self.sleep();
20920
20921                                _req = _raf || function (f) {
20922                                    return setTimeout(f, _nextTime - _self.time * 1000 + 1 | 0);
20923                                };
20924
20925                                _tickerActive = 1;
20926
20927                                _tick(2);
20928                            }
20929                        },
20930                        sleep: function sleep() {
20931                            (_raf ? _win.cancelAnimationFrame : clearTimeout)(_id);
20932                            _tickerActive = 0;
20933                            _req = _emptyFunc;
20934                        },
20935                        lagSmoothing: function lagSmoothing(threshold, adjustedLag) {
20936                            _lagThreshold = threshold || 1 / _tinyNum;
20937                            _adjustedLag = Math.min(adjustedLag, _lagThreshold, 0);
20938                        },
20939                        fps: function fps(_fps) {
20940                            _gap = 1000 / (_fps || 240);
20941                            _nextTime = _self.time * 1000 + _gap;
20942                        },
20943                        add: function add(callback) {
20944                            _listeners.indexOf(callback) < 0 && _listeners.push(callback);
20945
20946                            _wake();
20947                        },
20948                        remove: function remove(callback) {
20949                            var i;
20950                            ~(i = _listeners.indexOf(callback)) && _listeners.splice(i, 1) && _i >= i && _i--;
20951                        },
20952                        _listeners: _listeners
20953                    };
20954                    return _self;
20955                }(),
20956                _wake = function _wake() {
20957                    return !_tickerActive && _ticker.wake();
20958                },
20959                _easeMap = {},
20960                _customEaseExp = /^[\d.\-M][\d.\-,\s]/,
20961                _quotesExp = /["']/g,
20962                _parseObjectInString = function _parseObjectInString(value) {
20963                    var obj = {},
20964                        split = value.substr(1, value.length - 3).split(":"),
20965                        key = split[0],
20966                        i = 1,
20967                        l = split.length,
20968                        index,
20969                        val,
20970                        parsedVal;
20971
20972                    for (; i < l; i++) {
20973                        val = split[i];
20974                        index = i !== l - 1 ? val.lastIndexOf(",") : val.length;
20975                        parsedVal = val.substr(0, index);
20976                        obj[key] = isNaN(parsedVal) ? parsedVal.replace(_quotesExp, "").trim() : +parsedVal;
20977                        key = val.substr(index + 1).trim();
20978                    }
20979
20980                    return obj;
20981                },
20982                _valueInParentheses = function _valueInParentheses(value) {
20983                    var open = value.indexOf("(") + 1,
20984                        close = value.indexOf(")"),
vendor: 5,325 bytes, lines 20985-21095
20985                        nested = value.indexOf("(", open);
20986                    return value.substring(open, ~nested && nested < close ? value.indexOf(")", close + 1) : close);
20987                },
20988                _configEaseFromString = function _configEaseFromString(name) {
20989                    var split = (name + "").split("("),
20990                        ease = _easeMap[split[0]];
20991                    return ease && split.length > 1 && ease.config ? ease.config.apply(null, ~name.indexOf("{") ? [_parseObjectInString(split[1])] : _valueInParentheses(name).split(",").map(_numericIfPossible)) : _easeMap._CE && _customEaseExp.test(name) ? _easeMap._CE("", name) : ease;
20992                },
20993                _invertEase = function _invertEase(ease) {
20994                    return function (p) {
20995                        return 1 - ease(1 - p);
20996                    };
20997                },
20998                _propagateYoyoEase = function _propagateYoyoEase(timeline, isYoyo) {
20999                    var child = timeline._first,
21000                        ease;
21001
21002                    while (child) {
21003                        if (child instanceof Timeline) {
21004                            _propagateYoyoEase(child, isYoyo);
21005                        } else if (child.vars.yoyoEase && (!child._yoyo || !child._repeat) && child._yoyo !== isYoyo) {
21006                            if (child.timeline) {
21007                                _propagateYoyoEase(child.timeline, isYoyo);
21008                            } else {
21009                                ease = child._ease;
21010                                child._ease = child._yEase;
21011                                child._yEase = ease;
21012                                child._yoyo = isYoyo;
21013                            }
21014                        }
21015
21016                        child = child._next;
21017                    }
21018                },
21019                _parseEase = function _parseEase(ease, defaultEase) {
21020                    return !ease ? defaultEase : (_isFunction(ease) ? ease : _easeMap[ease] || _configEaseFromString(ease)) || defaultEase;
21021                },
21022                _insertEase = function _insertEase(names, easeIn, easeOut, easeInOut) {
21023                    if (easeOut === void 0) {
21024                        easeOut = function easeOut(p) {
21025                            return 1 - easeIn(1 - p);
21026                        };
21027                    }
21028
21029                    if (easeInOut === void 0) {
21030                        easeInOut = function easeInOut(p) {
21031                            return p < .5 ? easeIn(p * 2) / 2 : 1 - easeIn((1 - p) * 2) / 2;
21032                        };
21033                    }
21034
21035                    var ease = {
21036                            easeIn: easeIn,
21037                            easeOut: easeOut,
21038                            easeInOut: easeInOut
21039                        },
21040                        lowercaseName;
21041
21042                    _forEachName(names, function (name) {
21043                        _easeMap[name] = _globals[name] = ease;
21044                        _easeMap[lowercaseName = name.toLowerCase()] = easeOut;
21045
21046                        for (var p in ease) {
21047                            _easeMap[lowercaseName + (p === "easeIn" ? ".in" : p === "easeOut" ? ".out" : ".inOut")] = _easeMap[name + "." + p] = ease[p];
21048                        }
21049                    });
21050
21051                    return ease;
21052                },
21053                _easeInOutFromOut = function _easeInOutFromOut(easeOut) {
21054                    return function (p) {
21055                        return p < .5 ? (1 - easeOut(1 - p * 2)) / 2 : .5 + easeOut((p - .5) * 2) / 2;
21056                    };
21057                },
21058                _configElastic = function _configElastic(type, amplitude, period) {
21059                    var p1 = amplitude >= 1 ? amplitude : 1,
21060                        p2 = (period || (type ? .3 : .45)) / (amplitude < 1 ? amplitude : 1),
21061                        p3 = p2 / _2PI * (Math.asin(1 / p1) || 0),
21062                        easeOut = function easeOut(p) {
21063                            return p === 1 ? 1 : p1 * Math.pow(2, -10 * p) * _sin((p - p3) * p2) + 1;
21064                        },
21065                        ease = type === "out" ? easeOut : type === "in" ? function (p) {
21066                            return 1 - easeOut(1 - p);
21067                        } : _easeInOutFromOut(easeOut);
21068
21069                    p2 = _2PI / p2;
21070
21071                    ease.config = function (amplitude, period) {
21072                        return _configElastic(type, amplitude, period);
21073                    };
21074
21075                    return ease;
21076                },
21077                _configBack = function _configBack(type, overshoot) {
21078                    if (overshoot === void 0) {
21079                        overshoot = 1.70158;
21080                    }
21081
21082                    var easeOut = function easeOut(p) {
21083                            return p ? --p * p * ((overshoot + 1) * p + overshoot) + 1 : 0;
21084                        },
21085                        ease = type === "out" ? easeOut : type === "in" ? function (p) {
21086                            return 1 - easeOut(1 - p);
21087                        } : _easeInOutFromOut(easeOut);
21088
21089                    ease.config = function (overshoot) {
21090                        return _configBack(type, overshoot);
21091                    };
21092
21093                    return ease;
21094                };
21095
vendor: 4,157 bytes, lines 21096-21196
21096            _forEachName("Linear,Quad,Cubic,Quart,Quint,Strong", function (name, i) {
21097                var power = i < 5 ? i + 1 : i;
21098
21099                _insertEase(name + ",Power" + (power - 1), i ? function (p) {
21100                    return Math.pow(p, power);
21101                } : function (p) {
21102                    return p;
21103                }, function (p) {
21104                    return 1 - Math.pow(1 - p, power);
21105                }, function (p) {
21106                    return p < .5 ? Math.pow(p * 2, power) / 2 : 1 - Math.pow((1 - p) * 2, power) / 2;
21107                });
21108            });
21109
21110            _easeMap.Linear.easeNone = _easeMap.none = _easeMap.Linear.easeIn;
21111
21112            _insertEase("Elastic", _configElastic("in"), _configElastic("out"), _configElastic());
21113
21114            (function (n, c) {
21115                var n1 = 1 / c,
21116                    n2 = 2 * n1,
21117                    n3 = 2.5 * n1,
21118                    easeOut = function easeOut(p) {
21119                        return p < n1 ? n * p * p : p < n2 ? n * Math.pow(p - 1.5 / c, 2) + .75 : p < n3 ? n * (p -= 2.25 / c) * p + .9375 : n * Math.pow(p - 2.625 / c, 2) + .984375;
21120                    };
21121
21122                _insertEase("Bounce", function (p) {
21123                    return 1 - easeOut(1 - p);
21124                }, easeOut);
21125            })(7.5625, 2.75);
21126
21127            _insertEase("Expo", function (p) {
21128                return p ? Math.pow(2, 10 * (p - 1)) : 0;
21129            });
21130
21131            _insertEase("Circ", function (p) {
21132                return -(_sqrt(1 - p * p) - 1);
21133            });
21134
21135            _insertEase("Sine", function (p) {
21136                return p === 1 ? 1 : -_cos(p * _HALF_PI) + 1;
21137            });
21138
21139            _insertEase("Back", _configBack("in"), _configBack("out"), _configBack());
21140
21141            _easeMap.SteppedEase = _easeMap.steps = _globals.SteppedEase = {
21142                config: function config(steps, immediateStart) {
21143                    if (steps === void 0) {
21144                        steps = 1;
21145                    }
21146
21147                    var p1 = 1 / steps,
21148                        p2 = steps + (immediateStart ? 0 : 1),
21149                        p3 = immediateStart ? 1 : 0,
21150                        max = 1 - _tinyNum;
21151                    return function (p) {
21152                        return ((p2 * _clamp(0, max, p) | 0) + p3) * p1;
21153                    };
21154                }
21155            };
21156            _defaults.ease = _easeMap["quad.out"];
21157
21158            _forEachName("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt", function (name) {
21159                return _callbackNames += name + "," + name + "Params,";
21160            });
21161
21162            var GSCache = function GSCache(target, harness) {
21163                this.id = _gsID++;
21164                target._gsap = this;
21165                this.target = target;
21166                this.harness = harness;
21167                this.get = harness ? harness.get : _getProperty;
21168                this.set = harness ? harness.getSetter : _getSetter;
21169            };
21170            var Animation = function () {
21171                function Animation(vars, time) {
21172                    var parent = vars.parent || _globalTimeline;
21173                    this.vars = vars;
21174                    this._delay = +vars.delay || 0;
21175
21176                    if (this._repeat = vars.repeat || 0) {
21177                        this._rDelay = vars.repeatDelay || 0;
21178                        this._yoyo = !!vars.yoyo || !!vars.yoyoEase;
21179                    }
21180
21181                    this._ts = 1;
21182
21183                    _setDuration(this, +vars.duration, 1, 1);
21184
21185                    this.data = vars.data;
21186                    _tickerActive || _ticker.wake();
21187                    parent && _addToTimeline(parent, this, time || time === 0 ? time : parent._time, 1);
21188                    vars.reversed && this.reverse();
21189                    vars.paused && this.paused(true);
21190                }
21191
21192                var _proto = Animation.prototype;
21193
21194                _proto.delay = function delay(value) {
21195                    if (value || value === 0) {
21196                        this.parent && this.parent.smoothChildTiming && this.startTime(this._start + value - this._delay);
vendor: 5,510 bytes, lines 21197-21310
21197                        this._delay = value;
21198                        return this;
21199                    }
21200
21201                    return this._delay;
21202                };
21203
21204                _proto.duration = function duration(value) {
21205                    return arguments.length ? this.totalDuration(this._repeat > 0 ? value + (value + this._rDelay) * this._repeat : value) : this.totalDuration() && this._dur;
21206                };
21207
21208                _proto.totalDuration = function totalDuration(value) {
21209                    if (!arguments.length) {
21210                        return this._tDur;
21211                    }
21212
21213                    this._dirty = 0;
21214                    return _setDuration(this, this._repeat < 0 ? value : (value - this._repeat * this._rDelay) / (this._repeat + 1));
21215                };
21216
21217                _proto.totalTime = function totalTime(_totalTime, suppressEvents) {
21218                    _wake();
21219
21220                    if (!arguments.length) {
21221                        return this._tTime;
21222                    }
21223
21224                    var parent = this._dp;
21225
21226                    if (parent && parent.smoothChildTiming && this._ts) {
21227                        _alignPlayhead(this, _totalTime);
21228
21229                        while (parent.parent) {
21230                            if (parent.parent._time !== parent._start + (parent._ts >= 0 ? parent._tTime / parent._ts : (parent.totalDuration() - parent._tTime) / -parent._ts)) {
21231                                parent.totalTime(parent._tTime, true);
21232                            }
21233
21234                            parent = parent.parent;
21235                        }
21236
21237                        if (!this.parent && this._dp.autoRemoveChildren && (this._ts > 0 && _totalTime < this._tDur || this._ts < 0 && _totalTime > 0 || !this._tDur && !_totalTime)) {
21238                            _addToTimeline(this._dp, this, this._start - this._delay);
21239                        }
21240                    }
21241
21242                    if (this._tTime !== _totalTime || !this._dur && !suppressEvents || this._initted && Math.abs(this._zTime) === _tinyNum || !_totalTime && !this._initted && (this.add || this._ptLookup)) {
21243                        this._ts || (this._pTime = _totalTime);
21244
21245                        _lazySafeRender(this, _totalTime, suppressEvents);
21246                    }
21247
21248                    return this;
21249                };
21250
21251                _proto.time = function time(value, suppressEvents) {
21252                    return arguments.length ? this.totalTime(Math.min(this.totalDuration(), value + _elapsedCycleDuration(this)) % this._dur || (value ? this._dur : 0), suppressEvents) : this._time;
21253                };
21254
21255                _proto.totalProgress = function totalProgress(value, suppressEvents) {
21256                    return arguments.length ? this.totalTime(this.totalDuration() * value, suppressEvents) : this.totalDuration() ? Math.min(1, this._tTime / this._tDur) : this.ratio;
21257                };
21258
21259                _proto.progress = function progress(value, suppressEvents) {
21260                    return arguments.length ? this.totalTime(this.duration() * (this._yoyo && !(this.iteration() & 1) ? 1 - value : value) + _elapsedCycleDuration(this), suppressEvents) : this.duration() ? Math.min(1, this._time / this._dur) : this.ratio;
21261                };
21262
21263                _proto.iteration = function iteration(value, suppressEvents) {
21264                    var cycleDuration = this.duration() + this._rDelay;
21265
21266                    return arguments.length ? this.totalTime(this._time + (value - 1) * cycleDuration, suppressEvents) : this._repeat ? _animationCycle(this._tTime, cycleDuration) + 1 : 1;
21267                };
21268
21269                _proto.timeScale = function timeScale(value) {
21270                    if (!arguments.length) {
21271                        return this._rts === -_tinyNum ? 0 : this._rts;
21272                    }
21273
21274                    if (this._rts === value) {
21275                        return this;
21276                    }
21277
21278                    var tTime = this.parent && this._ts ? _parentToChildTotalTime(this.parent._time, this) : this._tTime;
21279                    this._rts = +value || 0;
21280                    this._ts = this._ps || value === -_tinyNum ? 0 : this._rts;
21281                    return _recacheAncestors(this.totalTime(_clamp(-this._delay, this._tDur, tTime), true));
21282                };
21283
21284                _proto.paused = function paused(value) {
21285                    if (!arguments.length) {
21286                        return this._ps;
21287                    }
21288
21289                    if (this._ps !== value) {
21290                        this._ps = value;
21291
21292                        if (value) {
21293                            this._pTime = this._tTime || Math.max(-this._delay, this.rawTime());
21294                            this._ts = this._act = 0;
21295                        } else {
21296                            _wake();
21297
21298                            this._ts = this._rts;
21299                            this.totalTime(this.parent && !this.parent.smoothChildTiming ? this.rawTime() : this._tTime || this._pTime, this.progress() === 1 && (this._tTime -= _tinyNum) && Math.abs(this._zTime) !== _tinyNum);
21300                        }
21301                    }
21302
21303                    return this;
21304                };
21305
21306                _proto.startTime = function startTime(value) {
21307                    if (arguments.length) {
21308                        this._start = value;
21309                        var parent = this.parent || this._dp;
21310                        parent && (parent._sort || !this.parent) && _addToT
vendor: 3,633 bytes, lines 21310-21400
21310imeline(parent, this, value - this._delay);
21311                        return this;
21312                    }
21313
21314                    return this._start;
21315                };
21316
21317                _proto.endTime = function endTime(includeRepeats) {
21318                    return this._start + (_isNotFalse(includeRepeats) ? this.totalDuration() : this.duration()) / Math.abs(this._ts);
21319                };
21320
21321                _proto.rawTime = function rawTime(wrapRepeats) {
21322                    var parent = this.parent || this._dp;
21323                    return !parent ? this._tTime : wrapRepeats && (!this._ts || this._repeat && this._time && this.totalProgress() < 1) ? this._tTime % (this._dur + this._rDelay) : !this._ts ? this._tTime : _parentToChildTotalTime(parent.rawTime(wrapRepeats), this);
21324                };
21325
21326                _proto.globalTime = function globalTime(rawTime) {
21327                    var animation = this,
21328                        time = arguments.length ? rawTime : animation.rawTime();
21329
21330                    while (animation) {
21331                        time = animation._start + time / (animation._ts || 1);
21332                        animation = animation._dp;
21333                    }
21334
21335                    return time;
21336                };
21337
21338                _proto.repeat = function repeat(value) {
21339                    if (arguments.length) {
21340                        this._repeat = value;
21341                        return _onUpdateTotalDuration(this);
21342                    }
21343
21344                    return this._repeat;
21345                };
21346
21347                _proto.repeatDelay = function repeatDelay(value) {
21348                    if (arguments.length) {
21349                        this._rDelay = value;
21350                        return _onUpdateTotalDuration(this);
21351                    }
21352
21353                    return this._rDelay;
21354                };
21355
21356                _proto.yoyo = function yoyo(value) {
21357                    if (arguments.length) {
21358                        this._yoyo = value;
21359                        return this;
21360                    }
21361
21362                    return this._yoyo;
21363                };
21364
21365                _proto.seek = function seek(position, suppressEvents) {
21366                    return this.totalTime(_parsePosition(this, position), _isNotFalse(suppressEvents));
21367                };
21368
21369                _proto.restart = function restart(includeDelay, suppressEvents) {
21370                    return this.play().totalTime(includeDelay ? -this._delay : 0, _isNotFalse(suppressEvents));
21371                };
21372
21373                _proto.play = function play(from, suppressEvents) {
21374                    from != null && this.seek(from, suppressEvents);
21375                    return this.reversed(false).paused(false);
21376                };
21377
21378                _proto.reverse = function reverse(from, suppressEvents) {
21379                    from != null && this.seek(from || this.totalDuration(), suppressEvents);
21380                    return this.reversed(true).paused(false);
21381                };
21382
21383                _proto.pause = function pause(atTime, suppressEvents) {
21384                    atTime != null && this.seek(atTime, suppressEvents);
21385                    return this.paused(true);
21386                };
21387
21388                _proto.resume = function resume() {
21389                    return this.paused(false);
21390                };
21391
21392                _proto.reversed = function reversed(value) {
21393                    if (arguments.length) {
21394                        !!value !== this.reversed() && this.timeScale(-this._rts || (value ? -_tinyNum : 0));
21395                        return this;
21396                    }
21397
21398                    return this._rts < 0;
21399                };
21400
vendor: 12,022 bytes, lines 21401-21666
21401                _proto.invalidate = function invalidate() {
21402                    this._initted = 0;
21403                    this._zTime = -_tinyNum;
21404                    return this;
21405                };
21406
21407                _proto.isActive = function isActive() {
21408                    var parent = this.parent || this._dp,
21409                        start = this._start,
21410                        rawTime;
21411                    return !!(!parent || this._ts && this._initted && parent.isActive() && (rawTime = parent.rawTime(true)) >= start && rawTime < this.endTime(true) - _tinyNum);
21412                };
21413
21414                _proto.eventCallback = function eventCallback(type, callback, params) {
21415                    var vars = this.vars;
21416
21417                    if (arguments.length > 1) {
21418                        if (!callback) {
21419                            delete vars[type];
21420                        } else {
21421                            vars[type] = callback;
21422                            params && (vars[type + "Params"] = params);
21423                            type === "onUpdate" && (this._onUpdate = callback);
21424                        }
21425
21426                        return this;
21427                    }
21428
21429                    return vars[type];
21430                };
21431
21432                _proto.then = function then(onFulfilled) {
21433                    var self = this;
21434                    return new Promise(function (resolve) {
21435                        var f = _isFunction(onFulfilled) ? onFulfilled : _passThrough,
21436                            _resolve = function _resolve() {
21437                                var _then = self.then;
21438                                self.then = null;
21439                                _isFunction(f) && (f = f(self)) && (f.then || f === self) && (self.then = _then);
21440                                resolve(f);
21441                                self.then = _then;
21442                            };
21443
21444                        if (self._initted && self.totalProgress() === 1 && self._ts >= 0 || !self._tTime && self._ts < 0) {
21445                            _resolve();
21446                        } else {
21447                            self._prom = _resolve;
21448                        }
21449                    });
21450                };
21451
21452                _proto.kill = function kill() {
21453                    _interrupt(this);
21454                };
21455
21456                return Animation;
21457            }();
21458
21459            _setDefaults(Animation.prototype, {
21460                _time: 0,
21461                _start: 0,
21462                _end: 0,
21463                _tTime: 0,
21464                _tDur: 0,
21465                _dirty: 0,
21466                _repeat: 0,
21467                _yoyo: false,
21468                parent: null,
21469                _initted: false,
21470                _rDelay: 0,
21471                _ts: 1,
21472                _dp: 0,
21473                ratio: 0,
21474                _zTime: -_tinyNum,
21475                _prom: 0,
21476                _ps: false,
21477                _rts: 1
21478            });
21479
21480            var Timeline = function (_Animation) {
21481                _inheritsLoose(Timeline, _Animation);
21482
21483                function Timeline(vars, time) {
21484                    var _this;
21485
21486                    if (vars === void 0) {
21487                        vars = {};
21488                    }
21489
21490                    _this = _Animation.call(this, vars, time) || this;
21491                    _this.labels = {};
21492                    _this.smoothChildTiming = !!vars.smoothChildTiming;
21493                    _this.autoRemoveChildren = !!vars.autoRemoveChildren;
21494                    _this._sort = _isNotFalse(vars.sortChildren);
21495                    _this.parent && _postAddChecks(_this.parent, _assertThisInitialized(_this));
21496                    vars.scrollTrigger && _scrollTrigger(_assertThisInitialized(_this), vars.scrollTrigger);
21497                    return _this;
21498                }
21499
21500                var _proto2 = Timeline.prototype;
21501
21502                _proto2.to = function to(targets, vars, position) {
21503                    new Tween(targets, _parseVars(arguments, 0, this), _parsePosition(this, _isNumber(vars) ? arguments[3] : position));
21504                    return this;
21505                };
21506
21507                _proto2.from = function from(targets, vars, position) {
21508                    new Tween(targets, _parseVars(arguments, 1, this), _parsePosition(this, _isNumber(vars) ? arguments[3] : position));
21509                    return this;
21510                };
21511
21512                _proto2.fromTo = function fromTo(targets, fromVars, toVars, position) {
21513                    new Tween(targets, _parseVars(arguments, 2, this), _parsePosition(this, _isNumber(fromVars) ? arguments[4] : position));
21514                    return this;
21515                };
21516
21517                _proto2.set = function set(targets, vars, position) {
21518                    vars.duration = 0;
21519                    vars.parent = this;
21520                    _inheritDefaults(vars).repeatDelay || (vars.repeat = 0);
21521                    vars.immediateRender = !!vars.immediateRender;
21522                    new Tween(targets, vars, _parsePosition(this, position), 1);
21523                    return this;
21524                };
21525
21526                _proto2.call = function call(callback, params, position) {
21527                    return _addToTimeline(this, Tween.delayedCall(0, callback, params), _parsePosition(this, position));
21528                };
21529
21530                _proto2.staggerTo = function staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) {
21531                    vars.duration = duration;
21532                    vars.stagger = vars.stagger || stagger;
21533                    vars.onComplete = onCompleteAll;
21534                    vars.onCompleteParams = onCompleteAllParams;
21535                    vars.parent = this;
21536                    new Tween(targets, vars, _parsePosition(this, position));
21537                    return this;
21538                };
21539
21540                _proto2.staggerFrom = function staggerFrom(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) {
21541                    vars.runBackwards = 1;
21542                    _inheritDefaults(vars).immediateRender = _isNotFalse(vars.immediateRender);
21543                    return this.staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams);
21544                };
21545
21546                _proto2.staggerFromTo = function staggerFromTo(targets, duration, fromVars, toVars, stagger, position, onCompleteAll, onCompleteAllParams) {
21547                    toVars.startAt = fromVars;
21548                    _inheritDefaults(toVars).immediateRender = _isNotFalse(toVars.immediateRender);
21549                    return this.staggerTo(targets, duration, toVars, stagger, position, onCompleteAll, onCompleteAllParams);
21550                };
21551
21552                _proto2.render = function render(totalTime, suppressEvents, force) {
21553                    var prevTime = this._time,
21554                        tDur = this._dirty ? this.totalDuration() : this._tDur,
21555                        dur = this._dur,
21556                        tTime = this !== _globalTimeline && totalTime > tDur - _tinyNum && totalTime >= 0 ? tDur : totalTime < _tinyNum ? 0 : totalTime,
21557                        crossingStart = this._zTime < 0 !== totalTime < 0 && (this._initted || !dur),
21558                        time,
21559                        child,
21560                        next,
21561                        iteration,
21562                        cycleDuration,
21563                        prevPaused,
21564                        pauseTween,
21565                        timeScale,
21566                        prevStart,
21567                        prevIteration,
21568                        yoyo,
21569                        isYoyo;
21570
21571                    if (tTime !== this._tTime || force || crossingStart) {
21572                        if (prevTime !== this._time && dur) {
21573                            tTime += this._time - prevTime;
21574                            totalTime += this._time - prevTime;
21575                        }
21576
21577                        time = tTime;
21578                        prevStart = this._start;
21579                        timeScale = this._ts;
21580                        prevPaused = !timeScale;
21581
21582                        if (crossingStart) {
21583                            dur || (prevTime = this._zTime);
21584                            (totalTime || !suppressEvents) && (this._zTime = totalTime);
21585                        }
21586
21587                        if (this._repeat) {
21588                            yoyo = this._yoyo;
21589                            cycleDuration = dur + this._rDelay;
21590                            time = _round(tTime % cycleDuration);
21591
21592                            if (tTime === tDur) {
21593                                iteration = this._repeat;
21594                                time = dur;
21595                            } else {
21596                                iteration = ~~(tTime / cycleDuration);
21597
21598                                if (iteration && iteration === tTime / cycleDuration) {
21599                                    time = dur;
21600                                    iteration--;
21601                                }
21602
21603                                time > dur && (time = dur);
21604                            }
21605
21606                            prevIteration = _animationCycle(this._tTime, cycleDuration);
21607                            !prevTime && this._tTime && prevIteration !== iteration && (prevIteration = iteration);
21608
21609                            if (yoyo && iteration & 1) {
21610                                time = dur - time;
21611                                isYoyo = 1;
21612                            }
21613
21614                            if (iteration !== prevIteration && !this._lock) {
21615                                var rewinding = yoyo && prevIteration & 1,
21616                                    doesWrap = rewinding === (yoyo && iteration & 1);
21617                                iteration < prevIteration && (rewinding = !rewinding);
21618                                prevTime = rewinding ? 0 : dur;
21619                                this._lock = 1;
21620                                this.render(prevTime || (isYoyo ? 0 : _round(iteration * cycleDuration)), suppressEvents, !dur)._lock = 0;
21621                                !suppressEvents && this.parent && _callback(this, "onRepeat");
21622                                this.vars.repeatRefresh && !isYoyo && (this.invalidate()._lock = 1);
21623
21624                                if (prevTime !== this._time || prevPaused !== !this._ts) {
21625                                    return this;
21626                                }
21627
21628                                dur = this._dur;
21629                                tDur = this._tDur;
21630
21631                                if (doesWrap) {
21632                                    this._lock = 2;
21633                                    prevTime = rewinding ? dur : -0.0001;
21634                                    this.render(prevTime, true);
21635                                    this.vars.repeatRefresh && !isYoyo && this.invalidate();
21636                                }
21637
21638                                this._lock = 0;
21639
21640                                if (!this._ts && !prevPaused) {
21641                                    return this;
21642                                }
21643
21644                                _propagateYoyoEase(this, isYoyo);
21645                            }
21646                        }
21647
21648                        if (this._hasPause && !this._forcing && this._lock < 2) {
21649                            pauseTween = _findNextPauseTween(this, _round(prevTime), _round(time));
21650
21651                            if (pauseTween) {
21652                                tTime -= time - (time = pauseTween._start);
21653                            }
21654                        }
21655
21656                        this._tTime = tTime;
21657                        this._time = time;
21658                        this._act = !timeScale;
21659
21660                        if (!this._initted) {
21661                            this._onUpdate = this.vars.onUpdate;
21662                            this._initted = 1;
21663                            this._zTime = totalTime;
21664                        }
21665
21666                        !prevTime && time && !suppressEvents && _c
vendor: 24,801 bytes, lines 21666-22249
21666allback(this, "onStart");
21667
21668                        if (time >= prevTime && totalTime >= 0) {
21669                            child = this._first;
21670
21671                            while (child) {
21672                                next = child._next;
21673
21674                                if ((child._act || time >= child._start) && child._ts && pauseTween !== child) {
21675                                    if (child.parent !== this) {
21676                                        return this.render(totalTime, suppressEvents, force);
21677                                    }
21678
21679                                    child.render(child._ts > 0 ? (time - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (time - child._start) * child._ts, suppressEvents, force);
21680
21681                                    if (time !== this._time || !this._ts && !prevPaused) {
21682                                        pauseTween = 0;
21683                                        next && (tTime += this._zTime = -_tinyNum);
21684                                        break;
21685                                    }
21686                                }
21687
21688                                child = next;
21689                            }
21690                        } else {
21691                            child = this._last;
21692                            var adjustedTime = totalTime < 0 ? totalTime : time;
21693
21694                            while (child) {
21695                                next = child._prev;
21696
21697                                if ((child._act || adjustedTime <= child._end) && child._ts && pauseTween !== child) {
21698                                    if (child.parent !== this) {
21699                                        return this.render(totalTime, suppressEvents, force);
21700                                    }
21701
21702                                    child.render(child._ts > 0 ? (adjustedTime - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (adjustedTime - child._start) * child._ts, suppressEvents, force);
21703
21704                                    if (time !== this._time || !this._ts && !prevPaused) {
21705                                        pauseTween = 0;
21706                                        next && (tTime += this._zTime = adjustedTime ? -_tinyNum : _tinyNum);
21707                                        break;
21708                                    }
21709                                }
21710
21711                                child = next;
21712                            }
21713                        }
21714
21715                        if (pauseTween && !suppressEvents) {
21716                            this.pause();
21717                            pauseTween.render(time >= prevTime ? 0 : -_tinyNum)._zTime = time >= prevTime ? 1 : -1;
21718
21719                            if (this._ts) {
21720                                this._start = prevStart;
21721
21722                                _setEnd(this);
21723
21724                                return this.render(totalTime, suppressEvents, force);
21725                            }
21726                        }
21727
21728                        this._onUpdate && !suppressEvents && _callback(this, "onUpdate", true);
21729                        if (tTime === tDur && tDur >= this.totalDuration() || !tTime && prevTime) if (prevStart === this._start || Math.abs(timeScale) !== Math.abs(this._ts)) if (!this._lock) {
21730                            (totalTime || !dur) && (tTime === tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1);
21731
21732                            if (!suppressEvents && !(totalTime < 0 && !prevTime) && (tTime || prevTime)) {
21733                                _callback(this, tTime === tDur ? "onComplete" : "onReverseComplete", true);
21734
21735                                this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom();
21736                            }
21737                        }
21738                    }
21739
21740                    return this;
21741                };
21742
21743                _proto2.add = function add(child, position) {
21744                    var _this2 = this;
21745
21746                    if (!_isNumber(position)) {
21747                        position = _parsePosition(this, position);
21748                    }
21749
21750                    if (!(child instanceof Animation)) {
21751                        if (_isArray(child)) {
21752                            child.forEach(function (obj) {
21753                                return _this2.add(obj, position);
21754                            });
21755                            return this;
21756                        }
21757
21758                        if (_isString(child)) {
21759                            return this.addLabel(child, position);
21760                        }
21761
21762                        if (_isFunction(child)) {
21763                            child = Tween.delayedCall(0, child);
21764                        } else {
21765                            return this;
21766                        }
21767                    }
21768
21769                    return this !== child ? _addToTimeline(this, child, position) : this;
21770                };
21771
21772                _proto2.getChildren = function getChildren(nested, tweens, timelines, ignoreBeforeTime) {
21773                    if (nested === void 0) {
21774                        nested = true;
21775                    }
21776
21777                    if (tweens === void 0) {
21778                        tweens = true;
21779                    }
21780
21781                    if (timelines === void 0) {
21782                        timelines = true;
21783                    }
21784
21785                    if (ignoreBeforeTime === void 0) {
21786                        ignoreBeforeTime = -_bigNum;
21787                    }
21788
21789                    var a = [],
21790                        child = this._first;
21791
21792                    while (child) {
21793                        if (child._start >= ignoreBeforeTime) {
21794                            if (child instanceof Tween) {
21795                                tweens && a.push(child);
21796                            } else {
21797                                timelines && a.push(child);
21798                                nested && a.push.apply(a, child.getChildren(true, tweens, timelines));
21799                            }
21800                        }
21801
21802                        child = child._next;
21803                    }
21804
21805                    return a;
21806                };
21807
21808                _proto2.getById = function getById(id) {
21809                    var animations = this.getChildren(1, 1, 1),
21810                        i = animations.length;
21811
21812                    while (i--) {
21813                        if (animations[i].vars.id === id) {
21814                            return animations[i];
21815                        }
21816                    }
21817                };
21818
21819                _proto2.remove = function remove(child) {
21820                    if (_isString(child)) {
21821                        return this.removeLabel(child);
21822                    }
21823
21824                    if (_isFunction(child)) {
21825                        return this.killTweensOf(child);
21826                    }
21827
21828                    _removeLinkedListItem(this, child);
21829
21830                    if (child === this._recent) {
21831                        this._recent = this._last;
21832                    }
21833
21834                    return _uncache(this);
21835                };
21836
21837                _proto2.totalTime = function totalTime(_totalTime2, suppressEvents) {
21838                    if (!arguments.length) {
21839                        return this._tTime;
21840                    }
21841
21842                    this._forcing = 1;
21843
21844                    if (!this._dp && this._ts) {
21845                        this._start = _round(_ticker.time - (this._ts > 0 ? _totalTime2 / this._ts : (this.totalDuration() - _totalTime2) / -this._ts));
21846                    }
21847
21848                    _Animation.prototype.totalTime.call(this, _totalTime2, suppressEvents);
21849
21850                    this._forcing = 0;
21851                    return this;
21852                };
21853
21854                _proto2.addLabel = function addLabel(label, position) {
21855                    this.labels[label] = _parsePosition(this, position);
21856                    return this;
21857                };
21858
21859                _proto2.removeLabel = function removeLabel(label) {
21860                    delete this.labels[label];
21861                    return this;
21862                };
21863
21864                _proto2.addPause = function addPause(position, callback, params) {
21865                    var t = Tween.delayedCall(0, callback || _emptyFunc, params);
21866                    t.data = "isPause";
21867                    this._hasPause = 1;
21868                    return _addToTimeline(this, t, _parsePosition(this, position));
21869                };
21870
21871                _proto2.removePause = function removePause(position) {
21872                    var child = this._first;
21873                    position = _parsePosition(this, position);
21874
21875                    while (child) {
21876                        if (child._start === position && child.data === "isPause") {
21877                            _removeFromParent(child);
21878                        }
21879
21880                        child = child._next;
21881                    }
21882                };
21883
21884                _proto2.killTweensOf = function killTweensOf(targets, props, onlyActive) {
21885                    var tweens = this.getTweensOf(targets, onlyActive),
21886                        i = tweens.length;
21887
21888                    while (i--) {
21889                        _overwritingTween !== tweens[i] && tweens[i].kill(targets, props);
21890                    }
21891
21892                    return this;
21893                };
21894
21895                _proto2.getTweensOf = function getTweensOf(targets, onlyActive) {
21896                    var a = [],
21897                        parsedTargets = toArray(targets),
21898                        child = this._first,
21899                        isGlobalTime = _isNumber(onlyActive),
21900                        children;
21901
21902                    while (child) {
21903                        if (child instanceof Tween) {
21904                            if (_arrayContainsAny(child._targets, parsedTargets) && (isGlobalTime ? (!_overwritingTween || child._initted && child._ts) && child.globalTime(0) <= onlyActive && child.globalTime(child.totalDuration()) > onlyActive : !onlyActive || child.isActive())) {
21905                                a.push(child);
21906                            }
21907                        } else if ((children = child.getTweensOf(parsedTargets, onlyActive)).length) {
21908                            a.push.apply(a, children);
21909                        }
21910
21911                        child = child._next;
21912                    }
21913
21914                    return a;
21915                };
21916
21917                _proto2.tweenTo = function tweenTo(position, vars) {
21918                    vars = vars || {};
21919
21920                    var tl = this,
21921                        endTime = _parsePosition(tl, position),
21922                        _vars = vars,
21923                        startAt = _vars.startAt,
21924                        _onStart = _vars.onStart,
21925                        onStartParams = _vars.onStartParams,
21926                        tween = Tween.to(tl, _setDefaults(vars, {
21927                            ease: "none",
21928                            lazy: false,
21929                            time: endTime,
21930                            overwrite: "auto",
21931                            duration: vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale()) || _tinyNum,
21932                            onStart: function onStart() {
21933                                tl.pause();
21934                                var duration = vars.duration || Math.abs((endTime - tl._time) / tl.timeScale());
21935                                tween._dur !== duration && _setDuration(tween, duration, 0, 1).render(tween._time, true, true);
21936                                _onStart && _onStart.apply(tween, onStartParams || []);
21937                            }
21938                        }));
21939
21940                    return tween;
21941                };
21942
21943                _proto2.tweenFromTo = function tweenFromTo(fromPosition, toPosition, vars) {
21944                    return this.tweenTo(toPosition, _setDefaults({
21945                        startAt: {
21946                            time: _parsePosition(this, fromPosition)
21947                        }
21948                    }, vars));
21949                };
21950
21951                _proto2.recent = function recent() {
21952                    return this._recent;
21953                };
21954
21955                _proto2.nextLabel = function nextLabel(afterTime) {
21956                    if (afterTime === void 0) {
21957                        afterTime = this._time;
21958                    }
21959
21960                    return _getLabelInDirection(this, _parsePosition(this, afterTime));
21961                };
21962
21963                _proto2.previousLabel = function previousLabel(beforeTime) {
21964                    if (beforeTime === void 0) {
21965                        beforeTime = this._time;
21966                    }
21967
21968                    return _getLabelInDirection(this, _parsePosition(this, beforeTime), 1);
21969                };
21970
21971                _proto2.currentLabel = function currentLabel(value) {
21972                    return arguments.length ? this.seek(value, true) : this.previousLabel(this._time + _tinyNum);
21973                };
21974
21975                _proto2.shiftChildren = function shiftChildren(amount, adjustLabels, ignoreBeforeTime) {
21976                    if (ignoreBeforeTime === void 0) {
21977                        ignoreBeforeTime = 0;
21978                    }
21979
21980                    var child = this._first,
21981                        labels = this.labels,
21982                        p;
21983
21984                    while (child) {
21985                        if (child._start >= ignoreBeforeTime) {
21986                            child._start += amount;
21987                            child._end += amount;
21988                        }
21989
21990                        child = child._next;
21991                    }
21992
21993                    if (adjustLabels) {
21994                        for (p in labels) {
21995                            if (labels[p] >= ignoreBeforeTime) {
21996                                labels[p] += amount;
21997                            }
21998                        }
21999                    }
22000
22001                    return _uncache(this);
22002                };
22003
22004                _proto2.invalidate = function invalidate() {
22005                    var child = this._first;
22006                    this._lock = 0;
22007
22008                    while (child) {
22009                        child.invalidate();
22010                        child = child._next;
22011                    }
22012
22013                    return _Animation.prototype.invalidate.call(this);
22014                };
22015
22016                _proto2.clear = function clear(includeLabels) {
22017                    if (includeLabels === void 0) {
22018                        includeLabels = true;
22019                    }
22020
22021                    var child = this._first,
22022                        next;
22023
22024                    while (child) {
22025                        next = child._next;
22026                        this.remove(child);
22027                        child = next;
22028                    }
22029
22030                    this._time = this._tTime = this._pTime = 0;
22031                    includeLabels && (this.labels = {});
22032                    return _uncache(this);
22033                };
22034
22035                _proto2.totalDuration = function totalDuration(value) {
22036                    var max = 0,
22037                        self = this,
22038                        child = self._last,
22039                        prevStart = _bigNum,
22040                        prev,
22041                        start,
22042                        parent;
22043
22044                    if (arguments.length) {
22045                        return self.timeScale((self._repeat < 0 ? self.duration() : self.totalDuration()) / (self.reversed() ? -value : value));
22046                    }
22047
22048                    if (self._dirty) {
22049                        parent = self.parent;
22050
22051                        while (child) {
22052                            prev = child._prev;
22053                            child._dirty && child.totalDuration();
22054                            start = child._start;
22055
22056                            if (start > prevStart && self._sort && child._ts && !self._lock) {
22057                                self._lock = 1;
22058                                _addToTimeline(self, child, start - child._delay, 1)._lock = 0;
22059                            } else {
22060                                prevStart = start;
22061                            }
22062
22063                            if (start < 0 && child._ts) {
22064                                max -= start;
22065
22066                                if (!parent && !self._dp || parent && parent.smoothChildTiming) {
22067                                    self._start += start / self._ts;
22068                                    self._time -= start;
22069                                    self._tTime -= start;
22070                                }
22071
22072                                self.shiftChildren(-start, false, -1e999);
22073                                prevStart = 0;
22074                            }
22075
22076                            child._end > max && child._ts && (max = child._end);
22077                            child = prev;
22078                        }
22079
22080                        _setDuration(self, self === _globalTimeline && self._time > max ? self._time : max, 1, 1);
22081
22082                        self._dirty = 0;
22083                    }
22084
22085                    return self._tDur;
22086                };
22087
22088                Timeline.updateRoot = function updateRoot(time) {
22089                    if (_globalTimeline._ts) {
22090                        _lazySafeRender(_globalTimeline, _parentToChildTotalTime(time, _globalTimeline));
22091
22092                        _lastRenderedFrame = _ticker.frame;
22093                    }
22094
22095                    if (_ticker.frame >= _nextGCFrame) {
22096                        _nextGCFrame += _config.autoSleep || 120;
22097                        var child = _globalTimeline._first;
22098                        if (!child || !child._ts) if (_config.autoSleep && _ticker._listeners.length < 2) {
22099                            while (child && !child._ts) {
22100                                child = child._next;
22101                            }
22102
22103                            child || _ticker.sleep();
22104                        }
22105                    }
22106                };
22107
22108                return Timeline;
22109            }(Animation);
22110
22111            _setDefaults(Timeline.prototype, {
22112                _lock: 0,
22113                _hasPause: 0,
22114                _forcing: 0
22115            });
22116
22117            var _addComplexStringPropTween = function _addComplexStringPropTween(target, prop, start, end, setter, stringFilter, funcParam) {
22118                    var pt = new PropTween(this._pt, target, prop, 0, 1, _renderComplexString, null, setter),
22119                        index = 0,
22120                        matchIndex = 0,
22121                        result,
22122                        startNums,
22123                        color,
22124                        endNum,
22125                        chunk,
22126                        startNum,
22127                        hasRandom,
22128                        a;
22129                    pt.b = start;
22130                    pt.e = end;
22131                    start += "";
22132                    end += "";
22133
22134                    if (hasRandom = ~end.indexOf("random(")) {
22135                        end = _replaceRandom(end);
22136                    }
22137
22138                    if (stringFilter) {
22139                        a = [start, end];
22140                        stringFilter(a, target, prop);
22141                        start = a[0];
22142                        end = a[1];
22143                    }
22144
22145                    startNums = start.match(_complexStringNumExp) || [];
22146
22147                    while (result = _complexStringNumExp.exec(end)) {
22148                        endNum = result[0];
22149                        chunk = end.substring(index, result.index);
22150
22151                        if (color) {
22152                            color = (color + 1) % 5;
22153                        } else if (chunk.substr(-5) === "rgba(") {
22154                            color = 1;
22155                        }
22156
22157                        if (endNum !== startNums[matchIndex++]) {
22158                            startNum = parseFloat(startNums[matchIndex - 1]) || 0;
22159                            pt._pt = {
22160                                _next: pt._pt,
22161                                p: chunk || matchIndex === 1 ? chunk : ",",
22162                                s: startNum,
22163                                c: endNum.charAt(1) === "=" ? parseFloat(endNum.substr(2)) * (endNum.charAt(0) === "-" ? -1 : 1) : parseFloat(endNum) - startNum,
22164                                m: color && color < 4 ? Math.round : 0
22165                            };
22166                            index = _complexStringNumExp.lastIndex;
22167                        }
22168                    }
22169
22170                    pt.c = index < end.length ? end.substring(index, end.length) : "";
22171                    pt.fp = funcParam;
22172
22173                    if (_relExp.test(end) || hasRandom) {
22174                        pt.e = 0;
22175                    }
22176
22177                    this._pt = pt;
22178                    return pt;
22179                },
22180                _addPropTween = function _addPropTween(target, prop, start, end, index, targets, modifier, stringFilter, funcParam) {
22181                    _isFunction(end) && (end = end(index || 0, target, targets));
22182                    var currentValue = target[prop],
22183                        parsedStart = start !== "get" ? start : !_isFunction(currentValue) ? currentValue : funcParam ? target[prop.indexOf("set") || !_isFunction(target["get" + prop.substr(3)]) ? prop : "get" + prop.substr(3)](funcParam) : target[prop](),
22184                        setter = !_isFunction(currentValue) ? _setterPlain : funcParam ? _setterFuncWithParam : _setterFunc,
22185                        pt;
22186
22187                    if (_isString(end)) {
22188                        if (~end.indexOf("random(")) {
22189                            end = _replaceRandom(end);
22190                        }
22191
22192                        if (end.charAt(1) === "=") {
22193                            end = parseFloat(parsedStart) + parseFloat(end.substr(2)) * (end.charAt(0) === "-" ? -1 : 1) + (getUnit(parsedStart) || 0);
22194                        }
22195                    }
22196
22197                    if (parsedStart !== end) {
22198                        if (!isNaN(parsedStart * end)) {
22199                            pt = new PropTween(this._pt, target, prop, +parsedStart || 0, end - (parsedStart || 0), typeof currentValue === "boolean" ? _renderBoolean : _renderPlain, 0, setter);
22200                            funcParam && (pt.fp = funcParam);
22201                            modifier && pt.modifier(modifier, this, target);
22202                            return this._pt = pt;
22203                        }
22204
22205                        !currentValue && !(prop in target) && _missingPlugin(prop, end);
22206                        return _addComplexStringPropTween.call(this, target, prop, parsedStart, end, setter, stringFilter || _config.stringFilter, funcParam);
22207                    }
22208                },
22209                _processVars = function _processVars(vars, index, target, targets, tween) {
22210                    _isFunction(vars) && (vars = _parseFuncOrString(vars, tween, index, target, targets));
22211
22212                    if (!_isObject(vars) || vars.style && vars.nodeType || _isArray(vars) || _isTypedArray(vars)) {
22213                        return _isString(vars) ? _parseFuncOrString(vars, tween, index, target, targets) : vars;
22214                    }
22215
22216                    var copy = {},
22217                        p;
22218
22219                    for (p in vars) {
22220                        copy[p] = _parseFuncOrString(vars[p], tween, index, target, targets);
22221                    }
22222
22223                    return copy;
22224                },
22225                _checkPlugin = function _checkPlugin(property, vars, tween, index, target, targets) {
22226                    var plugin, pt, ptLookup, i;
22227
22228                    if (_plugins[property] && (plugin = new _plugins[property]()).init(target, plugin.rawVars ? vars[property] : _processVars(vars[property], index, target, targets, tween), tween, index, targets) !== false) {
22229                        tween._pt = pt = new PropTween(tween._pt, target, property, 0, 1, plugin.render, plugin, 0, plugin.priority);
22230
22231                        if (tween !== _quickTween) {
22232                            ptLookup = tween._ptLookup[tween._targets.indexOf(target)];
22233                            i = plugin._props.length;
22234
22235                            while (i--) {
22236                                ptLookup[plugin._props[i]] = pt;
22237                            }
22238                        }
22239                    }
22240
22241                    return plugin;
22242                },
22243                _overwritingTween,
22244                _initTween = function _initTween(tween, time) {
22245                    var vars = tween.vars,
22246                        ease = vars.ease,
22247                        startAt = vars.startAt,
22248                        immediateRender = vars.immediateRender,
22249                        lazy = vars.lazy,
22250                        onUpdate = vars.onUpdate,
22251                        onUpdateParams = vars.onUpdateParams,
22252                        callbackScope = vars.callbackScope,
22253                        runBackwards = vars.runBackwards,
22254                        yoyoEase = vars.yoyoEase,
22255                        keyframes = vars.keyframes,
22256                        autoRevert = vars.autoRevert,
22257                        dur = tween._dur,
22258                        prevStartAt = tween._startAt,
22259                        targets = tween._targets,
22260                        parent = tween.parent,
22261                        fullTargets = parent && parent.data === "nested" ? parent.parent._targets : targets,
22262                        autoOverwrite = tween._overwrite === "auto",
22263                        tl = tween.timeline,
22264                        cleanVars,
22265                        i,
22266                        p,
22267                        pt,
22268                        target,
22269                        hasPriority,
22270                        gsData,
22271                        harness,
22272                        plugin,
22273                        ptLookup,
22274                        index,
22275                        harnessVars,
22276                        overwritten;
22277                    tl && (!keyframes || !ease) && (ease = "none");
22278                    tween._ease = _parseEase(ease, _defaults.ease);
22279                    tween._yEase = yoyoEase ? _invertEase(_parseEase(yoyoEase === true ? ease : yoyoEase, _defaults.ease)) : 0;
22280
22281                    if (yoyoEase && tween._yoyo && !tween._repeat) {
22282                        yoyoEase = tween._yEase;
22283                        tween._yEase = tween._ease;
22284                        tween._ease = yoyoEase;
22285                    }
22286
22287                    if (!tl) {
22288                        harness = targets[0] ? _getCache(targets[0]).harness : 0;
22289                        harnessVars = harness && vars[harness.prop];
22290                        cleanVars = _copyExcluding(vars, _reservedProps);
22291                        prevStartAt && prevStartAt.render(-1, true).kill();
22292
22293                        if (startAt) {
22294                            _removeFromParent(tween._startAt = Tween.set(targets, _setDefaults({
22295                                data: "isStart",
22296                                overwrite: false,
22297                                parent: parent,
22298                                immediateRender: true,
22299                                lazy: _isNotFalse(lazy),
22300                                startAt: null,
22301                                delay: 0,
22302                                onUpdate: onUpdate,
22303                                onUpdateParams: onUpdateParams,
22304                                callbackScope: callbackScope,
22305                                stagger: 0
22306                            }, startAt)));
22307
22308                            if (immediateRender) {
22309                                if (time > 0) {
22310                                    autoRevert || (tween._startAt = 0);
22311                                } else if (dur && !(time < 0 && prevStartAt)) {
22312                                    time && (tween._zTime = time);
22313                                    return;
22314                                }
22315                            }
22316                        } else if (runBackwards && dur) {
22317                            if (prevStartAt) {
22318                                !autoRevert && (tween._startAt = 0);
22319                            } else {
22320                                time && (immediateRender = false);
22321                                p = _setDefaults({
22322                                    overwrite: false,
22323                                    data: "isFromStart",
22324                                    lazy: immediateRender && _isNotFalse(lazy),
22325                                    immediateRender: immediateRender,
22326                                    stagger: 0,
22327                                    parent: parent
22328                                }, cleanVars);
22329                                harnessVars && (p[harness.prop] = harnessVars);
22330
22331                                _removeFromParent(tween._startAt = Tween.set(targets, p));
22332
22333                                if (!immediateRender) {
22334                                    _initTween(tween._startAt, _tinyNum);
22335                                } else if (!time) {
22336                                    return;
22337                                }
22338                            }
22339                        }
22340
22341                        tween._pt = 0;
22342                        lazy = dur && _isNotFalse(lazy) || lazy && !dur;
22343
22344                        for (i = 0; i < targets.length; i++) {
22345                            target = targets[i];
22346                            gsData = target._gsap || _harness(targets)[i]._gsap;
22347                            tween._ptLookup[i] = ptLookup = {};
22348                            _lazyLookup[gsData.id] && _lazyTweens.length && _lazyRender();
22349                            index = fullTargets === targets ? i : fullTargets.indexOf(target);
22350
22351                            if (harness && (plugin = new harness()).init(target, harnessVars || cleanVars, tween, index, fullTargets) !== false) {
22352                                tween._pt = pt = new PropTween(tween._pt, target, plugin.name, 0, 1, plugin.render, plugin, 0, plugin.priority);
22353
22354                                plugin._props.forEach(function (name) {
22355                                    ptLookup[name] = pt;
22356                                });
22357
22358                                plugin.priority && (hasPriority = 1);
22359                            }
22360
22361                            if (!harness || harnessVars) {
22362                                for (p in cleanVars) {
22363                                    if (_plugins[p] && (plugin = _checkPlugin(p, cleanVars, tween, index, target, fullTargets))) {
22364                                        plugin.priority && (hasPriority = 1);
22365                                    } else {
22366                                        ptLookup[p] = pt = _addPropTween.call(tween, target, p, "get", cleanVars[p], index, fullTargets, 0, vars.stringFilter);
22367                                    }
22368                                }
22369                            }
22370
22371                            tween._op && tween._op[i] && tween.kill(target, tween._op[i]);
22372
22373                            if (autoOverwrite && tween._pt) {
22374                                _overwritingTween = tween;
22375
22376                                _globalTimeline.killTweensOf(target, ptLookup, tween.globalTime(0));
22377
22378                                overwritten = !tween.parent;
22379                                _overwritingTween = 0;
22380                            }
22381
22382                            tween._pt && lazy && (_lazyLookup[gsData.id] = 1);
22383                        }
22384
22385                        hasPriority && _sortPropTweensByPriority(tween);
22386                        tween._onInit && tween._onInit(tween);
22387                    }
22388
22389                    tween._from = !tl && !!vars.runBackwards;
22390                    tween._onUpdate = onUpdate;
22391                    tween._initted = (!tween._op || tween._pt) && !overwritten;
22392                },
22393                _addAliasesToVars = function _addAliasesToVars(targets, vars) {
22394                    var harness = targets[0] ? _getCache(targets[0]).harness : 0,
22395                        propertyAliases = harness && harness.aliases,
22396                        copy,
22397                        p,
22398                        i,
22399                        aliases;
22400
22401                    if (!propertyAliases) {
22402                        return vars;
22403                    }
22404
22405                    copy = _merge({}, vars);
22406
22407                    for (p in propertyAliases) {
22408                        if (p in copy) {
22409                            aliases = propertyAliases[p].split(",");
22410                            i = aliases.length;
22411
22412                            while (i--) {
22413                                copy[aliases[i]] = copy[p];
22414                            }
22415                        }
22416                    }
22417
22418                    return copy;
22419                },
22420                _parseFuncOrString = function _parseFuncOrString(value, tween, i, target, targets) {
22421                    return _isFunction(value) ? value.call(tween, i, target, targets) : _isString(value) && ~value.indexOf("random(") ? _replaceRandom(value) : value;
22422                },
22423                _staggerTweenProps = _callbackNames + "repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase",
22424                _staggerPropsToSkip = (_staggerTweenProps + ",id,stagger,delay,duration,paused,scrollTrigger").split(",");
22425
22426            var Tween = function (_Animation2) {
22427                _inheritsLoose(Tween, _Animation2);
22428
22429                function Tween(targets, vars, time, skipInherit) {
22430                    var _this3;
22431
22432                    if (typeof vars === "number") {
22433                        time.duration = vars;
22434                        vars = time;
22435                        time = null;
22436                    }
22437
22438                    _this3 = _Animation2.call(this, skipInherit ? vars : _inheritDefaults(vars), time) || this;
22439                    var _this3$vars = _this3.vars,
22440                        duration = _this3$vars.duration,
22441                        delay = _this3$vars.delay,
22442                        immediateRender = _this3$vars.immediateRender,
22443                        stagger = _this3$vars.stagger,
22444                        overwrite = _this3$vars.overwrite,
22445                        keyframes = _this3$vars.keyframes,
22446                        defaults = _this3$vars.defaults,
22447                        scrollTrigger = _this3$vars.scrollTrigger,
22448                        yoyoEase = _this3$vars.yoyoEase,
22449                        parent = _this3.parent,
22450                        parsedTargets = (_isArray(targets) || _isTypedArray(targets) ? _isNumber(targets[0]) : "length" in vars) ? [targets] : toArray(targets),
22451                        tl,
22452                        i,
22453                        copy,
22454                        l,
22455                        p,
22456                        curTarget,
22457                        staggerFunc,
22458                        staggerVarsToMerge;
22459                    _this3._targets = parsedTargets.length ? _harness(parsedTargets) : _warn("GSAP target " + targets + " not found. https://greensock.com", !_config.nullTargetWarn) || [];
22460                    _this3._ptLookup = [];
22461                    _this3._overwrite = overwrite;
22462
22463                    if (keyframes || stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) {
22464                        vars = _this3.vars;
22465                        tl = _this3.timeline = new Timeline({
22466                            data: "nested",
22467                            defaults: defaults || {}
22468                        });
22469                        tl.kill();
22470                        tl.parent = _assertThisInitialized(_this3);
22471
22472                        if (keyframes) {
22473                            _setDefaults(tl.vars.defaults, {
22474                                ease: "none"
22475                            });
22476
22477                            keyframes.forEach(function (frame) {
22478                                return tl.to(parsedTargets, frame, ">");
22479                            });
22480                        } else {
22481                            l = parsedTargets.length;
22482                            staggerFunc = stagger ? distribute(stagger) : _emptyFunc;
22483
22484                            if (_isObject(stagger)) {
22485                                for (p in stagger) {
22486                                    if (~_staggerTweenProps.indexOf(p)) {
22487                                        staggerVarsToMerge || (staggerVarsToMerge = {});
22488                                        staggerVarsToMerge[p] = stagger[p];
22489                                    }
22490                                }
22491                            }
22492
22493                            for (i = 0; i < l; i++) {
22494                                copy = {};
22495
22496                                for (p in vars) {
22497                                    if (_staggerPropsToSkip.indexOf(p) < 0) {
22498                                        copy[p] = vars[p];
22499                                    }
22500                                }
22501
22502                                copy.stagger = 0;
22503                                yoyoEase && (copy.yoyoEase = yoyoEase);
22504                                staggerVarsToMerge && _merge(copy, staggerVarsToMerge);
22505                                curTarget = parsedTargets[i];
22506                                copy.duration = +_parseFuncOrString(duration, _assertThisInitialized(_this3), i, curTarget, parsedTargets);
22507                                copy.delay = (+_parseFuncOrString(delay, _assertThisInitialized(_this3), i, curTarget, parsedTargets) || 0) - _this3._delay;
22508
22509                                if (!stagger && l === 1 && copy.delay) {
22510                                    _this3._delay = delay = copy.delay;
22511                                    _this3._start += delay;
22512                                    copy.delay = 0;
22513                                }
22514
22515                                tl.to(curTarget, copy, staggerFunc(i, curTarget, parsedTargets));
22516                            }
22517
22518                            tl.duration() ? duration = delay = 0 : _this3.timeline = 0;
22519                        }
22520
22521                        duration || _this3.duration(duration = tl.duration());
22522                    } else {
22523                        _this3.timeline = 0;
22524                    }
22525
22526                    if (overwrite === true) {
22527                        _overwritingTween = _assertThisInitialized(_this3);
22528
22529                        _globalTimeline.killTweensOf(parsedTargets);
22530
22531                        _overwritingTween = 0;
22532                    }
22533
22534                    parent && _postAddChecks(parent, _assertThisInitialized(_this3));
22535
22536                    if (immediateRender || !duration && !keyframes && _this3._start === _round(parent._time) && _isNotFalse(immediateRender) && _hasNoPausedAncestors(_assertThisInitialized(_this3)) && parent.data !== "nested") {
22537                        _this3._tTime = -_tinyNum;
22538
22539                        _this3.render(Math.max(0, -delay));
22540                    }
22541
22542                    scrollTrigger && _scrollTrigger(_assertThisInitialized(_this3), scrollTrigger);
22543                    return _this3;
22544                }
22545
22546                var _proto3 = Tween.prototype;
22547
22548                _proto3.render = function render(totalTime, suppressEvents, force) {
22549                    var prevTime = this._time,
22550                        tDur = this._tDur,
22551                        dur = this._dur,
22552                        tTime = totalTime > tDur - _tinyNum && totalTime >= 0 ? tDur : totalTime < _tinyNum ? 0 : totalTime,
22553                        time,
22554                        pt,
22555                        iteration,
22556                        cycleDuration,
22557                        prevIteration,
22558                        isYoyo,
22559                        ratio,
22560                        timeline,
22561                        yoyoEase;
22562
22563                    if (!dur) {
22564                        _renderZeroDurationTween(this, totalTime, suppressEvents, force);
22565                    } else if (tTime !== this._tTime || !totalTime || force || this._startAt && this._zTime < 0 !== totalTime < 0) {
22566                        time = tTime;
22567                        timeline = this.timeline;
22568
22569                        if (this._repeat) {
22570                            cycleDuration = dur + this._rDelay;
22571                            time = _round(tTime % cycleDuration);
22572
22573                            if (tTime === tDur) {
22574                                iteration = this._repeat;
22575                                time = dur;
22576                            } else {
22577                                iteration = ~~(tTime / cycleDuration);
22578
22579                                if (iteration && iteration === tTime / cycleDuration) {
22580                                    time = dur;
22581                                    iteration--;
22582                                }
22583
22584                                time > dur && (time = dur);
22585                            }
22586
22587                            isYoyo = this._yoyo && iteration & 1;
22588
22589                            if (isYoyo) {
22590                                yoyoEase = this._yEase;
22591                                time = dur - time;
22592                            }
22593
22594                            prevIteration = _animationCycle(this._tTime, cycleDuration);
22595
22596                            if (time === prevTime && !force && this._initted) {
22597                                return this;
22598                            }
22599
22600                            if (iteration !== prevIteration) {
22601                                timeline && this._yEase && _propagateYoyoEase(timeline, isYoyo);
22602
22603                                if (this.vars.repeatRefresh && !isYoyo && !this._lock) {
22604                                    this._lock = force = 1;
22605                                    this.render(_round(cycleDuration * iteration), true).invalidate()._lock = 0;
22606                                }
22607                            }
22608                        }
22609
22610                        if (!this._initted) {
22611                            if (_attemptInitTween(this, totalTime < 0 ? totalTime : time, force, suppressEvents)) {
22612                                this._tTime = 0;
22613                                return this;
22614                            }
22615
22616                            if (dur !== this._dur) {
22617                                return this.render(totalTime, suppressEvents, force);
22618                            }
22619                        }
22620
22621                        this._tTime = tTime;
22622                        this._time = time;
22623
22624                        if (!this._act && this._ts) {
22625                            this._act = 1;
22626                            this._lazy = 0;
22627                        }
22628
22629                        this.ratio = ratio = (yoyoEase || this._ease)(time / dur);
22630
22631                        if (this._from) {
22632                            this.ratio = ratio = 1 - ratio;
22633                        }
22634
22635                        time && !prevTime && !suppressEvents && _c
22635allback(this, "onStart");
22636                        pt = this._pt;
22637
22638                        while (pt) {
22639                            pt.r(ratio, pt.d);
22640                            pt = pt._next;
22641                        }
22642
22643                        timeline && timeline.render(totalTime < 0 ? totalTime : !time && isYoyo ? -_tinyNum : timeline._dur * ratio, suppressEvents, force) || this._startAt && (this._zTime = totalTime);
22644
22645                        if (this._onUpdate && !suppressEvents) {
22646                            totalTime < 0 && this._startAt && this._startAt.render(totalTime, true, force);
22647
22648                            _callback(this, "onUpdate");
22649                        }
22650
22651                        this._repeat && iteration !== prevIteration && this.vars.onRepeat && !suppressEvents && this.parent && _callback(this, "onRepeat");
22652
22653                        if ((tTime === this._tDur || !tTime) && this._tTime === tTime) {
22654                            totalTime < 0 && this._startAt && !this._onUpdate && this._startAt.render(totalTime, true, true);
22655                            (totalTime || !dur) && (tTime === this._tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1);
22656
22657                            if (!suppressEvents && !(totalTime < 0 && !prevTime) && (tTime || prevTime)) {
22658                                _callback(this, tTime === tDur ? "onComplete" : "onReverseComplete", true);
22659
22660                                this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom();
22661                            }
22662                        }
22663                    }
22664
22665                    return this;
22666                };
22667
22668                _proto3.targets = function targets() {
22669                    return this._targets;
22670                };
22671
vendor: 18,341 bytes, lines 22672-23102
22672                _proto3.invalidate = function invalidate() {
22673                    this._pt = this._op = this._startAt = this._onUpdate = this._act = this._lazy = 0;
22674                    this._ptLookup = [];
22675                    this.timeline && this.timeline.invalidate();
22676                    return _Animation2.prototype.invalidate.call(this);
22677                };
22678
22679                _proto3.kill = function kill(targets, vars) {
22680                    if (vars === void 0) {
22681                        vars = "all";
22682                    }
22683
22684                    if (!targets && (!vars || vars === "all")) {
22685                        this._lazy = 0;
22686
22687                        if (this.parent) {
22688                            return _interrupt(this);
22689                        }
22690                    }
22691
22692                    if (this.timeline) {
22693                        var tDur = this.timeline.totalDuration();
22694                        this.timeline.killTweensOf(targets, vars, _overwritingTween && _overwritingTween.vars.overwrite !== true)._first || _interrupt(this);
22695                        this.parent && tDur !== this.timeline.totalDuration() && _setDuration(this, this._dur * this.timeline._tDur / tDur, 0, 1);
22696                        return this;
22697                    }
22698
22699                    var parsedTargets = this._targets,
22700                        killingTargets = targets ? toArray(targets) : parsedTargets,
22701                        propTweenLookup = this._ptLookup,
22702                        firstPT = this._pt,
22703                        overwrittenProps,
22704                        curLookup,
22705                        curOverwriteProps,
22706                        props,
22707                        p,
22708                        pt,
22709                        i;
22710
22711                    if ((!vars || vars === "all") && _arraysMatch(parsedTargets, killingTargets)) {
22712                        vars === "all" && (this._pt = 0);
22713                        return _interrupt(this);
22714                    }
22715
22716                    overwrittenProps = this._op = this._op || [];
22717
22718                    if (vars !== "all") {
22719                        if (_isString(vars)) {
22720                            p = {};
22721
22722                            _forEachName(vars, function (name) {
22723                                return p[name] = 1;
22724                            });
22725
22726                            vars = p;
22727                        }
22728
22729                        vars = _addAliasesToVars(parsedTargets, vars);
22730                    }
22731
22732                    i = parsedTargets.length;
22733
22734                    while (i--) {
22735                        if (~killingTargets.indexOf(parsedTargets[i])) {
22736                            curLookup = propTweenLookup[i];
22737
22738                            if (vars === "all") {
22739                                overwrittenProps[i] = vars;
22740                                props = curLookup;
22741                                curOverwriteProps = {};
22742                            } else {
22743                                curOverwriteProps = overwrittenProps[i] = overwrittenProps[i] || {};
22744                                props = vars;
22745                            }
22746
22747                            for (p in props) {
22748                                pt = curLookup && curLookup[p];
22749
22750                                if (pt) {
22751                                    if (!("kill" in pt.d) || pt.d.kill(p) === true) {
22752                                        _removeLinkedListItem(this, pt, "_pt");
22753                                    }
22754
22755                                    delete curLookup[p];
22756                                }
22757
22758                                if (curOverwriteProps !== "all") {
22759                                    curOverwriteProps[p] = 1;
22760                                }
22761                            }
22762                        }
22763                    }
22764
22765                    this._initted && !this._pt && firstPT && _interrupt(this);
22766                    return this;
22767                };
22768
22769                Tween.to = function to(targets, vars) {
22770                    return new Tween(targets, vars, arguments[2]);
22771                };
22772
22773                Tween.from = function from(targets, vars) {
22774                    return new Tween(targets, _parseVars(arguments, 1));
22775                };
22776
22777                Tween.delayedCall = function delayedCall(delay, callback, params, scope) {
22778                    return new Tween(callback, 0, {
22779                        immediateRender: false,
22780                        lazy: false,
22781                        overwrite: false,
22782                        delay: delay,
22783                        onComplete: callback,
22784                        onReverseComplete: callback,
22785                        onCompleteParams: params,
22786                        onReverseCompleteParams: params,
22787                        callbackScope: scope
22788                    });
22789                };
22790
22791                Tween.fromTo = function fromTo(targets, fromVars, toVars) {
22792                    return new Tween(targets, _parseVars(arguments, 2));
22793                };
22794
22795                Tween.set = function set(targets, vars) {
22796                    vars.duration = 0;
22797                    vars.repeatDelay || (vars.repeat = 0);
22798                    return new Tween(targets, vars);
22799                };
22800
22801                Tween.killTweensOf = function killTweensOf(targets, props, onlyActive) {
22802                    return _globalTimeline.killTweensOf(targets, props, onlyActive);
22803                };
22804
22805                return Tween;
22806            }(Animation);
22807
22808            _setDefaults(Tween.prototype, {
22809                _targets: [],
22810                _lazy: 0,
22811                _startAt: 0,
22812                _op: 0,
22813                _onInit: 0
22814            });
22815
22816            _forEachName("staggerTo,staggerFrom,staggerFromTo", function (name) {
22817                Tween[name] = function () {
22818                    var tl = new Timeline(),
22819                        params = _slice.call(arguments, 0);
22820
22821                    params.splice(name === "staggerFromTo" ? 5 : 4, 0, 0);
22822                    return tl[name].apply(tl, params);
22823                };
22824            });
22825
22826            var _setterPlain = function _setterPlain(target, property, value) {
22827                    return target[property] = value;
22828                },
22829                _setterFunc = function _setterFunc(target, property, value) {
22830                    return target[property](value);
22831                },
22832                _setterFuncWithParam = function _setterFuncWithParam(target, property, value, data) {
22833                    return target[property](data.fp, value);
22834                },
22835                _setterAttribute = function _setterAttribute(target, property, value) {
22836                    return target.setAttribute(property, value);
22837                },
22838                _getSetter = function _getSetter(target, property) {
22839                    return _isFunction(target[property]) ? _setterFunc : _isUndefined(target[property]) && target.setAttribute ? _setterAttribute : _setterPlain;
22840                },
22841                _renderPlain = function _renderPlain(ratio, data) {
22842                    return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 10000) / 10000, data);
22843                },
22844                _renderBoolean = function _renderBoolean(ratio, data) {
22845                    return data.set(data.t, data.p, !!(data.s + data.c * ratio), data);
22846                },
22847                _renderComplexString = function _renderComplexString(ratio, data) {
22848                    var pt = data._pt,
22849                        s = "";
22850
22851                    if (!ratio && data.b) {
22852                        s = data.b;
22853                    } else if (ratio === 1 && data.e) {
22854                        s = data.e;
22855                    } else {
22856                        while (pt) {
22857                            s = pt.p + (pt.m ? pt.m(pt.s + pt.c * ratio) : Math.round((pt.s + pt.c * ratio) * 10000) / 10000) + s;
22858                            pt = pt._next;
22859                        }
22860
22861                        s += data.c;
22862                    }
22863
22864                    data.set(data.t, data.p, s, data);
22865                },
22866                _renderPropTweens = function _renderPropTweens(ratio, data) {
22867                    var pt = data._pt;
22868
22869                    while (pt) {
22870                        pt.r(ratio, pt.d);
22871                        pt = pt._next;
22872                    }
22873                },
22874                _addPluginModifier = function _addPluginModifier(modifier, tween, target, property) {
22875                    var pt = this._pt,
22876                        next;
22877
22878                    while (pt) {
22879                        next = pt._next;
22880                        pt.p === property && pt.modifier(modifier, tween, target);
22881                        pt = next;
22882                    }
22883                },
22884                _killPropTweensOf = function _killPropTweensOf(property) {
22885                    var pt = this._pt,
22886                        hasNonDependentRemaining,
22887                        next;
22888
22889                    while (pt) {
22890                        next = pt._next;
22891
22892                        if (pt.p === property && !pt.op || pt.op === property) {
22893                            _removeLinkedListItem(this, pt, "_pt");
22894                        } else if (!pt.dep) {
22895                            hasNonDependentRemaining = 1;
22896                        }
22897
22898                        pt = next;
22899                    }
22900
22901                    return !hasNonDependentRemaining;
22902                },
22903                _setterWithModifier = function _setterWithModifier(target, property, value, data) {
22904                    data.mSet(target, property, data.m.call(data.tween, value, data.mt), data);
22905                },
22906                _sortPropTweensByPriority = function _sortPropTweensByPriority(parent) {
22907                    var pt = parent._pt,
22908                        next,
22909                        pt2,
22910                        first,
22911                        last;
22912
22913                    while (pt) {
22914                        next = pt._next;
22915                        pt2 = first;
22916
22917                        while (pt2 && pt2.pr > pt.pr) {
22918                            pt2 = pt2._next;
22919                        }
22920
22921                        if (pt._prev = pt2 ? pt2._prev : last) {
22922                            pt._prev._next = pt;
22923                        } else {
22924                            first = pt;
22925                        }
22926
22927                        if (pt._next = pt2) {
22928                            pt2._prev = pt;
22929                        } else {
22930                            last = pt;
22931                        }
22932
22933                        pt = next;
22934                    }
22935
22936                    parent._pt = first;
22937                };
22938
22939            var PropTween = function () {
22940                function PropTween(next, target, prop, start, change, renderer, data, setter, priority) {
22941                    this.t = target;
22942                    this.s = start;
22943                    this.c = change;
22944                    this.p = prop;
22945                    this.r = renderer || _renderPlain;
22946                    this.d = data || this;
22947                    this.set = setter || _setterPlain;
22948                    this.pr = priority || 0;
22949                    this._next = next;
22950
22951                    if (next) {
22952                        next._prev = this;
22953                    }
22954                }
22955
22956                var _proto4 = PropTween.prototype;
22957
22958                _proto4.modifier = function modifier(func, tween, target) {
22959                    this.mSet = this.mSet || this.set;
22960                    this.set = _setterWithModifier;
22961                    this.m = func;
22962                    this.mt = target;
22963                    this.tween = tween;
22964                };
22965
22966                return PropTween;
22967            }();
22968
22969            _forEachName(_callbackNames + "parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger", function (name) {
22970                return _reservedProps[name] = 1;
22971            });
22972
22973            _globals.TweenMax = _globals.TweenLite = Tween;
22974            _globals.TimelineLite = _globals.TimelineMax = Timeline;
22975            _globalTimeline = new Timeline({
22976                sortChildren: false,
22977                defaults: _defaults,
22978                autoRemoveChildren: true,
22979                id: "root",
22980                smoothChildTiming: true
22981            });
22982            _config.stringFilter = _colorStringFilter;
22983            var _gsap = {
22984                registerPlugin: function registerPlugin() {
22985                    for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
22986                        args[_key2] = arguments[_key2];
22987                    }
22988
22989                    args.forEach(function (config) {
22990                        return _createPlugin(config);
22991                    });
22992                },
22993                timeline: function timeline(vars) {
22994                    return new Timeline(vars);
22995                },
22996                getTweensOf: function getTweensOf(targets, onlyActive) {
22997                    return _globalTimeline.getTweensOf(targets, onlyActive);
22998                },
22999                getProperty: function getProperty(target, property, unit, uncache) {
23000                    _isString(target) && (target = toArray(target)[0]);
23001
23002                    var getter = _getCache(target || {}).get,
23003                        format = unit ? _passThrough : _numericIfPossible;
23004
23005                    unit === "native" && (unit = "");
23006                    return !target ? target : !property ? function (property, unit, uncache) {
23007                        return format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache));
23008                    } : format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache));
23009                },
23010                quickSetter: function quickSetter(target, property, unit) {
23011                    target = toArray(target);
23012
23013                    if (target.length > 1) {
23014                        var setters = target.map(function (t) {
23015                                return gsap.quickSetter(t, property, unit);
23016                            }),
23017                            l = setters.length;
23018                        return function (value) {
23019                            var i = l;
23020
23021                            while (i--) {
23022                                setters[i](value);
23023                            }
23024                        };
23025                    }
23026
23027                    target = target[0] || {};
23028
23029                    var Plugin = _plugins[property],
23030                        cache = _getCache(target),
23031                        p = cache.harness && (cache.harness.aliases || {})[property] || property,
23032                        setter = Plugin ? function (value) {
23033                            var p = new Plugin();
23034                            _quickTween._pt = 0;
23035                            p.init(target, unit ? value + unit : value, _quickTween, 0, [target]);
23036                            p.render(1, p);
23037                            _quickTween._pt && _renderPropTweens(1, _quickTween);
23038                        } : cache.set(target, p);
23039
23040                    return Plugin ? setter : function (value) {
23041                        return setter(target, p, unit ? value + unit : value, cache, 1);
23042                    };
23043                },
23044                isTweening: function isTweening(targets) {
23045                    return _globalTimeline.getTweensOf(targets, true).length > 0;
23046                },
23047                defaults: function defaults(value) {
23048                    value && value.ease && (value.ease = _parseEase(value.ease, _defaults.ease));
23049                    return _mergeDeep(_defaults, value || {});
23050                },
23051                config: function config(value) {
23052                    return _mergeDeep(_config, value || {});
23053                },
23054                registerEffect: function registerEffect(_ref) {
23055                    var name = _ref.name,
23056                        effect = _ref.effect,
23057                        plugins = _ref.plugins,
23058                        defaults = _ref.defaults,
23059                        extendTimeline = _ref.extendTimeline;
23060                    (plugins || "").split(",").forEach(function (pluginName) {
23061                        return pluginName && !_plugins[pluginName] && !_globals[pluginName] && _warn(name + " effect requires " + pluginName + " plugin.");
23062                    });
23063
23064                    _effects[name] = function (targets, vars, tl) {
23065                        return effect(toArray(targets), _setDefaults(vars || {}, defaults), tl);
23066                    };
23067
23068                    if (extendTimeline) {
23069                        Timeline.prototype[name] = function (targets, vars, position) {
23070                            return this.add(_effects[name](targets, _isObject(vars) ? vars : (position = vars) && {}, this), position);
23071                        };
23072                    }
23073                },
23074                registerEase: function registerEase(name, ease) {
23075                    _easeMap[name] = _parseEase(ease);
23076                },
23077                parseEase: function parseEase(ease, defaultEase) {
23078                    return arguments.length ? _parseEase(ease, defaultEase) : _easeMap;
23079                },
23080                getById: function getById(id) {
23081                    return _globalTimeline.getById(id);
23082                },
23083                exportRoot: function exportRoot(vars, includeDelayedCalls) {
23084                    if (vars === void 0) {
23085                        vars = {};
23086                    }
23087
23088                    var tl = new Timeline(vars),
23089                        child,
23090                        next;
23091                    tl.smoothChildTiming = _isNotFalse(vars.smoothChildTiming);
23092
23093                    _globalTimeline.remove(tl);
23094
23095                    tl._dp = 0;
23096                    tl._time = tl._tTime = _globalTimeline._time;
23097                    child = _globalTimeline._first;
23098
23099                    while (child) {
23100                        next = child._next;
23101
23102                        if (includeDelayedCalls || !(!child._dur && child instanceof Tween && child.vars.onComplete === child._targets[0])) {
23103                            _addToTimeline(tl, child, child._start - child._delay);
23104                        }
23105
23106                        child = next;
23107                    }
23108
23109                    _addToTimeline(_globalTimeline, tl, 0);
23110
23111                    return tl;
23112                },
23113                utils: {
23114                    wrap: wrap,
23115                    wrapYoyo: wrapYoyo,
23116                    distribute: distribute,
23117                    random: random,
23118                    snap: snap,
23119                    normalize: normalize,
23120                    getUnit: getUnit,
23121                    clamp: clamp,
23122                    splitColor: splitColor,
23123                    toArray: toArray,
23124                    mapRange: mapRange,
23125                    pipe: pipe,
23126                    unitize: unitize,
23127                    interpolate: interpolate,
23128                    shuffle: shuffle
23129                },
23130                install: _install,
23131                effects: _effects,
23132                ticker: _ticker,
23133                updateRoot: Timeline.updateRoot,
23134                plugins: _plugins,
23135                globalTimeline: _globalTimeline,
23136                core: {
23137                    PropTween: PropTween,
23138                    globals: _addGlobal,
23139                    Tween: Tween,
23140                    Timeline: Timeline,
23141                    Animation: Animation,
23142                    getCache: _getCache,
23143                    _removeLinkedListItem: _removeLinkedListItem
23144                }
23145            };
23146
23147            _forEachName("to,from,fromTo,delayedCall,set,killTweensOf", function (name) {
23148                return _gsap[name] = Tween[name];
23149            });
23150
23151            _ticker.add(Timeline.updateRoot);
23152
23153            _quickTween = _gsap.to({}, {
23154                duration: 0
23155            });
23156
23157            var _getPluginPropTween = function _getPluginPropTween(plugin, prop
vendor: 26,139 bytes, lines 23157-23733
23157) {
23158                    var pt = plugin._pt;
23159
23160                    while (pt && pt.p !== prop && pt.op !== prop && pt.fp !== prop) {
23161                        pt = pt._next;
23162                    }
23163
23164                    return pt;
23165                },
23166                _addModifiers = function _addModifiers(tween, modifiers) {
23167                    var targets = tween._targets,
23168                        p,
23169                        i,
23170                        pt;
23171
23172                    for (p in modifiers) {
23173                        i = targets.length;
23174
23175                        while (i--) {
23176                            pt = tween._ptLookup[i][p];
23177
23178                            if (pt && (pt = pt.d)) {
23179                                if (pt._pt) {
23180                                    pt = _getPluginPropTween(pt, p);
23181                                }
23182
23183                                pt && pt.modifier && pt.modifier(modifiers[p], tween, targets[i], p);
23184                            }
23185                        }
23186                    }
23187                },
23188                _buildModifierPlugin = function _buildModifierPlugin(name, modifier) {
23189                    return {
23190                        name: name,
23191                        rawVars: 1,
23192                        init: function init(target, vars, tween) {
23193                            tween._onInit = function (tween) {
23194                                var temp, p;
23195
23196                                if (_isString(vars)) {
23197                                    temp = {};
23198
23199                                    _forEachName(vars, function (name) {
23200                                        return temp[name] = 1;
23201                                    });
23202
23203                                    vars = temp;
23204                                }
23205
23206                                if (modifier) {
23207                                    temp = {};
23208
23209                                    for (p in vars) {
23210                                        temp[p] = modifier(vars[p]);
23211                                    }
23212
23213                                    vars = temp;
23214                                }
23215
23216                                _addModifiers(tween, vars);
23217                            };
23218                        }
23219                    };
23220                };
23221
23222            var gsap = _gsap.registerPlugin({
23223                name: "attr",
23224                init: function init(target, vars, tween, index, targets) {
23225                    var p, pt;
23226
23227                    for (p in vars) {
23228                        pt = this.add(target, "setAttribute", (target.getAttribute(p) || 0) + "", vars[p], index, targets, 0, 0, p);
23229                        pt && (pt.op = p);
23230
23231                        this._props.push(p);
23232                    }
23233                }
23234            }, {
23235                name: "endArray",
23236                init: function init(target, value) {
23237                    var i = value.length;
23238
23239                    while (i--) {
23240                        this.add(target, i, target[i] || 0, value[i]);
23241                    }
23242                }
23243            }, _buildModifierPlugin("roundProps", _roundModifier), _buildModifierPlugin("modifiers"), _buildModifierPlugin("snap", snap)) || _gsap;
23244            Tween.version = Timeline.version = gsap.version = "3.5.1";
23245            _coreReady = 1;
23246
23247            if (_windowExists()) {
23248                _wake();
23249            }
23250
23251            var Power0 = _easeMap.Power0,
23252                Power1 = _easeMap.Power1,
23253                Power2 = _easeMap.Power2,
23254                Power3 = _easeMap.Power3,
23255                Power4 = _easeMap.Power4,
23256                Linear = _easeMap.Linear,
23257                Quad = _easeMap.Quad,
23258                Cubic = _easeMap.Cubic,
23259                Quart = _easeMap.Quart,
23260                Quint = _easeMap.Quint,
23261                Strong = _easeMap.Strong,
23262                Elastic = _easeMap.Elastic,
23263                Back = _easeMap.Back,
23264                SteppedEase = _easeMap.SteppedEase,
23265                Bounce = _easeMap.Bounce,
23266                Sine = _easeMap.Sine,
23267                Expo = _easeMap.Expo,
23268                Circ = _easeMap.Circ;
23269
23270            var _win$1,
23271                _doc$1,
23272                _docElement,
23273                _pluginInitted,
23274                _tempDiv,
23275                _tempDivStyler,
23276                _recentSetterPlugin,
23277                _windowExists$1 = function _windowExists() {
23278                    return typeof window !== "undefined";
23279                },
23280                _transformProps = {},
23281                _RAD2DEG = 180 / Math.PI,
23282                _DEG2RAD = Math.PI / 180,
23283                _atan2 = Math.atan2,
23284                _bigNum$1 = 1e8,
23285                _capsExp = /([A-Z])/g,
23286                _horizontalExp = /(?:left|right|width|margin|padding|x)/i,
23287                _complexExp = /[\s,\(]\S/,
23288                _propertyAliases = {
23289                    autoAlpha: "opacity,visibility",
23290                    scale: "scaleX,scaleY",
23291                    alpha: "opacity"
23292                },
23293                _renderCSSProp = function _renderCSSProp(ratio, data) {
23294                    return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u, data);
23295                },
23296                _renderPropWithEnd = function _renderPropWithEnd(ratio, data) {
23297                    return data.set(data.t, data.p, ratio === 1 ? data.e : Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u, data);
23298                },
23299                _renderCSSPropWithBeginning = function _renderCSSPropWithBeginning(ratio, data) {
23300                    return data.set(data.t, data.p, ratio ? Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u : data.b, data);
23301                },
23302                _renderRoundedCSSProp = function _renderRoundedCSSProp(ratio, data) {
23303                    var value = data.s + data.c * ratio;
23304                    data.set(data.t, data.p, ~~(value + (value < 0 ? -.5 : .5)) + data.u, data);
23305                },
23306                _renderNonTweeningValue = function _renderNonTweeningValue(ratio, data) {
23307                    return data.set(data.t, data.p, ratio ? data.e : data.b, data);
23308                },
23309                _renderNonTweeningValueOnlyAtEnd = function _renderNonTweeningValueOnlyAtEnd(ratio, data) {
23310                    return data.set(data.t, data.p, ratio !== 1 ? data.b : data.e, data);
23311                },
23312                _setterCSSStyle = function _setterCSSStyle(target, property, value) {
23313                    return target.style[property] = value;
23314                },
23315                _setterCSSProp = function _setterCSSProp(target, property, value) {
23316                    return target.style.setProperty(property, value);
23317                },
23318                _setterTransform = function _setterTransform(target, property, value) {
23319                    return target._gsap[property] = value;
23320                },
23321                _setterScale = function _setterScale(target, property, value) {
23322                    return target._gsap.scaleX = target._gsap.scaleY = value;
23323                },
23324                _setterScaleWithRender = function _setterScaleWithRender(target, property, value, data, ratio) {
23325                    var cache = target._gsap;
23326                    cache.scaleX = cache.scaleY = value;
23327                    cache.renderTransform(ratio, cache);
23328                },
23329                _setterTransformWithRender = function _setterTransformWithRender(target, property, value, data, ratio) {
23330                    var cache = target._gsap;
23331                    cache[property] = value;
23332                    cache.renderTransform(ratio, cache);
23333                },
23334                _transformProp = "transform",
23335                _transformOriginProp = _transformProp + "Origin",
23336                _supports3D,
23337                _createElement = function _createElement(type, ns) {
23338                    var e = _doc$1.createElementNS ? _doc$1.createElementNS((ns || "http://www.w3.org/1999/xhtml").replace(/^https/, "http"), type) : _doc$1.createElement(type);
23339                    return e.style ? e : _doc$1.createElement(type);
23340                },
23341                _getComputedProperty = function _getComputedProperty(target, property, skipPrefixFallback) {
23342                    var cs = getComputedStyle(target);
23343                    return cs[property] || cs.getPropertyValue(property.replace(_capsExp, "-$1").toLowerCase()) || cs.getPropertyValue(property) || !skipPrefixFallback && _getComputedProperty(target, _checkPropPrefix(property) || property, 1) || "";
23344                },
23345                _prefixes = "O,Moz,ms,Ms,Webkit".split(","),
23346                _checkPropPrefix = function _checkPropPrefix(property, element, preferPrefix) {
23347                    var e = element || _tempDiv,
23348                        s = e.style,
23349                        i = 5;
23350
23351                    if (property in s && !preferPrefix) {
23352                        return property;
23353                    }
23354
23355                    property = property.charAt(0).toUpperCase() + property.substr(1);
23356
23357                    while (i-- && !(_prefixes[i] + property in s)) {
23358                    }
23359
23360                    return i < 0 ? null : (i === 3 ? "ms" : i >= 0 ? _prefixes[i] : "") + property;
23361                },
23362                _initCore = function _initCore() {
23363                    if (_windowExists$1() && window.document) {
23364                        _win$1 = window;
23365                        _doc$1 = _win$1.document;
23366                        _docElement = _doc$1.documentElement;
23367                        _tempDiv = _createElement("div") || {
23368                            style: {}
23369                        };
23370                        _tempDivStyler = _createElement("div");
23371                        _transformProp = _checkPropPrefix(_transformProp);
23372                        _transformOriginProp = _transformProp + "Origin";
23373                        _tempDiv.style.cssText = "border-width:0;line-height:0;position:absolute;padding:0";
23374                        _supports3D = !!_checkPropPrefix("perspective");
23375                        _pluginInitted = 1;
23376                    }
23377                },
23378                _getBBoxHack = function _getBBoxHack(swapIfPossible) {
23379                    var svg = _createElement("svg", this.ownerSVGElement && this.ownerSVGElement.getAttribute("xmlns") || "http://www.w3.org/2000/svg"),
23380                        oldParent = this.parentNode,
23381                        oldSibling = this.nextSibling,
23382                        oldCSS = this.style.cssText,
23383                        bbox;
23384
23385                    _docElement.appendChild(svg);
23386
23387                    svg.appendChild(this);
23388                    this.style.display = "block";
23389
23390                    if (swapIfPossible) {
23391                        try {
23392                            bbox = this.getBBox();
23393                            this._gsapBBox = this.getBBox;
23394                            this.getBBox = _getBBoxHack;
23395                        } catch (e) {
23396                        }
23397                    } else if (this._gsapBBox) {
23398                        bbox = this._gsapBBox();
23399                    }
23400
23401                    if (oldParent) {
23402                        if (oldSibling) {
23403                            oldParent.insertBefore(this, oldSibling);
23404                        } else {
23405                            oldParent.appendChild(this);
23406                        }
23407                    }
23408
23409                    _docElement.removeChild(svg);
23410
23411                    this.style.cssText = oldCSS;
23412                    return bbox;
23413                },
23414                _getAttributeFallbacks = function _getAttributeFallbacks(target, attributesArray) {
23415                    var i = attributesArray.length;
23416
23417                    while (i--) {
23418                        if (target.hasAttribute(attributesArray[i])) {
23419                            return target.getAttribute(attributesArray[i]);
23420                        }
23421                    }
23422                },
23423                _getBBox = function _getBBox(target) {
23424                    var bounds;
23425
23426                    try {
23427                        bounds = target.getBBox();
23428                    } catch (error) {
23429                        bounds = _getBBoxHack.call(target, true);
23430                    }
23431
23432                    bounds && (bounds.width || bounds.height) || target.getBBox === _getBBoxHack || (bounds = _getBBoxHack.call(target, true));
23433                    return bounds && !bounds.width && !bounds.x && !bounds.y ? {
23434                        x: +_getAttributeFallbacks(target, ["x", "cx", "x1"]) || 0,
23435                        y: +_getAttributeFallbacks(target, ["y", "cy", "y1"]) || 0,
23436                        width: 0,
23437                        height: 0
23438                    } : bounds;
23439                },
23440                _isSVG = function _isSVG(e) {
23441                    return !!(e.getCTM && (!e.parentNode || e.ownerSVGElement) && _getBBox(e));
23442                },
23443                _removeProperty = function _removeProperty(target, property) {
23444                    if (property) {
23445                        var style = target.style;
23446
23447                        if (property in _transformProps && property !== _transformOriginProp) {
23448                            property = _transformProp;
23449                        }
23450
23451                        if (style.removeProperty) {
23452                            if (property.substr(0, 2) === "ms" || property.substr(0, 6) === "webkit") {
23453                                property = "-" + property;
23454                            }
23455
23456                            style.removeProperty(property.replace(_capsExp, "-$1").toLowerCase());
23457                        } else {
23458                            style.removeAttribute(property);
23459                        }
23460                    }
23461                },
23462                _addNonTweeningPT = function _addNonTweeningPT(plugin, target, property, beginning, end, onlySetAtEnd) {
23463                    var pt = new PropTween(plugin._pt, target, property, 0, 1, onlySetAtEnd ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue);
23464                    plugin._pt = pt;
23465                    pt.b = beginning;
23466                    pt.e = end;
23467
23468                    plugin._props.push(property);
23469
23470                    return pt;
23471                },
23472                _nonConvertibleUnits = {
23473                    deg: 1,
23474                    rad: 1,
23475                    turn: 1
23476                },
23477                _convertToUnit = function _convertToUnit(target, property, value, unit) {
23478                    var curValue = parseFloat(value) || 0,
23479                        curUnit = (value + "").trim().substr((curValue + "").length) || "px",
23480                        style = _tempDiv.style,
23481                        horizontal = _horizontalExp.test(property),
23482                        isRootSVG = target.tagName.toLowerCase() === "svg",
23483                        measureProperty = (isRootSVG ? "client" : "offset") + (horizontal ? "Width" : "Height"),
23484                        amount = 100,
23485                        toPixels = unit === "px",
23486                        toPercent = unit === "%",
23487                        px,
23488                        parent,
23489                        cache,
23490                        isSVG;
23491
23492                    if (unit === curUnit || !curValue || _nonConvertibleUnits[unit] || _nonConvertibleUnits[curUnit]) {
23493                        return curValue;
23494                    }
23495
23496                    curUnit !== "px" && !toPixels && (curValue = _convertToUnit(target, property, value, "px"));
23497                    isSVG = target.getCTM && _isSVG(target);
23498
23499                    if (toPercent && (_transformProps[property] || ~property.indexOf("adius"))) {
23500                        return _round(curValue / (isSVG ? target.getBBox()[horizontal ? "width" : "height"] : target[measureProperty]) * amount);
23501                    }
23502
23503                    style[horizontal ? "width" : "height"] = amount + (toPixels ? curUnit : unit);
23504                    parent = ~property.indexOf("adius") || unit === "em" && target.appendChild && !isRootSVG ? target : target.parentNode;
23505
23506                    if (isSVG) {
23507                        parent = (target.ownerSVGElement || {}).parentNode;
23508                    }
23509
23510                    if (!parent || parent === _doc$1 || !parent.appendChild) {
23511                        parent = _doc$1.body;
23512                    }
23513
23514                    cache = parent._gsap;
23515
23516                    if (cache && toPercent && cache.width && horizontal && cache.time === _ticker.time) {
23517                        return _round(curValue / cache.width * amount);
23518                    } else {
23519                        (toPercent || curUnit === "%") && (style.position = _getComputedProperty(target, "position"));
23520                        parent === target && (style.position = "static");
23521                        parent.appendChild(_tempDiv);
23522                        px = _tempDiv[measureProperty];
23523                        parent.removeChild(_tempDiv);
23524                        style.position = "absolute";
23525
23526                        if (horizontal && toPercent) {
23527                            cache = _getCache(parent);
23528                            cache.time = _ticker.time;
23529                            cache.width = parent[measureProperty];
23530                        }
23531                    }
23532
23533                    return _round(toPixels ? px * curValue / amount : px && curValue ? amount / px * curValue : 0);
23534                },
23535                _get = function _get(target, property, unit, uncache) {
23536                    var value;
23537                    _pluginInitted || _initCore();
23538
23539                    if (property in _propertyAliases && property !== "transform") {
23540                        property = _propertyAliases[property];
23541
23542                        if (~property.indexOf(",")) {
23543                            property = property.split(",")[0];
23544                        }
23545                    }
23546
23547                    if (_transformProps[property] && property !== "transform") {
23548                        value = _parseTransform(target, uncache);
23549                        value = property !== "transformOrigin" ? value[property] : _firstTwoOnly(_getComputedProperty(target, _transformOriginProp)) + " " + value.zOrigin + "px";
23550                    } else {
23551                        value = target.style[property];
23552
23553                        if (!value || value === "auto" || uncache || ~(value + "").indexOf("calc(")) {
23554                            value = _specialProps[property] && _specialProps[property](target, property, unit) || _getComputedProperty(target, property) || _getProperty(target, property) || (property === "opacity" ? 1 : 0);
23555                        }
23556                    }
23557
23558                    return unit && !~(value + "").indexOf(" ") ? _convertToUnit(target, property, value, unit) + unit : value;
23559                },
23560                _tweenComplexCSSString = function _tweenComplexCSSString(target, prop, start, end) {
23561                    if (!start || start === "none") {
23562                        var p = _checkPropPrefix(prop, target, 1),
23563                            s = p && _getComputedProperty(target, p, 1);
23564
23565                        if (s && s !== start) {
23566                            prop = p;
23567                            start = s;
23568                        } else if (prop === "borderColor") {
23569                            start = _getComputedProperty(target, "borderTopColor");
23570                        }
23571                    }
23572
23573                    var pt = new PropTween(this._pt, target.style, prop, 0, 1, _renderComplexString),
23574                        index = 0,
23575                        matchIndex = 0,
23576                        a,
23577                        result,
23578                        startValues,
23579                        startNum,
23580                        color,
23581                        startValue,
23582                        endValue,
23583                        endNum,
23584                        chunk,
23585                        endUnit,
23586                        startUnit,
23587                        relative,
23588                        endValues;
23589                    pt.b = start;
23590                    pt.e = end;
23591                    start += "";
23592                    end += "";
23593
23594                    if (end === "auto") {
23595                        target.style[prop] = end;
23596                        end = _getComputedProperty(target, prop) || end;
23597                        target.style[prop] = start;
23598                    }
23599
23600                    a = [start, end];
23601
23602                    _colorStringFilter(a);
23603
23604                    start = a[0];
23605                    end = a[1];
23606                    startValues = start.match(_numWithUnitExp) || [];
23607                    endValues = end.match(_numWithUnitExp) || [];
23608
23609                    if (endValues.length) {
23610                        while (result = _numWithUnitExp.exec(end)) {
23611                            endValue = result[0];
23612                            chunk = end.substring(index, result.index);
23613
23614                            if (color) {
23615                                color = (color + 1) % 5;
23616                            } else if (chunk.substr(-5) === "rgba(" || chunk.substr(-5) === "hsla(") {
23617                                color = 1;
23618                            }
23619
23620                            if (endValue !== (startValue = startValues[matchIndex++] || "")) {
23621                                startNum = parseFloat(startValue) || 0;
23622                                startUnit = startValue.substr((startNum + "").length);
23623                                relative = endValue.charAt(1) === "=" ? +(endValue.charAt(0) + "1") : 0;
23624
23625                                if (relative) {
23626                                    endValue = endValue.substr(2);
23627                                }
23628
23629                                endNum = parseFloat(endValue);
23630                                endUnit = endValue.substr((endNum + "").length);
23631                                index = _numWithUnitExp.lastIndex - endUnit.length;
23632
23633                                if (!endUnit) {
23634                                    endUnit = endUnit || _config.units[prop] || startUnit;
23635
23636                                    if (index === end.length) {
23637                                        end += endUnit;
23638                                        pt.e += endUnit;
23639                                    }
23640                                }
23641
23642                                if (startUnit !== endUnit) {
23643                                    startNum = _convertToUnit(target, prop, startValue, endUnit) || 0;
23644                                }
23645
23646                                pt._pt = {
23647                                    _next: pt._pt,
23648                                    p: chunk || matchIndex === 1 ? chunk : ",",
23649                                    s: startNum,
23650                                    c: relative ? relative * endNum : endNum - startNum,
23651                                    m: color && color < 4 ? Math.round : 0
23652                                };
23653                            }
23654                        }
23655
23656                        pt.c = index < end.length ? end.substring(index, end.length) : "";
23657                    } else {
23658                        pt.r = prop === "display" && end === "none" ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue;
23659                    }
23660
23661                    if (_relExp.test(end)) {
23662                        pt.e = 0;
23663                    }
23664
23665                    this._pt = pt;
23666                    return pt;
23667                },
23668                _keywordToPercent = {
23669                    top: "0%",
23670                    bottom: "100%",
23671                    left: "0%",
23672                    right: "100%",
23673                    center: "50%"
23674                },
23675                _convertKeywordsToPercentages = function _convertKeywordsToPercentages(value) {
23676                    var split = value.split(" "),
23677                        x = split[0],
23678                        y = split[1] || "50%";
23679
23680                    if (x === "top" || x === "bottom" || y === "left" || y === "right") {
23681                        value = x;
23682                        x = y;
23683                        y = value;
23684                    }
23685
23686                    split[0] = _keywordToPercent[x] || x;
23687                    split[1] = _keywordToPercent[y] || y;
23688                    return split.join(" ");
23689                },
23690                _renderClearProps = function _renderClearProps(ratio, data) {
23691                    if (data.tween && data.tween._time === data.tween._dur) {
23692                        var target = data.t,
23693                            style = target.style,
23694                            props = data.u,
23695                            cache = target._gsap,
23696                            prop,
23697                            clearTransforms,
23698                            i;
23699
23700                        if (props === "all" || props === true) {
23701                            style.cssText = "";
23702                            clearTransforms = 1;
23703                        } else {
23704                            props = props.split(",");
23705                            i = props.length;
23706
23707                            while (--i > -1) {
23708                                prop = props[i];
23709
23710                                if (_transformProps[prop]) {
23711                                    clearTransforms = 1;
23712                                    prop = prop === "transformOrigin" ? _transformOriginProp : _transformProp;
23713                                }
23714
23715                                _removeProperty(target, prop);
23716                            }
23717                        }
23718
23719                        if (clearTransforms) {
23720                            _removeProperty(target, _transformProp);
23721
23722                            if (cache) {
23723                                cache.svg && target.removeAttribute("transform");
23724
23725                                _parseTransform(target, 1);
23726
23727                                cache.uncache = 1;
23728                            }
23729                        }
23730                    }
23731                },
23732                _specialProps = {
23733                    clearProps: function clearProps(plugin, target, property, endValue, tween) {
vendor: 4,165 bytes, lines 23734-23814
23734                        if (tween.data !== "isFromStart") {
23735                            var pt = plugin._pt = new PropTween(plugin._pt, target, property, 0, 0, _renderClearProps);
23736                            pt.u = endValue;
23737                            pt.pr = -10;
23738                            pt.tween = tween;
23739
23740                            plugin._props.push(property);
23741
23742                            return 1;
23743                        }
23744                    }
23745                },
23746                _identity2DMatrix = [1, 0, 0, 1, 0, 0],
23747                _rotationalProperties = {},
23748                _isNullTransform = function _isNullTransform(value) {
23749                    return value === "matrix(1, 0, 0, 1, 0, 0)" || value === "none" || !value;
23750                },
23751                _getComputedTransformMatrixAsArray = function _getComputedTransformMatrixAsArray(target) {
23752                    var matrixString = _getComputedProperty(target, _transformProp);
23753
23754                    return _isNullTransform(matrixString) ? _identity2DMatrix : matrixString.substr(7).match(_numExp).map(_round);
23755                },
23756                _getMatrix = function _getMatrix(target, force2D) {
23757                    var cache = target._gsap || _getCache(target),
23758                        style = target.style,
23759                        matrix = _getComputedTransformMatrixAsArray(target),
23760                        parent,
23761                        nextSibling,
23762                        temp,
23763                        addedToDOM;
23764
23765                    if (cache.svg && target.getAttribute("transform")) {
23766                        temp = target.transform.baseVal.consolidate().matrix;
23767                        matrix = [temp.a, temp.b, temp.c, temp.d, temp.e, temp.f];
23768                        return matrix.join(",") === "1,0,0,1,0,0" ? _identity2DMatrix : matrix;
23769                    } else if (matrix === _identity2DMatrix && !target.offsetParent && target !== _docElement && !cache.svg) {
23770                        temp = style.display;
23771                        style.display = "block";
23772                        parent = target.parentNode;
23773
23774                        if (!parent || !target.offsetParent) {
23775                            addedToDOM = 1;
23776                            nextSibling = target.nextSibling;
23777
23778                            _docElement.appendChild(target);
23779                        }
23780
23781                        matrix = _getComputedTransformMatrixAsArray(target);
23782                        temp ? style.display = temp : _removeProperty(target, "display");
23783
23784                        if (addedToDOM) {
23785                            nextSibling ? parent.insertBefore(target, nextSibling) : parent ? parent.appendChild(target) : _docElement.removeChild(target);
23786                        }
23787                    }
23788
23789                    return force2D && matrix.length > 6 ? [matrix[0], matrix[1], matrix[4], matrix[5], matrix[12], matrix[13]] : matrix;
23790                },
23791                _applySVGOrigin = function _applySVGOrigin(target, origin, originIsAbsolute, smooth, matrixArray, pluginToAddPropTweensTo) {
23792                    var cache = target._gsap,
23793                        matrix = matrixArray || _getMatrix(target, true),
23794                        xOriginOld = cache.xOrigin || 0,
23795                        yOriginOld = cache.yOrigin || 0,
23796                        xOffsetOld = cache.xOffset || 0,
23797                        yOffsetOld = cache.yOffset || 0,
23798                        a = matrix[0],
23799                        b = matrix[1],
23800                        c = matrix[2],
23801                        d = matrix[3],
23802                        tx = matrix[4],
23803                        ty = matrix[5],
23804                        originSplit = origin.split(" "),
23805                        xOrigin = parseFloat(originSplit[0]) || 0,
23806                        yOrigin = parseFloat(originSplit[1]) || 0,
23807                        bounds,
23808                        determinant,
23809                        x,
23810                        y;
23811
23812                    if (!originIsAbsolute) {
23813                        bounds = _getBBox(target);
23814                        xOrigin = bounds.x + (~originSplit[0].indexOf("%") ? xOrigin / 100 * boun
vendor: 9,715 bytes, lines 23814-24022
23814ds.width : xOrigin);
23815                        yOrigin = bounds.y + (~(originSplit[1] || originSplit[0]).indexOf("%") ? yOrigin / 100 * bounds.height : yOrigin);
23816                    } else if (matrix !== _identity2DMatrix && (determinant = a * d - b * c)) {
23817                        x = xOrigin * (d / determinant) + yOrigin * (-c / determinant) + (c * ty - d * tx) / determinant;
23818                        y = xOrigin * (-b / determinant) + yOrigin * (a / determinant) - (a * ty - b * tx) / determinant;
23819                        xOrigin = x;
23820                        yOrigin = y;
23821                    }
23822
23823                    if (smooth || smooth !== false && cache.smooth) {
23824                        tx = xOrigin - xOriginOld;
23825                        ty = yOrigin - yOriginOld;
23826                        cache.xOffset = xOffsetOld + (tx * a + ty * c) - tx;
23827                        cache.yOffset = yOffsetOld + (tx * b + ty * d) - ty;
23828                    } else {
23829                        cache.xOffset = cache.yOffset = 0;
23830                    }
23831
23832                    cache.xOrigin = xOrigin;
23833                    cache.yOrigin = yOrigin;
23834                    cache.smooth = !!smooth;
23835                    cache.origin = origin;
23836                    cache.originIsAbsolute = !!originIsAbsolute;
23837                    target.style[_transformOriginProp] = "0px 0px";
23838
23839                    if (pluginToAddPropTweensTo) {
23840                        _addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOrigin", xOriginOld, xOrigin);
23841
23842                        _addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOrigin", yOriginOld, yOrigin);
23843
23844                        _addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOffset", xOffsetOld, cache.xOffset);
23845
23846                        _addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOffset", yOffsetOld, cache.yOffset);
23847                    }
23848
23849                    target.setAttribute("data-svg-origin", xOrigin + " " + yOrigin);
23850                },
23851                _parseTransform = function _parseTransform(target, uncache) {
23852                    var cache = target._gsap || new GSCache(target);
23853
23854                    if ("x" in cache && !uncache && !cache.uncache) {
23855                        return cache;
23856                    }
23857
23858                    var style = target.style,
23859                        invertedScaleX = cache.scaleX < 0,
23860                        px = "px",
23861                        deg = "deg",
23862                        origin = _getComputedProperty(target, _transformOriginProp) || "0",
23863                        x,
23864                        y,
23865                        z,
23866                        scaleX,
23867                        scaleY,
23868                        rotation,
23869                        rotationX,
23870                        rotationY,
23871                        skewX,
23872                        skewY,
23873                        perspective,
23874                        xOrigin,
23875                        yOrigin,
23876                        matrix,
23877                        angle,
23878                        cos,
23879                        sin,
23880                        a,
23881                        b,
23882                        c,
23883                        d,
23884                        a12,
23885                        a22,
23886                        t1,
23887                        t2,
23888                        t3,
23889                        a13,
23890                        a23,
23891                        a33,
23892                        a42,
23893                        a43,
23894                        a32;
23895                    x = y = z = rotation = rotationX = rotationY = skewX = skewY = perspective = 0;
23896                    scaleX = scaleY = 1;
23897                    cache.svg = !!(target.getCTM && _isSVG(target));
23898                    matrix = _getMatrix(target, cache.svg);
23899
23900                    if (cache.svg) {
23901                        t1 = !cache.uncache && target.getAttribute("data-svg-origin");
23902
23903                        _applySVGOrigin(target, t1 || origin, !!t1 || cache.originIsAbsolute, cache.smooth !== false, matrix);
23904                    }
23905
23906                    xOrigin = cache.xOrigin || 0;
23907                    yOrigin = cache.yOrigin || 0;
23908
23909                    if (matrix !== _identity2DMatrix) {
23910                        a = matrix[0];
23911                        b = matrix[1];
23912                        c = matrix[2];
23913                        d = matrix[3];
23914                        x = a12 = matrix[4];
23915                        y = a22 = matrix[5];
23916
23917                        if (matrix.length === 6) {
23918                            scaleX = Math.sqrt(a * a + b * b);
23919                            scaleY = Math.sqrt(d * d + c * c);
23920                            rotation = a || b ? _atan2(b, a) * _RAD2DEG : 0;
23921                            skewX = c || d ? _atan2(c, d) * _RAD2DEG + rotation : 0;
23922                            skewX && (scaleY *= Math.cos(skewX * _DEG2RAD));
23923
23924                            if (cache.svg) {
23925                                x -= xOrigin - (xOrigin * a + yOrigin * c);
23926                                y -= yOrigin - (xOrigin * b + yOrigin * d);
23927                            }
23928                        } else {
23929                            a32 = matrix[6];
23930                            a42 = matrix[7];
23931                            a13 = matrix[8];
23932                            a23 = matrix[9];
23933                            a33 = matrix[10];
23934                            a43 = matrix[11];
23935                            x = matrix[12];
23936                            y = matrix[13];
23937                            z = matrix[14];
23938                            angle = _atan2(a32, a33);
23939                            rotationX = angle * _RAD2DEG;
23940
23941                            if (angle) {
23942                                cos = Math.cos(-angle);
23943                                sin = Math.sin(-angle);
23944                                t1 = a12 * cos + a13 * sin;
23945                                t2 = a22 * cos + a23 * sin;
23946                                t3 = a32 * cos + a33 * sin;
23947                                a13 = a12 * -sin + a13 * cos;
23948                                a23 = a22 * -sin + a23 * cos;
23949                                a33 = a32 * -sin + a33 * cos;
23950                                a43 = a42 * -sin + a43 * cos;
23951                                a12 = t1;
23952                                a22 = t2;
23953                                a32 = t3;
23954                            }
23955
23956                            angle = _atan2(-c, a33);
23957                            rotationY = angle * _RAD2DEG;
23958
23959                            if (angle) {
23960                                cos = Math.cos(-angle);
23961                                sin = Math.sin(-angle);
23962                                t1 = a * cos - a13 * sin;
23963                                t2 = b * cos - a23 * sin;
23964                                t3 = c * cos - a33 * sin;
23965                                a43 = d * sin + a43 * cos;
23966                                a = t1;
23967                                b = t2;
23968                                c = t3;
23969                            }
23970
23971                            angle = _atan2(b, a);
23972                            rotation = angle * _RAD2DEG;
23973
23974                            if (angle) {
23975                                cos = Math.cos(angle);
23976                                sin = Math.sin(angle);
23977                                t1 = a * cos + b * sin;
23978                                t2 = a12 * cos + a22 * sin;
23979                                b = b * cos - a * sin;
23980                                a22 = a22 * cos - a12 * sin;
23981                                a = t1;
23982                                a12 = t2;
23983                            }
23984
23985                            if (rotationX && Math.abs(rotationX) + Math.abs(rotation) > 359.9) {
23986                                rotationX = rotation = 0;
23987                                rotationY = 180 - rotationY;
23988                            }
23989
23990                            scaleX = _round(Math.sqrt(a * a + b * b + c * c));
23991                            scaleY = _round(Math.sqrt(a22 * a22 + a32 * a32));
23992                            angle = _atan2(a12, a22);
23993                            skewX = Math.abs(angle) > 0.0002 ? angle * _RAD2DEG : 0;
23994                            perspective = a43 ? 1 / (a43 < 0 ? -a43 : a43) : 0;
23995                        }
23996
23997                        if (cache.svg) {
23998                            t1 = target.getAttribute("transform");
23999                            cache.forceCSS = target.setAttribute("transform", "") || !_isNullTransform(_getComputedProperty(target, _transformProp));
24000                            t1 && target.setAttribute("transform", t1);
24001                        }
24002                    }
24003
24004                    if (Math.abs(skewX) > 90 && Math.abs(skewX) < 270) {
24005                        if (invertedScaleX) {
24006                            scaleX *= -1;
24007                            skewX += rotation <= 0 ? 180 : -180;
24008                            rotation += rotation <= 0 ? 180 : -180;
24009                        } else {
24010                            scaleY *= -1;
24011                            skewX += skewX <= 0 ? 180 : -180;
24012                        }
24013                    }
24014
24015                    cache.x = ((cache.xPercent = x && Math.round(target.offsetWidth / 2) === Math.round(-x) ? -50 : 0) ? 0 : x) + px;
24016                    cache.y = ((cache.yPercent = y && Math.round(target.offsetHeight / 2) === Math.round(-y) ? -50 : 0) ? 0 : y) + px;
24017                    cache.z = z + px;
24018                    cache.scaleX = _round(scaleX);
24019                    cache.scaleY = _round(scaleY);
24020                    cache.rotation = _round(rotation) + deg;
24021                    cache.rotationX = _round(rotationX) + deg;
24022                    cache.rotationY = _round(rotationY) + deg;
vendor: 4,297 bytes, lines 24023-24111
24023                    cache.skewX = skewX + deg;
24024                    cache.skewY = skewY + deg;
24025                    cache.transformPerspective = perspective + px;
24026
24027                    if (cache.zOrigin = parseFloat(origin.split(" ")[2]) || 0) {
24028                        style[_transformOriginProp] = _firstTwoOnly(origin);
24029                    }
24030
24031                    cache.xOffset = cache.yOffset = 0;
24032                    cache.force3D = _config.force3D;
24033                    cache.renderTransform = cache.svg ? _renderSVGTransforms : _supports3D ? _renderCSSTransforms : _renderNon3DTransforms;
24034                    cache.uncache = 0;
24035                    return cache;
24036                },
24037                _firstTwoOnly = function _firstTwoOnly(value) {
24038                    return (value = value.split(" "))[0] + " " + value[1];
24039                },
24040                _addPxTranslate = function _addPxTranslate(target, start, value) {
24041                    var unit = getUnit(start);
24042                    return _round(parseFloat(start) + parseFloat(_convertToUnit(target, "x", value + "px", unit))) + unit;
24043                },
24044                _renderNon3DTransforms = function _renderNon3DTransforms(ratio, cache) {
24045                    cache.z = "0px";
24046                    cache.rotationY = cache.rotationX = "0deg";
24047                    cache.force3D = 0;
24048
24049                    _renderCSSTransforms(ratio, cache);
24050                },
24051                _zeroDeg = "0deg",
24052                _zeroPx = "0px",
24053                _endParenthesis = ") ",
24054                _renderCSSTransforms = function _renderCSSTransforms(ratio, cache) {
24055                    var _ref = cache || this,
24056                        xPercent = _ref.xPercent,
24057                        yPercent = _ref.yPercent,
24058                        x = _ref.x,
24059                        y = _ref.y,
24060                        z = _ref.z,
24061                        rotation = _ref.rotation,
24062                        rotationY = _ref.rotationY,
24063                        rotationX = _ref.rotationX,
24064                        skewX = _ref.skewX,
24065                        skewY = _ref.skewY,
24066                        scaleX = _ref.scaleX,
24067                        scaleY = _ref.scaleY,
24068                        transformPerspective = _ref.transformPerspective,
24069                        force3D = _ref.force3D,
24070                        target = _ref.target,
24071                        zOrigin = _ref.zOrigin,
24072                        transforms = "",
24073                        use3D = force3D === "auto" && ratio && ratio !== 1 || force3D === true;
24074
24075                    if (zOrigin && (rotationX !== _zeroDeg || rotationY !== _zeroDeg)) {
24076                        var angle = parseFloat(rotationY) * _DEG2RAD,
24077                            a13 = Math.sin(angle),
24078                            a33 = Math.cos(angle),
24079                            cos;
24080
24081                        angle = parseFloat(rotationX) * _DEG2RAD;
24082                        cos = Math.cos(angle);
24083                        x = _addPxTranslate(target, x, a13 * cos * -zOrigin);
24084                        y = _addPxTranslate(target, y, -Math.sin(angle) * -zOrigin);
24085                        z = _addPxTranslate(target, z, a33 * cos * -zOrigin + zOrigin);
24086                    }
24087
24088                    if (transformPerspective !== _zeroPx) {
24089                        transforms += "perspective(" + transformPerspective + _endParenthesis;
24090                    }
24091
24092                    if (xPercent || yPercent) {
24093                        transforms += "translate(" + xPercent + "%, " + yPercent + "%) ";
24094                    }
24095
24096                    if (use3D || x !== _zeroPx || y !== _zeroPx || z !== _zeroPx) {
24097                        transforms += z !== _zeroPx || use3D ? "translate3d(" + x + ", " + y + ", " + z + ") " : "translate(" + x + ", " + y + _endParenthesis;
24098                    }
24099
24100                    if (rotation !== _zeroDeg) {
24101                        transforms += "rotate(" + rotation + _endParenthesis;
24102                    }
24103
24104                    if (rotationY !== _zeroDeg) {
24105                        transforms += "rotateY(" + rotationY + _endParenthesis;
24106                    }
24107
24108                    if (rotationX !== _zeroDeg) {
24109                        transforms += "rotateX(" + rotationX + _endParenthesis;
24110                    }
24111
vendor: 7,648 bytes, lines 24112-24285
24112                    if (skewX !== _zeroDeg || skewY !== _zeroDeg) {
24113                        transforms += "skew(" + skewX + ", " + skewY + _endParenthesis;
24114                    }
24115
24116                    if (scaleX !== 1 || scaleY !== 1) {
24117                        transforms += "scale(" + scaleX + ", " + scaleY + _endParenthesis;
24118                    }
24119
24120                    target.style[_transformProp] = transforms || "translate(0, 0)";
24121                },
24122                _renderSVGTransforms = function _renderSVGTransforms(ratio, cache) {
24123                    var _ref2 = cache || this,
24124                        xPercent = _ref2.xPercent,
24125                        yPercent = _ref2.yPercent,
24126                        x = _ref2.x,
24127                        y = _ref2.y,
24128                        rotation = _ref2.rotation,
24129                        skewX = _ref2.skewX,
24130                        skewY = _ref2.skewY,
24131                        scaleX = _ref2.scaleX,
24132                        scaleY = _ref2.scaleY,
24133                        target = _ref2.target,
24134                        xOrigin = _ref2.xOrigin,
24135                        yOrigin = _ref2.yOrigin,
24136                        xOffset = _ref2.xOffset,
24137                        yOffset = _ref2.yOffset,
24138                        forceCSS = _ref2.forceCSS,
24139                        tx = parseFloat(x),
24140                        ty = parseFloat(y),
24141                        a11,
24142                        a21,
24143                        a12,
24144                        a22,
24145                        temp;
24146
24147                    rotation = parseFloat(rotation);
24148                    skewX = parseFloat(skewX);
24149                    skewY = parseFloat(skewY);
24150
24151                    if (skewY) {
24152                        skewY = parseFloat(skewY);
24153                        skewX += skewY;
24154                        rotation += skewY;
24155                    }
24156
24157                    if (rotation || skewX) {
24158                        rotation *= _DEG2RAD;
24159                        skewX *= _DEG2RAD;
24160                        a11 = Math.cos(rotation) * scaleX;
24161                        a21 = Math.sin(rotation) * scaleX;
24162                        a12 = Math.sin(rotation - skewX) * -scaleY;
24163                        a22 = Math.cos(rotation - skewX) * scaleY;
24164
24165                        if (skewX) {
24166                            skewY *= _DEG2RAD;
24167                            temp = Math.tan(skewX - skewY);
24168                            temp = Math.sqrt(1 + temp * temp);
24169                            a12 *= temp;
24170                            a22 *= temp;
24171
24172                            if (skewY) {
24173                                temp = Math.tan(skewY);
24174                                temp = Math.sqrt(1 + temp * temp);
24175                                a11 *= temp;
24176                                a21 *= temp;
24177                            }
24178                        }
24179
24180                        a11 = _round(a11);
24181                        a21 = _round(a21);
24182                        a12 = _round(a12);
24183                        a22 = _round(a22);
24184                    } else {
24185                        a11 = scaleX;
24186                        a22 = scaleY;
24187                        a21 = a12 = 0;
24188                    }
24189
24190                    if (tx && !~(x + "").indexOf("px") || ty && !~(y + "").indexOf("px")) {
24191                        tx = _convertToUnit(target, "x", x, "px");
24192                        ty = _convertToUnit(target, "y", y, "px");
24193                    }
24194
24195                    if (xOrigin || yOrigin || xOffset || yOffset) {
24196                        tx = _round(tx + xOrigin - (xOrigin * a11 + yOrigin * a12) + xOffset);
24197                        ty = _round(ty + yOrigin - (xOrigin * a21 + yOrigin * a22) + yOffset);
24198                    }
24199
24200                    if (xPercent || yPercent) {
24201                        temp = target.getBBox();
24202                        tx = _round(tx + xPercent / 100 * temp.width);
24203                        ty = _round(ty + yPercent / 100 * temp.height);
24204                    }
24205
24206                    temp = "matrix(" + a11 + "," + a21 + "," + a12 + "," + a22 + "," + tx + "," + ty + ")";
24207                    target.setAttribute("transform", temp);
24208
24209                    if (forceCSS) {
24210                        target.style[_transformProp] = temp;
24211                    }
24212                },
24213                _addRotationalPropTween = function _addRotationalPropTween(plugin, target, property, startNum, endValue, relative) {
24214                    var cap = 360,
24215                        isString = _isString(endValue),
24216                        endNum = parseFloat(endValue) * (isString && ~endValue.indexOf("rad") ? _RAD2DEG : 1),
24217                        change = relative ? endNum * relative : endNum - startNum,
24218                        finalValue = startNum + change + "deg",
24219                        direction,
24220                        pt;
24221
24222                    if (isString) {
24223                        direction = endValue.split("_")[1];
24224
24225                        if (direction === "short") {
24226                            change %= cap;
24227
24228                            if (change !== change % (cap / 2)) {
24229                                change += change < 0 ? cap : -cap;
24230                            }
24231                        }
24232
24233                        if (direction === "cw" && change < 0) {
24234                            change = (change + cap * _bigNum$1) % cap - ~~(change / cap) * cap;
24235                        } else if (direction === "ccw" && change > 0) {
24236                            change = (change - cap * _bigNum$1) % cap - ~~(change / cap) * cap;
24237                        }
24238                    }
24239
24240                    plugin._pt = pt = new PropTween(plugin._pt, target, property, startNum, change, _renderPropWithEnd);
24241                    pt.e = finalValue;
24242                    pt.u = "deg";
24243
24244                    plugin._props.push(property);
24245
24246                    return pt;
24247                },
24248                _addRawTransformPTs = function _addRawTransformPTs(plugin, transforms, target) {
24249                    var style = _tempDivStyler.style,
24250                        startCache = target._gsap,
24251                        exclude = "perspective,force3D,transformOrigin,svgOrigin",
24252                        endCache,
24253                        p,
24254                        startValue,
24255                        endValue,
24256                        startNum,
24257                        endNum,
24258                        startUnit,
24259                        endUnit;
24260                    style.cssText = getComputedStyle(target).cssText + ";position:absolute;display:block;";
24261                    style[_transformProp] = transforms;
24262
24263                    _doc$1.body.appendChild(_tempDivStyler);
24264
24265                    endCache = _parseTransform(_tempDivStyler, 1);
24266
24267                    for (p in _transformProps) {
24268                        startValue = startCache[p];
24269                        endValue = endCache[p];
24270
24271                        if (startValue !== endValue && exclude.indexOf(p) < 0) {
24272                            startUnit = getUnit(startValue);
24273                            endUnit = getUnit(endValue);
24274                            startNum = startUnit !== endUnit ? _convertToUnit(target, p, startValue, endUnit) : parseFloat(startValue);
24275                            endNum = parseFloat(endValue);
24276                            plugin._pt = new PropTween(plugin._pt, startCache, p, startNum, endNum - startNum, _renderCSSProp);
24277                            plugin._pt.u = endUnit || 0;
24278
24279                            plugin._props.push(p);
24280                        }
24281                    }
24282
24283                    _doc$1.body.removeChild(_tempDivStyler);
24284                };
24285
24286            _forEachName("padding,margin,Width,Radius", function (name, index) {
24287                var t = "Top",
24288                    r = "Right",
24289                    b = "Bottom",
24290                    l = "Left",
24291                    props = (index < 3 ? [t, r, b, l] : [t + l, t + r, b + r, b + l]).map(function (side) {
24292                        return index < 2 ? name + side : "border" + side + name;
24293                    });
24294
24295                _specialProps[index > 1 ? "border" + name : name] = function (plugin, target, property, endValue, tween) {
24296                    var a, vars;
24297
24298                    if (arguments.length < 4) {
24299                        a = props.map(function (prop) {
24300                            return _get(plugin, prop, property);
24301                        });
24302                        vars = a.join(" ");
24303                        return vars.split(a[0]).length === 5 ? a[0] : vars;
24304                    }
24305
24306                    a = (endValue + "").split(" ");
24307                    vars = {};
24308                    props.forEach(function (prop, i) {
24309                        return vars[prop] = a[i] = a[i] || a[(i - 1) / 2 | 0];
24310                    });
24311                    plugin.init(target, vars, tween);
24312                };
24313            });
24314
24315            var CSSPlugin = {
24316                name: "css",
24317                register: _initCore,
24318                targetTest: function targetTest(target) {
24319                    return target.style && target.nodeType;
24320                },
24321                init: function init(target, vars, tween, index, targets) {
24322                    var props = this._props,
24323                        style = target.style,
24324                        startValue,
24325                        endValue,
24326                        endNum,
24327                        startNum,
24328                        type,
24329                        specialProp,
24330                        p,
24331                        startUnit,
24332                        endUnit,
24333                        relative,
24334                        isTransformRelated,
24335                        transformPropTween,
24336                        cache,
24337                        smooth,
24338                        hasPriority;
24339                    _pluginInitted || _initCore();
24340
24341                    for (p in vars) {
24342                        if (p === "autoRound") {
24343                            continue;
24344                        }
24345
24346                        endValue = vars[p];
24347
24348                        if (_plugins[p] && _checkPlugin(p, vars, tween, index, target, targets)) {
24349                            continue;
24350                        }
24351
24352                        type = typeof endValue;
24353                        specialProp = _specialProps[p];
24354
24355                        if (type === "function") {
24356                            endValue = endValue.call(tween, index, target, targets);
24357                            type = typeof endValue;
24358                        }
24359
24360                        if (type === "string" && ~endValue.indexOf("random(")) {
24361                            endValue = _replaceRandom(endValue);
24362                        }
24363
24364                        if (specialProp) {
24365                            if (specialProp(this, target, p, endValue, tween)) {
24366                                hasPriority = 1;
24367                            }
24368                        } else if (p.substr(0, 2) === "--") {
24369                            this.add(style, "setProperty", getComputedStyle(target).getPropertyValue(p) + "", endValue + "", index, targets, 0, 0, p);
24370                        } else if (type !== "undefined") {
24371                            startValue = _get(target, p);
24372                            startNum = parseFloat(startValue);
24373                            relative = type === "string" && endValue.charAt(1) === "=" ? +(endValue.charAt(0) + "1") : 0;
24374
24375                            if (relative) {
24376                                endValue = endValue.substr(2);
24377                            }
24378
24379                            endNum = parseFloat(endValue);
24380
24381                            if (p in _propertyAliases) {
24382                                if (p === "autoAlpha") {
24383                                    if (startNum === 1 && _get(target, "visibility") === "hidden" && endNum) {
24384                                        startNum = 0;
24385                                    }
24386
24387                                    _addNonTweeningPT(this, style, "visibility", startNum ? "inherit" : "hidden", endNum ? "inherit" : "hidden", !endNum);
24388                                }
24389
24390                                if (p !== "scale" && p !== "transform") {
24391                                    p = _propertyAliases[p];
24392                                    ~p.indexOf(",") && (p = p.split(",")[0]);
24393                                }
24394                            }
24395
vendor: 5,756 bytes, lines 24396-24489
24396                            isTransformRelated = p in _transformProps;
24397
24398                            if (isTransformRelated) {
24399                                if (!transformPropTween) {
24400                                    cache = target._gsap;
24401                                    cache.renderTransform || _parseTransform(target);
24402                                    smooth = vars.smoothOrigin !== false && cache.smooth;
24403                                    transformPropTween = this._pt = new PropTween(this._pt, style, _transformProp, 0, 1, cache.renderTransform, cache, 0, -1);
24404                                    transformPropTween.dep = 1;
24405                                }
24406
24407                                if (p === "scale") {
24408                                    this._pt = new PropTween(this._pt, cache, "scaleY", cache.scaleY, relative ? relative * endNum : endNum - cache.scaleY);
24409                                    props.push("scaleY", p);
24410                                    p += "X";
24411                                } else if (p === "transformOrigin") {
24412                                    endValue = _convertKeywordsToPercentages(endValue);
24413
24414                                    if (cache.svg) {
24415                                        _applySVGOrigin(target, endValue, 0, smooth, 0, this);
24416                                    } else {
24417                                        endUnit = parseFloat(endValue.split(" ")[2]) || 0;
24418                                        endUnit !== cache.zOrigin && _addNonTweeningPT(this, cache, "zOrigin", cache.zOrigin, endUnit);
24419
24420                                        _addNonTweeningPT(this, style, p, _firstTwoOnly(startValue), _firstTwoOnly(endValue));
24421                                    }
24422
24423                                    continue;
24424                                } else if (p === "svgOrigin") {
24425                                    _applySVGOrigin(target, endValue, 1, smooth, 0, this);
24426
24427                                    continue;
24428                                } else if (p in _rotationalProperties) {
24429                                    _addRotationalPropTween(this, cache, p, startNum, endValue, relative);
24430
24431                                    continue;
24432                                } else if (p === "smoothOrigin") {
24433                                    _addNonTweeningPT(this, cache, "smooth", cache.smooth, endValue);
24434
24435                                    continue;
24436                                } else if (p === "force3D") {
24437                                    cache[p] = endValue;
24438                                    continue;
24439                                } else if (p === "transform") {
24440                                    _addRawTransformPTs(this, endValue, target);
24441
24442                                    continue;
24443                                }
24444                            } else if (!(p in style)) {
24445                                p = _checkPropPrefix(p) || p;
24446                            }
24447
24448                            if (isTransformRelated || (endNum || endNum === 0) && (startNum || startNum === 0) && !_complexExp.test(endValue) && p in style) {
24449                                startUnit = (startValue + "").substr((startNum + "").length);
24450                                endNum || (endNum = 0);
24451                                endUnit = getUnit(endValue) || (p in _config.units ? _config.units[p] : startUnit);
24452                                startUnit !== endUnit && (startNum = _convertToUnit(target, p, startValue, endUnit));
24453                                this._pt = new PropTween(this._pt, isTransformRelated ? cache : style, p, startNum, relative ? relative * endNum : endNum - startNum, endUnit === "px" && vars.autoRound !== false && !isTransformRelated ? _renderRoundedCSSProp : _renderCSSProp);
24454                                this._pt.u = endUnit || 0;
24455
24456                                if (startUnit !== endUnit) {
24457                                    this._pt.b = startValue;
24458                                    this._pt.r = _renderCSSPropWithBeginning;
24459                                }
24460                            } else if (!(p in style)) {
24461                                if (p in target) {
24462                                    this.add(target, p, target[p], endValue, index, targets);
24463                                } else {
24464                                    _missingPlugin(p, endValue);
24465
24466                                    continue;
24467                                }
24468                            } else {
24469                                _tweenComplexCSSString.call(this, target, p, startValue, endValue);
24470                            }
24471
24472                            props.push(p);
24473                        }
24474                    }
24475
24476                    hasPriority && _sortPropTweensByPriority(this);
24477                },
24478                get: _get,
24479                aliases: _propertyAliases,
24480                getSetter: function getSetter(target, property, plugin) {
24481                    var p = _propertyAliases[property];
24482                    p && p.indexOf(",") < 0 && (property = p);
24483                    return property in _transformProps && property !== _transformOriginProp && (target._gsap.x || _get(target, "x")) ? plugin && _recentSetterPlugin === plugin ? property === "scale" ? _setterScale : _setterTransform : (_recentSetterPlugin = plugin || {}) && (property === "scale" ? _setterScaleWithRender : _setterTransformWithRender) : target.style && !_isUndefined(target.style[property]) ? _setterCSSStyle : ~property.indexOf("-") ? _setterCSSProp : _getSetter(target, property);
24484                },
24485                core: {
24486                    _removeProperty: _removeProperty,
24487                    _getMatrix: _getMatrix
24488                }
24489            };
24490            gsap.utils.checkPrefix = _checkPropPrefix;
24491
24492            (function (positionAndScale, rotation, others, aliases) {
24493                var all = _forEachName(positionAndScale + "," + rotation + "," + others, function (name) {
24494                    _transformProps[name] = 1;
24495                });
24496
24497                _forEachName(rotation, function (name) {
24498                    _config.units[name] = "deg";
24499                    _rotationalProperties[name] = 1;
24500                });
24501
24502                _propertyAliases[all[13]] = positionAndScale + "," + rotation;
24503
24504                _forEachName(aliases, function (name) {
24505                    var split = name.split(":");
24506                    _propertyAliases[split[1]] = all[split[0]];
24507                });
24508            })("x,y,z,scale,scaleX,scaleY,xPercent,yPercent", "rotation,rotationX,rotationY,skewX,skewY", "transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective", "0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY");
24509
24510            _forEachName("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective", function (name) {
24511                _config.units[name] = "px";
24512            });
24513
24514            gsap.registerPlugin(CSSPlugin);
24515
24516            var gsapWithCSS = gsap.registerPlugin(CSSPlugin) || gsap,
24517                TweenMaxWithCSS = gsapWithCSS.core.Tween;
24518
24519            exports.Back = Back;
24520            exports.Bounce = Bounce;
24521            exports.CSSPlugin = CSSPlugin;
24522            exports.Circ = Circ;
24523            exports.Cubic = Cubic;
24524            exports.Elastic = Elastic;
24525            exports.Expo = Expo;
24526            exports.Linear = Linear;
24527            exports.Power0 = Power0;
24528            exports.Power1 = Power1;
24529            exports.Power2 = Power2;
24530            exports.Power3 = Power3;
24531            exports.Power4 = Power4;
24532            exports.Quad = Quad;
24533            exports.Quart = Quart;
24534            exports.Quint = Quint;
24535            exports.Sine = Sine;
24536            exports.SteppedEase = SteppedEase;
24537            exports.Strong = Strong;
24538            exports.TimelineLite = Timeline;
24539            exports.TimelineMax = Timeline;
24540            exports.TweenLite = Tween;
24541            exports.TweenMax = TweenMaxWithCSS;
24542            exports.default = gsapWithCSS;
24543            exports.gsap = gsapWithCSS;
24544
24545            if (typeof (window) === 'undefined' || window !== exports) {
24546                Object.defineProperty(exports, '__esModule', {value: true});
24547            } else {
24548                delete window.default;
24549            }
24550
24551        })));
24552
24553    }, {}],
24554    6: [function (require, module, exports) {
24555        /*!
24556 * jQuery JavaScript Library v3.5.1
24557 * https://jquery.com/
24558 *
24559 * Includes Sizzle.js
24560 * https://sizzlejs.com/
24561 *
24562 * Copyright JS Foundation and other contributors
24563 * Released under the MIT license
24564 * https://jquery.org/license
24565 *
24566 * Date: 2020-05-04T22:49Z
24567 */
24568        (function (global, factory) {
24569
24570            "use strict";
24571
24572            if (typeof module === "object" && typeof module.exports === "object") {
24573
24574                // For CommonJS and CommonJS-like environments where a proper `window`
24575                // is present, execute the factory and get jQuery.
24576                // For environments that do not have a `window` with a `document`
24577                // (such as Node.js), expose a factory as module.exports.
24578                // This accentuates the need for the creation of a real `window`.
24579                // e.g. var jQuery = require("jquery")(window);
24580                // See ticket #14549 for more info.
24581                module.exports = global.document ?
24582                    factory(global, true) :
24583                    function (w) {
24584                        if (!w.document) {
24585                            throw new Error("jQuery requires a window with a document");
24586                        }
24587                        return factory(w);
24588                    };
24589            } else {
24590                factory(global);
24591            }
24592
24593// Pass this if window is not defined yet
24594        })(typeof window !== "undefined" ? window : this, function (window, noGlobal) {
24595
24596// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
24597// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
24598// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), str
vendor: 5,278 bytes, lines 24598-24747
24598ict mode should be common
24599// enough that all such attempts are guarded in a try block.
24600            "use strict";
24601
24602            var arr = [];
24603
24604            var getProto = Object.getPrototypeOf;
24605
24606            var slice = arr.slice;
24607
24608            var flat = arr.flat ? function (array) {
24609                return arr.flat.call(array);
24610            } : function (array) {
24611                return arr.concat.apply([], array);
24612            };
24613
24614
24615            var push = arr.push;
24616
24617            var indexOf = arr.indexOf;
24618
24619            var class2type = {};
24620
24621            var toString = class2type.toString;
24622
24623            var hasOwn = class2type.hasOwnProperty;
24624
24625            var fnToString = hasOwn.toString;
24626
24627            var ObjectFunctionString = fnToString.call(Object);
24628
24629            var support = {};
24630
24631            var isFunction = function isFunction(obj) {
24632
24633                // Support: Chrome <=57, Firefox <=52
24634                // In some browsers, typeof returns "function" for HTML <object> elements
24635                // (i.e., `typeof document.createElement( "object" ) === "function"`).
24636                // We don't want to classify *any* DOM node as a function.
24637                return typeof obj === "function" && typeof obj.nodeType !== "number";
24638            };
24639
24640
24641            var isWindow = function isWindow(obj) {
24642                return obj != null && obj === obj.window;
24643            };
24644
24645
24646            var document = window.document;
24647
24648
24649            var preservedScriptAttributes = {
24650                type: true,
24651                src: true,
24652                nonce: true,
24653                noModule: true
24654            };
24655
24656            function DOMEval(code, node, doc) {
24657                doc = doc || document;
24658
24659                var i, val,
24660                    script = doc.createElement("script");
24661
24662                script.text = code;
24663                if (node) {
24664                    for (i in preservedScriptAttributes) {
24665
24666                        // Support: Firefox 64+, Edge 18+
24667                        // Some browsers don't support the "nonce" property on scripts.
24668                        // On the other hand, just using `getAttribute` is not enough as
24669                        // the `nonce` attribute is reset to an empty string whenever it
24670                        // becomes browsing-context connected.
24671                        // See https://github.com/whatwg/html/issues/2369
24672                        // See https://html.spec.whatwg.org/#nonce-attributes
24673                        // The `node.getAttribute` check was added for the sake of
24674                        // `jQuery.globalEval` so that it can fake a nonce-containing node
24675                        // via an object.
24676                        val = node[i] || node.getAttribute && node.getAttribute(i);
24677                        if (val) {
24678                            script.setAttribute(i, val);
24679                        }
24680                    }
24681                }
24682                doc.head.appendChild(script).parentNode.removeChild(script);
24683            }
24684
24685
24686            function toType(obj) {
24687                if (obj == null) {
24688                    return obj + "";
24689                }
24690
24691                // Support: Android <=2.3 only (functionish RegExp)
24692                return typeof obj === "object" || typeof obj === "function" ?
24693                    class2type[toString.call(obj)] || "object" :
24694                    typeof obj;
24695            }
24696
24697            /* global Symbol */
24698// Defining this global in .eslintrc.json would create a danger of using the global
24699// unguarded in another place, it seems safer to define global only for this module
24700
24701
24702            var
24703                version = "3.5.1",
24704
24705                // Define a local copy of jQuery
24706                jQuery = function (selector, context) {
24707
24708                    // The jQuery object is actually just the init constructor 'enhanced'
24709                    // Need init if jQuery is called (just allow error to be thrown if not included)
24710                    return new jQuery.fn.init(selector, context);
24711                };
24712
24713            jQuery.fn = jQuery.prototype = {
24714
24715                // The current version of jQuery being used
24716                jquery: version,
24717
24718                constructor: jQuery,
24719
24720                // The default length of a jQuery object is 0
24721                length: 0,
24722
24723                toArray: function () {
24724                    return slice.call(this);
24725                },
24726
24727                // Get the Nth element in the matched element set OR
24728                // Get the whole matched element set as a clean array
24729                get: function (num) {
24730
24731                    // Return all the elements in a clean array
24732                    if (num == null) {
24733                        return slice.call(this);
24734                    }
24735
24736                    // Return just the one element from the set
24737                    return num < 0 ? this[num + this.length] : this[num];
24738                },
24739
24740                // Take an array of elements and push it onto the stack
24741                // (returning the new matched element set)
24742                pushStack: function (elems) {
24743
24744                    // Build a new jQuery matched element set
24745                    var ret = jQuery.merge(this.constructor(), elems);
24746
24747                    // Add the old object onto the stack (as a reference)
vendor: 4,243 bytes, lines 24748-24861
24748                    ret.prevObject = this;
24749
24750                    // Return the newly-formed element set
24751                    return ret;
24752                },
24753
24754                // Execute a callback for every element in the matched set.
24755                each: function (callback) {
24756                    return jQuery.each(this, callback);
24757                },
24758
24759                map: function (callback) {
24760                    return this.pushStack(jQuery.map(this, function (elem, i) {
24761                        return callback.call(elem, i, elem);
24762                    }));
24763                },
24764
24765                slice: function () {
24766                    return this.pushStack(slice.apply(this, arguments));
24767                },
24768
24769                first: function () {
24770                    return this.eq(0);
24771                },
24772
24773                last: function () {
24774                    return this.eq(-1);
24775                },
24776
24777                even: function () {
24778                    return this.pushStack(jQuery.grep(this, function (_elem, i) {
24779                        return (i + 1) % 2;
24780                    }));
24781                },
24782
24783                odd: function () {
24784                    return this.pushStack(jQuery.grep(this, function (_elem, i) {
24785                        return i % 2;
24786                    }));
24787                },
24788
24789                eq: function (i) {
24790                    var len = this.length,
24791                        j = +i + (i < 0 ? len : 0);
24792                    return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
24793                },
24794
24795                end: function () {
24796                    return this.prevObject || this.constructor();
24797                },
24798
24799                // For internal use only.
24800                // Behaves like an Array's method, not like a jQuery method.
24801                push: push,
24802                sort: arr.sort,
24803                splice: arr.splice
24804            };
24805
24806            jQuery.extend = jQuery.fn.extend = function () {
24807                var options, name, src, copy, copyIsArray, clone,
24808                    target = arguments[0] || {},
24809                    i = 1,
24810                    length = arguments.length,
24811                    deep = false;
24812
24813                // Handle a deep copy situation
24814                if (typeof target === "boolean") {
24815                    deep = target;
24816
24817                    // Skip the boolean and the target
24818                    target = arguments[i] || {};
24819                    i++;
24820                }
24821
24822                // Handle case when target is a string or something (possible in deep copy)
24823                if (typeof target !== "object" && !isFunction(target)) {
24824                    target = {};
24825                }
24826
24827                // Extend jQuery itself if only one argument is passed
24828                if (i === length) {
24829                    target = this;
24830                    i--;
24831                }
24832
24833                for (; i < length; i++) {
24834
24835                    // Only deal with non-null/undefined values
24836                    if ((options = arguments[i]) != null) {
24837
24838                        // Extend the base object
24839                        for (name in options) {
24840                            copy = options[name];
24841
24842                            // Prevent Object.prototype pollution
24843                            // Prevent never-ending loop
24844                            if (name === "__proto__" || target === copy) {
24845                                continue;
24846                            }
24847
24848                            // Recurse if we're merging plain objects or arrays
24849                            if (deep && copy && (jQuery.isPlainObject(copy) ||
24850                                (copyIsArray = Array.isArray(copy)))) {
24851                                src = target[name];
24852
24853                                // Ensure proper type for the source value
24854                                if (copyIsArray && !Array.isArray(src)) {
24855                                    clone = [];
24856                                } else if (!copyIsArray && !jQuery.isPlainObject(src)) {
24857                                    clone = {};
24858                                } else {
24859                                    clone = src;
24860                                }
24861                                copyIsArray = false;
vendor: 4,362 bytes, lines 24862-24987
24862
24863                                // Never move original objects, clone them
24864                                target[name] = jQuery.extend(deep, clone, copy);
24865
24866                                // Don't bring in undefined values
24867                            } else if (copy !== undefined) {
24868                                target[name] = copy;
24869                            }
24870                        }
24871                    }
24872                }
24873
24874                // Return the modified object
24875                return target;
24876            };
24877
24878            jQuery.extend({
24879
24880                // Unique for each copy of jQuery on the page
24881                expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
24882
24883                // Assume jQuery is ready without the ready module
24884                isReady: true,
24885
24886                error: function (msg) {
24887                    throw new Error(msg);
24888                },
24889
24890                noop: function () {
24891                },
24892
24893                isPlainObject: function (obj) {
24894                    var proto, Ctor;
24895
24896                    // Detect obvious negatives
24897                    // Use toString instead of jQuery.type to catch host objects
24898                    if (!obj || toString.call(obj) !== "[object Object]") {
24899                        return false;
24900                    }
24901
24902                    proto = getProto(obj);
24903
24904                    // Objects with no prototype (e.g., `Object.create( null )`) are plain
24905                    if (!proto) {
24906                        return true;
24907                    }
24908
24909                    // Objects with prototype are plain iff they were constructed by a global Object function
24910                    Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
24911                    return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
24912                },
24913
24914                isEmptyObject: function (obj) {
24915                    var name;
24916
24917                    for (name in obj) {
24918                        return false;
24919                    }
24920                    return true;
24921                },
24922
24923                // Evaluates a script in a provided context; falls back to the global one
24924                // if not specified.
24925                globalEval: function (code, options, doc) {
24926                    DOMEval(code, {nonce: options && options.nonce}, doc);
24927                },
24928
24929                each: function (obj, callback) {
24930                    var length, i = 0;
24931
24932                    if (isArrayLike(obj)) {
24933                        length = obj.length;
24934                        for (; i < length; i++) {
24935                            if (callback.call(obj[i], i, obj[i]) === false) {
24936                                break;
24937                            }
24938                        }
24939                    } else {
24940                        for (i in obj) {
24941                            if (callback.call(obj[i], i, obj[i]) === false) {
24942                                break;
24943                            }
24944                        }
24945                    }
24946
24947                    return obj;
24948                },
24949
24950                // results is for internal usage only
24951                makeArray: function (arr, results) {
24952                    var ret = results || [];
24953
24954                    if (arr != null) {
24955                        if (isArrayLike(Object(arr))) {
24956                            jQuery.merge(ret,
24957                                typeof arr === "string" ?
24958                                    [arr] : arr
24959                            );
24960                        } else {
24961                            push.call(ret, arr);
24962                        }
24963                    }
24964
24965                    return ret;
24966                },
24967
24968                inArray: function (elem, arr, i) {
24969                    return arr == null ? -1 : indexOf.call(arr, elem, i);
24970                },
24971
24972                // Support: Android <=4.0 only, PhantomJS 1 only
24973                // push.apply(_, arraylike) throws on ancient WebKit
24974                merge: function (first, second) {
24975                    var len = +second.length,
24976                        j = 0,
24977                        i = first.length;
24978
24979                    for (; j < len; j++) {
24980                        first[i++] = second[j];
24981                    }
24982
24983                    first.length = i;
24984
24985                    return first;
24986                },
24987
vendor: 24,183 bytes, lines 24988-25496
24988                grep: function (elems, callback, invert) {
24989                    var callbackInverse,
24990                        matches = [],
24991                        i = 0,
24992                        length = elems.length,
24993                        callbackExpect = !invert;
24994
24995                    // Go through the array, only saving the items
24996                    // that pass the validator function
24997                    for (; i < length; i++) {
24998                        callbackInverse = !callback(elems[i], i);
24999                        if (callbackInverse !== callbackExpect) {
25000                            matches.push(elems[i]);
25001                        }
25002                    }
25003
25004                    return matches;
25005                },
25006
25007                // arg is for internal usage only
25008                map: function (elems, callback, arg) {
25009                    var length, value,
25010                        i = 0,
25011                        ret = [];
25012
25013                    // Go through the array, translating each of the items to their new values
25014                    if (isArrayLike(elems)) {
25015                        length = elems.length;
25016                        for (; i < length; i++) {
25017                            value = callback(elems[i], i, arg);
25018
25019                            if (value != null) {
25020                                ret.push(value);
25021                            }
25022                        }
25023
25024                        // Go through every key on the object,
25025                    } else {
25026                        for (i in elems) {
25027                            value = callback(elems[i], i, arg);
25028
25029                            if (value != null) {
25030                                ret.push(value);
25031                            }
25032                        }
25033                    }
25034
25035                    // Flatten any nested arrays
25036                    return flat(ret);
25037                },
25038
25039                // A global GUID counter for objects
25040                guid: 1,
25041
25042                // jQuery.support is not used in Core but other projects attach their
25043                // properties to it so it needs to exist.
25044                support: support
25045            });
25046
25047            if (typeof Symbol === "function") {
25048                jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];
25049            }
25050
25051// Populate the class2type map
25052            jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),
25053                function (_i, name) {
25054                    class2type["[object " + name + "]"] = name.toLowerCase();
25055                });
25056
25057            function isArrayLike(obj) {
25058
25059                // Support: real iOS 8.2 only (not reproducible in simulator)
25060                // `in` check used to prevent JIT error (gh-2145)
25061                // hasOwn isn't used here due to false negatives
25062                // regarding Nodelist length in IE
25063                var length = !!obj && "length" in obj && obj.length,
25064                    type = toType(obj);
25065
25066                if (isFunction(obj) || isWindow(obj)) {
25067                    return false;
25068                }
25069
25070                return type === "array" || length === 0 ||
25071                    typeof length === "number" && length > 0 && (length - 1) in obj;
25072            }
25073
25074            var Sizzle =
25075                /*!
25076 * Sizzle CSS Selector Engine v2.3.5
25077 * https://sizzlejs.com/
25078 *
25079 * Copyright JS Foundation and other contributors
25080 * Released under the MIT license
25081 * https://js.foundation/
25082 *
25083 * Date: 2020-03-14
25084 */
25085                (function (window) {
25086                    var i,
25087                        support,
25088                        Expr,
25089                        getText,
25090                        isXML,
25091                        tokenize,
25092                        compile,
25093                        select,
25094                        outermostContext,
25095                        sortInput,
25096                        hasDuplicate,
25097
25098                        // Local document vars
25099                        setDocument,
25100                        document,
25101                        docElem,
25102                        documentIsHTML,
25103                        rbuggyQSA,
25104                        rbuggyMatches,
25105                        matches,
25106                        contains,
25107
25108                        // Instance-specific data
25109                        expando = "sizzle" + 1 * new Date(),
25110                        preferredDoc = window.document,
25111                        dirruns = 0,
25112                        done = 0,
25113                        classCache = createCache(),
25114                        tokenCache = createCache(),
25115                        compilerCache = createCache(),
25116                        nonnativeSelectorCache = createCache(),
25117                        sortOrder = function (a, b) {
25118                            if (a === b) {
25119                                hasDuplicate = true;
25120                            }
25121                            return 0;
25122                        },
25123
25124                        // Instance methods
25125                        hasOwn = ({}).hasOwnProperty,
25126                        arr = [],
25127                        pop = arr.pop,
25128                        pushNative = arr.push,
25129                        push = arr.push,
25130                        slice = arr.slice,
25131
25132                        // Use a stripped-down indexOf as it's faster than native
25133                        // https://jsperf.com/thor-indexof-vs-for/5
25134                        indexOf = function (list, elem) {
25135                            var i = 0,
25136                                len = list.length;
25137                            for (; i < len; i++) {
25138                                if (list[i] === elem) {
25139                                    return i;
25140                                }
25141                            }
25142                            return -1;
25143                        },
25144
25145                        booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" +
25146                            "ismap|loop|multiple|open|readonly|required|scoped",
25147
25148                        // Regular expressions
25149
25150                        // http://www.w3.org/TR/css3-selectors/#whitespace
25151                        whitespace = "[\\x20\\t\\r\\n\\f]",
25152
25153                        // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
25154                        identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace +
25155                            "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",
25156
25157                        // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
25158                        attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
25159
25160                            // Operator (capture 2)
25161                            "*([*^$|!~]?=)" + whitespace +
25162
25163                            // "Attribute values must be CSS identifiers [capture 5]
25164                            // or strings [capture 3 or capture 4]"
25165                            "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" +
25166                            whitespace + "*\\]",
25167
25168                        pseudos = ":(" + identifier + ")(?:\\((" +
25169
25170                            // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
25171                            // 1. quoted (capture 3; capture 4 or capture 5)
25172                            "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
25173
25174                            // 2. simple (capture 6)
25175                            "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
25176
25177                            // 3. anything else (capture 2)
25178                            ".*" +
25179                            ")\\)|)",
25180
25181                        // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
25182                        rwhitespace = new RegExp(whitespace + "+", "g"),
25183                        rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" +
25184                            whitespace + "+$", "g"),
25185
25186                        rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
25187                        rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace +
25188                            "*"),
25189                        rdescend = new RegExp(whitespace + "|>"),
25190
25191                        rpseudo = new RegExp(pseudos),
25192                        ridentifier = new RegExp("^" + identifier + "$"),
25193
25194                        matchExpr = {
25195                            "ID": new RegExp("^#(" + identifier + ")"),
25196                            "CLASS": new RegExp("^\\.(" + identifier + ")"),
25197                            "TAG": new RegExp("^(" + identifier + "|[*])"),
25198                            "ATTR": new RegExp("^" + attributes),
25199                            "PSEUDO": new RegExp("^" + pseudos),
25200                            "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
25201                                whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
25202                                whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
25203                            "bool": new RegExp("^(?:" + booleans + ")$", "i"),
25204
25205                            // For use in libraries implementing .is()
25206                            // We use this for POS matching in `select`
25207                            "needsContext": new RegExp("^" + whitespace +
25208                                "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
25209                                "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
25210                        },
25211
25212                        rhtml = /HTML$/i,
25213                        rinputs = /^(?:input|select|textarea|button)$/i,
25214                        rheader = /^h\d$/i,
25215
25216                        rnative = /^[^{]+\{\s*\[native \w/,
25217
25218                        // Easily-parseable/retrievable ID or TAG or CLASS selectors
25219                        rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
25220
25221                        rsibling = /[+~]/,
25222
25223                        // CSS escapes
25224                        // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
25225                        runescape = new RegExp("\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g"),
25226                        funescape = function (escape, nonHex) {
25227                            var high = "0x" + escape.slice(1) - 0x10000;
25228
25229                            return nonHex ?
25230
25231                                // Strip the backslash prefix from a non-hex escape sequence
25232                                nonHex :
25233
25234                                // Replace a hexadecimal escape sequence with the encoded Unicode code point
25235                                // Support: IE <=11+
25236                                // For values outside the Basic Multilingual Plane (BMP), manually construct a
25237                                // surrogate pair
25238                                high < 0 ?
25239                                    String.fromCharCode(high + 0x10000) :
25240                                    String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00);
25241                        },
25242
25243                        // CSS string/identifier serialization
25244                        // https://drafts.csswg.org/cssom/#common-serializing-idioms
25245                        rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
25246                        fcssescape = function (ch, asCodePoint) {
25247                            if (asCodePoint) {
25248
25249                                // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
25250                                if (ch === "\0") {
25251                                    return "\uFFFD";
25252                                }
25253
25254                                // Control characters and (dependent upon position) numbers get escaped as code points
25255                                return ch.slice(0, -1) + "\\" +
25256                                    ch.charCodeAt(ch.length - 1).toString(16) + " ";
25257                            }
25258
25259                            // Other potentially-special ASCII characters get backslash-escaped
25260                            return "\\" + ch;
25261                        },
25262
25263                        // Used for iframes
25264                        // See setDocument()
25265                        // Removing the function wrapper causes a "Permission Denied"
25266                        // error in IE
25267                        unloadHandler = function () {
25268                            setDocument();
25269                        },
25270
25271                        inDisabledFieldset = addCombinator(
25272                            function (elem) {
25273                                return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
25274                            },
25275                            {dir: "parentNode", next: "legend"}
25276                        );
25277
25278// Optimize for push.apply( _, NodeList )
25279                    try {
25280                        push.apply(
25281                            (arr = slice.call(preferredDoc.childNodes)),
25282                            preferredDoc.childNodes
25283                        );
25284
25285                        // Support: Android<4.0
25286                        // Detect silently failing push.apply
25287                        // eslint-disable-next-line no-unused-expressions
25288                        arr[preferredDoc.childNodes.length].nodeType;
25289                    } catch (e) {
25290                        push = {
25291                            apply: arr.length ?
25292
25293                                // Leverage slice if possible
25294                                function (target, els) {
25295                                    pushNative.apply(target, slice.call(els));
25296                                } :
25297
25298                                // Support: IE<9
25299                                // Otherwise append directly
25300                                function (target, els) {
25301                                    var j = target.length,
25302                                        i = 0;
25303
25304                                    // Can't trust NodeList.length
25305                                    while ((target[j++] = els[i++])) {
25306                                    }
25307                                    target.length = j - 1;
25308                                }
25309                        };
25310                    }
25311
25312                    function Sizzle(selector, context, results, seed) {
25313                        var m, i, elem, nid, match, groups, newSelector,
25314                            newContext = context && context.ownerDocument,
25315
25316                            // nodeType defaults to 9, since context defaults to document
25317                            nodeType = context ? context.nodeType : 9;
25318
25319                        results = results || [];
25320
25321                        // Return early from calls with invalid selector or context
25322                        if (typeof selector !== "string" || !selector ||
25323                            nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
25324
25325                            return results;
25326                        }
25327
25328                        // Try to shortcut find operations (as opposed to filters) in HTML documents
25329                        if (!seed) {
25330                            setDocument(context);
25331                            context = context || document;
25332
25333                            if (documentIsHTML) {
25334
25335                                // If the selector is sufficiently simple, try using a "get*By*" DOM method
25336                                // (excepting DocumentFragment context, where the methods don't exist)
25337                                if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
25338
25339                                    // ID selector
25340                                    if ((m = match[1])) {
25341
25342                                        // Document context
25343                                        if (nodeType === 9) {
25344                                            if ((elem = context.getElementById(m))) {
25345
25346                                                // Support: IE, Opera, Webkit
25347                                                // TODO: identify versions
25348                                                // getElementById can match elements by name instead of ID
25349                                                if (elem.id === m) {
25350                                                    results.push(elem);
25351                                                    return results;
25352                                                }
25353                                            } else {
25354                                                return results;
25355                                            }
25356
25357                                            // Element context
25358                                        } else {
25359
25360                                            // Support: IE, Opera, Webkit
25361                                            // TODO: identify versions
25362                                            // getElementById can match elements by name instead of ID
25363                                            if (newContext && (elem = newContext.getElementById(m)) &&
25364                                                contains(context, elem) &&
25365                                                elem.id === m) {
25366
25367                                                results.push(elem);
25368                                                return results;
25369                                            }
25370                                        }
25371
25372                                        // Type selector
25373                                    } else if (match[2]) {
25374                                        push.apply(results, context.getElementsByTagName(selector));
25375                                        return results;
25376
25377                                        // Class selector
25378                                    } else if ((m = match[3]) && support.getElementsByClassName &&
25379                                        context.getElementsByClassName) {
25380
25381                                        push.apply(results, context.getElementsByClassName(m));
25382                                        return results;
25383                                    }
25384                                }
25385
25386                                // Take advantage of querySelectorAll
25387                                if (support.qsa &&
25388                                    !nonnativeSelectorCache[selector + " "] &&
25389                                    (!rbuggyQSA || !rbuggyQSA.test(selector)) &&
25390
25391                                    // Support: IE 8 only
25392                                    // Exclude object elements
25393                                    (nodeType !== 1 || context.nodeName.toLowerCase() !== "object")) {
25394
25395                                    newSelector = selector;
25396                                    newContext = context;
25397
25398                                    // qSA considers elements outside a scoping root when evaluating child or
25399                                    // descendant combinators, which is not what we want.
25400                                    // In such cases, we work around the behavior by prefixing every selector in the
25401                                    // list with an ID selector referencing the scope context.
25402                                    // The technique has to be used as well when a leading combinator is used
25403                                    // as such selectors are not recognized by querySelectorAll.
25404                                    // Thanks to Andrew Dupont for this technique.
25405                                    if (nodeType === 1 &&
25406                                        (rdescend.test(selector) || rcombinators.test(selector))) {
25407
25408                                        // Expand context for sibling selectors
25409                                        newContext = rsibling.test(selector) && testContext(context.parentNode) ||
25410                                            context;
25411
25412                                        // We can use :scope instead of the ID hack if the browser
25413                                        // supports it & if we're not changing the context.
25414                                        if (newContext !== context || !support.scope) {
25415
25416                                            // Capture the context ID, setting it first if necessary
25417                                            if ((nid = context.getAttribute("id"))) {
25418                                                nid = nid.replace(rcssescape, fcssescape);
25419                                            } else {
25420                                                context.setAttribute("id", (nid = expando));
25421                                            }
25422                                        }
25423
25424                                        // Prefix every selector in the list
25425                                        groups = tokenize(selector);
25426                                        i = groups.length;
25427                                        while (i--) {
25428                                            groups[i] = (nid ? "#" + nid : ":scope") + " " +
25429                                                toSelector(groups[i]);
25430                                        }
25431                                        newSelector = groups.join(",");
25432                                    }
25433
25434                                    try {
25435                                        push.apply(results,
25436                                            newContext.querySelectorAll(newSelector)
25437                                        );
25438                                        return results;
25439                                    } catch (qsaError) {
25440                                        nonnativeSelectorCache(selector, true);
25441                                    } finally {
25442                                        if (nid === expando) {
25443                                            context.removeAttribute("id");
25444                                        }
25445                                    }
25446                                }
25447                            }
25448                        }
25449
25450                        // All others
25451                        return select(selector.replace(rtrim, "$1"), context, results, seed);
25452                    }
25453
25454                    /**
25455                     * Create key-value caches of limited size
25456                     * @returns {function(string, object)} Returns the Object data after storing it on itself with
25457                     *    property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
25458                     *    deleting the oldest entry
25459                     */
25460                    function createCache() {
25461                        var keys = [];
25462
25463                        function cache(key, value) {
25464
25465                            // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
25466                            if (keys.push(key + " ") > Expr.cacheLength) {
25467
25468                                // Only keep the most recent entries
25469                                delete cache[keys.shift()];
25470                            }
25471                            return (cache[key + " "] = value);
25472                        }
25473
25474                        return cache;
25475                    }
25476
25477                    /**
25478                     * Mark a function for special use by Sizzle
25479                     * @param {Function} fn The function to mark
25480                     */
25481                    function markFunction(fn) {
25482                        fn[expando] = true;
25483                        return fn;
25484                    }
25485
25486                    /**
25487                     * Support testing using an element
25488                     * @param {Function} fn Passed the created element and returns a boolean result
25489                     */
25490                    function assert(fn) {
25491                        var el = document.createElement("fieldset");
25492
25493                        try {
25494                            return !!fn(el);
25495                        } catch (e) {
25496                            return false;
vendor: 5,105 bytes, lines 25497-25604
25497                        } finally {
25498
25499                            // Remove from its parent by default
25500                            if (el.parentNode) {
25501                                el.parentNode.removeChild(el);
25502                            }
25503
25504                            // release memory in IE
25505                            el = null;
25506                        }
25507                    }
25508
25509                    /**
25510                     * Adds the same handler for all of the specified attrs
25511                     * @param {String} attrs Pipe-separated list of attributes
25512                     * @param {Function} handler The method that will be applied
25513                     */
25514                    function addHandle(attrs, handler) {
25515                        var arr = attrs.split("|"),
25516                            i = arr.length;
25517
25518                        while (i--) {
25519                            Expr.attrHandle[arr[i]] = handler;
25520                        }
25521                    }
25522
25523                    /**
25524                     * Checks document order of two siblings
25525                     * @param {Element} a
25526                     * @param {Element} b
25527                     * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
25528                     */
25529                    function siblingCheck(a, b) {
25530                        var cur = b && a,
25531                            diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
25532                                a.sourceIndex - b.sourceIndex;
25533
25534                        // Use IE sourceIndex if available on both nodes
25535                        if (diff) {
25536                            return diff;
25537                        }
25538
25539                        // Check if b follows a
25540                        if (cur) {
25541                            while ((cur = cur.nextSibling)) {
25542                                if (cur === b) {
25543                                    return -1;
25544                                }
25545                            }
25546                        }
25547
25548                        return a ? 1 : -1;
25549                    }
25550
25551                    /**
25552                     * Returns a function to use in pseudos for input types
25553                     * @param {String} type
25554                     */
25555                    function createInputPseudo(type) {
25556                        return function (elem) {
25557                            var name = elem.nodeName.toLowerCase();
25558                            return name === "input" && elem.type === type;
25559                        };
25560                    }
25561
25562                    /**
25563                     * Returns a function to use in pseudos for buttons
25564                     * @param {String} type
25565                     */
25566                    function createButtonPseudo(type) {
25567                        return function (elem) {
25568                            var name = elem.nodeName.toLowerCase();
25569                            return (name === "input" || name === "button") && elem.type === type;
25570                        };
25571                    }
25572
25573                    /**
25574                     * Returns a function to use in pseudos for :enabled/:disabled
25575                     * @param {Boolean} disabled true for :disabled; false for :enabled
25576                     */
25577                    function createDisabledPseudo(disabled) {
25578
25579                        // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
25580                        return function (elem) {
25581
25582                            // Only certain elements can match :enabled or :disabled
25583                            // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
25584                            // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
25585                            if ("form" in elem) {
25586
25587                                // Check for inherited disabledness on relevant non-disabled elements:
25588                                // * listed form-associated elements in a disabled fieldset
25589                                //   https://html.spec.whatwg.org/multipage/forms.html#category-listed
25590                                //   https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
25591                                // * option elements in a disabled optgroup
25592                                //   https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
25593                                // All such elements have a "form" property.
25594                                if (elem.parentNode && elem.disabled === false) {
25595
25596                                    // Option elements defer to a parent optgroup if present
25597                                    if ("label" in elem) {
25598                                        if ("label" in elem.parentNode) {
25599                                            return elem.parentNode.disabled === disabled;
25600                                        } else {
25601                                            return elem.disabled === disabled;
25602                                        }
25603                                    }
25604
vendor: 19,778 bytes, lines 25605-25963
25605                                    // Support: IE 6 - 11
25606                                    // Use the isDisabled shortcut property to check for disabled fieldset ancestors
25607                                    return elem.isDisabled === disabled ||
25608
25609                                        // Where there is no isDisabled, check manually
25610                                        /* jshint -W018 */
25611                                        elem.isDisabled !== !disabled &&
25612                                        inDisabledFieldset(elem) === disabled;
25613                                }
25614
25615                                return elem.disabled === disabled;
25616
25617                                // Try to winnow out elements that can't be disabled before trusting the disabled property.
25618                                // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
25619                                // even exist on them, let alone have a boolean value.
25620                            } else if ("label" in elem) {
25621                                return elem.disabled === disabled;
25622                            }
25623
25624                            // Remaining elements are neither :enabled nor :disabled
25625                            return false;
25626                        };
25627                    }
25628
25629                    /**
25630                     * Returns a function to use in pseudos for positionals
25631                     * @param {Function} fn
25632                     */
25633                    function createPositionalPseudo(fn) {
25634                        return markFunction(function (argument) {
25635                            argument = +argument;
25636                            return markFunction(function (seed, matches) {
25637                                var j,
25638                                    matchIndexes = fn([], seed.length, argument),
25639                                    i = matchIndexes.length;
25640
25641                                // Match elements found at the specified indexes
25642                                while (i--) {
25643                                    if (seed[(j = matchIndexes[i])]) {
25644                                        seed[j] = !(matches[j] = seed[j]);
25645                                    }
25646                                }
25647                            });
25648                        });
25649                    }
25650
25651                    /**
25652                     * Checks a node for validity as a Sizzle context
25653                     * @param {Element|Object=} context
25654                     * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
25655                     */
25656                    function testContext(context) {
25657                        return context && typeof context.getElementsByTagName !== "undefined" && context;
25658                    }
25659
25660// Expose support vars for convenience
25661                    support = Sizzle.support = {};
25662
25663                    /**
25664                     * Detects XML nodes
25665                     * @param {Element|Object} elem An element or a document
25666                     * @returns {Boolean} True iff elem is a non-HTML XML node
25667                     */
25668                    isXML = Sizzle.isXML = function (elem) {
25669                        var namespace = elem.namespaceURI,
25670                            docElem = (elem.ownerDocument || elem).documentElement;
25671
25672                        // Support: IE <=8
25673                        // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
25674                        // https://bugs.jquery.com/ticket/4833
25675                        return !rhtml.test(namespace || docElem && docElem.nodeName || "HTML");
25676                    };
25677
25678                    /**
25679                     * Sets document-related variables once based on the current document
25680                     * @param {Element|Object} [doc] An element or document object to use to set the document
25681                     * @returns {Object} Returns the current document
25682                     */
25683                    setDocument = Sizzle.setDocument = function (node) {
25684                        var hasCompare, subWindow,
25685                            doc = node ? node.ownerDocument || node : preferredDoc;
25686
25687                        // Return early if doc is invalid or already selected
25688                        // Support: IE 11+, Edge 17 - 18+
25689                        // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
25690                        // two documents; shallow comparisons work.
25691                        // eslint-disable-next-line eqeqeq
25692                        if (doc == document || doc.nodeType !== 9 || !doc.documentElement) {
25693                            return document;
25694                        }
25695
25696                        // Update global variables
25697                        document = doc;
25698                        docElem = document.documentElement;
25699                        documentIsHTML = !isXML(document);
25700
25701                        // Support: IE 9 - 11+, Edge 12 - 18+
25702                        // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
25703                        // Support: IE 11+, Edge 17 - 18+
25704                        // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
25705                        // two documents; shallow comparisons work.
25706                        // eslint-disable-next-line eqeqeq
25707                        if (preferredDoc != document &&
25708                            (subWindow = document.defaultView) && subWindow.top !== subWindow) {
25709
25710                            // Support: IE 11, Edge
25711                            if (subWindow.addEventListener) {
25712                                subWindow.addEventListener("unload", unloadHandler, false);
25713
25714                                // Support: IE 9 - 10 only
25715                            } else if (subWindow.attachEvent) {
25716                                subWindow.attachEvent("onunload", unloadHandler);
25717                            }
25718                        }
25719
25720                        // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only,
25721                        // Safari 4 - 5 only, Opera <=11.6 - 12.x only
25722                        // IE/Edge & older browsers don't support the :scope pseudo-class.
25723                        // Support: Safari 6.0 only
25724                        // Safari 6.0 supports :scope but it's an alias of :root there.
25725                        support.scope = assert(function (el) {
25726                            docElem.appendChild(el).appendChild(document.createElement("div"));
25727                            return typeof el.querySelectorAll !== "undefined" &&
25728                                !el.querySelectorAll(":scope fieldset div").length;
25729                        });
25730
25731                        /* Attributes
25732	---------------------------------------------------------------------- */
25733
25734                        // Support: IE<8
25735                        // Verify that getAttribute really returns attributes and not properties
25736                        // (excepting IE8 booleans)
25737                        support.attributes = assert(function (el) {
25738                            el.className = "i";
25739                            return !el.getAttribute("className");
25740                        });
25741
25742                        /* getElement(s)By*
25743	---------------------------------------------------------------------- */
25744
25745                        // Check if getElementsByTagName("*") returns only elements
25746                        support.getElementsByTagName = assert(function (el) {
25747                            el.appendChild(document.createComment(""));
25748                            return !el.getElementsByTagName("*").length;
25749                        });
25750
25751                        // Support: IE<9
25752                        support.getElementsByClassName = rnative.test(document.getElementsByClassName);
25753
25754                        // Support: IE<10
25755                        // Check if getElementById returns elements by name
25756                        // The broken getElementById methods don't pick up programmatically-set names,
25757                        // so use a roundabout getElementsByName test
25758                        support.getById = assert(function (el) {
25759                            docElem.appendChild(el).id = expando;
25760                            return !document.getElementsByName || !document.getElementsByName(expando).length;
25761                        });
25762
25763                        // ID filter and find
25764                        if (support.getById) {
25765                            Expr.filter["ID"] = function (id) {
25766                                var attrId = id.replace(runescape, funescape);
25767                                return function (elem) {
25768                                    return elem.getAttribute("id") === attrId;
25769                                };
25770                            };
25771                            Expr.find["ID"] = function (id, context) {
25772                                if (typeof context.getElementById !== "undefined" && documentIsHTML) {
25773                                    var elem = context.getElementById(id);
25774                                    return elem ? [elem] : [];
25775                                }
25776                            };
25777                        } else {
25778                            Expr.filter["ID"] = function (id) {
25779                                var attrId = id.replace(runescape, funescape);
25780                                return function (elem) {
25781                                    var node = typeof elem.getAttributeNode !== "undefined" &&
25782                                        elem.getAttributeNode("id");
25783                                    return node && node.value === attrId;
25784                                };
25785                            };
25786
25787                            // Support: IE 6 - 7 only
25788                            // getElementById is not reliable as a find shortcut
25789                            Expr.find["ID"] = function (id, context) {
25790                                if (typeof context.getElementById !== "undefined" && documentIsHTML) {
25791                                    var node, i, elems,
25792                                        elem = context.getElementById(id);
25793
25794                                    if (elem) {
25795
25796                                        // Verify the id attribute
25797                                        node = elem.getAttributeNode("id");
25798                                        if (node && node.value === id) {
25799                                            return [elem];
25800                                        }
25801
25802                                        // Fall back on getElementsByName
25803                                        elems = context.getElementsByName(id);
25804                                        i = 0;
25805                                        while ((elem = elems[i++])) {
25806                                            node = elem.getAttributeNode("id");
25807                                            if (node && node.value === id) {
25808                                                return [elem];
25809                                            }
25810                                        }
25811                                    }
25812
25813                                    return [];
25814                                }
25815                            };
25816                        }
25817
25818                        // Tag
25819                        Expr.find["TAG"] = support.getElementsByTagName ?
25820                            function (tag, context) {
25821                                if (typeof context.getElementsByTagName !== "undefined") {
25822                                    return context.getElementsByTagName(tag);
25823
25824                                    // DocumentFragment nodes don't have gEBTN
25825                                } else if (support.qsa) {
25826                                    return context.querySelectorAll(tag);
25827                                }
25828                            } :
25829
25830                            function (tag, context) {
25831                                var elem,
25832                                    tmp = [],
25833                                    i = 0,
25834
25835                                    // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
25836                                    results = context.getElementsByTagName(tag);
25837
25838                                // Filter out possible comments
25839                                if (tag === "*") {
25840                                    while ((elem = results[i++])) {
25841                                        if (elem.nodeType === 1) {
25842                                            tmp.push(elem);
25843                                        }
25844                                    }
25845
25846                                    return tmp;
25847                                }
25848                                return results;
25849                            };
25850
25851                        // Class
25852                        Expr.find["CLASS"] = support.getElementsByClassName && function (className, context) {
25853                            if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) {
25854                                return context.getElementsByClassName(className);
25855                            }
25856                        };
25857
25858                        /* QSA/matchesSelector
25859	---------------------------------------------------------------------- */
25860
25861                        // QSA and matchesSelector support
25862
25863                        // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
25864                        rbuggyMatches = [];
25865
25866                        // qSa(:focus) reports false when true (Chrome 21)
25867                        // We allow this because of a bug in IE8/9 that throws an error
25868                        // whenever `document.activeElement` is accessed on an iframe
25869                        // So, we allow :focus to pass through QSA all the time to avoid the IE error
25870                        // See https://bugs.jquery.com/ticket/13378
25871                        rbuggyQSA = [];
25872
25873                        if ((support.qsa = rnative.test(document.querySelectorAll))) {
25874
25875                            // Build QSA regex
25876                            // Regex strategy adopted from Diego Perini
25877                            assert(function (el) {
25878
25879                                var input;
25880
25881                                // Select is set to empty string on purpose
25882                                // This is to test IE's treatment of not explicitly
25883                                // setting a boolean content attribute,
25884                                // since its presence should be enough
25885                                // https://bugs.jquery.com/ticket/12359
25886                                docElem.appendChild(el).innerHTML = "<a id='" + expando + "'></a>" +
25887                                    "<select id='" + expando + "-\r\\' msallowcapture=''>" +
25888                                    "<option selected=''></option></select>";
25889
25890                                // Support: IE8, Opera 11-12.16
25891                                // Nothing should be selected when empty strings follow ^= or $= or *=
25892                                // The test attribute must be unknown in Opera but "safe" for WinRT
25893                                // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
25894                                if (el.querySelectorAll("[msallowcapture^='']").length) {
25895                                    rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")");
25896                                }
25897
25898                                // Support: IE8
25899                                // Boolean attributes and "value" are not treated correctly
25900                                if (!el.querySelectorAll("[selected]").length) {
25901                                    rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
25902                                }
25903
25904                                // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
25905                                if (!el.querySelectorAll("[id~=" + expando + "-]").length) {
25906                                    rbuggyQSA.push("~=");
25907                                }
25908
25909                                // Support: IE 11+, Edge 15 - 18+
25910                                // IE 11/Edge don't find elements on a `[name='']` query in some cases.
25911                                // Adding a temporary attribute to the document before the selection works
25912                                // around the issue.
25913                                // Interestingly, IE 10 & older don't seem to have the issue.
25914                                input = document.createElement("input");
25915                                input.setAttribute("name", "");
25916                                el.appendChild(input);
25917                                if (!el.querySelectorAll("[name='']").length) {
25918                                    rbuggyQSA.push("\\[" + whitespace + "*name" + whitespace + "*=" +
25919                                        whitespace + "*(?:''|\"\")");
25920                                }
25921
25922                                // Webkit/Opera - :checked should return selected option elements
25923                                // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
25924                                // IE8 throws error here and will not see later tests
25925                                if (!el.querySelectorAll(":checked").length) {
25926                                    rbuggyQSA.push(":checked");
25927                                }
25928
25929                                // Support: Safari 8+, iOS 8+
25930                                // https://bugs.webkit.org/show_bug.cgi?id=136851
25931                                // In-page `selector#id sibling-combinator selector` fails
25932                                if (!el.querySelectorAll("a#" + expando + "+*").length) {
25933                                    rbuggyQSA.push(".#.+[+~]");
25934                                }
25935
25936                                // Support: Firefox <=3.6 - 5 only
25937                                // Old Firefox doesn't throw on a badly-escaped identifier.
25938                                el.querySelectorAll("\\\f");
25939                                rbuggyQSA.push("[\\r\\n\\f]");
25940                            });
25941
25942                            assert(function (el) {
25943                                el.innerHTML = "<a href='' disabled='disabled'></a>" +
25944                                    "<select disabled='disabled'><option/></select>";
25945
25946                                // Support: Windows 8 Native Apps
25947                                // The type and name attributes are restricted during .innerHTML assignment
25948                                var input = document.createElement("input");
25949                                input.setAttribute("type", "hidden");
25950                                el.appendChild(input).setAttribute("name", "D");
25951
25952                                // Support: IE8
25953                                // Enforce case-sensitivity of name attribute
25954                                if (el.querySelectorAll("[name=d]").length) {
25955                                    rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=");
25956                                }
25957
25958                                // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
25959                                // IE8 throws error here and will not see later tests
25960                                if (el.querySelectorAll(":enabled").length !== 2) {
25961                                    rbuggyQSA.push(":enabled", ":disabled");
25962                                }
25963
vendor: 4,336 bytes, lines 25964-26047
25964                                // Support: IE9-11+
25965                                // IE's :disabled selector does not pick up the children of disabled fieldsets
25966                                docElem.appendChild(el).disabled = true;
25967                                if (el.querySelectorAll(":disabled").length !== 2) {
25968                                    rbuggyQSA.push(":enabled", ":disabled");
25969                                }
25970
25971                                // Support: Opera 10 - 11 only
25972                                // Opera 10-11 does not throw on post-comma invalid pseudos
25973                                el.querySelectorAll("*,:x");
25974                                rbuggyQSA.push(",.*:");
25975                            });
25976                        }
25977
25978                        if ((support.matchesSelector = rnative.test((matches = docElem.matches ||
25979                            docElem.webkitMatchesSelector ||
25980                            docElem.mozMatchesSelector ||
25981                            docElem.oMatchesSelector ||
25982                            docElem.msMatchesSelector)))) {
25983
25984                            assert(function (el) {
25985
25986                                // Check to see if it's possible to do matchesSelector
25987                                // on a disconnected node (IE 9)
25988                                support.disconnectedMatch = matches.call(el, "*");
25989
25990                                // This should fail with an exception
25991                                // Gecko does not error, returns false instead
25992                                matches.call(el, "[s!='']:x");
25993                                rbuggyMatches.push("!=", pseudos);
25994                            });
25995                        }
25996
25997                        rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
25998                        rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
25999
26000                        /* Contains
26001	---------------------------------------------------------------------- */
26002                        hasCompare = rnative.test(docElem.compareDocumentPosition);
26003
26004                        // Element contains another
26005                        // Purposefully self-exclusive
26006                        // As in, an element does not contain itself
26007                        contains = hasCompare || rnative.test(docElem.contains) ?
26008                            function (a, b) {
26009                                var adown = a.nodeType === 9 ? a.documentElement : a,
26010                                    bup = b && b.parentNode;
26011                                return a === bup || !!(bup && bup.nodeType === 1 && (
26012                                    adown.contains ?
26013                                        adown.contains(bup) :
26014                                        a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16
26015                                ));
26016                            } :
26017                            function (a, b) {
26018                                if (b) {
26019                                    while ((b = b.parentNode)) {
26020                                        if (b === a) {
26021                                            return true;
26022                                        }
26023                                    }
26024                                }
26025                                return false;
26026                            };
26027
26028                        /* Sorting
26029	---------------------------------------------------------------------- */
26030
26031                        // Document order sorting
26032                        sortOrder = hasCompare ?
26033                            function (a, b) {
26034
26035                                // Flag for duplicate removal
26036                                if (a === b) {
26037                                    hasDuplicate = true;
26038                                    return 0;
26039                                }
26040
26041                                // Sort on method existence if only one input has compareDocumentPosition
26042                                var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
26043                                if (compare) {
26044                                    return compare;
26045                                }
26046
26047                                // Calculate position if both inputs belong to the same document
vendor: 10,331 bytes, lines 26048-26252
26048                                // Support: IE 11+, Edge 17 - 18+
26049                                // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
26050                                // two documents; shallow comparisons work.
26051                                // eslint-disable-next-line eqeqeq
26052                                compare = (a.ownerDocument || a) == (b.ownerDocument || b) ?
26053                                    a.compareDocumentPosition(b) :
26054
26055                                    // Otherwise we know they are disconnected
26056                                    1;
26057
26058                                // Disconnected nodes
26059                                if (compare & 1 ||
26060                                    (!support.sortDetached && b.compareDocumentPosition(a) === compare)) {
26061
26062                                    // Choose the first element that is related to our preferred document
26063                                    // Support: IE 11+, Edge 17 - 18+
26064                                    // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
26065                                    // two documents; shallow comparisons work.
26066                                    // eslint-disable-next-line eqeqeq
26067                                    if (a == document || a.ownerDocument == preferredDoc &&
26068                                        contains(preferredDoc, a)) {
26069                                        return -1;
26070                                    }
26071
26072                                    // Support: IE 11+, Edge 17 - 18+
26073                                    // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
26074                                    // two documents; shallow comparisons work.
26075                                    // eslint-disable-next-line eqeqeq
26076                                    if (b == document || b.ownerDocument == preferredDoc &&
26077                                        contains(preferredDoc, b)) {
26078                                        return 1;
26079                                    }
26080
26081                                    // Maintain original order
26082                                    return sortInput ?
26083                                        (indexOf(sortInput, a) - indexOf(sortInput, b)) :
26084                                        0;
26085                                }
26086
26087                                return compare & 4 ? -1 : 1;
26088                            } :
26089                            function (a, b) {
26090
26091                                // Exit early if the nodes are identical
26092                                if (a === b) {
26093                                    hasDuplicate = true;
26094                                    return 0;
26095                                }
26096
26097                                var cur,
26098                                    i = 0,
26099                                    aup = a.parentNode,
26100                                    bup = b.parentNode,
26101                                    ap = [a],
26102                                    bp = [b];
26103
26104                                // Parentless nodes are either documents or disconnected
26105                                if (!aup || !bup) {
26106
26107                                    // Support: IE 11+, Edge 17 - 18+
26108                                    // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
26109                                    // two documents; shallow comparisons work.
26110                                    /* eslint-disable eqeqeq */
26111                                    return a == document ? -1 :
26112                                        b == document ? 1 :
26113                                            /* eslint-enable eqeqeq */
26114                                            aup ? -1 :
26115                                                bup ? 1 :
26116                                                    sortInput ?
26117                                                        (indexOf(sortInput, a) - indexOf(sortInput, b)) :
26118                                                        0;
26119
26120                                    // If the nodes are siblings, we can do a quick check
26121                                } else if (aup === bup) {
26122                                    return siblingCheck(a, b);
26123                                }
26124
26125                                // Otherwise we need full lists of their ancestors for comparison
26126                                cur = a;
26127                                while ((cur = cur.parentNode)) {
26128                                    ap.unshift(cur);
26129                                }
26130                                cur = b;
26131                                while ((cur = cur.parentNode)) {
26132                                    bp.unshift(cur);
26133                                }
26134
26135                                // Walk down the tree looking for a discrepancy
26136                                while (ap[i] === bp[i]) {
26137                                    i++;
26138                                }
26139
26140                                return i ?
26141
26142                                    // Do a sibling check if the nodes have a common ancestor
26143                                    siblingCheck(ap[i], bp[i]) :
26144
26145                                    // Otherwise nodes in our document sort first
26146                                    // Support: IE 11+, Edge 17 - 18+
26147                                    // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
26148                                    // two documents; shallow comparisons work.
26149                                    /* eslint-disable eqeqeq */
26150                                    ap[i] == preferredDoc ? -1 :
26151                                        bp[i] == preferredDoc ? 1 :
26152                                            /* eslint-enable eqeqeq */
26153                                            0;
26154                            };
26155
26156                        return document;
26157                    };
26158
26159                    Sizzle.matches = function (expr, elements) {
26160                        return Sizzle(expr, null, null, elements);
26161                    };
26162
26163                    Sizzle.matchesSelector = function (elem, expr) {
26164                        setDocument(elem);
26165
26166                        if (support.matchesSelector && documentIsHTML &&
26167                            !nonnativeSelectorCache[expr + " "] &&
26168                            (!rbuggyMatches || !rbuggyMatches.test(expr)) &&
26169                            (!rbuggyQSA || !rbuggyQSA.test(expr))) {
26170
26171                            try {
26172                                var ret = matches.call(elem, expr);
26173
26174                                // IE 9's matchesSelector returns false on disconnected nodes
26175                                if (ret || support.disconnectedMatch ||
26176
26177                                    // As well, disconnected nodes are said to be in a document
26178                                    // fragment in IE 9
26179                                    elem.document && elem.document.nodeType !== 11) {
26180                                    return ret;
26181                                }
26182                            } catch (e) {
26183                                nonnativeSelectorCache(expr, true);
26184                            }
26185                        }
26186
26187                        return Sizzle(expr, document, null, [elem]).length > 0;
26188                    };
26189
26190                    Sizzle.contains = function (context, elem) {
26191
26192                        // Set document vars if needed
26193                        // Support: IE 11+, Edge 17 - 18+
26194                        // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
26195                        // two documents; shallow comparisons work.
26196                        // eslint-disable-next-line eqeqeq
26197                        if ((context.ownerDocument || context) != document) {
26198                            setDocument(context);
26199                        }
26200                        return contains(context, elem);
26201                    };
26202
26203                    Sizzle.attr = function (elem, name) {
26204
26205                        // Set document vars if needed
26206                        // Support: IE 11+, Edge 17 - 18+
26207                        // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
26208                        // two documents; shallow comparisons work.
26209                        // eslint-disable-next-line eqeqeq
26210                        if ((elem.ownerDocument || elem) != document) {
26211                            setDocument(elem);
26212                        }
26213
26214                        var fn = Expr.attrHandle[name.toLowerCase()],
26215
26216                            // Don't get fooled by Object.prototype properties (jQuery #13807)
26217                            val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ?
26218                                fn(elem, name, !documentIsHTML) :
26219                                undefined;
26220
26221                        return val !== undefined ?
26222                            val :
26223                            support.attributes || !documentIsHTML ?
26224                                elem.getAttribute(name) :
26225                                (val = elem.getAttributeNode(name)) && val.specified ?
26226                                    val.value :
26227                                    null;
26228                    };
26229
26230                    Sizzle.escape = function (sel) {
26231                        return (sel + "").replace(rcssescape, fcssescape);
26232                    };
26233
26234                    Sizzle.error = function (msg) {
26235                        throw new Error("Syntax error, unrecognized expression: " + msg);
26236                    };
26237
26238                    /**
26239                     * Document sorting and removing duplicates
26240                     * @param {ArrayLike} results
26241                     */
26242                    Sizzle.uniqueSort = function (results) {
26243                        var elem,
26244                            duplicates = [],
26245                            j = 0,
26246                            i = 0;
26247
26248                        // Unless we *know* we can detect duplicates, assume their presence
26249                        hasDuplicate = !support.detectDuplicates;
26250                        sortInput = !support.sortStable && results.slice(0);
26251                        results.sort(sortOrder);
26252
vendor: 15,454 bytes, lines 26253-26559
26253                        if (hasDuplicate) {
26254                            while ((elem = results[i++])) {
26255                                if (elem === results[i]) {
26256                                    j = duplicates.push(i);
26257                                }
26258                            }
26259                            while (j--) {
26260                                results.splice(duplicates[j], 1);
26261                            }
26262                        }
26263
26264                        // Clear input after sorting to release objects
26265                        // See https://github.com/jquery/sizzle/pull/225
26266                        sortInput = null;
26267
26268                        return results;
26269                    };
26270
26271                    /**
26272                     * Utility function for retrieving the text value of an array of DOM nodes
26273                     * @param {Array|Element} elem
26274                     */
26275                    getText = Sizzle.getText = function (elem) {
26276                        var node,
26277                            ret = "",
26278                            i = 0,
26279                            nodeType = elem.nodeType;
26280
26281                        if (!nodeType) {
26282
26283                            // If no nodeType, this is expected to be an array
26284                            while ((node = elem[i++])) {
26285
26286                                // Do not traverse comment nodes
26287                                ret += getText(node);
26288                            }
26289                        } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
26290
26291                            // Use textContent for elements
26292                            // innerText usage removed for consistency of new lines (jQuery #11153)
26293                            if (typeof elem.textContent === "string") {
26294                                return elem.textContent;
26295                            } else {
26296
26297                                // Traverse its children
26298                                for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
26299                                    ret += getText(elem);
26300                                }
26301                            }
26302                        } else if (nodeType === 3 || nodeType === 4) {
26303                            return elem.nodeValue;
26304                        }
26305
26306                        // Do not include comment or processing instruction nodes
26307
26308                        return ret;
26309                    };
26310
26311                    Expr = Sizzle.selectors = {
26312
26313                        // Can be adjusted by the user
26314                        cacheLength: 50,
26315
26316                        createPseudo: markFunction,
26317
26318                        match: matchExpr,
26319
26320                        attrHandle: {},
26321
26322                        find: {},
26323
26324                        relative: {
26325                            ">": {dir: "parentNode", first: true},
26326                            " ": {dir: "parentNode"},
26327                            "+": {dir: "previousSibling", first: true},
26328                            "~": {dir: "previousSibling"}
26329                        },
26330
26331                        preFilter: {
26332                            "ATTR": function (match) {
26333                                match[1] = match[1].replace(runescape, funescape);
26334
26335                                // Move the given value to match[3] whether quoted or unquoted
26336                                match[3] = (match[3] || match[4] ||
26337                                    match[5] || "").replace(runescape, funescape);
26338
26339                                if (match[2] === "~=") {
26340                                    match[3] = " " + match[3] + " ";
26341                                }
26342
26343                                return match.slice(0, 4);
26344                            },
26345
26346                            "CHILD": function (match) {
26347
26348                                /* matches from matchExpr["CHILD"]
26349				1 type (only|nth|...)
26350				2 what (child|of-type)
26351				3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
26352				4 xn-component of xn+y argument ([+-]?\d*n|)
26353				5 sign of xn-component
26354				6 x of xn-component
26355				7 sign of y-component
26356				8 y of y-component
26357			*/
26358                                match[1] = match[1].toLowerCase();
26359
26360                                if (match[1].slice(0, 3) === "nth") {
26361
26362                                    // nth-* requires argument
26363                                    if (!match[3]) {
26364                                        Sizzle.error(match[0]);
26365                                    }
26366
26367                                    // numeric x and y parameters for Expr.filter.CHILD
26368                                    // remember that false/true cast respectively to 0/1
26369                                    match[4] = +(match[4] ?
26370                                        match[5] + (match[6] || 1) :
26371                                        2 * (match[3] === "even" || match[3] === "odd"));
26372                                    match[5] = +((match[7] + match[8]) || match[3] === "odd");
26373
26374                                    // other types prohibit arguments
26375                                } else if (match[3]) {
26376                                    Sizzle.error(match[0]);
26377                                }
26378
26379                                return match;
26380                            },
26381
26382                            "PSEUDO": function (match) {
26383                                var excess,
26384                                    unquoted = !match[6] && match[2];
26385
26386                                if (matchExpr["CHILD"].test(match[0])) {
26387                                    return null;
26388                                }
26389
26390                                // Accept quoted arguments as-is
26391                                if (match[3]) {
26392                                    match[2] = match[4] || match[5] || "";
26393
26394                                    // Strip excess characters from unquoted arguments
26395                                } else if (unquoted && rpseudo.test(unquoted) &&
26396
26397                                    // Get excess from tokenize (recursively)
26398                                    (excess = tokenize(unquoted, true)) &&
26399
26400                                    // advance to the next closing parenthesis
26401                                    (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
26402
26403                                    // excess is a negative index
26404                                    match[0] = match[0].slice(0, excess);
26405                                    match[2] = unquoted.slice(0, excess);
26406                                }
26407
26408                                // Return only captures needed by the pseudo filter method (type and argument)
26409                                return match.slice(0, 3);
26410                            }
26411                        },
26412
26413                        filter: {
26414
26415                            "TAG": function (nodeNameSelector) {
26416                                var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
26417                                return nodeNameSelector === "*" ?
26418                                    function () {
26419                                        return true;
26420                                    } :
26421                                    function (elem) {
26422                                        return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
26423                                    };
26424                            },
26425
26426                            "CLASS": function (className) {
26427                                var pattern = classCache[className + " "];
26428
26429                                return pattern ||
26430                                    (pattern = new RegExp("(^|" + whitespace +
26431                                        ")" + className + "(" + whitespace + "|$)")) && classCache(
26432                                        className, function (elem) {
26433                                            return pattern.test(
26434                                                typeof elem.className === "string" && elem.className ||
26435                                                typeof elem.getAttribute !== "undefined" &&
26436                                                elem.getAttribute("class") ||
26437                                                ""
26438                                            );
26439                                        });
26440                            },
26441
26442                            "ATTR": function (name, operator, check) {
26443                                return function (elem) {
26444                                    var result = Sizzle.attr(elem, name);
26445
26446                                    if (result == null) {
26447                                        return operator === "!=";
26448                                    }
26449                                    if (!operator) {
26450                                        return true;
26451                                    }
26452
26453                                    result += "";
26454
26455                                    /* eslint-disable max-len */
26456
26457                                    return operator === "=" ? result === check :
26458                                        operator === "!=" ? result !== check :
26459                                            operator === "^=" ? check && result.indexOf(check) === 0 :
26460                                                operator === "*=" ? check && result.indexOf(check) > -1 :
26461                                                    operator === "$=" ? check && result.slice(-check.length) === check :
26462                                                        operator === "~=" ? (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1 :
26463                                                            operator === "|=" ? result === check || result.slice(0, check.length + 1) === check + "-" :
26464                                                                false;
26465                                    /* eslint-enable max-len */
26466
26467                                };
26468                            },
26469
26470                            "CHILD": function (type, what, _argument, first, last) {
26471                                var simple = type.slice(0, 3) !== "nth",
26472                                    forward = type.slice(-4) !== "last",
26473                                    ofType = what === "of-type";
26474
26475                                return first === 1 && last === 0 ?
26476
26477                                    // Shortcut for :nth-*(n)
26478                                    function (elem) {
26479                                        return !!elem.parentNode;
26480                                    } :
26481
26482                                    function (elem, _context, xml) {
26483                                        var cache, uniqueCache, outerCache, node, nodeIndex, start,
26484                                            dir = simple !== forward ? "nextSibling" : "previousSibling",
26485                                            parent = elem.parentNode,
26486                                            name = ofType && elem.nodeName.toLowerCase(),
26487                                            useCache = !xml && !ofType,
26488                                            diff = false;
26489
26490                                        if (parent) {
26491
26492                                            // :(first|last|only)-(child|of-type)
26493                                            if (simple) {
26494                                                while (dir) {
26495                                                    node = elem;
26496                                                    while ((node = node[dir])) {
26497                                                        if (ofType ?
26498                                                            node.nodeName.toLowerCase() === name :
26499                                                            node.nodeType === 1) {
26500
26501                                                            return false;
26502                                                        }
26503                                                    }
26504
26505                                                    // Reverse direction for :only-* (if we haven't yet done so)
26506                                                    start = dir = type === "only" && !start && "nextSibling";
26507                                                }
26508                                                return true;
26509                                            }
26510
26511                                            start = [forward ? parent.firstChild : parent.lastChild];
26512
26513                                            // non-xml :nth-child(...) stores cache data on `parent`
26514                                            if (forward && useCache) {
26515
26516                                                // Seek `elem` from a previously-cached index
26517
26518                                                // ...in a gzip-friendly way
26519                                                node = parent;
26520                                                outerCache = node[expando] || (node[expando] = {});
26521
26522                                                // Support: IE <9 only
26523                                                // Defend against cloned attroperties (jQuery gh-1709)
26524                                                uniqueCache = outerCache[node.uniqueID] ||
26525                                                    (outerCache[node.uniqueID] = {});
26526
26527                                                cache = uniqueCache[type] || [];
26528                                                nodeIndex = cache[0] === dirruns && cache[1];
26529                                                diff = nodeIndex && cache[2];
26530                                                node = nodeIndex && parent.childNodes[nodeIndex];
26531
26532                                                while ((node = ++nodeIndex && node && node[dir] ||
26533
26534                                                    // Fallback to seeking `elem` from the start
26535                                                    (diff = nodeIndex = 0) || start.pop())) {
26536
26537                                                    // When found, cache indexes on `parent` and break
26538                                                    if (node.nodeType === 1 && ++diff && node === elem) {
26539                                                        uniqueCache[type] = [dirruns, nodeIndex, diff];
26540                                                        break;
26541                                                    }
26542                                                }
26543
26544                                            } else {
26545
26546                                                // Use previously-cached element index if available
26547                                                if (useCache) {
26548
26549                                                    // ...in a gzip-friendly way
26550                                                    node = elem;
26551                                                    outerCache = node[expando] || (node[expando] = {});
26552
26553                                                    // Support: IE <9 only
26554                                                    // Defend against cloned attroperties (jQuery gh-1709)
26555                                                    uniqueCache = outerCache[node.uniqueID] ||
26556                                                        (outerCache[node.uniqueID] = {});
26557
26558                                                    cache = uniqueCache[type] || [];
26559                                                    nodeIndex = cac
vendor: 16,871 bytes, lines 26559-26875
26559he[0] === dirruns && cache[1];
26560                                                    diff = nodeIndex;
26561                                                }
26562
26563                                                // xml :nth-child(...)
26564                                                // or :nth-last-child(...) or :nth(-last)?-of-type(...)
26565                                                if (diff === false) {
26566
26567                                                    // Use the same loop as above to seek `elem` from the start
26568                                                    while ((node = ++nodeIndex && node && node[dir] ||
26569                                                        (diff = nodeIndex = 0) || start.pop())) {
26570
26571                                                        if ((ofType ?
26572                                                                node.nodeName.toLowerCase() === name :
26573                                                                node.nodeType === 1) &&
26574                                                            ++diff) {
26575
26576                                                            // Cache the index of each encountered element
26577                                                            if (useCache) {
26578                                                                outerCache = node[expando] ||
26579                                                                    (node[expando] = {});
26580
26581                                                                // Support: IE <9 only
26582                                                                // Defend against cloned attroperties (jQuery gh-1709)
26583                                                                uniqueCache = outerCache[node.uniqueID] ||
26584                                                                    (outerCache[node.uniqueID] = {});
26585
26586                                                                uniqueCache[type] = [dirruns, diff];
26587                                                            }
26588
26589                                                            if (node === elem) {
26590                                                                break;
26591                                                            }
26592                                                        }
26593                                                    }
26594                                                }
26595                                            }
26596
26597                                            // Incorporate the offset, then check against cycle size
26598                                            diff -= last;
26599                                            return diff === first || (diff % first === 0 && diff / first >= 0);
26600                                        }
26601                                    };
26602                            },
26603
26604                            "PSEUDO": function (pseudo, argument) {
26605
26606                                // pseudo-class names are case-insensitive
26607                                // http://www.w3.org/TR/selectors/#pseudo-classes
26608                                // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
26609                                // Remember that setFilters inherits from pseudos
26610                                var args,
26611                                    fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] ||
26612                                        Sizzle.error("unsupported pseudo: " + pseudo);
26613
26614                                // The user may use createPseudo to indicate that
26615                                // arguments are needed to create the filter function
26616                                // just as Sizzle does
26617                                if (fn[expando]) {
26618                                    return fn(argument);
26619                                }
26620
26621                                // But maintain support for old signatures
26622                                if (fn.length > 1) {
26623                                    args = [pseudo, pseudo, "", argument];
26624                                    return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ?
26625                                        markFunction(function (seed, matches) {
26626                                            var idx,
26627                                                matched = fn(seed, argument),
26628                                                i = matched.length;
26629                                            while (i--) {
26630                                                idx = indexOf(seed, matched[i]);
26631                                                seed[idx] = !(matches[idx] = matched[i]);
26632                                            }
26633                                        }) :
26634                                        function (elem) {
26635                                            return fn(elem, 0, args);
26636                                        };
26637                                }
26638
26639                                return fn;
26640                            }
26641                        },
26642
26643                        pseudos: {
26644
26645                            // Potentially complex pseudos
26646                            "not": markFunction(function (selector) {
26647
26648                                // Trim the selector passed to compile
26649                                // to avoid treating leading and trailing
26650                                // spaces as combinators
26651                                var input = [],
26652                                    results = [],
26653                                    matcher = compile(selector.replace(rtrim, "$1"));
26654
26655                                return matcher[expando] ?
26656                                    markFunction(function (seed, matches, _context, xml) {
26657                                        var elem,
26658                                            unmatched = matcher(seed, null, xml, []),
26659                                            i = seed.length;
26660
26661                                        // Match elements unmatched by `matcher`
26662                                        while (i--) {
26663                                            if ((elem = unmatched[i])) {
26664                                                seed[i] = !(matches[i] = elem);
26665                                            }
26666                                        }
26667                                    }) :
26668                                    function (elem, _context, xml) {
26669                                        input[0] = elem;
26670                                        matcher(input, null, xml, results);
26671
26672                                        // Don't keep the element (issue #299)
26673                                        input[0] = null;
26674                                        return !results.pop();
26675                                    };
26676                            }),
26677
26678                            "has": markFunction(function (selector) {
26679                                return function (elem) {
26680                                    return Sizzle(selector, elem).length > 0;
26681                                };
26682                            }),
26683
26684                            "contains": markFunction(function (text) {
26685                                text = text.replace(runescape, funescape);
26686                                return function (elem) {
26687                                    return (elem.textContent || getText(elem)).indexOf(text) > -1;
26688                                };
26689                            }),
26690
26691                            // "Whether an element is represented by a :lang() selector
26692                            // is based solely on the element's language value
26693                            // being equal to the identifier C,
26694                            // or beginning with the identifier C immediately followed by "-".
26695                            // The matching of C against the element's language value is performed case-insensitively.
26696                            // The identifier C does not have to be a valid language name."
26697                            // http://www.w3.org/TR/selectors/#lang-pseudo
26698                            "lang": markFunction(function (lang) {
26699
26700                                // lang value must be a valid identifier
26701                                if (!ridentifier.test(lang || "")) {
26702                                    Sizzle.error("unsupported lang: " + lang);
26703                                }
26704                                lang = lang.replace(runescape, funescape).toLowerCase();
26705                                return function (elem) {
26706                                    var elemLang;
26707                                    do {
26708                                        if ((elemLang = documentIsHTML ?
26709                                            elem.lang :
26710                                            elem.getAttribute("xml:lang") || elem.getAttribute("lang"))) {
26711
26712                                            elemLang = elemLang.toLowerCase();
26713                                            return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
26714                                        }
26715                                    } while ((elem = elem.parentNode) && elem.nodeType === 1);
26716                                    return false;
26717                                };
26718                            }),
26719
26720                            // Miscellaneous
26721                            "target": function (elem) {
26722                                var hash = window.location && window.location.hash;
26723                                return hash && hash.slice(1) === elem.id;
26724                            },
26725
26726                            "root": function (elem) {
26727                                return elem === docElem;
26728                            },
26729
26730                            "focus": function (elem) {
26731                                return elem === document.activeElement &&
26732                                    (!document.hasFocus || document.hasFocus()) &&
26733                                    !!(elem.type || elem.href || ~elem.tabIndex);
26734                            },
26735
26736                            // Boolean properties
26737                            "enabled": createDisabledPseudo(false),
26738                            "disabled": createDisabledPseudo(true),
26739
26740                            "checked": function (elem) {
26741
26742                                // In CSS3, :checked should return both checked and selected elements
26743                                // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
26744                                var nodeName = elem.nodeName.toLowerCase();
26745                                return (nodeName === "input" && !!elem.checked) ||
26746                                    (nodeName === "option" && !!elem.selected);
26747                            },
26748
26749                            "selected": function (elem) {
26750
26751                                // Accessing this property makes selected-by-default
26752                                // options in Safari work properly
26753                                if (elem.parentNode) {
26754                                    // eslint-disable-next-line no-unused-expressions
26755                                    elem.parentNode.selectedIndex;
26756                                }
26757
26758                                return elem.selected === true;
26759                            },
26760
26761                            // Contents
26762                            "empty": function (elem) {
26763
26764                                // http://www.w3.org/TR/selectors/#empty-pseudo
26765                                // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
26766                                //   but not by others (comment: 8; processing instruction: 7; etc.)
26767                                // nodeType < 6 works because attributes (2) do not appear as children
26768                                for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
26769                                    if (elem.nodeType < 6) {
26770                                        return false;
26771                                    }
26772                                }
26773                                return true;
26774                            },
26775
26776                            "parent": function (elem) {
26777                                return !Expr.pseudos["empty"](elem);
26778                            },
26779
26780                            // Element/input types
26781                            "header": function (elem) {
26782                                return rheader.test(elem.nodeName);
26783                            },
26784
26785                            "input": function (elem) {
26786                                return rinputs.test(elem.nodeName);
26787                            },
26788
26789                            "button": function (elem) {
26790                                var name = elem.nodeName.toLowerCase();
26791                                return name === "input" && elem.type === "button" || name === "button";
26792                            },
26793
26794                            "text": function (elem) {
26795                                var attr;
26796                                return elem.nodeName.toLowerCase() === "input" &&
26797                                    elem.type === "text" &&
26798
26799                                    // Support: IE<8
26800                                    // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
26801                                    ((attr = elem.getAttribute("type")) == null ||
26802                                        attr.toLowerCase() === "text");
26803                            },
26804
26805                            // Position-in-collection
26806                            "first": createPositionalPseudo(function () {
26807                                return [0];
26808                            }),
26809
26810                            "last": createPositionalPseudo(function (_matchIndexes, length) {
26811                                return [length - 1];
26812                            }),
26813
26814                            "eq": createPositionalPseudo(function (_matchIndexes, length, argument) {
26815                                return [argument < 0 ? argument + length : argument];
26816                            }),
26817
26818                            "even": createPositionalPseudo(function (matchIndexes, length) {
26819                                var i = 0;
26820                                for (; i < length; i += 2) {
26821                                    matchIndexes.push(i);
26822                                }
26823                                return matchIndexes;
26824                            }),
26825
26826                            "odd": createPositionalPseudo(function (matchIndexes, length) {
26827                                var i = 1;
26828                                for (; i < length; i += 2) {
26829                                    matchIndexes.push(i);
26830                                }
26831                                return matchIndexes;
26832                            }),
26833
26834                            "lt": createPositionalPseudo(function (matchIndexes, length, argument) {
26835                                var i = argument < 0 ?
26836                                    argument + length :
26837                                    argument > length ?
26838                                        length :
26839                                        argument;
26840                                for (; --i >= 0;) {
26841                                    matchIndexes.push(i);
26842                                }
26843                                return matchIndexes;
26844                            }),
26845
26846                            "gt": createPositionalPseudo(function (matchIndexes, length, argument) {
26847                                var i = argument < 0 ? argument + length : argument;
26848                                for (; ++i < length;) {
26849                                    matchIndexes.push(i);
26850                                }
26851                                return matchIndexes;
26852                            })
26853                        }
26854                    };
26855
26856                    Expr.pseudos["nth"] = Expr.pseudos["eq"];
26857
26858// Add button/input type pseudos
26859                    for (i in {radio: true, checkbox: true, file: true, password: true, image: true}) {
26860                        Expr.pseudos[i] = createInputPseudo(i);
26861                    }
26862                    for (i in {submit: true, reset: true}) {
26863                        Expr.pseudos[i] = createButtonPseudo(i);
26864                    }
26865
26866// Easy API for creating new setFilters
26867                    function setFilters() {
26868                    }
26869
26870                    setFilters.prototype = Expr.filters = Expr.pseudos;
26871                    Expr.setFilters = new setFilters();
26872
26873                    tokenize = Sizzle.tokenize = function (selector, parseOnly) {
26874                        var matched, match, tokens, type,
26875                            soFar, groups, preFilters,
vendor: 14,279 bytes, lines 26876-27168
26876                            cached = tokenCache[selector + " "];
26877
26878                        if (cached) {
26879                            return parseOnly ? 0 : cached.slice(0);
26880                        }
26881
26882                        soFar = selector;
26883                        groups = [];
26884                        preFilters = Expr.preFilter;
26885
26886                        while (soFar) {
26887
26888                            // Comma and first run
26889                            if (!matched || (match = rcomma.exec(soFar))) {
26890                                if (match) {
26891
26892                                    // Don't consume trailing commas as valid
26893                                    soFar = soFar.slice(match[0].length) || soFar;
26894                                }
26895                                groups.push((tokens = []));
26896                            }
26897
26898                            matched = false;
26899
26900                            // Combinators
26901                            if ((match = rcombinators.exec(soFar))) {
26902                                matched = match.shift();
26903                                tokens.push({
26904                                    value: matched,
26905
26906                                    // Cast descendant combinators to space
26907                                    type: match[0].replace(rtrim, " ")
26908                                });
26909                                soFar = soFar.slice(matched.length);
26910                            }
26911
26912                            // Filters
26913                            for (type in Expr.filter) {
26914                                if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] ||
26915                                    (match = preFilters[type](match)))) {
26916                                    matched = match.shift();
26917                                    tokens.push({
26918                                        value: matched,
26919                                        type: type,
26920                                        matches: match
26921                                    });
26922                                    soFar = soFar.slice(matched.length);
26923                                }
26924                            }
26925
26926                            if (!matched) {
26927                                break;
26928                            }
26929                        }
26930
26931                        // Return the length of the invalid excess
26932                        // if we're just parsing
26933                        // Otherwise, throw an error or return tokens
26934                        return parseOnly ?
26935                            soFar.length :
26936                            soFar ?
26937                                Sizzle.error(selector) :
26938
26939                                // Cache the tokens
26940                                tokenCache(selector, groups).slice(0);
26941                    };
26942
26943                    function toSelector(tokens) {
26944                        var i = 0,
26945                            len = tokens.length,
26946                            selector = "";
26947                        for (; i < len; i++) {
26948                            selector += tokens[i].value;
26949                        }
26950                        return selector;
26951                    }
26952
26953                    function addCombinator(matcher, combinator, base) {
26954                        var dir = combinator.dir,
26955                            skip = combinator.next,
26956                            key = skip || dir,
26957                            checkNonElements = base && key === "parentNode",
26958                            doneName = done++;
26959
26960                        return combinator.first ?
26961
26962                            // Check against closest ancestor/preceding element
26963                            function (elem, context, xml) {
26964                                while ((elem = elem[dir])) {
26965                                    if (elem.nodeType === 1 || checkNonElements) {
26966                                        return matcher(elem, context, xml);
26967                                    }
26968                                }
26969                                return false;
26970                            } :
26971
26972                            // Check against all ancestor/preceding elements
26973                            function (elem, context, xml) {
26974                                var oldCache, uniqueCache, outerCache,
26975                                    newCache = [dirruns, doneName];
26976
26977                                // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
26978                                if (xml) {
26979                                    while ((elem = elem[dir])) {
26980                                        if (elem.nodeType === 1 || checkNonElements) {
26981                                            if (matcher(elem, context, xml)) {
26982                                                return true;
26983                                            }
26984                                        }
26985                                    }
26986                                } else {
26987                                    while ((elem = elem[dir])) {
26988                                        if (elem.nodeType === 1 || checkNonElements) {
26989                                            outerCache = elem[expando] || (elem[expando] = {});
26990
26991                                            // Support: IE <9 only
26992                                            // Defend against cloned attroperties (jQuery gh-1709)
26993                                            uniqueCache = outerCache[elem.uniqueID] ||
26994                                                (outerCache[elem.uniqueID] = {});
26995
26996                                            if (skip && skip === elem.nodeName.toLowerCase()) {
26997                                                elem = elem[dir] || elem;
26998                                            } else if ((oldCache = uniqueCache[key]) &&
26999                                                oldCache[0] === dirruns && oldCache[1] === doneName) {
27000
27001                                                // Assign to newCache so results back-propagate to previous elements
27002                                                return (newCache[2] = oldCache[2]);
27003                                            } else {
27004
27005                                                // Reuse newcache so results back-propagate to previous elements
27006                                                uniqueCache[key] = newCache;
27007
27008                                                // A match means we're done; a fail means we have to keep checking
27009                                                if ((newCache[2] = matcher(elem, context, xml))) {
27010                                                    return true;
27011                                                }
27012                                            }
27013                                        }
27014                                    }
27015                                }
27016                                return false;
27017                            };
27018                    }
27019
27020                    function elementMatcher(matchers) {
27021                        return matchers.length > 1 ?
27022                            function (elem, context, xml) {
27023                                var i = matchers.length;
27024                                while (i--) {
27025                                    if (!matchers[i](elem, context, xml)) {
27026                                        return false;
27027                                    }
27028                                }
27029                                return true;
27030                            } :
27031                            matchers[0];
27032                    }
27033
27034                    function multipleContexts(selector, contexts, results) {
27035                        var i = 0,
27036                            len = contexts.length;
27037                        for (; i < len; i++) {
27038                            Sizzle(selector, contexts[i], results);
27039                        }
27040                        return results;
27041                    }
27042
27043                    function condense(unmatched, map, filter, context, xml) {
27044                        var elem,
27045                            newUnmatched = [],
27046                            i = 0,
27047                            len = unmatched.length,
27048                            mapped = map != null;
27049
27050                        for (; i < len; i++) {
27051                            if ((elem = unmatched[i])) {
27052                                if (!filter || filter(elem, context, xml)) {
27053                                    newUnmatched.push(elem);
27054                                    if (mapped) {
27055                                        map.push(i);
27056                                    }
27057                                }
27058                            }
27059                        }
27060
27061                        return newUnmatched;
27062                    }
27063
27064                    function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
27065                        if (postFilter && !postFilter[expando]) {
27066                            postFilter = setMatcher(postFilter);
27067                        }
27068                        if (postFinder && !postFinder[expando]) {
27069                            postFinder = setMatcher(postFinder, postSelector);
27070                        }
27071                        return markFunction(function (seed, results, context, xml) {
27072                            var temp, i, elem,
27073                                preMap = [],
27074                                postMap = [],
27075                                preexisting = results.length,
27076
27077                                // Get initial elements from seed or context
27078                                elems = seed || multipleContexts(
27079                                    selector || "*",
27080                                    context.nodeType ? [context] : context,
27081                                    []
27082                                ),
27083
27084                                // Prefilter to get matcher input, preserving a map for seed-results synchronization
27085                                matcherIn = preFilter && (seed || !selector) ?
27086                                    condense(elems, preMap, preFilter, context, xml) :
27087                                    elems,
27088
27089                                matcherOut = matcher ?
27090
27091                                    // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
27092                                    postFinder || (seed ? preFilter : preexisting || postFilter) ?
27093
27094                                        // ...intermediate processing is necessary
27095                                        [] :
27096
27097                                        // ...otherwise use results directly
27098                                        results :
27099                                    matcherIn;
27100
27101                            // Find primary matches
27102                            if (matcher) {
27103                                matcher(matcherIn, matcherOut, context, xml);
27104                            }
27105
27106                            // Apply postFilter
27107                            if (postFilter) {
27108                                temp = condense(matcherOut, postMap);
27109                                postFilter(temp, [], context, xml);
27110
27111                                // Un-match failing elements by moving them back to matcherIn
27112                                i = temp.length;
27113                                while (i--) {
27114                                    if ((elem = temp[i])) {
27115                                        matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
27116                                    }
27117                                }
27118                            }
27119
27120                            if (seed) {
27121                                if (postFinder || preFilter) {
27122                                    if (postFinder) {
27123
27124                                        // Get the final matcherOut by condensing this intermediate into postFinder contexts
27125                                        temp = [];
27126                                        i = matcherOut.length;
27127                                        while (i--) {
27128                                            if ((elem = matcherOut[i])) {
27129
27130                                                // Restore matcherIn since elem is not yet a final match
27131                                                temp.push((matcherIn[i] = elem));
27132                                            }
27133                                        }
27134                                        postFinder(null, (matcherOut = []), temp, xml);
27135                                    }
27136
27137                                    // Move matched elements from seed to results to keep them synchronized
27138                                    i = matcherOut.length;
27139                                    while (i--) {
27140                                        if ((elem = matcherOut[i]) &&
27141                                            (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {
27142
27143                                            seed[temp] = !(results[temp] = elem);
27144                                        }
27145                                    }
27146                                }
27147
27148                                // Add elements to results, through postFinder if defined
27149                            } else {
27150                                matcherOut = condense(
27151                                    matcherOut === results ?
27152                                        matcherOut.splice(preexisting, matcherOut.length) :
27153                                        matcherOut
27154                                );
27155                                if (postFinder) {
27156                                    postFinder(null, results, matcherOut, xml);
27157                                } else {
27158                                    push.apply(results, matcherOut);
27159                                }
27160                            }
27161                        });
27162                    }
27163
27164                    function matcherFromTokens(tokens) {
27165                        var checkContext, matcher, j,
27166                            len = tokens.length,
27167                            leadingRelative = Expr.relative[tokens[0].type],
27168                            implicitRelative = leadingRelative || Expr.relative[" "],
vendor: 4,439 bytes, lines 27169-27245
27169                            i = leadingRelative ? 1 : 0,
27170
27171                            // The foundational matcher ensures that elements are reachable from top-level context(s)
27172                            matchContext = addCombinator(function (elem) {
27173                                return elem === checkContext;
27174                            }, implicitRelative, true),
27175                            matchAnyContext = addCombinator(function (elem) {
27176                                return indexOf(checkContext, elem) > -1;
27177                            }, implicitRelative, true),
27178                            matchers = [function (elem, context, xml) {
27179                                var ret = (!leadingRelative && (xml || context !== outermostContext)) || (
27180                                    (checkContext = context).nodeType ?
27181                                        matchContext(elem, context, xml) :
27182                                        matchAnyContext(elem, context, xml));
27183
27184                                // Avoid hanging onto element (issue #299)
27185                                checkContext = null;
27186                                return ret;
27187                            }];
27188
27189                        for (; i < len; i++) {
27190                            if ((matcher = Expr.relative[tokens[i].type])) {
27191                                matchers = [addCombinator(elementMatcher(matchers), matcher)];
27192                            } else {
27193                                matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
27194
27195                                // Return special upon seeing a positional matcher
27196                                if (matcher[expando]) {
27197
27198                                    // Find the next relative operator (if any) for proper handling
27199                                    j = ++i;
27200                                    for (; j < len; j++) {
27201                                        if (Expr.relative[tokens[j].type]) {
27202                                            break;
27203                                        }
27204                                    }
27205                                    return setMatcher(
27206                                        i > 1 && elementMatcher(matchers),
27207                                        i > 1 && toSelector(
27208                                            // If the preceding token was a descendant combinator, insert an implicit any-element `*`
27209                                            tokens
27210                                                .slice(0, i - 1)
27211                                                .concat({value: tokens[i - 2].type === " " ? "*" : ""})
27212                                        ).replace(rtrim, "$1"),
27213                                        matcher,
27214                                        i < j && matcherFromTokens(tokens.slice(i, j)),
27215                                        j < len && matcherFromTokens((tokens = tokens.slice(j))),
27216                                        j < len && toSelector(tokens)
27217                                    );
27218                                }
27219                                matchers.push(matcher);
27220                            }
27221                        }
27222
27223                        return elementMatcher(matchers);
27224                    }
27225
27226                    function matcherFromGroupMatchers(elementMatchers, setMatchers) {
27227                        var bySet = setMatchers.length > 0,
27228                            byElement = elementMatchers.length > 0,
27229                            superMatcher = function (seed, context, xml, results, outermost) {
27230                                var elem, j, matcher,
27231                                    matchedCount = 0,
27232                                    i = "0",
27233                                    unmatched = seed && [],
27234                                    setMatched = [],
27235                                    contextBackup = outermostContext,
27236
27237                                    // We must always have either seed elements or outermost context
27238                                    elems = seed || byElement && Expr.find["TAG"]("*", outermost),
27239
27240                                    // Use integer dirruns iff this is the outermost matcher
27241                                    dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
27242                                    len = elems.length;
27243
27244                                if (outermost) {
27245
vendor: 10,483 bytes, lines 27246-27437
27246                                    // Support: IE 11+, Edge 17 - 18+
27247                                    // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
27248                                    // two documents; shallow comparisons work.
27249                                    // eslint-disable-next-line eqeqeq
27250                                    outermostContext = context == document || context || outermost;
27251                                }
27252
27253                                // Add elements passing elementMatchers directly to results
27254                                // Support: IE<9, Safari
27255                                // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
27256                                for (; i !== len && (elem = elems[i]) != null; i++) {
27257                                    if (byElement && elem) {
27258                                        j = 0;
27259
27260                                        // Support: IE 11+, Edge 17 - 18+
27261                                        // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
27262                                        // two documents; shallow comparisons work.
27263                                        // eslint-disable-next-line eqeqeq
27264                                        if (!context && elem.ownerDocument != document) {
27265                                            setDocument(elem);
27266                                            xml = !documentIsHTML;
27267                                        }
27268                                        while ((matcher = elementMatchers[j++])) {
27269                                            if (matcher(elem, context || document, xml)) {
27270                                                results.push(elem);
27271                                                break;
27272                                            }
27273                                        }
27274                                        if (outermost) {
27275                                            dirruns = dirrunsUnique;
27276                                        }
27277                                    }
27278
27279                                    // Track unmatched elements for set filters
27280                                    if (bySet) {
27281
27282                                        // They will have gone through all possible matchers
27283                                        if ((elem = !matcher && elem)) {
27284                                            matchedCount--;
27285                                        }
27286
27287                                        // Lengthen the array for every element, matched or not
27288                                        if (seed) {
27289                                            unmatched.push(elem);
27290                                        }
27291                                    }
27292                                }
27293
27294                                // `i` is now the count of elements visited above, and adding it to `matchedCount`
27295                                // makes the latter nonnegative.
27296                                matchedCount += i;
27297
27298                                // Apply set filters to unmatched elements
27299                                // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
27300                                // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
27301                                // no element matchers and no seed.
27302                                // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
27303                                // case, which will result in a "00" `matchedCount` that differs from `i` but is also
27304                                // numerically zero.
27305                                if (bySet && i !== matchedCount) {
27306                                    j = 0;
27307                                    while ((matcher = setMatchers[j++])) {
27308                                        matcher(unmatched, setMatched, context, xml);
27309                                    }
27310
27311                                    if (seed) {
27312
27313                                        // Reintegrate element matches to eliminate the need for sorting
27314                                        if (matchedCount > 0) {
27315                                            while (i--) {
27316                                                if (!(unmatched[i] || setMatched[i])) {
27317                                                    setMatched[i] = pop.call(results);
27318                                                }
27319                                            }
27320                                        }
27321
27322                                        // Discard index placeholder values to get only actual matches
27323                                        setMatched = condense(setMatched);
27324                                    }
27325
27326                                    // Add matches to results
27327                                    push.apply(results, setMatched);
27328
27329                                    // Seedless set matches succeeding multiple successful matchers stipulate sorting
27330                                    if (outermost && !seed && setMatched.length > 0 &&
27331                                        (matchedCount + setMatchers.length) > 1) {
27332
27333                                        Sizzle.uniqueSort(results);
27334                                    }
27335                                }
27336
27337                                // Override manipulation of globals by nested matchers
27338                                if (outermost) {
27339                                    dirruns = dirrunsUnique;
27340                                    outermostContext = contextBackup;
27341                                }
27342
27343                                return unmatched;
27344                            };
27345
27346                        return bySet ?
27347                            markFunction(superMatcher) :
27348                            superMatcher;
27349                    }
27350
27351                    compile = Sizzle.compile = function (selector, match /* Internal Use Only */) {
27352                        var i,
27353                            setMatchers = [],
27354                            elementMatchers = [],
27355                            cached = compilerCache[selector + " "];
27356
27357                        if (!cached) {
27358
27359                            // Generate a function of recursive functions that can be used to check each element
27360                            if (!match) {
27361                                match = tokenize(selector);
27362                            }
27363                            i = match.length;
27364                            while (i--) {
27365                                cached = matcherFromTokens(match[i]);
27366                                if (cached[expando]) {
27367                                    setMatchers.push(cached);
27368                                } else {
27369                                    elementMatchers.push(cached);
27370                                }
27371                            }
27372
27373                            // Cache the compiled function
27374                            cached = compilerCache(
27375                                selector,
27376                                matcherFromGroupMatchers(elementMatchers, setMatchers)
27377                            );
27378
27379                            // Save selector and tokenization
27380                            cached.selector = selector;
27381                        }
27382                        return cached;
27383                    };
27384
27385                    /**
27386                     * A low-level selection function that works with Sizzle's compiled
27387                     *  selector functions
27388                     * @param {String|Function} selector A selector or a pre-compiled
27389                     *  selector function built with Sizzle.compile
27390                     * @param {Element} context
27391                     * @param {Array} [results]
27392                     * @param {Array} [seed] A set of elements to match against
27393                     */
27394                    select = Sizzle.select = function (selector, context, results, seed) {
27395                        var i, tokens, token, type, find,
27396                            compiled = typeof selector === "function" && selector,
27397                            match = !seed && tokenize((selector = compiled.selector || selector));
27398
27399                        results = results || [];
27400
27401                        // Try to minimize operations if there is only one selector in the list and no seed
27402                        // (the latter of which guarantees us context)
27403                        if (match.length === 1) {
27404
27405                            // Reduce context if the leading compound selector is an ID
27406                            tokens = match[0] = match[0].slice(0);
27407                            if (tokens.length > 2 && (token = tokens[0]).type === "ID" &&
27408                                context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
27409
27410                                context = (Expr.find["ID"](token.matches[0]
27411                                    .replace(runescape, funescape), context) || [])[0];
27412                                if (!context) {
27413                                    return results;
27414
27415                                    // Precompiled matchers will still verify ancestry, so step up a level
27416                                } else if (compiled) {
27417                                    context = context.parentNode;
27418                                }
27419
27420                                selector = selector.slice(tokens.shift().value.length);
27421                            }
27422
27423                            // Fetch a seed set for right-to-left matching
27424                            i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
27425                            while (i--) {
27426                                token = tokens[i];
27427
27428                                // Abort if we hit a combinator
27429                                if (Expr.relative[(type = token.type)]) {
27430                                    break;
27431                                }
27432                                if ((find = Expr.find[type])) {
27433
27434                                    // Search, expanding context for leading sibling combinators
27435                                    if ((seed = find(
27436                                        token.matches[0].replace(runescape, funescape),
27437                                        rsibling.test(tokens[0].type) && testC
vendor: 9,961 bytes, lines 27437-27695
27437ontext(context.parentNode) ||
27438                                        context
27439                                    ))) {
27440
27441                                        // If seed is empty or no tokens remain, we can return early
27442                                        tokens.splice(i, 1);
27443                                        selector = seed.length && toSelector(tokens);
27444                                        if (!selector) {
27445                                            push.apply(results, seed);
27446                                            return results;
27447                                        }
27448
27449                                        break;
27450                                    }
27451                                }
27452                            }
27453                        }
27454
27455                        // Compile and execute a filtering function if one is not provided
27456                        // Provide `match` to avoid retokenization if we modified the selector above
27457                        (compiled || compile(selector, match))(
27458                            seed,
27459                            context,
27460                            !documentIsHTML,
27461                            results,
27462                            !context || rsibling.test(selector) && testContext(context.parentNode) || context
27463                        );
27464                        return results;
27465                    };
27466
27467// One-time assignments
27468
27469// Sort stability
27470                    support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
27471
27472// Support: Chrome 14-35+
27473// Always assume duplicates if they aren't passed to the comparison function
27474                    support.detectDuplicates = !!hasDuplicate;
27475
27476// Initialize against the default document
27477                    setDocument();
27478
27479// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
27480// Detached nodes confoundingly follow *each other*
27481                    support.sortDetached = assert(function (el) {
27482
27483                        // Should return 1, but returns 4 (following)
27484                        return el.compareDocumentPosition(document.createElement("fieldset")) & 1;
27485                    });
27486
27487// Support: IE<8
27488// Prevent attribute/property "interpolation"
27489// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
27490                    if (!assert(function (el) {
27491                        el.innerHTML = "<a href='#'></a>";
27492                        return el.firstChild.getAttribute("href") === "#";
27493                    })) {
27494                        addHandle("type|href|height|width", function (elem, name, isXML) {
27495                            if (!isXML) {
27496                                return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2);
27497                            }
27498                        });
27499                    }
27500
27501// Support: IE<9
27502// Use defaultValue in place of getAttribute("value")
27503                    if (!support.attributes || !assert(function (el) {
27504                        el.innerHTML = "<input/>";
27505                        el.firstChild.setAttribute("value", "");
27506                        return el.firstChild.getAttribute("value") === "";
27507                    })) {
27508                        addHandle("value", function (elem, _name, isXML) {
27509                            if (!isXML && elem.nodeName.toLowerCase() === "input") {
27510                                return elem.defaultValue;
27511                            }
27512                        });
27513                    }
27514
27515// Support: IE<9
27516// Use getAttributeNode to fetch booleans when getAttribute lies
27517                    if (!assert(function (el) {
27518                        return el.getAttribute("disabled") == null;
27519                    })) {
27520                        addHandle(booleans, function (elem, name, isXML) {
27521                            var val;
27522                            if (!isXML) {
27523                                return elem[name] === true ? name.toLowerCase() :
27524                                    (val = elem.getAttributeNode(name)) && val.specified ?
27525                                        val.value :
27526                                        null;
27527                            }
27528                        });
27529                    }
27530
27531                    return Sizzle;
27532
27533                })(window);
27534
27535
27536            jQuery.find = Sizzle;
27537            jQuery.expr = Sizzle.selectors;
27538
27539// Deprecated
27540            jQuery.expr[":"] = jQuery.expr.pseudos;
27541            jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
27542            jQuery.text = Sizzle.getText;
27543            jQuery.isXMLDoc = Sizzle.isXML;
27544            jQuery.contains = Sizzle.contains;
27545            jQuery.escapeSelector = Sizzle.escape;
27546
27547
27548            var dir = function (elem, dir, until) {
27549                var matched = [],
27550                    truncate = until !== undefined;
27551
27552                while ((elem = elem[dir]) && elem.nodeType !== 9) {
27553                    if (elem.nodeType === 1) {
27554                        if (truncate && jQuery(elem).is(until)) {
27555                            break;
27556                        }
27557                        matched.push(elem);
27558                    }
27559                }
27560                return matched;
27561            };
27562
27563
27564            var siblings = function (n, elem) {
27565                var matched = [];
27566
27567                for (; n; n = n.nextSibling) {
27568                    if (n.nodeType === 1 && n !== elem) {
27569                        matched.push(n);
27570                    }
27571                }
27572
27573                return matched;
27574            };
27575
27576
27577            var rneedsContext = jQuery.expr.match.needsContext;
27578
27579
27580            function nodeName(elem, name) {
27581
27582                return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
27583
27584            };
27585            var rsingleTag = (/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i);
27586
27587
27588// Implement the identical functionality for filter and not
27589            function winnow(elements, qualifier, not) {
27590                if (isFunction(qualifier)) {
27591                    return jQuery.grep(elements, function (elem, i) {
27592                        return !!qualifier.call(elem, i, elem) !== not;
27593                    });
27594                }
27595
27596                // Single element
27597                if (qualifier.nodeType) {
27598                    return jQuery.grep(elements, function (elem) {
27599                        return (elem === qualifier) !== not;
27600                    });
27601                }
27602
27603                // Arraylike of elements (jQuery, arguments, Array)
27604                if (typeof qualifier !== "string") {
27605                    return jQuery.grep(elements, function (elem) {
27606                        return (indexOf.call(qualifier, elem) > -1) !== not;
27607                    });
27608                }
27609
27610                // Filtered directly for both simple and complex selectors
27611                return jQuery.filter(qualifier, elements, not);
27612            }
27613
27614            jQuery.filter = function (expr, elems, not) {
27615                var elem = elems[0];
27616
27617                if (not) {
27618                    expr = ":not(" + expr + ")";
27619                }
27620
27621                if (elems.length === 1 && elem.nodeType === 1) {
27622                    return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];
27623                }
27624
27625                return jQuery.find.matches(expr, jQuery.grep(elems, function (elem) {
27626                    return elem.nodeType === 1;
27627                }));
27628            };
27629
27630            jQuery.fn.extend({
27631                find: function (selector) {
27632                    var i, ret,
27633                        len = this.length,
27634                        self = this;
27635
27636                    if (typeof selector !== "string") {
27637                        return this.pushStack(jQuery(selector).filter(function () {
27638                            for (i = 0; i < len; i++) {
27639                                if (jQuery.contains(self[i], this)) {
27640                                    return true;
27641                                }
27642                            }
27643                        }));
27644                    }
27645
27646                    ret = this.pushStack([]);
27647
27648                    for (i = 0; i < len; i++) {
27649                        jQuery.find(selector, self[i], ret);
27650                    }
27651
27652                    return len > 1 ? jQuery.uniqueSort(ret) : ret;
27653                },
27654                filter: function (selector) {
27655                    return this.pushStack(winnow(this, selector || [], false));
27656                },
27657                not: function (selector) {
27658                    return this.pushStack(winnow(this, selector || [], true));
27659                },
27660                is: function (selector) {
27661                    return !!winnow(
27662                        this,
27663
27664                        // If this is a positional/relative selector, check membership in the returned set
27665                        // so $("p:first").is("p:last") won't return true for a doc with two "p".
27666                        typeof selector === "string" && rneedsContext.test(selector) ?
27667                            jQuery(selector) :
27668                            selector || [],
27669                        false
27670                    ).length;
27671                }
27672            });
27673
27674
27675// Initialize a jQuery object
27676
27677
27678// A central reference to the root jQuery(document)
27679            var rootjQuery,
27680
27681                // A simple way to check for HTML strings
27682                // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
27683                // Strict HTML recognition (#11290: must start with <)
27684                // Shortcut simple #id case for speed
27685                rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
27686
27687                init = jQuery.fn.init = function (selector, context, root) {
27688                    var match, elem;
27689
27690                    // HANDLE: $(""), $(null), $(undefined), $(false)
27691                    if (!selector) {
27692                        return this;
27693                    }
27694
27695                    // Method init() accepts an alternate rootjQuery
vendor: 49,996 bytes, lines 27696-28852
27696                    // so migrate can support jQuery.sub (gh-2101)
27697                    root = root || rootjQuery;
27698
27699                    // Handle HTML strings
27700                    if (typeof selector === "string") {
27701                        if (selector[0] === "<" &&
27702                            selector[selector.length - 1] === ">" &&
27703                            selector.length >= 3) {
27704
27705                            // Assume that strings that start and end with <> are HTML and skip the regex check
27706                            match = [null, selector, null];
27707
27708                        } else {
27709                            match = rquickExpr.exec(selector);
27710                        }
27711
27712                        // Match html or make sure no context is specified for #id
27713                        if (match && (match[1] || !context)) {
27714
27715                            // HANDLE: $(html) -> $(array)
27716                            if (match[1]) {
27717                                context = context instanceof jQuery ? context[0] : context;
27718
27719                                // Option to run scripts is true for back-compat
27720                                // Intentionally let the error be thrown if parseHTML is not present
27721                                jQuery.merge(this, jQuery.parseHTML(
27722                                    match[1],
27723                                    context && context.nodeType ? context.ownerDocument || context : document,
27724                                    true
27725                                ));
27726
27727                                // HANDLE: $(html, props)
27728                                if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
27729                                    for (match in context) {
27730
27731                                        // Properties of context are called as methods if possible
27732                                        if (isFunction(this[match])) {
27733                                            this[match](context[match]);
27734
27735                                            // ...and otherwise set as attributes
27736                                        } else {
27737                                            this.attr(match, context[match]);
27738                                        }
27739                                    }
27740                                }
27741
27742                                return this;
27743
27744                                // HANDLE: $(#id)
27745                            } else {
27746                                elem = document.getElementById(match[2]);
27747
27748                                if (elem) {
27749
27750                                    // Inject the element directly into the jQuery object
27751                                    this[0] = elem;
27752                                    this.length = 1;
27753                                }
27754                                return this;
27755                            }
27756
27757                            // HANDLE: $(expr, $(...))
27758                        } else if (!context || context.jquery) {
27759                            return (context || root).find(selector);
27760
27761                            // HANDLE: $(expr, context)
27762                            // (which is just equivalent to: $(context).find(expr)
27763                        } else {
27764                            return this.constructor(context).find(selector);
27765                        }
27766
27767                        // HANDLE: $(DOMElement)
27768                    } else if (selector.nodeType) {
27769                        this[0] = selector;
27770                        this.length = 1;
27771                        return this;
27772
27773                        // HANDLE: $(function)
27774                        // Shortcut for document ready
27775                    } else if (isFunction(selector)) {
27776                        return root.ready !== undefined ?
27777                            root.ready(selector) :
27778
27779                            // Execute immediately if ready is not present
27780                            selector(jQuery);
27781                    }
27782
27783                    return jQuery.makeArray(selector, this);
27784                };
27785
27786// Give the init function the jQuery prototype for later instantiation
27787            init.prototype = jQuery.fn;
27788
27789// Initialize central reference
27790            rootjQuery = jQuery(document);
27791
27792
27793            var rparentsprev = /^(?:parents|prev(?:Until|All))/,
27794
27795                // Methods guaranteed to produce a unique set when starting from a unique set
27796                guaranteedUnique = {
27797                    children: true,
27798                    contents: true,
27799                    next: true,
27800                    prev: true
27801                };
27802
27803            jQuery.fn.extend({
27804                has: function (target) {
27805                    var targets = jQuery(target, this),
27806                        l = targets.length;
27807
27808                    return this.filter(function () {
27809                        var i = 0;
27810                        for (; i < l; i++) {
27811                            if (jQuery.contains(this, targets[i])) {
27812                                return true;
27813                            }
27814                        }
27815                    });
27816                },
27817
27818                closest: function (selectors, context) {
27819                    var cur,
27820                        i = 0,
27821                        l = this.length,
27822                        matched = [],
27823                        targets = typeof selectors !== "string" && jQuery(selectors);
27824
27825                    // Positional selectors never match, since there's no _selection_ context
27826                    if (!rneedsContext.test(selectors)) {
27827                        for (; i < l; i++) {
27828                            for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
27829
27830                                // Always skip document fragments
27831                                if (cur.nodeType < 11 && (targets ?
27832                                    targets.index(cur) > -1 :
27833
27834                                    // Don't pass non-elements to Sizzle
27835                                    cur.nodeType === 1 &&
27836                                    jQuery.find.matchesSelector(cur, selectors))) {
27837
27838                                    matched.push(cur);
27839                                    break;
27840                                }
27841                            }
27842                        }
27843                    }
27844
27845                    return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);
27846                },
27847
27848                // Determine the position of an element within the set
27849                index: function (elem) {
27850
27851                    // No argument, return index in parent
27852                    if (!elem) {
27853                        return (this[0] && this[0].parentNode) ? this.first().prevAll().length : -1;
27854                    }
27855
27856                    // Index in selector
27857                    if (typeof elem === "string") {
27858                        return indexOf.call(jQuery(elem), this[0]);
27859                    }
27860
27861                    // Locate the position of the desired element
27862                    return indexOf.call(this,
27863
27864                        // If it receives a jQuery object, the first element is used
27865                        elem.jquery ? elem[0] : elem
27866                    );
27867                },
27868
27869                add: function (selector, context) {
27870                    return this.pushStack(
27871                        jQuery.uniqueSort(
27872                            jQuery.merge(this.get(), jQuery(selector, context))
27873                        )
27874                    );
27875                },
27876
27877                addBack: function (selector) {
27878                    return this.add(selector == null ?
27879                        this.prevObject : this.prevObject.filter(selector)
27880                    );
27881                }
27882            });
27883
27884            function sibling(cur, dir) {
27885                while ((cur = cur[dir]) && cur.nodeType !== 1) {
27886                }
27887                return cur;
27888            }
27889
27890            jQuery.each({
27891                parent: function (elem) {
27892                    var parent = elem.parentNode;
27893                    return parent && parent.nodeType !== 11 ? parent : null;
27894                },
27895                parents: function (elem) {
27896                    return dir(elem, "parentNode");
27897                },
27898                parentsUntil: function (elem, _i, until) {
27899                    return dir(elem, "parentNode", until);
27900                },
27901                next: function (elem) {
27902                    return sibling(elem, "nextSibling");
27903                },
27904                prev: function (elem) {
27905                    return sibling(elem, "previousSibling");
27906                },
27907                nextAll: function (elem) {
27908                    return dir(elem, "nextSibling");
27909                },
27910                prevAll: function (elem) {
27911                    return dir(elem, "previousSibling");
27912                },
27913                nextUntil: function (elem, _i, until) {
27914                    return dir(elem, "nextSibling", until);
27915                },
27916                prevUntil: function (elem, _i, until) {
27917                    return dir(elem, "previousSibling", until);
27918                },
27919                siblings: function (elem) {
27920                    return siblings((elem.parentNode || {}).firstChild, elem);
27921                },
27922                children: function (elem) {
27923                    return siblings(elem.firstChild);
27924                },
27925                contents: function (elem) {
27926                    if (elem.contentDocument != null &&
27927
27928                        // Support: IE 11+
27929                        // <object> elements with no `data` attribute has an object
27930                        // `contentDocument` with a `null` prototype.
27931                        getProto(elem.contentDocument)) {
27932
27933                        return elem.contentDocument;
27934                    }
27935
27936                    // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
27937                    // Treat the template element as a regular one in browsers that
27938                    // don't support it.
27939                    if (nodeName(elem, "template")) {
27940                        elem = elem.content || elem;
27941                    }
27942
27943                    return jQuery.merge([], elem.childNodes);
27944                }
27945            }, function (name, fn) {
27946                jQuery.fn[name] = function (until, selector) {
27947                    var matched = jQuery.map(this, fn, until);
27948
27949                    if (name.slice(-5) !== "Until") {
27950                        selector = until;
27951                    }
27952
27953                    if (selector && typeof selector === "string") {
27954                        matched = jQuery.filter(selector, matched);
27955                    }
27956
27957                    if (this.length > 1) {
27958
27959                        // Remove duplicates
27960                        if (!guaranteedUnique[name]) {
27961                            jQuery.uniqueSort(matched);
27962                        }
27963
27964                        // Reverse order for parents* and prev-derivatives
27965                        if (rparentsprev.test(name)) {
27966                            matched.reverse();
27967                        }
27968                    }
27969
27970                    return this.pushStack(matched);
27971                };
27972            });
27973            var rnothtmlwhite = (/[^\x20\t\r\n\f]+/g);
27974
27975
27976// Convert String-formatted options into Object-formatted ones
27977            function createOptions(options) {
27978                var object = {};
27979                jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) {
27980                    object[flag] = true;
27981                });
27982                return object;
27983            }
27984
27985            /*
27986 * Create a callback list using the following parameters:
27987 *
27988 *	options: an optional list of space-separated options that will change how
27989 *			the callback list behaves or a more traditional option object
27990 *
27991 * By default a callback list will act like an event callback list and can be
27992 * "fired" multiple times.
27993 *
27994 * Possible options:
27995 *
27996 *	once:			will ensure the callback list can only be fired once (like a Deferred)
27997 *
27998 *	memory:			will keep track of previous values and will call any callback added
27999 *					after the list has been fired right away with the latest "memorized"
28000 *					values (like a Deferred)
28001 *
28002 *	unique:			will ensure a callback can only be added once (no duplicate in the list)
28003 *
28004 *	stopOnFalse:	interrupt callings when a callback returns false
28005 *
28006 */
28007            jQuery.Callbacks = function (options) {
28008
28009                // Convert options from String-formatted to Object-formatted if needed
28010                // (we check in cache first)
28011                options = typeof options === "string" ?
28012                    createOptions(options) :
28013                    jQuery.extend({}, options);
28014
28015                var // Flag to know if list is currently firing
28016                    firing,
28017
28018                    // Last fire value for non-forgettable lists
28019                    memory,
28020
28021                    // Flag to know if list was already fired
28022                    fired,
28023
28024                    // Flag to prevent firing
28025                    locked,
28026
28027                    // Actual callback list
28028                    list = [],
28029
28030                    // Queue of execution data for repeatable lists
28031                    queue = [],
28032
28033                    // Index of currently firing callback (modified by add/remove as needed)
28034                    firingIndex = -1,
28035
28036                    // Fire callbacks
28037                    fire = function () {
28038
28039                        // Enforce single-firing
28040                        locked = locked || options.once;
28041
28042                        // Execute callbacks for all pending executions,
28043                        // respecting firingIndex overrides and runtime changes
28044                        fired = firing = true;
28045                        for (; queue.length; firingIndex = -1) {
28046                            memory = queue.shift();
28047                            while (++firingIndex < list.length) {
28048
28049                                // Run callback and check for early termination
28050                                if (list[firingIndex].apply(memory[0], memory[1]) === false &&
28051                                    options.stopOnFalse) {
28052
28053                                    // Jump to end and forget the data so .add doesn't re-fire
28054                                    firingIndex = list.length;
28055                                    memory = false;
28056                                }
28057                            }
28058                        }
28059
28060                        // Forget the data if we're done with it
28061                        if (!options.memory) {
28062                            memory = false;
28063                        }
28064
28065                        firing = false;
28066
28067                        // Clean up if we're done firing for good
28068                        if (locked) {
28069
28070                            // Keep an empty list if we have data for future add calls
28071                            if (memory) {
28072                                list = [];
28073
28074                                // Otherwise, this object is spent
28075                            } else {
28076                                list = "";
28077                            }
28078                        }
28079                    },
28080
28081                    // Actual Callbacks object
28082                    self = {
28083
28084                        // Add a callback or a collection of callbacks to the list
28085                        add: function () {
28086                            if (list) {
28087
28088                                // If we have memory from a past run, we should fire after adding
28089                                if (memory && !firing) {
28090                                    firingIndex = list.length - 1;
28091                                    queue.push(memory);
28092                                }
28093
28094                                (function add(args) {
28095                                    jQuery.each(args, function (_, arg) {
28096                                        if (isFunction(arg)) {
28097                                            if (!options.unique || !self.has(arg)) {
28098                                                list.push(arg);
28099                                            }
28100                                        } else if (arg && arg.length && toType(arg) !== "string") {
28101
28102                                            // Inspect recursively
28103                                            add(arg);
28104                                        }
28105                                    });
28106                                })(arguments);
28107
28108                                if (memory && !firing) {
28109                                    fire();
28110                                }
28111                            }
28112                            return this;
28113                        },
28114
28115                        // Remove a callback from the list
28116                        remove: function () {
28117                            jQuery.each(arguments, function (_, arg) {
28118                                var index;
28119                                while ((index = jQuery.inArray(arg, list, index)) > -1) {
28120                                    list.splice(index, 1);
28121
28122                                    // Handle firing indexes
28123                                    if (index <= firingIndex) {
28124                                        firingIndex--;
28125                                    }
28126                                }
28127                            });
28128                            return this;
28129                        },
28130
28131                        // Check if a given callback is in the list.
28132                        // If no argument is given, return whether or not list has callbacks attached.
28133                        has: function (fn) {
28134                            return fn ?
28135                                jQuery.inArray(fn, list) > -1 :
28136                                list.length > 0;
28137                        },
28138
28139                        // Remove all callbacks from the list
28140                        empty: function () {
28141                            if (list) {
28142                                list = [];
28143                            }
28144                            return this;
28145                        },
28146
28147                        // Disable .fire and .add
28148                        // Abort any current/pending executions
28149                        // Clear all callbacks and values
28150                        disable: function () {
28151                            locked = queue = [];
28152                            list = memory = "";
28153                            return this;
28154                        },
28155                        disabled: function () {
28156                            return !list;
28157                        },
28158
28159                        // Disable .fire
28160                        // Also disable .add unless we have memory (since it would have no effect)
28161                        // Abort any pending executions
28162                        lock: function () {
28163                            locked = queue = [];
28164                            if (!memory && !firing) {
28165                                list = memory = "";
28166                            }
28167                            return this;
28168                        },
28169                        locked: function () {
28170                            return !!locked;
28171                        },
28172
28173                        // Call all callbacks with the given context and arguments
28174                        fireWith: function (context, args) {
28175                            if (!locked) {
28176                                args = args || [];
28177                                args = [context, args.slice ? args.slice() : args];
28178                                queue.push(args);
28179                                if (!firing) {
28180                                    fire();
28181                                }
28182                            }
28183                            return this;
28184                        },
28185
28186                        // Call all the callbacks with the given arguments
28187                        fire: function () {
28188                            self.fireWith(this, arguments);
28189                            return this;
28190                        },
28191
28192                        // To know if the callbacks have already been called at least once
28193                        fired: function () {
28194                            return !!fired;
28195                        }
28196                    };
28197
28198                return self;
28199            };
28200
28201
28202            function Identity(v) {
28203                return v;
28204            }
28205
28206            function Thrower(ex) {
28207                throw ex;
28208            }
28209
28210            function adoptValue(value, resolve, reject, noValue) {
28211                var method;
28212
28213                try {
28214
28215                    // Check for promise aspect first to privilege synchronous behavior
28216                    if (value && isFunction((method = value.promise))) {
28217                        method.call(value).done(resolve).fail(reject);
28218
28219                        // Other thenables
28220                    } else if (value && isFunction((method = value.then))) {
28221                        method.call(value, resolve, reject);
28222
28223                        // Other non-thenables
28224                    } else {
28225
28226                        // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
28227                        // * false: [ value ].slice( 0 ) => resolve( value )
28228                        // * true: [ value ].slice( 1 ) => resolve()
28229                        resolve.apply(undefined, [value].slice(noValue));
28230                    }
28231
28232                    // For Promises/A+, convert exceptions into rejections
28233                    // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
28234                    // Deferred#then to conditionally suppress rejection.
28235                } catch (value) {
28236
28237                    // Support: Android 4.0 only
28238                    // Strict mode functions invoked without .call/.apply get global-object context
28239                    reject.apply(undefined, [value]);
28240                }
28241            }
28242
28243            jQuery.extend({
28244
28245                Deferred: function (func) {
28246                    var tuples = [
28247
28248                            // action, add listener, callbacks,
28249                            // ... .then handlers, argument index, [final state]
28250                            ["notify", "progress", jQuery.Callbacks("memory"),
28251                                jQuery.Callbacks("memory"), 2],
28252                            ["resolve", "done", jQuery.Callbacks("once memory"),
28253                                jQuery.Callbacks("once memory"), 0, "resolved"],
28254                            ["reject", "fail", jQuery.Callbacks("once memory"),
28255                                jQuery.Callbacks("once memory"), 1, "rejected"]
28256                        ],
28257                        state = "pending",
28258                        promise = {
28259                            state: function () {
28260                                return state;
28261                            },
28262                            always: function () {
28263                                deferred.done(arguments).fail(arguments);
28264                                return this;
28265                            },
28266                            "catch": function (fn) {
28267                                return promise.then(null, fn);
28268                            },
28269
28270                            // Keep pipe for back-compat
28271                            pipe: function ( /* fnDone, fnFail, fnProgress */) {
28272                                var fns = arguments;
28273
28274                                return jQuery.Deferred(function (newDefer) {
28275                                    jQuery.each(tuples, function (_i, tuple) {
28276
28277                                        // Map tuples (progress, done, fail) to arguments (done, fail, progress)
28278                                        var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]];
28279
28280                                        // deferred.progress(function() { bind to newDefer or newDefer.notify })
28281                                        // deferred.done(function() { bind to newDefer or newDefer.resolve })
28282                                        // deferred.fail(function() { bind to newDefer or newDefer.reject })
28283                                        deferred[tuple[1]](function () {
28284                                            var returned = fn && fn.apply(this, arguments);
28285                                            if (returned && isFunction(returned.promise)) {
28286                                                returned.promise()
28287                                                    .progress(newDefer.notify)
28288                                                    .done(newDefer.resolve)
28289                                                    .fail(newDefer.reject);
28290                                            } else {
28291                                                newDefer[tuple[0] + "With"](
28292                                                    this,
28293                                                    fn ? [returned] : arguments
28294                                                );
28295                                            }
28296                                        });
28297                                    });
28298                                    fns = null;
28299                                }).promise();
28300                            },
28301                            then: function (onFulfilled, onRejected, onProgress) {
28302                                var maxDepth = 0;
28303
28304                                function resolve(depth, deferred, handler, special) {
28305                                    return function () {
28306                                        var that = this,
28307                                            args = arguments,
28308                                            mightThrow = function () {
28309                                                var returned, then;
28310
28311                                                // Support: Promises/A+ section 2.3.3.3.3
28312                                                // https://promisesaplus.com/#point-59
28313                                                // Ignore double-resolution attempts
28314                                                if (depth < maxDepth) {
28315                                                    return;
28316                                                }
28317
28318                                                returned = handler.apply(that, args);
28319
28320                                                // Support: Promises/A+ section 2.3.1
28321                                                // https://promisesaplus.com/#point-48
28322                                                if (returned === deferred.promise()) {
28323                                                    throw new TypeError("Thenable self-resolution");
28324                                                }
28325
28326                                                // Support: Promises/A+ sections 2.3.3.1, 3.5
28327                                                // https://promisesaplus.com/#point-54
28328                                                // https://promisesaplus.com/#point-75
28329                                                // Retrieve `then` only once
28330                                                then = returned &&
28331
28332                                                    // Support: Promises/A+ section 2.3.4
28333                                                    // https://promisesaplus.com/#point-64
28334                                                    // Only check objects and functions for thenability
28335                                                    (typeof returned === "object" ||
28336                                                        typeof returned === "function") &&
28337                                                    returned.then;
28338
28339                                                // Handle a returned thenable
28340                                                if (isFunction(then)) {
28341
28342                                                    // Special processors (notify) just wait for resolution
28343                                                    if (special) {
28344                                                        then.call(
28345                                                            returned,
28346                                                            resolve(maxDepth, deferred, Identity, special),
28347                                                            resolve(maxDepth, deferred, Thrower, special)
28348                                                        );
28349
28350                                                        // Normal processors (resolve) also hook into progress
28351                                                    } else {
28352
28353                                                        // ...and disregard older resolution values
28354                                                        maxDepth++;
28355
28356                                                        then.call(
28357                                                            returned,
28358                                                            resolve(maxDepth, deferred, Identity, special),
28359                                                            resolve(maxDepth, deferred, Thrower, special),
28360                                                            resolve(maxDepth, deferred, Identity,
28361                                                                deferred.notifyWith)
28362                                                        );
28363                                                    }
28364
28365                                                    // Handle all other returned values
28366                                                } else {
28367
28368                                                    // Only substitute handlers pass on context
28369                                                    // and multiple values (non-spec behavior)
28370                                                    if (handler !== Identity) {
28371                                                        that = undefined;
28372                                                        args = [returned];
28373                                                    }
28374
28375                                                    // Process the value(s)
28376                                                    // Default process is resolve
28377                                                    (special || deferred.resolveWith)(that, args);
28378                                                }
28379                                            },
28380
28381                                            // Only normal processors (resolve) catch and reject exceptions
28382                                            process = special ?
28383                                                mightThrow :
28384                                                function () {
28385                                                    try {
28386                                                        mightThrow();
28387                                                    } catch (e) {
28388
28389                                                        if (jQuery.Deferred.exceptionHook) {
28390                                                            jQuery.Deferred.exceptionHook(e,
28391                                                                process.stackTrace);
28392                                                        }
28393
28394                                                        // Support: Promises/A+ section 2.3.3.3.4.1
28395                                                        // https://promisesaplus.com/#point-61
28396                                                        // Ignore post-resolution exceptions
28397                                                        if (depth + 1 >= maxDepth) {
28398
28399                                                            // Only substitute handlers pass on context
28400                                                            // and multiple values (non-spec behavior)
28401                                                            if (handler !== Thrower) {
28402                                                                that = undefined;
28403                                                                args = [e];
28404                                                            }
28405
28406                                                            deferred.rejectWith(that, args);
28407                                                        }
28408                                                    }
28409                                                };
28410
28411                                        // Support: Promises/A+ section 2.3.3.3.1
28412                                        // https://promisesaplus.com/#point-57
28413                                        // Re-resolve promises immediately to dodge false rejection from
28414                                        // subsequent errors
28415                                        if (depth) {
28416                                            process();
28417                                        } else {
28418
28419                                            // Call an optional hook to record the stack, in case of exception
28420                                            // since it's otherwise lost when execution goes async
28421                                            if (jQuery.Deferred.getStackHook) {
28422                                                process.stackTrace = jQuery.Deferred.getStackHook();
28423                                            }
28424                                            window.setTimeout(process);
28425                                        }
28426                                    };
28427                                }
28428
28429                                return jQuery.Deferred(function (newDefer) {
28430
28431                                    // progress_handlers.add( ... )
28432                                    tuples[0][3].add(
28433                                        resolve(
28434                                            0,
28435                                            newDefer,
28436                                            isFunction(onProgress) ?
28437                                                onProgress :
28438                                                Identity,
28439                                            newDefer.notifyWith
28440                                        )
28441                                    );
28442
28443                                    // fulfilled_handlers.add( ... )
28444                                    tuples[1][3].add(
28445                                        resolve(
28446                                            0,
28447                                            newDefer,
28448                                            isFunction(onFulfilled) ?
28449                                                onFulfilled :
28450                                                Identity
28451                                        )
28452                                    );
28453
28454                                    // rejected_handlers.add( ... )
28455                                    tuples[2][3].add(
28456                                        resolve(
28457                                            0,
28458                                            newDefer,
28459                                            isFunction(onRejected) ?
28460                                                onRejected :
28461                                                Thrower
28462                                        )
28463                                    );
28464                                }).promise();
28465                            },
28466
28467                            // Get a promise for this deferred
28468                            // If obj is provided, the promise aspect is added to the object
28469                            promise: function (obj) {
28470                                return obj != null ? jQuery.extend(obj, promise) : promise;
28471                            }
28472                        },
28473                        deferred = {};
28474
28475                    // Add list-specific methods
28476                    jQuery.each(tuples, function (i, tuple) {
28477                        var list = tuple[2],
28478                            stateString = tuple[5];
28479
28480                        // promise.progress = list.add
28481                        // promise.done = list.add
28482                        // promise.fail = list.add
28483                        promise[tuple[1]] = list.add;
28484
28485                        // Handle state
28486                        if (stateString) {
28487                            list.add(
28488                                function () {
28489
28490                                    // state = "resolved" (i.e., fulfilled)
28491                                    // state = "rejected"
28492                                    state = stateString;
28493                                },
28494
28495                                // rejected_callbacks.disable
28496                                // fulfilled_callbacks.disable
28497                                tuples[3 - i][2].disable,
28498
28499                                // rejected_handlers.disable
28500                                // fulfilled_handlers.disable
28501                                tuples[3 - i][3].disable,
28502
28503                                // progress_callbacks.lock
28504                                tuples[0][2].lock,
28505
28506                                // progress_handlers.lock
28507                                tuples[0][3].lock
28508                            );
28509                        }
28510
28511                        // progress_handlers.fire
28512                        // fulfilled_handlers.fire
28513                        // rejected_handlers.fire
28514                        list.add(tuple[3].fire);
28515
28516                        // deferred.notify = function() { deferred.notifyWith(...) }
28517                        // deferred.resolve = function() { deferred.resolveWith(...) }
28518                        // deferred.reject = function() { deferred.rejectWith(...) }
28519                        deferred[tuple[0]] = function () {
28520                            deferred[tuple[0] + "With"](this === deferred ? undefined : this, arguments);
28521                            return this;
28522                        };
28523
28524                        // deferred.notifyWith = list.fireWith
28525                        // deferred.resolveWith = list.fireWith
28526                        // deferred.rejectWith = list.fireWith
28527                        deferred[tuple[0] + "With"] = list.fireWith;
28528                    });
28529
28530                    // Make the deferred a promise
28531                    promise.promise(deferred);
28532
28533                    // Call given func if any
28534                    if (func) {
28535                        func.call(deferred, deferred);
28536                    }
28537
28538                    // All done!
28539                    return deferred;
28540                },
28541
28542                // Deferred helper
28543                when: function (singleValue) {
28544                    var
28545
28546                        // count of uncompleted subordinates
28547                        remaining = arguments.length,
28548
28549                        // count of unprocessed arguments
28550                        i = remaining,
28551
28552                        // subordinate fulfillment data
28553                        resolveContexts = Array(i),
28554                        resolveValues = slice.call(arguments),
28555
28556                        // the master Deferred
28557                        master = jQuery.Deferred(),
28558
28559                        // subordinate callback factory
28560                        updateFunc = function (i) {
28561                            return function (value) {
28562                                resolveContexts[i] = this;
28563                                resolveValues[i] = arguments.length > 1 ? slice.call(arguments) : value;
28564                                if (!(--remaining)) {
28565                                    master.resolveWith(resolveContexts, resolveValues);
28566                                }
28567                            };
28568                        };
28569
28570                    // Single- and empty arguments are adopted like Promise.resolve
28571                    if (remaining <= 1) {
28572                        adoptValue(singleValue, master.done(updateFunc(i)).resolve, master.reject,
28573                            !remaining);
28574
28575                        // Use .then() to unwrap secondary thenables (cf. gh-3000)
28576                        if (master.state() === "pending" ||
28577                            isFunction(resolveValues[i] && resolveValues[i].then)) {
28578
28579                            return master.then();
28580                        }
28581                    }
28582
28583                    // Multiple arguments are aggregated like Promise.all array elements
28584                    while (i--) {
28585                        adoptValue(resolveValues[i], updateFunc(i), master.reject);
28586                    }
28587
28588                    return master.promise();
28589                }
28590            });
28591
28592
28593// These usually indicate a programmer mistake during development,
28594// warn about them ASAP rather than swallowing them by default.
28595            var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
28596
28597            jQuery.Deferred.exceptionHook = function (error, stack) {
28598
28599                // Support: IE 8 - 9 only
28600                // Console exists when dev tools are open, which can happen at any time
28601                if (window.console && window.console.warn && error && rerrorNames.test(error.name)) {
28602                    window.console.warn("jQuery.Deferred exception: " + error.message, error.stack, stack);
28603                }
28604            };
28605
28606
28607            jQuery.readyException = function (error) {
28608                window.setTimeout(function () {
28609                    throw error;
28610                });
28611            };
28612
28613
28614// The deferred used on DOM ready
28615            var readyList = jQuery.Deferred();
28616
28617            jQuery.fn.ready = function (fn) {
28618
28619                readyList
28620                    .then(fn)
28621
28622                    // Wrap jQuery.readyException in a function so that the lookup
28623                    // happens at the time of error handling instead of callback
28624                    // registration.
28625                    .catch(function (error) {
28626                        jQuery.readyException(error);
28627                    });
28628
28629                return this;
28630            };
28631
28632            jQuery.extend({
28633
28634                // Is the DOM ready to be used? Set to true once it occurs.
28635                isReady: false,
28636
28637                // A counter to track how many items to wait for before
28638                // the ready event fires. See #6781
28639                readyWait: 1,
28640
28641                // Handle when the DOM is ready
28642                ready: function (wait) {
28643
28644                    // Abort if there are pending holds or we're already ready
28645                    if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
28646                        return;
28647                    }
28648
28649                    // Remember that the DOM is ready
28650                    jQuery.isReady = true;
28651
28652                    // If a normal DOM Ready event fired, decrement, and wait if need be
28653                    if (wait !== true && --jQuery.readyWait > 0) {
28654                        return;
28655                    }
28656
28657                    // If there are functions bound, to execute
28658                    readyList.resolveWith(document, [jQuery]);
28659                }
28660            });
28661
28662            jQuery.ready.then = readyList.then;
28663
28664// The ready event handler and self cleanup method
28665            function completed() {
28666                document.removeEventListener("DOMContentLoaded", completed);
28667                window.removeEventListener("load", completed);
28668                jQuery.ready();
28669            }
28670
28671// Catch cases where $(document).ready() is called
28672// after the browser event has already occurred.
28673// Support: IE <=9 - 10 only
28674// Older IE sometimes signals "interactive" too soon
28675            if (document.readyState === "complete" ||
28676                (document.readyState !== "loading" && !document.documentElement.doScroll)) {
28677
28678                // Handle it asynchronously to allow scripts the opportunity to delay ready
28679                window.setTimeout(jQuery.ready);
28680
28681            } else {
28682
28683                // Use the handy event callback
28684                document.addEventListener("DOMContentLoaded", completed);
28685
28686                // A fallback to window.onload, that will always work
28687                window.addEventListener("load", completed);
28688            }
28689
28690
28691// Multifunctional method to get and set values of a collection
28692// The value/s can optionally be executed if it's a function
28693            var access = function (elems, fn, key, value, chainable, emptyGet, raw) {
28694                var i = 0,
28695                    len = elems.length,
28696                    bulk = key == null;
28697
28698                // Sets many values
28699                if (toType(key) === "object") {
28700                    chainable = true;
28701                    for (i in key) {
28702                        access(elems, fn, i, key[i], true, emptyGet, raw);
28703                    }
28704
28705                    // Sets one value
28706                } else if (value !== undefined) {
28707                    chainable = true;
28708
28709                    if (!isFunction(value)) {
28710                        raw = true;
28711                    }
28712
28713                    if (bulk) {
28714
28715                        // Bulk operations run against the entire set
28716                        if (raw) {
28717                            fn.call(elems, value);
28718                            fn = null;
28719
28720                            // ...except when executing function values
28721                        } else {
28722                            bulk = fn;
28723                            fn = function (elem, _key, value) {
28724                                return bulk.call(jQuery(elem), value);
28725                            };
28726                        }
28727                    }
28728
28729                    if (fn) {
28730                        for (; i < len; i++) {
28731                            fn(
28732                                elems[i], key, raw ?
28733                                    value :
28734                                    value.call(elems[i], i, fn(elems[i], key))
28735                            );
28736                        }
28737                    }
28738                }
28739
28740                if (chainable) {
28741                    return elems;
28742                }
28743
28744                // Gets
28745                if (bulk) {
28746                    return fn.call(elems);
28747                }
28748
28749                return len ? fn(elems[0], key) : emptyGet;
28750            };
28751
28752
28753// Matches dashed string for camelizing
28754            var rmsPrefix = /^-ms-/,
28755                rdashAlpha = /-([a-z])/g;
28756
28757// Used by camelCase as callback to replace()
28758            function fcamelCase(_all, letter) {
28759                return letter.toUpperCase();
28760            }
28761
28762// Convert dashed to camelCase; used by the css and data modules
28763// Support: IE <=9 - 11, Edge 12 - 15
28764// Microsoft forgot to hump their vendor prefix (#9572)
28765            function camelCase(string) {
28766                return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
28767            }
28768
28769            var acceptData = function (owner) {
28770
28771                // Accepts only:
28772                //  - Node
28773                //    - Node.ELEMENT_NODE
28774                //    - Node.DOCUMENT_NODE
28775                //  - Object
28776                //    - Any
28777                return owner.nodeType === 1 || owner.nodeType === 9 || !(+owner.nodeType);
28778            };
28779
28780
28781            function Data() {
28782                this.expando = jQuery.expando + Data.uid++;
28783            }
28784
28785            Data.uid = 1;
28786
28787            Data.prototype = {
28788
28789                cache: function (owner) {
28790
28791                    // Check if the owner object already has a cache
28792                    var value = owner[this.expando];
28793
28794                    // If not, create one
28795                    if (!value) {
28796                        value = {};
28797
28798                        // We can accept data for non-element nodes in modern browsers,
28799                        // but we should not, see #8335.
28800                        // Always return an empty object.
28801                        if (acceptData(owner)) {
28802
28803                            // If it is a node unlikely to be stringify-ed or looped over
28804                            // use plain assignment
28805                            if (owner.nodeType) {
28806                                owner[this.expando] = value;
28807
28808                                // Otherwise secure it in a non-enumerable property
28809                                // configurable must be true to allow the property to be
28810                                // deleted when data is removed
28811                            } else {
28812                                Object.defineProperty(owner, this.expando, {
28813                                    value: value,
28814                                    configurable: true
28815                                });
28816                            }
28817                        }
28818                    }
28819
28820                    return value;
28821                },
28822                set: function (owner, data, value) {
28823                    var prop,
28824                        cache = this.cache(owner);
28825
28826                    // Handle: [ owner, key, value ] args
28827                    // Always use camelCase key (gh-2257)
28828                    if (typeof data === "string") {
28829                        cache[camelCase(data)] = value;
28830
28831                        // Handle: [ owner, { properties } ] args
28832                    } else {
28833
28834                        // Copy the properties one-by-one to the cache object
28835                        for (prop in data) {
28836                            cache[camelCase(prop)] = data[prop];
28837                        }
28838                    }
28839                    return cache;
28840                },
28841                get: function (owner, key) {
28842                    return key === undefined ?
28843                        this.cache(owner) :
28844
28845                        // Always use camelCase key (gh-2257)
28846                        owner[this.expando] && owner[this.expando][camelCase(key)];
28847                },
28848                access: function (owner, key, value) {
28849
28850                    // In cases where either:
28851                    //
28852                    //   1. No key was specified
vendor: 8,695 bytes, lines 28853-29071
28853                    //   2. A string key was specified, but no value provided
28854                    //
28855                    // Take the "read" path and allow the get method to determine
28856                    // which value to return, respectively either:
28857                    //
28858                    //   1. The entire cache object
28859                    //   2. The data stored at the key
28860                    //
28861                    if (key === undefined ||
28862                        ((key && typeof key === "string") && value === undefined)) {
28863
28864                        return this.get(owner, key);
28865                    }
28866
28867                    // When the key is not a string, or both a key and value
28868                    // are specified, set or extend (existing objects) with either:
28869                    //
28870                    //   1. An object of properties
28871                    //   2. A key and value
28872                    //
28873                    this.set(owner, key, value);
28874
28875                    // Since the "set" path can have two possible entry points
28876                    // return the expected data based on which path was taken[*]
28877                    return value !== undefined ? value : key;
28878                },
28879                remove: function (owner, key) {
28880                    var i,
28881                        cache = owner[this.expando];
28882
28883                    if (cache === undefined) {
28884                        return;
28885                    }
28886
28887                    if (key !== undefined) {
28888
28889                        // Support array or space separated string of keys
28890                        if (Array.isArray(key)) {
28891
28892                            // If key is an array of keys...
28893                            // We always set camelCase keys, so remove that.
28894                            key = key.map(camelCase);
28895                        } else {
28896                            key = camelCase(key);
28897
28898                            // If a key with the spaces exists, use it.
28899                            // Otherwise, create an array by matching non-whitespace
28900                            key = key in cache ?
28901                                [key] :
28902                                (key.match(rnothtmlwhite) || []);
28903                        }
28904
28905                        i = key.length;
28906
28907                        while (i--) {
28908                            delete cache[key[i]];
28909                        }
28910                    }
28911
28912                    // Remove the expando if there's no more data
28913                    if (key === undefined || jQuery.isEmptyObject(cache)) {
28914
28915                        // Support: Chrome <=35 - 45
28916                        // Webkit & Blink performance suffers when deleting properties
28917                        // from DOM nodes, so set to undefined instead
28918                        // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
28919                        if (owner.nodeType) {
28920                            owner[this.expando] = undefined;
28921                        } else {
28922                            delete owner[this.expando];
28923                        }
28924                    }
28925                },
28926                hasData: function (owner) {
28927                    var cache = owner[this.expando];
28928                    return cache !== undefined && !jQuery.isEmptyObject(cache);
28929                }
28930            };
28931            var dataPriv = new Data();
28932
28933            var dataUser = new Data();
28934
28935
28936//	Implementation Summary
28937//
28938//	1. Enforce API surface and semantic compatibility with 1.9.x branch
28939//	2. Improve the module's maintainability by reducing the storage
28940//		paths to a single mechanism.
28941//	3. Use the same single mechanism to support "private" and "user" data.
28942//	4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
28943//	5. Avoid exposing implementation details on user objects (eg. expando properties)
28944//	6. Provide a clear path for implementation upgrade to WeakMap in 2014
28945
28946            var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
28947                rmultiDash = /[A-Z]/g;
28948
28949            function getData(data) {
28950                if (data === "true") {
28951                    return true;
28952                }
28953
28954                if (data === "false") {
28955                    return false;
28956                }
28957
28958                if (data === "null") {
28959                    return null;
28960                }
28961
28962                // Only convert to a number if it doesn't change the string
28963                if (data === +data + "") {
28964                    return +data;
28965                }
28966
28967                if (rbrace.test(data)) {
28968                    return JSON.parse(data);
28969                }
28970
28971                return data;
28972            }
28973
28974            function dataAttr(elem, key, data) {
28975                var name;
28976
28977                // If nothing was found internally, try to fetch any
28978                // data from the HTML5 data-* attribute
28979                if (data === undefined && elem.nodeType === 1) {
28980                    name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase();
28981                    data = elem.getAttribute(name);
28982
28983                    if (typeof data === "string") {
28984                        try {
28985                            data = getData(data);
28986                        } catch (e) {
28987                        }
28988
28989                        // Make sure we set the data so it isn't changed later
28990                        dataUser.set(elem, key, data);
28991                    } else {
28992                        data = undefined;
28993                    }
28994                }
28995                return data;
28996            }
28997
28998            jQuery.extend({
28999                hasData: function (elem) {
29000                    return dataUser.hasData(elem) || dataPriv.hasData(elem);
29001                },
29002
29003                data: function (elem, name, data) {
29004                    return dataUser.access(elem, name, data);
29005                },
29006
29007                removeData: function (elem, name) {
29008                    dataUser.remove(elem, name);
29009                },
29010
29011                // TODO: Now that all calls to _data and _removeData have been replaced
29012                // with direct calls to dataPriv methods, these can be deprecated.
29013                _data: function (elem, name, data) {
29014                    return dataPriv.access(elem, name, data);
29015                },
29016
29017                _removeData: function (elem, name) {
29018                    dataPriv.remove(elem, name);
29019                }
29020            });
29021
29022            jQuery.fn.extend({
29023                data: function (key, value) {
29024                    var i, name, data,
29025                        elem = this[0],
29026                        attrs = elem && elem.attributes;
29027
29028                    // Gets all values
29029                    if (key === undefined) {
29030                        if (this.length) {
29031                            data = dataUser.get(elem);
29032
29033                            if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) {
29034                                i = attrs.length;
29035                                while (i--) {
29036
29037                                    // Support: IE 11 only
29038                                    // The attrs elements can be null (#14894)
29039                                    if (attrs[i]) {
29040                                        name = attrs[i].name;
29041                                        if (name.indexOf("data-") === 0) {
29042                                            name = camelCase(name.slice(5));
29043                                            dataAttr(elem, name, data[name]);
29044                                        }
29045                                    }
29046                                }
29047                                dataPriv.set(elem, "hasDataAttrs", true);
29048                            }
29049                        }
29050
29051                        return data;
29052                    }
29053
29054                    // Sets multiple values
29055                    if (typeof key === "object") {
29056                        return this.each(function () {
29057                            dataUser.set(this, key);
29058                        });
29059                    }
29060
29061                    return access(this, function (value) {
29062                        var data;
29063
29064                        // The calling jQuery object (element matches) is not empty
29065                        // (and therefore has an element appears at this[ 0 ]) and the
29066                        // `value` parameter was not undefined. An empty jQuery object
29067                        // will result in `undefined` for elem = this[ 0 ] which will
29068                        // throw an exception if an attempt to read a data cache is made.
29069                        if (elem && value === undefined) {
29070
29071                            // Attempt to get data from the cache
vendor: 20,034 bytes, lines 29072-29585
29072                            // The key will always be camelCased in Data
29073                            data = dataUser.get(elem, key);
29074                            if (data !== undefined) {
29075                                return data;
29076                            }
29077
29078                            // Attempt to "discover" the data in
29079                            // HTML5 custom data-* attrs
29080                            data = dataAttr(elem, key);
29081                            if (data !== undefined) {
29082                                return data;
29083                            }
29084
29085                            // We tried really hard, but the data doesn't exist.
29086                            return;
29087                        }
29088
29089                        // Set the data...
29090                        this.each(function () {
29091
29092                            // We always store the camelCased key
29093                            dataUser.set(this, key, value);
29094                        });
29095                    }, null, value, arguments.length > 1, null, true);
29096                },
29097
29098                removeData: function (key) {
29099                    return this.each(function () {
29100                        dataUser.remove(this, key);
29101                    });
29102                }
29103            });
29104
29105
29106            jQuery.extend({
29107                queue: function (elem, type, data) {
29108                    var queue;
29109
29110                    if (elem) {
29111                        type = (type || "fx") + "queue";
29112                        queue = dataPriv.get(elem, type);
29113
29114                        // Speed up dequeue by getting out quickly if this is just a lookup
29115                        if (data) {
29116                            if (!queue || Array.isArray(data)) {
29117                                queue = dataPriv.access(elem, type, jQuery.makeArray(data));
29118                            } else {
29119                                queue.push(data);
29120                            }
29121                        }
29122                        return queue || [];
29123                    }
29124                },
29125
29126                dequeue: function (elem, type) {
29127                    type = type || "fx";
29128
29129                    var queue = jQuery.queue(elem, type),
29130                        startLength = queue.length,
29131                        fn = queue.shift(),
29132                        hooks = jQuery._queueHooks(elem, type),
29133                        next = function () {
29134                            jQuery.dequeue(elem, type);
29135                        };
29136
29137                    // If the fx queue is dequeued, always remove the progress sentinel
29138                    if (fn === "inprogress") {
29139                        fn = queue.shift();
29140                        startLength--;
29141                    }
29142
29143                    if (fn) {
29144
29145                        // Add a progress sentinel to prevent the fx queue from being
29146                        // automatically dequeued
29147                        if (type === "fx") {
29148                            queue.unshift("inprogress");
29149                        }
29150
29151                        // Clear up the last queue stop function
29152                        delete hooks.stop;
29153                        fn.call(elem, next, hooks);
29154                    }
29155
29156                    if (!startLength && hooks) {
29157                        hooks.empty.fire();
29158                    }
29159                },
29160
29161                // Not public - generate a queueHooks object, or return the current one
29162                _queueHooks: function (elem, type) {
29163                    var key = type + "queueHooks";
29164                    return dataPriv.get(elem, key) || dataPriv.access(elem, key, {
29165                        empty: jQuery.Callbacks("once memory").add(function () {
29166                            dataPriv.remove(elem, [type + "queue", key]);
29167                        })
29168                    });
29169                }
29170            });
29171
29172            jQuery.fn.extend({
29173                queue: function (type, data) {
29174                    var setter = 2;
29175
29176                    if (typeof type !== "string") {
29177                        data = type;
29178                        type = "fx";
29179                        setter--;
29180                    }
29181
29182                    if (arguments.length < setter) {
29183                        return jQuery.queue(this[0], type);
29184                    }
29185
29186                    return data === undefined ?
29187                        this :
29188                        this.each(function () {
29189                            var queue = jQuery.queue(this, type, data);
29190
29191                            // Ensure a hooks for this queue
29192                            jQuery._queueHooks(this, type);
29193
29194                            if (type === "fx" && queue[0] !== "inprogress") {
29195                                jQuery.dequeue(this, type);
29196                            }
29197                        });
29198                },
29199                dequeue: function (type) {
29200                    return this.each(function () {
29201                        jQuery.dequeue(this, type);
29202                    });
29203                },
29204                clearQueue: function (type) {
29205                    return this.queue(type || "fx", []);
29206                },
29207
29208                // Get a promise resolved when queues of a certain type
29209                // are emptied (fx is the type by default)
29210                promise: function (type, obj) {
29211                    var tmp,
29212                        count = 1,
29213                        defer = jQuery.Deferred(),
29214                        elements = this,
29215                        i = this.length,
29216                        resolve = function () {
29217                            if (!(--count)) {
29218                                defer.resolveWith(elements, [elements]);
29219                            }
29220                        };
29221
29222                    if (typeof type !== "string") {
29223                        obj = type;
29224                        type = undefined;
29225                    }
29226                    type = type || "fx";
29227
29228                    while (i--) {
29229                        tmp = dataPriv.get(elements[i], type + "queueHooks");
29230                        if (tmp && tmp.empty) {
29231                            count++;
29232                            tmp.empty.add(resolve);
29233                        }
29234                    }
29235                    resolve();
29236                    return defer.promise(obj);
29237                }
29238            });
29239            var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
29240
29241            var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i");
29242
29243
29244            var cssExpand = ["Top", "Right", "Bottom", "Left"];
29245
29246            var documentElement = document.documentElement;
29247
29248
29249            var isAttached = function (elem) {
29250                    return jQuery.contains(elem.ownerDocument, elem);
29251                },
29252                composed = {composed: true};
29253
29254            // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
29255            // Check attachment across shadow DOM boundaries when possible (gh-3504)
29256            // Support: iOS 10.0-10.2 only
29257            // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
29258            // leading to errors. We need to check for `getRootNode`.
29259            if (documentElement.getRootNode) {
29260                isAttached = function (elem) {
29261                    return jQuery.contains(elem.ownerDocument, elem) ||
29262                        elem.getRootNode(composed) === elem.ownerDocument;
29263                };
29264            }
29265            var isHiddenWithinTree = function (elem, el) {
29266
29267                // isHiddenWithinTree might be called from jQuery#filter function;
29268                // in that case, element will be second argument
29269                elem = el || elem;
29270
29271                // Inline style trumps all
29272                return elem.style.display === "none" ||
29273                    elem.style.display === "" &&
29274
29275                    // Otherwise, check computed style
29276                    // Support: Firefox <=43 - 45
29277                    // Disconnected elements can have computed display: none, so first confirm that elem is
29278                    // in the document.
29279                    isAttached(elem) &&
29280
29281                    jQuery.css(elem, "display") === "none";
29282            };
29283
29284
29285            function adjustCSS(elem, prop, valueParts, tween) {
29286                var adjusted, scale,
29287                    maxIterations = 20,
29288                    currentValue = tween ?
29289                        function () {
29290                            return tween.cur();
29291                        } :
29292                        function () {
29293                            return jQuery.css(elem, prop, "");
29294                        },
29295                    initial = currentValue(),
29296                    unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"),
29297
29298                    // Starting value computation is required for potential unit mismatches
29299                    initialInUnit = elem.nodeType &&
29300                        (jQuery.cssNumber[prop] || unit !== "px" && +initial) &&
29301                        rcssNum.exec(jQuery.css(elem, prop));
29302
29303                if (initialInUnit && initialInUnit[3] !== unit) {
29304
29305                    // Support: Firefox <=54
29306                    // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
29307                    initial = initial / 2;
29308
29309                    // Trust units reported by jQuery.css
29310                    unit = unit || initialInUnit[3];
29311
29312                    // Iteratively approximate from a nonzero starting point
29313                    initialInUnit = +initial || 1;
29314
29315                    while (maxIterations--) {
29316
29317                        // Evaluate and update our best guess (doubling guesses that zero out).
29318                        // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
29319                        jQuery.style(elem, prop, initialInUnit + unit);
29320                        if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {
29321                            maxIterations = 0;
29322                        }
29323                        initialInUnit = initialInUnit / scale;
29324
29325                    }
29326
29327                    initialInUnit = initialInUnit * 2;
29328                    jQuery.style(elem, prop, initialInUnit + unit);
29329
29330                    // Make sure we update the tween properties later on
29331                    valueParts = valueParts || [];
29332                }
29333
29334                if (valueParts) {
29335                    initialInUnit = +initialInUnit || +initial || 0;
29336
29337                    // Apply relative offset (+=/-=) if specified
29338                    adjusted = valueParts[1] ?
29339                        initialInUnit + (valueParts[1] + 1) * valueParts[2] :
29340                        +valueParts[2];
29341                    if (tween) {
29342                        tween.unit = unit;
29343                        tween.start = initialInUnit;
29344                        tween.end = adjusted;
29345                    }
29346                }
29347                return adjusted;
29348            }
29349
29350
29351            var defaultDisplayMap = {};
29352
29353            function getDefaultDisplay(elem) {
29354                var temp,
29355                    doc = elem.ownerDocument,
29356                    nodeName = elem.nodeName,
29357                    display = defaultDisplayMap[nodeName];
29358
29359                if (display) {
29360                    return display;
29361                }
29362
29363                temp = doc.body.appendChild(doc.createElement(nodeName));
29364                display = jQuery.css(temp, "display");
29365
29366                temp.parentNode.removeChild(temp);
29367
29368                if (display === "none") {
29369                    display = "block";
29370                }
29371                defaultDisplayMap[nodeName] = display;
29372
29373                return display;
29374            }
29375
29376            function showHide(elements, show) {
29377                var display, elem,
29378                    values = [],
29379                    index = 0,
29380                    length = elements.length;
29381
29382                // Determine new display value for elements that need to change
29383                for (; index < length; index++) {
29384                    elem = elements[index];
29385                    if (!elem.style) {
29386                        continue;
29387                    }
29388
29389                    display = elem.style.display;
29390                    if (show) {
29391
29392                        // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
29393                        // check is required in this first loop unless we have a nonempty display value (either
29394                        // inline or about-to-be-restored)
29395                        if (display === "none") {
29396                            values[index] = dataPriv.get(elem, "display") || null;
29397                            if (!values[index]) {
29398                                elem.style.display = "";
29399                            }
29400                        }
29401                        if (elem.style.display === "" && isHiddenWithinTree(elem)) {
29402                            values[index] = getDefaultDisplay(elem);
29403                        }
29404                    } else {
29405                        if (display !== "none") {
29406                            values[index] = "none";
29407
29408                            // Remember what we're overwriting
29409                            dataPriv.set(elem, "display", display);
29410                        }
29411                    }
29412                }
29413
29414                // Set the display of the elements in a second loop to avoid constant reflow
29415                for (index = 0; index < length; index++) {
29416                    if (values[index] != null) {
29417                        elements[index].style.display = values[index];
29418                    }
29419                }
29420
29421                return elements;
29422            }
29423
29424            jQuery.fn.extend({
29425                show: function () {
29426                    return showHide(this, true);
29427                },
29428                hide: function () {
29429                    return showHide(this);
29430                },
29431                toggle: function (state) {
29432                    if (typeof state === "boolean") {
29433                        return state ? this.show() : this.hide();
29434                    }
29435
29436                    return this.each(function () {
29437                        if (isHiddenWithinTree(this)) {
29438                            jQuery(this).show();
29439                        } else {
29440                            jQuery(this).hide();
29441                        }
29442                    });
29443                }
29444            });
29445            var rcheckableType = (/^(?:checkbox|radio)$/i);
29446
29447            var rtagName = (/<([a-z][^\/\0>\x20\t\r\n\f]*)/i);
29448
29449            var rscriptType = (/^$|^module$|\/(?:java|ecma)script/i);
29450
29451
29452            (function () {
29453                var fragment = document.createDocumentFragment(),
29454                    div = fragment.appendChild(document.createElement("div")),
29455                    input = document.createElement("input");
29456
29457                // Support: Android 4.0 - 4.3 only
29458                // Check state lost if the name is set (#11217)
29459                // Support: Windows Web Apps (WWA)
29460                // `name` and `type` must use .setAttribute for WWA (#14901)
29461                input.setAttribute("type", "radio");
29462                input.setAttribute("checked", "checked");
29463                input.setAttribute("name", "t");
29464
29465                div.appendChild(input);
29466
29467                // Support: Android <=4.1 only
29468                // Older WebKit doesn't clone checked state correctly in fragments
29469                support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
29470
29471                // Support: IE <=11 only
29472                // Make sure textarea (and checkbox) defaultValue is properly cloned
29473                div.innerHTML = "<textarea>x</textarea>";
29474                support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
29475
29476                // Support: IE <=9 only
29477                // IE <=9 replaces <option> tags with their contents when inserted outside of
29478                // the select element.
29479                div.innerHTML = "<option></option>";
29480                support.option = !!div.lastChild;
29481            })();
29482
29483
29484// We have to close these tags to support XHTML (#13200)
29485            var wrapMap = {
29486
29487                // XHTML parsers do not magically insert elements in the
29488                // same way that tag soup parsers do. So we cannot shorten
29489                // this by omitting <tbody> or other required elements.
29490                thead: [1, "<table>", "</table>"],
29491                col: [2, "<table><colgroup>", "</colgroup></table>"],
29492                tr: [2, "<table><tbody>", "</tbody></table>"],
29493                td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
29494
29495                _default: [0, "", ""]
29496            };
29497
29498            wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
29499            wrapMap.th = wrapMap.td;
29500
29501// Support: IE <=9 only
29502            if (!support.option) {
29503                wrapMap.optgroup = wrapMap.option = [1, "<select multiple='multiple'>", "</select>"];
29504            }
29505
29506
29507            function getAll(context, tag) {
29508
29509                // Support: IE <=9 - 11 only
29510                // Use typeof to avoid zero-argument method invocation on host objects (#15151)
29511                var ret;
29512
29513                if (typeof context.getElementsByTagName !== "undefined") {
29514                    ret = context.getElementsByTagName(tag || "*");
29515
29516                } else if (typeof context.querySelectorAll !== "undefined") {
29517                    ret = context.querySelectorAll(tag || "*");
29518
29519                } else {
29520                    ret = [];
29521                }
29522
29523                if (tag === undefined || tag && nodeName(context, tag)) {
29524                    return jQuery.merge([context], ret);
29525                }
29526
29527                return ret;
29528            }
29529
29530
29531// Mark scripts as having already been evaluated
29532            function setGlobalEval(elems, refElements) {
29533                var i = 0,
29534                    l = elems.length;
29535
29536                for (; i < l; i++) {
29537                    dataPriv.set(
29538                        elems[i],
29539                        "globalEval",
29540                        !refElements || dataPriv.get(refElements[i], "globalEval")
29541                    );
29542                }
29543            }
29544
29545
29546            var rhtml = /<|&#?\w+;/;
29547
29548            function buildFragment(elems, context, scripts, selection, ignored) {
29549                var elem, tmp, tag, wrap, attached, j,
29550                    fragment = context.createDocumentFragment(),
29551                    nodes = [],
29552                    i = 0,
29553                    l = elems.length;
29554
29555                for (; i < l; i++) {
29556                    elem = elems[i];
29557
29558                    if (elem || elem === 0) {
29559
29560                        // Add nodes directly
29561                        if (toType(elem) === "object") {
29562
29563                            // Support: Android <=4.0 only, PhantomJS 1 only
29564                            // push.apply(_, arraylike) throws on ancient WebKit
29565                            jQuery.merge(nodes, elem.nodeType ? [elem] : elem);
29566
29567                            // Convert non-html into a text node
29568                        } else if (!rhtml.test(elem)) {
29569                            nodes.push(context.createTextNode(elem));
29570
29571                            // Convert html into DOM nodes
29572                        } else {
29573                            tmp = tmp || fragment.appendChild(context.createElement("div"));
29574
29575                            // Deserialize a standard representation
29576                            tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
29577                            wrap = wrapMap[tag] || wrapMap._default;
29578                            tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];
29579
29580                            // Descend through wrappers to the right content
29581                            j = wrap[0];
29582                            while (j--) {
29583                                tmp = tmp.lastChild;
29584                            }
29585
vendor: 11,139 bytes, lines 29586-29865
29586                            // Support: Android <=4.0 only, PhantomJS 1 only
29587                            // push.apply(_, arraylike) throws on ancient WebKit
29588                            jQuery.merge(nodes, tmp.childNodes);
29589
29590                            // Remember the top-level container
29591                            tmp = fragment.firstChild;
29592
29593                            // Ensure the created nodes are orphaned (#12392)
29594                            tmp.textContent = "";
29595                        }
29596                    }
29597                }
29598
29599                // Remove wrapper from fragment
29600                fragment.textContent = "";
29601
29602                i = 0;
29603                while ((elem = nodes[i++])) {
29604
29605                    // Skip elements already in the context collection (trac-4087)
29606                    if (selection && jQuery.inArray(elem, selection) > -1) {
29607                        if (ignored) {
29608                            ignored.push(elem);
29609                        }
29610                        continue;
29611                    }
29612
29613                    attached = isAttached(elem);
29614
29615                    // Append to fragment
29616                    tmp = getAll(fragment.appendChild(elem), "script");
29617
29618                    // Preserve script evaluation history
29619                    if (attached) {
29620                        setGlobalEval(tmp);
29621                    }
29622
29623                    // Capture executables
29624                    if (scripts) {
29625                        j = 0;
29626                        while ((elem = tmp[j++])) {
29627                            if (rscriptType.test(elem.type || "")) {
29628                                scripts.push(elem);
29629                            }
29630                        }
29631                    }
29632                }
29633
29634                return fragment;
29635            }
29636
29637
29638            var
29639                rkeyEvent = /^key/,
29640                rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
29641                rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
29642
29643            function returnTrue() {
29644                return true;
29645            }
29646
29647            function returnFalse() {
29648                return false;
29649            }
29650
29651// Support: IE <=9 - 11+
29652// focus() and blur() are asynchronous, except when they are no-op.
29653// So expect focus to be synchronous when the element is already active,
29654// and blur to be synchronous when the element is not already active.
29655// (focus and blur are always synchronous in other supported browsers,
29656// this just defines when we can count on it).
29657            function expectSync(elem, type) {
29658                return (elem === safeActiveElement()) === (type === "focus");
29659            }
29660
29661// Support: IE <=9 only
29662// Accessing document.activeElement can throw unexpectedly
29663// https://bugs.jquery.com/ticket/13393
29664            function safeActiveElement() {
29665                try {
29666                    return document.activeElement;
29667                } catch (err) {
29668                }
29669            }
29670
29671            function on(elem, types, selector, data, fn, one) {
29672                var origFn, type;
29673
29674                // Types can be a map of types/handlers
29675                if (typeof types === "object") {
29676
29677                    // ( types-Object, selector, data )
29678                    if (typeof selector !== "string") {
29679
29680                        // ( types-Object, data )
29681                        data = data || selector;
29682                        selector = undefined;
29683                    }
29684                    for (type in types) {
29685                        on(elem, type, selector, data, types[type], one);
29686                    }
29687                    return elem;
29688                }
29689
29690                if (data == null && fn == null) {
29691
29692                    // ( types, fn )
29693                    fn = selector;
29694                    data = selector = undefined;
29695                } else if (fn == null) {
29696                    if (typeof selector === "string") {
29697
29698                        // ( types, selector, fn )
29699                        fn = data;
29700                        data = undefined;
29701                    } else {
29702
29703                        // ( types, data, fn )
29704                        fn = data;
29705                        data = selector;
29706                        selector = undefined;
29707                    }
29708                }
29709                if (fn === false) {
29710                    fn = returnFalse;
29711                } else if (!fn) {
29712                    return elem;
29713                }
29714
29715                if (one === 1) {
29716                    origFn = fn;
29717                    fn = function (event) {
29718
29719                        // Can use an empty set, since event contains the info
29720                        jQuery().off(event);
29721                        return origFn.apply(this, arguments);
29722                    };
29723
29724                    // Use same guid so caller can remove using origFn
29725                    fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);
29726                }
29727                return elem.each(function () {
29728                    jQuery.event.add(this, types, fn, data, selector);
29729                });
29730            }
29731
29732            /*
29733 * Helper functions for managing events -- not part of the public interface.
29734 * Props to Dean Edwards' addEvent library for many of the ideas.
29735 */
29736            jQuery.event = {
29737
29738                global: {},
29739
29740                add: function (elem, types, handler, data, selector) {
29741
29742                    var handleObjIn, eventHandle, tmp,
29743                        events, t, handleObj,
29744                        special, handlers, type, namespaces, origType,
29745                        elemData = dataPriv.get(elem);
29746
29747                    // Only attach events to objects that accept data
29748                    if (!acceptData(elem)) {
29749                        return;
29750                    }
29751
29752                    // Caller can pass in an object of custom data in lieu of the handler
29753                    if (handler.handler) {
29754                        handleObjIn = handler;
29755                        handler = handleObjIn.handler;
29756                        selector = handleObjIn.selector;
29757                    }
29758
29759                    // Ensure that invalid selectors throw exceptions at attach time
29760                    // Evaluate against documentElement in case elem is a non-element node (e.g., document)
29761                    if (selector) {
29762                        jQuery.find.matchesSelector(documentElement, selector);
29763                    }
29764
29765                    // Make sure that the handler has a unique ID, used to find/remove it later
29766                    if (!handler.guid) {
29767                        handler.guid = jQuery.guid++;
29768                    }
29769
29770                    // Init the element's event structure and main handler, if this is the first
29771                    if (!(events = elemData.events)) {
29772                        events = elemData.events = Object.create(null);
29773                    }
29774                    if (!(eventHandle = elemData.handle)) {
29775                        eventHandle = elemData.handle = function (e) {
29776
29777                            // Discard the second event of a jQuery.event.trigger() and
29778                            // when an event is called after a page has unloaded
29779                            return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
29780                                jQuery.event.dispatch.apply(elem, arguments) : undefined;
29781                        };
29782                    }
29783
29784                    // Handle multiple events separated by a space
29785                    types = (types || "").match(rnothtmlwhite) || [""];
29786                    t = types.length;
29787                    while (t--) {
29788                        tmp = rtypenamespace.exec(types[t]) || [];
29789                        type = origType = tmp[1];
29790                        namespaces = (tmp[2] || "").split(".").sort();
29791
29792                        // There *must* be a type, no attaching namespace-only handlers
29793                        if (!type) {
29794                            continue;
29795                        }
29796
29797                        // If event changes its type, use the special event handlers for the changed type
29798                        special = jQuery.event.special[type] || {};
29799
29800                        // If selector defined, determine special event api type, otherwise given type
29801                        type = (selector ? special.delegateType : special.bindType) || type;
29802
29803                        // Update special based on newly reset type
29804                        special = jQuery.event.special[type] || {};
29805
29806                        // handleObj is passed to all event handlers
29807                        handleObj = jQuery.extend({
29808                            type: type,
29809                            origType: origType,
29810                            data: data,
29811                            handler: handler,
29812                            guid: handler.guid,
29813                            selector: selector,
29814                            needsContext: selector && jQuery.expr.match.needsContext.test(selector),
29815                            namespace: namespaces.join(".")
29816                        }, handleObjIn);
29817
29818                        // Init the event handler queue if we're the first
29819                        if (!(handlers = events[type])) {
29820                            handlers = events[type] = [];
29821                            handlers.delegateCount = 0;
29822
29823                            // Only use addEventListener if the special events handler returns false
29824                            if (!special.setup ||
29825                                special.setup.call(elem, data, namespaces, eventHandle) === false) {
29826
29827                                if (elem.addEventListener) {
29828                                    elem.addEventListener(type, eventHandle);
29829                                }
29830                            }
29831                        }
29832
29833                        if (special.add) {
29834                            special.add.call(elem, handleObj);
29835
29836                            if (!handleObj.handler.guid) {
29837                                handleObj.handler.guid = handler.guid;
29838                            }
29839                        }
29840
29841                        // Add to the element's handler list, delegates in front
29842                        if (selector) {
29843                            handlers.splice(handlers.delegateCount++, 0, handleObj);
29844                        } else {
29845                            handlers.push(handleObj);
29846                        }
29847
29848                        // Keep track of which events have ever been used, for event optimization
29849                        jQuery.event.global[type] = true;
29850                    }
29851
29852                },
29853
29854                // Detach an event or set of events from an element
29855                remove: function (elem, types, handler, selector, mappedTypes) {
29856
29857                    var j, origCount, tmp,
29858                        events, t, handleObj,
29859                        special, handlers, type, namespaces, origType,
29860                        elemData = dataPriv.hasData(elem) && dataPriv.get(elem);
29861
29862                    if (!elemData || !(events = elemData.events)) {
29863                        return;
29864                    }
29865
vendor: 5,041 bytes, lines 29866-29969
29866                    // Once for each type.namespace in types; type may be omitted
29867                    types = (types || "").match(rnothtmlwhite) || [""];
29868                    t = types.length;
29869                    while (t--) {
29870                        tmp = rtypenamespace.exec(types[t]) || [];
29871                        type = origType = tmp[1];
29872                        namespaces = (tmp[2] || "").split(".").sort();
29873
29874                        // Unbind all events (on this namespace, if provided) for the element
29875                        if (!type) {
29876                            for (type in events) {
29877                                jQuery.event.remove(elem, type + types[t], handler, selector, true);
29878                            }
29879                            continue;
29880                        }
29881
29882                        special = jQuery.event.special[type] || {};
29883                        type = (selector ? special.delegateType : special.bindType) || type;
29884                        handlers = events[type] || [];
29885                        tmp = tmp[2] &&
29886                            new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
29887
29888                        // Remove matching events
29889                        origCount = j = handlers.length;
29890                        while (j--) {
29891                            handleObj = handlers[j];
29892
29893                            if ((mappedTypes || origType === handleObj.origType) &&
29894                                (!handler || handler.guid === handleObj.guid) &&
29895                                (!tmp || tmp.test(handleObj.namespace)) &&
29896                                (!selector || selector === handleObj.selector ||
29897                                    selector === "**" && handleObj.selector)) {
29898                                handlers.splice(j, 1);
29899
29900                                if (handleObj.selector) {
29901                                    handlers.delegateCount--;
29902                                }
29903                                if (special.remove) {
29904                                    special.remove.call(elem, handleObj);
29905                                }
29906                            }
29907                        }
29908
29909                        // Remove generic event handler if we removed something and no more handlers exist
29910                        // (avoids potential for endless recursion during removal of special event handlers)
29911                        if (origCount && !handlers.length) {
29912                            if (!special.teardown ||
29913                                special.teardown.call(elem, namespaces, elemData.handle) === false) {
29914
29915                                jQuery.removeEvent(elem, type, elemData.handle);
29916                            }
29917
29918                            delete events[type];
29919                        }
29920                    }
29921
29922                    // Remove data and the expando if it's no longer used
29923                    if (jQuery.isEmptyObject(events)) {
29924                        dataPriv.remove(elem, "handle events");
29925                    }
29926                },
29927
29928                dispatch: function (nativeEvent) {
29929
29930                    var i, j, ret, matched, handleObj, handlerQueue,
29931                        args = new Array(arguments.length),
29932
29933                        // Make a writable jQuery.Event from the native event object
29934                        event = jQuery.event.fix(nativeEvent),
29935
29936                        handlers = (
29937                            dataPriv.get(this, "events") || Object.create(null)
29938                        )[event.type] || [],
29939                        special = jQuery.event.special[event.type] || {};
29940
29941                    // Use the fix-ed jQuery.Event rather than the (read-only) native event
29942                    args[0] = event;
29943
29944                    for (i = 1; i < arguments.length; i++) {
29945                        args[i] = arguments[i];
29946                    }
29947
29948                    event.delegateTarget = this;
29949
29950                    // Call the preDispatch hook for the mapped type, and let it bail if desired
29951                    if (special.preDispatch && special.preDispatch.call(this, event) === false) {
29952                        return;
29953                    }
29954
29955                    // Determine handlers
29956                    handlerQueue = jQuery.event.handlers.call(this, event, handlers);
29957
29958                    // Run delegates first; they may want to stop propagation beneath us
29959                    i = 0;
29960                    while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
29961                        event.currentTarget = matched.elem;
29962
29963                        j = 0;
29964                        while ((handleObj = matched.handlers[j++]) &&
29965                        !event.isImmediatePropagationStopped()) {
29966
29967                            // If the event is namespaced, then each handler is only invoked if it is
29968                            // specially universal or its namespaces are a superset of the event's.
29969                            if (!event.rnamespace || handleObj.namespace === false ||
vendor: 17,168 bytes, lines 29970-30349
29970                                event.rnamespace.test(handleObj.namespace)) {
29971
29972                                event.handleObj = handleObj;
29973                                event.data = handleObj.data;
29974
29975                                ret = ((jQuery.event.special[handleObj.origType] || {}).handle ||
29976                                    handleObj.handler).apply(matched.elem, args);
29977
29978                                if (ret !== undefined) {
29979                                    if ((event.result = ret) === false) {
29980                                        event.preventDefault();
29981                                        event.stopPropagation();
29982                                    }
29983                                }
29984                            }
29985                        }
29986                    }
29987
29988                    // Call the postDispatch hook for the mapped type
29989                    if (special.postDispatch) {
29990                        special.postDispatch.call(this, event);
29991                    }
29992
29993                    return event.result;
29994                },
29995
29996                handlers: function (event, handlers) {
29997                    var i, handleObj, sel, matchedHandlers, matchedSelectors,
29998                        handlerQueue = [],
29999                        delegateCount = handlers.delegateCount,
30000                        cur = event.target;
30001
30002                    // Find delegate handlers
30003                    if (delegateCount &&
30004
30005                        // Support: IE <=9
30006                        // Black-hole SVG <use> instance trees (trac-13180)
30007                        cur.nodeType &&
30008
30009                        // Support: Firefox <=42
30010                        // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
30011                        // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
30012                        // Support: IE 11 only
30013                        // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
30014                        !(event.type === "click" && event.button >= 1)) {
30015
30016                        for (; cur !== this; cur = cur.parentNode || this) {
30017
30018                            // Don't check non-elements (#13208)
30019                            // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
30020                            if (cur.nodeType === 1 && !(event.type === "click" && cur.disabled === true)) {
30021                                matchedHandlers = [];
30022                                matchedSelectors = {};
30023                                for (i = 0; i < delegateCount; i++) {
30024                                    handleObj = handlers[i];
30025
30026                                    // Don't conflict with Object.prototype properties (#13203)
30027                                    sel = handleObj.selector + " ";
30028
30029                                    if (matchedSelectors[sel] === undefined) {
30030                                        matchedSelectors[sel] = handleObj.needsContext ?
30031                                            jQuery(sel, this).index(cur) > -1 :
30032                                            jQuery.find(sel, this, null, [cur]).length;
30033                                    }
30034                                    if (matchedSelectors[sel]) {
30035                                        matchedHandlers.push(handleObj);
30036                                    }
30037                                }
30038                                if (matchedHandlers.length) {
30039                                    handlerQueue.push({elem: cur, handlers: matchedHandlers});
30040                                }
30041                            }
30042                        }
30043                    }
30044
30045                    // Add the remaining (directly-bound) handlers
30046                    cur = this;
30047                    if (delegateCount < handlers.length) {
30048                        handlerQueue.push({elem: cur, handlers: handlers.slice(delegateCount)});
30049                    }
30050
30051                    return handlerQueue;
30052                },
30053
30054                addProp: function (name, hook) {
30055                    Object.defineProperty(jQuery.Event.prototype, name, {
30056                        enumerable: true,
30057                        configurable: true,
30058
30059                        get: isFunction(hook) ?
30060                            function () {
30061                                if (this.originalEvent) {
30062                                    return hook(this.originalEvent);
30063                                }
30064                            } :
30065                            function () {
30066                                if (this.originalEvent) {
30067                                    return this.originalEvent[name];
30068                                }
30069                            },
30070
30071                        set: function (value) {
30072                            Object.defineProperty(this, name, {
30073                                enumerable: true,
30074                                configurable: true,
30075                                writable: true,
30076                                value: value
30077                            });
30078                        }
30079                    });
30080                },
30081
30082                fix: function (originalEvent) {
30083                    return originalEvent[jQuery.expando] ?
30084                        originalEvent :
30085                        new jQuery.Event(originalEvent);
30086                },
30087
30088                special: {
30089                    load: {
30090
30091                        // Prevent triggered image.load events from bubbling to window.load
30092                        noBubble: true
30093                    },
30094                    click: {
30095
30096                        // Utilize native event to ensure correct state for checkable inputs
30097                        setup: function (data) {
30098
30099                            // For mutual compressibility with _default, replace `this` access with a local var.
30100                            // `|| data` is dead code meant only to preserve the variable through minification.
30101                            var el = this || data;
30102
30103                            // Claim the first handler
30104                            if (rcheckableType.test(el.type) &&
30105                                el.click && nodeName(el, "input")) {
30106
30107                                // dataPriv.set( el, "click", ... )
30108                                leverageNative(el, "click", returnTrue);
30109                            }
30110
30111                            // Return false to allow normal processing in the caller
30112                            return false;
30113                        },
30114                        trigger: function (data) {
30115
30116                            // For mutual compressibility with _default, replace `this` access with a local var.
30117                            // `|| data` is dead code meant only to preserve the variable through minification.
30118                            var el = this || data;
30119
30120                            // Force setup before triggering a click
30121                            if (rcheckableType.test(el.type) &&
30122                                el.click && nodeName(el, "input")) {
30123
30124                                leverageNative(el, "click");
30125                            }
30126
30127                            // Return non-false to allow normal event-path propagation
30128                            return true;
30129                        },
30130
30131                        // For cross-browser consistency, suppress native .click() on links
30132                        // Also prevent it if we're currently inside a leveraged native-event stack
30133                        _default: function (event) {
30134                            var target = event.target;
30135                            return rcheckableType.test(target.type) &&
30136                                target.click && nodeName(target, "input") &&
30137                                dataPriv.get(target, "click") ||
30138                                nodeName(target, "a");
30139                        }
30140                    },
30141
30142                    beforeunload: {
30143                        postDispatch: function (event) {
30144
30145                            // Support: Firefox 20+
30146                            // Firefox doesn't alert if the returnValue field is not set.
30147                            if (event.result !== undefined && event.originalEvent) {
30148                                event.originalEvent.returnValue = event.result;
30149                            }
30150                        }
30151                    }
30152                }
30153            };
30154
30155// Ensure the presence of an event listener that handles manually-triggered
30156// synthetic events by interrupting progress until reinvoked in response to
30157// *native* events that it fires directly, ensuring that state changes have
30158// already occurred before other listeners are invoked.
30159            function leverageNative(el, type, expectSync) {
30160
30161                // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
30162                if (!expectSync) {
30163                    if (dataPriv.get(el, type) === undefined) {
30164                        jQuery.event.add(el, type, returnTrue);
30165                    }
30166                    return;
30167                }
30168
30169                // Register the controller as a special universal handler for all event namespaces
30170                dataPriv.set(el, type, false);
30171                jQuery.event.add(el, type, {
30172                    namespace: false,
30173                    handler: function (event) {
30174                        var notAsync, result,
30175                            saved = dataPriv.get(this, type);
30176
30177                        if ((event.isTrigger & 1) && this[type]) {
30178
30179                            // Interrupt processing of the outer synthetic .trigger()ed event
30180                            // Saved data should be false in such cases, but might be a leftover capture object
30181                            // from an async native handler (gh-4350)
30182                            if (!saved.length) {
30183
30184                                // Store arguments for use when handling the inner native event
30185                                // There will always be at least one argument (an event object), so this array
30186                                // will not be confused with a leftover capture object.
30187                                saved = slice.call(arguments);
30188                                dataPriv.set(this, type, saved);
30189
30190                                // Trigger the native event and capture its result
30191                                // Support: IE <=9 - 11+
30192                                // focus() and blur() are asynchronous
30193                                notAsync = expectSync(this, type);
30194                                this[type]();
30195                                result = dataPriv.get(this, type);
30196                                if (saved !== result || notAsync) {
30197                                    dataPriv.set(this, type, false);
30198                                } else {
30199                                    result = {};
30200                                }
30201                                if (saved !== result) {
30202
30203                                    // Cancel the outer synthetic event
30204                                    event.stopImmediatePropagation();
30205                                    event.preventDefault();
30206                                    return result.value;
30207                                }
30208
30209                                // If this is an inner synthetic event for an event with a bubbling surrogate
30210                                // (focus or blur), assume that the surrogate already propagated from triggering the
30211                                // native event and prevent that from happening again here.
30212                                // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
30213                                // bubbling surrogate propagates *after* the non-bubbling base), but that seems
30214                                // less bad than duplication.
30215                            } else if ((jQuery.event.special[type] || {}).delegateType) {
30216                                event.stopPropagation();
30217                            }
30218
30219                            // If this is a native event triggered above, everything is now in order
30220                            // Fire an inner synthetic event with the original arguments
30221                        } else if (saved.length) {
30222
30223                            // ...and capture the result
30224                            dataPriv.set(this, type, {
30225                                value: jQuery.event.trigger(
30226                                    // Support: IE <=9 - 11+
30227                                    // Extend with the prototype to reset the above stopImmediatePropagation()
30228                                    jQuery.extend(saved[0], jQuery.Event.prototype),
30229                                    saved.slice(1),
30230                                    this
30231                                )
30232                            });
30233
30234                            // Abort handling of the native event
30235                            event.stopImmediatePropagation();
30236                        }
30237                    }
30238                });
30239            }
30240
30241            jQuery.removeEvent = function (elem, type, handle) {
30242
30243                // This "if" is needed for plain objects
30244                if (elem.removeEventListener) {
30245                    elem.removeEventListener(type, handle);
30246                }
30247            };
30248
30249            jQuery.Event = function (src, props) {
30250
30251                // Allow instantiation without the 'new' keyword
30252                if (!(this instanceof jQuery.Event)) {
30253                    return new jQuery.Event(src, props);
30254                }
30255
30256                // Event object
30257                if (src && src.type) {
30258                    this.originalEvent = src;
30259                    this.type = src.type;
30260
30261                    // Events bubbling up the document may have been marked as prevented
30262                    // by a handler lower down the tree; reflect the correct value.
30263                    this.isDefaultPrevented = src.defaultPrevented ||
30264                    src.defaultPrevented === undefined &&
30265
30266                    // Support: Android <=2.3 only
30267                    src.returnValue === false ?
30268                        returnTrue :
30269                        returnFalse;
30270
30271                    // Create target properties
30272                    // Support: Safari <=6 - 7 only
30273                    // Target should not be a text node (#504, #13143)
30274                    this.target = (src.target && src.target.nodeType === 3) ?
30275                        src.target.parentNode :
30276                        src.target;
30277
30278                    this.currentTarget = src.currentTarget;
30279                    this.relatedTarget = src.relatedTarget;
30280
30281                    // Event type
30282                } else {
30283                    this.type = src;
30284                }
30285
30286                // Put explicitly provided properties onto the event object
30287                if (props) {
30288                    jQuery.extend(this, props);
30289                }
30290
30291                // Create a timestamp if incoming event doesn't have one
30292                this.timeStamp = src && src.timeStamp || Date.now();
30293
30294                // Mark it as fixed
30295                this[jQuery.expando] = true;
30296            };
30297
30298// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
30299// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
30300            jQuery.Event.prototype = {
30301                constructor: jQuery.Event,
30302                isDefaultPrevented: returnFalse,
30303                isPropagationStopped: returnFalse,
30304                isImmediatePropagationStopped: returnFalse,
30305                isSimulated: false,
30306
30307                preventDefault: function () {
30308                    var e = this.originalEvent;
30309
30310                    this.isDefaultPrevented = returnTrue;
30311
30312                    if (e && !this.isSimulated) {
30313                        e.preventDefault();
30314                    }
30315                },
30316                stopPropagation: function () {
30317                    var e = this.originalEvent;
30318
30319                    this.isPropagationStopped = returnTrue;
30320
30321                    if (e && !this.isSimulated) {
30322                        e.stopPropagation();
30323                    }
30324                },
30325                stopImmediatePropagation: function () {
30326                    var e = this.originalEvent;
30327
30328                    this.isImmediatePropagationStopped = returnTrue;
30329
30330                    if (e && !this.isSimulated) {
30331                        e.stopImmediatePropagation();
30332                    }
30333
30334                    this.stopPropagation();
30335                }
30336            };
30337
30338// Includes all common event props including KeyEvent and MouseEvent specific props
30339            jQuery.each({
30340                altKey: true,
30341                bubbles: true,
30342                cancelable: true,
30343                changedTouches: true,
30344                ctrlKey: true,
30345                detail: true,
30346                eventPhase: true,
30347                metaKey: true,
30348                pageX: true,
30349                pageY: true,
vendor: 6,111 bytes, lines 30350-30511
30350                shiftKey: true,
30351                view: true,
30352                "char": true,
30353                code: true,
30354                charCode: true,
30355                key: true,
30356                keyCode: true,
30357                button: true,
30358                buttons: true,
30359                clientX: true,
30360                clientY: true,
30361                offsetX: true,
30362                offsetY: true,
30363                pointerId: true,
30364                pointerType: true,
30365                screenX: true,
30366                screenY: true,
30367                targetTouches: true,
30368                toElement: true,
30369                touches: true,
30370
30371                which: function (event) {
30372                    var button = event.button;
30373
30374                    // Add which for key events
30375                    if (event.which == null && rkeyEvent.test(event.type)) {
30376                        return event.charCode != null ? event.charCode : event.keyCode;
30377                    }
30378
30379                    // Add which for click: 1 === left; 2 === middle; 3 === right
30380                    if (!event.which && button !== undefined && rmouseEvent.test(event.type)) {
30381                        if (button & 1) {
30382                            return 1;
30383                        }
30384
30385                        if (button & 2) {
30386                            return 3;
30387                        }
30388
30389                        if (button & 4) {
30390                            return 2;
30391                        }
30392
30393                        return 0;
30394                    }
30395
30396                    return event.which;
30397                }
30398            }, jQuery.event.addProp);
30399
30400            jQuery.each({focus: "focusin", blur: "focusout"}, function (type, delegateType) {
30401                jQuery.event.special[type] = {
30402
30403                    // Utilize native event if possible so blur/focus sequence is correct
30404                    setup: function () {
30405
30406                        // Claim the first handler
30407                        // dataPriv.set( this, "focus", ... )
30408                        // dataPriv.set( this, "blur", ... )
30409                        leverageNative(this, type, expectSync);
30410
30411                        // Return false to allow normal processing in the caller
30412                        return false;
30413                    },
30414                    trigger: function () {
30415
30416                        // Force setup before trigger
30417                        leverageNative(this, type);
30418
30419                        // Return non-false to allow normal event-path propagation
30420                        return true;
30421                    },
30422
30423                    delegateType: delegateType
30424                };
30425            });
30426
30427// Create mouseenter/leave events using mouseover/out and event-time checks
30428// so that event delegation works in jQuery.
30429// Do the same for pointerenter/pointerleave and pointerover/pointerout
30430//
30431// Support: Safari 7 only
30432// Safari sends mouseenter too often; see:
30433// https://bugs.chromium.org/p/chromium/issues/detail?id=470258
30434// for the description of the bug (it existed in older Chrome versions as well).
30435            jQuery.each({
30436                mouseenter: "mouseover",
30437                mouseleave: "mouseout",
30438                pointerenter: "pointerover",
30439                pointerleave: "pointerout"
30440            }, function (orig, fix) {
30441                jQuery.event.special[orig] = {
30442                    delegateType: fix,
30443                    bindType: fix,
30444
30445                    handle: function (event) {
30446                        var ret,
30447                            target = this,
30448                            related = event.relatedTarget,
30449                            handleObj = event.handleObj;
30450
30451                        // For mouseenter/leave call the handler if related is outside the target.
30452                        // NB: No relatedTarget if the mouse left/entered the browser window
30453                        if (!related || (related !== target && !jQuery.contains(target, related))) {
30454                            event.type = handleObj.origType;
30455                            ret = handleObj.handler.apply(this, arguments);
30456                            event.type = fix;
30457                        }
30458                        return ret;
30459                    }
30460                };
30461            });
30462
30463            jQuery.fn.extend({
30464
30465                on: function (types, selector, data, fn) {
30466                    return on(this, types, selector, data, fn);
30467                },
30468                one: function (types, selector, data, fn) {
30469                    return on(this, types, selector, data, fn, 1);
30470                },
30471                off: function (types, selector, fn) {
30472                    var handleObj, type;
30473                    if (types && types.preventDefault && types.handleObj) {
30474
30475                        // ( event )  dispatched jQuery.Event
30476                        handleObj = types.handleObj;
30477                        jQuery(types.delegateTarget).off(
30478                            handleObj.namespace ?
30479                                handleObj.origType + "." + handleObj.namespace :
30480                                handleObj.origType,
30481                            handleObj.selector,
30482                            handleObj.handler
30483                        );
30484                        return this;
30485                    }
30486                    if (typeof types === "object") {
30487
30488                        // ( types-object [, selector] )
30489                        for (type in types) {
30490                            this.off(type, selector, types[type]);
30491                        }
30492                        return this;
30493                    }
30494                    if (selector === false || typeof selector === "function") {
30495
30496                        // ( types [, fn] )
30497                        fn = selector;
30498                        selector = undefined;
30499                    }
30500                    if (fn === false) {
30501                        fn = returnFalse;
30502                    }
30503                    return this.each(function () {
30504                        jQuery.event.remove(this, types, fn, selector);
30505                    });
30506                }
30507            });
30508
30509
30510            var
30511
vendor: 11,047 bytes, lines 30512-30773
30512                // Support: IE <=10 - 11, Edge 12 - 13 only
30513                // In IE/Edge using regex groups here causes severe slowdowns.
30514                // See https://connect.microsoft.com/IE/feedback/details/1736512/
30515                rnoInnerhtml = /<script|<style|<link/i,
30516
30517                // checked="checked" or checked
30518                rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
30519                rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
30520
30521// Prefer a tbody over its parent table for containing new rows
30522            function manipulationTarget(elem, content) {
30523                if (nodeName(elem, "table") &&
30524                    nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) {
30525
30526                    return jQuery(elem).children("tbody")[0] || elem;
30527                }
30528
30529                return elem;
30530            }
30531
30532// Replace/restore the type attribute of script elements for safe DOM manipulation
30533            function disableScript(elem) {
30534                elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
30535                return elem;
30536            }
30537
30538            function restoreScript(elem) {
30539                if ((elem.type || "").slice(0, 5) === "true/") {
30540                    elem.type = elem.type.slice(5);
30541                } else {
30542                    elem.removeAttribute("type");
30543                }
30544
30545                return elem;
30546            }
30547
30548            function cloneCopyEvent(src, dest) {
30549                var i, l, type, pdataOld, udataOld, udataCur, events;
30550
30551                if (dest.nodeType !== 1) {
30552                    return;
30553                }
30554
30555                // 1. Copy private data: events, handlers, etc.
30556                if (dataPriv.hasData(src)) {
30557                    pdataOld = dataPriv.get(src);
30558                    events = pdataOld.events;
30559
30560                    if (events) {
30561                        dataPriv.remove(dest, "handle events");
30562
30563                        for (type in events) {
30564                            for (i = 0, l = events[type].length; i < l; i++) {
30565                                jQuery.event.add(dest, type, events[type][i]);
30566                            }
30567                        }
30568                    }
30569                }
30570
30571                // 2. Copy user data
30572                if (dataUser.hasData(src)) {
30573                    udataOld = dataUser.access(src);
30574                    udataCur = jQuery.extend({}, udataOld);
30575
30576                    dataUser.set(dest, udataCur);
30577                }
30578            }
30579
30580// Fix IE bugs, see support tests
30581            function fixInput(src, dest) {
30582                var nodeName = dest.nodeName.toLowerCase();
30583
30584                // Fails to persist the checked state of a cloned checkbox or radio button.
30585                if (nodeName === "input" && rcheckableType.test(src.type)) {
30586                    dest.checked = src.checked;
30587
30588                    // Fails to return the selected option to the default selected state when cloning options
30589                } else if (nodeName === "input" || nodeName === "textarea") {
30590                    dest.defaultValue = src.defaultValue;
30591                }
30592            }
30593
30594            function domManip(collection, args, callback, ignored) {
30595
30596                // Flatten any nested arrays
30597                args = flat(args);
30598
30599                var fragment, first, scripts, hasScripts, node, doc,
30600                    i = 0,
30601                    l = collection.length,
30602                    iNoClone = l - 1,
30603                    value = args[0],
30604                    valueIsFunction = isFunction(value);
30605
30606                // We can't cloneNode fragments that contain checked, in WebKit
30607                if (valueIsFunction ||
30608                    (l > 1 && typeof value === "string" &&
30609                        !support.checkClone && rchecked.test(value))) {
30610                    return collection.each(function (index) {
30611                        var self = collection.eq(index);
30612                        if (valueIsFunction) {
30613                            args[0] = value.call(this, index, self.html());
30614                        }
30615                        domManip(self, args, callback, ignored);
30616                    });
30617                }
30618
30619                if (l) {
30620                    fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);
30621                    first = fragment.firstChild;
30622
30623                    if (fragment.childNodes.length === 1) {
30624                        fragment = first;
30625                    }
30626
30627                    // Require either new content or an interest in ignored elements to invoke the callback
30628                    if (first || ignored) {
30629                        scripts = jQuery.map(getAll(fragment, "script"), disableScript);
30630                        hasScripts = scripts.length;
30631
30632                        // Use the original fragment for the last item
30633                        // instead of the first because it can end up
30634                        // being emptied incorrectly in certain situations (#8070).
30635                        for (; i < l; i++) {
30636                            node = fragment;
30637
30638                            if (i !== iNoClone) {
30639                                node = jQuery.clone(node, true, true);
30640
30641                                // Keep references to cloned scripts for later restoration
30642                                if (hasScripts) {
30643
30644                                    // Support: Android <=4.0 only, PhantomJS 1 only
30645                                    // push.apply(_, arraylike) throws on ancient WebKit
30646                                    jQuery.merge(scripts, getAll(node, "script"));
30647                                }
30648                            }
30649
30650                            callback.call(collection[i], node, i);
30651                        }
30652
30653                        if (hasScripts) {
30654                            doc = scripts[scripts.length - 1].ownerDocument;
30655
30656                            // Reenable scripts
30657                            jQuery.map(scripts, restoreScript);
30658
30659                            // Evaluate executable scripts on first document insertion
30660                            for (i = 0; i < hasScripts; i++) {
30661                                node = scripts[i];
30662                                if (rscriptType.test(node.type || "") &&
30663                                    !dataPriv.access(node, "globalEval") &&
30664                                    jQuery.contains(doc, node)) {
30665
30666                                    if (node.src && (node.type || "").toLowerCase() !== "module") {
30667
30668                                        // Optional AJAX dependency, but won't run scripts if not present
30669                                        if (jQuery._evalUrl && !node.noModule) {
30670                                            jQuery._evalUrl(node.src, {
30671                                                nonce: node.nonce || node.getAttribute("nonce")
30672                                            }, doc);
30673                                        }
30674                                    } else {
30675                                        DOMEval(node.textContent.replace(rcleanScript, ""), node, doc);
30676                                    }
30677                                }
30678                            }
30679                        }
30680                    }
30681                }
30682
30683                return collection;
30684            }
30685
30686            function remove(elem, selector, keepData) {
30687                var node,
30688                    nodes = selector ? jQuery.filter(selector, elem) : elem,
30689                    i = 0;
30690
30691                for (; (node = nodes[i]) != null; i++) {
30692                    if (!keepData && node.nodeType === 1) {
30693                        jQuery.cleanData(getAll(node));
30694                    }
30695
30696                    if (node.parentNode) {
30697                        if (keepData && isAttached(node)) {
30698                            setGlobalEval(getAll(node, "script"));
30699                        }
30700                        node.parentNode.removeChild(node);
30701                    }
30702                }
30703
30704                return elem;
30705            }
30706
30707            jQuery.extend({
30708                htmlPrefilter: function (html) {
30709                    return html;
30710                },
30711
30712                clone: function (elem, dataAndEvents, deepDataAndEvents) {
30713                    var i, l, srcElements, destElements,
30714                        clone = elem.cloneNode(true),
30715                        inPage = isAttached(elem);
30716
30717                    // Fix IE cloning issues
30718                    if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) &&
30719                        !jQuery.isXMLDoc(elem)) {
30720
30721                        // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
30722                        destElements = getAll(clone);
30723                        srcElements = getAll(elem);
30724
30725                        for (i = 0, l = srcElements.length; i < l; i++) {
30726                            fixInput(srcElements[i], destElements[i]);
30727                        }
30728                    }
30729
30730                    // Copy the events from the original to the clone
30731                    if (dataAndEvents) {
30732                        if (deepDataAndEvents) {
30733                            srcElements = srcElements || getAll(elem);
30734                            destElements = destElements || getAll(clone);
30735
30736                            for (i = 0, l = srcElements.length; i < l; i++) {
30737                                cloneCopyEvent(srcElements[i], destElements[i]);
30738                            }
30739                        } else {
30740                            cloneCopyEvent(elem, clone);
30741                        }
30742                    }
30743
30744                    // Preserve script evaluation history
30745                    destElements = getAll(clone, "script");
30746                    if (destElements.length > 0) {
30747                        setGlobalEval(destElements, !inPage && getAll(elem, "script"));
30748                    }
30749
30750                    // Return the cloned set
30751                    return clone;
30752                },
30753
30754                cleanData: function (elems) {
30755                    var data, elem, type,
30756                        special = jQuery.event.special,
30757                        i = 0;
30758
30759                    for (; (elem = elems[i]) !== undefined; i++) {
30760                        if (acceptData(elem)) {
30761                            if ((data = elem[dataPriv.expando])) {
30762                                if (data.events) {
30763                                    for (type in data.events) {
30764                                        if (special[type]) {
30765                                            jQuery.event.remove(elem, type);
30766
30767                                            // This is a shortcut to avoid jQuery.event.remove's overhead
30768                                        } else {
30769                                            jQuery.removeEvent(elem, type, data.handle);
30770                                        }
30771                                    }
30772                                }
30773
vendor: 4,447 bytes, lines 30774-30882
30774                                // Support: Chrome <=35 - 45+
30775                                // Assign undefined instead of using delete, see Data#remove
30776                                elem[dataPriv.expando] = undefined;
30777                            }
30778                            if (elem[dataUser.expando]) {
30779
30780                                // Support: Chrome <=35 - 45+
30781                                // Assign undefined instead of using delete, see Data#remove
30782                                elem[dataUser.expando] = undefined;
30783                            }
30784                        }
30785                    }
30786                }
30787            });
30788
30789            jQuery.fn.extend({
30790                detach: function (selector) {
30791                    return remove(this, selector, true);
30792                },
30793
30794                remove: function (selector) {
30795                    return remove(this, selector);
30796                },
30797
30798                text: function (value) {
30799                    return access(this, function (value) {
30800                        return value === undefined ?
30801                            jQuery.text(this) :
30802                            this.empty().each(function () {
30803                                if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
30804                                    this.textContent = value;
30805                                }
30806                            });
30807                    }, null, value, arguments.length);
30808                },
30809
30810                append: function () {
30811                    return domManip(this, arguments, function (elem) {
30812                        if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
30813                            var target = manipulationTarget(this, elem);
30814                            target.appendChild(elem);
30815                        }
30816                    });
30817                },
30818
30819                prepend: function () {
30820                    return domManip(this, arguments, function (elem) {
30821                        if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
30822                            var target = manipulationTarget(this, elem);
30823                            target.insertBefore(elem, target.firstChild);
30824                        }
30825                    });
30826                },
30827
30828                before: function () {
30829                    return domManip(this, arguments, function (elem) {
30830                        if (this.parentNode) {
30831                            this.parentNode.insertBefore(elem, this);
30832                        }
30833                    });
30834                },
30835
30836                after: function () {
30837                    return domManip(this, arguments, function (elem) {
30838                        if (this.parentNode) {
30839                            this.parentNode.insertBefore(elem, this.nextSibling);
30840                        }
30841                    });
30842                },
30843
30844                empty: function () {
30845                    var elem,
30846                        i = 0;
30847
30848                    for (; (elem = this[i]) != null; i++) {
30849                        if (elem.nodeType === 1) {
30850
30851                            // Prevent memory leaks
30852                            jQuery.cleanData(getAll(elem, false));
30853
30854                            // Remove any remaining nodes
30855                            elem.textContent = "";
30856                        }
30857                    }
30858
30859                    return this;
30860                },
30861
30862                clone: function (dataAndEvents, deepDataAndEvents) {
30863                    dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
30864                    deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
30865
30866                    return this.map(function () {
30867                        return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
30868                    });
30869                },
30870
30871                html: function (value) {
30872                    return access(this, function (value) {
30873                        var elem = this[0] || {},
30874                            i = 0,
30875                            l = this.length;
30876
30877                        if (value === undefined && elem.nodeType === 1) {
30878                            return elem.innerHTML;
30879                        }
30880
30881                        // See if we can take a shortcut and just use innerHTML
30882                        if (typeof value === "string" && !rnoInnerhtml.test(value) &&
vendor: 4,575 bytes, lines 30883-31007
30883                            !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) {
30884
30885                            value = jQuery.htmlPrefilter(value);
30886
30887                            try {
30888                                for (; i < l; i++) {
30889                                    elem = this[i] || {};
30890
30891                                    // Remove element nodes and prevent memory leaks
30892                                    if (elem.nodeType === 1) {
30893                                        jQuery.cleanData(getAll(elem, false));
30894                                        elem.innerHTML = value;
30895                                    }
30896                                }
30897
30898                                elem = 0;
30899
30900                                // If using innerHTML throws an exception, use the fallback method
30901                            } catch (e) {
30902                            }
30903                        }
30904
30905                        if (elem) {
30906                            this.empty().append(value);
30907                        }
30908                    }, null, value, arguments.length);
30909                },
30910
30911                replaceWith: function () {
30912                    var ignored = [];
30913
30914                    // Make the changes, replacing each non-ignored context element with the new content
30915                    return domManip(this, arguments, function (elem) {
30916                        var parent = this.parentNode;
30917
30918                        if (jQuery.inArray(this, ignored) < 0) {
30919                            jQuery.cleanData(getAll(this));
30920                            if (parent) {
30921                                parent.replaceChild(elem, this);
30922                            }
30923                        }
30924
30925                        // Force callback invocation
30926                    }, ignored);
30927                }
30928            });
30929
30930            jQuery.each({
30931                appendTo: "append",
30932                prependTo: "prepend",
30933                insertBefore: "before",
30934                insertAfter: "after",
30935                replaceAll: "replaceWith"
30936            }, function (name, original) {
30937                jQuery.fn[name] = function (selector) {
30938                    var elems,
30939                        ret = [],
30940                        insert = jQuery(selector),
30941                        last = insert.length - 1,
30942                        i = 0;
30943
30944                    for (; i <= last; i++) {
30945                        elems = i === last ? this : this.clone(true);
30946                        jQuery(insert[i])[original](elems);
30947
30948                        // Support: Android <=4.0 only, PhantomJS 1 only
30949                        // .get() because push.apply(_, arraylike) throws on ancient WebKit
30950                        push.apply(ret, elems.get());
30951                    }
30952
30953                    return this.pushStack(ret);
30954                };
30955            });
30956            var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
30957
30958            var getStyles = function (elem) {
30959
30960                // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
30961                // IE throws on elements created in popups
30962                // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
30963                var view = elem.ownerDocument.defaultView;
30964
30965                if (!view || !view.opener) {
30966                    view = window;
30967                }
30968
30969                return view.getComputedStyle(elem);
30970            };
30971
30972            var swap = function (elem, options, callback) {
30973                var ret, name,
30974                    old = {};
30975
30976                // Remember the old values, and insert the new ones
30977                for (name in options) {
30978                    old[name] = elem.style[name];
30979                    elem.style[name] = options[name];
30980                }
30981
30982                ret = callback.call(elem);
30983
30984                // Revert the old values
30985                for (name in options) {
30986                    elem.style[name] = old[name];
30987                }
30988
30989                return ret;
30990            };
30991
30992
30993            var rboxStyle = new RegExp(cssExpand.join("|"), "i");
30994
30995
30996            (function () {
30997
30998                // Executing both pixelPosition & boxSizingReliable tests require only one layout
30999                // so they're executed at the same time to save the second computation.
31000                function computeStyleTests() {
31001
31002                    // This is a singleton, we need to execute it only once
31003                    if (!div) {
31004                        return;
31005                    }
31006
31007                    container.style.cssText = "position:absolute;
vendor: 4,562 bytes, lines 31007-31098
31007left:-11111px;width:60px;" +
31008                        "margin-top:1px;padding:0;border:0";
31009                    div.style.cssText =
31010                        "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
31011                        "margin:auto;border:1px;padding:1px;" +
31012                        "width:60%;top:1%";
31013                    documentElement.appendChild(container).appendChild(div);
31014
31015                    var divStyle = window.getComputedStyle(div);
31016                    pixelPositionVal = divStyle.top !== "1%";
31017
31018                    // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
31019                    reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12;
31020
31021                    // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
31022                    // Some styles come back with percentage values, even though they shouldn't
31023                    div.style.right = "60%";
31024                    pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36;
31025
31026                    // Support: IE 9 - 11 only
31027                    // Detect misreporting of content dimensions for box-sizing:border-box elements
31028                    boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36;
31029
31030                    // Support: IE 9 only
31031                    // Detect overflow:scroll screwiness (gh-3699)
31032                    // Support: Chrome <=64
31033                    // Don't get tricked when zoom affects offsetWidth (gh-4029)
31034                    div.style.position = "absolute";
31035                    scrollboxSizeVal = roundPixelMeasures(div.offsetWidth / 3) === 12;
31036
31037                    documentElement.removeChild(container);
31038
31039                    // Nullify the div so it wouldn't be stored in the memory and
31040                    // it will also be a sign that checks already performed
31041                    div = null;
31042                }
31043
31044                function roundPixelMeasures(measure) {
31045                    return Math.round(parseFloat(measure));
31046                }
31047
31048                var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
31049                    reliableTrDimensionsVal, reliableMarginLeftVal,
31050                    container = document.createElement("div"),
31051                    div = document.createElement("div");
31052
31053                // Finish early in limited (non-browser) environments
31054                if (!div.style) {
31055                    return;
31056                }
31057
31058                // Support: IE <=9 - 11 only
31059                // Style of cloned element affects source element cloned (#8908)
31060                div.style.backgroundClip = "content-box";
31061                div.cloneNode(true).style.backgroundClip = "";
31062                support.clearCloneStyle = div.style.backgroundClip === "content-box";
31063
31064                jQuery.extend(support, {
31065                    boxSizingReliable: function () {
31066                        computeStyleTests();
31067                        return boxSizingReliableVal;
31068                    },
31069                    pixelBoxStyles: function () {
31070                        computeStyleTests();
31071                        return pixelBoxStylesVal;
31072                    },
31073                    pixelPosition: function () {
31074                        computeStyleTests();
31075                        return pixelPositionVal;
31076                    },
31077                    reliableMarginLeft: function () {
31078                        computeStyleTests();
31079                        return reliableMarginLeftVal;
31080                    },
31081                    scrollboxSize: function () {
31082                        computeStyleTests();
31083                        return scrollboxSizeVal;
31084                    },
31085
31086                    // Support: IE 9 - 11+, Edge 15 - 18+
31087                    // IE/Edge misreport `getComputedStyle` of table rows with width/height
31088                    // set in CSS while `offset*` properties report correct values.
31089                    // Behavior in IE 9 is more subtle than in newer versions & it passes
31090                    // some versions of this test; make sure not to make it pass there!
31091                    reliableTrDimensions: function () {
31092                        var table, tr, trChild, trStyle;
31093                        if (reliableTrDimensionsVal == null) {
31094                            table = document.createElement("table");
31095                            tr = document.createElement("tr");
31096                            trChild = document.createElement("div");
31097
31098                            table.style.cssText = "position:absolute;
vendor: 9,481 bytes, lines 31098-31331
31098left:-11111px";
31099                            tr.style.height = "1px";
31100                            trChild.style.height = "9px";
31101
31102                            documentElement
31103                                .appendChild(table)
31104                                .appendChild(tr)
31105                                .appendChild(trChild);
31106
31107                            trStyle = window.getComputedStyle(tr);
31108                            reliableTrDimensionsVal = parseInt(trStyle.height) > 3;
31109
31110                            documentElement.removeChild(table);
31111                        }
31112                        return reliableTrDimensionsVal;
31113                    }
31114                });
31115            })();
31116
31117
31118            function curCSS(elem, name, computed) {
31119                var width, minWidth, maxWidth, ret,
31120
31121                    // Support: Firefox 51+
31122                    // Retrieving style before computed somehow
31123                    // fixes an issue with getting wrong values
31124                    // on detached elements
31125                    style = elem.style;
31126
31127                computed = computed || getStyles(elem);
31128
31129                // getPropertyValue is needed for:
31130                //   .css('filter') (IE 9 only, #12537)
31131                //   .css('--customProperty) (#3144)
31132                if (computed) {
31133                    ret = computed.getPropertyValue(name) || computed[name];
31134
31135                    if (ret === "" && !isAttached(elem)) {
31136                        ret = jQuery.style(elem, name);
31137                    }
31138
31139                    // A tribute to the "awesome hack by Dean Edwards"
31140                    // Android Browser returns percentage for some values,
31141                    // but width seems to be reliably pixels.
31142                    // This is against the CSSOM draft spec:
31143                    // https://drafts.csswg.org/cssom/#resolved-values
31144                    if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) {
31145
31146                        // Remember the original values
31147                        width = style.width;
31148                        minWidth = style.minWidth;
31149                        maxWidth = style.maxWidth;
31150
31151                        // Put in the new values to get a computed value out
31152                        style.minWidth = style.maxWidth = style.width = ret;
31153                        ret = computed.width;
31154
31155                        // Revert the changed values
31156                        style.width = width;
31157                        style.minWidth = minWidth;
31158                        style.maxWidth = maxWidth;
31159                    }
31160                }
31161
31162                return ret !== undefined ?
31163
31164                    // Support: IE <=9 - 11 only
31165                    // IE returns zIndex value as an integer.
31166                    ret + "" :
31167                    ret;
31168            }
31169
31170
31171            function addGetHookIf(conditionFn, hookFn) {
31172
31173                // Define the hook, we'll check on the first run if it's really needed.
31174                return {
31175                    get: function () {
31176                        if (conditionFn()) {
31177
31178                            // Hook not needed (or it's not possible to use it due
31179                            // to missing dependency), remove it.
31180                            delete this.get;
31181                            return;
31182                        }
31183
31184                        // Hook needed; redefine it so that the support test is not executed again.
31185                        return (this.get = hookFn).apply(this, arguments);
31186                    }
31187                };
31188            }
31189
31190
31191            var cssPrefixes = ["Webkit", "Moz", "ms"],
31192                emptyStyle = document.createElement("div").style,
31193                vendorProps = {};
31194
31195// Return a vendor-prefixed property or undefined
31196            function vendorPropName(name) {
31197
31198                // Check for vendor prefixed names
31199                var capName = name[0].toUpperCase() + name.slice(1),
31200                    i = cssPrefixes.length;
31201
31202                while (i--) {
31203                    name = cssPrefixes[i] + capName;
31204                    if (name in emptyStyle) {
31205                        return name;
31206                    }
31207                }
31208            }
31209
31210// Return a potentially-mapped jQuery.cssProps or vendor prefixed property
31211            function finalPropName(name) {
31212                var final = jQuery.cssProps[name] || vendorProps[name];
31213
31214                if (final) {
31215                    return final;
31216                }
31217                if (name in emptyStyle) {
31218                    return name;
31219                }
31220                return vendorProps[name] = vendorPropName(name) || name;
31221            }
31222
31223
31224            var
31225
31226                // Swappable if display is none or starts with table
31227                // except "table", "table-cell", or "table-caption"
31228                // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
31229                rdisplayswap = /^(none|table(?!-c[ea]).+)/,
31230                rcustomProp = /^--/,
31231                cssShow = {position: "absolute", visibility: "hidden", display: "block"},
31232                cssNormalTransform = {
31233                    letterSpacing: "0",
31234                    fontWeight: "400"
31235                };
31236
31237            function setPositiveNumber(_elem, value, subtract) {
31238
31239                // Any relative (+/-) values have already been
31240                // normalized at this point
31241                var matches = rcssNum.exec(value);
31242                return matches ?
31243
31244                    // Guard against undefined "subtract", e.g., when used as in cssHooks
31245                    Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") :
31246                    value;
31247            }
31248
31249            function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {
31250                var i = dimension === "width" ? 1 : 0,
31251                    extra = 0,
31252                    delta = 0;
31253
31254                // Adjustment may not be necessary
31255                if (box === (isBorderBox ? "border" : "content")) {
31256                    return 0;
31257                }
31258
31259                for (; i < 4; i += 2) {
31260
31261                    // Both box models exclude margin
31262                    if (box === "margin") {
31263                        delta += jQuery.css(elem, box + cssExpand[i], true, styles);
31264                    }
31265
31266                    // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
31267                    if (!isBorderBox) {
31268
31269                        // Add padding
31270                        delta += jQuery.css(elem, "padding" + cssExpand[i], true, styles);
31271
31272                        // For "border" or "margin", add border
31273                        if (box !== "padding") {
31274                            delta += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
31275
31276                            // But still keep track of it otherwise
31277                        } else {
31278                            extra += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
31279                        }
31280
31281                        // If we get here with a border-box (content + padding + border), we're seeking "content" or
31282                        // "padding" or "margin"
31283                    } else {
31284
31285                        // For "content", subtract padding
31286                        if (box === "content") {
31287                            delta -= jQuery.css(elem, "padding" + cssExpand[i], true, styles);
31288                        }
31289
31290                        // For "content" or "padding", subtract border
31291                        if (box !== "margin") {
31292                            delta -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
31293                        }
31294                    }
31295                }
31296
31297                // Account for positive content-box scroll gutter when requested by providing computedVal
31298                if (!isBorderBox && computedVal >= 0) {
31299
31300                    // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
31301                    // Assuming integer scroll gutter, subtract the rest and round down
31302                    delta += Math.max(0, Math.ceil(
31303                        elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] -
31304                        computedVal -
31305                        delta -
31306                        extra -
31307                        0.5
31308
31309                        // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
31310                        // Use an explicit zero to avoid NaN (gh-3964)
31311                    )) || 0;
31312                }
31313
31314                return delta;
31315            }
31316
31317            function getWidthOrHeight(elem, dimension, extra) {
31318
31319                // Start with computed style
31320                var styles = getStyles(elem),
31321
31322                    // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
31323                    // Fake content-box until we know it's needed to know the true value.
31324                    boxSizingNeeded = !support.boxSizingReliable() || extra,
31325                    isBorderBox = boxSizingNeeded &&
31326                        jQuery.css(elem, "boxSizing", false, styles) === "border-box",
31327                    valueIsBorderBox = isBorderBox,
31328
31329                    val = curCSS(elem, dimension, styles),
31330                    offsetProp = "offset" + dimension[0].toUpperCase() + dimension.slice(1);
31331
vendor: 10,266 bytes, lines 31332-31563
31332                // Support: Firefox <=54
31333                // Return a confounding non-pixel value or feign ignorance, as appropriate.
31334                if (rnumnonpx.test(val)) {
31335                    if (!extra) {
31336                        return val;
31337                    }
31338                    val = "auto";
31339                }
31340
31341
31342                // Support: IE 9 - 11 only
31343                // Use offsetWidth/offsetHeight for when box sizing is unreliable.
31344                // In those cases, the computed value can be trusted to be border-box.
31345                if ((!support.boxSizingReliable() && isBorderBox ||
31346
31347                        // Support: IE 10 - 11+, Edge 15 - 18+
31348                        // IE/Edge misreport `getComputedStyle` of table rows with width/height
31349                        // set in CSS while `offset*` properties report correct values.
31350                        // Interestingly, in some cases IE 9 doesn't suffer from this issue.
31351                        !support.reliableTrDimensions() && nodeName(elem, "tr") ||
31352
31353                        // Fall back to offsetWidth/offsetHeight when value is "auto"
31354                        // This happens for inline elements with no explicit setting (gh-3571)
31355                        val === "auto" ||
31356
31357                        // Support: Android <=4.1 - 4.3 only
31358                        // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
31359                        !parseFloat(val) && jQuery.css(elem, "display", false, styles) === "inline") &&
31360
31361                    // Make sure the element is visible & connected
31362                    elem.getClientRects().length) {
31363
31364                    isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box";
31365
31366                    // Where available, offsetWidth/offsetHeight approximate border box dimensions.
31367                    // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
31368                    // retrieved value as a content box dimension.
31369                    valueIsBorderBox = offsetProp in elem;
31370                    if (valueIsBorderBox) {
31371                        val = elem[offsetProp];
31372                    }
31373                }
31374
31375                // Normalize "" and auto
31376                val = parseFloat(val) || 0;
31377
31378                // Adjust for the element's box model
31379                return (val +
31380                    boxModelAdjustment(
31381                        elem,
31382                        dimension,
31383                        extra || (isBorderBox ? "border" : "content"),
31384                        valueIsBorderBox,
31385                        styles,
31386
31387                        // Provide the current computed size to request scroll gutter calculation (gh-3589)
31388                        val
31389                    )
31390                ) + "px";
31391            }
31392
31393            jQuery.extend({
31394
31395                // Add in style property hooks for overriding the default
31396                // behavior of getting and setting a style property
31397                cssHooks: {
31398                    opacity: {
31399                        get: function (elem, computed) {
31400                            if (computed) {
31401
31402                                // We should always get a number back from opacity
31403                                var ret = curCSS(elem, "opacity");
31404                                return ret === "" ? "1" : ret;
31405                            }
31406                        }
31407                    }
31408                },
31409
31410                // Don't automatically add "px" to these possibly-unitless properties
31411                cssNumber: {
31412                    "animationIterationCount": true,
31413                    "columnCount": true,
31414                    "fillOpacity": true,
31415                    "flexGrow": true,
31416                    "flexShrink": true,
31417                    "fontWeight": true,
31418                    "gridArea": true,
31419                    "gridColumn": true,
31420                    "gridColumnEnd": true,
31421                    "gridColumnStart": true,
31422                    "gridRow": true,
31423                    "gridRowEnd": true,
31424                    "gridRowStart": true,
31425                    "lineHeight": true,
31426                    "opacity": true,
31427                    "order": true,
31428                    "orphans": true,
31429                    "widows": true,
31430                    "zIndex": true,
31431                    "zoom": true
31432                },
31433
31434                // Add in properties whose names you wish to fix before
31435                // setting or getting the value
31436                cssProps: {},
31437
31438                // Get and set the style property on a DOM Node
31439                style: function (elem, name, value, extra) {
31440
31441                    // Don't set styles on text and comment nodes
31442                    if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
31443                        return;
31444                    }
31445
31446                    // Make sure that we're working with the right name
31447                    var ret, type, hooks,
31448                        origName = camelCase(name),
31449                        isCustomProp = rcustomProp.test(name),
31450                        style = elem.style;
31451
31452                    // Make sure that we're working with the right name. We don't
31453                    // want to query the value if it is a CSS custom property
31454                    // since they are user-defined.
31455                    if (!isCustomProp) {
31456                        name = finalPropName(origName);
31457                    }
31458
31459                    // Gets hook for the prefixed version, then unprefixed version
31460                    hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
31461
31462                    // Check if we're setting a value
31463                    if (value !== undefined) {
31464                        type = typeof value;
31465
31466                        // Convert "+=" or "-=" to relative numbers (#7345)
31467                        if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) {
31468                            value = adjustCSS(elem, name, ret);
31469
31470                            // Fixes bug #9237
31471                            type = "number";
31472                        }
31473
31474                        // Make sure that null and NaN values aren't set (#7116)
31475                        if (value == null || value !== value) {
31476                            return;
31477                        }
31478
31479                        // If a number was passed in, add the unit (except for certain CSS properties)
31480                        // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
31481                        // "px" to a few hardcoded values.
31482                        if (type === "number" && !isCustomProp) {
31483                            value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px");
31484                        }
31485
31486                        // background-* props affect original clone's values
31487                        if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
31488                            style[name] = "inherit";
31489                        }
31490
31491                        // If a hook was provided, use that value, otherwise just set the specified value
31492                        if (!hooks || !("set" in hooks) ||
31493                            (value = hooks.set(elem, value, extra)) !== undefined) {
31494
31495                            if (isCustomProp) {
31496                                style.setProperty(name, value);
31497                            } else {
31498                                style[name] = value;
31499                            }
31500                        }
31501
31502                    } else {
31503
31504                        // If a hook was provided get the non-computed value from there
31505                        if (hooks && "get" in hooks &&
31506                            (ret = hooks.get(elem, false, extra)) !== undefined) {
31507
31508                            return ret;
31509                        }
31510
31511                        // Otherwise just get the value from the style object
31512                        return style[name];
31513                    }
31514                },
31515
31516                css: function (elem, name, extra, styles) {
31517                    var val, num, hooks,
31518                        origName = camelCase(name),
31519                        isCustomProp = rcustomProp.test(name);
31520
31521                    // Make sure that we're working with the right name. We don't
31522                    // want to modify the value if it is a CSS custom property
31523                    // since they are user-defined.
31524                    if (!isCustomProp) {
31525                        name = finalPropName(origName);
31526                    }
31527
31528                    // Try prefixed name followed by the unprefixed name
31529                    hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
31530
31531                    // If a hook was provided get the computed value from there
31532                    if (hooks && "get" in hooks) {
31533                        val = hooks.get(elem, true, extra);
31534                    }
31535
31536                    // Otherwise, if a way to get the computed value exists, use that
31537                    if (val === undefined) {
31538                        val = curCSS(elem, name, styles);
31539                    }
31540
31541                    // Convert "normal" to computed value
31542                    if (val === "normal" && name in cssNormalTransform) {
31543                        val = cssNormalTransform[name];
31544                    }
31545
31546                    // Make numeric if forced or a qualifier was provided and val looks numeric
31547                    if (extra === "" || extra) {
31548                        num = parseFloat(val);
31549                        return extra === true || isFinite(num) ? num || 0 : val;
31550                    }
31551
31552                    return val;
31553                }
31554            });
31555
31556            jQuery.each(["height", "width"], function (_i, dimension) {
31557                jQuery.cssHooks[dimension] = {
31558                    get: function (elem, computed, extra) {
31559                        if (computed) {
31560
31561                            // Certain elements can have dimension info if we invisibly show them
31562                            // but it must have a current display style that would benefit
31563                            return rdisplayswap.test(jQuery.css(elem, "dis
vendor: 15,455 bytes, lines 31563-31935
31563play")) &&
31564
31565                            // Support: Safari 8+
31566                            // Table columns in Safari have non-zero offsetWidth & zero
31567                            // getBoundingClientRect().width unless display is changed.
31568                            // Support: IE <=11 only
31569                            // Running getBoundingClientRect on a disconnected node
31570                            // in IE throws an error.
31571                            (!elem.getClientRects().length || !elem.getBoundingClientRect().width) ?
31572                                swap(elem, cssShow, function () {
31573                                    return getWidthOrHeight(elem, dimension, extra);
31574                                }) :
31575                                getWidthOrHeight(elem, dimension, extra);
31576                        }
31577                    },
31578
31579                    set: function (elem, value, extra) {
31580                        var matches,
31581                            styles = getStyles(elem),
31582
31583                            // Only read styles.position if the test has a chance to fail
31584                            // to avoid forcing a reflow.
31585                            scrollboxSizeBuggy = !support.scrollboxSize() &&
31586                                styles.position === "absolute",
31587
31588                            // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
31589                            boxSizingNeeded = scrollboxSizeBuggy || extra,
31590                            isBorderBox = boxSizingNeeded &&
31591                                jQuery.css(elem, "boxSizing", false, styles) === "border-box",
31592                            subtract = extra ?
31593                                boxModelAdjustment(
31594                                    elem,
31595                                    dimension,
31596                                    extra,
31597                                    isBorderBox,
31598                                    styles
31599                                ) :
31600                                0;
31601
31602                        // Account for unreliable border-box dimensions by comparing offset* to computed and
31603                        // faking a content-box to get border and padding (gh-3699)
31604                        if (isBorderBox && scrollboxSizeBuggy) {
31605                            subtract -= Math.ceil(
31606                                elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] -
31607                                parseFloat(styles[dimension]) -
31608                                boxModelAdjustment(elem, dimension, "border", false, styles) -
31609                                0.5
31610                            );
31611                        }
31612
31613                        // Convert to pixels if value adjustment is needed
31614                        if (subtract && (matches = rcssNum.exec(value)) &&
31615                            (matches[3] || "px") !== "px") {
31616
31617                            elem.style[dimension] = value;
31618                            value = jQuery.css(elem, dimension);
31619                        }
31620
31621                        return setPositiveNumber(elem, value, subtract);
31622                    }
31623                };
31624            });
31625
31626            jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft,
31627                function (elem, computed) {
31628                    if (computed) {
31629                        return (parseFloat(curCSS(elem, "marginLeft")) ||
31630                            elem.getBoundingClientRect().left -
31631                            swap(elem, {marginLeft: 0}, function () {
31632                                return elem.getBoundingClientRect().left;
31633                            })
31634                        ) + "px";
31635                    }
31636                }
31637            );
31638
31639// These hooks are used by animate to expand properties
31640            jQuery.each({
31641                margin: "",
31642                padding: "",
31643                border: "Width"
31644            }, function (prefix, suffix) {
31645                jQuery.cssHooks[prefix + suffix] = {
31646                    expand: function (value) {
31647                        var i = 0,
31648                            expanded = {},
31649
31650                            // Assumes a single number if not a string
31651                            parts = typeof value === "string" ? value.split(" ") : [value];
31652
31653                        for (; i < 4; i++) {
31654                            expanded[prefix + cssExpand[i] + suffix] =
31655                                parts[i] || parts[i - 2] || parts[0];
31656                        }
31657
31658                        return expanded;
31659                    }
31660                };
31661
31662                if (prefix !== "margin") {
31663                    jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
31664                }
31665            });
31666
31667            jQuery.fn.extend({
31668                css: function (name, value) {
31669                    return access(this, function (elem, name, value) {
31670                        var styles, len,
31671                            map = {},
31672                            i = 0;
31673
31674                        if (Array.isArray(name)) {
31675                            styles = getStyles(elem);
31676                            len = name.length;
31677
31678                            for (; i < len; i++) {
31679                                map[name[i]] = jQuery.css(elem, name[i], false, styles);
31680                            }
31681
31682                            return map;
31683                        }
31684
31685                        return value !== undefined ?
31686                            jQuery.style(elem, name, value) :
31687                            jQuery.css(elem, name);
31688                    }, name, value, arguments.length > 1);
31689                }
31690            });
31691
31692
31693            function Tween(elem, options, prop, end, easing) {
31694                return new Tween.prototype.init(elem, options, prop, end, easing);
31695            }
31696
31697            jQuery.Tween = Tween;
31698
31699            Tween.prototype = {
31700                constructor: Tween,
31701                init: function (elem, options, prop, end, easing, unit) {
31702                    this.elem = elem;
31703                    this.prop = prop;
31704                    this.easing = easing || jQuery.easing._default;
31705                    this.options = options;
31706                    this.start = this.now = this.cur();
31707                    this.end = end;
31708                    this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px");
31709                },
31710                cur: function () {
31711                    var hooks = Tween.propHooks[this.prop];
31712
31713                    return hooks && hooks.get ?
31714                        hooks.get(this) :
31715                        Tween.propHooks._default.get(this);
31716                },
31717                run: function (percent) {
31718                    var eased,
31719                        hooks = Tween.propHooks[this.prop];
31720
31721                    if (this.options.duration) {
31722                        this.pos = eased = jQuery.easing[this.easing](
31723                            percent, this.options.duration * percent, 0, 1, this.options.duration
31724                        );
31725                    } else {
31726                        this.pos = eased = percent;
31727                    }
31728                    this.now = (this.end - this.start) * eased + this.start;
31729
31730                    if (this.options.step) {
31731                        this.options.step.call(this.elem, this.now, this);
31732                    }
31733
31734                    if (hooks && hooks.set) {
31735                        hooks.set(this);
31736                    } else {
31737                        Tween.propHooks._default.set(this);
31738                    }
31739                    return this;
31740                }
31741            };
31742
31743            Tween.prototype.init.prototype = Tween.prototype;
31744
31745            Tween.propHooks = {
31746                _default: {
31747                    get: function (tween) {
31748                        var result;
31749
31750                        // Use a property on the element directly when it is not a DOM element,
31751                        // or when there is no matching style property that exists.
31752                        if (tween.elem.nodeType !== 1 ||
31753                            tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {
31754                            return tween.elem[tween.prop];
31755                        }
31756
31757                        // Passing an empty string as a 3rd parameter to .css will automatically
31758                        // attempt a parseFloat and fallback to a string if the parse fails.
31759                        // Simple values such as "10px" are parsed to Float;
31760                        // complex values such as "rotate(1rad)" are returned as-is.
31761                        result = jQuery.css(tween.elem, tween.prop, "");
31762
31763                        // Empty strings, null, undefined and "auto" are converted to 0.
31764                        return !result || result === "auto" ? 0 : result;
31765                    },
31766                    set: function (tween) {
31767
31768                        // Use step hook for back compat.
31769                        // Use cssHook if its there.
31770                        // Use .style if available and use plain properties where available.
31771                        if (jQuery.fx.step[tween.prop]) {
31772                            jQuery.fx.step[tween.prop](tween);
31773                        } else if (tween.elem.nodeType === 1 && (
31774                            jQuery.cssHooks[tween.prop] ||
31775                            tween.elem.style[finalPropName(tween.prop)] != null)) {
31776                            jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
31777                        } else {
31778                            tween.elem[tween.prop] = tween.now;
31779                        }
31780                    }
31781                }
31782            };
31783
31784// Support: IE <=9 only
31785// Panic based approach to setting things on disconnected nodes
31786            Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
31787                set: function (tween) {
31788                    if (tween.elem.nodeType && tween.elem.parentNode) {
31789                        tween.elem[tween.prop] = tween.now;
31790                    }
31791                }
31792            };
31793
31794            jQuery.easing = {
31795                linear: function (p) {
31796                    return p;
31797                },
31798                swing: function (p) {
31799                    return 0.5 - Math.cos(p * Math.PI) / 2;
31800                },
31801                _default: "swing"
31802            };
31803
31804            jQuery.fx = Tween.prototype.init;
31805
31806// Back compat <1.8 extension point
31807            jQuery.fx.step = {};
31808
31809
31810            var
31811                fxNow, inProgress,
31812                rfxtypes = /^(?:toggle|show|hide)$/,
31813                rrun = /queueHooks$/;
31814
31815            function schedule() {
31816                if (inProgress) {
31817                    if (document.hidden === false && window.requestAnimationFrame) {
31818                        window.requestAnimationFrame(schedule);
31819                    } else {
31820                        window.setTimeout(schedule, jQuery.fx.interval);
31821                    }
31822
31823                    jQuery.fx.tick();
31824                }
31825            }
31826
31827// Animations created synchronously will run synchronously
31828            function createFxNow() {
31829                window.setTimeout(function () {
31830                    fxNow = undefined;
31831                });
31832                return (fxNow = Date.now());
31833            }
31834
31835// Generate parameters to create a standard animation
31836            function genFx(type, includeWidth) {
31837                var which,
31838                    i = 0,
31839                    attrs = {height: type};
31840
31841                // If we include width, step value is 1 to do all cssExpand values,
31842                // otherwise step value is 2 to skip over Left and Right
31843                includeWidth = includeWidth ? 1 : 0;
31844                for (; i < 4; i += 2 - includeWidth) {
31845                    which = cssExpand[i];
31846                    attrs["margin" + which] = attrs["padding" + which] = type;
31847                }
31848
31849                if (includeWidth) {
31850                    attrs.opacity = attrs.width = type;
31851                }
31852
31853                return attrs;
31854            }
31855
31856            function createTween(value, prop, animation) {
31857                var tween,
31858                    collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]),
31859                    index = 0,
31860                    length = collection.length;
31861                for (; index < length; index++) {
31862                    if ((tween = collection[index].call(animation, prop, value))) {
31863
31864                        // We're done with this property
31865                        return tween;
31866                    }
31867                }
31868            }
31869
31870            function defaultPrefilter(elem, props, opts) {
31871                var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
31872                    isBox = "width" in props || "height" in props,
31873                    anim = this,
31874                    orig = {},
31875                    style = elem.style,
31876                    hidden = elem.nodeType && isHiddenWithinTree(elem),
31877                    dataShow = dataPriv.get(elem, "fxshow");
31878
31879                // Queue-skipping animations hijack the fx hooks
31880                if (!opts.queue) {
31881                    hooks = jQuery._queueHooks(elem, "fx");
31882                    if (hooks.unqueued == null) {
31883                        hooks.unqueued = 0;
31884                        oldfire = hooks.empty.fire;
31885                        hooks.empty.fire = function () {
31886                            if (!hooks.unqueued) {
31887                                oldfire();
31888                            }
31889                        };
31890                    }
31891                    hooks.unqueued++;
31892
31893                    anim.always(function () {
31894
31895                        // Ensure the complete handler is called before this completes
31896                        anim.always(function () {
31897                            hooks.unqueued--;
31898                            if (!jQuery.queue(elem, "fx").length) {
31899                                hooks.empty.fire();
31900                            }
31901                        });
31902                    });
31903                }
31904
31905                // Detect show/hide animations
31906                for (prop in props) {
31907                    value = props[prop];
31908                    if (rfxtypes.test(value)) {
31909                        delete props[prop];
31910                        toggle = toggle || value === "toggle";
31911                        if (value === (hidden ? "hide" : "show")) {
31912
31913                            // Pretend to be hidden if this is a "show" and
31914                            // there is still data from a stopped show/hide
31915                            if (value === "show" && dataShow && dataShow[prop] !== undefined) {
31916                                hidden = true;
31917
31918                                // Ignore all other no-op show/hide data
31919                            } else {
31920                                continue;
31921                            }
31922                        }
31923                        orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
31924                    }
31925                }
31926
31927                // Bail out if this is a no-op like .hide().hide()
31928                propTween = !jQuery.isEmptyObject(props);
31929                if (!propTween && jQuery.isEmptyObject(orig)) {
31930                    return;
31931                }
31932
31933                // Restrict "overflow" and "display" styles during box animations
31934                if (isBox && elem.nodeType === 1) {
31935
vendor: 6,061 bytes, lines 31936-32073
31936                    // Support: IE <=9 - 11, Edge 12 - 15
31937                    // Record all 3 overflow attributes because IE does not infer the shorthand
31938                    // from identically-valued overflowX and overflowY and Edge just mirrors
31939                    // the overflowX value there.
31940                    opts.overflow = [style.overflow, style.overflowX, style.overflowY];
31941
31942                    // Identify a display type, preferring old show/hide data over the CSS cascade
31943                    restoreDisplay = dataShow && dataShow.display;
31944                    if (restoreDisplay == null) {
31945                        restoreDisplay = dataPriv.get(elem, "display");
31946                    }
31947                    display = jQuery.css(elem, "display");
31948                    if (display === "none") {
31949                        if (restoreDisplay) {
31950                            display = restoreDisplay;
31951                        } else {
31952
31953                            // Get nonempty value(s) by temporarily forcing visibility
31954                            showHide([elem], true);
31955                            restoreDisplay = elem.style.display || restoreDisplay;
31956                            display = jQuery.css(elem, "display");
31957                            showHide([elem]);
31958                        }
31959                    }
31960
31961                    // Animate inline elements as inline-block
31962                    if (display === "inline" || display === "inline-block" && restoreDisplay != null) {
31963                        if (jQuery.css(elem, "float") === "none") {
31964
31965                            // Restore the original display value at the end of pure show/hide animations
31966                            if (!propTween) {
31967                                anim.done(function () {
31968                                    style.display = restoreDisplay;
31969                                });
31970                                if (restoreDisplay == null) {
31971                                    display = style.display;
31972                                    restoreDisplay = display === "none" ? "" : display;
31973                                }
31974                            }
31975                            style.display = "inline-block";
31976                        }
31977                    }
31978                }
31979
31980                if (opts.overflow) {
31981                    style.overflow = "hidden";
31982                    anim.always(function () {
31983                        style.overflow = opts.overflow[0];
31984                        style.overflowX = opts.overflow[1];
31985                        style.overflowY = opts.overflow[2];
31986                    });
31987                }
31988
31989                // Implement show/hide animations
31990                propTween = false;
31991                for (prop in orig) {
31992
31993                    // General show/hide setup for this element animation
31994                    if (!propTween) {
31995                        if (dataShow) {
31996                            if ("hidden" in dataShow) {
31997                                hidden = dataShow.hidden;
31998                            }
31999                        } else {
32000                            dataShow = dataPriv.access(elem, "fxshow", {display: restoreDisplay});
32001                        }
32002
32003                        // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
32004                        if (toggle) {
32005                            dataShow.hidden = !hidden;
32006                        }
32007
32008                        // Show elements before animating them
32009                        if (hidden) {
32010                            showHide([elem], true);
32011                        }
32012
32013                        /* eslint-disable no-loop-func */
32014
32015                        anim.done(function () {
32016
32017                            /* eslint-enable no-loop-func */
32018
32019                            // The final step of a "hide" animation is actually hiding the element
32020                            if (!hidden) {
32021                                showHide([elem]);
32022                            }
32023                            dataPriv.remove(elem, "fxshow");
32024                            for (prop in orig) {
32025                                jQuery.style(elem, prop, orig[prop]);
32026                            }
32027                        });
32028                    }
32029
32030                    // Per-property setup
32031                    propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
32032                    if (!(prop in dataShow)) {
32033                        dataShow[prop] = propTween.start;
32034                        if (hidden) {
32035                            propTween.end = propTween.start;
32036                            propTween.start = 0;
32037                        }
32038                    }
32039                }
32040            }
32041
32042            function propFilter(props, specialEasing) {
32043                var index, name, easing, value, hooks;
32044
32045                // camelCase, specialEasing and expand cssHook pass
32046                for (index in props) {
32047                    name = camelCase(index);
32048                    easing = specialEasing[name];
32049                    value = props[index];
32050                    if (Array.isArray(value)) {
32051                        easing = value[1];
32052                        value = props[index] = value[0];
32053                    }
32054
32055                    if (index !== name) {
32056                        props[name] = value;
32057                        delete props[index];
32058                    }
32059
32060                    hooks = jQuery.cssHooks[name];
32061                    if (hooks && "expand" in hooks) {
32062                        value = hooks.expand(value);
32063                        delete props[name];
32064
32065                        // Not quite $.extend, this won't overwrite existing keys.
32066                        // Reusing 'index' because we have the correct "name"
32067                        for (index in value) {
32068                            if (!(index in props)) {
32069                                props[index] = value[index];
32070                                specialEasing[index] = easing;
32071                            }
32072                        }
32073                    } else {
vendor: 24,603 bytes, lines 32074-32705
32074                        specialEasing[name] = easing;
32075                    }
32076                }
32077            }
32078
32079            function Animation(elem, properties, options) {
32080                var result,
32081                    stopped,
32082                    index = 0,
32083                    length = Animation.prefilters.length,
32084                    deferred = jQuery.Deferred().always(function () {
32085
32086                        // Don't match elem in the :animated selector
32087                        delete tick.elem;
32088                    }),
32089                    tick = function () {
32090                        if (stopped) {
32091                            return false;
32092                        }
32093                        var currentTime = fxNow || createFxNow(),
32094                            remaining = Math.max(0, animation.startTime + animation.duration - currentTime),
32095
32096                            // Support: Android 2.3 only
32097                            // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
32098                            temp = remaining / animation.duration || 0,
32099                            percent = 1 - temp,
32100                            index = 0,
32101                            length = animation.tweens.length;
32102
32103                        for (; index < length; index++) {
32104                            animation.tweens[index].run(percent);
32105                        }
32106
32107                        deferred.notifyWith(elem, [animation, percent, remaining]);
32108
32109                        // If there's more to do, yield
32110                        if (percent < 1 && length) {
32111                            return remaining;
32112                        }
32113
32114                        // If this was an empty animation, synthesize a final progress notification
32115                        if (!length) {
32116                            deferred.notifyWith(elem, [animation, 1, 0]);
32117                        }
32118
32119                        // Resolve the animation and report its conclusion
32120                        deferred.resolveWith(elem, [animation]);
32121                        return false;
32122                    },
32123                    animation = deferred.promise({
32124                        elem: elem,
32125                        props: jQuery.extend({}, properties),
32126                        opts: jQuery.extend(true, {
32127                            specialEasing: {},
32128                            easing: jQuery.easing._default
32129                        }, options),
32130                        originalProperties: properties,
32131                        originalOptions: options,
32132                        startTime: fxNow || createFxNow(),
32133                        duration: options.duration,
32134                        tweens: [],
32135                        createTween: function (prop, end) {
32136                            var tween = jQuery.Tween(elem, animation.opts, prop, end,
32137                                animation.opts.specialEasing[prop] || animation.opts.easing);
32138                            animation.tweens.push(tween);
32139                            return tween;
32140                        },
32141                        stop: function (gotoEnd) {
32142                            var index = 0,
32143
32144                                // If we are going to the end, we want to run all the tweens
32145                                // otherwise we skip this part
32146                                length = gotoEnd ? animation.tweens.length : 0;
32147                            if (stopped) {
32148                                return this;
32149                            }
32150                            stopped = true;
32151                            for (; index < length; index++) {
32152                                animation.tweens[index].run(1);
32153                            }
32154
32155                            // Resolve when we played the last frame; otherwise, reject
32156                            if (gotoEnd) {
32157                                deferred.notifyWith(elem, [animation, 1, 0]);
32158                                deferred.resolveWith(elem, [animation, gotoEnd]);
32159                            } else {
32160                                deferred.rejectWith(elem, [animation, gotoEnd]);
32161                            }
32162                            return this;
32163                        }
32164                    }),
32165                    props = animation.props;
32166
32167                propFilter(props, animation.opts.specialEasing);
32168
32169                for (; index < length; index++) {
32170                    result = Animation.prefilters[index].call(animation, elem, props, animation.opts);
32171                    if (result) {
32172                        if (isFunction(result.stop)) {
32173                            jQuery._queueHooks(animation.elem, animation.opts.queue).stop =
32174                                result.stop.bind(result);
32175                        }
32176                        return result;
32177                    }
32178                }
32179
32180                jQuery.map(props, createTween, animation);
32181
32182                if (isFunction(animation.opts.start)) {
32183                    animation.opts.start.call(elem, animation);
32184                }
32185
32186                // Attach callbacks from options
32187                animation
32188                    .progress(animation.opts.progress)
32189                    .done(animation.opts.done, animation.opts.complete)
32190                    .fail(animation.opts.fail)
32191                    .always(animation.opts.always);
32192
32193                jQuery.fx.timer(
32194                    jQuery.extend(tick, {
32195                        elem: elem,
32196                        anim: animation,
32197                        queue: animation.opts.queue
32198                    })
32199                );
32200
32201                return animation;
32202            }
32203
32204            jQuery.Animation = jQuery.extend(Animation, {
32205
32206                tweeners: {
32207                    "*": [function (prop, value) {
32208                        var tween = this.createTween(prop, value);
32209                        adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);
32210                        return tween;
32211                    }]
32212                },
32213
32214                tweener: function (props, callback) {
32215                    if (isFunction(props)) {
32216                        callback = props;
32217                        props = ["*"];
32218                    } else {
32219                        props = props.match(rnothtmlwhite);
32220                    }
32221
32222                    var prop,
32223                        index = 0,
32224                        length = props.length;
32225
32226                    for (; index < length; index++) {
32227                        prop = props[index];
32228                        Animation.tweeners[prop] = Animation.tweeners[prop] || [];
32229                        Animation.tweeners[prop].unshift(callback);
32230                    }
32231                },
32232
32233                prefilters: [defaultPrefilter],
32234
32235                prefilter: function (callback, prepend) {
32236                    if (prepend) {
32237                        Animation.prefilters.unshift(callback);
32238                    } else {
32239                        Animation.prefilters.push(callback);
32240                    }
32241                }
32242            });
32243
32244            jQuery.speed = function (speed, easing, fn) {
32245                var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
32246                    complete: fn || !fn && easing ||
32247                        isFunction(speed) && speed,
32248                    duration: speed,
32249                    easing: fn && easing || easing && !isFunction(easing) && easing
32250                };
32251
32252                // Go to the end state if fx are off
32253                if (jQuery.fx.off) {
32254                    opt.duration = 0;
32255
32256                } else {
32257                    if (typeof opt.duration !== "number") {
32258                        if (opt.duration in jQuery.fx.speeds) {
32259                            opt.duration = jQuery.fx.speeds[opt.duration];
32260
32261                        } else {
32262                            opt.duration = jQuery.fx.speeds._default;
32263                        }
32264                    }
32265                }
32266
32267                // Normalize opt.queue - true/undefined/null -> "fx"
32268                if (opt.queue == null || opt.queue === true) {
32269                    opt.queue = "fx";
32270                }
32271
32272                // Queueing
32273                opt.old = opt.complete;
32274
32275                opt.complete = function () {
32276                    if (isFunction(opt.old)) {
32277                        opt.old.call(this);
32278                    }
32279
32280                    if (opt.queue) {
32281                        jQuery.dequeue(this, opt.queue);
32282                    }
32283                };
32284
32285                return opt;
32286            };
32287
32288            jQuery.fn.extend({
32289                fadeTo: function (speed, to, easing, callback) {
32290
32291                    // Show any hidden elements after setting opacity to 0
32292                    return this.filter(isHiddenWithinTree).css("opacity", 0).show()
32293
32294                        // Animate to the value specified
32295                        .end().animate({opacity: to}, speed, easing, callback);
32296                },
32297                animate: function (prop, speed, easing, callback) {
32298                    var empty = jQuery.isEmptyObject(prop),
32299                        optall = jQuery.speed(speed, easing, callback),
32300                        doAnimation = function () {
32301
32302                            // Operate on a copy of prop so per-property easing won't be lost
32303                            var anim = Animation(this, jQuery.extend({}, prop), optall);
32304
32305                            // Empty animations, or finishing resolves immediately
32306                            if (empty || dataPriv.get(this, "finish")) {
32307                                anim.stop(true);
32308                            }
32309                        };
32310                    doAnimation.finish = doAnimation;
32311
32312                    return empty || optall.queue === false ?
32313                        this.each(doAnimation) :
32314                        this.queue(optall.queue, doAnimation);
32315                },
32316                stop: function (type, clearQueue, gotoEnd) {
32317                    var stopQueue = function (hooks) {
32318                        var stop = hooks.stop;
32319                        delete hooks.stop;
32320                        stop(gotoEnd);
32321                    };
32322
32323                    if (typeof type !== "string") {
32324                        gotoEnd = clearQueue;
32325                        clearQueue = type;
32326                        type = undefined;
32327                    }
32328                    if (clearQueue) {
32329                        this.queue(type || "fx", []);
32330                    }
32331
32332                    return this.each(function () {
32333                        var dequeue = true,
32334                            index = type != null && type + "queueHooks",
32335                            timers = jQuery.timers,
32336                            data = dataPriv.get(this);
32337
32338                        if (index) {
32339                            if (data[index] && data[index].stop) {
32340                                stopQueue(data[index]);
32341                            }
32342                        } else {
32343                            for (index in data) {
32344                                if (data[index] && data[index].stop && rrun.test(index)) {
32345                                    stopQueue(data[index]);
32346                                }
32347                            }
32348                        }
32349
32350                        for (index = timers.length; index--;) {
32351                            if (timers[index].elem === this &&
32352                                (type == null || timers[index].queue === type)) {
32353
32354                                timers[index].anim.stop(gotoEnd);
32355                                dequeue = false;
32356                                timers.splice(index, 1);
32357                            }
32358                        }
32359
32360                        // Start the next in the queue if the last step wasn't forced.
32361                        // Timers currently will call their complete callbacks, which
32362                        // will dequeue but only if they were gotoEnd.
32363                        if (dequeue || !gotoEnd) {
32364                            jQuery.dequeue(this, type);
32365                        }
32366                    });
32367                },
32368                finish: function (type) {
32369                    if (type !== false) {
32370                        type = type || "fx";
32371                    }
32372                    return this.each(function () {
32373                        var index,
32374                            data = dataPriv.get(this),
32375                            queue = data[type + "queue"],
32376                            hooks = data[type + "queueHooks"],
32377                            timers = jQuery.timers,
32378                            length = queue ? queue.length : 0;
32379
32380                        // Enable finishing flag on private data
32381                        data.finish = true;
32382
32383                        // Empty the queue first
32384                        jQuery.queue(this, type, []);
32385
32386                        if (hooks && hooks.stop) {
32387                            hooks.stop.call(this, true);
32388                        }
32389
32390                        // Look for any active animations, and finish them
32391                        for (index = timers.length; index--;) {
32392                            if (timers[index].elem === this && timers[index].queue === type) {
32393                                timers[index].anim.stop(true);
32394                                timers.splice(index, 1);
32395                            }
32396                        }
32397
32398                        // Look for any animations in the old queue and finish them
32399                        for (index = 0; index < length; index++) {
32400                            if (queue[index] && queue[index].finish) {
32401                                queue[index].finish.call(this);
32402                            }
32403                        }
32404
32405                        // Turn off finishing flag
32406                        delete data.finish;
32407                    });
32408                }
32409            });
32410
32411            jQuery.each(["toggle", "show", "hide"], function (_i, name) {
32412                var cssFn = jQuery.fn[name];
32413                jQuery.fn[name] = function (speed, easing, callback) {
32414                    return speed == null || typeof speed === "boolean" ?
32415                        cssFn.apply(this, arguments) :
32416                        this.animate(genFx(name, true), speed, easing, callback);
32417                };
32418            });
32419
32420// Generate shortcuts for custom animations
32421            jQuery.each({
32422                slideDown: genFx("show"),
32423                slideUp: genFx("hide"),
32424                slideToggle: genFx("toggle"),
32425                fadeIn: {opacity: "show"},
32426                fadeOut: {opacity: "hide"},
32427                fadeToggle: {opacity: "toggle"}
32428            }, function (name, props) {
32429                jQuery.fn[name] = function (speed, easing, callback) {
32430                    return this.animate(props, speed, easing, callback);
32431                };
32432            });
32433
32434            jQuery.timers = [];
32435            jQuery.fx.tick = function () {
32436                var timer,
32437                    i = 0,
32438                    timers = jQuery.timers;
32439
32440                fxNow = Date.now();
32441
32442                for (; i < timers.length; i++) {
32443                    timer = timers[i];
32444
32445                    // Run the timer and safely remove it when done (allowing for external removal)
32446                    if (!timer() && timers[i] === timer) {
32447                        timers.splice(i--, 1);
32448                    }
32449                }
32450
32451                if (!timers.length) {
32452                    jQuery.fx.stop();
32453                }
32454                fxNow = undefined;
32455            };
32456
32457            jQuery.fx.timer = function (timer) {
32458                jQuery.timers.push(timer);
32459                jQuery.fx.start();
32460            };
32461
32462            jQuery.fx.interval = 13;
32463            jQuery.fx.start = function () {
32464                if (inProgress) {
32465                    return;
32466                }
32467
32468                inProgress = true;
32469                schedule();
32470            };
32471
32472            jQuery.fx.stop = function () {
32473                inProgress = null;
32474            };
32475
32476            jQuery.fx.speeds = {
32477                slow: 600,
32478                fast: 200,
32479
32480                // Default speed
32481                _default: 400
32482            };
32483
32484
32485// Based off of the plugin by Clint Helfers, with permission.
32486// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
32487            jQuery.fn.delay = function (time, type) {
32488                time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
32489                type = type || "fx";
32490
32491                return this.queue(type, function (next, hooks) {
32492                    var timeout = window.setTimeout(next, time);
32493                    hooks.stop = function () {
32494                        window.clearTimeout(timeout);
32495                    };
32496                });
32497            };
32498
32499
32500            (function () {
32501                var input = document.createElement("input"),
32502                    select = document.createElement("select"),
32503                    opt = select.appendChild(document.createElement("option"));
32504
32505                input.type = "checkbox";
32506
32507                // Support: Android <=4.3 only
32508                // Default value for a checkbox should be "on"
32509                support.checkOn = input.value !== "";
32510
32511                // Support: IE <=11 only
32512                // Must access selectedIndex to make default options select
32513                support.optSelected = opt.selected;
32514
32515                // Support: IE <=11 only
32516                // An input loses its value after becoming a radio
32517                input = document.createElement("input");
32518                input.value = "t";
32519                input.type = "radio";
32520                support.radioValue = input.value === "t";
32521            })();
32522
32523
32524            var boolHook,
32525                attrHandle = jQuery.expr.attrHandle;
32526
32527            jQuery.fn.extend({
32528                attr: function (name, value) {
32529                    return access(this, jQuery.attr, name, value, arguments.length > 1);
32530                },
32531
32532                removeAttr: function (name) {
32533                    return this.each(function () {
32534                        jQuery.removeAttr(this, name);
32535                    });
32536                }
32537            });
32538
32539            jQuery.extend({
32540                attr: function (elem, name, value) {
32541                    var ret, hooks,
32542                        nType = elem.nodeType;
32543
32544                    // Don't get/set attributes on text, comment and attribute nodes
32545                    if (nType === 3 || nType === 8 || nType === 2) {
32546                        return;
32547                    }
32548
32549                    // Fallback to prop when attributes are not supported
32550                    if (typeof elem.getAttribute === "undefined") {
32551                        return jQuery.prop(elem, name, value);
32552                    }
32553
32554                    // Attribute hooks are determined by the lowercase version
32555                    // Grab necessary hook if one is defined
32556                    if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
32557                        hooks = jQuery.attrHooks[name.toLowerCase()] ||
32558                            (jQuery.expr.match.bool.test(name) ? boolHook : undefined);
32559                    }
32560
32561                    if (value !== undefined) {
32562                        if (value === null) {
32563                            jQuery.removeAttr(elem, name);
32564                            return;
32565                        }
32566
32567                        if (hooks && "set" in hooks &&
32568                            (ret = hooks.set(elem, value, name)) !== undefined) {
32569                            return ret;
32570                        }
32571
32572                        elem.setAttribute(name, value + "");
32573                        return value;
32574                    }
32575
32576                    if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
32577                        return ret;
32578                    }
32579
32580                    ret = jQuery.find.attr(elem, name);
32581
32582                    // Non-existent attributes return null, we normalize to undefined
32583                    return ret == null ? undefined : ret;
32584                },
32585
32586                attrHooks: {
32587                    type: {
32588                        set: function (elem, value) {
32589                            if (!support.radioValue && value === "radio" &&
32590                                nodeName(elem, "input")) {
32591                                var val = elem.value;
32592                                elem.setAttribute("type", value);
32593                                if (val) {
32594                                    elem.value = val;
32595                                }
32596                                return value;
32597                            }
32598                        }
32599                    }
32600                },
32601
32602                removeAttr: function (elem, value) {
32603                    var name,
32604                        i = 0,
32605
32606                        // Attribute names can contain non-HTML whitespace characters
32607                        // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
32608                        attrNames = value && value.match(rnothtmlwhite);
32609
32610                    if (attrNames && elem.nodeType === 1) {
32611                        while ((name = attrNames[i++])) {
32612                            elem.removeAttribute(name);
32613                        }
32614                    }
32615                }
32616            });
32617
32618// Hooks for boolean attributes
32619            boolHook = {
32620                set: function (elem, value, name) {
32621                    if (value === false) {
32622
32623                        // Remove boolean attributes when set to false
32624                        jQuery.removeAttr(elem, name);
32625                    } else {
32626                        elem.setAttribute(name, name);
32627                    }
32628                    return name;
32629                }
32630            };
32631
32632            jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function (_i, name) {
32633                var getter = attrHandle[name] || jQuery.find.attr;
32634
32635                attrHandle[name] = function (elem, name, isXML) {
32636                    var ret, handle,
32637                        lowercaseName = name.toLowerCase();
32638
32639                    if (!isXML) {
32640
32641                        // Avoid an infinite loop by temporarily removing this function from the getter
32642                        handle = attrHandle[lowercaseName];
32643                        attrHandle[lowercaseName] = ret;
32644                        ret = getter(elem, name, isXML) != null ?
32645                            lowercaseName :
32646                            null;
32647                        attrHandle[lowercaseName] = handle;
32648                    }
32649                    return ret;
32650                };
32651            });
32652
32653
32654            var rfocusable = /^(?:input|select|textarea|button)$/i,
32655                rclickable = /^(?:a|area)$/i;
32656
32657            jQuery.fn.extend({
32658                prop: function (name, value) {
32659                    return access(this, jQuery.prop, name, value, arguments.length > 1);
32660                },
32661
32662                removeProp: function (name) {
32663                    return this.each(function () {
32664                        delete this[jQuery.propFix[name] || name];
32665                    });
32666                }
32667            });
32668
32669            jQuery.extend({
32670                prop: function (elem, name, value) {
32671                    var ret, hooks,
32672                        nType = elem.nodeType;
32673
32674                    // Don't get/set properties on text, comment and attribute nodes
32675                    if (nType === 3 || nType === 8 || nType === 2) {
32676                        return;
32677                    }
32678
32679                    if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
32680
32681                        // Fix name and attach hooks
32682                        name = jQuery.propFix[name] || name;
32683                        hooks = jQuery.propHooks[name];
32684                    }
32685
32686                    if (value !== undefined) {
32687                        if (hooks && "set" in hooks &&
32688                            (ret = hooks.set(elem, value, name)) !== undefined) {
32689                            return ret;
32690                        }
32691
32692                        return (elem[name] = value);
32693                    }
32694
32695                    if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
32696                        return ret;
32697                    }
32698
32699                    return elem[name];
32700                },
32701
32702                propHooks: {
32703                    tabIndex: {
32704                        get: function (elem) {
32705
vendor: 19,041 bytes, lines 32706-33188
32706                            // Support: IE <=9 - 11 only
32707                            // elem.tabIndex doesn't always return the
32708                            // correct value when it hasn't been explicitly set
32709                            // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
32710                            // Use proper attribute retrieval(#12072)
32711                            var tabindex = jQuery.find.attr(elem, "tabindex");
32712
32713                            if (tabindex) {
32714                                return parseInt(tabindex, 10);
32715                            }
32716
32717                            if (
32718                                rfocusable.test(elem.nodeName) ||
32719                                rclickable.test(elem.nodeName) &&
32720                                elem.href
32721                            ) {
32722                                return 0;
32723                            }
32724
32725                            return -1;
32726                        }
32727                    }
32728                },
32729
32730                propFix: {
32731                    "for": "htmlFor",
32732                    "class": "className"
32733                }
32734            });
32735
32736// Support: IE <=11 only
32737// Accessing the selectedIndex property
32738// forces the browser to respect setting selected
32739// on the option
32740// The getter ensures a default option is selected
32741// when in an optgroup
32742// eslint rule "no-unused-expressions" is disabled for this code
32743// since it considers such accessions noop
32744            if (!support.optSelected) {
32745                jQuery.propHooks.selected = {
32746                    get: function (elem) {
32747
32748                        /* eslint no-unused-expressions: "off" */
32749
32750                        var parent = elem.parentNode;
32751                        if (parent && parent.parentNode) {
32752                            parent.parentNode.selectedIndex;
32753                        }
32754                        return null;
32755                    },
32756                    set: function (elem) {
32757
32758                        /* eslint no-unused-expressions: "off" */
32759
32760                        var parent = elem.parentNode;
32761                        if (parent) {
32762                            parent.selectedIndex;
32763
32764                            if (parent.parentNode) {
32765                                parent.parentNode.selectedIndex;
32766                            }
32767                        }
32768                    }
32769                };
32770            }
32771
32772            jQuery.each([
32773                "tabIndex",
32774                "readOnly",
32775                "maxLength",
32776                "cellSpacing",
32777                "cellPadding",
32778                "rowSpan",
32779                "colSpan",
32780                "useMap",
32781                "frameBorder",
32782                "contentEditable"
32783            ], function () {
32784                jQuery.propFix[this.toLowerCase()] = this;
32785            });
32786
32787
32788            // Strip and collapse whitespace according to HTML spec
32789            // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
32790            function stripAndCollapse(value) {
32791                var tokens = value.match(rnothtmlwhite) || [];
32792                return tokens.join(" ");
32793            }
32794
32795
32796            function getClass(elem) {
32797                return elem.getAttribute && elem.getAttribute("class") || "";
32798            }
32799
32800            function classesToArray(value) {
32801                if (Array.isArray(value)) {
32802                    return value;
32803                }
32804                if (typeof value === "string") {
32805                    return value.match(rnothtmlwhite) || [];
32806                }
32807                return [];
32808            }
32809
32810            jQuery.fn.extend({
32811                addClass: function (value) {
32812                    var classes, elem, cur, curValue, clazz, j, finalValue,
32813                        i = 0;
32814
32815                    if (isFunction(value)) {
32816                        return this.each(function (j) {
32817                            jQuery(this).addClass(value.call(this, j, getClass(this)));
32818                        });
32819                    }
32820
32821                    classes = classesToArray(value);
32822
32823                    if (classes.length) {
32824                        while ((elem = this[i++])) {
32825                            curValue = getClass(elem);
32826                            cur = elem.nodeType === 1 && (" " + stripAndCollapse(curValue) + " ");
32827
32828                            if (cur) {
32829                                j = 0;
32830                                while ((clazz = classes[j++])) {
32831                                    if (cur.indexOf(" " + clazz + " ") < 0) {
32832                                        cur += clazz + " ";
32833                                    }
32834                                }
32835
32836                                // Only assign if different to avoid unneeded rendering.
32837                                finalValue = stripAndCollapse(cur);
32838                                if (curValue !== finalValue) {
32839                                    elem.setAttribute("class", finalValue);
32840                                }
32841                            }
32842                        }
32843                    }
32844
32845                    return this;
32846                },
32847
32848                removeClass: function (value) {
32849                    var classes, elem, cur, curValue, clazz, j, finalValue,
32850                        i = 0;
32851
32852                    if (isFunction(value)) {
32853                        return this.each(function (j) {
32854                            jQuery(this).removeClass(value.call(this, j, getClass(this)));
32855                        });
32856                    }
32857
32858                    if (!arguments.length) {
32859                        return this.attr("class", "");
32860                    }
32861
32862                    classes = classesToArray(value);
32863
32864                    if (classes.length) {
32865                        while ((elem = this[i++])) {
32866                            curValue = getClass(elem);
32867
32868                            // This expression is here for better compressibility (see addClass)
32869                            cur = elem.nodeType === 1 && (" " + stripAndCollapse(curValue) + " ");
32870
32871                            if (cur) {
32872                                j = 0;
32873                                while ((clazz = classes[j++])) {
32874
32875                                    // Remove *all* instances
32876                                    while (cur.indexOf(" " + clazz + " ") > -1) {
32877                                        cur = cur.replace(" " + clazz + " ", " ");
32878                                    }
32879                                }
32880
32881                                // Only assign if different to avoid unneeded rendering.
32882                                finalValue = stripAndCollapse(cur);
32883                                if (curValue !== finalValue) {
32884                                    elem.setAttribute("class", finalValue);
32885                                }
32886                            }
32887                        }
32888                    }
32889
32890                    return this;
32891                },
32892
32893                toggleClass: function (value, stateVal) {
32894                    var type = typeof value,
32895                        isValidValue = type === "string" || Array.isArray(value);
32896
32897                    if (typeof stateVal === "boolean" && isValidValue) {
32898                        return stateVal ? this.addClass(value) : this.removeClass(value);
32899                    }
32900
32901                    if (isFunction(value)) {
32902                        return this.each(function (i) {
32903                            jQuery(this).toggleClass(
32904                                value.call(this, i, getClass(this), stateVal),
32905                                stateVal
32906                            );
32907                        });
32908                    }
32909
32910                    return this.each(function () {
32911                        var className, i, self, classNames;
32912
32913                        if (isValidValue) {
32914
32915                            // Toggle individual class names
32916                            i = 0;
32917                            self = jQuery(this);
32918                            classNames = classesToArray(value);
32919
32920                            while ((className = classNames[i++])) {
32921
32922                                // Check each className given, space separated list
32923                                if (self.hasClass(className)) {
32924                                    self.removeClass(className);
32925                                } else {
32926                                    self.addClass(className);
32927                                }
32928                            }
32929
32930                            // Toggle whole class name
32931                        } else if (value === undefined || type === "boolean") {
32932                            className = getClass(this);
32933                            if (className) {
32934
32935                                // Store className if set
32936                                dataPriv.set(this, "__className__", className);
32937                            }
32938
32939                            // If the element has a class name or if we're passed `false`,
32940                            // then remove the whole classname (if there was one, the above saved it).
32941                            // Otherwise bring back whatever was previously saved (if anything),
32942                            // falling back to the empty string if nothing was stored.
32943                            if (this.setAttribute) {
32944                                this.setAttribute("class",
32945                                    className || value === false ?
32946                                        "" :
32947                                        dataPriv.get(this, "__className__") || ""
32948                                );
32949                            }
32950                        }
32951                    });
32952                },
32953
32954                hasClass: function (selector) {
32955                    var className, elem,
32956                        i = 0;
32957
32958                    className = " " + selector + " ";
32959                    while ((elem = this[i++])) {
32960                        if (elem.nodeType === 1 &&
32961                            (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1) {
32962                            return true;
32963                        }
32964                    }
32965
32966                    return false;
32967                }
32968            });
32969
32970
32971            var rreturn = /\r/g;
32972
32973            jQuery.fn.extend({
32974                val: function (value) {
32975                    var hooks, ret, valueIsFunction,
32976                        elem = this[0];
32977
32978                    if (!arguments.length) {
32979                        if (elem) {
32980                            hooks = jQuery.valHooks[elem.type] ||
32981                                jQuery.valHooks[elem.nodeName.toLowerCase()];
32982
32983                            if (hooks &&
32984                                "get" in hooks &&
32985                                (ret = hooks.get(elem, "value")) !== undefined
32986                            ) {
32987                                return ret;
32988                            }
32989
32990                            ret = elem.value;
32991
32992                            // Handle most common string cases
32993                            if (typeof ret === "string") {
32994                                return ret.replace(rreturn, "");
32995                            }
32996
32997                            // Handle cases where value is null/undef or number
32998                            return ret == null ? "" : ret;
32999                        }
33000
33001                        return;
33002                    }
33003
33004                    valueIsFunction = isFunction(value);
33005
33006                    return this.each(function (i) {
33007                        var val;
33008
33009                        if (this.nodeType !== 1) {
33010                            return;
33011                        }
33012
33013                        if (valueIsFunction) {
33014                            val = value.call(this, i, jQuery(this).val());
33015                        } else {
33016                            val = value;
33017                        }
33018
33019                        // Treat null/undefined as ""; convert numbers to string
33020                        if (val == null) {
33021                            val = "";
33022
33023                        } else if (typeof val === "number") {
33024                            val += "";
33025
33026                        } else if (Array.isArray(val)) {
33027                            val = jQuery.map(val, function (value) {
33028                                return value == null ? "" : value + "";
33029                            });
33030                        }
33031
33032                        hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
33033
33034                        // If set returns undefined, fall back to normal setting
33035                        if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
33036                            this.value = val;
33037                        }
33038                    });
33039                }
33040            });
33041
33042            jQuery.extend({
33043                valHooks: {
33044                    option: {
33045                        get: function (elem) {
33046
33047                            var val = jQuery.find.attr(elem, "value");
33048                            return val != null ?
33049                                val :
33050
33051                                // Support: IE <=10 - 11 only
33052                                // option.text throws exceptions (#14686, #14858)
33053                                // Strip and collapse whitespace
33054                                // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
33055                                stripAndCollapse(jQuery.text(elem));
33056                        }
33057                    },
33058                    select: {
33059                        get: function (elem) {
33060                            var value, option, i,
33061                                options = elem.options,
33062                                index = elem.selectedIndex,
33063                                one = elem.type === "select-one",
33064                                values = one ? null : [],
33065                                max = one ? index + 1 : options.length;
33066
33067                            if (index < 0) {
33068                                i = max;
33069
33070                            } else {
33071                                i = one ? index : 0;
33072                            }
33073
33074                            // Loop through all the selected options
33075                            for (; i < max; i++) {
33076                                option = options[i];
33077
33078                                // Support: IE <=9 only
33079                                // IE8-9 doesn't update selected after form reset (#2551)
33080                                if ((option.selected || i === index) &&
33081
33082                                    // Don't return options that are disabled or in a disabled optgroup
33083                                    !option.disabled &&
33084                                    (!option.parentNode.disabled ||
33085                                        !nodeName(option.parentNode, "optgroup"))) {
33086
33087                                    // Get the specific value for the option
33088                                    value = jQuery(option).val();
33089
33090                                    // We don't need an array for one selects
33091                                    if (one) {
33092                                        return value;
33093                                    }
33094
33095                                    // Multi-Selects return an array
33096                                    values.push(value);
33097                                }
33098                            }
33099
33100                            return values;
33101                        },
33102
33103                        set: function (elem, value) {
33104                            var optionSet, option,
33105                                options = elem.options,
33106                                values = jQuery.makeArray(value),
33107                                i = options.length;
33108
33109                            while (i--) {
33110                                option = options[i];
33111
33112                                /* eslint-disable no-cond-assign */
33113
33114                                if (option.selected =
33115                                    jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1
33116                                ) {
33117                                    optionSet = true;
33118                                }
33119
33120                                /* eslint-enable no-cond-assign */
33121                            }
33122
33123                            // Force browsers to behave consistently when non-matching value is set
33124                            if (!optionSet) {
33125                                elem.selectedIndex = -1;
33126                            }
33127                            return values;
33128                        }
33129                    }
33130                }
33131            });
33132
33133// Radios and checkboxes getter/setter
33134            jQuery.each(["radio", "checkbox"], function () {
33135                jQuery.valHooks[this] = {
33136                    set: function (elem, value) {
33137                        if (Array.isArray(value)) {
33138                            return (elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1);
33139                        }
33140                    }
33141                };
33142                if (!support.checkOn) {
33143                    jQuery.valHooks[this].get = function (elem) {
33144                        return elem.getAttribute("value") === null ? "on" : elem.value;
33145                    };
33146                }
33147            });
33148
33149
33150// Return jQuery for attributes-only inclusion
33151
33152
33153            support.focusin = "onfocusin" in window;
33154
33155
33156            var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
33157                stopPropagationCallback = function (e) {
33158                    e.stopPropagation();
33159                };
33160
33161            jQuery.extend(jQuery.event, {
33162
33163                trigger: function (event, data, elem, onlyHandlers) {
33164
33165                    var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
33166                        eventPath = [elem || document],
33167                        type = hasOwn.call(event, "type") ? event.type : event,
33168                        namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
33169
33170                    cur = lastElement = tmp = elem = elem || document;
33171
33172                    // Don't do events on text and comment nodes
33173                    if (elem.nodeType === 3 || elem.nodeType === 8) {
33174                        return;
33175                    }
33176
33177                    // focus/blur morphs to focusin/out; ensure we're not firing them right now
33178                    if (rfocusMorph.test(type + jQuery.event.triggered)) {
33179                        return;
33180                    }
33181
33182                    if (type.indexOf(".") > -1) {
33183
33184                        // Namespaced trigger; create a regexp to match event type in handle()
33185                        namespaces = type.split(".");
33186                        type = namespaces.shift();
33187                        namespaces.sort();
33188                    }
vendor: 6,702 bytes, lines 33189-33344
33189                    ontype = type.indexOf(":") < 0 && "on" + type;
33190
33191                    // Caller can pass in a jQuery.Event object, Object, or just an event type string
33192                    event = event[jQuery.expando] ?
33193                        event :
33194                        new jQuery.Event(type, typeof event === "object" && event);
33195
33196                    // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
33197                    event.isTrigger = onlyHandlers ? 2 : 3;
33198                    event.namespace = namespaces.join(".");
33199                    event.rnamespace = event.namespace ?
33200                        new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") :
33201                        null;
33202
33203                    // Clean up the event in case it is being reused
33204                    event.result = undefined;
33205                    if (!event.target) {
33206                        event.target = elem;
33207                    }
33208
33209                    // Clone any incoming data and prepend the event, creating the handler arg list
33210                    data = data == null ?
33211                        [event] :
33212                        jQuery.makeArray(data, [event]);
33213
33214                    // Allow special events to draw outside the lines
33215                    special = jQuery.event.special[type] || {};
33216                    if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
33217                        return;
33218                    }
33219
33220                    // Determine event propagation path in advance, per W3C events spec (#9951)
33221                    // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
33222                    if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {
33223
33224                        bubbleType = special.delegateType || type;
33225                        if (!rfocusMorph.test(bubbleType + type)) {
33226                            cur = cur.parentNode;
33227                        }
33228                        for (; cur; cur = cur.parentNode) {
33229                            eventPath.push(cur);
33230                            tmp = cur;
33231                        }
33232
33233                        // Only add window if we got to document (e.g., not plain obj or detached DOM)
33234                        if (tmp === (elem.ownerDocument || document)) {
33235                            eventPath.push(tmp.defaultView || tmp.parentWindow || window);
33236                        }
33237                    }
33238
33239                    // Fire handlers on the event path
33240                    i = 0;
33241                    while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
33242                        lastElement = cur;
33243                        event.type = i > 1 ?
33244                            bubbleType :
33245                            special.bindType || type;
33246
33247                        // jQuery handler
33248                        handle = (
33249                                dataPriv.get(cur, "events") || Object.create(null)
33250                            )[event.type] &&
33251                            dataPriv.get(cur, "handle");
33252                        if (handle) {
33253                            handle.apply(cur, data);
33254                        }
33255
33256                        // Native handler
33257                        handle = ontype && cur[ontype];
33258                        if (handle && handle.apply && acceptData(cur)) {
33259                            event.result = handle.apply(cur, data);
33260                            if (event.result === false) {
33261                                event.preventDefault();
33262                            }
33263                        }
33264                    }
33265                    event.type = type;
33266
33267                    // If nobody prevented the default action, do it now
33268                    if (!onlyHandlers && !event.isDefaultPrevented()) {
33269
33270                        if ((!special._default ||
33271                                special._default.apply(eventPath.pop(), data) === false) &&
33272                            acceptData(elem)) {
33273
33274                            // Call a native DOM method on the target with the same name as the event.
33275                            // Don't do default actions on window, that's where global variables be (#6170)
33276                            if (ontype && isFunction(elem[type]) && !isWindow(elem)) {
33277
33278                                // Don't re-trigger an onFOO event when we call its FOO() method
33279                                tmp = elem[ontype];
33280
33281                                if (tmp) {
33282                                    elem[ontype] = null;
33283                                }
33284
33285                                // Prevent re-triggering of the same event, since we already bubbled it above
33286                                jQuery.event.triggered = type;
33287
33288                                if (event.isPropagationStopped()) {
33289                                    lastElement.addEventListener(type, stopPropagationCallback);
33290                                }
33291
33292                                elem[type]();
33293
33294                                if (event.isPropagationStopped()) {
33295                                    lastElement.removeEventListener(type, stopPropagationCallback);
33296                                }
33297
33298                                jQuery.event.triggered = undefined;
33299
33300                                if (tmp) {
33301                                    elem[ontype] = tmp;
33302                                }
33303                            }
33304                        }
33305                    }
33306
33307                    return event.result;
33308                },
33309
33310                // Piggyback on a donor event to simulate a different one
33311                // Used only for `focus(in | out)` events
33312                simulate: function (type, elem, event) {
33313                    var e = jQuery.extend(
33314                        new jQuery.Event(),
33315                        event,
33316                        {
33317                            type: type,
33318                            isSimulated: true
33319                        }
33320                    );
33321
33322                    jQuery.event.trigger(e, null, elem);
33323                }
33324
33325            });
33326
33327            jQuery.fn.extend({
33328
33329                trigger: function (type, data) {
33330                    return this.each(function () {
33331                        jQuery.event.trigger(type, data, this);
33332                    });
33333                },
33334                triggerHandler: function (type, data) {
33335                    var elem = this[0];
33336                    if (elem) {
33337                        return jQuery.event.trigger(type, data, elem, true);
33338                    }
33339                }
33340            });
33341
33342
33343// Support: Firefox <=44
33344// Firefox doesn't have focus(in | out) events
vendor: 1,928 bytes, lines 33345-33381
33345// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
33346//
33347// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
33348// focus(in | out) events fire after focus & blur events,
33349// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
33350// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
33351            if (!support.focusin) {
33352                jQuery.each({focus: "focusin", blur: "focusout"}, function (orig, fix) {
33353
33354                    // Attach a single capturing handler on the document while someone wants focusin/focusout
33355                    var handler = function (event) {
33356                        jQuery.event.simulate(fix, event.target, jQuery.event.fix(event));
33357                    };
33358
33359                    jQuery.event.special[fix] = {
33360                        setup: function () {
33361
33362                            // Handle: regular nodes (via `this.ownerDocument`), window
33363                            // (via `this.document`) & document (via `this`).
33364                            var doc = this.ownerDocument || this.document || this,
33365                                attaches = dataPriv.access(doc, fix);
33366
33367                            if (!attaches) {
33368                                doc.addEventListener(orig, handler, true);
33369                            }
33370                            dataPriv.access(doc, fix, (attaches || 0) + 1);
33371                        },
33372                        teardown: function () {
33373                            var doc = this.ownerDocument || this.document || this,
33374                                attaches = dataPriv.access(doc, fix) - 1;
33375
33376                            if (!attaches) {
33377                                doc.removeEventListener(orig, handler, true);
33378                                dataPriv.remove(doc, fix);
33379
33380                            } else {
33381                                dataPriv.access(doc, fix, attaches
vendor: 4,726 bytes, lines 33381-33515
33381);
33382                            }
33383                        }
33384                    };
33385                });
33386            }
33387            var location = window.location;
33388
33389            var nonce = {guid: Date.now()};
33390
33391            var rquery = (/\?/);
33392
33393
33394// Cross-browser xml parsing
33395            jQuery.parseXML = function (data) {
33396                var xml;
33397                if (!data || typeof data !== "string") {
33398                    return null;
33399                }
33400
33401                // Support: IE 9 - 11 only
33402                // IE throws on parseFromString with invalid input.
33403                try {
33404                    xml = (new window.DOMParser()).parseFromString(data, "text/xml");
33405                } catch (e) {
33406                    xml = undefined;
33407                }
33408
33409                if (!xml || xml.getElementsByTagName("parsererror").length) {
33410                    jQuery.error("Invalid XML: " + data);
33411                }
33412                return xml;
33413            };
33414
33415
33416            var
33417                rbracket = /\[\]$/,
33418                rCRLF = /\r?\n/g,
33419                rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
33420                rsubmittable = /^(?:input|select|textarea|keygen)/i;
33421
33422            function buildParams(prefix, obj, traditional, add) {
33423                var name;
33424
33425                if (Array.isArray(obj)) {
33426
33427                    // Serialize array item.
33428                    jQuery.each(obj, function (i, v) {
33429                        if (traditional || rbracket.test(prefix)) {
33430
33431                            // Treat each array item as a scalar.
33432                            add(prefix, v);
33433
33434                        } else {
33435
33436                            // Item is non-scalar (array or object), encode its numeric index.
33437                            buildParams(
33438                                prefix + "[" + (typeof v === "object" && v != null ? i : "") + "]",
33439                                v,
33440                                traditional,
33441                                add
33442                            );
33443                        }
33444                    });
33445
33446                } else if (!traditional && toType(obj) === "object") {
33447
33448                    // Serialize object item.
33449                    for (name in obj) {
33450                        buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
33451                    }
33452
33453                } else {
33454
33455                    // Serialize scalar item.
33456                    add(prefix, obj);
33457                }
33458            }
33459
33460// Serialize an array of form elements or a set of
33461// key/values into a query string
33462            jQuery.param = function (a, traditional) {
33463                var prefix,
33464                    s = [],
33465                    add = function (key, valueOrFunction) {
33466
33467                        // If value is a function, invoke it and use its return value
33468                        var value = isFunction(valueOrFunction) ?
33469                            valueOrFunction() :
33470                            valueOrFunction;
33471
33472                        s[s.length] = encodeURIComponent(key) + "=" +
33473                            encodeURIComponent(value == null ? "" : value);
33474                    };
33475
33476                if (a == null) {
33477                    return "";
33478                }
33479
33480                // If an array was passed in, assume that it is an array of form elements.
33481                if (Array.isArray(a) || (a.jquery && !jQuery.isPlainObject(a))) {
33482
33483                    // Serialize the form elements
33484                    jQuery.each(a, function () {
33485                        add(this.name, this.value);
33486                    });
33487
33488                } else {
33489
33490                    // If traditional, encode the "old" way (the way 1.3.2 or older
33491                    // did it), otherwise encode params recursively.
33492                    for (prefix in a) {
33493                        buildParams(prefix, a[prefix], traditional, add);
33494                    }
33495                }
33496
33497                // Return the resulting serialization
33498                return s.join("&");
33499            };
33500
33501            jQuery.fn.extend({
33502                serialize: function () {
33503                    return jQuery.param(this.serializeArray());
33504                },
33505                serializeArray: function () {
33506                    return this.map(function () {
33507
33508                        // Can add propHook for "elements" to filter or add form elements
33509                        var elements = jQuery.prop(this, "elements");
33510                        return elements ? jQuery.makeArray(elements) : this;
33511                    })
33512                        .filter(function () {
33513                            var type = this.type;
33514
33515                            // Use .is( ":disabled" ) so that fieldset[disabled] w
vendor: 4,171 bytes, lines 33515-33618
33515orks
33516                            return this.name && !jQuery(this).is(":disabled") &&
33517                                rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) &&
33518                                (this.checked || !rcheckableType.test(type));
33519                        })
33520                        .map(function (_i, elem) {
33521                            var val = jQuery(this).val();
33522
33523                            if (val == null) {
33524                                return null;
33525                            }
33526
33527                            if (Array.isArray(val)) {
33528                                return jQuery.map(val, function (val) {
33529                                    return {name: elem.name, value: val.replace(rCRLF, "\r\n")};
33530                                });
33531                            }
33532
33533                            return {name: elem.name, value: val.replace(rCRLF, "\r\n")};
33534                        }).get();
33535                }
33536            });
33537
33538
33539            var
33540                r20 = /%20/g,
33541                rhash = /#.*$/,
33542                rantiCache = /([?&])_=[^&]*/,
33543                rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
33544
33545                // #7653, #8125, #8152: local protocol detection
33546                rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
33547                rnoContent = /^(?:GET|HEAD)$/,
33548                rprotocol = /^\/\//,
33549
33550                /* Prefilters
33551	 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
33552	 * 2) These are called:
33553	 *    - BEFORE asking for a transport
33554	 *    - AFTER param serialization (s.data is a string if s.processData is true)
33555	 * 3) key is the dataType
33556	 * 4) the catchall symbol "*" can be used
33557	 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
33558	 */
33559                prefilters = {},
33560
33561                /* Transports bindings
33562	 * 1) key is the dataType
33563	 * 2) the catchall symbol "*" can be used
33564	 * 3) selection will start with
33565	 *  transport dataType and THEN go to "*" if needed
33566	 */
33567                transports = {},
33568
33569                // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
33570                allTypes = "*/".concat("*"),
33571
33572                // Anchor tag for parsing the document origin
33573                originAnchor = document.createElement("a");
33574            originAnchor.href = location.href;
33575
33576// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
33577            function addToPrefiltersOrTransports(structure) {
33578
33579                // dataTypeExpression is optional and defaults to "*"
33580                return function (dataTypeExpression, func) {
33581
33582                    if (typeof dataTypeExpression !== "string") {
33583                        func = dataTypeExpression;
33584                        dataTypeExpression = "*";
33585                    }
33586
33587                    var dataType,
33588                        i = 0,
33589                        dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];
33590
33591                    if (isFunction(func)) {
33592
33593                        // For each dataType in the dataTypeExpression
33594                        while ((dataType = dataTypes[i++])) {
33595
33596                            // Prepend if requested
33597                            if (dataType[0] === "+") {
33598                                dataType = dataType.slice(1) || "*";
33599                                (structure[dataType] = structure[dataType] || []).unshift(func);
33600
33601                                // Otherwise append
33602                            } else {
33603                                (structure[dataType] = structure[dataType] || []).push(func);
33604                            }
33605                        }
33606                    }
33607                };
33608            }
33609
33610// Base inspection function for prefilters and transports
33611            function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
33612
33613                var inspected = {},
33614                    seekingTransport = (structure === transports);
33615
33616                function inspect(dataType) {
33617                    var selected;
33618                    inspected[dataType] = true;
vendor: 18,234 bytes, lines 33619-34064
33619                    jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) {
33620                        var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
33621                        if (typeof dataTypeOrTransport === "string" &&
33622                            !seekingTransport && !inspected[dataTypeOrTransport]) {
33623
33624                            options.dataTypes.unshift(dataTypeOrTransport);
33625                            inspect(dataTypeOrTransport);
33626                            return false;
33627                        } else if (seekingTransport) {
33628                            return !(selected = dataTypeOrTransport);
33629                        }
33630                    });
33631                    return selected;
33632                }
33633
33634                return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*");
33635            }
33636
33637// A special extend for ajax options
33638// that takes "flat" options (not to be deep extended)
33639// Fixes #9887
33640            function ajaxExtend(target, src) {
33641                var key, deep,
33642                    flatOptions = jQuery.ajaxSettings.flatOptions || {};
33643
33644                for (key in src) {
33645                    if (src[key] !== undefined) {
33646                        (flatOptions[key] ? target : (deep || (deep = {})))[key] = src[key];
33647                    }
33648                }
33649                if (deep) {
33650                    jQuery.extend(true, target, deep);
33651                }
33652
33653                return target;
33654            }
33655
33656            /* Handles responses to an ajax request:
33657 * - finds the right dataType (mediates between content-type and expected dataType)
33658 * - returns the corresponding response
33659 */
33660            function ajaxHandleResponses(s, jqXHR, responses) {
33661
33662                var ct, type, finalDataType, firstDataType,
33663                    contents = s.contents,
33664                    dataTypes = s.dataTypes;
33665
33666                // Remove auto dataType and get content-type in the process
33667                while (dataTypes[0] === "*") {
33668                    dataTypes.shift();
33669                    if (ct === undefined) {
33670                        ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
33671                    }
33672                }
33673
33674                // Check if we're dealing with a known content-type
33675                if (ct) {
33676                    for (type in contents) {
33677                        if (contents[type] && contents[type].test(ct)) {
33678                            dataTypes.unshift(type);
33679                            break;
33680                        }
33681                    }
33682                }
33683
33684                // Check to see if we have a response for the expected dataType
33685                if (dataTypes[0] in responses) {
33686                    finalDataType = dataTypes[0];
33687                } else {
33688
33689                    // Try convertible dataTypes
33690                    for (type in responses) {
33691                        if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
33692                            finalDataType = type;
33693                            break;
33694                        }
33695                        if (!firstDataType) {
33696                            firstDataType = type;
33697                        }
33698                    }
33699
33700                    // Or just use first one
33701                    finalDataType = finalDataType || firstDataType;
33702                }
33703
33704                // If we found a dataType
33705                // We add the dataType to the list if needed
33706                // and return the corresponding response
33707                if (finalDataType) {
33708                    if (finalDataType !== dataTypes[0]) {
33709                        dataTypes.unshift(finalDataType);
33710                    }
33711                    return responses[finalDataType];
33712                }
33713            }
33714
33715            /* Chain conversions given the request and the original response
33716 * Also sets the responseXXX fields on the jqXHR instance
33717 */
33718            function ajaxConvert(s, response, jqXHR, isSuccess) {
33719                var conv2, current, conv, tmp, prev,
33720                    converters = {},
33721
33722                    // Work with a copy of dataTypes in case we need to modify it for conversion
33723                    dataTypes = s.dataTypes.slice();
33724
33725                // Create converters map with lowercased keys
33726                if (dataTypes[1]) {
33727                    for (conv in s.converters) {
33728                        converters[conv.toLowerCase()] = s.converters[conv];
33729                    }
33730                }
33731
33732                current = dataTypes.shift();
33733
33734                // Convert to each sequential dataType
33735                while (current) {
33736
33737                    if (s.responseFields[current]) {
33738                        jqXHR[s.responseFields[current]] = response;
33739                    }
33740
33741                    // Apply the dataFilter if provided
33742                    if (!prev && isSuccess && s.dataFilter) {
33743                        response = s.dataFilter(response, s.dataType);
33744                    }
33745
33746                    prev = current;
33747                    current = dataTypes.shift();
33748
33749                    if (current) {
33750
33751                        // There's only work to do if current dataType is non-auto
33752                        if (current === "*") {
33753
33754                            current = prev;
33755
33756                            // Convert response if prev dataType is non-auto and differs from current
33757                        } else if (prev !== "*" && prev !== current) {
33758
33759                            // Seek a direct converter
33760                            conv = converters[prev + " " + current] || converters["* " + current];
33761
33762                            // If none found, seek a pair
33763                            if (!conv) {
33764                                for (conv2 in converters) {
33765
33766                                    // If conv2 outputs current
33767                                    tmp = conv2.split(" ");
33768                                    if (tmp[1] === current) {
33769
33770                                        // If prev can be converted to accepted input
33771                                        conv = converters[prev + " " + tmp[0]] ||
33772                                            converters["* " + tmp[0]];
33773                                        if (conv) {
33774
33775                                            // Condense equivalence converters
33776                                            if (conv === true) {
33777                                                conv = converters[conv2];
33778
33779                                                // Otherwise, insert the intermediate dataType
33780                                            } else if (converters[conv2] !== true) {
33781                                                current = tmp[0];
33782                                                dataTypes.unshift(tmp[1]);
33783                                            }
33784                                            break;
33785                                        }
33786                                    }
33787                                }
33788                            }
33789
33790                            // Apply converter (if not an equivalence)
33791                            if (conv !== true) {
33792
33793                                // Unless errors are allowed to bubble, catch and return them
33794                                if (conv && s.throws) {
33795                                    response = conv(response);
33796                                } else {
33797                                    try {
33798                                        response = conv(response);
33799                                    } catch (e) {
33800                                        return {
33801                                            state: "parsererror",
33802                                            error: conv ? e : "No conversion from " + prev + " to " + current
33803                                        };
33804                                    }
33805                                }
33806                            }
33807                        }
33808                    }
33809                }
33810
33811                return {state: "success", data: response};
33812            }
33813
33814            jQuery.extend({
33815
33816                // Counter for holding the number of active queries
33817                active: 0,
33818
33819                // Last-Modified header cache for next request
33820                lastModified: {},
33821                etag: {},
33822
33823                ajaxSettings: {
33824                    url: location.href,
33825                    type: "GET",
33826                    isLocal: rlocalProtocol.test(location.protocol),
33827                    global: true,
33828                    processData: true,
33829                    async: true,
33830                    contentType: "application/x-www-form-urlencoded; charset=UTF-8",
33831
33832                    /*
33833		timeout: 0,
33834		data: null,
33835		dataType: null,
33836		username: null,
33837		password: null,
33838		cache: null,
33839		throws: false,
33840		traditional: false,
33841		headers: {},
33842		*/
33843
33844                    accepts: {
33845                        "*": allTypes,
33846                        text: "text/plain",
33847                        html: "text/html",
33848                        xml: "application/xml, text/xml",
33849                        json: "application/json, text/javascript"
33850                    },
33851
33852                    contents: {
33853                        xml: /\bxml\b/,
33854                        html: /\bhtml/,
33855                        json: /\bjson\b/
33856                    },
33857
33858                    responseFields: {
33859                        xml: "responseXML",
33860                        text: "responseText",
33861                        json: "responseJSON"
33862                    },
33863
33864                    // Data converters
33865                    // Keys separate source (or catchall "*") and destination types with a single space
33866                    converters: {
33867
33868                        // Convert anything to text
33869                        "* text": String,
33870
33871                        // Text to html (true = no transformation)
33872                        "text html": true,
33873
33874                        // Evaluate text as a json expression
33875                        "text json": JSON.parse,
33876
33877                        // Parse text as xml
33878                        "text xml": jQuery.parseXML
33879                    },
33880
33881                    // For options that shouldn't be deep extended:
33882                    // you can add your own custom options here if
33883                    // and when you create one that shouldn't be
33884                    // deep extended (see ajaxExtend)
33885                    flatOptions: {
33886                        url: true,
33887                        context: true
33888                    }
33889                },
33890
33891                // Creates a full fledged settings object into target
33892                // with both ajaxSettings and settings fields.
33893                // If target is omitted, writes into ajaxSettings.
33894                ajaxSetup: function (target, settings) {
33895                    return settings ?
33896
33897                        // Building a settings object
33898                        ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) :
33899
33900                        // Extending ajaxSettings
33901                        ajaxExtend(jQuery.ajaxSettings, target);
33902                },
33903
33904                ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
33905                ajaxTransport: addToPrefiltersOrTransports(transports),
33906
33907                // Main method
33908                ajax: function (url, options) {
33909
33910                    // If url is an object, simulate pre-1.5 signature
33911                    if (typeof url === "object") {
33912                        options = url;
33913                        url = undefined;
33914                    }
33915
33916                    // Force options to be an object
33917                    options = options || {};
33918
33919                    var transport,
33920
33921                        // URL without anti-cache param
33922                        cacheURL,
33923
33924                        // Response headers
33925                        responseHeadersString,
33926                        responseHeaders,
33927
33928                        // timeout handle
33929                        timeoutTimer,
33930
33931                        // Url cleanup var
33932                        urlAnchor,
33933
33934                        // Request state (becomes false upon send and true upon completion)
33935                        completed,
33936
33937                        // To know if global events are to be dispatched
33938                        fireGlobals,
33939
33940                        // Loop variable
33941                        i,
33942
33943                        // uncached part of the url
33944                        uncached,
33945
33946                        // Create the final options object
33947                        s = jQuery.ajaxSetup({}, options),
33948
33949                        // Callbacks context
33950                        callbackContext = s.context || s,
33951
33952                        // Context for global events is callbackContext if it is a DOM node or jQuery collection
33953                        globalEventContext = s.context &&
33954                        (callbackContext.nodeType || callbackContext.jquery) ?
33955                            jQuery(callbackContext) :
33956                            jQuery.event,
33957
33958                        // Deferreds
33959                        deferred = jQuery.Deferred(),
33960                        completeDeferred = jQuery.Callbacks("once memory"),
33961
33962                        // Status-dependent callbacks
33963                        statusCode = s.statusCode || {},
33964
33965                        // Headers (they are sent all at once)
33966                        requestHeaders = {},
33967                        requestHeadersNames = {},
33968
33969                        // Default abort message
33970                        strAbort = "canceled",
33971
33972                        // Fake xhr
33973                        jqXHR = {
33974                            readyState: 0,
33975
33976                            // Builds headers hashtable if needed
33977                            getResponseHeader: function (key) {
33978                                var match;
33979                                if (completed) {
33980                                    if (!responseHeaders) {
33981                                        responseHeaders = {};
33982                                        while ((match = rheaders.exec(responseHeadersString))) {
33983                                            responseHeaders[match[1].toLowerCase() + " "] =
33984                                                (responseHeaders[match[1].toLowerCase() + " "] || [])
33985                                                    .concat(match[2]);
33986                                        }
33987                                    }
33988                                    match = responseHeaders[key.toLowerCase() + " "];
33989                                }
33990                                return match == null ? null : match.join(", ");
33991                            },
33992
33993                            // Raw string
33994                            getAllResponseHeaders: function () {
33995                                return completed ? responseHeadersString : null;
33996                            },
33997
33998                            // Caches the header
33999                            setRequestHeader: function (name, value) {
34000                                if (completed == null) {
34001                                    name = requestHeadersNames[name.toLowerCase()] =
34002                                        requestHeadersNames[name.toLowerCase()] || name;
34003                                    requestHeaders[name] = value;
34004                                }
34005                                return this;
34006                            },
34007
34008                            // Overrides response content-type header
34009                            overrideMimeType: function (type) {
34010                                if (completed == null) {
34011                                    s.mimeType = type;
34012                                }
34013                                return this;
34014                            },
34015
34016                            // Status-dependent callbacks
34017                            statusCode: function (map) {
34018                                var code;
34019                                if (map) {
34020                                    if (completed) {
34021
34022                                        // Execute the appropriate callbacks
34023                                        jqXHR.always(map[jqXHR.status]);
34024                                    } else {
34025
34026                                        // Lazy-add the new callbacks in a way that preserves old ones
34027                                        for (code in map) {
34028                                            statusCode[code] = [statusCode[code], map[code]];
34029                                        }
34030                                    }
34031                                }
34032                                return this;
34033                            },
34034
34035                            // Cancel the request
34036                            abort: function (statusText) {
34037                                var finalText = statusText || strAbort;
34038                                if (transport) {
34039                                    transport.abort(finalText);
34040                                }
34041                                done(0, finalText);
34042                                return this;
34043                            }
34044                        };
34045
34046                    // Attach deferreds
34047                    deferred.promise(jqXHR);
34048
34049                    // Add protocol if not provided (prefilters might expect it)
34050                    // Handle falsy url in the settings object (#10093: consistency with old signature)
34051                    // We also use the url parameter if available
34052                    s.url = ((url || s.url || location.href) + "")
34053                        .replace(rprotocol, location.protocol + "//");
34054
34055                    // Alias method option to type as per ticket #12004
34056                    s.type = options.method || options.type || s.method || s.type;
34057
34058                    // Extract dataTypes list
34059                    s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""];
34060
34061                    // A cross-domain request is in order when the origin doesn't match the current origin.
34062                    if (s.crossDomain == null) {
34063                        urlAnchor = document.createElement("a");
34064
vendor: 37,487 bytes, lines 34065-34952
34065                        // Support: IE <=8 - 11, Edge 12 - 15
34066                        // IE throws exception on accessing the href property if url is malformed,
34067                        // e.g. http://example.com:80x/
34068                        try {
34069                            urlAnchor.href = s.url;
34070
34071                            // Support: IE <=8 - 11 only
34072                            // Anchor's host property isn't correctly set when s.url is relative
34073                            urlAnchor.href = urlAnchor.href;
34074                            s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
34075                                urlAnchor.protocol + "//" + urlAnchor.host;
34076                        } catch (e) {
34077
34078                            // If there is an error parsing the URL, assume it is crossDomain,
34079                            // it can be rejected by the transport if it is invalid
34080                            s.crossDomain = true;
34081                        }
34082                    }
34083
34084                    // Convert data if not already a string
34085                    if (s.data && s.processData && typeof s.data !== "string") {
34086                        s.data = jQuery.param(s.data, s.traditional);
34087                    }
34088
34089                    // Apply prefilters
34090                    inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
34091
34092                    // If request was aborted inside a prefilter, stop there
34093                    if (completed) {
34094                        return jqXHR;
34095                    }
34096
34097                    // We can fire global events as of now if asked to
34098                    // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
34099                    fireGlobals = jQuery.event && s.global;
34100
34101                    // Watch for a new set of requests
34102                    if (fireGlobals && jQuery.active++ === 0) {
34103                        jQuery.event.trigger("ajaxStart");
34104                    }
34105
34106                    // Uppercase the type
34107                    s.type = s.type.toUpperCase();
34108
34109                    // Determine if request has content
34110                    s.hasContent = !rnoContent.test(s.type);
34111
34112                    // Save the URL in case we're toying with the If-Modified-Since
34113                    // and/or If-None-Match header later on
34114                    // Remove hash to simplify url manipulation
34115                    cacheURL = s.url.replace(rhash, "");
34116
34117                    // More options handling for requests with no content
34118                    if (!s.hasContent) {
34119
34120                        // Remember the hash so we can put it back
34121                        uncached = s.url.slice(cacheURL.length);
34122
34123                        // If data is available and should be processed, append data to url
34124                        if (s.data && (s.processData || typeof s.data === "string")) {
34125                            cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data;
34126
34127                            // #9682: remove data so that it's not used in an eventual retry
34128                            delete s.data;
34129                        }
34130
34131                        // Add or update anti-cache param if needed
34132                        if (s.cache === false) {
34133                            cacheURL = cacheURL.replace(rantiCache, "$1");
34134                            uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + (nonce.guid++) +
34135                                uncached;
34136                        }
34137
34138                        // Put hash and anti-cache on the URL that will be requested (gh-1732)
34139                        s.url = cacheURL + uncached;
34140
34141                        // Change '%20' to '+' if this is encoded form body content (gh-2658)
34142                    } else if (s.data && s.processData &&
34143                        (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) {
34144                        s.data = s.data.replace(r20, "+");
34145                    }
34146
34147                    // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
34148                    if (s.ifModified) {
34149                        if (jQuery.lastModified[cacheURL]) {
34150                            jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]);
34151                        }
34152                        if (jQuery.etag[cacheURL]) {
34153                            jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]);
34154                        }
34155                    }
34156
34157                    // Set the correct header, if data is being sent
34158                    if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
34159                        jqXHR.setRequestHeader("Content-Type", s.contentType);
34160                    }
34161
34162                    // Set the Accepts header for the server, depending on the dataType
34163                    jqXHR.setRequestHeader(
34164                        "Accept",
34165                        s.dataTypes[0] && s.accepts[s.dataTypes[0]] ?
34166                            s.accepts[s.dataTypes[0]] +
34167                            (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") :
34168                            s.accepts["*"]
34169                    );
34170
34171                    // Check for headers option
34172                    for (i in s.headers) {
34173                        jqXHR.setRequestHeader(i, s.headers[i]);
34174                    }
34175
34176                    // Allow custom headers/mimetypes and early abort
34177                    if (s.beforeSend &&
34178                        (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)) {
34179
34180                        // Abort if not done already and return
34181                        return jqXHR.abort();
34182                    }
34183
34184                    // Aborting is no longer a cancellation
34185                    strAbort = "abort";
34186
34187                    // Install callbacks on deferreds
34188                    completeDeferred.add(s.complete);
34189                    jqXHR.done(s.success);
34190                    jqXHR.fail(s.error);
34191
34192                    // Get transport
34193                    transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
34194
34195                    // If no transport, we auto-abort
34196                    if (!transport) {
34197                        done(-1, "No Transport");
34198                    } else {
34199                        jqXHR.readyState = 1;
34200
34201                        // Send global event
34202                        if (fireGlobals) {
34203                            globalEventContext.trigger("ajaxSend", [jqXHR, s]);
34204                        }
34205
34206                        // If request was aborted inside ajaxSend, stop there
34207                        if (completed) {
34208                            return jqXHR;
34209                        }
34210
34211                        // Timeout
34212                        if (s.async && s.timeout > 0) {
34213                            timeoutTimer = window.setTimeout(function () {
34214                                jqXHR.abort("timeout");
34215                            }, s.timeout);
34216                        }
34217
34218                        try {
34219                            completed = false;
34220                            transport.send(requestHeaders, done);
34221                        } catch (e) {
34222
34223                            // Rethrow post-completion exceptions
34224                            if (completed) {
34225                                throw e;
34226                            }
34227
34228                            // Propagate others as results
34229                            done(-1, e);
34230                        }
34231                    }
34232
34233                    // Callback for when everything is done
34234                    function done(status, nativeStatusText, responses, headers) {
34235                        var isSuccess, success, error, response, modified,
34236                            statusText = nativeStatusText;
34237
34238                        // Ignore repeat invocations
34239                        if (completed) {
34240                            return;
34241                        }
34242
34243                        completed = true;
34244
34245                        // Clear timeout if it exists
34246                        if (timeoutTimer) {
34247                            window.clearTimeout(timeoutTimer);
34248                        }
34249
34250                        // Dereference transport for early garbage collection
34251                        // (no matter how long the jqXHR object will be used)
34252                        transport = undefined;
34253
34254                        // Cache response headers
34255                        responseHeadersString = headers || "";
34256
34257                        // Set readyState
34258                        jqXHR.readyState = status > 0 ? 4 : 0;
34259
34260                        // Determine if successful
34261                        isSuccess = status >= 200 && status < 300 || status === 304;
34262
34263                        // Get response data
34264                        if (responses) {
34265                            response = ajaxHandleResponses(s, jqXHR, responses);
34266                        }
34267
34268                        // Use a noop converter for missing script
34269                        if (!isSuccess && jQuery.inArray("script", s.dataTypes) > -1) {
34270                            s.converters["text script"] = function () {
34271                            };
34272                        }
34273
34274                        // Convert no matter what (that way responseXXX fields are always set)
34275                        response = ajaxConvert(s, response, jqXHR, isSuccess);
34276
34277                        // If successful, handle type chaining
34278                        if (isSuccess) {
34279
34280                            // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
34281                            if (s.ifModified) {
34282                                modified = jqXHR.getResponseHeader("Last-Modified");
34283                                if (modified) {
34284                                    jQuery.lastModified[cacheURL] = modified;
34285                                }
34286                                modified = jqXHR.getResponseHeader("etag");
34287                                if (modified) {
34288                                    jQuery.etag[cacheURL] = modified;
34289                                }
34290                            }
34291
34292                            // if no content
34293                            if (status === 204 || s.type === "HEAD") {
34294                                statusText = "nocontent";
34295
34296                                // if not modified
34297                            } else if (status === 304) {
34298                                statusText = "notmodified";
34299
34300                                // If we have data, let's convert it
34301                            } else {
34302                                statusText = response.state;
34303                                success = response.data;
34304                                error = response.error;
34305                                isSuccess = !error;
34306                            }
34307                        } else {
34308
34309                            // Extract error from statusText and normalize for non-aborts
34310                            error = statusText;
34311                            if (status || !statusText) {
34312                                statusText = "error";
34313                                if (status < 0) {
34314                                    status = 0;
34315                                }
34316                            }
34317                        }
34318
34319                        // Set data for the fake xhr object
34320                        jqXHR.status = status;
34321                        jqXHR.statusText = (nativeStatusText || statusText) + "";
34322
34323                        // Success/Error
34324                        if (isSuccess) {
34325                            deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);
34326                        } else {
34327                            deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);
34328                        }
34329
34330                        // Status-dependent callbacks
34331                        jqXHR.statusCode(statusCode);
34332                        statusCode = undefined;
34333
34334                        if (fireGlobals) {
34335                            globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError",
34336                                [jqXHR, s, isSuccess ? success : error]);
34337                        }
34338
34339                        // Complete
34340                        completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
34341
34342                        if (fireGlobals) {
34343                            globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
34344
34345                            // Handle the global AJAX counter
34346                            if (!(--jQuery.active)) {
34347                                jQuery.event.trigger("ajaxStop");
34348                            }
34349                        }
34350                    }
34351
34352                    return jqXHR;
34353                },
34354
34355                getJSON: function (url, data, callback) {
34356                    return jQuery.get(url, data, callback, "json");
34357                },
34358
34359                getScript: function (url, callback) {
34360                    return jQuery.get(url, undefined, callback, "script");
34361                }
34362            });
34363
34364            jQuery.each(["get", "post"], function (_i, method) {
34365                jQuery[method] = function (url, data, callback, type) {
34366
34367                    // Shift arguments if data argument was omitted
34368                    if (isFunction(data)) {
34369                        type = type || callback;
34370                        callback = data;
34371                        data = undefined;
34372                    }
34373
34374                    // The url can be an options object (which then must have .url)
34375                    return jQuery.ajax(jQuery.extend({
34376                        url: url,
34377                        type: method,
34378                        dataType: type,
34379                        data: data,
34380                        success: callback
34381                    }, jQuery.isPlainObject(url) && url));
34382                };
34383            });
34384
34385            jQuery.ajaxPrefilter(function (s) {
34386                var i;
34387                for (i in s.headers) {
34388                    if (i.toLowerCase() === "content-type") {
34389                        s.contentType = s.headers[i] || "";
34390                    }
34391                }
34392            });
34393
34394
34395            jQuery._evalUrl = function (url, options, doc) {
34396                return jQuery.ajax({
34397                    url: url,
34398
34399                    // Make this explicit, since user can override this through ajaxSetup (#11264)
34400                    type: "GET",
34401                    dataType: "script",
34402                    cache: true,
34403                    async: false,
34404                    global: false,
34405
34406                    // Only evaluate the response if it is successful (gh-4126)
34407                    // dataFilter is not invoked for failure responses, so using it instead
34408                    // of the default converter is kludgy but it works.
34409                    converters: {
34410                        "text script": function () {
34411                        }
34412                    },
34413                    dataFilter: function (response) {
34414                        jQuery.globalEval(response, options, doc);
34415                    }
34416                });
34417            };
34418
34419
34420            jQuery.fn.extend({
34421                wrapAll: function (html) {
34422                    var wrap;
34423
34424                    if (this[0]) {
34425                        if (isFunction(html)) {
34426                            html = html.call(this[0]);
34427                        }
34428
34429                        // The elements to wrap the target around
34430                        wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
34431
34432                        if (this[0].parentNode) {
34433                            wrap.insertBefore(this[0]);
34434                        }
34435
34436                        wrap.map(function () {
34437                            var elem = this;
34438
34439                            while (elem.firstElementChild) {
34440                                elem = elem.firstElementChild;
34441                            }
34442
34443                            return elem;
34444                        }).append(this);
34445                    }
34446
34447                    return this;
34448                },
34449
34450                wrapInner: function (html) {
34451                    if (isFunction(html)) {
34452                        return this.each(function (i) {
34453                            jQuery(this).wrapInner(html.call(this, i));
34454                        });
34455                    }
34456
34457                    return this.each(function () {
34458                        var self = jQuery(this),
34459                            contents = self.contents();
34460
34461                        if (contents.length) {
34462                            contents.wrapAll(html);
34463
34464                        } else {
34465                            self.append(html);
34466                        }
34467                    });
34468                },
34469
34470                wrap: function (html) {
34471                    var htmlIsFunction = isFunction(html);
34472
34473                    return this.each(function (i) {
34474                        jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html);
34475                    });
34476                },
34477
34478                unwrap: function (selector) {
34479                    this.parent(selector).not("body").each(function () {
34480                        jQuery(this).replaceWith(this.childNodes);
34481                    });
34482                    return this;
34483                }
34484            });
34485
34486
34487            jQuery.expr.pseudos.hidden = function (elem) {
34488                return !jQuery.expr.pseudos.visible(elem);
34489            };
34490            jQuery.expr.pseudos.visible = function (elem) {
34491                return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
34492            };
34493
34494
34495            jQuery.ajaxSettings.xhr = function () {
34496                try {
34497                    return new window.XMLHttpRequest();
34498                } catch (e) {
34499                }
34500            };
34501
34502            var xhrSuccessStatus = {
34503
34504                    // File protocol always yields status code 0, assume 200
34505                    0: 200,
34506
34507                    // Support: IE <=9 only
34508                    // #1450: sometimes IE returns 1223 when it should be 204
34509                    1223: 204
34510                },
34511                xhrSupported = jQuery.ajaxSettings.xhr();
34512
34513            support.cors = !!xhrSupported && ("withCredentials" in xhrSupported);
34514            support.ajax = xhrSupported = !!xhrSupported;
34515
34516            jQuery.ajaxTransport(function (options) {
34517                var callback, errorCallback;
34518
34519                // Cross domain only allowed if supported through XMLHttpRequest
34520                if (support.cors || xhrSupported && !options.crossDomain) {
34521                    return {
34522                        send: function (headers, complete) {
34523                            var i,
34524                                xhr = options.xhr();
34525
34526                            xhr.open(
34527                                options.type,
34528                                options.url,
34529                                options.async,
34530                                options.username,
34531                                options.password
34532                            );
34533
34534                            // Apply custom fields if provided
34535                            if (options.xhrFields) {
34536                                for (i in options.xhrFields) {
34537                                    xhr[i] = options.xhrFields[i];
34538                                }
34539                            }
34540
34541                            // Override mime type if needed
34542                            if (options.mimeType && xhr.overrideMimeType) {
34543                                xhr.overrideMimeType(options.mimeType);
34544                            }
34545
34546                            // X-Requested-With header
34547                            // For cross-domain requests, seeing as conditions for a preflight are
34548                            // akin to a jigsaw puzzle, we simply never set it to be sure.
34549                            // (it can always be set on a per-request basis or even using ajaxSetup)
34550                            // For same-domain requests, won't change header if already provided.
34551                            if (!options.crossDomain && !headers["X-Requested-With"]) {
34552                                headers["X-Requested-With"] = "XMLHttpRequest";
34553                            }
34554
34555                            // Set headers
34556                            for (i in headers) {
34557                                xhr.setRequestHeader(i, headers[i]);
34558                            }
34559
34560                            // Callback
34561                            callback = function (type) {
34562                                return function () {
34563                                    if (callback) {
34564                                        callback = errorCallback = xhr.onload =
34565                                            xhr.onerror = xhr.onabort = xhr.ontimeout =
34566                                                xhr.onreadystatechange = null;
34567
34568                                        if (type === "abort") {
34569                                            xhr.abort();
34570                                        } else if (type === "error") {
34571
34572                                            // Support: IE <=9 only
34573                                            // On a manual native abort, IE9 throws
34574                                            // errors on any property access that is not readyState
34575                                            if (typeof xhr.status !== "number") {
34576                                                complete(0, "error");
34577                                            } else {
34578                                                complete(
34579                                                    // File: protocol always yields status 0; see #8605, #14207
34580                                                    xhr.status,
34581                                                    xhr.statusText
34582                                                );
34583                                            }
34584                                        } else {
34585                                            complete(
34586                                                xhrSuccessStatus[xhr.status] || xhr.status,
34587                                                xhr.statusText,
34588
34589                                                // Support: IE <=9 only
34590                                                // IE9 has no XHR2 but throws on binary (trac-11426)
34591                                                // For XHR2 non-text, let the caller handle it (gh-2498)
34592                                                (xhr.responseType || "text") !== "text" ||
34593                                                typeof xhr.responseText !== "string" ?
34594                                                    {binary: xhr.response} :
34595                                                    {text: xhr.responseText},
34596                                                xhr.getAllResponseHeaders()
34597                                            );
34598                                        }
34599                                    }
34600                                };
34601                            };
34602
34603                            // Listen to events
34604                            xhr.onload = callback();
34605                            errorCallback = xhr.onerror = xhr.ontimeout = callback("error");
34606
34607                            // Support: IE 9 only
34608                            // Use onreadystatechange to replace onabort
34609                            // to handle uncaught aborts
34610                            if (xhr.onabort !== undefined) {
34611                                xhr.onabort = errorCallback;
34612                            } else {
34613                                xhr.onreadystatechange = function () {
34614
34615                                    // Check readyState before timeout as it changes
34616                                    if (xhr.readyState === 4) {
34617
34618                                        // Allow onerror to be called first,
34619                                        // but that will not handle a native abort
34620                                        // Also, save errorCallback to a variable
34621                                        // as xhr.onerror cannot be accessed
34622                                        window.setTimeout(function () {
34623                                            if (callback) {
34624                                                errorCallback();
34625                                            }
34626                                        });
34627                                    }
34628                                };
34629                            }
34630
34631                            // Create the abort callback
34632                            callback = callback("abort");
34633
34634                            try {
34635
34636                                // Do send the request (this may raise an exception)
34637                                xhr.send(options.hasContent && options.data || null);
34638                            } catch (e) {
34639
34640                                // #14683: Only rethrow if this hasn't been notified as an error yet
34641                                if (callback) {
34642                                    throw e;
34643                                }
34644                            }
34645                        },
34646
34647                        abort: function () {
34648                            if (callback) {
34649                                callback();
34650                            }
34651                        }
34652                    };
34653                }
34654            });
34655
34656
34657// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
34658            jQuery.ajaxPrefilter(function (s) {
34659                if (s.crossDomain) {
34660                    s.contents.script = false;
34661                }
34662            });
34663
34664// Install script dataType
34665            jQuery.ajaxSetup({
34666                accepts: {
34667                    script: "text/javascript, application/javascript, " +
34668                        "application/ecmascript, application/x-ecmascript"
34669                },
34670                contents: {
34671                    script: /\b(?:java|ecma)script\b/
34672                },
34673                converters: {
34674                    "text script": function (text) {
34675                        jQuery.globalEval(text);
34676                        return text;
34677                    }
34678                }
34679            });
34680
34681// Handle cache's special case and crossDomain
34682            jQuery.ajaxPrefilter("script", function (s) {
34683                if (s.cache === undefined) {
34684                    s.cache = false;
34685                }
34686                if (s.crossDomain) {
34687                    s.type = "GET";
34688                }
34689            });
34690
34691// Bind script tag hack transport
34692            jQuery.ajaxTransport("script", function (s) {
34693
34694                // This transport only deals with cross domain or forced-by-attrs requests
34695                if (s.crossDomain || s.scriptAttrs) {
34696                    var script, callback;
34697                    return {
34698                        send: function (_, complete) {
34699                            script = jQuery("<script>")
34700                                .attr(s.scriptAttrs || {})
34701                                .prop({charset: s.scriptCharset, src: s.url})
34702                                .on("load error", callback = function (evt) {
34703                                    script.remove();
34704                                    callback = null;
34705                                    if (evt) {
34706                                        complete(evt.type === "error" ? 404 : 200, evt.type);
34707                                    }
34708                                });
34709
34710                            // Use native DOM manipulation to avoid our domManip AJAX trickery
34711                            document.head.appendChild(script[0]);
34712                        },
34713                        abort: function () {
34714                            if (callback) {
34715                                callback();
34716                            }
34717                        }
34718                    };
34719                }
34720            });
34721
34722
34723            var oldCallbacks = [],
34724                rjsonp = /(=)\?(?=&|$)|\?\?/;
34725
34726// Default jsonp settings
34727            jQuery.ajaxSetup({
34728                jsonp: "callback",
34729                jsonpCallback: function () {
34730                    var callback = oldCallbacks.pop() || (jQuery.expando + "_" + (nonce.guid++));
34731                    this[callback] = true;
34732                    return callback;
34733                }
34734            });
34735
34736// Detect, normalize options and install callbacks for jsonp requests
34737            jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) {
34738
34739                var callbackName, overwritten, responseContainer,
34740                    jsonProp = s.jsonp !== false && (rjsonp.test(s.url) ?
34741                            "url" :
34742                            typeof s.data === "string" &&
34743                            (s.contentType || "")
34744                                .indexOf("application/x-www-form-urlencoded") === 0 &&
34745                            rjsonp.test(s.data) && "data"
34746                    );
34747
34748                // Handle iff the expected data type is "jsonp" or we have a parameter to set
34749                if (jsonProp || s.dataTypes[0] === "jsonp") {
34750
34751                    // Get callback name, remembering preexisting value associated with it
34752                    callbackName = s.jsonpCallback = isFunction(s.jsonpCallback) ?
34753                        s.jsonpCallback() :
34754                        s.jsonpCallback;
34755
34756                    // Insert callback into url or form data
34757                    if (jsonProp) {
34758                        s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName);
34759                    } else if (s.jsonp !== false) {
34760                        s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName;
34761                    }
34762
34763                    // Use data converter to retrieve json after script execution
34764                    s.converters["script json"] = function () {
34765                        if (!responseContainer) {
34766                            jQuery.error(callbackName + " was not called");
34767                        }
34768                        return responseContainer[0];
34769                    };
34770
34771                    // Force json dataType
34772                    s.dataTypes[0] = "json";
34773
34774                    // Install callback
34775                    overwritten = window[callbackName];
34776                    window[callbackName] = function () {
34777                        responseContainer = arguments;
34778                    };
34779
34780                    // Clean-up function (fires after converters)
34781                    jqXHR.always(function () {
34782
34783                        // If previous value didn't exist - remove it
34784                        if (overwritten === undefined) {
34785                            jQuery(window).removeProp(callbackName);
34786
34787                            // Otherwise restore preexisting value
34788                        } else {
34789                            window[callbackName] = overwritten;
34790                        }
34791
34792                        // Save back as free
34793                        if (s[callbackName]) {
34794
34795                            // Make sure that re-using the options doesn't screw things around
34796                            s.jsonpCallback = originalSettings.jsonpCallback;
34797
34798                            // Save the callback name for future use
34799                            oldCallbacks.push(callbackName);
34800                        }
34801
34802                        // Call if it was a function and we have a response
34803                        if (responseContainer && isFunction(overwritten)) {
34804                            overwritten(responseContainer[0]);
34805                        }
34806
34807                        responseContainer = overwritten = undefined;
34808                    });
34809
34810                    // Delegate to script
34811                    return "script";
34812                }
34813            });
34814
34815
34816// Support: Safari 8 only
34817// In Safari 8 documents created via document.implementation.createHTMLDocument
34818// collapse sibling forms: the second one becomes a child of the first one.
34819// Because of that, this security measure has to be disabled in Safari 8.
34820// https://bugs.webkit.org/show_bug.cgi?id=137337
34821            support.createHTMLDocument = (function () {
34822                var body = document.implementation.createHTMLDocument("").body;
34823                body.innerHTML = "<form></form><form></form>";
34824                return body.childNodes.length === 2;
34825            })();
34826
34827
34828// Argument "data" should be string of html
34829// context (optional): If specified, the fragment will be created in this context,
34830// defaults to document
34831// keepScripts (optional): If true, will include scripts passed in the html string
34832            jQuery.parseHTML = function (data, context, keepScripts) {
34833                if (typeof data !== "string") {
34834                    return [];
34835                }
34836                if (typeof context === "boolean") {
34837                    keepScripts = context;
34838                    context = false;
34839                }
34840
34841                var base, parsed, scripts;
34842
34843                if (!context) {
34844
34845                    // Stop scripts or inline event handlers from being executed immediately
34846                    // by using document.implementation
34847                    if (support.createHTMLDocument) {
34848                        context = document.implementation.createHTMLDocument("");
34849
34850                        // Set the base href for the created document
34851                        // so any parsed elements with URLs
34852                        // are based on the document's URL (gh-2965)
34853                        base = context.createElement("base");
34854                        base.href = document.location.href;
34855                        context.head.appendChild(base);
34856                    } else {
34857                        context = document;
34858                    }
34859                }
34860
34861                parsed = rsingleTag.exec(data);
34862                scripts = !keepScripts && [];
34863
34864                // Single tag
34865                if (parsed) {
34866                    return [context.createElement(parsed[1])];
34867                }
34868
34869                parsed = buildFragment([data], context, scripts);
34870
34871                if (scripts && scripts.length) {
34872                    jQuery(scripts).remove();
34873                }
34874
34875                return jQuery.merge([], parsed.childNodes);
34876            };
34877
34878
34879            /**
34880             * Load a url into a page
34881             */
34882            jQuery.fn.load = function (url, params, callback) {
34883                var selector, type, response,
34884                    self = this,
34885                    off = url.indexOf(" ");
34886
34887                if (off > -1) {
34888                    selector = stripAndCollapse(url.slice(off));
34889                    url = url.slice(0, off);
34890                }
34891
34892                // If it's a function
34893                if (isFunction(params)) {
34894
34895                    // We assume that it's the callback
34896                    callback = params;
34897                    params = undefined;
34898
34899                    // Otherwise, build a param string
34900                } else if (params && typeof params === "object") {
34901                    type = "POST";
34902                }
34903
34904                // If we have elements to modify, make the request
34905                if (self.length > 0) {
34906                    jQuery.ajax({
34907                        url: url,
34908
34909                        // If "type" variable is undefined, then "GET" method will be used.
34910                        // Make value of this field explicit since
34911                        // user can override it through ajaxSetup method
34912                        type: type || "GET",
34913                        dataType: "html",
34914                        data: params
34915                    }).done(function (responseText) {
34916
34917                        // Save response for use in complete callback
34918                        response = arguments;
34919
34920                        self.html(selector ?
34921
34922                            // If a selector was specified, locate the right elements in a dummy div
34923                            // Exclude scripts to avoid IE 'Permission Denied' errors
34924                            jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) :
34925
34926                            // Otherwise use the full result
34927                            responseText);
34928
34929                        // If the request succeeds, this function gets "data", "status", "jqXHR"
34930                        // but they are ignored because response was set above.
34931                        // If it fails, this function gets "jqXHR", "status", "error"
34932                    }).always(callback && function (jqXHR, status) {
34933                        self.each(function () {
34934                            callback.apply(this, response || [jqXHR.responseText, status, jqXHR]);
34935                        });
34936                    });
34937                }
34938
34939                return this;
34940            };
34941
34942
34943            jQuery.expr.pseudos.animated = function (elem) {
34944                return jQuery.grep(jQuery.timers, function (fn) {
34945                    return elem === fn.elem;
34946                }).length;
34947            };
34948
34949
34950            jQuery.offset = {
34951                setOffset: function (elem, options, i) {
34952                    var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, 
vendor: 5,408 bytes, lines 34952-35076
34952calculatePosition,
34953                        position = jQuery.css(elem, "position"),
34954                        curElem = jQuery(elem),
34955                        props = {};
34956
34957                    // Set position first, in-case top/left are set even on static elem
34958                    if (position === "static") {
34959                        elem.style.position = "relative";
34960                    }
34961
34962                    curOffset = curElem.offset();
34963                    curCSSTop = jQuery.css(elem, "top");
34964                    curCSSLeft = jQuery.css(elem, "left");
34965                    calculatePosition = (position === "absolute" || position === "fixed") &&
34966                        (curCSSTop + curCSSLeft).indexOf("auto") > -1;
34967
34968                    // Need to be able to calculate position if either
34969                    // top or left is auto and position is either absolute or fixed
34970                    if (calculatePosition) {
34971                        curPosition = curElem.position();
34972                        curTop = curPosition.top;
34973                        curLeft = curPosition.left;
34974
34975                    } else {
34976                        curTop = parseFloat(curCSSTop) || 0;
34977                        curLeft = parseFloat(curCSSLeft) || 0;
34978                    }
34979
34980                    if (isFunction(options)) {
34981
34982                        // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
34983                        options = options.call(elem, i, jQuery.extend({}, curOffset));
34984                    }
34985
34986                    if (options.top != null) {
34987                        props.top = (options.top - curOffset.top) + curTop;
34988                    }
34989                    if (options.left != null) {
34990                        props.left = (options.left - curOffset.left) + curLeft;
34991                    }
34992
34993                    if ("using" in options) {
34994                        options.using.call(elem, props);
34995
34996                    } else {
34997                        if (typeof props.top === "number") {
34998                            props.top += "px";
34999                        }
35000                        if (typeof props.left === "number") {
35001                            props.left += "px";
35002                        }
35003                        curElem.css(props);
35004                    }
35005                }
35006            };
35007
35008            jQuery.fn.extend({
35009
35010                // offset() relates an element's border box to the document origin
35011                offset: function (options) {
35012
35013                    // Preserve chaining for setter
35014                    if (arguments.length) {
35015                        return options === undefined ?
35016                            this :
35017                            this.each(function (i) {
35018                                jQuery.offset.setOffset(this, options, i);
35019                            });
35020                    }
35021
35022                    var rect, win,
35023                        elem = this[0];
35024
35025                    if (!elem) {
35026                        return;
35027                    }
35028
35029                    // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
35030                    // Support: IE <=11 only
35031                    // Running getBoundingClientRect on a
35032                    // disconnected node in IE throws an error
35033                    if (!elem.getClientRects().length) {
35034                        return {top: 0, left: 0};
35035                    }
35036
35037                    // Get document-relative position by adding viewport scroll to viewport-relative gBCR
35038                    rect = elem.getBoundingClientRect();
35039                    win = elem.ownerDocument.defaultView;
35040                    return {
35041                        top: rect.top + win.pageYOffset,
35042                        left: rect.left + win.pageXOffset
35043                    };
35044                },
35045
35046                // position() relates an element's margin box to its offset parent's padding box
35047                // This corresponds to the behavior of CSS absolute positioning
35048                position: function () {
35049                    if (!this[0]) {
35050                        return;
35051                    }
35052
35053                    var offsetParent, offset, doc,
35054                        elem = this[0],
35055                        parentOffset = {top: 0, left: 0};
35056
35057                    // position:fixed elements are offset from the viewport, which itself always has zero offset
35058                    if (jQuery.css(elem, "position") === "fixed") {
35059
35060                        // Assume position:fixed implies availability of getBoundingClientRect
35061                        offset = elem.getBoundingClientRect();
35062
35063                    } else {
35064                        offset = this.offset();
35065
35066                        // Account for the *real* offset parent, which can be the document or its root element
35067                        // when a statically positioned element is identified
35068                        doc = elem.ownerDocument;
35069                        offsetParent = elem.offsetParent || doc.documentElement;
35070                        while (offsetParent &&
35071                        (offsetParent === doc.body || offsetParent === doc.documentElement) &&
35072                        jQuery.css(offsetParent, "position") === "static") {
35073
35074                            offsetParent = offsetParent.parentNode;
35075                        }
35076                        if (offsetParent && offsetParent !== elem && offsetParent.
vendor: 4,371 bytes, lines 35076-35170
35076nodeType === 1) {
35077
35078                            // Incorporate borders into its offset, since they are outside its content origin
35079                            parentOffset = jQuery(offsetParent).offset();
35080                            parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true);
35081                            parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", true);
35082                        }
35083                    }
35084
35085                    // Subtract parent offsets and element margins
35086                    return {
35087                        top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
35088                        left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
35089                    };
35090                },
35091
35092                // This method will return documentElement in the following cases:
35093                // 1) For the element inside the iframe without offsetParent, this method will return
35094                //    documentElement of the parent window
35095                // 2) For the hidden or detached element
35096                // 3) For body or html element, i.e. in case of the html node - it will return itself
35097                //
35098                // but those exceptions were never presented as a real life use-cases
35099                // and might be considered as more preferable results.
35100                //
35101                // This logic, however, is not guaranteed and can change at any point in the future
35102                offsetParent: function () {
35103                    return this.map(function () {
35104                        var offsetParent = this.offsetParent;
35105
35106                        while (offsetParent && jQuery.css(offsetParent, "position") === "static") {
35107                            offsetParent = offsetParent.offsetParent;
35108                        }
35109
35110                        return offsetParent || documentElement;
35111                    });
35112                }
35113            });
35114
35115// Create scrollLeft and scrollTop methods
35116            jQuery.each({scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function (method, prop) {
35117                var top = "pageYOffset" === prop;
35118
35119                jQuery.fn[method] = function (val) {
35120                    return access(this, function (elem, method, val) {
35121
35122                        // Coalesce documents and windows
35123                        var win;
35124                        if (isWindow(elem)) {
35125                            win = elem;
35126                        } else if (elem.nodeType === 9) {
35127                            win = elem.defaultView;
35128                        }
35129
35130                        if (val === undefined) {
35131                            return win ? win[prop] : elem[method];
35132                        }
35133
35134                        if (win) {
35135                            win.scrollTo(
35136                                !top ? val : win.pageXOffset,
35137                                top ? val : win.pageYOffset
35138                            );
35139
35140                        } else {
35141                            elem[method] = val;
35142                        }
35143                    }, method, val, arguments.length);
35144                };
35145            });
35146
35147// Support: Safari <=7 - 9.1, Chrome <=37 - 49
35148// Add the top/left cssHooks using jQuery.fn.position
35149// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
35150// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
35151// getComputedStyle returns percent when specified for top/left/bottom/right;
35152// rather than make the css module depend on the offset module, just check for it here
35153            jQuery.each(["top", "left"], function (_i, prop) {
35154                jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition,
35155                    function (elem, computed) {
35156                        if (computed) {
35157                            computed = curCSS(elem, prop);
35158
35159                            // If curCSS returns percentage, fallback to offset
35160                            return rnumnonpx.test(computed) ?
35161                                jQuery(elem).position()[prop] + "px" :
35162                                computed;
35163                        }
35164                    }
35165                );
35166            });
35167
35168
35169// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
35170            jQuery.each({Height: "height", Width: "width"}, function (name, type) {
vendor: 7,688 bytes, lines 35171-35352
35171                jQuery.each({padding: "inner" + name, content: type, "": "outer" + name},
35172                    function (defaultExtra, funcName) {
35173
35174                        // Margin is only for outerHeight, outerWidth
35175                        jQuery.fn[funcName] = function (margin, value) {
35176                            var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"),
35177                                extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
35178
35179                            return access(this, function (elem, type, value) {
35180                                var doc;
35181
35182                                if (isWindow(elem)) {
35183
35184                                    // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
35185                                    return funcName.indexOf("outer") === 0 ?
35186                                        elem["inner" + name] :
35187                                        elem.document.documentElement["client" + name];
35188                                }
35189
35190                                // Get document width or height
35191                                if (elem.nodeType === 9) {
35192                                    doc = elem.documentElement;
35193
35194                                    // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
35195                                    // whichever is greatest
35196                                    return Math.max(
35197                                        elem.body["scroll" + name], doc["scroll" + name],
35198                                        elem.body["offset" + name], doc["offset" + name],
35199                                        doc["client" + name]
35200                                    );
35201                                }
35202
35203                                return value === undefined ?
35204
35205                                    // Get width or height on the element, requesting but not forcing parseFloat
35206                                    jQuery.css(elem, type, extra) :
35207
35208                                    // Set width or height on the element
35209                                    jQuery.style(elem, type, value, extra);
35210                            }, type, chainable ? margin : undefined, chainable);
35211                        };
35212                    });
35213            });
35214
35215
35216            jQuery.each([
35217                "ajaxStart",
35218                "ajaxStop",
35219                "ajaxComplete",
35220                "ajaxError",
35221                "ajaxSuccess",
35222                "ajaxSend"
35223            ], function (_i, type) {
35224                jQuery.fn[type] = function (fn) {
35225                    return this.on(type, fn);
35226                };
35227            });
35228
35229
35230            jQuery.fn.extend({
35231
35232                bind: function (types, data, fn) {
35233                    return this.on(types, null, data, fn);
35234                },
35235                unbind: function (types, fn) {
35236                    return this.off(types, null, fn);
35237                },
35238
35239                delegate: function (selector, types, data, fn) {
35240                    return this.on(types, selector, data, fn);
35241                },
35242                undelegate: function (selector, types, fn) {
35243
35244                    // ( namespace ) or ( selector, types [, fn] )
35245                    return arguments.length === 1 ?
35246                        this.off(selector, "**") :
35247                        this.off(types, selector || "**", fn);
35248                },
35249
35250                hover: function (fnOver, fnOut) {
35251                    return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
35252                }
35253            });
35254
35255            jQuery.each(("blur focus focusin focusout resize scroll click dblclick " +
35256                    "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
35257                    "change select submit keydown keypress keyup contextmenu").split(" "),
35258                function (_i, name) {
35259
35260                    // Handle event binding
35261                    jQuery.fn[name] = function (data, fn) {
35262                        return arguments.length > 0 ?
35263                            this.on(name, null, data, fn) :
35264                            this.trigger(name);
35265                    };
35266                });
35267
35268
35269// Support: Android <=4.0 only
35270// Make sure we trim BOM and NBSP
35271            var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
35272
35273// Bind a function to a context, optionally partially applying any
35274// arguments.
35275// jQuery.proxy is deprecated to promote standards (specifically Function#bind)
35276// However, it is not slated for removal any time soon
35277            jQuery.proxy = function (fn, context) {
35278                var tmp, args, proxy;
35279
35280                if (typeof context === "string") {
35281                    tmp = fn[context];
35282                    context = fn;
35283                    fn = tmp;
35284                }
35285
35286                // Quick check to determine if target is callable, in the spec
35287                // this throws a TypeError, but we will just return undefined.
35288                if (!isFunction(fn)) {
35289                    return undefined;
35290                }
35291
35292                // Simulated bind
35293                args = slice.call(arguments, 2);
35294                proxy = function () {
35295                    return fn.apply(context || this, args.concat(slice.call(arguments)));
35296                };
35297
35298                // Set the guid of unique handler to the same of original handler, so it can be removed
35299                proxy.guid = fn.guid = fn.guid || jQuery.guid++;
35300
35301                return proxy;
35302            };
35303
35304            jQuery.holdReady = function (hold) {
35305                if (hold) {
35306                    jQuery.readyWait++;
35307                } else {
35308                    jQuery.ready(true);
35309                }
35310            };
35311            jQuery.isArray = Array.isArray;
35312            jQuery.parseJSON = JSON.parse;
35313            jQuery.nodeName = nodeName;
35314            jQuery.isFunction = isFunction;
35315            jQuery.isWindow = isWindow;
35316            jQuery.camelCase = camelCase;
35317            jQuery.type = toType;
35318
35319            jQuery.now = Date.now;
35320
35321            jQuery.isNumeric = function (obj) {
35322
35323                // As of jQuery 3.0, isNumeric is limited to
35324                // strings and numbers (primitives or objects)
35325                // that can be coerced to finite numbers (gh-2662)
35326                var type = jQuery.type(obj);
35327                return (type === "number" || type === "string") &&
35328
35329                    // parseFloat NaNs numeric-cast false positives ("")
35330                    // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
35331                    // subtraction forces infinities to NaN
35332                    !isNaN(obj - parseFloat(obj));
35333            };
35334
35335            jQuery.trim = function (text) {
35336                return text == null ?
35337                    "" :
35338                    (text + "").replace(rtrim, "");
35339            };
35340
35341
35342// Register as a named AMD module, since jQuery can be concatenated with other
35343// files that may use define, but not via a proper concatenation script that
35344// understands anonymous AMD modules. A named AMD is safest and most robust
35345// way to register. Lowercase jquery is used because AMD module names are
35346// derived from file names, and jQuery is normally delivered in a lowercase
35347// file name. Do this after creating the global so that if an AMD module wants
35348// to call noConflict to hide this version of jQuery, it will work.
35349
35350// Note that for maximum portability, libraries that are not jQuery should
35351// declare themselves as anonymous modules, and avoid setting a global if an
35352// AMD loader is present. jQuery is a special case. For more information, see
35353// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
35354
35355            if (typeof define === "function" && define.amd) {
35356                define("jquery", [], function () {
35357                    return jQuery;
35358                });
35359            }
35360
35361
35362            var
35363
35364                // Map over jQuery in case of overwrite
35365                _jQuery = window.jQuery,
35366
35367                // Map over the $ in case of overwrite
35368                _$ = window.$;
35369
35370            jQuery.noConflict = function (deep) {
35371                if (window.$ === jQuery) {
35372                    window.$ = _$;
35373                }
35374
35375                if (deep && window.jQuery === jQuery) {
35376                    window.jQuery = _jQuery;
35377                }
35378
35379                return jQuery;
35380            };
35381
35382// Expose jQuery and $ identifiers, even in AMD
35383// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
35384// and CommonJS for browser emulators (#13566)
35385            if (typeof noGlobal === "undefined") {
35386                window.jQuery = window.$ = jQuery;
35387            }
35388
35389
35390            return jQuery;
35391        });
35392
35393    }, {}],
35394    7: [function (require, module, exports) {
35395        (typeof navigator !== "undefined") && (function (root, factory) {
35396            if (typeof define === "function" && define.amd) {
35397                define(function () {
35398                    return factory(root);
35399                });
35400            } else if (typeof module === "object" && module.exports) {
35401                module.exports = factory(root);
35402            } else {
35403                root.lottie = factory(root);
35404                root.bodymovin = root.lottie;
35405            }
35406        }((window || {}), function (window) {
35407            "use strict";
35408            var svgNS = "http://www.w3.org/2000/svg";
35409
35410            var locationHref = '';
35411
35412            var initialDefaultFrame = -999999;
35413
35414            var subframeEnabled = true;
35415            var expressionsPlugin;
35416            var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
35417            var cachedColors = {};
35418            var bm_rounder = Math.round;
35419            var bm_rnd;
35420            var bm_pow = Math.pow;
35421            var bm_sqrt = Math.sqrt;
35422            var bm_abs = Math.abs;
35423            var bm_floor = Math.floor;
35424            var bm_max = Math.max;
35425            var bm_min = Math.min;
35426            var blitter = 10;
35427
35428            var BMMath = {};
35429            (function () {
35430                var propertyNames = ["abs", "acos", "acosh", "asin", "asinh", "atan", "atanh", "atan2", "ceil", "cbrt", "expm1", "clz32", "cos", "cosh", "exp", "floor", "fround", "hypot", "imul", "log", "log1p", "log2", "log10", "max", "min", "pow", "random", "round", "sign", "sin", "sinh", "sqrt", "tan", "tanh", "trunc", "E", "LN10", "LN2", "LOG10E", "LOG2E", "PI", "SQRT1_2", "SQRT2"];
35431                var i, len = propertyNames.length;
35432                for (i = 0; i < len; i += 1) {
35433                    BMMath[propertyNames[i]] = Math[propertyNames[i]];
35434                }
35435            }());
35436
35437            function ProjectInterface() {
35438                return {};
35439            }
35440
35441            BMMath.random = Math.random;
35442            BMMath.abs = function (val) {
35443                var tOfVal = typeof val;
35444                if (tOfVal === 'object' && val.length) {
35445                    var absArr = createSizedArray(val.length);
35446                    var i, len = val.length;
35447                    for (i = 0; i < len; i += 1) {
35448                        absArr[i] = Math.abs(val[i]);
35449                    }
35450                    return absArr;
35451                }
35452                return Math.abs(val);
35453
35454            };
35455            var defaultCurveSegments = 150;
35456            var degToRads = Math.PI / 180;
35457            var roundCorner = 0.5519;
35458
35459            function roundValues(flag) {
35460                if (flag) {
35461                    bm_rnd = Math.round;
35462                } else {
35463                    bm_rnd = function (val) {
35464                        return val;
35465                    };
35466                }
35467            }
35468
35469            roundValues(false);
35470
35471            function styleDiv(element) {
35472                element.style.position = 'absolute';
35473                element.style.top = 0;
35474                element.style.left = 0;
35475                element.style.display = 'block';
35476                element.style.transformOrigin = element.style.webkitTransformOrigin = '0 0';
35477                element.style.backfaceVisibility = element.style.webkitBackfaceVisibility = 'visible';
35478                element.style.transformStyle = element.style.webkitTransformStyle = element.style.mozTransformStyle = "preserve-3d";
35479            }
35480
35481            function BMEnterFrameEvent(type, currentTime, totalTime, frameMultiplier) {
35482                this.type = type;
35483                this.currentTime = currentTime;
35484                this.totalTime = totalTime;
35485                this.direction = frameMultiplier < 0 ? -1 : 1;
35486            }
35487
35488            function BMCompleteEvent(type, frameMultiplier) {
35489                this.type = type;
35490                this.direction = frameMultiplier < 0 ? -1 : 1;
35491            }
35492
35493            function BMCompleteLoopEvent(type, totalLoops, currentLoop, frameMultiplier) {
35494                this.type = type;
35495                this.currentLoop = currentLoop;
35496                this.totalLoops = totalLoops;
35497                this.direction = frameMultiplier < 0 ? -1 : 1;
35498            }
35499
35500            function BMSegmentStartEvent(type, firstFrame, totalFrames) {
35501                this.type = type;
35502                this.firstFrame = firstFrame;
35503                this.totalFrames = totalFrames;
35504            }
35505
35506            function BMDestroyEvent(type, target) {
35507                this.type = type;
35508                this.target = target;
35509            }
35510
35511            function BMRenderFrameErrorEvent(nativeError, currentTime) {
35512                this.type = 'renderFrameError';
35513                this.nativeError = nativeError;
35514                this.currentTime = currentTime;
35515            }
35516
35517            function BMConfigErrorEvent(nativeError) {
35518                this.type = 'configError';
35519                this.nativeError = nativeError;
35520            }
35521
35522            function BMAnimationConfigErrorEvent(type, nativeError) {
35523                this.type = type;
35524                this.nativeError = nativeError;
35525                this.currentTime = currentTime;
35526            }
35527
35528            var createElementID = (function () {
35529                var _count = 0;
35530                return function createID() {
35531                    return '__lottie_element_' + ++_count
35532                }
35533            }())
35534
35535            function HSVtoRGB(h, s, v) {
35536                var r, g, b, i, f, p, q, t;
35537                i = Math.floor(h * 6);
35538                f = h * 6 - i;
35539                p = v * (1 - s);
35540                q = v * (1 - f * s);
35541                t = v * (1 - (1 - f) * s);
35542                switch (i % 6) {
35543                    case 0:
35544                        r = v;
35545                        g = t;
35546                        b = p;
35547                        break;
35548                    case 1:
35549                        r = q;
35550                        g = v;
35551                        b = p;
35552                        break;
35553                    case 2:
35554                        r = p;
35555                        g = v;
35556                        b = t;
35557                        break;
35558                    case 3:
35559                        r = p;
35560                        g = q;
35561                        b = v;
35562                        break;
35563                    case 4:
35564                        r = t;
35565                        g = p;
35566                        b = v;
35567                        break;
35568                    case 5:
35569                        r = v;
35570                        g = p;
35571                        b = q;
35572                        break;
35573                }
35574                return [r,
35575                    g,
35576                    b];
35577            }
35578
35579            function RGBtoHSV(r, g, b) {
35580                var max = Math.max(r, g, b), min = Math.min(r, g, b),
35581                    d = max - min,
35582                    h,
35583                    s = (max === 0 ? 0 : d / max),
35584                    v = max / 255;
35585
35586                switch (max) {
35587                    case min:
35588                        h = 0;
35589                        break;
35590                    case r:
35591                        h = (g - b) + d * (g < b ? 6 : 0);
35592                        h /= 6 * d;
35593                        break;
35594                    case g:
35595                        h = (b - r) + d * 2;
35596                        h /= 6 * d;
35597                        break;
35598                    case b:
35599                        h = (r - g) + d * 4;
35600                        h /= 6 * d;
35601                        break;
35602                }
35603
35604                return [
35605                    h,
35606                    s,
35607                    v
35608                ];
35609            }
35610
35611            function addSaturationToRGB(color, offset) {
35612                var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255);
35613                hsv[1] += offset;
35614                if (hsv[1] > 1) {
35615                    hsv[1] = 1;
35616                } else if (hsv[1] <= 0) {
35617                    hsv[1] = 0;
35618                }
35619                return HSVtoRGB(hsv[0], hsv[1], hsv[2]);
35620            }
35621
35622            function addBrightnessToRGB(color, offset) {
35623                var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255);
35624                hsv[2] += offset;
35625                if (hsv[2] > 1) {
35626                    hsv[2] = 1;
35627                } else if (hsv[2] < 0) {
35628                    hsv[2] = 0;
35629                }
35630                return HSVtoRGB(hsv[0], hsv[1], hsv[2]);
35631            }
35632
35633            function addHueToRGB(color, offset) {
35634                var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255);
35635                hsv[0] += offset / 360;
35636                if (hsv[0] > 1) {
35637                    hsv[0] -= 1;
35638                } else if (hsv[0] < 0) {
35639                    hsv[0] += 1;
35640                }
35641                return HSVtoRGB(hsv[0], hsv[1], hsv[2]);
35642            }
35643
35644            var rgbToHex = (function () {
35645                var colorMap = [];
35646                var i;
35647                var hex;
35648                for (i = 0; i < 256; i += 1) {
35649                    hex = i.toString(16);
35650                    colorMap[i] = hex.length == 1 ? '0' + hex : hex;
35651                }
35652
35653                return function (r, g, b) {
35654                    if (r < 0) {
35655                        r = 0;
35656                    }
35657                    if (g < 0) {
35658                        g = 0;
35659                    }
35660                    if (b < 0) {
35661                        b = 0;
35662                    }
35663                    return '#' + colorMap[r] + colorMap[g] + colorMap[b];
35664                };
35665            }());
35666
35667            function BaseEvent() {
35668            }
35669
35670            BaseEvent.prototype = {
35671                triggerEvent: function (eventName, args) {
35672                    if (this._cbs[eventName]) {
35673                        var len = this._cbs[eventName].length;
35674                        for (var i = 0; i < len; i++) {
35675                            this._cbs[eventName][i](args);
35676                        }
35677                    }
35678                },
35679                addEventListener: function (eventName, callback) {
35680                    if (!this._cbs[eventName]) {
35681                        this._cbs[eventName] = [];
35682                    }
35683                    this._cbs[eventName].push(callback);
35684
35685                    return function () {
35686                        this.removeEventListener(eventName, callback);
35687                    }.bind(this);
35688                },
35689                removeEventListener: function (eventName, callback) {
35690                    if (!callback) {
35691                        this._cbs[eventName] = null;
35692                    } else if (this._cbs[eventName]) {
35693                        var i = 0, len = this._cbs[eventName].length;
35694                        while (i < len) {
35695                            if (this._cbs[eventName][i] === callback) {
35696                                this._cbs[eventName].splice(i, 1);
35697                                i -= 1;
35698                                len -= 1;
35699                            }
35700                            i += 1;
35701                        }
35702                        if (!this._cbs[eventName].length) {
35703                            this._cbs[eventName] = null;
35704                        }
35705                    }
35706                }
35707            };
35708            var createTypedArray = (function () {
35709                function createRegularArray(type, len) {
35710                    var i = 0, arr = [], value;
35711                    switch (type) {
35712                        case 'int16':
35713                        case 'uint8c':
35714                            value = 1;
35715                            break;
35716                        default:
35717                            value = 1.1;
35718                            break;
35719                    }
35720                    for (i = 0; i < len; i += 1) {
35721                        arr.push(value);
35722                    }
35723                    return arr;
35724                }
35725
35726                function createTypedArray(type, len) {
35727                    if (type === 'float32') {
35728                        return new Float32Array(len);
35729                    } else if (type === 'int16') {
35730                        return new Int16Array(len);
35731                    } else if (type === 'uint8c') {
35732                        return new Uint8ClampedArray(len);
35733                    }
35734                }
35735
35736                if (typeof Uint8ClampedArray === 'function' && typeof Float32Array === 'function') {
35737                    return createTypedArray;
35738                } else {
35739                    return createRegularArray;
35740                }
35741            }());
35742
35743            function createSizedArray(len) {
35744                return Array.apply(null, {length: len});
35745            }
35746
35747            function createNS(type) {
35748                //return {appendChild:function(){},setAttribute:function(){},style:{}}
35749                return document.createElementNS(svgNS, type);
35750            }
35751
35752            function createTag(type) {
35753                //return {appendChild:function(){},setAttribute:function(){},style:{}}
35754                return document.createElement(type);
35755            }
35756
35757            function DynamicPropertyContainer() {
35758            };
35759            DynamicPropertyContainer.prototype = {
35760                addDynamicProperty: function (prop) {
35761                    if (this.dynamicProperties.indexOf(prop) === -1) {
35762                        this.dynamicProperties.push(prop);
35763                        this.container.addDynamicProperty(this);
35764                        this._isAnimated = true;
35765                    }
35766                },
35767                iterateDynamicProperties: function () {
35768                    this._mdf = false;
vendor: 4,807 bytes, lines 35769-35900
35769                    var i, len = this.dynamicProperties.length;
35770                    for (i = 0; i < len; i += 1) {
35771                        this.dynamicProperties[i].getValue();
35772                        if (this.dynamicProperties[i]._mdf) {
35773                            this._mdf = true;
35774                        }
35775                    }
35776                },
35777                initDynamicPropertyContainer: function (container) {
35778                    this.container = container;
35779                    this.dynamicProperties = [];
35780                    this._mdf = false;
35781                    this._isAnimated = false;
35782                }
35783            }
35784            var getBlendMode = (function () {
35785
35786                var blendModeEnums = {
35787                    0: 'source-over',
35788                    1: 'multiply',
35789                    2: 'screen',
35790                    3: 'overlay',
35791                    4: 'darken',
35792                    5: 'lighten',
35793                    6: 'color-dodge',
35794                    7: 'color-burn',
35795                    8: 'hard-light',
35796                    9: 'soft-light',
35797                    10: 'difference',
35798                    11: 'exclusion',
35799                    12: 'hue',
35800                    13: 'saturation',
35801                    14: 'color',
35802                    15: 'luminosity'
35803                }
35804
35805                return function (mode) {
35806                    return blendModeEnums[mode] || '';
35807                }
35808            }())
35809            /*!
35810 Transformation Matrix v2.0
35811 (c) Epistemex 2014-2015
35812 www.epistemex.com
35813 By Ken Fyrstenberg
35814 Contributions by leeoniya.
35815 License: MIT, header required.
35816 */
35817
35818            /**
35819             * 2D transformation matrix object initialized with identity matrix.
35820             *
35821             * The matrix can synchronize a canvas context by supplying the context
35822             * as an argument, or later apply current absolute transform to an
35823             * existing context.
35824             *
35825             * All values are handled as floating point values.
35826             *
35827             * @param {CanvasRenderingContext2D} [context] - Optional context to sync with Matrix
35828             * @prop {number} a - scale x
35829             * @prop {number} b - shear y
35830             * @prop {number} c - shear x
35831             * @prop {number} d - scale y
35832             * @prop {number} e - translate x
35833             * @prop {number} f - translate y
35834             * @prop {CanvasRenderingContext2D|null} [context=null] - set or get current canvas context
35835             * @constructor
35836             */
35837
35838            var Matrix = (function () {
35839
35840                var _cos = Math.cos;
35841                var _sin = Math.sin;
35842                var _tan = Math.tan;
35843                var _rnd = Math.round;
35844
35845                function reset() {
35846                    this.props[0] = 1;
35847                    this.props[1] = 0;
35848                    this.props[2] = 0;
35849                    this.props[3] = 0;
35850                    this.props[4] = 0;
35851                    this.props[5] = 1;
35852                    this.props[6] = 0;
35853                    this.props[7] = 0;
35854                    this.props[8] = 0;
35855                    this.props[9] = 0;
35856                    this.props[10] = 1;
35857                    this.props[11] = 0;
35858                    this.props[12] = 0;
35859                    this.props[13] = 0;
35860                    this.props[14] = 0;
35861                    this.props[15] = 1;
35862                    return this;
35863                }
35864
35865                function rotate(angle) {
35866                    if (angle === 0) {
35867                        return this;
35868                    }
35869                    var mCos = _cos(angle);
35870                    var mSin = _sin(angle);
35871                    return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
35872                }
35873
35874                function rotateX(angle) {
35875                    if (angle === 0) {
35876                        return this;
35877                    }
35878                    var mCos = _cos(angle);
35879                    var mSin = _sin(angle);
35880                    return this._t(1, 0, 0, 0, 0, mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1);
35881                }
35882
35883                function rotateY(angle) {
35884                    if (angle === 0) {
35885                        return this;
35886                    }
35887                    var mCos = _cos(angle);
35888                    var mSin = _sin(angle);
35889                    return this._t(mCos, 0, mSin, 0, 0, 1, 0, 0, -mSin, 0, mCos, 0, 0, 0, 0, 1);
35890                }
35891
35892                function rotateZ(angle) {
35893                    if (angle === 0) {
35894                        return this;
35895                    }
35896                    var mCos = _cos(angle);
35897                    var mSin = _sin(angle);
35898                    return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
35899                }
35900
vendor: 4,527 bytes, lines 35901-36006
35901                function shear(sx, sy) {
35902                    return this._t(1, sy, sx, 1, 0, 0);
35903                }
35904
35905                function skew(ax, ay) {
35906                    return this.shear(_tan(ax), _tan(ay));
35907                }
35908
35909                function skewFromAxis(ax, angle) {
35910                    var mCos = _cos(angle);
35911                    var mSin = _sin(angle);
35912                    return this._t(mCos, mSin, 0, 0, -mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
35913                        ._t(1, 0, 0, 0, _tan(ax), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
35914                        ._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
35915                    //return this._t(mCos, mSin, -mSin, mCos, 0, 0)._t(1, 0, _tan(ax), 1, 0, 0)._t(mCos, -mSin, mSin, mCos, 0, 0);
35916                }
35917
35918                function scale(sx, sy, sz) {
35919                    if (!sz && sz !== 0) {
35920                        sz = 1;
35921                    }
35922                    if (sx === 1 && sy === 1 && sz === 1) {
35923                        return this;
35924                    }
35925                    return this._t(sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0, 0, 0, 0, 1);
35926                }
35927
35928                function setTransform(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {
35929                    this.props[0] = a;
35930                    this.props[1] = b;
35931                    this.props[2] = c;
35932                    this.props[3] = d;
35933                    this.props[4] = e;
35934                    this.props[5] = f;
35935                    this.props[6] = g;
35936                    this.props[7] = h;
35937                    this.props[8] = i;
35938                    this.props[9] = j;
35939                    this.props[10] = k;
35940                    this.props[11] = l;
35941                    this.props[12] = m;
35942                    this.props[13] = n;
35943                    this.props[14] = o;
35944                    this.props[15] = p;
35945                    return this;
35946                }
35947
35948                function translate(tx, ty, tz) {
35949                    tz = tz || 0;
35950                    if (tx !== 0 || ty !== 0 || tz !== 0) {
35951                        return this._t(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, tx, ty, tz, 1);
35952                    }
35953                    return this;
35954                }
35955
35956                function transform(a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2, l2, m2, n2, o2, p2) {
35957
35958                    var _p = this.props;
35959
35960                    if (a2 === 1 && b2 === 0 && c2 === 0 && d2 === 0 && e2 === 0 && f2 === 1 && g2 === 0 && h2 === 0 && i2 === 0 && j2 === 0 && k2 === 1 && l2 === 0) {
35961                        //NOTE: commenting this condition because TurboFan deoptimizes code when present
35962                        //if(m2 !== 0 || n2 !== 0 || o2 !== 0){
35963                        _p[12] = _p[12] * a2 + _p[15] * m2;
35964                        _p[13] = _p[13] * f2 + _p[15] * n2;
35965                        _p[14] = _p[14] * k2 + _p[15] * o2;
35966                        _p[15] = _p[15] * p2;
35967                        //}
35968                        this._identityCalculated = false;
35969                        return this;
35970                    }
35971
35972                    var a1 = _p[0];
35973                    var b1 = _p[1];
35974                    var c1 = _p[2];
35975                    var d1 = _p[3];
35976                    var e1 = _p[4];
35977                    var f1 = _p[5];
35978                    var g1 = _p[6];
35979                    var h1 = _p[7];
35980                    var i1 = _p[8];
35981                    var j1 = _p[9];
35982                    var k1 = _p[10];
35983                    var l1 = _p[11];
35984                    var m1 = _p[12];
35985                    var n1 = _p[13];
35986                    var o1 = _p[14];
35987                    var p1 = _p[15];
35988
35989                    /* matrix order (canvas compatible):
35990         * ace
35991         * bdf
35992         * 001
35993         */
35994                    _p[0] = a1 * a2 + b1 * e2 + c1 * i2 + d1 * m2;
35995                    _p[1] = a1 * b2 + b1 * f2 + c1 * j2 + d1 * n2;
35996                    _p[2] = a1 * c2 + b1 * g2 + c1 * k2 + d1 * o2;
35997                    _p[3] = a1 * d2 + b1 * h2 + c1 * l2 + d1 * p2;
35998
35999                    _p[4] = e1 * a2 + f1 * e2 + g1 * i2 + h1 * m2;
36000                    _p[5] = e1 * b2 + f1 * f2 + g1 * j2 + h1 * n2;
36001                    _p[6] = e1 * c2 + f1 * g2 + g1 * k2 + h1 * o2;
36002                    _p[7] = e1 * d2 + f1 * h2 + g1 * l2 + h1 * p2;
36003
36004                    _p[8] = i1 * a2 + j1 * e2 + k1 * i2 + l1 * m2;
36005                    _p[9] = i1 * b2 + j1 * f2 + k1 * j2 + l1 * n2;
36006                    _p[10] = i1 * c2 + j1 * g2 + k1 * k2 + l1 * o2;
vendor: 7,435 bytes, lines 36007-36170
36007                    _p[11] = i1 * d2 + j1 * h2 + k1 * l2 + l1 * p2;
36008
36009                    _p[12] = m1 * a2 + n1 * e2 + o1 * i2 + p1 * m2;
36010                    _p[13] = m1 * b2 + n1 * f2 + o1 * j2 + p1 * n2;
36011                    _p[14] = m1 * c2 + n1 * g2 + o1 * k2 + p1 * o2;
36012                    _p[15] = m1 * d2 + n1 * h2 + o1 * l2 + p1 * p2;
36013
36014                    this._identityCalculated = false;
36015                    return this;
36016                }
36017
36018                function isIdentity() {
36019                    if (!this._identityCalculated) {
36020                        this._identity = !(this.props[0] !== 1 || this.props[1] !== 0 || this.props[2] !== 0 || this.props[3] !== 0 || this.props[4] !== 0 || this.props[5] !== 1 || this.props[6] !== 0 || this.props[7] !== 0 || this.props[8] !== 0 || this.props[9] !== 0 || this.props[10] !== 1 || this.props[11] !== 0 || this.props[12] !== 0 || this.props[13] !== 0 || this.props[14] !== 0 || this.props[15] !== 1);
36021                        this._identityCalculated = true;
36022                    }
36023                    return this._identity;
36024                }
36025
36026                function equals(matr) {
36027                    var i = 0;
36028                    while (i < 16) {
36029                        if (matr.props[i] !== this.props[i]) {
36030                            return false;
36031                        }
36032                        i += 1;
36033                    }
36034                    return true;
36035                }
36036
36037                function clone(matr) {
36038                    var i;
36039                    for (i = 0; i < 16; i += 1) {
36040                        matr.props[i] = this.props[i];
36041                    }
36042                }
36043
36044                function cloneFromProps(props) {
36045                    var i;
36046                    for (i = 0; i < 16; i += 1) {
36047                        this.props[i] = props[i];
36048                    }
36049                }
36050
36051                function applyToPoint(x, y, z) {
36052
36053                    return {
36054                        x: x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12],
36055                        y: x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13],
36056                        z: x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14]
36057                    };
36058                    /*return {
36059         x: x * me.a + y * me.c + me.e,
36060         y: x * me.b + y * me.d + me.f
36061         };*/
36062                }
36063
36064                function applyToX(x, y, z) {
36065                    return x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12];
36066                }
36067
36068                function applyToY(x, y, z) {
36069                    return x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13];
36070                }
36071
36072                function applyToZ(x, y, z) {
36073                    return x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14];
36074                }
36075
36076                function getInverseMatrix() {
36077                    var determinant = this.props[0] * this.props[5] - this.props[1] * this.props[4];
36078                    var a = this.props[5] / determinant;
36079                    var b = -this.props[1] / determinant;
36080                    var c = -this.props[4] / determinant;
36081                    var d = this.props[0] / determinant;
36082                    var e = (this.props[4] * this.props[13] - this.props[5] * this.props[12]) / determinant;
36083                    var f = -(this.props[0] * this.props[13] - this.props[1] * this.props[12]) / determinant;
36084                    var inverseMatrix = new Matrix();
36085                    inverseMatrix.props[0] = a;
36086                    inverseMatrix.props[1] = b;
36087                    inverseMatrix.props[4] = c;
36088                    inverseMatrix.props[5] = d;
36089                    inverseMatrix.props[12] = e;
36090                    inverseMatrix.props[13] = f;
36091                    return inverseMatrix;
36092                }
36093
36094                function inversePoint(pt) {
36095                    var inverseMatrix = this.getInverseMatrix();
36096                    return inverseMatrix.applyToPointArray(pt[0], pt[1], pt[2] || 0)
36097                }
36098
36099                function inversePoints(pts) {
36100                    var i, len = pts.length, retPts = [];
36101                    for (i = 0; i < len; i += 1) {
36102                        retPts[i] = inversePoint(pts[i]);
36103                    }
36104                    return retPts;
36105                }
36106
36107                function applyToTriplePoints(pt1, pt2, pt3) {
36108                    var arr = createTypedArray('float32', 6);
36109                    if (this.isIdentity()) {
36110                        arr[0] = pt1[0];
36111                        arr[1] = pt1[1];
36112                        arr[2] = pt2[0];
36113                        arr[3] = pt2[1];
36114                        arr[4] = pt3[0];
36115                        arr[5] = pt3[1];
36116                    } else {
36117                        var p0 = this.props[0], p1 = this.props[1], p4 = this.props[4], p5 = this.props[5],
36118                            p12 = this.props[12], p13 = this.props[13];
36119                        arr[0] = pt1[0] * p0 + pt1[1] * p4 + p12;
36120                        arr[1] = pt1[0] * p1 + pt1[1] * p5 + p13;
36121                        arr[2] = pt2[0] * p0 + pt2[1] * p4 + p12;
36122                        arr[3] = pt2[0] * p1 + pt2[1] * p5 + p13;
36123                        arr[4] = pt3[0] * p0 + pt3[1] * p4 + p12;
36124                        arr[5] = pt3[0] * p1 + pt3[1] * p5 + p13;
36125                    }
36126                    return arr;
36127                }
36128
36129                function applyToPointArray(x, y, z) {
36130                    var arr;
36131                    if (this.isIdentity()) {
36132                        arr = [x, y, z];
36133                    } else {
36134                        arr = [
36135                            x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12],
36136                            x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13],
36137                            x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14]
36138                        ];
36139                    }
36140                    return arr;
36141                }
36142
36143                function applyToPointStringified(x, y) {
36144                    if (this.isIdentity()) {
36145                        return x + ',' + y;
36146                    }
36147                    var _p = this.props;
36148                    return Math.round((x * _p[0] + y * _p[4] + _p[12]) * 100) / 100 + ',' + Math.round((x * _p[1] + y * _p[5] + _p[13]) * 100) / 100;
36149                }
36150
36151                function toCSS() {
36152                    //Doesn't make much sense to add this optimization. If it is an identity matrix, it's very likely this will get called only once since it won't be keyframed.
36153                    /*if(this.isIdentity()) {
36154            return '';
36155        }*/
36156                    var i = 0;
36157                    var props = this.props;
36158                    var cssValue = 'matrix3d(';
36159                    var v = 10000;
36160                    while (i < 16) {
36161                        cssValue += _rnd(props[i] * v) / v;
36162                        cssValue += i === 15 ? ')' : ',';
36163                        i += 1;
36164                    }
36165                    return cssValue;
36166                }
36167
36168                function roundMatrixProperty(val) {
36169                    var v = 10000;
36170                    if ((val < 0.000001 && val > 0) || (val > -0.000001 && val < 0)) {
vendor: 17,406 bytes, lines 36171-36570
36171                        return _rnd(val * v) / v;
36172                    }
36173                    return val;
36174                }
36175
36176                function to2dCSS() {
36177                    //Doesn't make much sense to add this optimization. If it is an identity matrix, it's very likely this will get called only once since it won't be keyframed.
36178                    /*if(this.isIdentity()) {
36179            return '';
36180        }*/
36181                    var props = this.props;
36182                    var _a = roundMatrixProperty(props[0]);
36183                    var _b = roundMatrixProperty(props[1]);
36184                    var _c = roundMatrixProperty(props[4]);
36185                    var _d = roundMatrixProperty(props[5]);
36186                    var _e = roundMatrixProperty(props[12]);
36187                    var _f = roundMatrixProperty(props[13]);
36188                    return "matrix(" + _a + ',' + _b + ',' + _c + ',' + _d + ',' + _e + ',' + _f + ")";
36189                }
36190
36191                return function () {
36192                    this.reset = reset;
36193                    this.rotate = rotate;
36194                    this.rotateX = rotateX;
36195                    this.rotateY = rotateY;
36196                    this.rotateZ = rotateZ;
36197                    this.skew = skew;
36198                    this.skewFromAxis = skewFromAxis;
36199                    this.shear = shear;
36200                    this.scale = scale;
36201                    this.setTransform = setTransform;
36202                    this.translate = translate;
36203                    this.transform = transform;
36204                    this.applyToPoint = applyToPoint;
36205                    this.applyToX = applyToX;
36206                    this.applyToY = applyToY;
36207                    this.applyToZ = applyToZ;
36208                    this.applyToPointArray = applyToPointArray;
36209                    this.applyToTriplePoints = applyToTriplePoints;
36210                    this.applyToPointStringified = applyToPointStringified;
36211                    this.toCSS = toCSS;
36212                    this.to2dCSS = to2dCSS;
36213                    this.clone = clone;
36214                    this.cloneFromProps = cloneFromProps;
36215                    this.equals = equals;
36216                    this.inversePoints = inversePoints;
36217                    this.inversePoint = inversePoint;
36218                    this.getInverseMatrix = getInverseMatrix;
36219                    this._t = this.transform;
36220                    this.isIdentity = isIdentity;
36221                    this._identity = true;
36222                    this._identityCalculated = false;
36223
36224                    this.props = createTypedArray('float32', 16);
36225                    this.reset();
36226                };
36227            }());
36228
36229            /*
36230 Copyright 2014 David Bau.
36231
36232 Permission is hereby granted, free of charge, to any person obtaining
36233 a copy of this software and associated documentation files (the
36234 "Software"), to deal in the Software without restriction, including
36235 without limitation the rights to use, copy, modify, merge, publish,
36236 distribute, sublicense, and/or sell copies of the Software, and to
36237 permit persons to whom the Software is furnished to do so, subject to
36238 the following conditions:
36239
36240 The above copyright notice and this permission notice shall be
36241 included in all copies or substantial portions of the Software.
36242
36243 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
36244 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
36245 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
36246 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
36247 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
36248 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
36249 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36250
36251 */
36252
36253            (function (pool, math) {
36254//
36255// The following constants are related to IEEE 754 limits.
36256//
36257                var global = this,
36258                    width = 256,        // each RC4 output is 0 <= x < 256
36259                    chunks = 6,         // at least six RC4 outputs for each double
36260                    digits = 52,        // there are 52 significant digits in a double
36261                    rngname = 'random', // rngname: name for Math.random and Math.seedrandom
36262                    startdenom = math.pow(width, chunks),
36263                    significance = math.pow(2, digits),
36264                    overflow = significance * 2,
36265                    mask = width - 1,
36266                    nodecrypto;         // node.js crypto module, initialized at the bottom.
36267
36268//
36269// seedrandom()
36270// This is the seedrandom function described above.
36271//
36272                function seedrandom(seed, options, callback) {
36273                    var key = [];
36274                    options = (options === true) ? {entropy: true} : (options || {});
36275
36276                    // Flatten the seed string or build one from local entropy if needed.
36277                    var shortseed = mixkey(flatten(
36278                        options.entropy ? [seed, tostring(pool)] :
36279                            (seed === null) ? autoseed() : seed, 3), key);
36280
36281                    // Use the seed to initialize an ARC4 generator.
36282                    var arc4 = new ARC4(key);
36283
36284                    // This function returns a random double in [0, 1) that contains
36285                    // randomness in every bit of the mantissa of the IEEE 754 value.
36286                    var prng = function () {
36287                        var n = arc4.g(chunks),             // Start with a numerator n < 2 ^ 48
36288                            d = startdenom,                 //   and denominator d = 2 ^ 48.
36289                            x = 0;                          //   and no 'extra last byte'.
36290                        while (n < significance) {          // Fill up all significant digits by
36291                            n = (n + x) * width;              //   shifting numerator and
36292                            d *= width;                       //   denominator and generating a
36293                            x = arc4.g(1);                    //   new least-significant-byte.
36294                        }
36295                        while (n >= overflow) {             // To avoid rounding up, before adding
36296                            n /= 2;                           //   last byte, shift everything
36297                            d /= 2;                           //   right using integer math until
36298                            x >>>= 1;                         //   we have exactly the desired bits.
36299                        }
36300                        return (n + x) / d;                 // Form the number within [0, 1).
36301                    };
36302
36303                    prng.int32 = function () {
36304                        return arc4.g(4) | 0;
36305                    };
36306                    prng.quick = function () {
36307                        return arc4.g(4) / 0x100000000;
36308                    };
36309                    prng.double = prng;
36310
36311                    // Mix the randomness into accumulated entropy.
36312                    mixkey(tostring(arc4.S), pool);
36313
36314                    // Calling convention: what to return as a function of prng, seed, is_math.
36315                    return (options.pass || callback ||
36316                        function (prng, seed, is_math_call, state) {
36317                            if (state) {
36318                                // Load the arc4 state from the given state if it has an S array.
36319                                if (state.S) {
36320                                    copy(state, arc4);
36321                                }
36322                                // Only provide the .state method if requested via options.state.
36323                                prng.state = function () {
36324                                    return copy(arc4, {});
36325                                };
36326                            }
36327
36328                            // If called as a method of Math (Math.seedrandom()), mutate
36329                            // Math.random because that is how seedrandom.js has worked since v1.0.
36330                            if (is_math_call) {
36331                                math[rngname] = prng;
36332                                return seed;
36333                            }
36334
36335                                // Otherwise, it is a newer calling convention, so return the
36336                            // prng directly.
36337                            else return prng;
36338                        })(
36339                        prng,
36340                        shortseed,
36341                        'global' in options ? options.global : (this == math),
36342                        options.state);
36343                }
36344
36345                math['seed' + rngname] = seedrandom;
36346
36347//
36348// ARC4
36349//
36350// An ARC4 implementation.  The constructor takes a key in the form of
36351// an array of at most (width) integers that should be 0 <= x < (width).
36352//
36353// The g(count) method returns a pseudorandom integer that concatenates
36354// the next (count) outputs from ARC4.  Its return value is a number x
36355// that is in the range 0 <= x < (width ^ count).
36356//
36357                function ARC4(key) {
36358                    var t, keylen = key.length,
36359                        me = this, i = 0, j = me.i = me.j = 0, s = me.S = [];
36360
36361                    // The empty key [] is treated as [0].
36362                    if (!keylen) {
36363                        key = [keylen++];
36364                    }
36365
36366                    // Set up S using the standard key scheduling algorithm.
36367                    while (i < width) {
36368                        s[i] = i++;
36369                    }
36370                    for (i = 0; i < width; i++) {
36371                        s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))];
36372                        s[j] = t;
36373                    }
36374
36375                    // The "g" method returns the next (count) outputs as one number.
36376                    me.g = function (count) {
36377                        // Using instance members instead of closure state nearly doubles speed.
36378                        var t, r = 0,
36379                            i = me.i, j = me.j, s = me.S;
36380                        while (count--) {
36381                            t = s[i = mask & (i + 1)];
36382                            r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))];
36383                        }
36384                        me.i = i;
36385                        me.j = j;
36386                        return r;
36387                        // For robust unpredictability, the function call below automatically
36388                        // discards an initial batch of values.  This is called RC4-drop[256].
36389                        // See http://google.com/search?q=rsa+fluhrer+response&btnI
36390                    };
36391                }
36392
36393//
36394// copy()
36395// Copies internal state of ARC4 to or from a plain object.
36396//
36397                function copy(f, t) {
36398                    t.i = f.i;
36399                    t.j = f.j;
36400                    t.S = f.S.slice();
36401                    return t;
36402                }
36403
36404//
36405// flatten()
36406// Converts an object tree to nested arrays of strings.
36407//
36408                function flatten(obj, depth) {
36409                    var result = [], typ = (typeof obj), prop;
36410                    if (depth && typ == 'object') {
36411                        for (prop in obj) {
36412                            try {
36413                                result.push(flatten(obj[prop], depth - 1));
36414                            } catch (e) {
36415                            }
36416                        }
36417                    }
36418                    return (result.length ? result : typ == 'string' ? obj : obj + '\0');
36419                }
36420
36421//
36422// mixkey()
36423// Mixes a string seed into a key that is an array of integers, and
36424// returns a shortened string seed that is equivalent to the result key.
36425//
36426                function mixkey(seed, key) {
36427                    var stringseed = seed + '', smear, j = 0;
36428                    while (j < stringseed.length) {
36429                        key[mask & j] =
36430                            mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++));
36431                    }
36432                    return tostring(key);
36433                }
36434
36435//
36436// autoseed()
36437// Returns an object for autoseeding, using window.crypto and Node crypto
36438// module if available.
36439//
36440                function autoseed() {
36441                    try {
36442                        if (nodecrypto) {
36443                            return tostring(nodecrypto.randomBytes(width));
36444                        }
36445                        var out = new Uint8Array(width);
36446                        (global.crypto || global.msCrypto).getRandomValues(out);
36447                        return tostring(out);
36448                    } catch (e) {
36449                        var browser = global.navigator,
36450                            plugins = browser && browser.plugins;
36451                        return [+new Date(), global, plugins, global.screen, tostring(pool)];
36452                    }
36453                }
36454
36455//
36456// tostring()
36457// Converts an array of charcodes to a string
36458//
36459                function tostring(a) {
36460                    return String.fromCharCode.apply(0, a);
36461                }
36462
36463//
36464// When seedrandom.js is loaded, we immediately mix a few bits
36465// from the built-in RNG into the entropy pool.  Because we do
36466// not want to interfere with deterministic PRNG state later,
36467// seedrandom will not call math.random on its own again after
36468// initialization.
36469//
36470                mixkey(math.random(), pool);
36471
36472//
36473// Nodejs and AMD support: export the implementation as a module using
36474// either convention.
36475//
36476
36477// End anonymous scope, and pass initial values.
36478            })(
36479                [],     // pool: entropy pool starts empty
36480                BMMath    // math: package containing random, pow, and seedrandom
36481            );
36482            var BezierFactory = (function () {
36483                /**
36484                 * BezierEasing - use bezier curve for transition easing function
36485                 * by Gaëtan Renaudeau 2014 - 2015 – MIT License
36486                 *
36487                 * Credits: is based on Firefox's nsSMILKeySpline.cpp
36488                 * Usage:
36489                 * var spline = BezierEasing([ 0.25, 0.1, 0.25, 1.0 ])
36490                 * spline.get(x) => returns the easing value | x must be in [0, 1] range
36491                 *
36492                 */
36493
36494                var ob = {};
36495                ob.getBezierEasing = getBezierEasing;
36496                var beziers = {};
36497
36498                function getBezierEasing(a, b, c, d, nm) {
36499                    var str = nm || ('bez_' + a + '_' + b + '_' + c + '_' + d).replace(/\./g, 'p');
36500                    if (beziers[str]) {
36501                        return beziers[str];
36502                    }
36503                    var bezEasing = new BezierEasing([a, b, c, d]);
36504                    beziers[str] = bezEasing;
36505                    return bezEasing;
36506                }
36507
36508// These values are established by empiricism with tests (tradeoff: performance VS precision)
36509                var NEWTON_ITERATIONS = 4;
36510                var NEWTON_MIN_SLOPE = 0.001;
36511                var SUBDIVISION_PRECISION = 0.0000001;
36512                var SUBDIVISION_MAX_ITERATIONS = 10;
36513
36514                var kSplineTableSize = 11;
36515                var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
36516
36517                var float32ArraySupported = typeof Float32Array === "function";
36518
36519                function A(aA1, aA2) {
36520                    return 1.0 - 3.0 * aA2 + 3.0 * aA1;
36521                }
36522
36523                function B(aA1, aA2) {
36524                    return 3.0 * aA2 - 6.0 * aA1;
36525                }
36526
36527                function C(aA1) {
36528                    return 3.0 * aA1;
36529                }
36530
36531// Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.
36532                function calcBezier(aT, aA1, aA2) {
36533                    return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT;
36534                }
36535
36536// Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2.
36537                function getSlope(aT, aA1, aA2) {
36538                    return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1);
36539                }
36540
36541                function binarySubdivide(aX, aA, aB, mX1, mX2) {
36542                    var currentX, currentT, i = 0;
36543                    do {
36544                        currentT = aA + (aB - aA) / 2.0;
36545                        currentX = calcBezier(currentT, mX1, mX2) - aX;
36546                        if (currentX > 0.0) {
36547                            aB = currentT;
36548                        } else {
36549                            aA = currentT;
36550                        }
36551                    } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);
36552                    return currentT;
36553                }
36554
36555                function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {
36556                    for (var i = 0; i < NEWTON_ITERATIONS; ++i) {
36557                        var currentSlope = getSlope(aGuessT, mX1, mX2);
36558                        if (currentSlope === 0.0) return aGuessT;
36559                        var currentX = calcBezier(aGuessT, mX1, mX2) - aX;
36560                        aGuessT -= currentX / currentSlope;
36561                    }
36562                    return aGuessT;
36563                }
36564
36565                /**
36566                 * points is an array of [ mX1, mY1, mX2, mY2 ]
36567                 */
36568                function BezierEasing(points) {
36569                    this._p = points;
36570                    this._mSampleValues = float32ArraySupported ? new Float32Array(kS
vendor: 12,796 bytes, lines 36570-36832
36570plineTableSize) : new Array(kSplineTableSize);
36571                    this._precomputed = false;
36572
36573                    this.get = this.get.bind(this);
36574                }
36575
36576                BezierEasing.prototype = {
36577
36578                    get: function (x) {
36579                        var mX1 = this._p[0],
36580                            mY1 = this._p[1],
36581                            mX2 = this._p[2],
36582                            mY2 = this._p[3];
36583                        if (!this._precomputed) this._precompute();
36584                        if (mX1 === mY1 && mX2 === mY2) return x; // linear
36585                        // Because JavaScript number are imprecise, we should guarantee the extremes are right.
36586                        if (x === 0) return 0;
36587                        if (x === 1) return 1;
36588                        return calcBezier(this._getTForX(x), mY1, mY2);
36589                    },
36590
36591                    // Private part
36592
36593                    _precompute: function () {
36594                        var mX1 = this._p[0],
36595                            mY1 = this._p[1],
36596                            mX2 = this._p[2],
36597                            mY2 = this._p[3];
36598                        this._precomputed = true;
36599                        if (mX1 !== mY1 || mX2 !== mY2)
36600                            this._calcSampleValues();
36601                    },
36602
36603                    _calcSampleValues: function () {
36604                        var mX1 = this._p[0],
36605                            mX2 = this._p[2];
36606                        for (var i = 0; i < kSplineTableSize; ++i) {
36607                            this._mSampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
36608                        }
36609                    },
36610
36611                    /**
36612                     * getTForX chose the fastest heuristic to determine the percentage value precisely from a given X projection.
36613                     */
36614                    _getTForX: function (aX) {
36615                        var mX1 = this._p[0],
36616                            mX2 = this._p[2],
36617                            mSampleValues = this._mSampleValues;
36618
36619                        var intervalStart = 0.0;
36620                        var currentSample = 1;
36621                        var lastSample = kSplineTableSize - 1;
36622
36623                        for (; currentSample !== lastSample && mSampleValues[currentSample] <= aX; ++currentSample) {
36624                            intervalStart += kSampleStepSize;
36625                        }
36626                        --currentSample;
36627
36628                        // Interpolate to provide an initial guess for t
36629                        var dist = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample + 1] - mSampleValues[currentSample]);
36630                        var guessForT = intervalStart + dist * kSampleStepSize;
36631
36632                        var initialSlope = getSlope(guessForT, mX1, mX2);
36633                        if (initialSlope >= NEWTON_MIN_SLOPE) {
36634                            return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
36635                        } else if (initialSlope === 0.0) {
36636                            return guessForT;
36637                        } else {
36638                            return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);
36639                        }
36640                    }
36641                };
36642
36643                return ob;
36644
36645            }());
36646            (function () {
36647                var lastTime = 0;
36648                var vendors = ['ms', 'moz', 'webkit', 'o'];
36649                for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
36650                    window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
36651                    window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame'];
36652                }
36653                if (!window.requestAnimationFrame)
36654                    window.requestAnimationFrame = function (callback, element) {
36655                        var currTime = new Date().getTime();
36656                        var timeToCall = Math.max(0, 16 - (currTime - lastTime));
36657                        var id = setTimeout(function () {
36658                                callback(currTime + timeToCall);
36659                            },
36660                            timeToCall);
36661                        lastTime = currTime + timeToCall;
36662                        return id;
36663                    };
36664                if (!window.cancelAnimationFrame)
36665                    window.cancelAnimationFrame = function (id) {
36666                        clearTimeout(id);
36667                    };
36668            }());
36669
36670            function extendPrototype(sources, destination) {
36671                var i, len = sources.length, sourcePrototype;
36672                for (i = 0; i < len; i += 1) {
36673                    sourcePrototype = sources[i].prototype;
36674                    for (var attr in sourcePrototype) {
36675                        if (sourcePrototype.hasOwnProperty(attr)) destination.prototype[attr] = sourcePrototype[attr];
36676                    }
36677                }
36678            }
36679
36680            function getDescriptor(object, prop) {
36681                return Object.getOwnPropertyDescriptor(object, prop);
36682            }
36683
36684            function createProxyFunction(prototype) {
36685                function ProxyFunction() {
36686                }
36687
36688                ProxyFunction.prototype = prototype;
36689                return ProxyFunction;
36690            }
36691
36692            function bezFunction() {
36693
36694                var easingFunctions = [];
36695                var math = Math;
36696
36697                function pointOnLine2D(x1, y1, x2, y2, x3, y3) {
36698                    var det1 = (x1 * y2) + (y1 * x3) + (x2 * y3) - (x3 * y2) - (y3 * x1) - (x2 * y1);
36699                    return det1 > -0.001 && det1 < 0.001;
36700                }
36701
36702                function pointOnLine3D(x1, y1, z1, x2, y2, z2, x3, y3, z3) {
36703                    if (z1 === 0 && z2 === 0 && z3 === 0) {
36704                        return pointOnLine2D(x1, y1, x2, y2, x3, y3);
36705                    }
36706                    var dist1 = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2) + Math.pow(z2 - z1, 2));
36707                    var dist2 = Math.sqrt(Math.pow(x3 - x1, 2) + Math.pow(y3 - y1, 2) + Math.pow(z3 - z1, 2));
36708                    var dist3 = Math.sqrt(Math.pow(x3 - x2, 2) + Math.pow(y3 - y2, 2) + Math.pow(z3 - z2, 2));
36709                    var diffDist;
36710                    if (dist1 > dist2) {
36711                        if (dist1 > dist3) {
36712                            diffDist = dist1 - dist2 - dist3;
36713                        } else {
36714                            diffDist = dist3 - dist2 - dist1;
36715                        }
36716                    } else if (dist3 > dist2) {
36717                        diffDist = dist3 - dist2 - dist1;
36718                    } else {
36719                        diffDist = dist2 - dist1 - dist3;
36720                    }
36721                    return diffDist > -0.0001 && diffDist < 0.0001;
36722                }
36723
36724                var getBezierLength = (function () {
36725
36726                    return function (pt1, pt2, pt3, pt4) {
36727                        var curveSegments = defaultCurveSegments;
36728                        var k;
36729                        var i, len;
36730                        var ptCoord, perc, addedLength = 0;
36731                        var ptDistance;
36732                        var point = [], lastPoint = [];
36733                        var lengthData = bezier_length_pool.newElement();
36734                        len = pt3.length;
36735                        for (k = 0; k < curveSegments; k += 1) {
36736                            perc = k / (curveSegments - 1);
36737                            ptDistance = 0;
36738                            for (i = 0; i < len; i += 1) {
36739                                ptCoord = bm_pow(1 - perc, 3) * pt1[i] + 3 * bm_pow(1 - perc, 2) * perc * pt3[i] + 3 * (1 - perc) * bm_pow(perc, 2) * pt4[i] + bm_pow(perc, 3) * pt2[i];
36740                                point[i] = ptCoord;
36741                                if (lastPoint[i] !== null) {
36742                                    ptDistance += bm_pow(point[i] - lastPoint[i], 2);
36743                                }
36744                                lastPoint[i] = point[i];
36745                            }
36746                            if (ptDistance) {
36747                                ptDistance = bm_sqrt(ptDistance);
36748                                addedLength += ptDistance;
36749                            }
36750                            lengthData.percents[k] = perc;
36751                            lengthData.lengths[k] = addedLength;
36752                        }
36753                        lengthData.addedLength = addedLength;
36754                        return lengthData;
36755                    };
36756                }());
36757
36758                function getSegmentsLength(shapeData) {
36759                    var segmentsLength = segments_length_pool.newElement();
36760                    var closed = shapeData.c;
36761                    var pathV = shapeData.v;
36762                    var pathO = shapeData.o;
36763                    var pathI = shapeData.i;
36764                    var i, len = shapeData._length;
36765                    var lengths = segmentsLength.lengths;
36766                    var totalLength = 0;
36767                    for (i = 0; i < len - 1; i += 1) {
36768                        lengths[i] = getBezierLength(pathV[i], pathV[i + 1], pathO[i], pathI[i + 1]);
36769                        totalLength += lengths[i].addedLength;
36770                    }
36771                    if (closed && len) {
36772                        lengths[i] = getBezierLength(pathV[i], pathV[0], pathO[i], pathI[0]);
36773                        totalLength += lengths[i].addedLength;
36774                    }
36775                    segmentsLength.totalLength = totalLength;
36776                    return segmentsLength;
36777                }
36778
36779                function BezierData(length) {
36780                    this.segmentLength = 0;
36781                    this.points = new Array(length);
36782                }
36783
36784                function PointData(partial, point) {
36785                    this.partialLength = partial;
36786                    this.point = point;
36787                }
36788
36789                var buildBezierData = (function () {
36790
36791                    var storedData = {};
36792
36793                    return function (pt1, pt2, pt3, pt4) {
36794                        var bezierName = (pt1[0] + '_' + pt1[1] + '_' + pt2[0] + '_' + pt2[1] + '_' + pt3[0] + '_' + pt3[1] + '_' + pt4[0] + '_' + pt4[1]).replace(/\./g, 'p');
36795                        if (!storedData[bezierName]) {
36796                            var curveSegments = defaultCurveSegments;
36797                            var k, i, len;
36798                            var ptCoord, perc, addedLength = 0;
36799                            var ptDistance;
36800                            var point, lastPoint = null;
36801                            if (pt1.length === 2 && (pt1[0] != pt2[0] || pt1[1] != pt2[1]) && pointOnLine2D(pt1[0], pt1[1], pt2[0], pt2[1], pt1[0] + pt3[0], pt1[1] + pt3[1]) && pointOnLine2D(pt1[0], pt1[1], pt2[0], pt2[1], pt2[0] + pt4[0], pt2[1] + pt4[1])) {
36802                                curveSegments = 2;
36803                            }
36804                            var bezierData = new BezierData(curveSegments);
36805                            len = pt3.length;
36806                            for (k = 0; k < curveSegments; k += 1) {
36807                                point = createSizedArray(len);
36808                                perc = k / (curveSegments - 1);
36809                                ptDistance = 0;
36810                                for (i = 0; i < len; i += 1) {
36811                                    ptCoord = bm_pow(1 - perc, 3) * pt1[i] + 3 * bm_pow(1 - perc, 2) * perc * (pt1[i] + pt3[i]) + 3 * (1 - perc) * bm_pow(perc, 2) * (pt2[i] + pt4[i]) + bm_pow(perc, 3) * pt2[i];
36812                                    point[i] = ptCoord;
36813                                    if (lastPoint !== null) {
36814                                        ptDistance += bm_pow(point[i] - lastPoint[i], 2);
36815                                    }
36816                                }
36817                                ptDistance = bm_sqrt(ptDistance);
36818                                addedLength += ptDistance;
36819                                bezierData.points[k] = new PointData(ptDistance, point);
36820                                lastPoint = point;
36821                            }
36822                            bezierData.segmentLength = addedLength;
36823                            storedData[bezierName] = bezierData;
36824                        }
36825                        return storedData[bezierName];
36826                    };
36827                }());
36828
36829                function getDistancePerc(perc, bezierData) {
36830                    var percents = bezierData.percents;
36831                    var lengths = bezierData.lengths;
36832                    var len = percents.length;
vendor: 4,697 bytes, lines 36833-36914
36833                    var initPos = bm_floor((len - 1) * perc);
36834                    var lengthPos = perc * bezierData.addedLength;
36835                    var lPerc = 0;
36836                    if (initPos === len - 1 || initPos === 0 || lengthPos === lengths[initPos]) {
36837                        return percents[initPos];
36838                    } else {
36839                        var dir = lengths[initPos] > lengthPos ? -1 : 1;
36840                        var flag = true;
36841                        while (flag) {
36842                            if (lengths[initPos] <= lengthPos && lengths[initPos + 1] > lengthPos) {
36843                                lPerc = (lengthPos - lengths[initPos]) / (lengths[initPos + 1] - lengths[initPos]);
36844                                flag = false;
36845                            } else {
36846                                initPos += dir;
36847                            }
36848                            if (initPos < 0 || initPos >= len - 1) {
36849                                //FIX for TypedArrays that don't store floating point values with enough accuracy
36850                                if (initPos === len - 1) {
36851                                    return percents[initPos];
36852                                }
36853                                flag = false;
36854                            }
36855                        }
36856                        return percents[initPos] + (percents[initPos + 1] - percents[initPos]) * lPerc;
36857                    }
36858                }
36859
36860                function getPointInSegment(pt1, pt2, pt3, pt4, percent, bezierData) {
36861                    var t1 = getDistancePerc(percent, bezierData);
36862                    var u0 = 1;
36863                    var u1 = 1 - t1;
36864                    var ptX = Math.round((u1 * u1 * u1 * pt1[0] + (t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1) * pt3[0] + (t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1) * pt4[0] + t1 * t1 * t1 * pt2[0]) * 1000) / 1000;
36865                    var ptY = Math.round((u1 * u1 * u1 * pt1[1] + (t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1) * pt3[1] + (t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1) * pt4[1] + t1 * t1 * t1 * pt2[1]) * 1000) / 1000;
36866                    return [ptX, ptY];
36867                }
36868
36869                function getSegmentArray() {
36870
36871                }
36872
36873                var bezier_segment_points = createTypedArray('float32', 8);
36874
36875                function getNewSegment(pt1, pt2, pt3, pt4, startPerc, endPerc, bezierData) {
36876
36877                    startPerc = startPerc < 0 ? 0 : startPerc > 1 ? 1 : startPerc;
36878                    var t0 = getDistancePerc(startPerc, bezierData);
36879                    endPerc = endPerc > 1 ? 1 : endPerc;
36880                    var t1 = getDistancePerc(endPerc, bezierData);
36881                    var i, len = pt1.length;
36882                    var u0 = 1 - t0;
36883                    var u1 = 1 - t1;
36884                    var u0u0u0 = u0 * u0 * u0;
36885                    var t0u0u0_3 = t0 * u0 * u0 * 3;
36886                    var t0t0u0_3 = t0 * t0 * u0 * 3;
36887                    var t0t0t0 = t0 * t0 * t0;
36888                    //
36889                    var u0u0u1 = u0 * u0 * u1;
36890                    var t0u0u1_3 = t0 * u0 * u1 + u0 * t0 * u1 + u0 * u0 * t1;
36891                    var t0t0u1_3 = t0 * t0 * u1 + u0 * t0 * t1 + t0 * u0 * t1;
36892                    var t0t0t1 = t0 * t0 * t1;
36893                    //
36894                    var u0u1u1 = u0 * u1 * u1;
36895                    var t0u1u1_3 = t0 * u1 * u1 + u0 * t1 * u1 + u0 * u1 * t1;
36896                    var t0t1u1_3 = t0 * t1 * u1 + u0 * t1 * t1 + t0 * u1 * t1;
36897                    var t0t1t1 = t0 * t1 * t1;
36898                    //
36899                    var u1u1u1 = u1 * u1 * u1;
36900                    var t1u1u1_3 = t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1;
36901                    var t1t1u1_3 = t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1;
36902                    var t1t1t1 = t1 * t1 * t1;
36903                    for (i = 0; i < len; i += 1) {
36904                        bezier_segment_points[i * 4] = Math.round((u0u0u0 * pt1[i] + t0u0u0_3 * pt3[i] + t0t0u0_3 * pt4[i] + t0t0t0 * pt2[i]) * 1000) / 1000;
36905                        bezier_segment_points[i * 4 + 1] = Math.round((u0u0u1 * pt1[i] + t0u0u1_3 * pt3[i] + t0t0u1_3 * pt4[i] + t0t0t1 * pt2[i]) * 1000) / 1000;
36906                        bezier_segment_points[i * 4 + 2] = Math.round((u0u1u1 * pt1[i] + t0u1u1_3 * pt3[i] + t0t1u1_3 * pt4[i] + t0t1t1 * pt2[i]) * 1000) / 1000;
36907                        bezier_segment_points[i * 4 + 3] = Math.round((u1u1u1 * pt1[i] + t1u1u1_3 * pt3[i] + t1t1u1_3 * pt4[i] + t1t1t1 * pt2[i]) * 1000) / 1000;
36908                    }
36909
36910                    return bezier_segment_points;
36911                }
36912
36913                return {
36914                    getSegmentsLength: getSegmentsLength,
36915                    getNewSegment: getNewSegment,
36916                    getPointInSegment: getPointInSegment,
36917                    buildBezierData: buildBezierData,
36918                    pointOnLine2D: pointOnLine2D,
36919                    pointOnLine3D: pointOnLine3D
36920                };
36921            }
36922
36923            var bez = bezFunction();
36924
36925            function dataFunctionManager() {
36926
36927                //var tCanvasHelper = createTag('canvas').getContext('2d');
36928
36929                function completeLayers(layers, comps, fontManager) {
36930                    var layerData;
36931                    var animArray, lastFrame;
36932                    var i, len = layers.length;
36933                    var j, jLen, k, kLen;
36934                    for (i = 0; i < len; i += 1) {
36935                        layerData = layers[i];
36936                        if (!('ks' in layerData) || layerData.completed) {
36937                            continue;
36938                        }
36939                        layerData.completed = true;
36940                        if (layerData.tt) {
36941                            layers[i - 1].td = layerData.tt;
36942                        }
36943                        animArray = [];
36944                        lastFrame = -1;
36945                        if (layerData.hasMask) {
36946                            var maskProps = layerData.masksProperties;
36947                            jLen = maskProps.length;
36948                            for (j = 0; j < jLen; j += 1) {
36949                                if (maskProps[j].pt.k.i) {
36950                                    convertPathsToAbsoluteValues(maskProps[j].pt.k);
36951                                } else {
36952                                    kLen = maskProps[j].pt.k.length;
36953                                    for (k = 0; k < kLen; k += 1) {
36954                                        if (maskProps[j].pt.k[k].s) {
36955                                            convertPathsToAbsoluteValues(maskProps[j].pt.k[k].s[0]);
36956                                        }
36957                                        if (maskProps[j].pt.k[k].e) {
36958                                            convertPathsToAbsoluteValues(maskProps[j].pt.k[k].e[0]);
36959                                        }
36960                                    }
36961                                }
36962                            }
36963                        }
36964                        if (layerData.ty === 0) {
36965                            layerData.layers = findCompLayers(layerData.refId, comps);
36966                            completeLayers(layerData.layers, comps, fontManager);
36967                        } else if (layerData.ty === 4) {
36968                            completeShapes(layerData.shapes);
36969                        } else if (layerData.ty == 5) {
36970                            completeText(layerData, fontManager);
36971                        }
36972                    }
36973                }
36974
36975                function findCompLayers(id, comps) {
36976                    var i = 0, len = comps.length;
36977                    while (i < len) {
36978                        if (comps[i].id === id) {
36979                            if (!comps[i].layers.__used) {
36980                                comps[i].layers.__used = true;
36981                                return comps[i].layers;
36982                            }
36983                            return JSON.parse(JSON.stringify(comps[i].layers));
36984                        }
36985                        i += 1;
36986                    }
36987                }
36988
36989                function completeShapes(arr) {
36990                    var i, len = arr.length;
36991                    var j, jLen;
36992                    var hasPaths = false;
36993                    for (i = len - 1; i >= 0; i -= 1) {
36994                        if (arr[i].ty == 'sh') {
36995                            if (arr[i].ks.k.i) {
36996                                convertPathsToAbsoluteValues(arr[i].ks.k);
36997                            } else {
36998                                jLen = arr[i].ks.k.length;
36999                                for (j = 0; j < jLen; j += 1) {
37000                                    if (arr[i].ks.k[j].s) {
37001                                        convertPathsToAbsoluteValues(arr[i].ks.k[j].s[0]);
37002                                    }
37003                                    if (arr[i].ks.k[j].e) {
37004                                        convertPathsToAbsoluteValues(arr[i].ks.k[j].e[0]);
37005                                    }
37006                                }
37007                            }
37008                            hasPaths = true;
37009                        } else if (arr[i].ty == 'gr') {
37010                            completeShapes(arr[i].it);
37011                        }
37012                    }
37013                    /*if(hasPaths){
37014            //mx: distance
37015            //ss: sensitivity
37016            //dc: decay
37017            arr.splice(arr.length-1,0,{
37018                "ty": "ms",
37019                "mx":20,
37020                "ss":10,
37021                 "dc":0.001,
37022                "maxDist":200
37023            });
37024        }*/
37025                }
37026
37027                function convertPathsToAbsoluteValues(path) {
37028                    var i, len = path.i.length;
37029                    for (i = 0; i < len; i += 1) {
37030                        path.i[i][0] += path.v[i][0];
37031                        path.i[i][1] += path.v[i][1];
37032                        path.o[i][0] += path.v[i][0];
37033                        path.o[i][1] += path.v[i][1];
37034                    }
37035                }
37036
37037                function checkVersion(minimum, animVersionString) {
37038                    var animVersion = animVersionString ? animVersionString.split('.') : [100, 100, 100];
37039                    if (minimum[0] > animVersion[0]) {
37040                        return true;
37041                    } else if (animVersion[0] > minimum[0]) {
37042                        return false;
37043                    }
37044                    if (minimum[1] > animVersion[1]) {
37045                        return true;
37046                    } else if (animVersion[1] > minimum[1]) {
37047                        return false;
37048                    }
37049                    if (minimum[2] > animVersion[2]) {
37050                        return true;
37051                    } else if (animVersion[2] > minimum[2]) {
37052                        return false;
37053                    }
37054                }
37055
37056                var checkText = (function () {
37057                    var minimumVersion = [4, 4, 14];
37058
37059                    function updateTextLayer(textLayer) {
37060                        var documentData = textLayer.t.d;
37061                        textLayer.t.d = {
37062                            k: [
37063                                {
37064                                    s: documentData,
37065                                    t: 0
37066                                }
37067                            ]
37068                        };
37069                    }
37070
37071                    function iterateLayers(layers) {
37072                        var i, len = layers.length;
37073                        for (i = 0; i < len; i += 1) {
37074                            if (layers[i].ty === 5) {
37075                                updateTextLayer(layers[i]);
37076                            }
37077                        }
37078                    }
37079
37080                    return function (animationData) {
37081                        if (checkVersion(minimumVersion, animationData.v)) {
37082                            iterateLayers(animationData.layers);
37083                            if (animationData.assets) {
37084                                var i, len = animationData.assets.length;
37085                                for (i = 0; i < len; i += 1) {
37086                                    if (animationData.assets[i].layers) {
37087                                        iterateLayers(animationData.assets[i].layers);
37088
37089                                    }
37090                                }
37091                            }
37092                        }
37093                    };
37094                }());
37095
37096                var checkChars = (function () {
37097                    var minimumVersion = [4, 7, 99];
37098                    return function (animationData) {
37099                        if (animationData.chars && !checkVersion(minimumVersion, animationData.v)) {
37100                            var i, len = animationData.chars.length, j, jLen, k, kLen;
37101                            var pathData, paths;
37102                            for (i = 0; i < len; i += 1) {
37103                                if (animationData.chars[i].data && animationData.chars[i].data.shapes) {
37104                                    paths = animationData.chars[i].data.shapes[0].it;
37105                                    jLen = paths.length;
37106
37107                                    for (j = 0; j < jLen; j += 1) {
37108                                        pathData = paths[j].ks.k;
37109                                        if (!pathData.__converted) {
37110                                            convertPathsToAbsoluteValues(paths[j].ks.k);
37111                                            pathData.__converted = true;
37112                                        }
37113                                    }
37114                                }
37115                            }
37116                        }
37117                    };
37118                }());
37119
37120                var checkColors = (function () {
37121                    var minimumVersion = [4, 1, 9];
37122
37123                    function iterateShapes(shapes) {
37124                        var i, len = shapes.length;
37125                        var j, jLen;
37126                        for (i = 0; i < len; i += 1) {
37127                            if (shapes[i].ty === 'gr') {
37128                                iterateShapes(shapes[i].it);
37129                            } else if (shapes[i].ty === 'fl' || shapes[i].ty === 'st') {
37130                                if (shapes[i].c.k && shapes[i].c.k[0].i) {
37131                                    jLen = shapes[i].c.k.length;
37132                                    for (j = 0; j < jLen; j += 1) {
37133                                        if (shapes[i].c.k[j].s) {
37134                                            shapes[i].c.k[j].s[0] /= 255;
37135                                            shapes[i].c.k[j].s[1] /= 255;
37136                                            shapes[i].c.k[j].s[2] /= 255;
37137                                            shapes[i].c.k[j].s[3] /= 255;
37138                                        }
37139                                        if (shapes[i].c.k[j].e) {
37140                                            shapes[i].c.k[j].e[0] /= 255;
37141                                            shapes[i].c.k[j].e[1] /= 255;
37142                                            shapes[i].c.k[j].e[2] /= 255;
37143                                            shapes[i].c.k[j].e[3] /= 255;
37144                                        }
37145                                    }
37146                                } else {
37147                                    shapes[i].c.k[0] /= 255;
37148                                    shapes[i].c.k[1] /= 255;
37149                                    shapes[i].c.k[2] /= 255;
37150                                    shapes[i].c.k[3] /= 255;
37151                                }
37152                            }
37153                        }
37154                    }
37155
37156                    function iterateLayers(layers) {
37157                        var i, len = layers.length;
37158                        for (i = 0; i < len; i += 1) {
37159                            if (layers[i].ty === 4) {
37160                                iterateShapes(layers[i].shapes);
37161                            }
37162                        }
37163                    }
37164
37165                    return function (animationData) {
37166                        if (checkVersion(minimumVersion, animationData.v)) {
37167                            iterateLayers(animationData.layers);
37168                            if (animationData.assets) {
37169                                var i, len = animationData.assets.length;
37170                                for (i = 0; i < len; i += 1) {
37171                                    if (animationData.assets[i].layers) {
37172                                        iterateLayers(animationData.assets[i].layers);
37173
37174                                    }
37175                                }
37176                            }
37177                        }
37178                    };
37179                }());
37180
37181                var checkShapes = (function () {
37182                    var minimumVersion = [4, 4, 18];
37183
37184
37185                    function completeShapes(arr) {
37186                        var i, len = arr.length;
37187                        var j, jLen;
37188                        var hasPaths = false;
37189                        for (i = len - 1; i >= 0; i -= 1) {
37190                            if (arr[i].ty == 'sh') {
37191                                if (arr[i].ks.k.i) {
37192                                    arr[i].ks.k.c = arr[i].closed;
37193                                } else {
37194                                    jLen = arr[i].ks.k.length;
37195                                    for (j = 0; j < jLen; j += 1) {
37196                                        if (arr[i].ks.k[j].s) {
37197                                            arr[i].ks.k[j].s[0].c = arr[i].closed;
37198                                        }
37199                                        if (arr[i].ks.k[j].e) {
37200                                            arr[i].ks.k[j].e[0].c = arr[i].closed;
37201                                        }
37202                                    }
37203                                }
37204                                hasPaths = true;
37205                            } else if (arr[i].ty == 'gr') {
37206                                completeShapes(arr[i].it);
37207                            }
37208                        }
37209                    }
37210
37211                    function iterateLayers(layers) {
37212                        var layerData;
37213                        var i, len = layers.length;
37214                        var j, jLen, k, kLen;
37215                        for (i = 0; i < len; i += 1) {
37216                            layerData = layers[i];
37217                            if (layerData.hasMask) {
37218                                var maskProps = layerData.masksProperties;
37219                                jLen = maskProps.length;
37220                                for (j = 0; j < jLen; j += 1) {
37221                                    if (maskProps[j].pt.k.i) {
37222                                        maskProps[j].pt.k.c = maskProps[j].cl;
37223                                    } else {
37224                                        kLen = maskProps[j].pt.k.length;
37225                                        for (k = 0; k < kLen; k += 1) {
37226                                            if (maskProps[j].pt.k[k].s) {
37227                                                maskProps[j].pt.k[k].s[0].c = maskProps[j].cl;
37228                                            }
37229                                            if (maskProps[j].pt.k[k].e) {
37230                                                maskProps[j].pt.k[k].e[0].c = maskProps[j].cl;
37231                                            }
37232                                        }
37233                                    }
37234                                }
37235                            }
37236                            if (layerData.ty === 4) {
37237                                completeShapes(layerData.shapes);
37238                            }
37239                        }
37240                    }
37241
37242                    return function (animationData) {
37243                        if (checkVersion(minimumVersion, animationData.v)) {
37244                            iterateLayers(animationData.layers);
37245                            if (animationData.assets) {
37246                                var i, len = animationData.assets.length;
37247                                for (i = 0; i < len; i += 1) {
37248                                    if (animationData.assets[i].layers) {
37249                                        iterateLayers(animationData.assets[i].layers);
37250
37251                                    }
37252                                }
37253                            }
37254                        }
37255                    };
37256                }());
37257
37258                function completeData(animationData, fontManager) {
37259                    if (animationData.__complete) {
37260                        return;
37261                    }
37262                    checkColors(animationData);
37263                    checkText(animationData);
37264                    checkChars(animationData);
37265                    checkShapes(animationData);
37266                    completeLayers(animationData.layers, animationData.assets, fontManager);
37267                    animationData.__complete = true;
37268                    //blitAnimation(animationData, animationData.assets, fontManager);
37269                }
37270
37271                function completeText(data, fontManager) {
37272                    if (data.t.a.length === 0 && !('m' in data.t.p)) {
37273                        data.singleShape = true;
37274                    }
37275                }
37276
37277                var moduleOb = {};
37278                moduleOb.completeData = completeData;
37279                moduleOb.checkColors = checkColors;
37280                moduleOb.checkChars = checkChars;
37281                moduleOb.checkShapes = checkShapes;
37282                moduleOb.completeLayers = completeLayers;
37283
37284                return moduleOb;
37285            }
37286
37287            var dataManager = dataFunctionManager();
37288
37289            var FontManager = (function () {
37290
37291                var maxWaitingTime = 5000;
37292                var emptyChar = {
37293                    w: 0,
37294                    size: 0,
37295                    shapes: []
37296                };
37297                var combinedCharacters = [];
37298                //Hindi characters
37299                combinedCharacters = combinedCharacters.concat([2304, 2305, 2306, 2307, 2362, 2363, 2364, 2364, 2366
37300                    , 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 2375, 2376, 2377, 2378, 2379
37301                    , 2380, 2381, 2382, 2383, 2387, 2388, 2389, 2390, 2391, 2402, 2403]);
37302
37303                function trimFontOptions(font) {
37304                    var familyArray = font.split(',');
37305                    var i, len = familyArray.length;
37306                    var enabledFamilies = [];
37307                    for (i = 0; i < len; i += 1) {
37308                        if (familyArray[i] !== 'sans-serif' && familyArray[i] !== 'monospace') {
37309                            enabledFamilies.push(familyArray[i]);
37310                        }
37311                    }
37312                    return enabledFamilies.join(',');
37313                }
37314
37315                function setUpNode(font, family) {
37316                    var parentNode = createTag('span');
37317                    parentNode.style.fontFamily = family;
37318                    var node = createTag('span');
37319                    // Characters that vary significantly among different fonts
37320                    node.innerText = 'giItT1WQy@!-/#';
37321                    // Visible - so we can measure it - but not on the screen
37322                    parentNode.style.position = 'absolute';
37323                    parentNode.style.left = '-10000px';
37324                    parentNode.style.top = '-10000px';
37325                    // Large font size makes even subtle changes obvious
37326                    parentNode.style.fontSize = '300px';
37327                    // Reset any font properties
37328                    parentNode.style.fontVariant = 'normal';
37329                    parentNode.style.fontStyle = 'normal';
37330                    parentNode.style.fontWeight = 'normal';
37331                    parentNode.style.letterSpacing = '0';
37332                    parentNode.appendChild(node);
37333                    document.body.appendChild(parentNode);
37334
vendor: 8,809 bytes, lines 37335-37505
37335                    // Remember width with no applied web font
37336                    var width = node.offsetWidth;
37337                    node.style.fontFamily = trimFontOptions(font) + ', ' + family;
37338                    return {node: node, w: width, parent: parentNode};
37339                }
37340
37341                function checkLoadedFonts() {
37342                    var i, len = this.fonts.length;
37343                    var node, w;
37344                    var loadedCount = len;
37345                    for (i = 0; i < len; i += 1) {
37346                        if (this.fonts[i].loaded) {
37347                            loadedCount -= 1;
37348                            continue;
37349                        }
37350                        if (this.fonts[i].fOrigin === 'n' || this.fonts[i].origin === 0) {
37351                            this.fonts[i].loaded = true;
37352                        } else {
37353                            node = this.fonts[i].monoCase.node;
37354                            w = this.fonts[i].monoCase.w;
37355                            if (node.offsetWidth !== w) {
37356                                loadedCount -= 1;
37357                                this.fonts[i].loaded = true;
37358                            } else {
37359                                node = this.fonts[i].sansCase.node;
37360                                w = this.fonts[i].sansCase.w;
37361                                if (node.offsetWidth !== w) {
37362                                    loadedCount -= 1;
37363                                    this.fonts[i].loaded = true;
37364                                }
37365                            }
37366                            if (this.fonts[i].loaded) {
37367                                this.fonts[i].sansCase.parent.parentNode.removeChild(this.fonts[i].sansCase.parent);
37368                                this.fonts[i].monoCase.parent.parentNode.removeChild(this.fonts[i].monoCase.parent);
37369                            }
37370                        }
37371                    }
37372
37373                    if (loadedCount !== 0 && Date.now() - this.initTime < maxWaitingTime) {
37374                        setTimeout(this.checkLoadedFontsBinded, 20);
37375                    } else {
37376                        setTimeout(this.setIsLoadedBinded, 10);
37377
37378                    }
37379                }
37380
37381                function createHelper(def, fontData) {
37382                    var tHelper = createNS('text');
37383                    tHelper.style.fontSize = '100px';
37384                    //tHelper.style.fontFamily = fontData.fFamily;
37385                    tHelper.setAttribute('font-family', fontData.fFamily);
37386                    tHelper.setAttribute('font-style', fontData.fStyle);
37387                    tHelper.setAttribute('font-weight', fontData.fWeight);
37388                    tHelper.textContent = '1';
37389                    if (fontData.fClass) {
37390                        tHelper.style.fontFamily = 'inherit';
37391                        tHelper.setAttribute('class', fontData.fClass);
37392                    } else {
37393                        tHelper.style.fontFamily = fontData.fFamily;
37394                    }
37395                    def.appendChild(tHelper);
37396                    var tCanvasHelper = createTag('canvas').getContext('2d');
37397                    tCanvasHelper.font = fontData.fWeight + ' ' + fontData.fStyle + ' 100px ' + fontData.fFamily;
37398                    //tCanvasHelper.font = ' 100px '+ fontData.fFamily;
37399                    return tHelper;
37400                }
37401
37402                function addFonts(fontData, defs) {
37403                    if (!fontData) {
37404                        this.isLoaded = true;
37405                        return;
37406                    }
37407                    if (this.chars) {
37408                        this.isLoaded = true;
37409                        this.fonts = fontData.list;
37410                        return;
37411                    }
37412
37413
37414                    var fontArr = fontData.list;
37415                    var i, len = fontArr.length;
37416                    var _pendingFonts = len;
37417                    for (i = 0; i < len; i += 1) {
37418                        var shouldLoadFont = true;
37419                        var loadedSelector;
37420                        var j;
37421                        fontArr[i].loaded = false;
37422                        fontArr[i].monoCase = setUpNode(fontArr[i].fFamily, 'monospace');
37423                        fontArr[i].sansCase = setUpNode(fontArr[i].fFamily, 'sans-serif');
37424                        if (!fontArr[i].fPath) {
37425                            fontArr[i].loaded = true;
37426                            _pendingFonts -= 1;
37427                        } else if (fontArr[i].fOrigin === 'p' || fontArr[i].origin === 3) {
37428                            loadedSelector = document.querySelectorAll('style[f-forigin="p"][f-family="' + fontArr[i].fFamily + '"], style[f-origin="3"][f-family="' + fontArr[i].fFamily + '"]');
37429
37430                            if (loadedSelector.length > 0) {
37431                                shouldLoadFont = false;
37432                            }
37433
37434                            if (shouldLoadFont) {
37435                                var s = createTag('style');
37436                                s.setAttribute('f-forigin', fontArr[i].fOrigin);
37437                                s.setAttribute('f-origin', fontArr[i].origin);
37438                                s.setAttribute('f-family', fontArr[i].fFamily);
37439                                s.type = "text/css";
37440                                s.innerText = "@font-face {" + "font-family: " + fontArr[i].fFamily + "; font-style: normal; src: url('" + fontArr[i].fPath + "');}";
37441                                defs.appendChild(s);
37442                            }
37443                        } else if (fontArr[i].fOrigin === 'g' || fontArr[i].origin === 1) {
37444                            loadedSelector = document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]');
37445
37446                            for (j = 0; j < loadedSelector.length; j++) {
37447                                if (loadedSelector[j].href.indexOf(fontArr[i].fPath) !== -1) {
37448                                    // Font is already loaded
37449                                    shouldLoadFont = false;
37450                                }
37451                            }
37452
37453                            if (shouldLoadFont) {
37454                                var l = createTag('link');
37455                                l.setAttribute('f-forigin', fontArr[i].fOrigin);
37456                                l.setAttribute('f-origin', fontArr[i].origin);
37457                                l.type = "text/css";
37458                                l.rel = "stylesheet";
37459                                l.href = fontArr[i].fPath;
37460                                document.body.appendChild(l);
37461                            }
37462                        } else if (fontArr[i].fOrigin === 't' || fontArr[i].origin === 2) {
37463                            loadedSelector = document.querySelectorAll('script[f-forigin="t"], script[f-origin="2"]');
37464
37465                            for (j = 0; j < loadedSelector.length; j++) {
37466                                if (fontArr[i].fPath === loadedSelector[j].src) {
37467                                    // Font is already loaded
37468                                    shouldLoadFont = false;
37469                                }
37470                            }
37471
37472                            if (shouldLoadFont) {
37473                                var sc = createTag('link');
37474                                sc.setAttribute('f-forigin', fontArr[i].fOrigin);
37475                                sc.setAttribute('f-origin', fontArr[i].origin);
37476                                sc.setAttribute('rel', 'stylesheet');
37477                                sc.setAttribute('href', fontArr[i].fPath);
37478                                defs.appendChild(sc);
37479                            }
37480                        }
37481                        fontArr[i].helper = createHelper(defs, fontArr[i]);
37482                        fontArr[i].cache = {};
37483                        this.fonts.push(fontArr[i]);
37484                    }
37485                    if (_pendingFonts === 0) {
37486                        this.isLoaded = true;
37487                    } else {
37488                        //On some cases even if the font is loaded, it won't load correctly when measuring text on canvas.
37489                        //Adding this timeout seems to fix it
37490                        setTimeout(this.checkLoadedFonts.bind(this), 100);
37491                    }
37492                }
37493
37494                function addChars(chars) {
37495                    if (!chars) {
37496                        return;
37497                    }
37498                    if (!this.chars) {
37499                        this.chars = [];
37500                    }
37501                    var i, len = chars.length;
37502                    var j, jLen = this.chars.length, found;
37503                    for (i = 0; i < len; i += 1) {
37504                        j = 0;
37505                        found = false;
37506                        while (j < jLen) {
37507                            if (this.chars[j].style === chars[i].style && this.chars[j].fFamily === chars[i].fFamily && this.chars[j].ch === chars[i].ch) {
37508                                found = true;
37509                            }
37510                            j += 1;
37511                        }
37512                        if (!found) {
37513                            this.chars.push(chars[i]);
37514                            jLen += 1;
37515                        }
37516                    }
37517                }
37518
37519                function getCharData(char, style, font) {
37520                    var i = 0, len = this.chars.length;
37521                    while (i < len) {
37522                        if (this.chars[i].ch === char && this.chars[i].style === style && this.chars[i].fFamily === font) {
37523
37524                            return this.chars[i];
37525                        }
37526                        i += 1;
37527                    }
37528                    if ((typeof char === 'string' && char.charCodeAt(0) !== 13 || !char) && console && console.warn) {
37529                        console.warn('Missing character from exported characters list: ', char, style, font);
37530                    }
37531                    return emptyChar;
37532                }
37533
37534                function measureText(char, fontName, size) {
37535                    var fontData = this.getFontByName(fontName);
37536                    var index = char.charCodeAt(0);
37537                    if (!fontData.cache[index + 1]) {
37538                        var tHelper = fontData.helper;
37539                        //Canvas version
37540                        //fontData.cache[index] = tHelper.measureText(char).width / 100;
37541                        //SVG version
37542                        //console.log(tHelper.getBBox().width)
37543                        if (char === ' ') {
37544                            tHelper.textContent = '|' + char + '|';
37545                            var doubleSize = tHelper.getComputedTextLength();
37546                            tHelper.textContent = '||';
37547                            var singleSize = tHelper.getComputedTextLength();
37548                            fontData.cache[index + 1] = (doubleSize - singleSize) / 100;
37549                        } else {
37550                            tHelper.textContent = char;
37551                            fontData.cache[index + 1] = (tHelper.getComputedTextLength()) / 100;
37552                        }
37553                    }
37554                    return fontData.cache[index + 1] * size;
37555                }
37556
37557                function getFontByName(name) {
37558                    var i = 0, len = this.fonts.length;
37559                    while (i < len) {
37560                        if (this.fonts[i].fName === name) {
37561                            return this.fonts[i];
37562                        }
37563                        i += 1;
37564                    }
37565                    return this.fonts[0];
37566                }
37567
37568                function getCombinedCharacterCodes() {
37569                    return combinedCharacters;
37570                }
37571
37572                function setIsLoaded() {
37573                    this.isLoaded = true
37574                }
37575
37576                var Font = function () {
37577                    this.fonts = [];
37578                    this.chars = null;
37579                    this.typekitLoaded = 0;
37580                    this.isLoaded = false;
37581                    this.initTime = Date.now();
37582                    this.setIsLoadedBinded = this.setIsLoaded.bind(this)
37583                    this.checkLoadedFontsBinded = this.checkLoadedFonts.bind(this)
37584                };
37585                //TODO: for now I'm adding these methods to the Class and not the prototype. Think of a better way to implement it.
37586                Font.getCombinedCharacterCodes = getCombinedCharacterCodes;
37587
37588                var fontPrototype = {
37589                    addChars: addChars,
37590                    addFonts: addFonts,
37591                    getCharData: getCharData,
37592                    getFontByName: getFontByName,
37593                    measureText: measureText,
37594                    checkLoadedFonts: checkLoadedFonts,
37595                    setIsLoaded: setIsLoaded,
37596                }
37597
37598                Font.prototype = fontPrototype;
37599
37600                return Font;
37601
37602            }());
37603
37604            var PropertyFactory = (function () {
37605
37606                var initFrame = initialDefaultFrame;
37607                var math_abs = Math.abs;
37608
37609                function interpolateValue(frameNum, caching) {
37610                    var offsetTime = this.offsetTime;
37611                    var newValue;
37612                    if (this.propType === 'multidimensional') {
37613                        newValue = createTypedArray('float32', this.pv.length);
37614                    }
vendor: 15,681 bytes, lines 37615-37911
37615                    var iterationIndex = caching.lastIndex;
37616                    var i = iterationIndex;
37617                    var len = this.keyframes.length - 1, flag = true;
37618                    var keyData, nextKeyData;
37619
37620                    while (flag) {
37621                        keyData = this.keyframes[i];
37622                        nextKeyData = this.keyframes[i + 1];
37623                        if (i === len - 1 && frameNum >= nextKeyData.t - offsetTime) {
37624                            if (keyData.h) {
37625                                keyData = nextKeyData;
37626                            }
37627                            iterationIndex = 0;
37628                            break;
37629                        }
37630                        if ((nextKeyData.t - offsetTime) > frameNum) {
37631                            iterationIndex = i;
37632                            break;
37633                        }
37634                        if (i < len - 1) {
37635                            i += 1;
37636                        } else {
37637                            iterationIndex = 0;
37638                            flag = false;
37639                        }
37640                    }
37641
37642                    var k, kLen, perc, jLen, j, fnc;
37643                    var nextKeyTime = nextKeyData.t - offsetTime;
37644                    var keyTime = keyData.t - offsetTime;
37645                    var endValue;
37646                    if (keyData.to) {
37647                        if (!keyData.bezierData) {
37648                            keyData.bezierData = bez.buildBezierData(keyData.s, nextKeyData.s || keyData.e, keyData.to, keyData.ti);
37649                        }
37650                        var bezierData = keyData.bezierData;
37651                        if (frameNum >= nextKeyTime || frameNum < keyTime) {
37652                            var ind = frameNum >= nextKeyTime ? bezierData.points.length - 1 : 0;
37653                            kLen = bezierData.points[ind].point.length;
37654                            for (k = 0; k < kLen; k += 1) {
37655                                newValue[k] = bezierData.points[ind].point[k];
37656                            }
37657                            // caching._lastKeyframeIndex = -1;
37658                        } else {
37659                            if (keyData.__fnct) {
37660                                fnc = keyData.__fnct;
37661                            } else {
37662                                fnc = BezierFactory.getBezierEasing(keyData.o.x, keyData.o.y, keyData.i.x, keyData.i.y, keyData.n).get;
37663                                keyData.__fnct = fnc;
37664                            }
37665                            perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime));
37666                            var distanceInLine = bezierData.segmentLength * perc;
37667
37668                            var segmentPerc;
37669                            var addedLength = (caching.lastFrame < frameNum && caching._lastKeyframeIndex === i) ? caching._lastAddedLength : 0;
37670                            j = (caching.lastFrame < frameNum && caching._lastKeyframeIndex === i) ? caching._lastPoint : 0;
37671                            flag = true;
37672                            jLen = bezierData.points.length;
37673                            while (flag) {
37674                                addedLength += bezierData.points[j].partialLength;
37675                                if (distanceInLine === 0 || perc === 0 || j === bezierData.points.length - 1) {
37676                                    kLen = bezierData.points[j].point.length;
37677                                    for (k = 0; k < kLen; k += 1) {
37678                                        newValue[k] = bezierData.points[j].point[k];
37679                                    }
37680                                    break;
37681                                } else if (distanceInLine >= addedLength && distanceInLine < addedLength + bezierData.points[j + 1].partialLength) {
37682                                    segmentPerc = (distanceInLine - addedLength) / bezierData.points[j + 1].partialLength;
37683                                    kLen = bezierData.points[j].point.length;
37684                                    for (k = 0; k < kLen; k += 1) {
37685                                        newValue[k] = bezierData.points[j].point[k] + (bezierData.points[j + 1].point[k] - bezierData.points[j].point[k]) * segmentPerc;
37686                                    }
37687                                    break;
37688                                }
37689                                if (j < jLen - 1) {
37690                                    j += 1;
37691                                } else {
37692                                    flag = false;
37693                                }
37694                            }
37695                            caching._lastPoint = j;
37696                            caching._lastAddedLength = addedLength - bezierData.points[j].partialLength;
37697                            caching._lastKeyframeIndex = i;
37698                        }
37699                    } else {
37700                        var outX, outY, inX, inY, keyValue;
37701                        len = keyData.s.length;
37702                        endValue = nextKeyData.s || keyData.e;
37703                        if (this.sh && keyData.h !== 1) {
37704                            if (frameNum >= nextKeyTime) {
37705                                newValue[0] = endValue[0];
37706                                newValue[1] = endValue[1];
37707                                newValue[2] = endValue[2];
37708                            } else if (frameNum <= keyTime) {
37709                                newValue[0] = keyData.s[0];
37710                                newValue[1] = keyData.s[1];
37711                                newValue[2] = keyData.s[2];
37712                            } else {
37713                                var quatStart = createQuaternion(keyData.s);
37714                                var quatEnd = createQuaternion(endValue);
37715                                var time = (frameNum - keyTime) / (nextKeyTime - keyTime);
37716                                quaternionToEuler(newValue, slerp(quatStart, quatEnd, time));
37717                            }
37718
37719                        } else {
37720                            for (i = 0; i < len; i += 1) {
37721                                if (keyData.h !== 1) {
37722                                    if (frameNum >= nextKeyTime) {
37723                                        perc = 1;
37724                                    } else if (frameNum < keyTime) {
37725                                        perc = 0;
37726                                    } else {
37727                                        if (keyData.o.x.constructor === Array) {
37728                                            if (!keyData.__fnct) {
37729                                                keyData.__fnct = [];
37730                                            }
37731                                            if (!keyData.__fnct[i]) {
37732                                                outX = (typeof keyData.o.x[i] === 'undefined') ? keyData.o.x[0] : keyData.o.x[i];
37733                                                outY = (typeof keyData.o.y[i] === 'undefined') ? keyData.o.y[0] : keyData.o.y[i];
37734                                                inX = (typeof keyData.i.x[i] === 'undefined') ? keyData.i.x[0] : keyData.i.x[i];
37735                                                inY = (typeof keyData.i.y[i] === 'undefined') ? keyData.i.y[0] : keyData.i.y[i];
37736                                                fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get;
37737                                                keyData.__fnct[i] = fnc;
37738                                            } else {
37739                                                fnc = keyData.__fnct[i];
37740                                            }
37741                                        } else {
37742                                            if (!keyData.__fnct) {
37743                                                outX = keyData.o.x;
37744                                                outY = keyData.o.y;
37745                                                inX = keyData.i.x;
37746                                                inY = keyData.i.y;
37747                                                fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get;
37748                                                keyData.__fnct = fnc;
37749                                            } else {
37750                                                fnc = keyData.__fnct;
37751                                            }
37752                                        }
37753                                        perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime));
37754                                    }
37755                                }
37756
37757                                endValue = nextKeyData.s || keyData.e;
37758                                keyValue = keyData.h === 1 ? keyData.s[i] : keyData.s[i] + (endValue[i] - keyData.s[i]) * perc;
37759
37760                                if (this.propType === 'multidimensional') {
37761                                    newValue[i] = keyValue;
37762                                } else {
37763                                    newValue = keyValue;
37764                                }
37765                            }
37766                        }
37767                    }
37768                    caching.lastIndex = iterationIndex;
37769                    return newValue;
37770                }
37771
37772                //based on @Toji's https://github.com/toji/gl-matrix/
37773                function slerp(a, b, t) {
37774                    var out = [];
37775                    var ax = a[0], ay = a[1], az = a[2], aw = a[3],
37776                        bx = b[0], by = b[1], bz = b[2], bw = b[3]
37777
37778                    var omega, cosom, sinom, scale0, scale1;
37779
37780                    cosom = ax * bx + ay * by + az * bz + aw * bw;
37781                    if (cosom < 0.0) {
37782                        cosom = -cosom;
37783                        bx = -bx;
37784                        by = -by;
37785                        bz = -bz;
37786                        bw = -bw;
37787                    }
37788                    if ((1.0 - cosom) > 0.000001) {
37789                        omega = Math.acos(cosom);
37790                        sinom = Math.sin(omega);
37791                        scale0 = Math.sin((1.0 - t) * omega) / sinom;
37792                        scale1 = Math.sin(t * omega) / sinom;
37793                    } else {
37794                        scale0 = 1.0 - t;
37795                        scale1 = t;
37796                    }
37797                    out[0] = scale0 * ax + scale1 * bx;
37798                    out[1] = scale0 * ay + scale1 * by;
37799                    out[2] = scale0 * az + scale1 * bz;
37800                    out[3] = scale0 * aw + scale1 * bw;
37801
37802                    return out;
37803                }
37804
37805                function quaternionToEuler(out, quat) {
37806                    var qx = quat[0];
37807                    var qy = quat[1];
37808                    var qz = quat[2];
37809                    var qw = quat[3];
37810                    var heading = Math.atan2(2 * qy * qw - 2 * qx * qz, 1 - 2 * qy * qy - 2 * qz * qz)
37811                    var attitude = Math.asin(2 * qx * qy + 2 * qz * qw)
37812                    var bank = Math.atan2(2 * qx * qw - 2 * qy * qz, 1 - 2 * qx * qx - 2 * qz * qz);
37813                    out[0] = heading / degToRads;
37814                    out[1] = attitude / degToRads;
37815                    out[2] = bank / degToRads;
37816                }
37817
37818                function createQuaternion(values) {
37819                    var heading = values[0] * degToRads;
37820                    var attitude = values[1] * degToRads;
37821                    var bank = values[2] * degToRads;
37822                    var c1 = Math.cos(heading / 2);
37823                    var c2 = Math.cos(attitude / 2);
37824                    var c3 = Math.cos(bank / 2);
37825                    var s1 = Math.sin(heading / 2);
37826                    var s2 = Math.sin(attitude / 2);
37827                    var s3 = Math.sin(bank / 2);
37828                    var w = c1 * c2 * c3 - s1 * s2 * s3;
37829                    var x = s1 * s2 * c3 + c1 * c2 * s3;
37830                    var y = s1 * c2 * c3 + c1 * s2 * s3;
37831                    var z = c1 * s2 * c3 - s1 * c2 * s3;
37832
37833                    return [x, y, z, w];
37834                }
37835
37836                function getValueAtCurrentTime() {
37837                    var frameNum = this.comp.renderedFrame - this.offsetTime;
37838                    var initTime = this.keyframes[0].t - this.offsetTime;
37839                    var endTime = this.keyframes[this.keyframes.length - 1].t - this.offsetTime;
37840                    if (!(frameNum === this._caching.lastFrame || (this._caching.lastFrame !== initFrame && ((this._caching.lastFrame >= endTime && frameNum >= endTime) || (this._caching.lastFrame < initTime && frameNum < initTime))))) {
37841                        if (this._caching.lastFrame >= frameNum) {
37842                            this._caching._lastKeyframeIndex = -1;
37843                            this._caching.lastIndex = 0;
37844                        }
37845
37846                        var renderResult = this.interpolateValue(frameNum, this._caching);
37847                        this.pv = renderResult;
37848                    }
37849                    this._caching.lastFrame = frameNum;
37850                    return this.pv;
37851                }
37852
37853                function setVValue(val) {
37854                    var multipliedValue;
37855                    if (this.propType === 'unidimensional') {
37856                        multipliedValue = val * this.mult;
37857                        if (math_abs(this.v - multipliedValue) > 0.00001) {
37858                            this.v = multipliedValue;
37859                            this._mdf = true;
37860                        }
37861                    } else {
37862                        var i = 0, len = this.v.length;
37863                        while (i < len) {
37864                            multipliedValue = val[i] * this.mult;
37865                            if (math_abs(this.v[i] - multipliedValue) > 0.00001) {
37866                                this.v[i] = multipliedValue;
37867                                this._mdf = true;
37868                            }
37869                            i += 1;
37870                        }
37871                    }
37872                }
37873
37874                function processEffectsSequence() {
37875                    if (this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) {
37876                        return;
37877                    }
37878                    if (this.lock) {
37879                        this.setVValue(this.pv);
37880                        return;
37881                    }
37882                    this.lock = true;
37883                    this._mdf = this._isFirstFrame;
37884                    var multipliedValue;
37885                    var i, len = this.effectsSequence.length;
37886                    var finalValue = this.kf ? this.pv : this.data.k;
37887                    for (i = 0; i < len; i += 1) {
37888                        finalValue = this.effectsSequence[i](finalValue);
37889                    }
37890                    this.setVValue(finalValue);
37891                    this._isFirstFrame = false;
37892                    this.lock = false;
37893                    this.frameId = this.elem.globalData.frameId;
37894                }
37895
37896                function addEffect(effectFunction) {
37897                    this.effectsSequence.push(effectFunction);
37898                    this.container.addDynamicProperty(this);
37899                }
37900
37901                function ValueProperty(elem, data, mult, container) {
37902                    this.propType = 'unidimensional';
37903                    this.mult = mult || 1;
37904                    this.data = data;
37905                    this.v = mult ? data.k * mult : data.k;
37906                    this.pv = data.k;
37907                    this._mdf = false;
37908                    this.elem = elem;
37909                    this.container = container;
37910                    this.comp = elem.comp;
37911                    this.k = false;
vendor: 19,491 bytes, lines 37912-38275
37912                    this.kf = false;
37913                    this.vel = 0;
37914                    this.effectsSequence = [];
37915                    this._isFirstFrame = true;
37916                    this.getValue = processEffectsSequence;
37917                    this.setVValue = setVValue;
37918                    this.addEffect = addEffect;
37919                }
37920
37921                function MultiDimensionalProperty(elem, data, mult, container) {
37922                    this.propType = 'multidimensional';
37923                    this.mult = mult || 1;
37924                    this.data = data;
37925                    this._mdf = false;
37926                    this.elem = elem;
37927                    this.container = container;
37928                    this.comp = elem.comp;
37929                    this.k = false;
37930                    this.kf = false;
37931                    this.frameId = -1;
37932                    var i, len = data.k.length;
37933                    this.v = createTypedArray('float32', len);
37934                    this.pv = createTypedArray('float32', len);
37935                    var arr = createTypedArray('float32', len);
37936                    this.vel = createTypedArray('float32', len);
37937                    for (i = 0; i < len; i += 1) {
37938                        this.v[i] = data.k[i] * this.mult;
37939                        this.pv[i] = data.k[i];
37940                    }
37941                    this._isFirstFrame = true;
37942                    this.effectsSequence = [];
37943                    this.getValue = processEffectsSequence;
37944                    this.setVValue = setVValue;
37945                    this.addEffect = addEffect;
37946                }
37947
37948                function KeyframedValueProperty(elem, data, mult, container) {
37949                    this.propType = 'unidimensional';
37950                    this.keyframes = data.k;
37951                    this.offsetTime = elem.data.st;
37952                    this.frameId = -1;
37953                    this._caching = {lastFrame: initFrame, lastIndex: 0, value: 0, _lastKeyframeIndex: -1};
37954                    this.k = true;
37955                    this.kf = true;
37956                    this.data = data;
37957                    this.mult = mult || 1;
37958                    this.elem = elem;
37959                    this.container = container;
37960                    this.comp = elem.comp;
37961                    this.v = initFrame;
37962                    this.pv = initFrame;
37963                    this._isFirstFrame = true;
37964                    this.getValue = processEffectsSequence;
37965                    this.setVValue = setVValue;
37966                    this.interpolateValue = interpolateValue;
37967                    this.effectsSequence = [getValueAtCurrentTime.bind(this)];
37968                    this.addEffect = addEffect;
37969                }
37970
37971                function KeyframedMultidimensionalProperty(elem, data, mult, container) {
37972                    this.propType = 'multidimensional';
37973                    var i, len = data.k.length;
37974                    var s, e, to, ti;
37975                    for (i = 0; i < len - 1; i += 1) {
37976                        if (data.k[i].to && data.k[i].s && data.k[i + 1] && data.k[i + 1].s) {
37977                            s = data.k[i].s;
37978                            e = data.k[i + 1].s;
37979                            to = data.k[i].to;
37980                            ti = data.k[i].ti;
37981                            if ((s.length === 2 && !(s[0] === e[0] && s[1] === e[1]) && bez.pointOnLine2D(s[0], s[1], e[0], e[1], s[0] + to[0], s[1] + to[1]) && bez.pointOnLine2D(s[0], s[1], e[0], e[1], e[0] + ti[0], e[1] + ti[1])) || (s.length === 3 && !(s[0] === e[0] && s[1] === e[1] && s[2] === e[2]) && bez.pointOnLine3D(s[0], s[1], s[2], e[0], e[1], e[2], s[0] + to[0], s[1] + to[1], s[2] + to[2]) && bez.pointOnLine3D(s[0], s[1], s[2], e[0], e[1], e[2], e[0] + ti[0], e[1] + ti[1], e[2] + ti[2]))) {
37982                                data.k[i].to = null;
37983                                data.k[i].ti = null;
37984                            }
37985                            if (s[0] === e[0] && s[1] === e[1] && to[0] === 0 && to[1] === 0 && ti[0] === 0 && ti[1] === 0) {
37986                                if (s.length === 2 || (s[2] === e[2] && to[2] === 0 && ti[2] === 0)) {
37987                                    data.k[i].to = null;
37988                                    data.k[i].ti = null;
37989                                }
37990                            }
37991                        }
37992                    }
37993                    this.effectsSequence = [getValueAtCurrentTime.bind(this)];
37994                    this.keyframes = data.k;
37995                    this.offsetTime = elem.data.st;
37996                    this.k = true;
37997                    this.kf = true;
37998                    this._isFirstFrame = true;
37999                    this.mult = mult || 1;
38000                    this.elem = elem;
38001                    this.container = container;
38002                    this.comp = elem.comp;
38003                    this.getValue = processEffectsSequence;
38004                    this.setVValue = setVValue;
38005                    this.interpolateValue = interpolateValue;
38006                    this.frameId = -1;
38007                    var arrLen = data.k[0].s.length;
38008                    this.v = createTypedArray('float32', arrLen);
38009                    this.pv = createTypedArray('float32', arrLen);
38010                    for (i = 0; i < arrLen; i += 1) {
38011                        this.v[i] = initFrame;
38012                        this.pv[i] = initFrame;
38013                    }
38014                    this._caching = {lastFrame: initFrame, lastIndex: 0, value: createTypedArray('float32', arrLen)};
38015                    this.addEffect = addEffect;
38016                }
38017
38018                function getProp(elem, data, type, mult, container) {
38019                    var p;
38020                    if (!data.k.length) {
38021                        p = new ValueProperty(elem, data, mult, container);
38022                    } else if (typeof (data.k[0]) === 'number') {
38023                        p = new MultiDimensionalProperty(elem, data, mult, container);
38024                    } else {
38025                        switch (type) {
38026                            case 0:
38027                                p = new KeyframedValueProperty(elem, data, mult, container);
38028                                break;
38029                            case 1:
38030                                p = new KeyframedMultidimensionalProperty(elem, data, mult, container);
38031                                break;
38032                        }
38033                    }
38034                    if (p.effectsSequence.length) {
38035                        container.addDynamicProperty(p);
38036                    }
38037                    return p;
38038                }
38039
38040                var ob = {
38041                    getProp: getProp
38042                };
38043                return ob;
38044            }());
38045            var TransformPropertyFactory = (function () {
38046
38047                var defaultVector = [0, 0]
38048
38049                function applyToMatrix(mat) {
38050                    var _mdf = this._mdf;
38051                    this.iterateDynamicProperties();
38052                    this._mdf = this._mdf || _mdf;
38053                    if (this.a) {
38054                        mat.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);
38055                    }
38056                    if (this.s) {
38057                        mat.scale(this.s.v[0], this.s.v[1], this.s.v[2]);
38058                    }
38059                    if (this.sk) {
38060                        mat.skewFromAxis(-this.sk.v, this.sa.v);
38061                    }
38062                    if (this.r) {
38063                        mat.rotate(-this.r.v);
38064                    } else {
38065                        mat.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]);
38066                    }
38067                    if (this.data.p.s) {
38068                        if (this.data.p.z) {
38069                            mat.translate(this.px.v, this.py.v, -this.pz.v);
38070                        } else {
38071                            mat.translate(this.px.v, this.py.v, 0);
38072                        }
38073                    } else {
38074                        mat.translate(this.p.v[0], this.p.v[1], -this.p.v[2]);
38075                    }
38076                }
38077
38078                function processKeys(forceRender) {
38079                    if (this.elem.globalData.frameId === this.frameId) {
38080                        return;
38081                    }
38082                    if (this._isDirty) {
38083                        this.precalculateMatrix();
38084                        this._isDirty = false;
38085                    }
38086
38087                    this.iterateDynamicProperties();
38088
38089                    if (this._mdf || forceRender) {
38090                        this.v.cloneFromProps(this.pre.props);
38091                        if (this.appliedTransformations < 1) {
38092                            this.v.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);
38093                        }
38094                        if (this.appliedTransformations < 2) {
38095                            this.v.scale(this.s.v[0], this.s.v[1], this.s.v[2]);
38096                        }
38097                        if (this.sk && this.appliedTransformations < 3) {
38098                            this.v.skewFromAxis(-this.sk.v, this.sa.v);
38099                        }
38100                        if (this.r && this.appliedTransformations < 4) {
38101                            this.v.rotate(-this.r.v);
38102                        } else if (!this.r && this.appliedTransformations < 4) {
38103                            this.v.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]);
38104                        }
38105                        if (this.autoOriented) {
38106                            var v1, v2, frameRate = this.elem.globalData.frameRate;
38107                            if (this.p && this.p.keyframes && this.p.getValueAtTime) {
38108                                if (this.p._caching.lastFrame + this.p.offsetTime <= this.p.keyframes[0].t) {
38109                                    v1 = this.p.getValueAtTime((this.p.keyframes[0].t + 0.01) / frameRate, 0);
38110                                    v2 = this.p.getValueAtTime(this.p.keyframes[0].t / frameRate, 0);
38111                                } else if (this.p._caching.lastFrame + this.p.offsetTime >= this.p.keyframes[this.p.keyframes.length - 1].t) {
38112                                    v1 = this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length - 1].t / frameRate), 0);
38113                                    v2 = this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length - 1].t - 0.05) / frameRate, 0);
38114                                } else {
38115                                    v1 = this.p.pv;
38116                                    v2 = this.p.getValueAtTime((this.p._caching.lastFrame + this.p.offsetTime - 0.01) / frameRate, this.p.offsetTime);
38117                                }
38118                            } else if (this.px && this.px.keyframes && this.py.keyframes && this.px.getValueAtTime && this.py.getValueAtTime) {
38119                                v1 = [];
38120                                v2 = [];
38121                                var px = this.px, py = this.py, frameRate;
38122                                if (px._caching.lastFrame + px.offsetTime <= px.keyframes[0].t) {
38123                                    v1[0] = px.getValueAtTime((px.keyframes[0].t + 0.01) / frameRate, 0);
38124                                    v1[1] = py.getValueAtTime((py.keyframes[0].t + 0.01) / frameRate, 0);
38125                                    v2[0] = px.getValueAtTime((px.keyframes[0].t) / frameRate, 0);
38126                                    v2[1] = py.getValueAtTime((py.keyframes[0].t) / frameRate, 0);
38127                                } else if (px._caching.lastFrame + px.offsetTime >= px.keyframes[px.keyframes.length - 1].t) {
38128                                    v1[0] = px.getValueAtTime((px.keyframes[px.keyframes.length - 1].t / frameRate), 0);
38129                                    v1[1] = py.getValueAtTime((py.keyframes[py.keyframes.length - 1].t / frameRate), 0);
38130                                    v2[0] = px.getValueAtTime((px.keyframes[px.keyframes.length - 1].t - 0.01) / frameRate, 0);
38131                                    v2[1] = py.getValueAtTime((py.keyframes[py.keyframes.length - 1].t - 0.01) / frameRate, 0);
38132                                } else {
38133                                    v1 = [px.pv, py.pv];
38134                                    v2[0] = px.getValueAtTime((px._caching.lastFrame + px.offsetTime - 0.01) / frameRate, px.offsetTime);
38135                                    v2[1] = py.getValueAtTime((py._caching.lastFrame + py.offsetTime - 0.01) / frameRate, py.offsetTime);
38136                                }
38137                            } else {
38138                                v1 = v2 = defaultVector
38139                            }
38140                            this.v.rotate(-Math.atan2(v1[1] - v2[1], v1[0] - v2[0]));
38141                        }
38142                        if (this.data.p && this.data.p.s) {
38143                            if (this.data.p.z) {
38144                                this.v.translate(this.px.v, this.py.v, -this.pz.v);
38145                            } else {
38146                                this.v.translate(this.px.v, this.py.v, 0);
38147                            }
38148                        } else {
38149                            this.v.translate(this.p.v[0], this.p.v[1], -this.p.v[2]);
38150                        }
38151                    }
38152                    this.frameId = this.elem.globalData.frameId;
38153                }
38154
38155                function precalculateMatrix() {
38156                    if (!this.a.k) {
38157                        this.pre.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);
38158                        this.appliedTransformations = 1;
38159                    } else {
38160                        return;
38161                    }
38162                    if (!this.s.effectsSequence.length) {
38163                        this.pre.scale(this.s.v[0], this.s.v[1], this.s.v[2]);
38164                        this.appliedTransformations = 2;
38165                    } else {
38166                        return;
38167                    }
38168                    if (this.sk) {
38169                        if (!this.sk.effectsSequence.length && !this.sa.effectsSequence.length) {
38170                            this.pre.skewFromAxis(-this.sk.v, this.sa.v);
38171                            this.appliedTransformations = 3;
38172                        } else {
38173                            return;
38174                        }
38175                    }
38176                    if (this.r) {
38177                        if (!this.r.effectsSequence.length) {
38178                            this.pre.rotate(-this.r.v);
38179                            this.appliedTransformations = 4;
38180                        } else {
38181                            return;
38182                        }
38183                    } else if (!this.rz.effectsSequence.length && !this.ry.effectsSequence.length && !this.rx.effectsSequence.length && !this.or.effectsSequence.length) {
38184                        this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]);
38185                        this.appliedTransformations = 4;
38186                    }
38187                }
38188
38189                function autoOrient() {
38190                    //
38191                    //var prevP = this.getValueAtTime();
38192                }
38193
38194                function addDynamicProperty(prop) {
38195                    this._addDynamicProperty(prop);
38196                    this.elem.addDynamicProperty(prop);
38197                    this._isDirty = true;
38198                }
38199
38200                function TransformProperty(elem, data, container) {
38201                    this.elem = elem;
38202                    this.frameId = -1;
38203                    this.propType = 'transform';
38204                    this.data = data;
38205                    this.v = new Matrix();
38206                    //Precalculated matrix with non animated properties
38207                    this.pre = new Matrix();
38208                    this.appliedTransformations = 0;
38209                    this.initDynamicPropertyContainer(container || elem);
38210                    if (data.p && data.p.s) {
38211                        this.px = PropertyFactory.getProp(elem, data.p.x, 0, 0, this);
38212                        this.py = PropertyFactory.getProp(elem, data.p.y, 0, 0, this);
38213                        if (data.p.z) {
38214                            this.pz = PropertyFactory.getProp(elem, data.p.z, 0, 0, this);
38215                        }
38216                    } else {
38217                        this.p = PropertyFactory.getProp(elem, data.p || {k: [0, 0, 0]}, 1, 0, this);
38218                    }
38219                    if (data.rx) {
38220                        this.rx = PropertyFactory.getProp(elem, data.rx, 0, degToRads, this);
38221                        this.ry = PropertyFactory.getProp(elem, data.ry, 0, degToRads, this);
38222                        this.rz = PropertyFactory.getProp(elem, data.rz, 0, degToRads, this);
38223                        if (data.or.k[0].ti) {
38224                            var i, len = data.or.k.length;
38225                            for (i = 0; i < len; i += 1) {
38226                                data.or.k[i].to = data.or.k[i].ti = null;
38227                            }
38228                        }
38229                        this.or = PropertyFactory.getProp(elem, data.or, 1, degToRads, this);
38230                        //sh Indicates it needs to be capped between -180 and 180
38231                        this.or.sh = true;
38232                    } else {
38233                        this.r = PropertyFactory.getProp(elem, data.r || {k: 0}, 0, degToRads, this);
38234                    }
38235                    if (data.sk) {
38236                        this.sk = PropertyFactory.getProp(elem, data.sk, 0, degToRads, this);
38237                        this.sa = PropertyFactory.getProp(elem, data.sa, 0, degToRads, this);
38238                    }
38239                    this.a = PropertyFactory.getProp(elem, data.a || {k: [0, 0, 0]}, 1, 0, this);
38240                    this.s = PropertyFactory.getProp(elem, data.s || {k: [100, 100, 100]}, 1, 0.01, this);
38241                    // Opacity is not part of the transform properties, that's why it won't use this.dynamicProperties. That way transforms won't get updated if opacity changes.
38242                    if (data.o) {
38243                        this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, elem);
38244                    } else {
38245                        this.o = {_mdf: false, v: 1};
38246                    }
38247                    this._isDirty = true;
38248                    if (!this.dynamicProperties.length) {
38249                        this.getValue(true);
38250                    }
38251                }
38252
38253                TransformProperty.prototype = {
38254                    applyToMatrix: applyToMatrix,
38255                    getValue: processKeys,
38256                    precalculateMatrix: precalculateMatrix,
38257                    autoOrient: autoOrient
38258                }
38259
38260                extendPrototype([DynamicPropertyContainer], TransformProperty);
38261                TransformProperty.prototype.addDynamicProperty = addDynamicProperty;
38262                TransformProperty.prototype._addDynamicProperty = DynamicPropertyContainer.prototype.addDynamicProperty;
38263
38264                function getTransformProperty(elem, data, container) {
38265                    return new TransformProperty(elem, data, container);
38266                }
38267
38268                return {
38269                    getTransformProperty: getTransformProperty
38270                };
38271
38272            }());
38273
38274            function ShapePath() {
38275                this.c = false;
vendor: 1,495 bytes, lines 38276-38312
38276                this._length = 0;
38277                this._maxLength = 8;
38278                this.v = createSizedArray(this._maxLength);
38279                this.o = createSizedArray(this._maxLength);
38280                this.i = createSizedArray(this._maxLength);
38281            }
38282
38283            ShapePath.prototype.setPathData = function (closed, len) {
38284                this.c = closed;
38285                this.setLength(len);
38286                var i = 0;
38287                while (i < len) {
38288                    this.v[i] = point_pool.newElement();
38289                    this.o[i] = point_pool.newElement();
38290                    this.i[i] = point_pool.newElement();
38291                    i += 1;
38292                }
38293            };
38294
38295            ShapePath.prototype.setLength = function (len) {
38296                while (this._maxLength < len) {
38297                    this.doubleArrayLength();
38298                }
38299                this._length = len;
38300            };
38301
38302            ShapePath.prototype.doubleArrayLength = function () {
38303                this.v = this.v.concat(createSizedArray(this._maxLength));
38304                this.i = this.i.concat(createSizedArray(this._maxLength));
38305                this.o = this.o.concat(createSizedArray(this._maxLength));
38306                this._maxLength *= 2;
38307            };
38308
38309            ShapePath.prototype.setXYAt = function (x, y, type, pos, replace) {
38310                var arr;
38311                this._length = Math.max(this._length, pos + 1);
38312                if (this._length >= this._maxLength) {
vendor: 4,157 bytes, lines 38313-38405
38313                    this.doubleArrayLength();
38314                }
38315                switch (type) {
38316                    case 'v':
38317                        arr = this.v;
38318                        break;
38319                    case 'i':
38320                        arr = this.i;
38321                        break;
38322                    case 'o':
38323                        arr = this.o;
38324                        break;
38325                }
38326                if (!arr[pos] || (arr[pos] && !replace)) {
38327                    arr[pos] = point_pool.newElement();
38328                }
38329                arr[pos][0] = x;
38330                arr[pos][1] = y;
38331            };
38332
38333            ShapePath.prototype.setTripleAt = function (vX, vY, oX, oY, iX, iY, pos, replace) {
38334                this.setXYAt(vX, vY, 'v', pos, replace);
38335                this.setXYAt(oX, oY, 'o', pos, replace);
38336                this.setXYAt(iX, iY, 'i', pos, replace);
38337            };
38338
38339            ShapePath.prototype.reverse = function () {
38340                var newPath = new ShapePath();
38341                newPath.setPathData(this.c, this._length);
38342                var vertices = this.v, outPoints = this.o, inPoints = this.i;
38343                var init = 0;
38344                if (this.c) {
38345                    newPath.setTripleAt(vertices[0][0], vertices[0][1], inPoints[0][0], inPoints[0][1], outPoints[0][0], outPoints[0][1], 0, false);
38346                    init = 1;
38347                }
38348                var cnt = this._length - 1;
38349                var len = this._length;
38350
38351                var i;
38352                for (i = init; i < len; i += 1) {
38353                    newPath.setTripleAt(vertices[cnt][0], vertices[cnt][1], inPoints[cnt][0], inPoints[cnt][1], outPoints[cnt][0], outPoints[cnt][1], i, false);
38354                    cnt -= 1;
38355                }
38356                return newPath;
38357            };
38358            var ShapePropertyFactory = (function () {
38359
38360                var initFrame = -999999;
38361
38362                function interpolateShape(frameNum, previousValue, caching) {
38363                    var iterationIndex = caching.lastIndex;
38364                    var keyPropS, keyPropE, isHold, j, k, jLen, kLen, perc, vertexValue;
38365                    var kf = this.keyframes;
38366                    if (frameNum < kf[0].t - this.offsetTime) {
38367                        keyPropS = kf[0].s[0];
38368                        isHold = true;
38369                        iterationIndex = 0;
38370                    } else if (frameNum >= kf[kf.length - 1].t - this.offsetTime) {
38371                        keyPropS = kf[kf.length - 1].s ? kf[kf.length - 1].s[0] : kf[kf.length - 2].e[0];
38372                        /*if(kf[kf.length - 1].s){
38373                keyPropS = kf[kf.length - 1].s[0];
38374            }else{
38375                keyPropS = kf[kf.length - 2].e[0];
38376            }*/
38377                        isHold = true;
38378                    } else {
38379                        var i = iterationIndex;
38380                        var len = kf.length - 1, flag = true, keyData, nextKeyData;
38381                        while (flag) {
38382                            keyData = kf[i];
38383                            nextKeyData = kf[i + 1];
38384                            if ((nextKeyData.t - this.offsetTime) > frameNum) {
38385                                break;
38386                            }
38387                            if (i < len - 1) {
38388                                i += 1;
38389                            } else {
38390                                flag = false;
38391                            }
38392                        }
38393                        isHold = keyData.h === 1;
38394                        iterationIndex = i;
38395                        if (!isHold) {
38396                            if (frameNum >= nextKeyData.t - this.offsetTime) {
38397                                perc = 1;
38398                            } else if (frameNum < keyData.t - this.offsetTime) {
38399                                perc = 0;
38400                            } else {
38401                                var fnc;
38402                                if (keyData.__fnct) {
38403                                    fnc = keyData.__fnct;
38404                                } else {
38405                                    fnc = BezierFactory.getBezierEasing(keyD
vendor: 4,273 bytes, lines 38405-38489
38405ata.o.x, keyData.o.y, keyData.i.x, keyData.i.y).get;
38406                                    keyData.__fnct = fnc;
38407                                }
38408                                perc = fnc((frameNum - (keyData.t - this.offsetTime)) / ((nextKeyData.t - this.offsetTime) - (keyData.t - this.offsetTime)));
38409                            }
38410                            keyPropE = nextKeyData.s ? nextKeyData.s[0] : keyData.e[0];
38411                        }
38412                        keyPropS = keyData.s[0];
38413                    }
38414                    jLen = previousValue._length;
38415                    kLen = keyPropS.i[0].length;
38416                    caching.lastIndex = iterationIndex;
38417
38418                    for (j = 0; j < jLen; j += 1) {
38419                        for (k = 0; k < kLen; k += 1) {
38420                            vertexValue = isHold ? keyPropS.i[j][k] : keyPropS.i[j][k] + (keyPropE.i[j][k] - keyPropS.i[j][k]) * perc;
38421                            previousValue.i[j][k] = vertexValue;
38422                            vertexValue = isHold ? keyPropS.o[j][k] : keyPropS.o[j][k] + (keyPropE.o[j][k] - keyPropS.o[j][k]) * perc;
38423                            previousValue.o[j][k] = vertexValue;
38424                            vertexValue = isHold ? keyPropS.v[j][k] : keyPropS.v[j][k] + (keyPropE.v[j][k] - keyPropS.v[j][k]) * perc;
38425                            previousValue.v[j][k] = vertexValue;
38426                        }
38427                    }
38428                }
38429
38430                function interpolateShapeCurrentTime() {
38431                    var frameNum = this.comp.renderedFrame - this.offsetTime;
38432                    var initTime = this.keyframes[0].t - this.offsetTime;
38433                    var endTime = this.keyframes[this.keyframes.length - 1].t - this.offsetTime;
38434                    var lastFrame = this._caching.lastFrame;
38435                    if (!(lastFrame !== initFrame && ((lastFrame < initTime && frameNum < initTime) || (lastFrame > endTime && frameNum > endTime)))) {
38436                        ////
38437                        this._caching.lastIndex = lastFrame < frameNum ? this._caching.lastIndex : 0;
38438                        this.interpolateShape(frameNum, this.pv, this._caching);
38439                        ////
38440                    }
38441                    this._caching.lastFrame = frameNum;
38442                    return this.pv;
38443                }
38444
38445                function resetShape() {
38446                    this.paths = this.localShapeCollection;
38447                }
38448
38449                function shapesEqual(shape1, shape2) {
38450                    if (shape1._length !== shape2._length || shape1.c !== shape2.c) {
38451                        return false;
38452                    }
38453                    var i, len = shape1._length;
38454                    for (i = 0; i < len; i += 1) {
38455                        if (shape1.v[i][0] !== shape2.v[i][0]
38456                            || shape1.v[i][1] !== shape2.v[i][1]
38457                            || shape1.o[i][0] !== shape2.o[i][0]
38458                            || shape1.o[i][1] !== shape2.o[i][1]
38459                            || shape1.i[i][0] !== shape2.i[i][0]
38460                            || shape1.i[i][1] !== shape2.i[i][1]) {
38461                            return false;
38462                        }
38463                    }
38464                    return true;
38465                }
38466
38467                function setVValue(newPath) {
38468                    if (!shapesEqual(this.v, newPath)) {
38469                        this.v = shape_pool.clone(newPath);
38470                        this.localShapeCollection.releaseShapes();
38471                        this.localShapeCollection.addShape(this.v);
38472                        this._mdf = true;
38473                        this.paths = this.localShapeCollection;
38474                    }
38475                }
38476
38477                function processEffectsSequence() {
38478                    if (this.elem.globalData.frameId === this.frameId) {
38479                        return;
38480                    } else if (!this.effectsSequence.length) {
38481                        this._mdf = false;
38482                        return;
38483                    }
38484                    if (this.lock) {
38485                        this.setVValue(this.pv);
38486                        return;
38487                    }
38488                    this.lock = true;
38489                    this._mdf = false;
38490                    var finalValue = this.kf ? this.pv : this.data.ks ? this.data.ks.k : this.data.pt.k;
38491                    var i, len = this.effectsSequence.length;
38492                    for (i = 0; i < len; i += 1) {
38493                        finalValue = this.effectsSequence[i](finalValue);
38494                    }
38495                    this.setVValue(finalValue);
38496                    this.lock = false;
38497                    this.frameId = this.elem.globalData.frameId;
38498                };
38499
38500                function ShapeProperty(elem, data, type) {
38501                    this.propType = 'shape';
38502                    this.comp = elem.comp;
38503                    this.container = elem;
38504                    this.elem = elem;
38505                    this.data = data;
38506                    this.k = false;
38507                    this.kf = false;
38508                    this._mdf = false;
38509                    var pathData = type === 3 ? data.pt.k : data.ks.k;
38510                    this.v = shape_pool.clone(pathData);
38511                    this.pv = shape_pool.clone(this.v);
38512                    this.localShapeCollection = shapeCollection_pool.newShapeCollection();
38513                    this.paths = this.localShapeCollection;
38514                    this.paths.addShape(this.v);
38515                    this.reset = resetShape;
38516                    this.effectsSequence = [];
38517                }
38518
38519                function addEffect(effectFunction) {
38520                    this.effectsSequence.push(effectFunction);
38521                    this.container.addDynamicProperty(this);
38522                }
38523
38524                ShapeProperty.prototype.interpolateShape = interpolateShape;
38525                ShapeProperty.prototype.getValue = processEffectsSequence;
38526                ShapeProperty.prototype.setVValue = setVValue;
38527                ShapeProperty.prototype.addEffect = addEffect;
38528
38529                function KeyframedShapeProperty(elem, data, type) {
38530                    this.propType = 'shape';
38531                    this.comp = elem.comp;
38532                    this.elem = elem;
38533                    this.container = elem;
38534                    this.offsetTime = elem.data.st;
38535                    this.keyframes = type === 3 ? data.pt.k : data.ks.k;
38536                    this.k = true;
38537                    this.kf = true;
38538                    var i, len = this.keyframes[0].s[0].i.length;
38539                    var jLen = this.keyframes[0].s[0].i[0].length;
38540                    this.v = shape_pool.newElement();
38541                    this.v.setPathData(this.keyframes[0].s[0].c, len);
38542                    this.pv = shape_pool.clone(this.v);
38543                    this.localShapeCollection = shapeCollection_pool.newShapeCollection();
38544                    this.paths = this.localShapeCollection;
38545                    this.paths.addShape(this.v);
38546                    this.lastFrame = initFrame;
38547                    this.reset = resetShape;
38548                    this._caching = {lastFrame: initFrame, lastIndex: 0};
38549                    this.effectsSequence = [interpolateShapeCurrentTime.bind(this)];
38550                }
38551
38552                KeyframedShapeProperty.prototype.getValue = processEffectsSequence;
38553                KeyframedShapeProperty.prototype.interpolateShape = interpolateShape;
38554                KeyframedShapeProperty.prototype.setVValue = setVValue;
38555                KeyframedShapeProperty.prototype.addEffect = addEffect;
38556
38557                var EllShapeProperty = (function () {
38558
38559                    var cPoint = roundCorner;
38560
38561                    function EllShapeProperty(elem, data) {
38562                        /*this.v = {
38563                v: createSizedArray(4),
38564                i: createSizedArray(4),
38565                o: createSizedArray(4),
38566                c: true
38567            };*/
38568                        this.v = shape_pool.newElement();
38569                        this.v.setPathData(true, 4);
38570                        this.localShapeCollection = shapeCollection_pool.newShapeCollection();
38571                        this.paths = this.localShapeCollection;
38572                        this.localShapeCollection.addShape(this.v);
38573                        this.d = data.d;
38574                        this.elem = elem;
38575                        this.comp = elem.comp;
38576                        this.frameId = -1;
38577                        this.initDynamicPropertyContainer(elem);
38578                        this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this);
38579                        this.s = PropertyFactory.getProp(elem, data.s, 1, 0, this);
38580                        if (this.dynamicProperties.length) {
38581                            this.k = true;
38582                        } else {
38583                            this.k = false;
vendor: 4,393 bytes, lines 38584-38666
38584                            this.convertEllToPath();
38585                        }
38586                    };
38587
38588                    EllShapeProperty.prototype = {
38589                        reset: resetShape,
38590                        getValue: function () {
38591                            if (this.elem.globalData.frameId === this.frameId) {
38592                                return;
38593                            }
38594                            this.frameId = this.elem.globalData.frameId;
38595                            this.iterateDynamicProperties();
38596
38597                            if (this._mdf) {
38598                                this.convertEllToPath();
38599                            }
38600                        },
38601                        convertEllToPath: function () {
38602                            var p0 = this.p.v[0], p1 = this.p.v[1], s0 = this.s.v[0] / 2, s1 = this.s.v[1] / 2;
38603                            var _cw = this.d !== 3;
38604                            var _v = this.v;
38605                            _v.v[0][0] = p0;
38606                            _v.v[0][1] = p1 - s1;
38607                            _v.v[1][0] = _cw ? p0 + s0 : p0 - s0;
38608                            _v.v[1][1] = p1;
38609                            _v.v[2][0] = p0;
38610                            _v.v[2][1] = p1 + s1;
38611                            _v.v[3][0] = _cw ? p0 - s0 : p0 + s0;
38612                            _v.v[3][1] = p1;
38613                            _v.i[0][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint;
38614                            _v.i[0][1] = p1 - s1;
38615                            _v.i[1][0] = _cw ? p0 + s0 : p0 - s0;
38616                            _v.i[1][1] = p1 - s1 * cPoint;
38617                            _v.i[2][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint;
38618                            _v.i[2][1] = p1 + s1;
38619                            _v.i[3][0] = _cw ? p0 - s0 : p0 + s0;
38620                            _v.i[3][1] = p1 + s1 * cPoint;
38621                            _v.o[0][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint;
38622                            _v.o[0][1] = p1 - s1;
38623                            _v.o[1][0] = _cw ? p0 + s0 : p0 - s0;
38624                            _v.o[1][1] = p1 + s1 * cPoint;
38625                            _v.o[2][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint;
38626                            _v.o[2][1] = p1 + s1;
38627                            _v.o[3][0] = _cw ? p0 - s0 : p0 + s0;
38628                            _v.o[3][1] = p1 - s1 * cPoint;
38629                        }
38630                    }
38631
38632                    extendPrototype([DynamicPropertyContainer], EllShapeProperty);
38633
38634                    return EllShapeProperty;
38635                }());
38636
38637                var StarShapeProperty = (function () {
38638
38639                    function StarShapeProperty(elem, data) {
38640                        this.v = shape_pool.newElement();
38641                        this.v.setPathData(true, 0);
38642                        this.elem = elem;
38643                        this.comp = elem.comp;
38644                        this.data = data;
38645                        this.frameId = -1;
38646                        this.d = data.d;
38647                        this.initDynamicPropertyContainer(elem);
38648                        if (data.sy === 1) {
38649                            this.ir = PropertyFactory.getProp(elem, data.ir, 0, 0, this);
38650                            this.is = PropertyFactory.getProp(elem, data.is, 0, 0.01, this);
38651                            this.convertToPath = this.convertStarToPath;
38652                        } else {
38653                            this.convertToPath = this.convertPolygonToPath;
38654                        }
38655                        this.pt = PropertyFactory.getProp(elem, data.pt, 0, 0, this);
38656                        this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this);
38657                        this.r = PropertyFactory.getProp(elem, data.r, 0, degToRads, this);
38658                        this.or = PropertyFactory.getProp(elem, data.or, 0, 0, this);
38659                        this.os = PropertyFactory.getProp(elem, data.os, 0, 0.01, this);
38660                        this.localShapeCollection = shapeCollection_pool.newShapeCollection();
38661                        this.localShapeCollection.addShape(this.v);
38662                        this.paths = this.localShapeCollection;
38663                        if (this.dynamicProperties.length) {
38664                            this.k = true;
38665                        } else {
38666                            this.k = false;
vendor: 5,993 bytes, lines 38667-38769
38667                            this.convertToPath();
38668                        }
38669                    };
38670
38671                    StarShapeProperty.prototype = {
38672                        reset: resetShape,
38673                        getValue: function () {
38674                            if (this.elem.globalData.frameId === this.frameId) {
38675                                return;
38676                            }
38677                            this.frameId = this.elem.globalData.frameId;
38678                            this.iterateDynamicProperties();
38679                            if (this._mdf) {
38680                                this.convertToPath();
38681                            }
38682                        },
38683                        convertStarToPath: function () {
38684                            var numPts = Math.floor(this.pt.v) * 2;
38685                            var angle = Math.PI * 2 / numPts;
38686                            /*this.v.v.length = numPts;
38687                this.v.i.length = numPts;
38688                this.v.o.length = numPts;*/
38689                            var longFlag = true;
38690                            var longRad = this.or.v;
38691                            var shortRad = this.ir.v;
38692                            var longRound = this.os.v;
38693                            var shortRound = this.is.v;
38694                            var longPerimSegment = 2 * Math.PI * longRad / (numPts * 2);
38695                            var shortPerimSegment = 2 * Math.PI * shortRad / (numPts * 2);
38696                            var i, rad, roundness, perimSegment, currentAng = -Math.PI / 2;
38697                            currentAng += this.r.v;
38698                            var dir = this.data.d === 3 ? -1 : 1;
38699                            this.v._length = 0;
38700                            for (i = 0; i < numPts; i += 1) {
38701                                rad = longFlag ? longRad : shortRad;
38702                                roundness = longFlag ? longRound : shortRound;
38703                                perimSegment = longFlag ? longPerimSegment : shortPerimSegment;
38704                                var x = rad * Math.cos(currentAng);
38705                                var y = rad * Math.sin(currentAng);
38706                                var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);
38707                                var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);
38708                                x += +this.p.v[0];
38709                                y += +this.p.v[1];
38710                                this.v.setTripleAt(x, y, x - ox * perimSegment * roundness * dir, y - oy * perimSegment * roundness * dir, x + ox * perimSegment * roundness * dir, y + oy * perimSegment * roundness * dir, i, true);
38711
38712                                /*this.v.v[i] = [x,y];
38713                    this.v.i[i] = [x+ox*perimSegment*roundness*dir,y+oy*perimSegment*roundness*dir];
38714                    this.v.o[i] = [x-ox*perimSegment*roundness*dir,y-oy*perimSegment*roundness*dir];
38715                    this.v._length = numPts;*/
38716                                longFlag = !longFlag;
38717                                currentAng += angle * dir;
38718                            }
38719                        },
38720                        convertPolygonToPath: function () {
38721                            var numPts = Math.floor(this.pt.v);
38722                            var angle = Math.PI * 2 / numPts;
38723                            var rad = this.or.v;
38724                            var roundness = this.os.v;
38725                            var perimSegment = 2 * Math.PI * rad / (numPts * 4);
38726                            var i, currentAng = -Math.PI / 2;
38727                            var dir = this.data.d === 3 ? -1 : 1;
38728                            currentAng += this.r.v;
38729                            this.v._length = 0;
38730                            for (i = 0; i < numPts; i += 1) {
38731                                var x = rad * Math.cos(currentAng);
38732                                var y = rad * Math.sin(currentAng);
38733                                var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);
38734                                var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);
38735                                x += +this.p.v[0];
38736                                y += +this.p.v[1];
38737                                this.v.setTripleAt(x, y, x - ox * perimSegment * roundness * dir, y - oy * perimSegment * roundness * dir, x + ox * perimSegment * roundness * dir, y + oy * perimSegment * roundness * dir, i, true);
38738                                currentAng += angle * dir;
38739                            }
38740                            this.paths.length = 0;
38741                            this.paths[0] = this.v;
38742                        }
38743
38744                    }
38745                    extendPrototype([DynamicPropertyContainer], StarShapeProperty);
38746
38747                    return StarShapeProperty;
38748                }());
38749
38750                var RectShapeProperty = (function () {
38751
38752                    function RectShapeProperty(elem, data) {
38753                        this.v = shape_pool.newElement();
38754                        this.v.c = true;
38755                        this.localShapeCollection = shapeCollection_pool.newShapeCollection();
38756                        this.localShapeCollection.addShape(this.v);
38757                        this.paths = this.localShapeCollection;
38758                        this.elem = elem;
38759                        this.comp = elem.comp;
38760                        this.frameId = -1;
38761                        this.d = data.d;
38762                        this.initDynamicPropertyContainer(elem);
38763                        this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this);
38764                        this.s = PropertyFactory.getProp(elem, data.s, 1, 0, this);
38765                        this.r = PropertyFactory.getProp(elem, data.r, 0, 0, this);
38766                        if (this.dynamicProperties.length) {
38767                            this.k = true;
38768                        } else {
38769                            this.k = false;
vendor: 5,426 bytes, lines 38770-38847
38770                            this.convertRectToPath();
38771                        }
38772                    };
38773
38774                    RectShapeProperty.prototype = {
38775                        convertRectToPath: function () {
38776                            var p0 = this.p.v[0], p1 = this.p.v[1], v0 = this.s.v[0] / 2, v1 = this.s.v[1] / 2;
38777                            var round = bm_min(v0, v1, this.r.v);
38778                            var cPoint = round * (1 - roundCorner);
38779                            this.v._length = 0;
38780
38781                            if (this.d === 2 || this.d === 1) {
38782                                this.v.setTripleAt(p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + cPoint, 0, true);
38783                                this.v.setTripleAt(p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - cPoint, p0 + v0, p1 + v1 - round, 1, true);
38784                                if (round !== 0) {
38785                                    this.v.setTripleAt(p0 + v0 - round, p1 + v1, p0 + v0 - round, p1 + v1, p0 + v0 - cPoint, p1 + v1, 2, true);
38786                                    this.v.setTripleAt(p0 - v0 + round, p1 + v1, p0 - v0 + cPoint, p1 + v1, p0 - v0 + round, p1 + v1, 3, true);
38787                                    this.v.setTripleAt(p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - cPoint, 4, true);
38788                                    this.v.setTripleAt(p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + cPoint, p0 - v0, p1 - v1 + round, 5, true);
38789                                    this.v.setTripleAt(p0 - v0 + round, p1 - v1, p0 - v0 + round, p1 - v1, p0 - v0 + cPoint, p1 - v1, 6, true);
38790                                    this.v.setTripleAt(p0 + v0 - round, p1 - v1, p0 + v0 - cPoint, p1 - v1, p0 + v0 - round, p1 - v1, 7, true);
38791                                } else {
38792                                    this.v.setTripleAt(p0 - v0, p1 + v1, p0 - v0 + cPoint, p1 + v1, p0 - v0, p1 + v1, 2);
38793                                    this.v.setTripleAt(p0 - v0, p1 - v1, p0 - v0, p1 - v1 + cPoint, p0 - v0, p1 - v1, 3);
38794                                }
38795                            } else {
38796                                this.v.setTripleAt(p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + cPoint, p0 + v0, p1 - v1 + round, 0, true);
38797                                if (round !== 0) {
38798                                    this.v.setTripleAt(p0 + v0 - round, p1 - v1, p0 + v0 - round, p1 - v1, p0 + v0 - cPoint, p1 - v1, 1, true);
38799                                    this.v.setTripleAt(p0 - v0 + round, p1 - v1, p0 - v0 + cPoint, p1 - v1, p0 - v0 + round, p1 - v1, 2, true);
38800                                    this.v.setTripleAt(p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + cPoint, 3, true);
38801                                    this.v.setTripleAt(p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - cPoint, p0 - v0, p1 + v1 - round, 4, true);
38802                                    this.v.setTripleAt(p0 - v0 + round, p1 + v1, p0 - v0 + round, p1 + v1, p0 - v0 + cPoint, p1 + v1, 5, true);
38803                                    this.v.setTripleAt(p0 + v0 - round, p1 + v1, p0 + v0 - cPoint, p1 + v1, p0 + v0 - round, p1 + v1, 6, true);
38804                                    this.v.setTripleAt(p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - cPoint, 7, true);
38805                                } else {
38806                                    this.v.setTripleAt(p0 - v0, p1 - v1, p0 - v0 + cPoint, p1 - v1, p0 - v0, p1 - v1, 1, true);
38807                                    this.v.setTripleAt(p0 - v0, p1 + v1, p0 - v0, p1 + v1 - cPoint, p0 - v0, p1 + v1, 2, true);
38808                                    this.v.setTripleAt(p0 + v0, p1 + v1, p0 + v0 - cPoint, p1 + v1, p0 + v0, p1 + v1, 3, true);
38809
38810                                }
38811                            }
38812                        },
38813                        getValue: function (frameNum) {
38814                            if (this.elem.globalData.frameId === this.frameId) {
38815                                return;
38816                            }
38817                            this.frameId = this.elem.globalData.frameId;
38818                            this.iterateDynamicProperties();
38819                            if (this._mdf) {
38820                                this.convertRectToPath();
38821                            }
38822
38823                        },
38824                        reset: resetShape
38825                    }
38826                    extendPrototype([DynamicPropertyContainer], RectShapeProperty);
38827
38828                    return RectShapeProperty;
38829                }());
38830
38831                function getShapeProp(elem, data, type) {
38832                    var prop;
38833                    if (type === 3 || type === 4) {
38834                        var dataProp = type === 3 ? data.pt : data.ks;
38835                        var keys = dataProp.k;
38836                        if (keys.length) {
38837                            prop = new KeyframedShapeProperty(elem, data, type);
38838                        } else {
38839                            prop = new ShapeProperty(elem, data, type);
38840                        }
38841                    } else if (type === 5) {
38842                        prop = new RectShapeProperty(elem, data);
38843                    } else if (type === 6) {
38844                        prop = new EllShapeProperty(elem, data);
38845                    } else if (type === 7) {
38846                        prop = new StarShapeProperty(elem, data);
38847                    }
vendor: 15,731 bytes, lines 38848-39183
38848                    if (prop.k) {
38849                        elem.addDynamicProperty(prop);
38850                    }
38851                    return prop;
38852                }
38853
38854                function getConstructorFunction() {
38855                    return ShapeProperty;
38856                }
38857
38858                function getKeyframedConstructorFunction() {
38859                    return KeyframedShapeProperty;
38860                }
38861
38862                var ob = {};
38863                ob.getShapeProp = getShapeProp;
38864                ob.getConstructorFunction = getConstructorFunction;
38865                ob.getKeyframedConstructorFunction = getKeyframedConstructorFunction;
38866                return ob;
38867            }());
38868            var ShapeModifiers = (function () {
38869                var ob = {};
38870                var modifiers = {};
38871                ob.registerModifier = registerModifier;
38872                ob.getModifier = getModifier;
38873
38874                function registerModifier(nm, factory) {
38875                    if (!modifiers[nm]) {
38876                        modifiers[nm] = factory;
38877                    }
38878                }
38879
38880                function getModifier(nm, elem, data) {
38881                    return new modifiers[nm](elem, data);
38882                }
38883
38884                return ob;
38885            }());
38886
38887            function ShapeModifier() {
38888            }
38889
38890            ShapeModifier.prototype.initModifierProperties = function () {
38891            };
38892            ShapeModifier.prototype.addShapeToModifier = function () {
38893            };
38894            ShapeModifier.prototype.addShape = function (data) {
38895                if (!this.closed) {
38896                    // Adding shape to dynamic properties. It covers the case where a shape has no effects applied, to reset it's _mdf state on every tick.
38897                    data.sh.container.addDynamicProperty(data.sh);
38898                    var shapeData = {
38899                        shape: data.sh,
38900                        data: data,
38901                        localShapeCollection: shapeCollection_pool.newShapeCollection()
38902                    };
38903                    this.shapes.push(shapeData);
38904                    this.addShapeToModifier(shapeData);
38905                    if (this._isAnimated) {
38906                        data.setAsAnimated();
38907                    }
38908                }
38909            };
38910            ShapeModifier.prototype.init = function (elem, data) {
38911                this.shapes = [];
38912                this.elem = elem;
38913                this.initDynamicPropertyContainer(elem);
38914                this.initModifierProperties(elem, data);
38915                this.frameId = initialDefaultFrame;
38916                this.closed = false;
38917                this.k = false;
38918                if (this.dynamicProperties.length) {
38919                    this.k = true;
38920                } else {
38921                    this.getValue(true);
38922                }
38923            };
38924            ShapeModifier.prototype.processKeys = function () {
38925                if (this.elem.globalData.frameId === this.frameId) {
38926                    return;
38927                }
38928                this.frameId = this.elem.globalData.frameId;
38929                this.iterateDynamicProperties();
38930            };
38931
38932            extendPrototype([DynamicPropertyContainer], ShapeModifier);
38933
38934            function TrimModifier() {
38935            }
38936
38937            extendPrototype([ShapeModifier], TrimModifier);
38938            TrimModifier.prototype.initModifierProperties = function (elem, data) {
38939                this.s = PropertyFactory.getProp(elem, data.s, 0, 0.01, this);
38940                this.e = PropertyFactory.getProp(elem, data.e, 0, 0.01, this);
38941                this.o = PropertyFactory.getProp(elem, data.o, 0, 0, this);
38942                this.sValue = 0;
38943                this.eValue = 0;
38944                this.getValue = this.processKeys;
38945                this.m = data.m;
38946                this._isAnimated = !!this.s.effectsSequence.length || !!this.e.effectsSequence.length || !!this.o.effectsSequence.length;
38947            };
38948
38949            TrimModifier.prototype.addShapeToModifier = function (shapeData) {
38950                shapeData.pathsData = [];
38951            };
38952
38953            TrimModifier.prototype.calculateShapeEdges = function (s, e, shapeLength, addedLength, totalModifierLength) {
38954                var segments = [];
38955                if (e <= 1) {
38956                    segments.push({
38957                        s: s,
38958                        e: e
38959                    });
38960                } else if (s >= 1) {
38961                    segments.push({
38962                        s: s - 1,
38963                        e: e - 1
38964                    });
38965                } else {
38966                    segments.push({
38967                        s: s,
38968                        e: 1
38969                    });
38970                    segments.push({
38971                        s: 0,
38972                        e: e - 1
38973                    });
38974                }
38975                var shapeSegments = [];
38976                var i, len = segments.length, segmentOb;
38977                for (i = 0; i < len; i += 1) {
38978                    segmentOb = segments[i];
38979                    if (segmentOb.e * totalModifierLength < addedLength || segmentOb.s * totalModifierLength > addedLength + shapeLength) {
38980
38981                    } else {
38982                        var shapeS, shapeE;
38983                        if (segmentOb.s * totalModifierLength <= addedLength) {
38984                            shapeS = 0;
38985                        } else {
38986                            shapeS = (segmentOb.s * totalModifierLength - addedLength) / shapeLength;
38987                        }
38988                        if (segmentOb.e * totalModifierLength >= addedLength + shapeLength) {
38989                            shapeE = 1;
38990                        } else {
38991                            shapeE = ((segmentOb.e * totalModifierLength - addedLength) / shapeLength);
38992                        }
38993                        shapeSegments.push([shapeS, shapeE]);
38994                    }
38995                }
38996                if (!shapeSegments.length) {
38997                    shapeSegments.push([0, 0]);
38998                }
38999                return shapeSegments;
39000            };
39001
39002            TrimModifier.prototype.releasePathsData = function (pathsData) {
39003                var i, len = pathsData.length;
39004                for (i = 0; i < len; i += 1) {
39005                    segments_length_pool.release(pathsData[i]);
39006                }
39007                pathsData.length = 0;
39008                return pathsData;
39009            };
39010
39011            TrimModifier.prototype.processShapes = function (_isFirstFrame) {
39012                var s, e;
39013                if (this._mdf || _isFirstFrame) {
39014                    var o = (this.o.v % 360) / 360;
39015                    if (o < 0) {
39016                        o += 1;
39017                    }
39018                    s = (this.s.v > 1 ? 1 : this.s.v < 0 ? 0 : this.s.v) + o;
39019                    e = (this.e.v > 1 ? 1 : this.e.v < 0 ? 0 : this.e.v) + o;
39020                    if (s === e) {
39021
39022                    }
39023                    if (s > e) {
39024                        var _s = s;
39025                        s = e;
39026                        e = _s;
39027                    }
39028                    s = Math.round(s * 10000) * 0.0001;
39029                    e = Math.round(e * 10000) * 0.0001;
39030                    this.sValue = s;
39031                    this.eValue = e;
39032                } else {
39033                    s = this.sValue;
39034                    e = this.eValue;
39035                }
39036                var shapePaths;
39037                var i, len = this.shapes.length, j, jLen;
39038                var pathsData, pathData, totalShapeLength, totalModifierLength = 0;
39039
39040                if (e === s) {
39041                    for (i = 0; i < len; i += 1) {
39042                        this.shapes[i].localShapeCollection.releaseShapes();
39043                        this.shapes[i].shape._mdf = true;
39044                        this.shapes[i].shape.paths = this.shapes[i].localShapeCollection;
39045                        if (this._mdf) {
39046                            this.shapes[i].pathsData.length = 0;
39047                        }
39048                    }
39049                } else if (!((e === 1 && s === 0) || (e === 0 && s === 1))) {
39050                    var segments = [], shapeData, localShapeCollection;
39051                    for (i = 0; i < len; i += 1) {
39052                        shapeData = this.shapes[i];
39053                        // if shape hasn't changed and trim properties haven't changed, cached previous path can be used
39054                        if (!shapeData.shape._mdf && !this._mdf && !_isFirstFrame && this.m !== 2) {
39055                            shapeData.shape.paths = shapeData.localShapeCollection;
39056                        } else {
39057                            shapePaths = shapeData.shape.paths;
39058                            jLen = shapePaths._length;
39059                            totalShapeLength = 0;
39060                            if (!shapeData.shape._mdf && shapeData.pathsData.length) {
39061                                totalShapeLength = shapeData.totalShapeLength;
39062                            } else {
39063                                pathsData = this.releasePathsData(shapeData.pathsData);
39064                                for (j = 0; j < jLen; j += 1) {
39065                                    pathData = bez.getSegmentsLength(shapePaths.shapes[j]);
39066                                    pathsData.push(pathData);
39067                                    totalShapeLength += pathData.totalLength;
39068                                }
39069                                shapeData.totalShapeLength = totalShapeLength;
39070                                shapeData.pathsData = pathsData;
39071                            }
39072
39073                            totalModifierLength += totalShapeLength;
39074                            shapeData.shape._mdf = true;
39075                        }
39076                    }
39077                    var shapeS = s, shapeE = e, addedLength = 0, edges;
39078                    for (i = len - 1; i >= 0; i -= 1) {
39079                        shapeData = this.shapes[i];
39080                        if (shapeData.shape._mdf) {
39081                            localShapeCollection = shapeData.localShapeCollection;
39082                            localShapeCollection.releaseShapes();
39083                            //if m === 2 means paths are trimmed individually so edges need to be found for this specific shape relative to whoel group
39084                            if (this.m === 2 && len > 1) {
39085                                edges = this.calculateShapeEdges(s, e, shapeData.totalShapeLength, addedLength, totalModifierLength);
39086                                addedLength += shapeData.totalShapeLength;
39087                            } else {
39088                                edges = [[shapeS, shapeE]];
39089                            }
39090                            jLen = edges.length;
39091                            for (j = 0; j < jLen; j += 1) {
39092                                shapeS = edges[j][0];
39093                                shapeE = edges[j][1];
39094                                segments.length = 0;
39095                                if (shapeE <= 1) {
39096                                    segments.push({
39097                                        s: shapeData.totalShapeLength * shapeS,
39098                                        e: shapeData.totalShapeLength * shapeE
39099                                    });
39100                                } else if (shapeS >= 1) {
39101                                    segments.push({
39102                                        s: shapeData.totalShapeLength * (shapeS - 1),
39103                                        e: shapeData.totalShapeLength * (shapeE - 1)
39104                                    });
39105                                } else {
39106                                    segments.push({
39107                                        s: shapeData.totalShapeLength * shapeS,
39108                                        e: shapeData.totalShapeLength
39109                                    });
39110                                    segments.push({
39111                                        s: 0,
39112                                        e: shapeData.totalShapeLength * (shapeE - 1)
39113                                    });
39114                                }
39115                                var newShapesData = this.addShapes(shapeData, segments[0]);
39116                                if (segments[0].s !== segments[0].e) {
39117                                    if (segments.length > 1) {
39118                                        var lastShapeInCollection = shapeData.shape.paths.shapes[shapeData.shape.paths._length - 1];
39119                                        if (lastShapeInCollection.c) {
39120                                            var lastShape = newShapesData.pop();
39121                                            this.addPaths(newShapesData, localShapeCollection);
39122                                            newShapesData = this.addShapes(shapeData, segments[1], lastShape);
39123                                        } else {
39124                                            this.addPaths(newShapesData, localShapeCollection);
39125                                            newShapesData = this.addShapes(shapeData, segments[1]);
39126                                        }
39127                                    }
39128                                    this.addPaths(newShapesData, localShapeCollection);
39129                                }
39130
39131                            }
39132                            shapeData.shape.paths = localShapeCollection;
39133                        }
39134                    }
39135                } else if (this._mdf) {
39136                    for (i = 0; i < len; i += 1) {
39137                        //Releasign Trim Cached paths data when no trim applied in case shapes are modified inbetween.
39138                        //Don't remove this even if it's losing cached info.
39139                        this.shapes[i].pathsData.length = 0;
39140                        this.shapes[i].shape._mdf = true;
39141                    }
39142                }
39143            };
39144
39145            TrimModifier.prototype.addPaths = function (newPaths, localShapeCollection) {
39146                var i, len = newPaths.length;
39147                for (i = 0; i < len; i += 1) {
39148                    localShapeCollection.addShape(newPaths[i]);
39149                }
39150            };
39151
39152            TrimModifier.prototype.addSegment = function (pt1, pt2, pt3, pt4, shapePath, pos, newShape) {
39153                shapePath.setXYAt(pt2[0], pt2[1], 'o', pos);
39154                shapePath.setXYAt(pt3[0], pt3[1], 'i', pos + 1);
39155                if (newShape) {
39156                    shapePath.setXYAt(pt1[0], pt1[1], 'v', pos);
39157                }
39158                shapePath.setXYAt(pt4[0], pt4[1], 'v', pos + 1);
39159            };
39160
39161            TrimModifier.prototype.addSegmentFromArray = function (points, shapePath, pos, newShape) {
39162                shapePath.setXYAt(points[1], points[5], 'o', pos);
39163                shapePath.setXYAt(points[2], points[6], 'i', pos + 1);
39164                if (newShape) {
39165                    shapePath.setXYAt(points[0], points[4], 'v', pos);
39166                }
39167                shapePath.setXYAt(points[3], points[7], 'v', pos + 1);
39168            };
39169
39170            TrimModifier.prototype.addShapes = function (shapeData, shapeSegment, shapePath) {
39171                var pathsData = shapeData.pathsData;
39172                var shapePaths = shapeData.shape.paths.shapes;
39173                var i, len = shapeData.shape.paths._length, j, jLen;
39174                var addedLength = 0;
39175                var currentLengthData, segmentCount;
39176                var lengths;
39177                var segment;
39178                var shapes = [];
39179                var initPos;
39180                var newShape = true;
39181                if (!shapePath) {
39182                    shapePath = shape_pool.newElement();
39183                    segmentCount = 0;
vendor: 2,781 bytes, lines 39184-39223
39184                    initPos = 0;
39185                } else {
39186                    segmentCount = shapePath._length;
39187                    initPos = shapePath._length;
39188                }
39189                shapes.push(shapePath);
39190                for (i = 0; i < len; i += 1) {
39191                    lengths = pathsData[i].lengths;
39192                    shapePath.c = shapePaths[i].c;
39193                    jLen = shapePaths[i].c ? lengths.length : lengths.length + 1;
39194                    for (j = 1; j < jLen; j += 1) {
39195                        currentLengthData = lengths[j - 1];
39196                        if (addedLength + currentLengthData.addedLength < shapeSegment.s) {
39197                            addedLength += currentLengthData.addedLength;
39198                            shapePath.c = false;
39199                        } else if (addedLength > shapeSegment.e) {
39200                            shapePath.c = false;
39201                            break;
39202                        } else {
39203                            if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + currentLengthData.addedLength) {
39204                                this.addSegment(shapePaths[i].v[j - 1], shapePaths[i].o[j - 1], shapePaths[i].i[j], shapePaths[i].v[j], shapePath, segmentCount, newShape);
39205                                newShape = false;
39206                            } else {
39207                                segment = bez.getNewSegment(shapePaths[i].v[j - 1], shapePaths[i].v[j], shapePaths[i].o[j - 1], shapePaths[i].i[j], (shapeSegment.s - addedLength) / currentLengthData.addedLength, (shapeSegment.e - addedLength) / currentLengthData.addedLength, lengths[j - 1]);
39208                                this.addSegmentFromArray(segment, shapePath, segmentCount, newShape);
39209                                // this.addSegment(segment.pt1, segment.pt3, segment.pt4, segment.pt2, shapePath, segmentCount, newShape);
39210                                newShape = false;
39211                                shapePath.c = false;
39212                            }
39213                            addedLength += currentLengthData.addedLength;
39214                            segmentCount += 1;
39215                        }
39216                    }
39217                    if (shapePaths[i].c && lengths.length) {
39218                        currentLengthData = lengths[j - 1];
39219                        if (addedLength <= shapeSegment.e) {
39220                            var segmentLength = lengths[j - 1].addedLength;
39221                            if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + segmentLength) {
39222                                this.addSegment(shapePaths[i].v[j - 1], shapePaths[i].o[j - 1], shapePaths[i].i[0], shapePaths[i].v[0], shapePath, segmentCount, newShape);
39223                                newShape = false;
vendor: 11,382 bytes, lines 39224-39442
39224                            } else {
39225                                segment = bez.getNewSegment(shapePaths[i].v[j - 1], shapePaths[i].v[0], shapePaths[i].o[j - 1], shapePaths[i].i[0], (shapeSegment.s - addedLength) / segmentLength, (shapeSegment.e - addedLength) / segmentLength, lengths[j - 1]);
39226                                this.addSegmentFromArray(segment, shapePath, segmentCount, newShape);
39227                                // this.addSegment(segment.pt1, segment.pt3, segment.pt4, segment.pt2, shapePath, segmentCount, newShape);
39228                                newShape = false;
39229                                shapePath.c = false;
39230                            }
39231                        } else {
39232                            shapePath.c = false;
39233                        }
39234                        addedLength += currentLengthData.addedLength;
39235                        segmentCount += 1;
39236                    }
39237                    if (shapePath._length) {
39238                        shapePath.setXYAt(shapePath.v[initPos][0], shapePath.v[initPos][1], 'i', initPos);
39239                        shapePath.setXYAt(shapePath.v[shapePath._length - 1][0], shapePath.v[shapePath._length - 1][1], 'o', shapePath._length - 1);
39240                    }
39241                    if (addedLength > shapeSegment.e) {
39242                        break;
39243                    }
39244                    if (i < len - 1) {
39245                        shapePath = shape_pool.newElement();
39246                        newShape = true;
39247                        shapes.push(shapePath);
39248                        segmentCount = 0;
39249                    }
39250                }
39251                return shapes;
39252            };
39253
39254
39255            ShapeModifiers.registerModifier('tm', TrimModifier);
39256
39257            function RoundCornersModifier() {
39258            }
39259
39260            extendPrototype([ShapeModifier], RoundCornersModifier);
39261            RoundCornersModifier.prototype.initModifierProperties = function (elem, data) {
39262                this.getValue = this.processKeys;
39263                this.rd = PropertyFactory.getProp(elem, data.r, 0, null, this);
39264                this._isAnimated = !!this.rd.effectsSequence.length;
39265            };
39266
39267            RoundCornersModifier.prototype.processPath = function (path, round) {
39268                var cloned_path = shape_pool.newElement();
39269                cloned_path.c = path.c;
39270                var i, len = path._length;
39271                var currentV, currentI, currentO, closerV, newV, newO, newI, distance, newPosPerc, index = 0;
39272                var vX, vY, oX, oY, iX, iY;
39273                for (i = 0; i < len; i += 1) {
39274                    currentV = path.v[i];
39275                    currentO = path.o[i];
39276                    currentI = path.i[i];
39277                    if (currentV[0] === currentO[0] && currentV[1] === currentO[1] && currentV[0] === currentI[0] && currentV[1] === currentI[1]) {
39278                        if ((i === 0 || i === len - 1) && !path.c) {
39279                            cloned_path.setTripleAt(currentV[0], currentV[1], currentO[0], currentO[1], currentI[0], currentI[1], index);
39280                            /*cloned_path.v[index] = currentV;
39281                cloned_path.o[index] = currentO;
39282                cloned_path.i[index] = currentI;*/
39283                            index += 1;
39284                        } else {
39285                            if (i === 0) {
39286                                closerV = path.v[len - 1];
39287                            } else {
39288                                closerV = path.v[i - 1];
39289                            }
39290                            distance = Math.sqrt(Math.pow(currentV[0] - closerV[0], 2) + Math.pow(currentV[1] - closerV[1], 2));
39291                            newPosPerc = distance ? Math.min(distance / 2, round) / distance : 0;
39292                            vX = iX = currentV[0] + (closerV[0] - currentV[0]) * newPosPerc;
39293                            vY = iY = currentV[1] - (currentV[1] - closerV[1]) * newPosPerc;
39294                            oX = vX - (vX - currentV[0]) * roundCorner;
39295                            oY = vY - (vY - currentV[1]) * roundCorner;
39296                            cloned_path.setTripleAt(vX, vY, oX, oY, iX, iY, index);
39297                            index += 1;
39298
39299                            if (i === len - 1) {
39300                                closerV = path.v[0];
39301                            } else {
39302                                closerV = path.v[i + 1];
39303                            }
39304                            distance = Math.sqrt(Math.pow(currentV[0] - closerV[0], 2) + Math.pow(currentV[1] - closerV[1], 2));
39305                            newPosPerc = distance ? Math.min(distance / 2, round) / distance : 0;
39306                            vX = oX = currentV[0] + (closerV[0] - currentV[0]) * newPosPerc;
39307                            vY = oY = currentV[1] + (closerV[1] - currentV[1]) * newPosPerc;
39308                            iX = vX - (vX - currentV[0]) * roundCorner;
39309                            iY = vY - (vY - currentV[1]) * roundCorner;
39310                            cloned_path.setTripleAt(vX, vY, oX, oY, iX, iY, index);
39311                            index += 1;
39312                        }
39313                    } else {
39314                        cloned_path.setTripleAt(path.v[i][0], path.v[i][1], path.o[i][0], path.o[i][1], path.i[i][0], path.i[i][1], index);
39315                        index += 1;
39316                    }
39317                }
39318                return cloned_path;
39319            };
39320
39321            RoundCornersModifier.prototype.processShapes = function (_isFirstFrame) {
39322                var shapePaths;
39323                var i, len = this.shapes.length;
39324                var j, jLen;
39325                var rd = this.rd.v;
39326
39327                if (rd !== 0) {
39328                    var shapeData, newPaths, localShapeCollection;
39329                    for (i = 0; i < len; i += 1) {
39330                        shapeData = this.shapes[i];
39331                        newPaths = shapeData.shape.paths;
39332                        localShapeCollection = shapeData.localShapeCollection;
39333                        if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) {
39334                            localShapeCollection.releaseShapes();
39335                            shapeData.shape._mdf = true;
39336                            shapePaths = shapeData.shape.paths.shapes;
39337                            jLen = shapeData.shape.paths._length;
39338                            for (j = 0; j < jLen; j += 1) {
39339                                localShapeCollection.addShape(this.processPath(shapePaths[j], rd));
39340                            }
39341                        }
39342                        shapeData.shape.paths = shapeData.localShapeCollection;
39343                    }
39344
39345                }
39346                if (!this.dynamicProperties.length) {
39347                    this._mdf = false;
39348                }
39349            };
39350
39351            ShapeModifiers.registerModifier('rd', RoundCornersModifier);
39352
39353            function PuckerAndBloatModifier() {
39354            }
39355
39356            extendPrototype([ShapeModifier], PuckerAndBloatModifier);
39357            PuckerAndBloatModifier.prototype.initModifierProperties = function (elem, data) {
39358                this.getValue = this.processKeys;
39359                this.amount = PropertyFactory.getProp(elem, data.a, 0, null, this);
39360                this._isAnimated = !!this.amount.effectsSequence.length;
39361            };
39362
39363            PuckerAndBloatModifier.prototype.processPath = function (path, amount) {
39364                var percent = amount / 100;
39365                var centerPoint = [0, 0];
39366                var pathLength = path._length, i = 0;
39367                for (i = 0; i < pathLength; i += 1) {
39368                    centerPoint[0] += path.v[i][0];
39369                    centerPoint[1] += path.v[i][1];
39370                }
39371                centerPoint[0] /= pathLength;
39372                centerPoint[1] /= pathLength;
39373                var cloned_path = shape_pool.newElement();
39374                cloned_path.c = path.c;
39375                var vX, vY, oX, oY, iX, iY;
39376                for (i = 0; i < pathLength; i += 1) {
39377                    vX = path.v[i][0] + (centerPoint[0] - path.v[i][0]) * percent;
39378                    vY = path.v[i][1] + (centerPoint[1] - path.v[i][1]) * percent;
39379                    oX = path.o[i][0] + (centerPoint[0] - path.o[i][0]) * -percent;
39380                    oY = path.o[i][1] + (centerPoint[1] - path.o[i][1]) * -percent;
39381                    iX = path.i[i][0] + (centerPoint[0] - path.i[i][0]) * -percent;
39382                    iY = path.i[i][1] + (centerPoint[1] - path.i[i][1]) * -percent;
39383                    cloned_path.setTripleAt(vX, vY, oX, oY, iX, iY, i);
39384                }
39385                return cloned_path;
39386            };
39387
39388            PuckerAndBloatModifier.prototype.processShapes = function (_isFirstFrame) {
39389                var shapePaths;
39390                var i, len = this.shapes.length;
39391                var j, jLen;
39392                var amount = this.amount.v;
39393
39394                if (amount !== 0) {
39395                    var shapeData, newPaths, localShapeCollection;
39396                    for (i = 0; i < len; i += 1) {
39397                        shapeData = this.shapes[i];
39398                        newPaths = shapeData.shape.paths;
39399                        localShapeCollection = shapeData.localShapeCollection;
39400                        if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) {
39401                            localShapeCollection.releaseShapes();
39402                            shapeData.shape._mdf = true;
39403                            shapePaths = shapeData.shape.paths.shapes;
39404                            jLen = shapeData.shape.paths._length;
39405                            for (j = 0; j < jLen; j += 1) {
39406                                localShapeCollection.addShape(this.processPath(shapePaths[j], amount));
39407                            }
39408                        }
39409                        shapeData.shape.paths = shapeData.localShapeCollection;
39410                    }
39411                }
39412                if (!this.dynamicProperties.length) {
39413                    this._mdf = false;
39414                }
39415            };
39416            ShapeModifiers.registerModifier('pb', PuckerAndBloatModifier);
39417
39418            function RepeaterModifier() {
39419            }
39420
39421            extendPrototype([ShapeModifier], RepeaterModifier);
39422
39423            RepeaterModifier.prototype.initModifierProperties = function (elem, data) {
39424                this.getValue = this.processKeys;
39425                this.c = PropertyFactory.getProp(elem, data.c, 0, null, this);
39426                this.o = PropertyFactory.getProp(elem, data.o, 0, null, this);
39427                this.tr = TransformPropertyFactory.getTransformProperty(elem, data.tr, this);
39428                this.so = PropertyFactory.getProp(elem, data.tr.so, 0, 0.01, this);
39429                this.eo = PropertyFactory.getProp(elem, data.tr.eo, 0, 0.01, this);
39430                this.data = data;
39431                if (!this.dynamicProperties.length) {
39432                    this.getValue(true);
39433                }
39434                this._isAnimated = !!this.dynamicProperties.length;
39435                this.pMatrix = new Matrix();
39436                this.rMatrix = new Matrix();
39437                this.sMatrix = new Matrix();
39438                this.tMatrix = new Matrix();
39439                this.matrix = new Matrix();
39440            };
39441
39442            RepeaterModifier.prototype.applyTransforms = function (pMatrix, rMatr
39442ix, sMatrix, transform, perc, inv) {
39443                var dir = inv ? -1 : 1;
39444                var scaleX = transform.s.v[0] + (1 - transform.s.v[0]) * (1 - perc);
39445                var scaleY = transform.s.v[1] + (1 - transform.s.v[1]) * (1 - perc);
39446                pMatrix.translate(transform.p.v[0] * dir * perc, transform.p.v[1] * dir * perc, transform.p.v[2]);
39447                rMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2]);
39448                rMatrix.rotate(-transform.r.v * dir * perc);
39449                rMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2]);
39450                sMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2]);
39451                sMatrix.scale(inv ? 1 / scaleX : scaleX, inv ? 1 / scaleY : scaleY);
39452                sMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2]);
39453            };
39454
39455            RepeaterModifier.prototype.init = function (elem, arr, pos, elemsData) {
39456                this.elem = elem;
39457                this.arr = arr;
39458                this.pos = pos;
39459                this.elemsData = elemsData;
39460                this._currentCopies = 0;
39461                this._elements = [];
39462                this._groups = [];
39463                this.frameId = -1;
39464                this.initDynamicPropertyContainer(elem);
39465                this.initModifierProperties(elem, arr[pos]);
39466                var cont = 0;
39467                while (pos > 0) {
39468                    pos -= 1;
39469                    //this._elements.unshift(arr.splice(pos,1)[0]);
39470                    this._elements.unshift(arr[pos]);
39471                    cont += 1;
39472                }
39473                if (this.dynamicProperties.length) {
39474                    this.k = true;
39475                } else {
39476                    this.getValue(true);
39477                }
39478            };
39479
39480            RepeaterModifier.prototype.resetElements = function (elements) {
39481                var i, len = elements.length;
39482                for (i = 0; i < len; i += 1) {
39483                    elements[i]._processed = false;
39484                    if (elements[i].ty === 'gr') {
39485                        this.resetElements(elements[i].it);
39486                    }
39487                }
39488            };
39489
39490            RepeaterModifier.prototype.cloneElements = function (elements) {
39491                var i, len = elements.length;
39492                var newElements = JSON.parse(JSON.stringify(elements));
39493                this.resetElements(newElements);
39494                return newElements;
39495            };
39496
39497            RepeaterModifier.prototype.changeGroupRender = function (elements, renderFlag) {
39498                var i, len = elements.length;
39499                for (i = 0; i < len; i += 1) {
39500                    elements[i]._render = renderFlag;
39501                    if (elements[i].ty === 'gr') {
39502                        this.changeGroupRender(elements[i].it, renderFlag);
39503                    }
39504                }
39505            };
39506
39507            RepeaterModifier.prototype.processShapes = function (_isFirstFrame) {
39508                var items, itemsTransform, i, dir, cont;
39509                if (this._mdf || _isFirstFrame) {
39510                    var copies = Math.ceil(this.c.v);
39511                    if (this._groups.length < copies) {
39512                        while (this._groups.length < copies) {
39513                            var group = {
39514                                it: this.cloneElements(this._elements),
39515                                ty: 'gr'
39516                            };
39517                            group.it.push({
39518                                "a": {"a": 0, "ix": 1, "k": [0, 0]},
39519                                "nm": "Transform",
39520                                "o": {"a": 0, "ix": 7, "k": 100},
39521                                "p": {"a": 0, "ix": 2, "k": [0, 0]},
39522                                "r": {"a": 1, "ix": 6, "k": [{s: 0, e: 0, t: 0}, {s: 0, e: 0, t: 1}]},
39523                                "s": {"a": 0, "ix": 3, "k": [100, 100]},
39524                                "sa": {"a": 0, "ix": 5, "k": 0},
39525                                "sk": {"a": 0, "ix": 4, "k": 0},
39526                                "ty": "tr"
39527                            });
39528
39529                            this.arr.splice(0, 0, group);
39530                            this._groups.splice(0, 0, group);
39531                            this._currentCopies += 1;
39532                        }
39533                        this.elem.reloadShapes();
39534                    }
39535                    cont = 0;
39536                    var renderFlag;
39537                    for (i = 0; i <= this._groups.length - 1; i += 1) {
39538                        renderFlag = cont < copies;
39539                        this._groups[i]._render = renderFlag;
39540                        this.changeGroupRender(this._groups[i].it, renderFlag);
39541                        cont += 1;
39542                    }
39543
39544                    this._currentCopies = copies;
39545                    ////
39546
39547                    var offset = this.o.v;
39548                    var offsetModulo = offset % 1;
39549                    var roundOffset = offset > 0 ? Math.floor(offset) : Math.ceil(offset);
39550                    var k;
39551                    var tMat = this.tr.v.props;
39552                    var pProps = this.pMatrix.props;
39553                    var rProps = this.rMatrix.props;
vendor: 4,111 bytes, lines 39554-39621
39554                    var sProps = this.sMatrix.props;
39555                    this.pMatrix.reset();
39556                    this.rMatrix.reset();
39557                    this.sMatrix.reset();
39558                    this.tMatrix.reset();
39559                    this.matrix.reset();
39560                    var iteration = 0;
39561
39562                    if (offset > 0) {
39563                        while (iteration < roundOffset) {
39564                            this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false);
39565                            iteration += 1;
39566                        }
39567                        if (offsetModulo) {
39568                            this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, offsetModulo, false);
39569                            iteration += offsetModulo;
39570                        }
39571                    } else if (offset < 0) {
39572                        while (iteration > roundOffset) {
39573                            this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, true);
39574                            iteration -= 1;
39575                        }
39576                        if (offsetModulo) {
39577                            this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, -offsetModulo, true);
39578                            iteration -= offsetModulo;
39579                        }
39580                    }
39581                    i = this.data.m === 1 ? 0 : this._currentCopies - 1;
39582                    dir = this.data.m === 1 ? 1 : -1;
39583                    cont = this._currentCopies;
39584                    var j, jLen;
39585                    while (cont) {
39586                        items = this.elemsData[i].it;
39587                        itemsTransform = items[items.length - 1].transform.mProps.v.props;
39588                        jLen = itemsTransform.length;
39589                        items[items.length - 1].transform.mProps._mdf = true;
39590                        items[items.length - 1].transform.op._mdf = true;
39591                        items[items.length - 1].transform.op.v = this.so.v + (this.eo.v - this.so.v) * (i / (this._currentCopies - 1));
39592                        if (iteration !== 0) {
39593                            if ((i !== 0 && dir === 1) || (i !== this._currentCopies - 1 && dir === -1)) {
39594                                this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false);
39595                            }
39596                            this.matrix.transform(rProps[0], rProps[1], rProps[2], rProps[3], rProps[4], rProps[5], rProps[6], rProps[7], rProps[8], rProps[9], rProps[10], rProps[11], rProps[12], rProps[13], rProps[14], rProps[15]);
39597                            this.matrix.transform(sProps[0], sProps[1], sProps[2], sProps[3], sProps[4], sProps[5], sProps[6], sProps[7], sProps[8], sProps[9], sProps[10], sProps[11], sProps[12], sProps[13], sProps[14], sProps[15]);
39598                            this.matrix.transform(pProps[0], pProps[1], pProps[2], pProps[3], pProps[4], pProps[5], pProps[6], pProps[7], pProps[8], pProps[9], pProps[10], pProps[11], pProps[12], pProps[13], pProps[14], pProps[15]);
39599
39600                            for (j = 0; j < jLen; j += 1) {
39601                                itemsTransform[j] = this.matrix.props[j];
39602                            }
39603                            this.matrix.reset();
39604                        } else {
39605                            this.matrix.reset();
39606                            for (j = 0; j < jLen; j += 1) {
39607                                itemsTransform[j] = this.matrix.props[j];
39608                            }
39609                        }
39610                        iteration += 1;
39611                        cont -= 1;
39612                        i += dir;
39613                    }
39614                } else {
39615                    cont = this._currentCopies;
39616                    i = 0;
39617                    dir = 1;
39618                    while (cont) {
39619                        items = this.elemsData[i].it;
39620                        itemsTransform = items[items.length - 1].transform.mProps.v.props;
39621                        items[items.length - 1].transform.mProps._mdf = false;
vendor: 4,494 bytes, lines 39622-39726
39622                        items[items.length - 1].transform.op._mdf = false;
39623                        cont -= 1;
39624                        i += dir;
39625                    }
39626                }
39627            };
39628
39629            RepeaterModifier.prototype.addShape = function () {
39630            };
39631
39632            ShapeModifiers.registerModifier('rp', RepeaterModifier);
39633
39634            function ShapeCollection() {
39635                this._length = 0;
39636                this._maxLength = 4;
39637                this.shapes = createSizedArray(this._maxLength);
39638            }
39639
39640            ShapeCollection.prototype.addShape = function (shapeData) {
39641                if (this._length === this._maxLength) {
39642                    this.shapes = this.shapes.concat(createSizedArray(this._maxLength));
39643                    this._maxLength *= 2;
39644                }
39645                this.shapes[this._length] = shapeData;
39646                this._length += 1;
39647            };
39648
39649            ShapeCollection.prototype.releaseShapes = function () {
39650                var i;
39651                for (i = 0; i < this._length; i += 1) {
39652                    shape_pool.release(this.shapes[i]);
39653                }
39654                this._length = 0;
39655            };
39656
39657            function DashProperty(elem, data, renderer, container) {
39658                this.elem = elem;
39659                this.frameId = -1;
39660                this.dataProps = createSizedArray(data.length);
39661                this.renderer = renderer;
39662                this.k = false;
39663                this.dashStr = '';
39664                this.dashArray = createTypedArray('float32', data.length ? data.length - 1 : 0);
39665                this.dashoffset = createTypedArray('float32', 1);
39666                this.initDynamicPropertyContainer(container);
39667                var i, len = data.length || 0, prop;
39668                for (i = 0; i < len; i += 1) {
39669                    prop = PropertyFactory.getProp(elem, data[i].v, 0, 0, this);
39670                    this.k = prop.k || this.k;
39671                    this.dataProps[i] = {n: data[i].n, p: prop};
39672                }
39673                if (!this.k) {
39674                    this.getValue(true);
39675                }
39676                this._isAnimated = this.k;
39677            }
39678
39679            DashProperty.prototype.getValue = function (forceRender) {
39680                if (this.elem.globalData.frameId === this.frameId && !forceRender) {
39681                    return;
39682                }
39683                this.frameId = this.elem.globalData.frameId;
39684                this.iterateDynamicProperties();
39685                this._mdf = this._mdf || forceRender;
39686                if (this._mdf) {
39687                    var i = 0, len = this.dataProps.length;
39688                    if (this.renderer === 'svg') {
39689                        this.dashStr = '';
39690                    }
39691                    for (i = 0; i < len; i += 1) {
39692                        if (this.dataProps[i].n != 'o') {
39693                            if (this.renderer === 'svg') {
39694                                this.dashStr += ' ' + this.dataProps[i].p.v;
39695                            } else {
39696                                this.dashArray[i] = this.dataProps[i].p.v;
39697                            }
39698                        } else {
39699                            this.dashoffset[0] = this.dataProps[i].p.v;
39700                        }
39701                    }
39702                }
39703            };
39704            extendPrototype([DynamicPropertyContainer], DashProperty);
39705
39706            function GradientProperty(elem, data, container) {
39707                this.data = data;
39708                this.c = createTypedArray('uint8c', data.p * 4);
39709                var cLength = data.k.k[0].s ? (data.k.k[0].s.length - data.p * 4) : data.k.k.length - data.p * 4;
39710                this.o = createTypedArray('float32', cLength);
39711                this._cmdf = false;
39712                this._omdf = false;
39713                this._collapsable = this.checkCollapsable();
39714                this._hasOpacity = cLength;
39715                this.initDynamicPropertyContainer(container);
39716                this.prop = PropertyFactory.getProp(elem, data.k, 1, null, this);
39717                this.k = this.prop.k;
39718                this.getValue(true);
39719            }
39720
39721            GradientProperty.prototype.comparePoints = function (values, points) {
39722                var i = 0, len = this.o.length / 2, diff;
39723                while (i < len) {
39724                    diff = Math.abs(values[i * 4] - values[points * 4 + i * 2]);
39725                    if (diff > 0.01) {
39726                        return false;
39727                    }
39728                    i += 1;
39729                }
39730                return true;
39731            };
39732
39733            GradientProperty.prototype.checkCollapsable = function () {
39734                if (this.o.length / 2 !== this.c.length / 4) {
39735                    return false;
39736                }
39737                if (this.data.k.k[0].s) {
39738                    var i = 0, len = this.data.k.k.length;
39739                    while (i < len) {
39740                        if (!this.comparePoints(this.data.k.k[i].s, this.data.p)) {
39741                            return false;
39742                        }
39743                        i += 1;
39744                    }
39745                } else if (!this.comparePoints(this.data.k.k, this.data.p)) {
39746                    return false;
39747                }
39748                return true;
39749            };
39750
39751            GradientProperty.prototype.getValue = function (forceRender) {
39752                this.prop.getValue();
39753                this._mdf = false;
39754                this._cmdf = false;
39755                this._omdf = false;
39756                if (this.prop._mdf || forceRender) {
39757                    var i, len = this.data.p * 4;
39758                    var mult, val;
39759                    for (i = 0; i < len; i += 1) {
39760                        mult = i % 4 === 0 ? 100 : 255;
39761                        val = Math.round(this.prop.v[i] * mult);
39762                        if (this.c[i] !== val) {
39763                            this.c[i] = val;
39764                            this._cmdf = !forceRender;
39765                        }
39766                    }
39767                    if (this.o.length) {
39768                        len = this.prop.v.length;
39769                        for (i = this.data.p * 4; i < len; i += 1) {
39770                            mult = i % 2 === 0 ? 100 : 1;
39771                            val = i % 2 === 0 ? Math.round(this.prop.v[i] * 100) : this.prop.v[i];
39772                            if (this.o[i - this.data.p * 4] !== val) {
39773                                this.o[i - this.data.p * 4] = val;
39774                                this._omdf = !forceRender;
39775                            }
39776                        }
39777                    }
39778                    this._mdf = !forceRender;
39779                }
39780            };
39781
39782            extendPrototype([DynamicPropertyContainer], GradientProperty);
39783            var buildShapeString = function (pathNodes, length, closed, mat) {
39784                if (length === 0) {
39785                    return '';
39786                }
39787                var _o = pathNodes.o;
39788                var _i = pathNodes.i;
39789                var _v = pathNodes.v;
39790                var i, shapeString = " M" + mat.applyToPointStringified(_v[0][0], _v[0][1]);
39791                for (i = 1; i < length; i += 1) {
39792                    shapeString += " C" + mat.applyToPointStringified(_o[i - 1][0], _o[i - 1][1]) + " " + mat.applyToPointStringified(_i[i][0], _i[i][1]) + " " + mat.applyToPointStringified(_v[i][0], _v[i][1]);
39793                }
39794                if (closed && length) {
39795                    shapeString += " C" + mat.applyToPointStringified(_o[i - 1][0], _o[i - 1][1]) + " " + mat.applyToPointStringified(_i[0][0], _i[0][1]) + " " + mat.applyToPointStringified(_v[0][0], _v[0][1]);
39796                    shapeString += 'z';
39797                }
39798                return shapeString;
39799            }
39800            var audioControllerFactory = (function () {
39801
39802                function AudioController(audioFactory) {
39803                    this.audios = [];
39804                    this.audioFactory = audioFactory;
39805                    this._volume = 1;
39806                    this._isMuted = false;
39807                }
39808
39809                AudioController.prototype = {
39810                    addAudio: function (audio) {
39811                        this.audios.push(audio);
39812                    },
39813                    pause: function () {
39814                        var i, len = this.audios.length;
39815                        for (i = 0; i < len; i += 1) {
39816                            this.audios[i].pause()
39817                        }
39818                    },
39819                    resume: function () {
39820                        var i, len = this.audios.length;
39821                        for (i = 0; i < len; i += 1) {
39822                            this.audios[i].resume()
39823                        }
39824                    },
39825                    setRate: function (rateValue) {
39826                        var i, len = this.audios.length;
39827                        for (i = 0; i < len; i += 1) {
39828                            this.audios[i].setRate(rateValue)
39829                        }
39830                    },
39831                    createAudio: function (assetPath) {
39832                        if (this.audioFactory) {
39833                            return this.audioFactory(assetPath);
39834                        } else if (Howl) {
39835                            return new Howl({
39836                                src: [assetPath]
39837                            })
39838                        } else {
39839                            return {
39840                                isPlaying: false,
39841                                play: function () {
39842                                    this.isPlaying = true
39843                                },
39844                                seek: function () {
39845                                    this.isPlaying = false
39846                                },
39847                                playing: function () {
39848                                },
39849                                rate: function () {
39850                                },
39851                                setVolume: function () {
39852                                },
39853                            }
39854                        }
39855                    },
39856                    setAudioFactory: function (audioFactory) {
39857                        this.audioFactory = audioFactory;
39858                    },
39859                    setVolume: function (value) {
39860                        this._volume = value;
39861                        this._updateVolume();
39862                    },
39863                    mute: function () {
39864                        this._isMuted = true;
39865                        this._updateVolume();
39866                    },
39867                    unmute: function () {
39868                        this._isMuted = false;
39869                        this._updateVolume();
39870                    },
39871                    getVolume: function (value) {
39872                        return this._volume;
39873                    },
39874                    _updateVolume: function () {
39875                        var i, len = this.audios.length;
39876                        for (i = 0; i < len; i += 1) {
39877                            this.audios[i].volume(this._volume * (this._isMuted ? 0 : 1))
39878                        }
39879                    }
39880                }
39881
39882                return function () {
39883                    return new AudioController()
39884                }
39885
39886            }())
39887            var ImagePreloader = (function () {
39888
39889                var proxyImage = (function () {
39890                    var canvas = createTag('canvas');
39891                    canvas.width = 1;
39892                    canvas.height = 1;
39893                    var ctx = canvas.getContext('2d');
39894                    ctx.fillStyle = 'rgba(0,0,0,0)';
39895                    ctx.fillRect(0, 0, 1, 1);
39896                    return canvas;
39897                }())
39898
39899                function imageLoaded() {
39900                    this.loadedAssets += 1;
39901                    if (this.loadedAssets === this.totalImages) {
39902                        if (this.imagesLoadedCb) {
39903                            this.imagesLoadedCb(null);
39904                        }
39905                    }
39906                }
39907
39908                function getAssetsPath(assetData, assetsPath, original_path) {
39909                    var path = '';
39910                    if (assetData.e) {
39911                        path = assetData.p;
39912                    } else if (assetsPath) {
39913                        var imagePath = assetData.p;
39914                        if (imagePath.indexOf('images/') !== -1) {
39915                            imagePath = imagePath.split('/')[1];
39916                        }
39917                        path = assetsPath + imagePath;
39918                    } else {
39919                        path = original_path;
39920                        path += assetData.u ? assetData.u : '';
39921                        path += assetData.p;
39922                    }
39923                    return path;
39924                }
39925
39926                function createImageData(assetData) {
39927                    var path = getAssetsPath(assetData, this.assetsPath, this.path);
39928                    var img = createNS('image');
39929                    img.addEventListener('load', this._imageLoaded, false);
39930                    img.addEventListener('error', function () {
39931                        ob.img = proxyImage;
39932                        this._imageLoaded();
39933                    }.bind(this), false);
39934                    img.setAttributeNS('http://www.w3.org/1999/xlink', 'href', path);
39935                    var ob = {
39936                        img: img,
39937                        assetData: assetData
39938                    }
39939                    return ob;
39940                }
39941
39942                function createImgData(assetData) {
39943                    var path = getAssetsPath(assetData, this.assetsPath, this.path);
39944                    var img = createTag('img');
39945                    img.crossOrigin = 'anonymous';
39946                    img.addEventListener('load', this._imageLoaded, false);
39947                    img.addEventListener('error', function () {
39948                        ob.img = proxyImage;
39949                        this._imageLoaded();
39950                    }.bind(this), false);
39951                    img.src = path;
39952                    var ob = {
39953                        img: img,
39954                        assetData: assetData
39955                    }
39956                    return ob;
39957                }
39958
39959                function loadAssets(assets, cb) {
39960                    this.imagesLoadedCb = cb;
39961                    var i, len = assets.length;
39962                    for (i = 0; i < len; i += 1) {
39963                        if (!assets[i].layers) {
39964                            this.totalImages += 1;
39965                            this.images.push(this._createImageData(assets[i]));
39966                        }
39967                    }
39968                }
39969
39970                function setPath(path) {
39971                    this.path = path || '';
39972                }
39973
39974                function setAssetsPath(path) {
39975                    this.assetsPath = path || '';
39976                }
39977
39978                function getImage(assetData) {
39979                    var i = 0, len = this.images.length;
39980                    while (i < len) {
39981                        if (this.images[i].assetData === assetData) {
39982                            return this.images[i].img;
39983                        }
39984                        i += 1;
39985                    }
39986                }
39987
39988                function destroy() {
39989                    this.imagesLoadedCb = null;
39990                    this.images.length = 0;
39991                }
39992
39993                function loaded() {
39994                    return this.totalImages === this.loadedAssets;
39995                }
39996
39997                function setCacheType(type) {
39998                    if (type === 'svg') {
39999                        this._createImageData = this.createImageData.bind(this);
40000                    } else {
40001                        this._createImageData = this.createImgData.bind(this);
40002                    }
40003                }
40004
40005                function ImagePreloader(type) {
40006                    this._imageLoaded = imageLoaded.bind(this);
40007                    this.assetsPath = '';
40008                    this.path = '';
40009                    this.totalImages = 0;
40010                    this.loadedAssets = 0;
40011                    this.imagesLoadedCb = null;
40012                    this.images = [];
40013                };
40014
40015                ImagePreloader.prototype = {
40016                    loadAssets: loadAssets,
40017                    setAssetsPath: setAssetsPath,
40018                    setPath: setPath,
40019                    loaded: loaded,
40020                    destroy: destroy,
40021                    getImage: getImage,
40022                    createImgData: createImgData,
40023                    createImageData: createImageData,
40024                    imageLoaded: imageLoaded,
40025                    setCacheType: setCacheType,
40026                }
40027
40028                return ImagePreloader;
40029            }());
40030            var featureSupport = (function () {
40031                var ob = {
40032                    maskType: true
40033                };
40034                if (/MSIE 10/i.test(navigator.userAgent) || /MSIE 9/i.test(navigator.userAgent) || /rv:11.0/i.test(navigator.userAgent) || /Edge\/\d./i.test(navigator.userAgent)) {
40035                    ob.maskType = false;
40036                }
40037                return ob;
40038            }());
40039            var filtersFactory = (function () {
40040                var ob = {};
40041                ob.createFilter = createFilter;
40042                ob.createAlphaToLuminanceFilter = createAlphaToLuminanceFilter;
40043
40044                function createFilter(filId) {
40045                    var fil = createNS('filter');
40046                    fil.setAttribute('id', filId);
40047                    fil.setAttribute('filterUnits', 'objectBoundingBox');
40048                    fil.setAttribute('x', '0%');
40049                    fil.setAttribute('y', '0%');
40050                    fil.setAttribute('width', '100%');
40051                    fil.setAttribute('height', '100%');
40052                    return fil;
40053                }
40054
40055                function createAlphaToLuminanceFilter() {
40056                    var feColorMatrix = createNS('feColorMatrix');
40057                    feColorMatrix.setAttribute('type', 'matrix');
40058                    feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');
40059                    feColorMatrix.setAttribute('values', '0 0 0 1 0  0 0 0 1 0  0 0 0 1 0  0 0 0 1 1');
40060                    return feColorMatrix;
40061                }
40062
40063                return ob;
40064            }());
40065            var assetLoader = (function () {
40066
40067                function formatResponse(xhr) {
40068                    if (xhr.response && typeof xhr.response === 'object') {
40069                        return xhr.response;
40070                    } else if (xhr.response && typeof xhr.response === 'string') {
40071                        return JSON.parse(xhr.response);
40072                    } else if (xhr.responseText) {
40073                        return JSON.parse(xhr.responseText);
40074                    }
40075                }
40076
40077                function loadAsset(path, callback, errorCallback) {
40078                    var response;
40079                    var xhr = new XMLHttpRequest();
40080                    xhr.open('GET', path, true);
40081                    // set responseType after calling open or IE will break.
40082                    try {
40083                        // This crashes on Android WebView prior to KitKat
40084                        xhr.responseType = "json";
40085                    } catch (err) {
40086                    }
40087                    xhr.send();
40088                    xhr.onreadystatechange = function () {
40089                        if (xhr.readyState == 4) {
40090                            if (xhr.status == 200) {
40091                                response = formatResponse(xhr);
40092                                callback(response);
40093                            } else {
40094                                try {
40095                                    response = formatResponse(xhr);
40096                                    callback(response);
40097                                } catch (err) {
40098                                    if (errorCallback) {
40099                                        errorCallback(err);
40100                                    }
40101                                }
40102                            }
40103                        }
40104                    };
40105                }
40106
40107                return {
40108                    load: loadAsset
40109                }
40110            }())
40111
40112            function TextAnimatorProperty(textData, renderType, elem) {
40113                this._isFirstFrame = true;
40114                this._hasMaskedPath = false;
40115                this._frameId = -1;
40116                this._textData = textData;
40117                this._renderType = renderType;
40118                this._elem = elem;
40119                this._animatorsData = createSizedArray(this._textData.a.length);
40120                this._pathData = {};
40121                this._moreOptions = {
40122                    alignment: {}
40123                };
40124                this.renderedLetters = [];
40125                this.lettersChangedFlag = false;
40126                this.initDynamicPropertyContainer(elem);
40127
40128            }
40129
40130            TextAnimatorProperty.prototype.searchProperties = function () {
40131                var i, len = this._textData.a.length, animatorProps;
40132                var getProp = PropertyFactory.getProp;
40133                for (i = 0; i < len; i += 1) {
40134                    animatorProps = this._textData.a[i];
vendor: 7,197 bytes, lines 40135-40277
40135                    this._animatorsData[i] = new TextAnimatorDataProperty(this._elem, animatorProps, this);
40136                }
40137                if (this._textData.p && 'm' in this._textData.p) {
40138                    this._pathData = {
40139                        f: getProp(this._elem, this._textData.p.f, 0, 0, this),
40140                        l: getProp(this._elem, this._textData.p.l, 0, 0, this),
40141                        r: this._textData.p.r,
40142                        m: this._elem.maskManager.getMaskProperty(this._textData.p.m)
40143                    };
40144                    this._hasMaskedPath = true;
40145                } else {
40146                    this._hasMaskedPath = false;
40147                }
40148                this._moreOptions.alignment = getProp(this._elem, this._textData.m.a, 1, 0, this);
40149            };
40150
40151            TextAnimatorProperty.prototype.getMeasures = function (documentData, lettersChangedFlag) {
40152                this.lettersChangedFlag = lettersChangedFlag;
40153                if (!this._mdf && !this._isFirstFrame && !lettersChangedFlag && (!this._hasMaskedPath || !this._pathData.m._mdf)) {
40154                    return;
40155                }
40156                this._isFirstFrame = false;
40157                var alignment = this._moreOptions.alignment.v;
40158                var animators = this._animatorsData;
40159                var textData = this._textData;
40160                var matrixHelper = this.mHelper;
40161                var renderType = this._renderType;
40162                var renderedLettersCount = this.renderedLetters.length;
40163                var data = this.data;
40164                var xPos, yPos;
40165                var i, len;
40166                var letters = documentData.l, pathInfo, currentLength, currentPoint, segmentLength, flag, pointInd,
40167                    segmentInd, prevPoint, points, segments, partialLength, totalLength, perc, tanAngle, mask;
40168                if (this._hasMaskedPath) {
40169                    mask = this._pathData.m;
40170                    if (!this._pathData.n || this._pathData._mdf) {
40171                        var paths = mask.v;
40172                        if (this._pathData.r) {
40173                            paths = paths.reverse();
40174                        }
40175                        // TODO: release bezier data cached from previous pathInfo: this._pathData.pi
40176                        pathInfo = {
40177                            tLength: 0,
40178                            segments: []
40179                        };
40180                        len = paths._length - 1;
40181                        var bezierData;
40182                        totalLength = 0;
40183                        for (i = 0; i < len; i += 1) {
40184                            bezierData = bez.buildBezierData(paths.v[i]
40185                                , paths.v[i + 1]
40186                                , [paths.o[i][0] - paths.v[i][0], paths.o[i][1] - paths.v[i][1]]
40187                                , [paths.i[i + 1][0] - paths.v[i + 1][0], paths.i[i + 1][1] - paths.v[i + 1][1]]);
40188                            pathInfo.tLength += bezierData.segmentLength;
40189                            pathInfo.segments.push(bezierData);
40190                            totalLength += bezierData.segmentLength;
40191                        }
40192                        i = len;
40193                        if (mask.v.c) {
40194                            bezierData = bez.buildBezierData(paths.v[i]
40195                                , paths.v[0]
40196                                , [paths.o[i][0] - paths.v[i][0], paths.o[i][1] - paths.v[i][1]]
40197                                , [paths.i[0][0] - paths.v[0][0], paths.i[0][1] - paths.v[0][1]]);
40198                            pathInfo.tLength += bezierData.segmentLength;
40199                            pathInfo.segments.push(bezierData);
40200                            totalLength += bezierData.segmentLength;
40201                        }
40202                        this._pathData.pi = pathInfo;
40203                    }
40204                    pathInfo = this._pathData.pi;
40205
40206                    currentLength = this._pathData.f.v;
40207                    segmentInd = 0;
40208                    pointInd = 1;
40209                    segmentLength = 0;
40210                    flag = true;
40211                    segments = pathInfo.segments;
40212                    if (currentLength < 0 && mask.v.c) {
40213                        if (pathInfo.tLength < Math.abs(currentLength)) {
40214                            currentLength = -Math.abs(currentLength) % pathInfo.tLength;
40215                        }
40216                        segmentInd = segments.length - 1;
40217                        points = segments[segmentInd].points;
40218                        pointInd = points.length - 1;
40219                        while (currentLength < 0) {
40220                            currentLength += points[pointInd].partialLength;
40221                            pointInd -= 1;
40222                            if (pointInd < 0) {
40223                                segmentInd -= 1;
40224                                points = segments[segmentInd].points;
40225                                pointInd = points.length - 1;
40226                            }
40227                        }
40228
40229                    }
40230                    points = segments[segmentInd].points;
40231                    prevPoint = points[pointInd - 1];
40232                    currentPoint = points[pointInd];
40233                    partialLength = currentPoint.partialLength;
40234                }
40235
40236
40237                len = letters.length;
40238                xPos = 0;
40239                yPos = 0;
40240                var yOff = documentData.finalSize * 1.2 * 0.714;
40241                var firstLine = true;
40242                var animatorProps, animatorSelector;
40243                var j, jLen;
40244                var letterValue;
40245
40246                jLen = animators.length;
40247                var lastLetter;
40248
40249                var mult, ind = -1, offf, xPathPos, yPathPos;
40250                var initPathPos = currentLength, initSegmentInd = segmentInd, initPointInd = pointInd, currentLine = -1;
40251                var elemOpacity;
40252                var sc, sw, fc, k;
40253                var lineLength = 0;
40254                var letterSw, letterSc, letterFc, letterM = '', letterP = this.defaultPropsArray, letterO;
40255
40256                //
40257                if (documentData.j === 2 || documentData.j === 1) {
40258                    var animatorJustifyOffset = 0;
40259                    var animatorFirstCharOffset = 0;
40260                    var justifyOffsetMult = documentData.j === 2 ? -0.5 : -1;
40261                    var lastIndex = 0;
40262                    var isNewLine = true;
40263
40264                    for (i = 0; i < len; i += 1) {
40265                        if (letters[i].n) {
40266                            if (animatorJustifyOffset) {
40267                                animatorJustifyOffset += animatorFirstCharOffset;
40268                            }
40269                            while (lastIndex < i) {
40270                                letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset;
40271                                lastIndex += 1;
40272                            }
40273                            animatorJustifyOffset = 0;
40274                            isNewLine = true;
40275                        } else {
40276                            for (j = 0; j < jLen; j += 1) {
40277                                animatorProps = animators[j].a;
vendor: 4,128 bytes, lines 40278-40353
40278                                if (animatorProps.t.propType) {
40279                                    if (isNewLine && documentData.j === 2) {
40280                                        animatorFirstCharOffset += animatorProps.t.v * justifyOffsetMult;
40281                                    }
40282                                    animatorSelector = animators[j].s;
40283                                    mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
40284                                    if (mult.length) {
40285                                        animatorJustifyOffset += animatorProps.t.v * mult[0] * justifyOffsetMult;
40286                                    } else {
40287                                        animatorJustifyOffset += animatorProps.t.v * mult * justifyOffsetMult;
40288                                    }
40289                                }
40290                            }
40291                            isNewLine = false;
40292                        }
40293                    }
40294                    if (animatorJustifyOffset) {
40295                        animatorJustifyOffset += animatorFirstCharOffset;
40296                    }
40297                    while (lastIndex < i) {
40298                        letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset;
40299                        lastIndex += 1;
40300                    }
40301                }
40302                //
40303
40304                for (i = 0; i < len; i += 1) {
40305
40306                    matrixHelper.reset();
40307                    elemOpacity = 1;
40308                    if (letters[i].n) {
40309                        xPos = 0;
40310                        yPos += documentData.yOffset;
40311                        yPos += firstLine ? 1 : 0;
40312                        currentLength = initPathPos;
40313                        firstLine = false;
40314                        lineLength = 0;
40315                        if (this._hasMaskedPath) {
40316                            segmentInd = initSegmentInd;
40317                            pointInd = initPointInd;
40318                            points = segments[segmentInd].points;
40319                            prevPoint = points[pointInd - 1];
40320                            currentPoint = points[pointInd];
40321                            partialLength = currentPoint.partialLength;
40322                            segmentLength = 0;
40323                        }
40324                        letterO = letterSw = letterFc = letterM = '';
40325                        letterP = this.defaultPropsArray;
40326                    } else {
40327                        if (this._hasMaskedPath) {
40328                            if (currentLine !== letters[i].line) {
40329                                switch (documentData.j) {
40330                                    case 1:
40331                                        currentLength += totalLength - documentData.lineWidths[letters[i].line];
40332                                        break;
40333                                    case 2:
40334                                        currentLength += (totalLength - documentData.lineWidths[letters[i].line]) / 2;
40335                                        break;
40336                                }
40337                                currentLine = letters[i].line;
40338                            }
40339                            if (ind !== letters[i].ind) {
40340                                if (letters[ind]) {
40341                                    currentLength += letters[ind].extra;
40342                                }
40343                                currentLength += letters[i].an / 2;
40344                                ind = letters[i].ind;
40345                            }
40346                            currentLength += alignment[0] * letters[i].an / 200;
40347                            var animatorOffset = 0;
40348                            for (j = 0; j < jLen; j += 1) {
40349                                animatorProps = animators[j].a;
40350                                if (animatorProps.p.propType) {
40351                                    animatorSelector = animators[j].s;
40352                                    mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
40353                                    if (mult.length) {
vendor: 16,384 bytes, lines 40354-40623
40354                                        animatorOffset += animatorProps.p.v[0] * mult[0];
40355                                    } else {
40356                                        animatorOffset += animatorProps.p.v[0] * mult;
40357                                    }
40358
40359                                }
40360                                if (animatorProps.a.propType) {
40361                                    animatorSelector = animators[j].s;
40362                                    mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
40363                                    if (mult.length) {
40364                                        animatorOffset += animatorProps.a.v[0] * mult[0];
40365                                    } else {
40366                                        animatorOffset += animatorProps.a.v[0] * mult;
40367                                    }
40368
40369                                }
40370                            }
40371                            flag = true;
40372                            while (flag) {
40373                                if (segmentLength + partialLength >= currentLength + animatorOffset || !points) {
40374                                    perc = (currentLength + animatorOffset - segmentLength) / currentPoint.partialLength;
40375                                    xPathPos = prevPoint.point[0] + (currentPoint.point[0] - prevPoint.point[0]) * perc;
40376                                    yPathPos = prevPoint.point[1] + (currentPoint.point[1] - prevPoint.point[1]) * perc;
40377                                    matrixHelper.translate(-alignment[0] * letters[i].an / 200, -(alignment[1] * yOff / 100));
40378                                    flag = false;
40379                                } else if (points) {
40380                                    segmentLength += currentPoint.partialLength;
40381                                    pointInd += 1;
40382                                    if (pointInd >= points.length) {
40383                                        pointInd = 0;
40384                                        segmentInd += 1;
40385                                        if (!segments[segmentInd]) {
40386                                            if (mask.v.c) {
40387                                                pointInd = 0;
40388                                                segmentInd = 0;
40389                                                points = segments[segmentInd].points;
40390                                            } else {
40391                                                segmentLength -= currentPoint.partialLength;
40392                                                points = null;
40393                                            }
40394                                        } else {
40395                                            points = segments[segmentInd].points;
40396                                        }
40397                                    }
40398                                    if (points) {
40399                                        prevPoint = currentPoint;
40400                                        currentPoint = points[pointInd];
40401                                        partialLength = currentPoint.partialLength;
40402                                    }
40403                                }
40404                            }
40405                            offf = letters[i].an / 2 - letters[i].add;
40406                            matrixHelper.translate(-offf, 0, 0);
40407                        } else {
40408                            offf = letters[i].an / 2 - letters[i].add;
40409                            matrixHelper.translate(-offf, 0, 0);
40410
40411                            // Grouping alignment
40412                            matrixHelper.translate(-alignment[0] * letters[i].an / 200, -alignment[1] * yOff / 100, 0);
40413                        }
40414
40415                        lineLength += letters[i].l / 2;
40416                        for (j = 0; j < jLen; j += 1) {
40417                            animatorProps = animators[j].a;
40418                            if (animatorProps.t.propType) {
40419                                animatorSelector = animators[j].s;
40420                                mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
40421                                //This condition is to prevent applying tracking to first character in each line. Might be better to use a boolean "isNewLine"
40422                                if (xPos !== 0 || documentData.j !== 0) {
40423                                    if (this._hasMaskedPath) {
40424                                        if (mult.length) {
40425                                            currentLength += animatorProps.t.v * mult[0];
40426                                        } else {
40427                                            currentLength += animatorProps.t.v * mult;
40428                                        }
40429                                    } else {
40430                                        if (mult.length) {
40431                                            xPos += animatorProps.t.v * mult[0];
40432                                        } else {
40433                                            xPos += animatorProps.t.v * mult;
40434                                        }
40435                                    }
40436                                }
40437                            }
40438                        }
40439                        lineLength += letters[i].l / 2;
40440                        if (documentData.strokeWidthAnim) {
40441                            sw = documentData.sw || 0;
40442                        }
40443                        if (documentData.strokeColorAnim) {
40444                            if (documentData.sc) {
40445                                sc = [documentData.sc[0], documentData.sc[1], documentData.sc[2]];
40446                            } else {
40447                                sc = [0, 0, 0];
40448                            }
40449                        }
40450                        if (documentData.fillColorAnim && documentData.fc) {
40451                            fc = [documentData.fc[0], documentData.fc[1], documentData.fc[2]];
40452                        }
40453                        for (j = 0; j < jLen; j += 1) {
40454                            animatorProps = animators[j].a;
40455                            if (animatorProps.a.propType) {
40456                                animatorSelector = animators[j].s;
40457                                mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
40458
40459                                if (mult.length) {
40460                                    matrixHelper.translate(-animatorProps.a.v[0] * mult[0], -animatorProps.a.v[1] * mult[1], animatorProps.a.v[2] * mult[2]);
40461                                } else {
40462                                    matrixHelper.translate(-animatorProps.a.v[0] * mult, -animatorProps.a.v[1] * mult, animatorProps.a.v[2] * mult);
40463                                }
40464                            }
40465                        }
40466                        for (j = 0; j < jLen; j += 1) {
40467                            animatorProps = animators[j].a;
40468                            if (animatorProps.s.propType) {
40469                                animatorSelector = animators[j].s;
40470                                mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
40471                                if (mult.length) {
40472                                    matrixHelper.scale(1 + ((animatorProps.s.v[0] - 1) * mult[0]), 1 + ((animatorProps.s.v[1] - 1) * mult[1]), 1);
40473                                } else {
40474                                    matrixHelper.scale(1 + ((animatorProps.s.v[0] - 1) * mult), 1 + ((animatorProps.s.v[1] - 1) * mult), 1);
40475                                }
40476                            }
40477                        }
40478                        for (j = 0; j < jLen; j += 1) {
40479                            animatorProps = animators[j].a;
40480                            animatorSelector = animators[j].s;
40481                            mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
40482                            if (animatorProps.sk.propType) {
40483                                if (mult.length) {
40484                                    matrixHelper.skewFromAxis(-animatorProps.sk.v * mult[0], animatorProps.sa.v * mult[1]);
40485                                } else {
40486                                    matrixHelper.skewFromAxis(-animatorProps.sk.v * mult, animatorProps.sa.v * mult);
40487                                }
40488                            }
40489                            if (animatorProps.r.propType) {
40490                                if (mult.length) {
40491                                    matrixHelper.rotateZ(-animatorProps.r.v * mult[2]);
40492                                } else {
40493                                    matrixHelper.rotateZ(-animatorProps.r.v * mult);
40494                                }
40495                            }
40496                            if (animatorProps.ry.propType) {
40497
40498                                if (mult.length) {
40499                                    matrixHelper.rotateY(animatorProps.ry.v * mult[1]);
40500                                } else {
40501                                    matrixHelper.rotateY(animatorProps.ry.v * mult);
40502                                }
40503                            }
40504                            if (animatorProps.rx.propType) {
40505                                if (mult.length) {
40506                                    matrixHelper.rotateX(animatorProps.rx.v * mult[0]);
40507                                } else {
40508                                    matrixHelper.rotateX(animatorProps.rx.v * mult);
40509                                }
40510                            }
40511                            if (animatorProps.o.propType) {
40512                                if (mult.length) {
40513                                    elemOpacity += ((animatorProps.o.v) * mult[0] - elemOpacity) * mult[0];
40514                                } else {
40515                                    elemOpacity += ((animatorProps.o.v) * mult - elemOpacity) * mult;
40516                                }
40517                            }
40518                            if (documentData.strokeWidthAnim && animatorProps.sw.propType) {
40519                                if (mult.length) {
40520                                    sw += animatorProps.sw.v * mult[0];
40521                                } else {
40522                                    sw += animatorProps.sw.v * mult;
40523                                }
40524                            }
40525                            if (documentData.strokeColorAnim && animatorProps.sc.propType) {
40526                                for (k = 0; k < 3; k += 1) {
40527                                    if (mult.length) {
40528                                        sc[k] = sc[k] + (animatorProps.sc.v[k] - sc[k]) * mult[0];
40529                                    } else {
40530                                        sc[k] = sc[k] + (animatorProps.sc.v[k] - sc[k]) * mult;
40531                                    }
40532                                }
40533                            }
40534                            if (documentData.fillColorAnim && documentData.fc) {
40535                                if (animatorProps.fc.propType) {
40536                                    for (k = 0; k < 3; k += 1) {
40537                                        if (mult.length) {
40538                                            fc[k] = fc[k] + (animatorProps.fc.v[k] - fc[k]) * mult[0];
40539                                        } else {
40540                                            fc[k] = fc[k] + (animatorProps.fc.v[k] - fc[k]) * mult;
40541                                        }
40542                                    }
40543                                }
40544                                if (animatorProps.fh.propType) {
40545                                    if (mult.length) {
40546                                        fc = addHueToRGB(fc, animatorProps.fh.v * mult[0]);
40547                                    } else {
40548                                        fc = addHueToRGB(fc, animatorProps.fh.v * mult);
40549                                    }
40550                                }
40551                                if (animatorProps.fs.propType) {
40552                                    if (mult.length) {
40553                                        fc = addSaturationToRGB(fc, animatorProps.fs.v * mult[0]);
40554                                    } else {
40555                                        fc = addSaturationToRGB(fc, animatorProps.fs.v * mult);
40556                                    }
40557                                }
40558                                if (animatorProps.fb.propType) {
40559                                    if (mult.length) {
40560                                        fc = addBrightnessToRGB(fc, animatorProps.fb.v * mult[0]);
40561                                    } else {
40562                                        fc = addBrightnessToRGB(fc, animatorProps.fb.v * mult);
40563                                    }
40564                                }
40565                            }
40566                        }
40567
40568                        for (j = 0; j < jLen; j += 1) {
40569                            animatorProps = animators[j].a;
40570
40571                            if (animatorProps.p.propType) {
40572                                animatorSelector = animators[j].s;
40573                                mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
40574                                if (this._hasMaskedPath) {
40575                                    if (mult.length) {
40576                                        matrixHelper.translate(0, animatorProps.p.v[1] * mult[0], -animatorProps.p.v[2] * mult[1]);
40577                                    } else {
40578                                        matrixHelper.translate(0, animatorProps.p.v[1] * mult, -animatorProps.p.v[2] * mult);
40579                                    }
40580                                } else {
40581                                    if (mult.length) {
40582                                        matrixHelper.translate(animatorProps.p.v[0] * mult[0], animatorProps.p.v[1] * mult[1], -animatorProps.p.v[2] * mult[2]);
40583                                    } else {
40584                                        matrixHelper.translate(animatorProps.p.v[0] * mult, animatorProps.p.v[1] * mult, -animatorProps.p.v[2] * mult);
40585
40586                                    }
40587                                }
40588                            }
40589                        }
40590                        if (documentData.strokeWidthAnim) {
40591                            letterSw = sw < 0 ? 0 : sw;
40592                        }
40593                        if (documentData.strokeColorAnim) {
40594                            letterSc = 'rgb(' + Math.round(sc[0] * 255) + ',' + Math.round(sc[1] * 255) + ',' + Math.round(sc[2] * 255) + ')';
40595                        }
40596                        if (documentData.fillColorAnim && documentData.fc) {
40597                            letterFc = 'rgb(' + Math.round(fc[0] * 255) + ',' + Math.round(fc[1] * 255) + ',' + Math.round(fc[2] * 255) + ')';
40598                        }
40599
40600                        if (this._hasMaskedPath) {
40601                            matrixHelper.translate(0, -documentData.ls);
40602
40603                            matrixHelper.translate(0, alignment[1] * yOff / 100 + yPos, 0);
40604                            if (textData.p.p) {
40605                                tanAngle = (currentPoint.point[1] - prevPoint.point[1]) / (currentPoint.point[0] - prevPoint.point[0]);
40606                                var rot = Math.atan(tanAngle) * 180 / Math.PI;
40607                                if (currentPoint.point[0] < prevPoint.point[0]) {
40608                                    rot += 180;
40609                                }
40610                                matrixHelper.rotate(-rot * Math.PI / 180);
40611                            }
40612                            matrixHelper.translate(xPathPos, yPathPos, 0);
40613                            currentLength -= alignment[0] * letters[i].an / 200;
40614                            if (letters[i + 1] && ind !== letters[i + 1].ind) {
40615                                currentLength += letters[i].an / 2;
40616                                currentLength += documentData.tr / 1000 * documentData.finalSize;
40617                            }
40618                        } else {
40619
40620                            matrixHelper.translate(xPos, yPos, 0);
40621
40622                            if (documentData.ps) {
40623                                //matrixHelper.translate(documentData.ps[0],documentData.ps[1],0)
vendor: 11,327 bytes, lines 40623-40860
40623;
40624                                matrixHelper.translate(documentData.ps[0], documentData.ps[1] + documentData.ascent, 0);
40625                            }
40626                            switch (documentData.j) {
40627                                case 1:
40628                                    matrixHelper.translate(letters[i].animatorJustifyOffset + documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[letters[i].line]), 0, 0);
40629                                    break;
40630                                case 2:
40631                                    matrixHelper.translate(letters[i].animatorJustifyOffset + documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[letters[i].line]) / 2, 0, 0);
40632                                    break;
40633                            }
40634                            matrixHelper.translate(0, -documentData.ls);
40635                            matrixHelper.translate(offf, 0, 0);
40636                            matrixHelper.translate(alignment[0] * letters[i].an / 200, alignment[1] * yOff / 100, 0);
40637                            xPos += letters[i].l + documentData.tr / 1000 * documentData.finalSize;
40638                        }
40639                        if (renderType === 'html') {
40640                            letterM = matrixHelper.toCSS();
40641                        } else if (renderType === 'svg') {
40642                            letterM = matrixHelper.to2dCSS();
40643                        } else {
40644                            letterP = [matrixHelper.props[0], matrixHelper.props[1], matrixHelper.props[2], matrixHelper.props[3], matrixHelper.props[4], matrixHelper.props[5], matrixHelper.props[6], matrixHelper.props[7], matrixHelper.props[8], matrixHelper.props[9], matrixHelper.props[10], matrixHelper.props[11], matrixHelper.props[12], matrixHelper.props[13], matrixHelper.props[14], matrixHelper.props[15]];
40645                        }
40646                        letterO = elemOpacity;
40647                    }
40648
40649                    if (renderedLettersCount <= i) {
40650                        letterValue = new LetterProps(letterO, letterSw, letterSc, letterFc, letterM, letterP);
40651                        this.renderedLetters.push(letterValue);
40652                        renderedLettersCount += 1;
40653                        this.lettersChangedFlag = true;
40654                    } else {
40655                        letterValue = this.renderedLetters[i];
40656                        this.lettersChangedFlag = letterValue.update(letterO, letterSw, letterSc, letterFc, letterM, letterP) || this.lettersChangedFlag;
40657                    }
40658                }
40659            };
40660
40661            TextAnimatorProperty.prototype.getValue = function () {
40662                if (this._elem.globalData.frameId === this._frameId) {
40663                    return;
40664                }
40665                this._frameId = this._elem.globalData.frameId;
40666                this.iterateDynamicProperties();
40667            };
40668
40669            TextAnimatorProperty.prototype.mHelper = new Matrix();
40670            TextAnimatorProperty.prototype.defaultPropsArray = [];
40671            extendPrototype([DynamicPropertyContainer], TextAnimatorProperty);
40672
40673            function TextAnimatorDataProperty(elem, animatorProps, container) {
40674                var defaultData = {propType: false};
40675                var getProp = PropertyFactory.getProp;
40676                var textAnimator_animatables = animatorProps.a;
40677                this.a = {
40678                    r: textAnimator_animatables.r ? getProp(elem, textAnimator_animatables.r, 0, degToRads, container) : defaultData,
40679                    rx: textAnimator_animatables.rx ? getProp(elem, textAnimator_animatables.rx, 0, degToRads, container) : defaultData,
40680                    ry: textAnimator_animatables.ry ? getProp(elem, textAnimator_animatables.ry, 0, degToRads, container) : defaultData,
40681                    sk: textAnimator_animatables.sk ? getProp(elem, textAnimator_animatables.sk, 0, degToRads, container) : defaultData,
40682                    sa: textAnimator_animatables.sa ? getProp(elem, textAnimator_animatables.sa, 0, degToRads, container) : defaultData,
40683                    s: textAnimator_animatables.s ? getProp(elem, textAnimator_animatables.s, 1, 0.01, container) : defaultData,
40684                    a: textAnimator_animatables.a ? getProp(elem, textAnimator_animatables.a, 1, 0, container) : defaultData,
40685                    o: textAnimator_animatables.o ? getProp(elem, textAnimator_animatables.o, 0, 0.01, container) : defaultData,
40686                    p: textAnimator_animatables.p ? getProp(elem, textAnimator_animatables.p, 1, 0, container) : defaultData,
40687                    sw: textAnimator_animatables.sw ? getProp(elem, textAnimator_animatables.sw, 0, 0, container) : defaultData,
40688                    sc: textAnimator_animatables.sc ? getProp(elem, textAnimator_animatables.sc, 1, 0, container) : defaultData,
40689                    fc: textAnimator_animatables.fc ? getProp(elem, textAnimator_animatables.fc, 1, 0, container) : defaultData,
40690                    fh: textAnimator_animatables.fh ? getProp(elem, textAnimator_animatables.fh, 0, 0, container) : defaultData,
40691                    fs: textAnimator_animatables.fs ? getProp(elem, textAnimator_animatables.fs, 0, 0.01, container) : defaultData,
40692                    fb: textAnimator_animatables.fb ? getProp(elem, textAnimator_animatables.fb, 0, 0.01, container) : defaultData,
40693                    t: textAnimator_animatables.t ? getProp(elem, textAnimator_animatables.t, 0, 0, container) : defaultData
40694                };
40695
40696                this.s = TextSelectorProp.getTextSelectorProp(elem, animatorProps.s, container);
40697                this.s.t = animatorProps.s.t;
40698            }
40699
40700            function LetterProps(o, sw, sc, fc, m, p) {
40701                this.o = o;
40702                this.sw = sw;
40703                this.sc = sc;
40704                this.fc = fc;
40705                this.m = m;
40706                this.p = p;
40707                this._mdf = {
40708                    o: true,
40709                    sw: !!sw,
40710                    sc: !!sc,
40711                    fc: !!fc,
40712                    m: true,
40713                    p: true
40714                };
40715            }
40716
40717            LetterProps.prototype.update = function (o, sw, sc, fc, m, p) {
40718                this._mdf.o = false;
40719                this._mdf.sw = false;
40720                this._mdf.sc = false;
40721                this._mdf.fc = false;
40722                this._mdf.m = false;
40723                this._mdf.p = false;
40724                var updated = false;
40725
40726                if (this.o !== o) {
40727                    this.o = o;
40728                    this._mdf.o = true;
40729                    updated = true;
40730                }
40731                if (this.sw !== sw) {
40732                    this.sw = sw;
40733                    this._mdf.sw = true;
40734                    updated = true;
40735                }
40736                if (this.sc !== sc) {
40737                    this.sc = sc;
40738                    this._mdf.sc = true;
40739                    updated = true;
40740                }
40741                if (this.fc !== fc) {
40742                    this.fc = fc;
40743                    this._mdf.fc = true;
40744                    updated = true;
40745                }
40746                if (this.m !== m) {
40747                    this.m = m;
40748                    this._mdf.m = true;
40749                    updated = true;
40750                }
40751                if (p.length && (this.p[0] !== p[0] || this.p[1] !== p[1] || this.p[4] !== p[4] || this.p[5] !== p[5] || this.p[12] !== p[12] || this.p[13] !== p[13])) {
40752                    this.p = p;
40753                    this._mdf.p = true;
40754                    updated = true;
40755                }
40756                return updated;
40757            };
40758
40759            function TextProperty(elem, data) {
40760                this._frameId = initialDefaultFrame;
40761                this.pv = '';
40762                this.v = '';
40763                this.kf = false;
40764                this._isFirstFrame = true;
40765                this._mdf = false;
40766                this.data = data;
40767                this.elem = elem;
40768                this.comp = this.elem.comp;
40769                this.keysIndex = 0;
40770                this.canResize = false;
40771                this.minimumFontSize = 1;
40772                this.effectsSequence = [];
40773                this.currentData = {
40774                    ascent: 0,
40775                    boxWidth: this.defaultBoxWidth,
40776                    f: '',
40777                    fStyle: '',
40778                    fWeight: '',
40779                    fc: '',
40780                    j: '',
40781                    justifyOffset: '',
40782                    l: [],
40783                    lh: 0,
40784                    lineWidths: [],
40785                    ls: '',
40786                    of: '',
40787                    s: '',
40788                    sc: '',
40789                    sw: 0,
40790                    t: 0,
40791                    tr: 0,
40792                    sz: 0,
40793                    ps: null,
40794                    fillColorAnim: false,
40795                    strokeColorAnim: false,
40796                    strokeWidthAnim: false,
40797                    yOffset: 0,
40798                    finalSize: 0,
40799                    finalText: [],
40800                    finalLineHeight: 0,
40801                    __complete: false
40802
40803                };
40804                this.copyData(this.currentData, this.data.d.k[0].s);
40805
40806                if (!this.searchProperty()) {
40807                    this.completeTextData(this.currentData);
40808                }
40809            }
40810
40811            TextProperty.prototype.defaultBoxWidth = [0, 0];
40812
40813            TextProperty.prototype.copyData = function (obj, data) {
40814                for (var s in data) {
40815                    if (data.hasOwnProperty(s)) {
40816                        obj[s] = data[s];
40817                    }
40818                }
40819                return obj;
40820            }
40821
40822            TextProperty.prototype.setCurrentData = function (data) {
40823                if (!data.__complete) {
40824                    this.completeTextData(data);
40825                }
40826                this.currentData = data;
40827                this.currentData.boxWidth = this.currentData.boxWidth || this.defaultBoxWidth;
40828                this._mdf = true;
40829            };
40830
40831            TextProperty.prototype.searchProperty = function () {
40832                return this.searchKeyframes();
40833            };
40834
40835            TextProperty.prototype.searchKeyframes = function () {
40836                this.kf = this.data.d.k.length > 1;
40837                if (this.kf) {
40838                    this.addEffect(this.getKeyframeValue.bind(this));
40839                }
40840                return this.kf;
40841            }
40842
40843            TextProperty.prototype.addEffect = function (effectFunction) {
40844                this.effectsSequence.push(effectFunction);
40845                this.elem.addDynamicProperty(this);
40846            };
40847
40848            TextProperty.prototype.getValue = function (_finalValue) {
40849                if ((this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) && !_finalValue) {
40850                    return;
40851                }
40852                this.currentData.t = this.data.d.k[this.keysIndex].s.t;
40853                var currentValue = this.currentData;
40854                var currentIndex = this.keysIndex;
40855                if (this.lock) {
40856                    this.setCurrentData(this.currentData);
40857                    return;
40858                }
40859                this.lock = true;
40860                this._mdf = false;
40861                var multipliedValue;
40862                var i, len = this.effectsSequence.length;
40863                var finalValue = _finalValue || this.data.d.k[this.keysIndex].s;
40864                for (i = 0; i < len; i += 1) {
40865                    //Checking if index changed to prevent creating a new object every time the expression updates.
40866                    if (currentIndex !== this.keysIndex) {
40867                        finalValue = this.effectsSequence[i](finalValue, finalValue.t);
40868                    } else {
40869                        finalValue = this.effectsSequence[i](this.currentData, finalValue.t);
40870                    }
40871                }
40872                if (currentValue !== finalValue) {
40873                    this.setCurrentData(finalValue);
40874                }
40875                this.pv = this.v = this.currentData;
40876                this.lock = false;
40877                this.frameId = this.elem.globalData.frameId;
40878            }
40879
40880            TextProperty.prototype.getKeyframeValue = function () {
40881                var textKeys = this.data.d.k, textDocumentData;
40882                var frameNum = this.elem.comp.renderedFrame;
40883                var i = 0, len = textKeys.length;
40884                while (i <= len - 1) {
40885                    textDocumentData = textKeys[i].s;
40886                    if (i === len - 1 || textKeys[i + 1].t > frameNum) {
40887                        break;
40888                    }
40889                    i += 1;
40890                }
40891                if (this.keysIndex !== i) {
40892                    this.keysIndex = i;
40893                }
40894                return this.data.d.k[this.keysIndex].s;
40895            };
40896
40897            TextProperty.prototype.buildFinalText = function (text) {
40898                var combinedCharacters = FontManager.getCombinedCharacterCodes();
40899                var charactersArray = [];
40900                var i = 0, len = text.length;
40901                var charCode;
40902                while (i < len) {
40903                    charCode = text.charCodeAt(i);
40904                    if (combinedCharacters.indexOf(charCode) !== -1) {
40905                        charactersArray[charactersArray.length - 1] += text.charAt(i);
40906                    } else {
40907                        if (charCode >= 0xD800 && charCode <= 0xDBFF) {
40908                            charCode = text.charCodeAt(i + 1);
40909                            if (charCode >= 0xDC00 && charCode <= 0xDFFF) {
40910                                charactersArray.push(text.substr(i, 2));
40911                                ++i;
40912                            } else {
40913                                charactersArray.push(text.charAt(i));
40914                            }
40915                        } else {
40916                            charactersArray.push(text.charAt(i));
40917                        }
40918                    }
40919                    i += 1;
40920                }
40921                return charactersArray;
40922            }
40923
40924            TextProperty.prototype.completeTextData = function (documentData) {
40925                documentData.__complete = true;
40926                var fontManager = this.elem.globalData.fontManager;
40927                var data = this.data;
40928                var letters = [];
40929                var i, len;
40930                var newLineFlag, index = 0, val;
40931                var anchorGrouping = data.m.g;
40932                var currentSize = 0, currentPos = 0, currentLine = 0, lineWidths = [];
40933                var lineWidth = 0;
40934                var maxLineWidth = 0;
40935                var j, jLen;
40936                var fontData = fontManager.getFontByName(documentData.f);
40937                var charData, cLength = 0;
40938                var styles = fontData.fStyle ? fontData.fStyle.split(' ') : [];
40939
40940                var fWeight = 'normal', fStyle = 'normal';
40941                len = styles.length;
40942                var styleName;
40943                for (i = 0; i < len; i += 1) {
40944                    styleName = styles[i].toLowerCase();
40945                    switch (styleName) {
40946                        case 'italic':
40947                            fStyle = 'italic';
40948                            break;
40949                        case 'bold':
40950                            fWeight = '700';
40951                            break;
40952                        case 'black':
40953                            fWeight = '900';
40954                            break;
40955                        case 'medium':
40956                            fWeight = '500';
40957                            break;
40958                        case 'regular':
40959                        case 'normal':
40960                            fWeight = '400';
40961                            break;
40962                        case 'light':
40963                        case 'thin':
40964                            fWeight = '200';
40965                            break;
40966                    }
40967                }
40968                documentData.fWeight = fontData.fWeight || fWeight;
40969                documentData.fStyle = fStyle;
40970                documentData.finalSize = documentData.s;
40971                documentData.finalText = this.buildFinalText(documentData.t);
40972                len = documentData.finalText.length;
40973                documentData.finalLineHeight = documentData.lh;
40974                var trackingOffset = documentData.tr / 1000 * documentData.finalSize;
vendor: 4,461 bytes, lines 40975-41053
40975                var charCode;
40976                if (documentData.sz) {
40977                    var flag = true;
40978                    var boxWidth = documentData.sz[0];
40979                    var boxHeight = documentData.sz[1];
40980                    var currentHeight, finalText;
40981                    while (flag) {
40982                        finalText = this.buildFinalText(documentData.t);
40983                        currentHeight = 0;
40984                        lineWidth = 0;
40985                        len = finalText.length;
40986                        trackingOffset = documentData.tr / 1000 * documentData.finalSize;
40987                        var lastSpaceIndex = -1;
40988                        for (i = 0; i < len; i += 1) {
40989                            charCode = finalText[i].charCodeAt(0);
40990                            newLineFlag = false;
40991                            if (finalText[i] === ' ') {
40992                                lastSpaceIndex = i;
40993                            } else if (charCode === 13 || charCode === 3) {
40994                                lineWidth = 0;
40995                                newLineFlag = true;
40996                                currentHeight += documentData.finalLineHeight || documentData.finalSize * 1.2;
40997                            }
40998                            if (fontManager.chars) {
40999                                charData = fontManager.getCharData(finalText[i], fontData.fStyle, fontData.fFamily);
41000                                cLength = newLineFlag ? 0 : charData.w * documentData.finalSize / 100;
41001                            } else {
41002                                //tCanvasHelper.font = documentData.s + 'px '+ fontData.fFamily;
41003                                cLength = fontManager.measureText(finalText[i], documentData.f, documentData.finalSize);
41004                            }
41005                            if (lineWidth + cLength > boxWidth && finalText[i] !== ' ') {
41006                                if (lastSpaceIndex === -1) {
41007                                    len += 1;
41008                                } else {
41009                                    i = lastSpaceIndex;
41010                                }
41011                                currentHeight += documentData.finalLineHeight || documentData.finalSize * 1.2;
41012                                finalText.splice(i, lastSpaceIndex === i ? 1 : 0, "\r");
41013                                //finalText = finalText.substr(0,i) + "\r" + finalText.substr(i === lastSpaceIndex ? i + 1 : i);
41014                                lastSpaceIndex = -1;
41015                                lineWidth = 0;
41016                            } else {
41017                                lineWidth += cLength;
41018                                lineWidth += trackingOffset;
41019                            }
41020                        }
41021                        currentHeight += fontData.ascent * documentData.finalSize / 100;
41022                        if (this.canResize && documentData.finalSize > this.minimumFontSize && boxHeight < currentHeight) {
41023                            documentData.finalSize -= 1;
41024                            documentData.finalLineHeight = documentData.finalSize * documentData.lh / documentData.s;
41025                        } else {
41026                            documentData.finalText = finalText;
41027                            len = documentData.finalText.length;
41028                            flag = false;
41029                        }
41030                    }
41031
41032                }
41033                lineWidth = -trackingOffset;
41034                cLength = 0;
41035                var uncollapsedSpaces = 0;
41036                var currentChar;
41037                for (i = 0; i < len; i += 1) {
41038                    newLineFlag = false;
41039                    currentChar = documentData.finalText[i];
41040                    charCode = currentChar.charCodeAt(0);
41041                    if (charCode === 13 || charCode === 3) {
41042                        uncollapsedSpaces = 0;
41043                        lineWidths.push(lineWidth);
41044                        maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth;
41045                        lineWidth = -2 * trackingOffset;
41046                        val = '';
41047                        newLineFlag = true;
41048                        currentLine += 1;
41049                    } else {
41050                        val = currentChar;
41051                    }
41052                    if (fontManager.chars) {
41053                        charData = fontManager.getCharData(currentChar, fontData.fStyle, fontManager.getFontByName(
vendor: 6,810 bytes, lines 41053-41190
41053documentData.f).fFamily);
41054                        cLength = newLineFlag ? 0 : charData.w * documentData.finalSize / 100;
41055                    } else {
41056                        //var charWidth = fontManager.measureText(val, documentData.f, documentData.finalSize);
41057                        //tCanvasHelper.font = documentData.finalSize + 'px '+ fontManager.getFontByName(documentData.f).fFamily;
41058                        cLength = fontManager.measureText(val, documentData.f, documentData.finalSize);
41059                    }
41060
41061                    //
41062                    if (currentChar === ' ') {
41063                        uncollapsedSpaces += cLength + trackingOffset;
41064                    } else {
41065                        lineWidth += cLength + trackingOffset + uncollapsedSpaces;
41066                        uncollapsedSpaces = 0;
41067                    }
41068                    letters.push({
41069                        l: cLength,
41070                        an: cLength,
41071                        add: currentSize,
41072                        n: newLineFlag,
41073                        anIndexes: [],
41074                        val: val,
41075                        line: currentLine,
41076                        animatorJustifyOffset: 0
41077                    });
41078                    if (anchorGrouping == 2) {
41079                        currentSize += cLength;
41080                        if (val === '' || val === ' ' || i === len - 1) {
41081                            if (val === '' || val === ' ') {
41082                                currentSize -= cLength;
41083                            }
41084                            while (currentPos <= i) {
41085                                letters[currentPos].an = currentSize;
41086                                letters[currentPos].ind = index;
41087                                letters[currentPos].extra = cLength;
41088                                currentPos += 1;
41089                            }
41090                            index += 1;
41091                            currentSize = 0;
41092                        }
41093                    } else if (anchorGrouping == 3) {
41094                        currentSize += cLength;
41095                        if (val === '' || i === len - 1) {
41096                            if (val === '') {
41097                                currentSize -= cLength;
41098                            }
41099                            while (currentPos <= i) {
41100                                letters[currentPos].an = currentSize;
41101                                letters[currentPos].ind = index;
41102                                letters[currentPos].extra = cLength;
41103                                currentPos += 1;
41104                            }
41105                            currentSize = 0;
41106                            index += 1;
41107                        }
41108                    } else {
41109                        letters[index].ind = index;
41110                        letters[index].extra = 0;
41111                        index += 1;
41112                    }
41113                }
41114                documentData.l = letters;
41115                maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth;
41116                lineWidths.push(lineWidth);
41117                if (documentData.sz) {
41118                    documentData.boxWidth = documentData.sz[0];
41119                    documentData.justifyOffset = 0;
41120                } else {
41121                    documentData.boxWidth = maxLineWidth;
41122                    switch (documentData.j) {
41123                        case 1:
41124                            documentData.justifyOffset = -documentData.boxWidth;
41125                            break;
41126                        case 2:
41127                            documentData.justifyOffset = -documentData.boxWidth / 2;
41128                            break;
41129                        default:
41130                            documentData.justifyOffset = 0;
41131                    }
41132                }
41133                documentData.lineWidths = lineWidths;
41134
41135                var animators = data.a, animatorData, letterData;
41136                jLen = animators.length;
41137                var based, ind, indexes = [];
41138                for (j = 0; j < jLen; j += 1) {
41139                    animatorData = animators[j];
41140                    if (animatorData.a.sc) {
41141                        documentData.strokeColorAnim = true;
41142                    }
41143                    if (animatorData.a.sw) {
41144                        documentData.strokeWidthAnim = true;
41145                    }
41146                    if (animatorData.a.fc || animatorData.a.fh || animatorData.a.fs || animatorData.a.fb) {
41147                        documentData.fillColorAnim = true;
41148                    }
41149                    ind = 0;
41150                    based = animatorData.s.b;
41151                    for (i = 0; i < len; i += 1) {
41152                        letterData = letters[i];
41153                        letterData.anIndexes[j] = ind;
41154                        if ((based == 1 && letterData.val !== '') || (based == 2 && letterData.val !== '' && letterData.val !== ' ') || (based == 3 && (letterData.n || letterData.val == ' ' || i == len - 1)) || (based == 4 && (letterData.n || i == len - 1))) {
41155                            if (animatorData.s.rn === 1) {
41156                                indexes.push(ind);
41157                            }
41158                            ind += 1;
41159                        }
41160                    }
41161                    data.a[j].s.totalChars = ind;
41162                    var currentInd = -1, newInd;
41163                    if (animatorData.s.rn === 1) {
41164                        for (i = 0; i < len; i += 1) {
41165                            letterData = letters[i];
41166                            if (currentInd != letterData.anIndexes[j]) {
41167                                currentInd = letterData.anIndexes[j];
41168                                newInd = indexes.splice(Math.floor(Math.random() * indexes.length), 1)[0];
41169                            }
41170                            letterData.anIndexes[j] = newInd;
41171                        }
41172                    }
41173                }
41174                documentData.yOffset = documentData.finalLineHeight || documentData.finalSize * 1.2;
41175                documentData.ls = documentData.ls || 0;
41176                documentData.ascent = fontData.ascent * documentData.finalSize / 100;
41177            };
41178
41179            TextProperty.prototype.updateDocumentData = function (newData, index) {
41180                index = index === undefined ? this.keysIndex : index;
41181                var dData = this.copyData({}, this.data.d.k[index].s);
41182                dData = this.copyData(dData, newData);
41183                this.data.d.k[index].s = dData;
41184                this.recalculate(index);
41185                this.elem.addDynamicProperty(this);
41186            };
41187
41188            TextProperty.prototype.recalculate = function (index) {
41189                var dData = this.data.d.k[index].s;
41190                dData.__complete = false;
vendor: 19,973 bytes, lines 41191-41677
41191                this.keysIndex = 0;
41192                this._isFirstFrame = true;
41193                this.getValue(dData);
41194            }
41195
41196            TextProperty.prototype.canResizeFont = function (_canResize) {
41197                this.canResize = _canResize;
41198                this.recalculate(this.keysIndex);
41199                this.elem.addDynamicProperty(this);
41200            };
41201
41202            TextProperty.prototype.setMinimumFontSize = function (_fontValue) {
41203                this.minimumFontSize = Math.floor(_fontValue) || 1;
41204                this.recalculate(this.keysIndex);
41205                this.elem.addDynamicProperty(this);
41206            };
41207
41208            var TextSelectorProp = (function () {
41209                var max = Math.max;
41210                var min = Math.min;
41211                var floor = Math.floor;
41212
41213                function TextSelectorProp(elem, data) {
41214                    this._currentTextLength = -1;
41215                    this.k = false;
41216                    this.data = data;
41217                    this.elem = elem;
41218                    this.comp = elem.comp;
41219                    this.finalS = 0;
41220                    this.finalE = 0;
41221                    this.initDynamicPropertyContainer(elem);
41222                    this.s = PropertyFactory.getProp(elem, data.s || {k: 0}, 0, 0, this);
41223                    if ('e' in data) {
41224                        this.e = PropertyFactory.getProp(elem, data.e, 0, 0, this);
41225                    } else {
41226                        this.e = {v: 100};
41227                    }
41228                    this.o = PropertyFactory.getProp(elem, data.o || {k: 0}, 0, 0, this);
41229                    this.xe = PropertyFactory.getProp(elem, data.xe || {k: 0}, 0, 0, this);
41230                    this.ne = PropertyFactory.getProp(elem, data.ne || {k: 0}, 0, 0, this);
41231                    this.a = PropertyFactory.getProp(elem, data.a, 0, 0.01, this);
41232                    if (!this.dynamicProperties.length) {
41233                        this.getValue();
41234                    }
41235                }
41236
41237                TextSelectorProp.prototype = {
41238                    getMult: function (ind) {
41239                        if (this._currentTextLength !== this.elem.textProperty.currentData.l.length) {
41240                            this.getValue();
41241                        }
41242                        //var easer = bez.getEasingCurve(this.ne.v/100,0,1-this.xe.v/100,1);
41243                        var x1 = 0;
41244                        var y1 = 0;
41245                        var x2 = 1;
41246                        var y2 = 1;
41247                        if (this.ne.v > 0) {
41248                            x1 = this.ne.v / 100.0;
41249                        } else {
41250                            y1 = -this.ne.v / 100.0;
41251                        }
41252                        if (this.xe.v > 0) {
41253                            x2 = 1.0 - this.xe.v / 100.0;
41254                        } else {
41255                            y2 = 1.0 + this.xe.v / 100.0;
41256                        }
41257                        var easer = BezierFactory.getBezierEasing(x1, y1, x2, y2).get;
41258
41259                        var mult = 0;
41260                        var s = this.finalS;
41261                        var e = this.finalE;
41262                        var type = this.data.sh;
41263                        if (type === 2) {
41264                            if (e === s) {
41265                                mult = ind >= e ? 1 : 0;
41266                            } else {
41267                                mult = max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1));
41268                            }
41269                            mult = easer(mult);
41270                        } else if (type === 3) {
41271                            if (e === s) {
41272                                mult = ind >= e ? 0 : 1;
41273                            } else {
41274                                mult = 1 - max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1));
41275                            }
41276
41277                            mult = easer(mult);
41278                        } else if (type === 4) {
41279                            if (e === s) {
41280                                mult = 0;
41281                            } else {
41282                                mult = max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1));
41283                                if (mult < 0.5) {
41284                                    mult *= 2;
41285                                } else {
41286                                    mult = 1 - 2 * (mult - 0.5);
41287                                }
41288                            }
41289                            mult = easer(mult);
41290                        } else if (type === 5) {
41291                            if (e === s) {
41292                                mult = 0;
41293                            } else {
41294                                var tot = e - s;
41295                                /*ind += 0.5;
41296                    mult = -4/(tot*tot)*(ind*ind)+(4/tot)*ind;*/
41297                                ind = min(max(0, ind + 0.5 - s), e - s);
41298                                var x = -tot / 2 + ind;
41299                                var a = tot / 2;
41300                                mult = Math.sqrt(1 - (x * x) / (a * a));
41301                            }
41302                            mult = easer(mult);
41303                        } else if (type === 6) {
41304                            if (e === s) {
41305                                mult = 0;
41306                            } else {
41307                                ind = min(max(0, ind + 0.5 - s), e - s);
41308                                mult = (1 + (Math.cos((Math.PI + Math.PI * 2 * (ind) / (e - s))))) / 2;
41309                            }
41310                            mult = easer(mult);
41311                        } else {
41312                            if (ind >= floor(s)) {
41313                                if (ind - s < 0) {
41314                                    mult = max(0, min(min(e, 1) - (s - ind), 1));
41315                                } else {
41316                                    mult = max(0, min(e - ind, 1));
41317                                }
41318                            }
41319                            mult = easer(mult);
41320                        }
41321                        return mult * this.a.v;
41322                    },
41323                    getValue: function (newCharsFlag) {
41324                        this.iterateDynamicProperties();
41325                        this._mdf = newCharsFlag || this._mdf;
41326                        this._currentTextLength = this.elem.textProperty.currentData.l.length || 0;
41327                        if (newCharsFlag && this.data.r === 2) {
41328                            this.e.v = this._currentTextLength;
41329                        }
41330                        var divisor = this.data.r === 2 ? 1 : 100 / this.data.totalChars;
41331                        var o = this.o.v / divisor;
41332                        var s = this.s.v / divisor + o;
41333                        var e = (this.e.v / divisor) + o;
41334                        if (s > e) {
41335                            var _s = s;
41336                            s = e;
41337                            e = _s;
41338                        }
41339                        this.finalS = s;
41340                        this.finalE = e;
41341                    }
41342                }
41343                extendPrototype([DynamicPropertyContainer], TextSelectorProp);
41344
41345                function getTextSelectorProp(elem, data, arr) {
41346                    return new TextSelectorProp(elem, data, arr);
41347                }
41348
41349                return {
41350                    getTextSelectorProp: getTextSelectorProp
41351                };
41352            }());
41353
41354
41355            var pool_factory = (function () {
41356                return function (initialLength, _create, _release, _clone) {
41357
41358                    var _length = 0;
41359                    var _maxLength = initialLength;
41360                    var pool = createSizedArray(_maxLength);
41361
41362                    var ob = {
41363                        newElement: newElement,
41364                        release: release
41365                    };
41366
41367                    function newElement() {
41368                        var element;
41369                        if (_length) {
41370                            _length -= 1;
41371                            element = pool[_length];
41372                        } else {
41373                            element = _create();
41374                        }
41375                        return element;
41376                    }
41377
41378                    function release(element) {
41379                        if (_length === _maxLength) {
41380                            pool = pooling.double(pool);
41381                            _maxLength = _maxLength * 2;
41382                        }
41383                        if (_release) {
41384                            _release(element);
41385                        }
41386                        pool[_length] = element;
41387                        _length += 1;
41388                    }
41389
41390                    function clone() {
41391                        var clonedElement = newElement();
41392                        return _clone(clonedElement);
41393                    }
41394
41395                    return ob;
41396                };
41397            }());
41398
41399            var pooling = (function () {
41400
41401                function double(arr) {
41402                    return arr.concat(createSizedArray(arr.length));
41403                }
41404
41405                return {
41406                    double: double
41407                };
41408            }());
41409            var point_pool = (function () {
41410
41411                function create() {
41412                    return createTypedArray('float32', 2);
41413                }
41414
41415                return pool_factory(8, create);
41416            }());
41417            var shape_pool = (function () {
41418
41419                function create() {
41420                    return new ShapePath();
41421                }
41422
41423                function release(shapePath) {
41424                    var len = shapePath._length, i;
41425                    for (i = 0; i < len; i += 1) {
41426                        point_pool.release(shapePath.v[i]);
41427                        point_pool.release(shapePath.i[i]);
41428                        point_pool.release(shapePath.o[i]);
41429                        shapePath.v[i] = null;
41430                        shapePath.i[i] = null;
41431                        shapePath.o[i] = null;
41432                    }
41433                    shapePath._length = 0;
41434                    shapePath.c = false;
41435                }
41436
41437                function clone(shape) {
41438                    var cloned = factory.newElement();
41439                    var i, len = shape._length === undefined ? shape.v.length : shape._length;
41440                    cloned.setLength(len);
41441                    cloned.c = shape.c;
41442                    var pt;
41443
41444                    for (i = 0; i < len; i += 1) {
41445                        cloned.setTripleAt(shape.v[i][0], shape.v[i][1], shape.o[i][0], shape.o[i][1], shape.i[i][0], shape.i[i][1], i);
41446                    }
41447                    return cloned;
41448                }
41449
41450                var factory = pool_factory(4, create, release);
41451                factory.clone = clone;
41452
41453                return factory;
41454            }());
41455            var shapeCollection_pool = (function () {
41456                var ob = {
41457                    newShapeCollection: newShapeCollection,
41458                    release: release
41459                };
41460
41461                var _length = 0;
41462                var _maxLength = 4;
41463                var pool = createSizedArray(_maxLength);
41464
41465                function newShapeCollection() {
41466                    var shapeCollection;
41467                    if (_length) {
41468                        _length -= 1;
41469                        shapeCollection = pool[_length];
41470                    } else {
41471                        shapeCollection = new ShapeCollection();
41472                    }
41473                    return shapeCollection;
41474                }
41475
41476                function release(shapeCollection) {
41477                    var i, len = shapeCollection._length;
41478                    for (i = 0; i < len; i += 1) {
41479                        shape_pool.release(shapeCollection.shapes[i]);
41480                    }
41481                    shapeCollection._length = 0;
41482
41483                    if (_length === _maxLength) {
41484                        pool = pooling.double(pool);
41485                        _maxLength = _maxLength * 2;
41486                    }
41487                    pool[_length] = shapeCollection;
41488                    _length += 1;
41489                }
41490
41491                return ob;
41492            }());
41493            var segments_length_pool = (function () {
41494
41495                function create() {
41496                    return {
41497                        lengths: [],
41498                        totalLength: 0
41499                    };
41500                }
41501
41502                function release(element) {
41503                    var i, len = element.lengths.length;
41504                    for (i = 0; i < len; i += 1) {
41505                        bezier_length_pool.release(element.lengths[i]);
41506                    }
41507                    element.lengths.length = 0;
41508                }
41509
41510                return pool_factory(8, create, release);
41511            }());
41512            var bezier_length_pool = (function () {
41513
41514                function create() {
41515                    return {
41516                        addedLength: 0,
41517                        percents: createTypedArray('float32', defaultCurveSegments),
41518                        lengths: createTypedArray('float32', defaultCurveSegments),
41519                    };
41520                }
41521
41522                return pool_factory(8, create);
41523            }());
41524
41525            function BaseRenderer() {
41526            }
41527
41528            BaseRenderer.prototype.checkLayers = function (num) {
41529                var i, len = this.layers.length, data;
41530                this.completeLayers = true;
41531                for (i = len - 1; i >= 0; i--) {
41532                    if (!this.elements[i]) {
41533                        data = this.layers[i];
41534                        if (data.ip - data.st <= (num - this.layers[i].st) && data.op - data.st > (num - this.layers[i].st)) {
41535                            this.buildItem(i);
41536                        }
41537                    }
41538                    this.completeLayers = this.elements[i] ? this.completeLayers : false;
41539                }
41540                this.checkPendingElements();
41541            };
41542
41543            BaseRenderer.prototype.createItem = function (layer) {
41544                switch (layer.ty) {
41545                    case 2:
41546                        return this.createImage(layer);
41547                    case 0:
41548                        return this.createComp(layer);
41549                    case 1:
41550                        return this.createSolid(layer);
41551                    case 3:
41552                        return this.createNull(layer);
41553                    case 4:
41554                        return this.createShape(layer);
41555                    case 5:
41556                        return this.createText(layer);
41557                    case 6:
41558                        return this.createAudio(layer);
41559                    case 13:
41560                        return this.createCamera(layer);
41561                }
41562                return this.createNull(layer);
41563            };
41564
41565            BaseRenderer.prototype.createCamera = function () {
41566                throw new Error('You\'re using a 3d camera. Try the html renderer.');
41567            };
41568
41569            BaseRenderer.prototype.createAudio = function (data) {
41570                return new AudioElement(data, this.globalData, this);
41571            };
41572
41573            BaseRenderer.prototype.buildAllItems = function () {
41574                var i, len = this.layers.length;
41575                for (i = 0; i < len; i += 1) {
41576                    this.buildItem(i);
41577                }
41578                this.checkPendingElements();
41579            };
41580
41581            BaseRenderer.prototype.includeLayers = function (newLayers) {
41582                this.completeLayers = false;
41583                var i, len = newLayers.length;
41584                var j, jLen = this.layers.length;
41585                for (i = 0; i < len; i += 1) {
41586                    j = 0;
41587                    while (j < jLen) {
41588                        if (this.layers[j].id == newLayers[i].id) {
41589                            this.layers[j] = newLayers[i];
41590                            break;
41591                        }
41592                        j += 1;
41593                    }
41594                }
41595            };
41596
41597            BaseRenderer.prototype.setProjectInterface = function (pInterface) {
41598                this.globalData.projectInterface = pInterface;
41599            };
41600
41601            BaseRenderer.prototype.initItems = function () {
41602                if (!this.globalData.progressiveLoad) {
41603                    this.buildAllItems();
41604                }
41605            };
41606            BaseRenderer.prototype.buildElementParenting = function (element, parentName, hierarchy) {
41607                var elements = this.elements;
41608                var layers = this.layers;
41609                var i = 0, len = layers.length;
41610                while (i < len) {
41611                    if (layers[i].ind == parentName) {
41612                        if (!elements[i] || elements[i] === true) {
41613                            this.buildItem(i);
41614                            this.addPendingElement(element);
41615                        } else {
41616                            hierarchy.push(elements[i]);
41617                            elements[i].setAsParent();
41618                            if (layers[i].parent !== undefined) {
41619                                this.buildElementParenting(element, layers[i].parent, hierarchy);
41620                            } else {
41621                                element.setHierarchy(hierarchy);
41622                            }
41623                        }
41624                    }
41625                    i += 1;
41626                }
41627            };
41628
41629            BaseRenderer.prototype.addPendingElement = function (element) {
41630                this.pendingElements.push(element);
41631            };
41632
41633            BaseRenderer.prototype.searchExtraCompositions = function (assets) {
41634                var i, len = assets.length;
41635                for (i = 0; i < len; i += 1) {
41636                    if (assets[i].xt) {
41637                        var comp = this.createComp(assets[i]);
41638                        comp.initExpressions();
41639                        this.globalData.projectInterface.registerComposition(comp);
41640                    }
41641                }
41642            };
41643
41644            BaseRenderer.prototype.setupGlobalData = function (animData, fontsContainer) {
41645                this.globalData.fontManager = new FontManager();
41646                this.globalData.fontManager.addChars(animData.chars);
41647                this.globalData.fontManager.addFonts(animData.fonts, fontsContainer);
41648                this.globalData.getAssetData = this.animationItem.getAssetData.bind(this.animationItem);
41649                this.globalData.getAssetsPath = this.animationItem.getAssetsPath.bind(this.animationItem);
41650                this.globalData.imageLoader = this.animationItem.imagePreloader;
41651                this.globalData.audioController = this.animationItem.audioController;
41652                this.globalData.frameId = 0;
41653                this.globalData.frameRate = animData.fr;
41654                this.globalData.nm = animData.nm;
41655                this.globalData.compSize = {
41656                    w: animData.w,
41657                    h: animData.h
41658                }
41659            }
41660
41661            function SVGRenderer(animationItem, config) {
41662                this.animationItem = animationItem;
41663                this.layers = null;
41664                this.renderedFrame = -1;
41665                this.svgElement = createNS('svg');
41666                var ariaLabel = '';
41667                if (config && config.title) {
41668                    var titleElement = createNS('title');
41669                    var titleId = createElementID();
41670                    titleElement.setAttribute('id', titleId);
41671                    titleElement.textContent = config.title;
41672                    this.svgElement.appendChild(titleElement);
41673                    ariaLabel += titleId;
41674                }
41675                if (config && config.description) {
41676                    var descElement = createNS('desc');
41677                    var descId = createElementID();
41678                    descElement.setAttribute('id', descId);
41679                    descElement.textContent = config.description;
41680                    this.svgElement.appendChild(descElement);
41681                    ariaLabel += ' ' + descId;
41682                }
41683                if (ariaLabel) {
41684                    this.svgElement.setAttribute('aria-labelledby', ariaLabel)
41685                }
41686                var defs = createNS('defs');
41687                this.svgElement.appendChild(defs);
41688                var maskElement = createNS('g');
41689                this.svgElement.appendChild(maskElement);
41690                this.layerElement = maskElement;
41691                this.renderConfig = {
41692                    preserveAspectRatio: (config && config.preserveAspectRatio) || 'xMidYMid meet',
41693                    imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice',
41694                    progressiveLoad: (config && config.progressiveLoad) || false,
41695                    hideOnTransparent: (config && config.hideOnTransparent === false) ? false : true,
vendor: 8,054 bytes, lines 41696-41877
41696                    viewBoxOnly: (config && config.viewBoxOnly) || false,
41697                    viewBoxSize: (config && config.viewBoxSize) || false,
41698                    className: (config && config.className) || '',
41699                    id: (config && config.id) || '',
41700                    focusable: config && config.focusable,
41701                    filterSize: {
41702                        width: config && config.filterSize && config.filterSize.width || '100%',
41703                        height: config && config.filterSize && config.filterSize.height || '100%',
41704                        x: config && config.filterSize && config.filterSize.x || '0%',
41705                        y: config && config.filterSize && config.filterSize.y || '0%',
41706                    }
41707                };
41708
41709                this.globalData = {
41710                    _mdf: false,
41711                    frameNum: -1,
41712                    defs: defs,
41713                    renderConfig: this.renderConfig
41714                };
41715                this.elements = [];
41716                this.pendingElements = [];
41717                this.destroyed = false;
41718                this.rendererType = 'svg';
41719
41720            }
41721
41722            extendPrototype([BaseRenderer], SVGRenderer);
41723
41724            SVGRenderer.prototype.createNull = function (data) {
41725                return new NullElement(data, this.globalData, this);
41726            };
41727
41728            SVGRenderer.prototype.createShape = function (data) {
41729                return new SVGShapeElement(data, this.globalData, this);
41730            };
41731
41732            SVGRenderer.prototype.createText = function (data) {
41733                return new SVGTextElement(data, this.globalData, this);
41734
41735            };
41736
41737            SVGRenderer.prototype.createImage = function (data) {
41738                return new IImageElement(data, this.globalData, this);
41739            };
41740
41741            SVGRenderer.prototype.createComp = function (data) {
41742                return new SVGCompElement(data, this.globalData, this);
41743
41744            };
41745
41746            SVGRenderer.prototype.createSolid = function (data) {
41747                return new ISolidElement(data, this.globalData, this);
41748            };
41749
41750            SVGRenderer.prototype.configAnimation = function (animData) {
41751                this.svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
41752                if (this.renderConfig.viewBoxSize) {
41753                    this.svgElement.setAttribute('viewBox', this.renderConfig.viewBoxSize);
41754                } else {
41755                    this.svgElement.setAttribute('viewBox', '0 0 ' + animData.w + ' ' + animData.h);
41756                }
41757
41758                if (!this.renderConfig.viewBoxOnly) {
41759                    this.svgElement.setAttribute('width', animData.w);
41760                    this.svgElement.setAttribute('height', animData.h);
41761                    this.svgElement.style.width = '100%';
41762                    this.svgElement.style.height = '100%';
41763                    this.svgElement.style.transform = 'translate3d(0,0,0)';
41764                }
41765                if (this.renderConfig.className) {
41766                    this.svgElement.setAttribute('class', this.renderConfig.className);
41767                }
41768                if (this.renderConfig.id) {
41769                    this.svgElement.setAttribute('id', this.renderConfig.id);
41770                }
41771                if (this.renderConfig.focusable !== undefined) {
41772                    this.svgElement.setAttribute('focusable', this.renderConfig.focusable);
41773                }
41774                this.svgElement.setAttribute('preserveAspectRatio', this.renderConfig.preserveAspectRatio);
41775                //this.layerElement.style.transform = 'translate3d(0,0,0)';
41776                //this.layerElement.style.transformOrigin = this.layerElement.style.mozTransformOrigin = this.layerElement.style.webkitTransformOrigin = this.layerElement.style['-webkit-transform'] = "0px 0px 0px";
41777                this.animationItem.wrapper.appendChild(this.svgElement);
41778                //Mask animation
41779                var defs = this.globalData.defs;
41780
41781                this.setupGlobalData(animData, defs);
41782                this.globalData.progressiveLoad = this.renderConfig.progressiveLoad;
41783                this.data = animData;
41784
41785                var maskElement = createNS('clipPath');
41786                var rect = createNS('rect');
41787                rect.setAttribute('width', animData.w);
41788                rect.setAttribute('height', animData.h);
41789                rect.setAttribute('x', 0);
41790                rect.setAttribute('y', 0);
41791                var maskId = createElementID();
41792                maskElement.setAttribute('id', maskId);
41793                maskElement.appendChild(rect);
41794                this.layerElement.setAttribute("clip-path", "url(" + locationHref + "#" + maskId + ")");
41795
41796                defs.appendChild(maskElement);
41797                this.layers = animData.layers;
41798                this.elements = createSizedArray(animData.layers.length);
41799            };
41800
41801
41802            SVGRenderer.prototype.destroy = function () {
41803                this.animationItem.wrapper.innerText = '';
41804                this.layerElement = null;
41805                this.globalData.defs = null;
41806                var i, len = this.layers ? this.layers.length : 0;
41807                for (i = 0; i < len; i++) {
41808                    if (this.elements[i]) {
41809                        this.elements[i].destroy();
41810                    }
41811                }
41812                this.elements.length = 0;
41813                this.destroyed = true;
41814                this.animationItem = null;
41815            };
41816
41817            SVGRenderer.prototype.updateContainerSize = function () {
41818            };
41819
41820            SVGRenderer.prototype.buildItem = function (pos) {
41821                var elements = this.elements;
41822                if (elements[pos] || this.layers[pos].ty == 99) {
41823                    return;
41824                }
41825                elements[pos] = true;
41826                var element = this.createItem(this.layers[pos]);
41827
41828                elements[pos] = element;
41829                if (expressionsPlugin) {
41830                    if (this.layers[pos].ty === 0) {
41831                        this.globalData.projectInterface.registerComposition(element);
41832                    }
41833                    element.initExpressions();
41834                }
41835                this.appendElementInPos(element, pos);
41836                if (this.layers[pos].tt) {
41837                    if (!this.elements[pos - 1] || this.elements[pos - 1] === true) {
41838                        this.buildItem(pos - 1);
41839                        this.addPendingElement(element);
41840                    } else {
41841                        element.setMatte(elements[pos - 1].layerId);
41842                    }
41843                }
41844            };
41845
41846            SVGRenderer.prototype.checkPendingElements = function () {
41847                while (this.pendingElements.length) {
41848                    var element = this.pendingElements.pop();
41849                    element.checkParenting();
41850                    if (element.data.tt) {
41851                        var i = 0, len = this.elements.length;
41852                        while (i < len) {
41853                            if (this.elements[i] === element) {
41854                                element.setMatte(this.elements[i - 1].layerId);
41855                                break;
41856                            }
41857                            i += 1;
41858                        }
41859                    }
41860                }
41861            };
41862
41863            SVGRenderer.prototype.renderFrame = function (num) {
41864                if (this.renderedFrame === num || this.destroyed) {
41865                    return;
41866                }
41867                if (num === null) {
41868                    num = this.renderedFrame;
41869                } else {
41870                    this.renderedFrame = num;
41871                }
41872                // console.log('-------');
41873                // console.log('FRAME ',num);
41874                this.globalData.frameNum = num;
41875                this.globalData.frameId += 1;
41876                this.globalData.projectInterface.currentFrame = num;
41877                this.globalData._mdf = false;
vendor: 4,142 bytes, lines 41878-41975
41878                var i, len = this.layers.length;
41879                if (!this.completeLayers) {
41880                    this.checkLayers(num);
41881                }
41882                for (i = len - 1; i >= 0; i--) {
41883                    if (this.completeLayers || this.elements[i]) {
41884                        this.elements[i].prepareFrame(num - this.layers[i].st);
41885                    }
41886                }
41887                if (this.globalData._mdf) {
41888                    for (i = 0; i < len; i += 1) {
41889                        if (this.completeLayers || this.elements[i]) {
41890                            this.elements[i].renderFrame();
41891                        }
41892                    }
41893                }
41894            };
41895
41896            SVGRenderer.prototype.appendElementInPos = function (element, pos) {
41897                var newElement = element.getBaseElement();
41898                if (!newElement) {
41899                    return;
41900                }
41901                var i = 0;
41902                var nextElement;
41903                while (i < pos) {
41904                    if (this.elements[i] && this.elements[i] !== true && this.elements[i].getBaseElement()) {
41905                        nextElement = this.elements[i].getBaseElement();
41906                    }
41907                    i += 1;
41908                }
41909                if (nextElement) {
41910                    this.layerElement.insertBefore(newElement, nextElement);
41911                } else {
41912                    this.layerElement.appendChild(newElement);
41913                }
41914            };
41915
41916            SVGRenderer.prototype.hide = function () {
41917                this.layerElement.style.display = 'none';
41918            };
41919
41920            SVGRenderer.prototype.show = function () {
41921                this.layerElement.style.display = 'block';
41922            };
41923
41924            function CanvasRenderer(animationItem, config) {
41925                this.animationItem = animationItem;
41926                this.renderConfig = {
41927                    clearCanvas: (config && config.clearCanvas !== undefined) ? config.clearCanvas : true,
41928                    context: (config && config.context) || null,
41929                    progressiveLoad: (config && config.progressiveLoad) || false,
41930                    preserveAspectRatio: (config && config.preserveAspectRatio) || 'xMidYMid meet',
41931                    imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice',
41932                    className: (config && config.className) || '',
41933                    id: (config && config.id) || '',
41934                };
41935                this.renderConfig.dpr = (config && config.dpr) || 1;
41936                if (this.animationItem.wrapper) {
41937                    this.renderConfig.dpr = (config && config.dpr) || window.devicePixelRatio || 1;
41938                }
41939                this.renderedFrame = -1;
41940                this.globalData = {
41941                    frameNum: -1,
41942                    _mdf: false,
41943                    renderConfig: this.renderConfig,
41944                    currentGlobalAlpha: -1
41945                };
41946                this.contextData = new CVContextData();
41947                this.elements = [];
41948                this.pendingElements = [];
41949                this.transformMat = new Matrix();
41950                this.completeLayers = false;
41951                this.rendererType = 'canvas';
41952            }
41953
41954            extendPrototype([BaseRenderer], CanvasRenderer);
41955
41956            CanvasRenderer.prototype.createShape = function (data) {
41957                return new CVShapeElement(data, this.globalData, this);
41958            };
41959
41960            CanvasRenderer.prototype.createText = function (data) {
41961                return new CVTextElement(data, this.globalData, this);
41962            };
41963
41964            CanvasRenderer.prototype.createImage = function (data) {
41965                return new CVImageElement(data, this.globalData, this);
41966            };
41967
41968            CanvasRenderer.prototype.createComp = function (data) {
41969                return new CVCompElement(data, this.globalData, this);
41970            };
41971
41972            CanvasRenderer.prototype.createSolid = function (data) {
41973                return new CVSolidElement(data, this.globalData, this);
41974            };
41975
41976            CanvasRenderer.prototype.createNull = SVGRenderer.prototype.createNull;
41977
41978            CanvasRenderer.prototype.ctxTransform = function (props) {
41979                if (props[0] === 1 && props[1] === 0 && props[4] === 0 && props[5] === 1 && props[12] === 0 && props[13] === 0) {
41980                    return;
41981                }
41982                if (!this.renderConfig.clearCanvas) {
41983                    this.canvasContext.transform(props[0], props[1], props[4], props[5], props[12], props[13]);
41984                    return;
41985                }
41986                this.transformMat.cloneFromProps(props);
41987                var cProps = this.contextData.cTr.props;
41988                this.transformMat.transform(cProps[0], cProps[1], cProps[2], cProps[3], cProps[4], cProps[5], cProps[6], cProps[7], cProps[8], cProps[9], cProps[10], cProps[11], cProps[12], cProps[13], cProps[14], cProps[15]);
41989                //this.contextData.cTr.transform(props[0],props[1],props[2],props[3],props[4],props[5],props[6],props[7],props[8],props[9],props[10],props[11],props[12],props[13],props[14],props[15]);
41990                this.contextData.cTr.cloneFromProps(this.transformMat.props);
41991                var trProps = this.contextData.cTr.props;
41992                this.canvasContext.setTransform(trProps[0], trProps[1], trProps[4], trProps[5], trProps[12], trProps[13]);
41993            };
41994
41995            CanvasRenderer.prototype.ctxOpacity = function (op) {
41996                /*if(op === 1){
41997        return;
41998    }*/
41999                if (!this.renderConfig.clearCanvas) {
42000                    this.canvasContext.globalAlpha *= op < 0 ? 0 : op;
42001                    this.globalData.currentGlobalAlpha = this.contextData.cO;
42002                    return;
42003                }
42004                this.contextData.cO *= op < 0 ? 0 : op;
42005                if (this.globalData.currentGlobalAlpha !== this.contextData.cO) {
42006                    this.canvasContext.globalAlpha = this.contextData.cO;
42007                    this.globalData.currentGlobalAlpha = this.contextData.cO;
42008                }
42009            };
42010
42011            CanvasRenderer.prototype.reset = function () {
42012                if (!this.renderConfig.clearCanvas) {
42013                    this.canvasContext.restore();
42014                    return;
42015                }
42016                this.contextData.reset();
42017            };
42018
42019            CanvasRenderer.prototype.save = function (actionFlag) {
42020                if (!this.renderConfig.clearCanvas) {
42021                    this.canvasContext.save();
42022                    return;
42023                }
42024                if (actionFlag) {
42025                    this.canvasContext.save();
42026                }
42027                var props = this.contextData.cTr.props;
42028                if (this.contextData._length <= this.contextData.cArrPos) {
42029                    this.contextData.duplicate();
42030                }
42031                var i, arr = this.contextData.saved[this.contextData.cArrPos];
42032                for (i = 0; i < 16; i += 1) {
42033                    arr[i] = props[i];
42034                }
42035                this.contextData.savedOp[this.contextData.cArrPos] = this.contextData.cO;
42036                this.contextData.cArrPos += 1;
42037            };
42038
42039            CanvasRenderer.prototype.restore = function (actionFlag) {
42040                if (!this.renderConfig.clearCanvas) {
42041                    this.canvasContext.restore();
42042                    return;
42043                }
42044                if (actionFlag) {
42045                    this.canvasContext.restore();
42046                    this.globalData.blendMode = 'source-over';
42047                }
42048                this.contextData.cArrPos -= 1;
42049                var popped = this.contextData.saved[this.contextData.cArrPos];
42050                var i, arr = this.contextData.cTr.props;
42051                for (i = 0; i < 16; i += 1) {
42052                    arr[i] = popped[i];
42053                }
42054                this.canvasContext.setTransform(popped[0], popped[1], popped[4], popped[5], popped[12], popped[13]);
42055                popped = this.contextData.savedOp[this.contextData.cArrPos];
42056                this.contextData.cO = popped;
42057                if (this.globalData.currentGlobalAlpha !== popped) {
42058                    this.canvasContext.globalAlpha = popped;
42059                    this.globalData.currentGlobalAlpha = popped;
42060                }
42061            };
42062
42063            CanvasRenderer.prototype.configAnimation = function (animData) {
42064                if (this.animationItem.wrapper) {
42065                    this.animationItem.container = createTag('canvas');
42066                    this.animationItem.container.style.width = '100%';
42067                    this.animationItem.container.style.height = '100%';
42068                    //this.animationItem.container.style.transform = 'translate3d(0,
420680,0)';
42069                    //this.animationItem.container.style.webkitTransform = 'translate3d(0,0,0)';
42070                    this.animationItem.container.style.transformOrigin = this.animationItem.container.style.mozTransformOrigin = this.animationItem.container.style.webkitTransformOrigin = this.animationItem.container.style['-webkit-transform'] = "0px 0px 0px";
42071                    this.animationItem.wrapper.appendChild(this.animationItem.container);
42072                    this.canvasContext = this.animationItem.container.getContext('2d');
42073                    if (this.renderConfig.className) {
42074                        this.animationItem.container.setAttribute('class', this.renderConfig.className);
42075                    }
42076                    if (this.renderConfig.id) {
42077                        this.animationItem.container.setAttribute('id', this.renderConfig.id);
42078                    }
42079                } else {
42080                    this.canvasContext = this.renderConfig.context;
42081                }
42082                this.data = animData;
42083                this.layers = animData.layers;
42084                this.transformCanvas = {
42085                    w: animData.w,
42086                    h: animData.h,
42087                    sx: 0,
42088                    sy: 0,
42089                    tx: 0,
42090                    ty: 0
42091                };
42092                this.setupGlobalData(animData, document.body);
42093                this.globalData.canvasContext = this.canvasContext;
42094                this.globalData.renderer = this;
42095                this.globalData.isDashed = false;
42096                this.globalData.progressiveLoad = this.renderConfig.progressiveLoad;
42097                this.globalData.transformCanvas = this.transformCanvas;
42098                this.elements = createSizedArray(animData.layers.length);
42099
42100                this.updateContainerSize();
42101            };
42102
42103            CanvasRenderer.prototype.updateContainerSize = function () {
42104                this.reset();
42105                var elementWidth, elementHeight;
42106                if (this.animationItem.wrapper && this.animationItem.container) {
42107                    elementWidth = this.animationItem.wrapper.offsetWidth;
42108                    elementHeight = this.animationItem.wrapper.offsetHeight;
42109                    this.animationItem.container.setAttribute('width', elementWidth * this.renderConfig.dpr);
42110                    this.animationItem.container.setAttribute('height', elementHeight * this.renderConfig.dpr);
42111                } else {
42112                    elementWidth = this.canvasContext.canvas.width * this.renderConfig.dpr;
42113                    elementHeight = this.canvasContext.canvas.height * this.renderConfig.dpr;
42114                }
42115                var elementRel, animationRel;
42116                if (this.renderConfig.preserveAspectRatio.indexOf('meet') !== -1 || this.renderConfig.preserveAspectRatio.indexOf('slice') !== -1) {
42117                    var par = this.renderConfig.preserveAspectRatio.split(' ');
42118                    var fillType = par[1] || 'meet';
42119                    var pos = par[0] || 'xMidYMid';
42120                    var xPos = pos.substr(0, 4);
42121                    var yPos = pos.substr(4);
42122                    elementRel = elementWidth / elementHeight;
42123                    animationRel = this.transformCanvas.w / this.transformCanvas.h;
42124                    if (animationRel > elementRel && fillType === 'meet' || animationRel < elementRel && fillType === 'slice') {
42125                        this.transformCanvas.sx = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr);
42126                        this.transformCanvas.sy = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr);
42127                    } else {
42128                        this.transformCanvas.sx = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr);
42129                        this.transformCanvas.sy = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr);
42130                    }
42131
42132                    if (xPos === 'xMid' && ((animationRel < elementRel && fillType === 'meet') || (animationRel > elementRel && fillType === 'slice'))) {
42133                        this.transformCanvas.tx = (elementWidth - this.transformCanvas.w * (elementHeight / this.transformCanvas.h)) / 2 * this.renderConfig.dpr;
42134                    } else if (xPos === 'xMax' && ((animationRel < elementRel && fillType === 'meet') || (animationRel > elementRel && fillType === 'slice'))) {
42135                        this.transformCanvas.tx = (elementWidth - this.transformCanvas.w * (elementHeight / this.transformCanvas.h)) * this.renderConfig.dpr;
42136                    } else {
42137                        this.transformCanvas.tx = 0;
42138                    }
42139                    if (yPos === 'YMid' && ((animationRel > elementRel && fillType === 'meet') || (animationRel < elementRel && fillType === 'slice'))) {
vendor: 4,387 bytes, lines 42140-42223
42140                        this.transformCanvas.ty = ((elementHeight - this.transformCanvas.h * (elementWidth / this.transformCanvas.w)) / 2) * this.renderConfig.dpr;
42141                    } else if (yPos === 'YMax' && ((animationRel > elementRel && fillType === 'meet') || (animationRel < elementRel && fillType === 'slice'))) {
42142                        this.transformCanvas.ty = ((elementHeight - this.transformCanvas.h * (elementWidth / this.transformCanvas.w))) * this.renderConfig.dpr;
42143                    } else {
42144                        this.transformCanvas.ty = 0;
42145                    }
42146
42147                } else if (this.renderConfig.preserveAspectRatio == 'none') {
42148                    this.transformCanvas.sx = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr);
42149                    this.transformCanvas.sy = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr);
42150                    this.transformCanvas.tx = 0;
42151                    this.transformCanvas.ty = 0;
42152                } else {
42153                    this.transformCanvas.sx = this.renderConfig.dpr;
42154                    this.transformCanvas.sy = this.renderConfig.dpr;
42155                    this.transformCanvas.tx = 0;
42156                    this.transformCanvas.ty = 0;
42157                }
42158                this.transformCanvas.props = [this.transformCanvas.sx, 0, 0, 0, 0, this.transformCanvas.sy, 0, 0, 0, 0, 1, 0, this.transformCanvas.tx, this.transformCanvas.ty, 0, 1];
42159                /*var i, len = this.elements.length;
42160    for(i=0;i<len;i+=1){
42161        if(this.elements[i] && this.elements[i].data.ty === 0){
42162            this.elements[i].resize(this.globalData.transformCanvas);
42163        }
42164    }*/
42165                this.ctxTransform(this.transformCanvas.props);
42166                this.canvasContext.beginPath();
42167                this.canvasContext.rect(0, 0, this.transformCanvas.w, this.transformCanvas.h);
42168                this.canvasContext.closePath();
42169                this.canvasContext.clip();
42170
42171                this.renderFrame(this.renderedFrame, true);
42172            };
42173
42174            CanvasRenderer.prototype.destroy = function () {
42175                if (this.renderConfig.clearCanvas) {
42176                    this.animationItem.wrapper.innerText = '';
42177                }
42178                var i, len = this.layers ? this.layers.length : 0;
42179                for (i = len - 1; i >= 0; i -= 1) {
42180                    if (this.elements[i]) {
42181                        this.elements[i].destroy();
42182                    }
42183                }
42184                this.elements.length = 0;
42185                this.globalData.canvasContext = null;
42186                this.animationItem.container = null;
42187                this.destroyed = true;
42188            };
42189
42190            CanvasRenderer.prototype.renderFrame = function (num, forceRender) {
42191                if ((this.renderedFrame === num && this.renderConfig.clearCanvas === true && !forceRender) || this.destroyed || num === -1) {
42192                    return;
42193                }
42194                this.renderedFrame = num;
42195                this.globalData.frameNum = num - this.animationItem._isFirstFrame;
42196                this.globalData.frameId += 1;
42197                this.globalData._mdf = !this.renderConfig.clearCanvas || forceRender;
42198                this.globalData.projectInterface.currentFrame = num;
42199
42200                // console.log('--------');
42201                // console.log('NEW: ',num);
42202                var i, len = this.layers.length;
42203                if (!this.completeLayers) {
42204                    this.checkLayers(num);
42205                }
42206
42207                for (i = 0; i < len; i++) {
42208                    if (this.completeLayers || this.elements[i]) {
42209                        this.elements[i].prepareFrame(num - this.layers[i].st);
42210                    }
42211                }
42212                if (this.globalData._mdf) {
42213                    if (this.renderConfig.clearCanvas === true) {
42214                        this.canvasContext.clearRect(0, 0, this.transformCanvas.w, this.transformCanvas.h);
42215                    } else {
42216                        this.save();
42217                    }
42218                    for (i = len - 1; i >= 0; i -= 1) {
42219                        if (this.completeLayers || this.elements[i]) {
42220                            this.elements[i].renderFrame();
42221                        }
42222                    }
42223                    if (this.renderConfig.clearCanvas !== true) {
42224                        this.restore();
42225                    }
42226                }
42227            };
42228
42229            CanvasRenderer.prototype.buildItem = function (pos) {
42230                var elements = this.elements;
42231                if (elements[pos] || this.layers[pos].ty == 99) {
42232                    return;
42233                }
42234                var element = this.createItem(this.layers[pos], this, this.globalData);
42235                elements[pos] = element;
42236                element.initExpressions();
42237                /*if(this.layers[pos].ty === 0){
42238        element.resize(this.globalData.transformCanvas);
42239    }*/
42240            };
42241
42242            CanvasRenderer.prototype.checkPendingElements = function () {
42243                while (this.pendingElements.length) {
42244                    var element = this.pendingElements.pop();
42245                    element.checkParenting();
42246                }
42247            };
42248
42249            CanvasRenderer.prototype.hide = function () {
42250                this.animationItem.container.style.display = 'none';
42251            };
42252
42253            CanvasRenderer.prototype.show = function () {
42254                this.animationItem.container.style.display = 'block';
42255            };
42256
42257            function HybridRenderer(animationItem, config) {
42258                this.animationItem = animationItem;
42259                this.layers = null;
42260                this.renderedFrame = -1;
42261                this.renderConfig = {
42262                    className: (config && config.className) || '',
42263                    imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice',
42264                    hideOnTransparent: (config && config.hideOnTransparent === false) ? false : true,
42265                    filterSize: {
42266                        width: config && config.filterSize && config.filterSize.width || '400%',
42267                        height: config && config.filterSize && config.filterSize.height || '400%',
42268                        x: config && config.filterSize && config.filterSize.x || '-100%',
42269                        y: config && config.filterSize && config.filterSize.y || '-100%',
42270                    }
42271                };
42272                this.globalData = {
42273                    _mdf: false,
42274                    frameNum: -1,
42275                    renderConfig: this.renderConfig
42276                };
42277                this.pendingElements = [];
42278                this.elements = [];
42279                this.threeDElements = [];
42280                this.destroyed = false;
42281                this.camera = null;
42282                this.supports3d = true;
42283                this.rendererType = 'html';
42284
42285            }
42286
42287            extendPrototype([BaseRenderer], HybridRenderer);
42288
42289            HybridRenderer.prototype.buildItem = SVGRenderer.prototype.buildItem;
42290
42291            HybridRenderer.prototype.checkPendingElements = function () {
42292                while (this.pendingElements.length) {
42293                    var element = this.pendingElements.pop();
42294                    element.checkParenting();
42295                }
42296            };
42297
42298            HybridRenderer.prototype.appendElementInPos = function (element, pos) {
42299                var newDOMElement = element.getBaseElement();
42300                if (!newDOMElement) {
42301                    return;
42302                }
42303                var layer = this.layers[pos];
42304                if (!layer.ddd || !this.supports3d) {
42305                    if (this.threeDElements) {
42306                        this.addTo3dContainer(newDOMElement, pos);
42307                    } else {
42308                        var i = 0;
42309                        var nextDOMElement, nextLayer, tmpDOMElement;
42310                        while (i < pos) {
42311                            if (this.elements[i] && this.elements[i] !== true && this.elements[i].getBaseElement) {
42312                                nextLayer = this.elements[i];
42313                                tmpDOMElement = this.layers[i].ddd ? this.getThreeDContainerByPos(i) : nextLayer.getBaseElement();
42314                                nextDOMElement = tmpDOMElement || nextDOMElement;
42315                            }
42316                            i += 1;
42317                        }
42318                        if (nextDOMElement) {
42319                            if (!layer.ddd || !this.supports3d) {
42320                                this.layerElement.insertBefore(newDOMElement, nextDOMElement);
42321                            }
42322                        } else {
42323                            if (!layer.ddd || !this.supports3d) {
42324                                this.layerElement.appendChild(newDOMElement);
42325                            }
42326                        }
42327                    }
42328
42329                } else {
vendor: 11,545 bytes, lines 42330-42577
42330                    this.addTo3dContainer(newDOMElement, pos);
42331                }
42332            };
42333
42334            HybridRenderer.prototype.createShape = function (data) {
42335                if (!this.supports3d) {
42336                    return new SVGShapeElement(data, this.globalData, this);
42337                }
42338                return new HShapeElement(data, this.globalData, this);
42339            };
42340
42341            HybridRenderer.prototype.createText = function (data) {
42342                if (!this.supports3d) {
42343                    return new SVGTextElement(data, this.globalData, this);
42344                }
42345                return new HTextElement(data, this.globalData, this);
42346            };
42347
42348            HybridRenderer.prototype.createCamera = function (data) {
42349                this.camera = new HCameraElement(data, this.globalData, this);
42350                return this.camera;
42351            };
42352
42353            HybridRenderer.prototype.createImage = function (data) {
42354                if (!this.supports3d) {
42355                    return new IImageElement(data, this.globalData, this);
42356                }
42357                return new HImageElement(data, this.globalData, this);
42358            };
42359
42360            HybridRenderer.prototype.createComp = function (data) {
42361                if (!this.supports3d) {
42362                    return new SVGCompElement(data, this.globalData, this);
42363                }
42364                return new HCompElement(data, this.globalData, this);
42365
42366            };
42367
42368            HybridRenderer.prototype.createSolid = function (data) {
42369                if (!this.supports3d) {
42370                    return new ISolidElement(data, this.globalData, this);
42371                }
42372                return new HSolidElement(data, this.globalData, this);
42373            };
42374
42375            HybridRenderer.prototype.createNull = SVGRenderer.prototype.createNull;
42376
42377            HybridRenderer.prototype.getThreeDContainerByPos = function (pos) {
42378                var i = 0, len = this.threeDElements.length;
42379                while (i < len) {
42380                    if (this.threeDElements[i].startPos <= pos && this.threeDElements[i].endPos >= pos) {
42381                        return this.threeDElements[i].perspectiveElem;
42382                    }
42383                    i += 1;
42384                }
42385            };
42386
42387            HybridRenderer.prototype.createThreeDContainer = function (pos, type) {
42388                var perspectiveElem = createTag('div');
42389                styleDiv(perspectiveElem);
42390                var container = createTag('div');
42391                styleDiv(container);
42392                if (type === '3d') {
42393                    perspectiveElem.style.width = this.globalData.compSize.w + 'px';
42394                    perspectiveElem.style.height = this.globalData.compSize.h + 'px';
42395                    perspectiveElem.style.transformOrigin = perspectiveElem.style.mozTransformOrigin = perspectiveElem.style.webkitTransformOrigin = "50% 50%";
42396                    container.style.transform = container.style.webkitTransform = 'matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)';
42397                }
42398
42399                perspectiveElem.appendChild(container);
42400                //this.resizerElem.appendChild(perspectiveElem);
42401                var threeDContainerData = {
42402                    container: container,
42403                    perspectiveElem: perspectiveElem,
42404                    startPos: pos,
42405                    endPos: pos,
42406                    type: type
42407                };
42408                this.threeDElements.push(threeDContainerData);
42409                return threeDContainerData;
42410            };
42411
42412            HybridRenderer.prototype.build3dContainers = function () {
42413                var i, len = this.layers.length;
42414                var lastThreeDContainerData;
42415                var currentContainer = '';
42416                for (i = 0; i < len; i += 1) {
42417                    if (this.layers[i].ddd && this.layers[i].ty !== 3) {
42418                        if (currentContainer !== '3d') {
42419                            currentContainer = '3d';
42420                            lastThreeDContainerData = this.createThreeDContainer(i, '3d');
42421                        }
42422                        lastThreeDContainerData.endPos = Math.max(lastThreeDContainerData.endPos, i);
42423                    } else {
42424                        if (currentContainer !== '2d') {
42425                            currentContainer = '2d';
42426                            lastThreeDContainerData = this.createThreeDContainer(i, '2d');
42427                        }
42428                        lastThreeDContainerData.endPos = Math.max(lastThreeDContainerData.endPos, i);
42429                    }
42430                }
42431                len = this.threeDElements.length;
42432                for (i = len - 1; i >= 0; i--) {
42433                    this.resizerElem.appendChild(this.threeDElements[i].perspectiveElem);
42434                }
42435            };
42436
42437            HybridRenderer.prototype.addTo3dContainer = function (elem, pos) {
42438                var i = 0, len = this.threeDElements.length;
42439                while (i < len) {
42440                    if (pos <= this.threeDElements[i].endPos) {
42441                        var j = this.threeDElements[i].startPos;
42442                        var nextElement;
42443                        while (j < pos) {
42444                            if (this.elements[j] && this.elements[j].getBaseElement) {
42445                                nextElement = this.elements[j].getBaseElement();
42446                            }
42447                            j += 1;
42448                        }
42449                        if (nextElement) {
42450                            this.threeDElements[i].container.insertBefore(elem, nextElement);
42451                        } else {
42452                            this.threeDElements[i].container.appendChild(elem);
42453                        }
42454                        break;
42455                    }
42456                    i += 1;
42457                }
42458            };
42459
42460            HybridRenderer.prototype.configAnimation = function (animData) {
42461                var resizerElem = createTag('div');
42462                var wrapper = this.animationItem.wrapper;
42463                resizerElem.style.width = animData.w + 'px';
42464                resizerElem.style.height = animData.h + 'px';
42465                this.resizerElem = resizerElem;
42466                styleDiv(resizerElem);
42467                resizerElem.style.transformStyle = resizerElem.style.webkitTransformStyle = resizerElem.style.mozTransformStyle = "flat";
42468                if (this.renderConfig.className) {
42469                    resizerElem.setAttribute('class', this.renderConfig.className);
42470                }
42471                wrapper.appendChild(resizerElem);
42472
42473                resizerElem.style.overflow = 'hidden';
42474                var svg = createNS('svg');
42475                svg.setAttribute('width', '1');
42476                svg.setAttribute('height', '1');
42477                styleDiv(svg);
42478                this.resizerElem.appendChild(svg);
42479                var defs = createNS('defs');
42480                svg.appendChild(defs);
42481                this.data = animData;
42482                //Mask animation
42483                this.setupGlobalData(animData, svg);
42484                this.globalData.defs = defs;
42485                this.layers = animData.layers;
42486                this.layerElement = this.resizerElem;
42487                this.build3dContainers();
42488                this.updateContainerSize();
42489            };
42490
42491            HybridRenderer.prototype.destroy = function () {
42492                this.animationItem.wrapper.innerText = '';
42493                this.animationItem.container = null;
42494                this.globalData.defs = null;
42495                var i, len = this.layers ? this.layers.length : 0;
42496                for (i = 0; i < len; i++) {
42497                    this.elements[i].destroy();
42498                }
42499                this.elements.length = 0;
42500                this.destroyed = true;
42501                this.animationItem = null;
42502            };
42503
42504            HybridRenderer.prototype.updateContainerSize = function () {
42505                var elementWidth = this.animationItem.wrapper.offsetWidth;
42506                var elementHeight = this.animationItem.wrapper.offsetHeight;
42507                var elementRel = elementWidth / elementHeight;
42508                var animationRel = this.globalData.compSize.w / this.globalData.compSize.h;
42509                var sx, sy, tx, ty;
42510                if (animationRel > elementRel) {
42511                    sx = elementWidth / (this.globalData.compSize.w);
42512                    sy = elementWidth / (this.globalData.compSize.w);
42513                    tx = 0;
42514                    ty = ((elementHeight - this.globalData.compSize.h * (elementWidth / this.globalData.compSize.w)) / 2);
42515                } else {
42516                    sx = elementHeight / (this.globalData.compSize.h);
42517                    sy = elementHeight / (this.globalData.compSize.h);
42518                    tx = (elementWidth - this.globalData.compSize.w * (elementHeight / this.globalData.compSize.h)) / 2;
42519                    ty = 0;
42520                }
42521                this.resizerElem.style.transform = this.resizerElem.style.webkitTransform = 'matrix3d(' + sx + ',0,0,0,0,' + sy + ',0,0,0,0,1,0,' + tx + ',' + ty + ',0,1)';
42522            };
42523
42524            HybridRenderer.prototype.renderFrame = SVGRenderer.prototype.renderFrame;
42525
42526            HybridRenderer.prototype.hide = function () {
42527                this.resizerElem.style.display = 'none';
42528            };
42529
42530            HybridRenderer.prototype.show = function () {
42531                this.resizerElem.style.display = 'block';
42532            };
42533
42534            HybridRenderer.prototype.initItems = function () {
42535                this.buildAllItems();
42536                if (this.camera) {
42537                    this.camera.setup();
42538                } else {
42539                    var cWidth = this.globalData.compSize.w;
42540                    var cHeight = this.globalData.compSize.h;
42541                    var i, len = this.threeDElements.length;
42542                    for (i = 0; i < len; i += 1) {
42543                        this.threeDElements[i].perspectiveElem.style.perspective = this.threeDElements[i].perspectiveElem.style.webkitPerspective = Math.sqrt(Math.pow(cWidth, 2) + Math.pow(cHeight, 2)) + 'px';
42544                    }
42545                }
42546            };
42547
42548            HybridRenderer.prototype.searchExtraCompositions = function (assets) {
42549                var i, len = assets.length;
42550                var floatingContainer = createTag('div');
42551                for (i = 0; i < len; i += 1) {
42552                    if (assets[i].xt) {
42553                        var comp = this.createComp(assets[i], floatingContainer, this.globalData.comp, null);
42554                        comp.initExpressions();
42555                        this.globalData.projectInterface.registerComposition(comp);
42556                    }
42557                }
42558            };
42559
42560            function MaskElement(data, element, globalData) {
42561                this.data = data;
42562                this.element = element;
42563                this.globalData = globalData;
42564                this.storedData = [];
42565                this.masksProperties = this.data.masksProperties || [];
42566                this.maskElement = null;
42567                var defs = this.globalData.defs;
42568                var i, len = this.masksProperties ? this.masksProperties.length : 0;
42569                this.viewData = createSizedArray(len);
42570                this.solidPath = '';
42571
42572
42573                var path, properties = this.masksProperties;
42574                var count = 0;
42575                var currentMasks = [];
42576                var j, jLen;
42577                var layerId = createElementID();
vendor: 9,971 bytes, lines 42578-42768
42578                var rect, expansor, feMorph, x;
42579                var maskType = 'clipPath', maskRef = 'clip-path';
42580                for (i = 0; i < len; i++) {
42581                    if ((properties[i].mode !== 'a' && properties[i].mode !== 'n') || properties[i].inv || properties[i].o.k !== 100 || properties[i].o.x) {
42582                        maskType = 'mask';
42583                        maskRef = 'mask';
42584                    }
42585
42586                    if ((properties[i].mode == 's' || properties[i].mode == 'i') && count === 0) {
42587                        rect = createNS('rect');
42588                        rect.setAttribute('fill', '#ffffff');
42589                        rect.setAttribute('width', this.element.comp.data.w || 0);
42590                        rect.setAttribute('height', this.element.comp.data.h || 0);
42591                        currentMasks.push(rect);
42592                    } else {
42593                        rect = null;
42594                    }
42595
42596                    path = createNS('path');
42597                    if (properties[i].mode == 'n') {
42598                        // TODO move this to a factory or to a constructor
42599                        this.viewData[i] = {
42600                            op: PropertyFactory.getProp(this.element, properties[i].o, 0, 0.01, this.element),
42601                            prop: ShapePropertyFactory.getShapeProp(this.element, properties[i], 3),
42602                            elem: path,
42603                            lastPath: ''
42604                        };
42605                        defs.appendChild(path);
42606                        continue;
42607                    }
42608                    count += 1;
42609
42610                    path.setAttribute('fill', properties[i].mode === 's' ? '#000000' : '#ffffff');
42611                    path.setAttribute('clip-rule', 'nonzero');
42612                    var filterID;
42613
42614                    if (properties[i].x.k !== 0) {
42615                        maskType = 'mask';
42616                        maskRef = 'mask';
42617                        x = PropertyFactory.getProp(this.element, properties[i].x, 0, null, this.element);
42618                        filterID = createElementID();
42619                        expansor = createNS('filter');
42620                        expansor.setAttribute('id', filterID);
42621                        feMorph = createNS('feMorphology');
42622                        feMorph.setAttribute('operator', 'erode');
42623                        feMorph.setAttribute('in', 'SourceGraphic');
42624                        feMorph.setAttribute('radius', '0');
42625                        expansor.appendChild(feMorph);
42626                        defs.appendChild(expansor);
42627                        path.setAttribute('stroke', properties[i].mode === 's' ? '#000000' : '#ffffff');
42628                    } else {
42629                        feMorph = null;
42630                        x = null;
42631                    }
42632
42633                    // TODO move this to a factory or to a constructor
42634                    this.storedData[i] = {
42635                        elem: path,
42636                        x: x,
42637                        expan: feMorph,
42638                        lastPath: '',
42639                        lastOperator: '',
42640                        filterId: filterID,
42641                        lastRadius: 0
42642                    };
42643                    if (properties[i].mode == 'i') {
42644                        jLen = currentMasks.length;
42645                        var g = createNS('g');
42646                        for (j = 0; j < jLen; j += 1) {
42647                            g.appendChild(currentMasks[j]);
42648                        }
42649                        var mask = createNS('mask');
42650                        mask.setAttribute('mask-type', 'alpha');
42651                        mask.setAttribute('id', layerId + '_' + count);
42652                        mask.appendChild(path);
42653                        defs.appendChild(mask);
42654                        g.setAttribute('mask', 'url(' + locationHref + '#' + layerId + '_' + count + ')');
42655
42656                        currentMasks.length = 0;
42657                        currentMasks.push(g);
42658                    } else {
42659                        currentMasks.push(path);
42660                    }
42661                    if (properties[i].inv && !this.solidPath) {
42662                        this.solidPath = this.createLayerSolidPath();
42663                    }
42664                    // TODO move this to a factory or to a constructor
42665                    this.viewData[i] = {
42666                        elem: path,
42667                        lastPath: '',
42668                        op: PropertyFactory.getProp(this.element, properties[i].o, 0, 0.01, this.element),
42669                        prop: ShapePropertyFactory.getShapeProp(this.element, properties[i], 3),
42670                        invRect: rect
42671                    };
42672                    if (!this.viewData[i].prop.k) {
42673                        this.drawPath(properties[i], this.viewData[i].prop.v, this.viewData[i]);
42674                    }
42675                }
42676
42677                this.maskElement = createNS(maskType);
42678
42679                len = currentMasks.length;
42680                for (i = 0; i < len; i += 1) {
42681                    this.maskElement.appendChild(currentMasks[i]);
42682                }
42683
42684                if (count > 0) {
42685                    this.maskElement.setAttribute('id', layerId);
42686                    this.element.maskedElement.setAttribute(maskRef, "url(" + locationHref + "#" + layerId + ")");
42687                    defs.appendChild(this.maskElement);
42688                }
42689                if (this.viewData.length) {
42690                    this.element.addRenderableComponent(this);
42691                }
42692
42693            }
42694
42695            MaskElement.prototype.getMaskProperty = function (pos) {
42696                return this.viewData[pos].prop;
42697            };
42698
42699            MaskElement.prototype.renderFrame = function (isFirstFrame) {
42700                var finalMat = this.element.finalTransform.mat;
42701                var i, len = this.masksProperties.length;
42702                for (i = 0; i < len; i++) {
42703                    if (this.viewData[i].prop._mdf || isFirstFrame) {
42704                        this.drawPath(this.masksProperties[i], this.viewData[i].prop.v, this.viewData[i]);
42705                    }
42706                    if (this.viewData[i].op._mdf || isFirstFrame) {
42707                        this.viewData[i].elem.setAttribute('fill-opacity', this.viewData[i].op.v);
42708                    }
42709                    if (this.masksProperties[i].mode !== 'n') {
42710                        if (this.viewData[i].invRect && (this.element.finalTransform.mProp._mdf || isFirstFrame)) {
42711                            this.viewData[i].invRect.setAttribute('transform', finalMat.getInverseMatrix().to2dCSS())
42712                        }
42713                        if (this.storedData[i].x && (this.storedData[i].x._mdf || isFirstFrame)) {
42714                            var feMorph = this.storedData[i].expan;
42715                            if (this.storedData[i].x.v < 0) {
42716                                if (this.storedData[i].lastOperator !== 'erode') {
42717                                    this.storedData[i].lastOperator = 'erode';
42718                                    this.storedData[i].elem.setAttribute('filter', 'url(' + locationHref + '#' + this.storedData[i].filterId + ')');
42719                                }
42720                                feMorph.setAttribute('radius', -this.storedData[i].x.v);
42721                            } else {
42722                                if (this.storedData[i].lastOperator !== 'dilate') {
42723                                    this.storedData[i].lastOperator = 'dilate';
42724                                    this.storedData[i].elem.setAttribute('filter', null);
42725                                }
42726                                this.storedData[i].elem.setAttribute('stroke-width', this.storedData[i].x.v * 2);
42727
42728                            }
42729                        }
42730                    }
42731                }
42732            };
42733
42734            MaskElement.prototype.getMaskelement = function () {
42735                return this.maskElement;
42736            };
42737
42738            MaskElement.prototype.createLayerSolidPath = function () {
42739                var path = 'M0,0 ';
42740                path += ' h' + this.globalData.compSize.w;
42741                path += ' v' + this.globalData.compSize.h;
42742                path += ' h-' + this.globalData.compSize.w;
42743                path += ' v-' + this.globalData.compSize.h + ' ';
42744                return path;
42745            };
42746
42747            MaskElement.prototype.drawPath = function (pathData, pathNodes, viewData) {
42748                var pathString = " M" + pathNodes.v[0][0] + ',' + pathNodes.v[0][1];
42749                var i, len;
42750                len = pathNodes._length;
42751                for (i = 1; i < len; i += 1) {
42752                    //pathString += " C"+pathNodes.o[i-1][0]+','+pathNodes.o[i-1][1] + " "+pathNodes.i[i][0]+','+pathNodes.i[i][1] + " "+pathNodes.v[i][0]+','+pathNodes.v[i][1];
42753                    pathString += " C" + pathNodes.o[i - 1][0] + ',' + pathNodes.o[i - 1][1] + " " + pathNodes.i[i][0] + ',' + pathNodes.i[i][1] + " " + pathNodes.v[i][0] + ',' + pathNodes.v[i][1];
42754                }
42755                //pathString += " C"+pathNodes.o[i-1][0]+','+pathNodes.o[i-1][1] + " "+pathNodes.i[0][0]+','+pathNodes.i[0][1] + " "+pathNodes.v[0][0]+','+pathNodes.v[0][1];
42756                if (pathNodes.c && len > 1) {
42757                    pathString += " C" + pathNodes.o[i - 1][0] + ',' + pathNodes.o[i - 1][1] + " " + pathNodes.i[0][0] + ',' + pathNodes.i[0][1] + " " + pathNodes.v[0][0] + ',' + pathNodes.v[0][1];
42758                }
42759                //pathNodes.__renderedString = pathString;
42760
42761                if (viewData.lastPath !== pathString) {
42762                    var pathShapeValue = '';
42763                    if (viewData.elem) {
42764                        if (pathNodes.c) {
42765                            pathShapeValue = pathData.inv ? this.solidPath + pathString : pathString;
42766                        }
42767                        viewData.elem.setAttribute('d', pathShapeValue);
42768                    }
vendor: 7,014 bytes, lines 42769-42948
42769                    viewData.lastPath = pathString;
42770                }
42771            };
42772
42773            MaskElement.prototype.destroy = function () {
42774                this.element = null;
42775                this.globalData = null;
42776                this.maskElement = null;
42777                this.data = null;
42778                this.masksProperties = null;
42779            };
42780
42781            /**
42782             * @file
42783             * Handles AE's layer parenting property.
42784             *
42785             */
42786
42787            function HierarchyElement() {
42788            }
42789
42790            HierarchyElement.prototype = {
42791                /**
42792                 * @function
42793                 * Initializes hierarchy properties
42794                 *
42795                 */
42796                initHierarchy: function () {
42797                    //element's parent list
42798                    this.hierarchy = [];
42799                    //if element is parent of another layer _isParent will be true
42800                    this._isParent = false;
42801                    this.checkParenting();
42802                },
42803                /**
42804                 * @function
42805                 * Sets layer's hierarchy.
42806                 * @param {array} hierarch
42807                 * layer's parent list
42808                 *
42809                 */
42810                setHierarchy: function (hierarchy) {
42811                    this.hierarchy = hierarchy;
42812                },
42813                /**
42814                 * @function
42815                 * Sets layer as parent.
42816                 *
42817                 */
42818                setAsParent: function () {
42819                    this._isParent = true;
42820                },
42821                /**
42822                 * @function
42823                 * Searches layer's parenting chain
42824                 *
42825                 */
42826                checkParenting: function () {
42827                    if (this.data.parent !== undefined) {
42828                        this.comp.buildElementParenting(this, this.data.parent, []);
42829                    }
42830                }
42831            };
42832
42833            /**
42834             * @file
42835             * Handles element's layer frame update.
42836             * Checks layer in point and out point
42837             *
42838             */
42839
42840            function FrameElement() {
42841            }
42842
42843            FrameElement.prototype = {
42844                /**
42845                 * @function
42846                 * Initializes frame related properties.
42847                 *
42848                 */
42849                initFrame: function () {
42850                    //set to true when inpoint is rendered
42851                    this._isFirstFrame = false;
42852                    //list of animated properties
42853                    this.dynamicProperties = [];
42854                    // If layer has been modified in current tick this will be true
42855                    this._mdf = false;
42856                },
42857                /**
42858                 * @function
42859                 * Calculates all dynamic values
42860                 *
42861                 * @param {number} num
42862                 * current frame number in Layer's time
42863                 * @param {boolean} isVisible
42864                 * if layers is currently in range
42865                 *
42866                 */
42867                prepareProperties: function (num, isVisible) {
42868                    var i, len = this.dynamicProperties.length;
42869                    for (i = 0; i < len; i += 1) {
42870                        if (isVisible || (this._isParent && this.dynamicProperties[i].propType === 'transform')) {
42871                            this.dynamicProperties[i].getValue();
42872                            if (this.dynamicProperties[i]._mdf) {
42873                                this.globalData._mdf = true;
42874                                this._mdf = true;
42875                            }
42876                        }
42877                    }
42878                },
42879                addDynamicProperty: function (prop) {
42880                    if (this.dynamicProperties.indexOf(prop) === -1) {
42881                        this.dynamicProperties.push(prop);
42882                    }
42883                }
42884            };
42885
42886            function TransformElement() {
42887            }
42888
42889            TransformElement.prototype = {
42890                initTransform: function () {
42891                    this.finalTransform = {
42892                        mProp: this.data.ks ? TransformPropertyFactory.getTransformProperty(this, this.data.ks, this) : {o: 0},
42893                        _matMdf: false,
42894                        _opMdf: false,
42895                        mat: new Matrix()
42896                    };
42897                    if (this.data.ao) {
42898                        this.finalTransform.mProp.autoOriented = true;
42899                    }
42900
42901                    //TODO: check TYPE 11: Guided elements
42902                    if (this.data.ty !== 11) {
42903                        //this.createElements();
42904                    }
42905                },
42906                renderTransform: function () {
42907
42908                    this.finalTransform._opMdf = this.finalTransform.mProp.o._mdf || this._isFirstFrame;
42909                    this.finalTransform._matMdf = this.finalTransform.mProp._mdf || this._isFirstFrame;
42910
42911                    if (this.hierarchy) {
42912                        var mat;
42913                        var finalMat = this.finalTransform.mat;
42914                        var i = 0, len = this.hierarchy.length;
42915                        //Checking if any of the transformation matrices in the hierarchy chain has changed.
42916                        if (!this.finalTransform._matMdf) {
42917                            while (i < len) {
42918                                if (this.hierarchy[i].finalTransform.mProp._mdf) {
42919                                    this.finalTransform._matMdf = true;
42920                                    break;
42921                                }
42922                                i += 1;
42923                            }
42924                        }
42925
42926                        if (this.finalTransform._matMdf) {
42927                            mat = this.finalTransform.mProp.v.props;
42928                            finalMat.cloneFromProps(mat);
42929                            for (i = 0; i < len; i += 1) {
42930                                mat = this.hierarchy[i].finalTransform.mProp.v.props;
42931                                finalMat.transform(mat[0], mat[1], mat[2], mat[3], mat[4], mat[5], mat[6], mat[7], mat[8], mat[9], mat[10], mat[11], mat[12], mat[13], mat[14], mat[15]);
42932                            }
42933                        }
42934                    }
42935                },
42936                globalToLocal: function (pt) {
42937                    var transforms = [];
42938                    transforms.push(this.finalTransform);
42939                    var flag = true;
42940                    var comp = this.comp;
42941                    while (flag) {
42942                        if (comp.finalTransform) {
42943                            if (comp.data.hasMask) {
42944                                transforms.splice(0, 0, comp.finalTransform);
42945                            }
42946                            comp = comp.comp;
42947                        } else {
42948                            flag = false;
42949                        }
42950                    }
42951                    var i, len = transforms.length, ptNew;
42952                    for (i = 0; i < len; i += 1) {
42953                        ptNew = transforms[i].mat.applyToPointArray(0, 0, 0);
42954                        //ptNew = transforms[i].mat.applyToPointArray(pt[0],pt[1],pt[2]);
42955                        pt = [pt[0] - ptNew[0], pt[1] - ptNew[1], 0];
42956                    }
42957                    return pt;
42958                },
42959                mHelper: new Matrix()
42960            };
42961
42962            function RenderableElement() {
42963
42964            }
42965
42966            RenderableElement.prototype = {
42967                initRenderable: function () {
42968                    //layer's visibility related to inpoint and outpoint. Rename isVisible to isInRange
42969                    this.isInRange = false;
42970                    //layer's display state
42971                    this.hidden = false;
42972                    // If layer's transparency equals 0, it can be hidden
42973                    this.isTransparent = false;
42974                    //list of animated components
42975                    this.renderableComponents = [];
42976                },
42977                addRenderableComponent: function (component) {
42978                    if (this.renderableComponents.indexOf(component) === -1) {
42979                        this.renderableComponents.push(component);
42980                    }
42981                },
42982                removeRenderableComponent: function (component) {
42983                    if (this.renderableComponents.indexOf(component) !== -1) {
42984                        this.renderableComponents.splice(this.renderableComponents.indexOf(component), 1);
42985                    }
42986                },
42987                prepareRenderableFrame: function (num) {
42988                    this.checkLayerLimits(num);
42989                },
42990                checkTransparency: function () {
42991                    if (this.finalTransform.mProp.o.v <= 0) {
42992                        if (!this.isTransparent && this.globalData.renderConfig.hideOnTransparent) {
42993                            this.isTransparent = true;
42994                            this.hide();
42995                        }
42996                    } else if (this.isTransparent) {
42997                        this.isTransparent = false;
42998                        this.show();
42999                    }
43000                },
43001                /**
43002                 * @function
43003                 * Initializes frame related properties.
43004                 *
43005                 * @param {number} num
43006                 * current frame number in Layer's time
43007                 *
43008                 */
43009                checkLayerLimits: function (num) {
43010                    if (this.data.ip - this.data.st <= num && this.data.op - this.data.st > num) {
43011                        if (this.isInRange !== true) {
43012                            this.globalData._mdf = true;
43013                            this._mdf = true;
43014                            this.isInRange = true;
43015                            this.show();
43016                        }
43017                    } else {
43018                        if (this.isInRange !== false) {
43019                            this.globalData._mdf = true;
43020                            this.isInRange = false;
43021                            this.hide();
43022                        }
43023                    }
43024                },
43025                renderRenderable: function () {
43026                    var i, len = this.renderableComponents.length;
43027                    for (i = 0; i < len; i += 1) {
43028                        this.renderableComponents[i].renderFrame(this._isFirstFrame);
43029                    }
43030                    /*this.maskManager.renderFrame(this.finalTransform.mat);
43031        this.renderableEffectsManager.renderFrame(this._isFirstFrame);*/
43032                },
43033                sourceRectAtTime: function () {
43034                    return {
43035                        top: 0,
43036                        left: 0,
43037                        width: 100,
43038                        height: 100
43039                    };
43040                },
43041                getLayerSize: function () {
43042                    if (this.data.ty === 5) {
43043                        return {w: this.data.textData.width, h: this.data.textData.height};
43044                    } else {
43045                        return {w: this.data.width, h: this.data.height};
43046                    }
43047                }
43048            };
43049
vendor: 20,573 bytes, lines 43050-43470
43050            function RenderableDOMElement() {
43051            }
43052
43053            (function () {
43054                var _prototype = {
43055                    initElement: function (data, globalData, comp) {
43056                        this.initFrame();
43057                        this.initBaseData(data, globalData, comp);
43058                        this.initTransform(data, globalData, comp);
43059                        this.initHierarchy();
43060                        this.initRenderable();
43061                        this.initRendererElement();
43062                        this.createContainerElements();
43063                        this.createRenderableComponents();
43064                        this.createContent();
43065                        this.hide();
43066                    },
43067                    hide: function () {
43068                        if (!this.hidden && (!this.isInRange || this.isTransparent)) {
43069                            var elem = this.baseElement || this.layerElement;
43070                            elem.style.display = 'none';
43071                            this.hidden = true;
43072                        }
43073                    },
43074                    show: function () {
43075                        if (this.isInRange && !this.isTransparent) {
43076                            if (!this.data.hd) {
43077                                var elem = this.baseElement || this.layerElement;
43078                                elem.style.display = 'block';
43079                            }
43080                            this.hidden = false;
43081                            this._isFirstFrame = true;
43082                        }
43083                    },
43084                    renderFrame: function () {
43085                        //If it is exported as hidden (data.hd === true) no need to render
43086                        //If it is not visible no need to render
43087                        if (this.data.hd || this.hidden) {
43088                            return;
43089                        }
43090                        this.renderTransform();
43091                        this.renderRenderable();
43092                        this.renderElement();
43093                        this.renderInnerContent();
43094                        if (this._isFirstFrame) {
43095                            this._isFirstFrame = false;
43096                        }
43097                    },
43098                    renderInnerContent: function () {
43099                    },
43100                    prepareFrame: function (num) {
43101                        this._mdf = false;
43102                        this.prepareRenderableFrame(num);
43103                        this.prepareProperties(num, this.isInRange);
43104                        this.checkTransparency();
43105                    },
43106                    destroy: function () {
43107                        this.innerElem = null;
43108                        this.destroyBaseElement();
43109                    }
43110                };
43111                extendPrototype([RenderableElement, createProxyFunction(_prototype)], RenderableDOMElement);
43112            }());
43113
43114            function ProcessedElement(element, position) {
43115                this.elem = element;
43116                this.pos = position;
43117            }
43118
43119            function SVGStyleData(data, level) {
43120                this.data = data;
43121                this.type = data.ty;
43122                this.d = '';
43123                this.lvl = level;
43124                this._mdf = false;
43125                this.closed = data.hd === true;
43126                this.pElem = createNS('path');
43127                this.msElem = null;
43128            }
43129
43130            SVGStyleData.prototype.reset = function () {
43131                this.d = '';
43132                this._mdf = false;
43133            };
43134
43135            function SVGShapeData(transformers, level, shape) {
43136                this.caches = [];
43137                this.styles = [];
43138                this.transformers = transformers;
43139                this.lStr = '';
43140                this.sh = shape;
43141                this.lvl = level;
43142                //TODO find if there are some cases where _isAnimated can be false.
43143                // For now, since shapes add up with other shapes. They have to be calculated every time.
43144                // One way of finding out is checking if all styles associated to this shape depend only of this shape
43145                this._isAnimated = !!shape.k;
43146                // TODO: commenting this for now since all shapes are animated
43147                var i = 0, len = transformers.length;
43148                while (i < len) {
43149                    if (transformers[i].mProps.dynamicProperties.length) {
43150                        this._isAnimated = true;
43151                        break;
43152                    }
43153                    i += 1;
43154                }
43155            }
43156
43157            SVGShapeData.prototype.setAsAnimated = function () {
43158                this._isAnimated = true;
43159            }
43160
43161            function SVGTransformData(mProps, op, container) {
43162                this.transform = {
43163                    mProps: mProps,
43164                    op: op,
43165                    container: container
43166                };
43167                this.elements = [];
43168                this._isAnimated = this.transform.mProps.dynamicProperties.length || this.transform.op.effectsSequence.length;
43169            }
43170
43171            function SVGStrokeStyleData(elem, data, styleOb) {
43172                this.initDynamicPropertyContainer(elem);
43173                this.getValue = this.iterateDynamicProperties;
43174                this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this);
43175                this.w = PropertyFactory.getProp(elem, data.w, 0, null, this);
43176                this.d = new DashProperty(elem, data.d || {}, 'svg', this);
43177                this.c = PropertyFactory.getProp(elem, data.c, 1, 255, this);
43178                this.style = styleOb;
43179                this._isAnimated = !!this._isAnimated;
43180            }
43181
43182            extendPrototype([DynamicPropertyContainer], SVGStrokeStyleData);
43183
43184            function SVGFillStyleData(elem, data, styleOb) {
43185                this.initDynamicPropertyContainer(elem);
43186                this.getValue = this.iterateDynamicProperties;
43187                this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this);
43188                this.c = PropertyFactory.getProp(elem, data.c, 1, 255, this);
43189                this.style = styleOb;
43190            }
43191
43192            extendPrototype([DynamicPropertyContainer], SVGFillStyleData);
43193
43194            function SVGGradientFillStyleData(elem, data, styleOb) {
43195                this.initDynamicPropertyContainer(elem);
43196                this.getValue = this.iterateDynamicProperties;
43197                this.initGradientData(elem, data, styleOb);
43198            }
43199
43200            SVGGradientFillStyleData.prototype.initGradientData = function (elem, data, styleOb) {
43201                this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this);
43202                this.s = PropertyFactory.getProp(elem, data.s, 1, null, this);
43203                this.e = PropertyFactory.getProp(elem, data.e, 1, null, this);
43204                this.h = PropertyFactory.getProp(elem, data.h || {k: 0}, 0, 0.01, this);
43205                this.a = PropertyFactory.getProp(elem, data.a || {k: 0}, 0, degToRads, this);
43206                this.g = new GradientProperty(elem, data.g, this);
43207                this.style = styleOb;
43208                this.stops = [];
43209                this.setGradientData(styleOb.pElem, data);
43210                this.setGradientOpacity(data, styleOb);
43211                this._isAnimated = !!this._isAnimated;
43212
43213            };
43214
43215            SVGGradientFillStyleData.prototype.setGradientData = function (pathElement, data) {
43216
43217                var gradientId = createElementID();
43218                var gfill = createNS(data.t === 1 ? 'linearGradient' : 'radialGradient');
43219                gfill.setAttribute('id', gradientId);
43220                gfill.setAttribute('spreadMethod', 'pad');
43221                gfill.setAttribute('gradientUnits', 'userSpaceOnUse');
43222                var stops = [];
43223                var stop, j, jLen;
43224                jLen = data.g.p * 4;
43225                for (j = 0; j < jLen; j += 4) {
43226                    stop = createNS('stop');
43227                    gfill.appendChild(stop);
43228                    stops.push(stop);
43229                }
43230                pathElement.setAttribute(data.ty === 'gf' ? 'fill' : 'stroke', 'url(' + locationHref + '#' + gradientId + ')');
43231
43232                this.gf = gfill;
43233                this.cst = stops;
43234            };
43235
43236            SVGGradientFillStyleData.prototype.setGradientOpacity = function (data, styleOb) {
43237                if (this.g._hasOpacity && !this.g._collapsable) {
43238                    var stop, j, jLen;
43239                    var mask = createNS("mask");
43240                    var maskElement = createNS('path');
43241                    mask.appendChild(maskElement);
43242                    var opacityId = createElementID();
43243                    var maskId = createElementID();
43244                    mask.setAttribute('id', maskId);
43245                    var opFill = createNS(data.t === 1 ? 'linearGradient' : 'radialGradient');
43246                    opFill.setAttribute('id', opacityId);
43247                    opFill.setAttribute('spreadMethod', 'pad');
43248                    opFill.setAttribute('gradientUnits', 'userSpaceOnUse');
43249                    jLen = data.g.k.k[0].s ? data.g.k.k[0].s.length : data.g.k.k.length;
43250                    var stops = this.stops;
43251                    for (j = data.g.p * 4; j < jLen; j += 2) {
43252                        stop = createNS('stop');
43253                        stop.setAttribute('stop-color', 'rgb(255,255,255)');
43254                        opFill.appendChild(stop);
43255                        stops.push(stop);
43256                    }
43257                    maskElement.setAttribute(data.ty === 'gf' ? 'fill' : 'stroke', 'url(' + locationHref + '#' + opacityId + ')');
43258                    this.of = opFill;
43259                    this.ms = mask;
43260                    this.ost = stops;
43261                    this.maskId = maskId;
43262                    styleOb.msElem = maskElement;
43263                }
43264            };
43265
43266            extendPrototype([DynamicPropertyContainer], SVGGradientFillStyleData);
43267
43268            function SVGGradientStrokeStyleData(elem, data, styleOb) {
43269                this.initDynamicPropertyContainer(elem);
43270                this.getValue = this.iterateDynamicProperties;
43271                this.w = PropertyFactory.getProp(elem, data.w, 0, null, this);
43272                this.d = new DashProperty(elem, data.d || {}, 'svg', this);
43273                this.initGradientData(elem, data, styleOb);
43274                this._isAnimated = !!this._isAnimated;
43275            }
43276
43277            extendPrototype([SVGGradientFillStyleData, DynamicPropertyContainer], SVGGradientStrokeStyleData);
43278
43279            function ShapeGroupData() {
43280                this.it = [];
43281                this.prevViewData = [];
43282                this.gr = createNS('g');
43283            }
43284
43285            var SVGElementsRenderer = (function () {
43286                var _identityMatrix = new Matrix();
43287                var _matrixHelper = new Matrix();
43288
43289                var ob = {
43290                    createRenderFunction: createRenderFunction
43291                }
43292
43293                function createRenderFunction(data) {
43294                    var ty = data.ty;
43295                    switch (data.ty) {
43296                        case 'fl':
43297                            return renderFill;
43298                        case 'gf':
43299                            return renderGradient;
43300                        case 'gs':
43301                            return renderGradientStroke;
43302                        case 'st':
43303                            return renderStroke;
43304                        case 'sh':
43305                        case 'el':
43306                        case 'rc':
43307                        case 'sr':
43308                            return renderPath;
43309                        case 'tr':
43310                            return renderContentTransform;
43311                    }
43312                }
43313
43314                function renderContentTransform(styleData, itemData, isFirstFrame) {
43315                    if (isFirstFrame || itemData.transform.op._mdf) {
43316                        itemData.transform.container.setAttribute('opacity', itemData.transform.op.v);
43317                    }
43318                    if (isFirstFrame || itemData.transform.mProps._mdf) {
43319                        itemData.transform.container.setAttribute('transform', itemData.transform.mProps.v.to2dCSS());
43320                    }
43321                }
43322
43323                function renderPath(styleData, itemData, isFirstFrame) {
43324                    var j, jLen, pathStringTransformed, redraw, pathNodes, l, lLen = itemData.styles.length;
43325                    var lvl = itemData.lvl;
43326                    var paths, mat, props, iterations, k;
43327                    for (l = 0; l < lLen; l += 1) {
43328                        redraw = itemData.sh._mdf || isFirstFrame;
43329                        if (itemData.styles[l].lvl < lvl) {
43330                            mat = _matrixHelper.reset();
43331                            iterations = lvl - itemData.styles[l].lvl;
43332                            k = itemData.transformers.length - 1;
43333                            while (!redraw && iterations > 0) {
43334                                redraw = itemData.transformers[k].mProps._mdf || redraw;
43335                                iterations--;
43336                                k--;
43337                            }
43338                            if (redraw) {
43339                                iterations = lvl - itemData.styles[l].lvl;
43340                                k = itemData.transformers.length - 1;
43341                                while (iterations > 0) {
43342                                    props = itemData.transformers[k].mProps.v.props;
43343                                    mat.transform(props[0], props[1], props[2], props[3], props[4], props[5], props[6], props[7], props[8], props[9], props[10], props[11], props[12], props[13], props[14], props[15]);
43344                                    iterations--;
43345                                    k--;
43346                                }
43347                            }
43348                        } else {
43349                            mat = _identityMatrix;
43350                        }
43351                        paths = itemData.sh.paths;
43352                        jLen = paths._length;
43353                        if (redraw) {
43354                            pathStringTransformed = '';
43355                            for (j = 0; j < jLen; j += 1) {
43356                                pathNodes = paths.shapes[j];
43357                                if (pathNodes && pathNodes._length) {
43358                                    pathStringTransformed += buildShapeString(pathNodes, pathNodes._length, pathNodes.c, mat);
43359                                }
43360                            }
43361                            itemData.caches[l] = pathStringTransformed;
43362                        } else {
43363                            pathStringTransformed = itemData.caches[l];
43364                        }
43365                        itemData.styles[l].d += styleData.hd === true ? '' : pathStringTransformed;
43366                        itemData.styles[l]._mdf = redraw || itemData.styles[l]._mdf;
43367                    }
43368                }
43369
43370                function renderFill(styleData, itemData, isFirstFrame) {
43371                    var styleElem = itemData.style;
43372
43373                    if (itemData.c._mdf || isFirstFrame) {
43374                        styleElem.pElem.setAttribute('fill', 'rgb(' + bm_floor(itemData.c.v[0]) + ',' + bm_floor(itemData.c.v[1]) + ',' + bm_floor(itemData.c.v[2]) + ')');
43375                    }
43376                    if (itemData.o._mdf || isFirstFrame) {
43377                        styleElem.pElem.setAttribute('fill-opacity', itemData.o.v);
43378                    }
43379                };
43380
43381                function renderGradientStroke(styleData, itemData, isFirstFrame) {
43382                    renderGradient(styleData, itemData, isFirstFrame);
43383                    renderStroke(styleData, itemData, isFirstFrame);
43384                }
43385
43386                function renderGradient(styleData, itemData, isFirstFrame) {
43387                    var gfill = itemData.gf;
43388                    var hasOpacity = itemData.g._hasOpacity;
43389                    var pt1 = itemData.s.v, pt2 = itemData.e.v;
43390
43391                    if (itemData.o._mdf || isFirstFrame) {
43392                        var attr = styleData.ty === 'gf' ? 'fill-opacity' : 'stroke-opacity';
43393                        itemData.style.pElem.setAttribute(attr, itemData.o.v);
43394                    }
43395                    if (itemData.s._mdf || isFirstFrame) {
43396                        var attr1 = styleData.t === 1 ? 'x1' : 'cx';
43397                        var attr2 = attr1 === 'x1' ? 'y1' : 'cy';
43398                        gfill.setAttribute(attr1, pt1[0]);
43399                        gfill.setAttribute(attr2, pt1[1]);
43400                        if (hasOpacity && !itemData.g._collapsable) {
43401                            itemData.of.setAttribute(attr1, pt1[0]);
43402                            itemData.of.setAttribute(attr2, pt1[1]);
43403                        }
43404                    }
43405                    var stops, i, len, stop;
43406                    if (itemData.g._cmdf || isFirstFrame) {
43407                        stops = itemData.cst;
43408                        var cValues = itemData.g.c;
43409                        len = stops.length;
43410                        for (i = 0; i < len; i += 1) {
43411                            stop = stops[i];
43412                            stop.setAttribute('offset', cValues[i * 4] + '%');
43413                            stop.setAttribute('stop-color', 'rgb(' + cValues[i * 4 + 1] + ',' + cValues[i * 4 + 2] + ',' + cValues[i * 4 + 3] + ')');
43414                        }
43415                    }
43416                    if (hasOpacity && (itemData.g._omdf || isFirstFrame)) {
43417                        var oValues = itemData.g.o;
43418                        if (itemData.g._collapsable) {
43419                            stops = itemData.cst;
43420                        } else {
43421                            stops = itemData.ost;
43422                        }
43423                        len = stops.length;
43424                        for (i = 0; i < len; i += 1) {
43425                            stop = stops[i];
43426                            if (!itemData.g._collapsable) {
43427                                stop.setAttribute('offset', oValues[i * 2] + '%');
43428                            }
43429                            stop.setAttribute('stop-opacity', oValues[i * 2 + 1]);
43430                        }
43431                    }
43432                    if (styleData.t === 1) {
43433                        if (itemData.e._mdf || isFirstFrame) {
43434                            gfill.setAttribute('x2', pt2[0]);
43435                            gfill.setAttribute('y2', pt2[1]);
43436                            if (hasOpacity && !itemData.g._collapsable) {
43437                                itemData.of.setAttribute('x2', pt2[0]);
43438                                itemData.of.setAttribute('y2', pt2[1]);
43439                            }
43440                        }
43441                    } else {
43442                        var rad;
43443                        if (itemData.s._mdf || itemData.e._mdf || isFirstFrame) {
43444                            rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));
43445                            gfill.setAttribute('r', rad);
43446                            if (hasOpacity && !itemData.g._collapsable) {
43447                                itemData.of.setAttribute('r', rad);
43448                            }
43449                        }
43450                        if (itemData.e._mdf || itemData.h._mdf || itemData.a._mdf || isFirstFrame) {
43451                            if (!rad) {
43452                                rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));
43453                            }
43454                            var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0]);
43455
43456                            var percent = itemData.h.v >= 1 ? 0.99 : itemData.h.v <= -1 ? -0.99 : itemData.h.v;
43457                            var dist = rad * percent;
43458                            var x = Math.cos(ang + itemData.a.v) * dist + pt1[0];
43459                            var y = Math.sin(ang + itemData.a.v) * dist + pt1[1];
43460                            gfill.setAttribute('fx', x);
43461                            gfill.setAttribute('fy', y);
43462                            if (hasOpacity && !itemData.g._collapsable) {
43463                                itemData.of.setAttribute('fx', x);
43464                                itemData.of.setAttribute('fy', y);
43465                            }
43466                        }
43467                        //gfill.setAttribute('fy','200');
43468                    }
43469                };
43470
43471                function renderStroke(styleData, itemData, isFirstFrame) {
43472                    var styleElem = itemData.style;
43473                    var d = itemData.d;
43474                    if (d && (d._mdf || isFirstFrame) && d.dashStr) {
43475                        styleElem.pElem.setAttribute('stroke-dasharray', d.dashStr);
43476                        styleElem.pElem.setAttribute('stroke-dashoffset', d.dashoffset[0]);
43477                    }
43478                    if (itemData.c && (itemData.c._mdf || isFirstFrame)) {
43479                        styleElem.pElem.setAttribute('stroke', 'rgb(' + bm_floor(itemData.c.v[0]) + ',' + bm_floor(itemData.c.v[1]) + ',' + bm_floor(itemData.c.v[2]) + ')');
43480                    }
43481                    if (itemData.o._mdf || isFirstFrame) {
43482                        styleElem.pElem.setAttribute('stroke-opacity', itemData.o.v);
43483                    }
43484                    if (itemData.w._mdf || isFirstFrame) {
43485                        styleElem.pElem.setAttribute('stroke-width', itemData.w.v);
43486                        if (styleElem.msElem) {
43487                            styleElem.msElem.setAttribute('stroke-width', itemData.w.v);
43488                        }
43489                    }
43490                };
43491
43492                return ob;
43493            }())
43494
43495            function ShapeTransformManager() {
43496                this.sequences = {};
43497                this.sequenceList = [];
43498                this.transform_key_count = 0;
43499            }
43500
43501            ShapeTransformManager.prototype = {
43502                addTransformSequence: function (transforms) {
43503                    var i, len = transforms.length;
43504                    var key = '_';
43505                    for (i = 0; i < len; i += 1) {
43506                        key += transforms[i].transform.key + '_';
43507                    }
43508                    var sequence = this.sequences[key];
43509                    if (!sequence) {
43510                        sequence = {
43511                            transforms: [].concat(transforms),
43512                            finalTransform: new Matrix(),
43513                            _mdf: false
43514                        };
43515                        this.sequences[key] = sequence;
43516                        this.sequenceList.push(sequence);
43517                    }
43518                    return sequence;
43519                },
43520                processSequence: function (sequence, isFirstFrame) {
43521                    var i = 0, len = sequence.transforms.length, _mdf = isFirstFrame;
43522                    while (i < len && !isFirstFrame) {
43523                        if (sequence.transforms[i].transform.mProps._mdf) {
43524                            _mdf = true;
43525                            break;
43526                        }
43527                        i += 1
43528                    }
43529                    if (_mdf) {
43530                        var props;
43531                        sequence.finalTransform.reset();
43532                        for (i = len - 1; i >= 0; i -= 1) {
43533                            props = sequence.transforms[i].transform.mProps.v.props;
43534                            sequence.finalTransform.transform(props[0], props[1], props[2], props[3], props[4], props[5], props[6], props[7], props[8], props[9], props[10], props[11], props[12], props[13], props[14], props[15]);
43535                        }
43536                    }
43537                    sequence._mdf = _mdf;
43538
43539                },
43540                processSequences: function (isFirstFrame) {
43541                    var i, len = this.sequenceList.length;
43542                    for (i = 0; i < len; i += 1) {
43543                        this.processSequence(this.sequenceList[i], isFirstFrame);
43544                    }
43545
43546                },
43547                getNewKey: function () {
43548                    return '_' + this.transform_key_count++;
43549                }
43550            }
43551
43552            function CVShapeData(element, data, styles, transformsManager) {
43553                this.styledShapes = [];
43554                this.tr = [0, 0, 0, 0, 0, 0];
43555                var ty = 4;
43556                if (data.ty == 'rc') {
43557                    ty = 5;
43558                } else if (data.ty == 'el') {
43559                    ty = 6;
43560                } else if (data.ty == 'sr') {
43561                    ty = 7;
43562                }
43563                this.sh = ShapePropertyFactory.getShapeProp(element, data, ty, element);
43564                var i, len = styles.length, styledShape;
43565                for (i = 0; i < len; i += 1) {
43566                    if (!styles[i].closed) {
43567                        styledShape = {
43568                            transforms: transformsManager.addTransformSequence(styles[i].transforms),
43569                            trNodes: []
43570                        }
43571                        this.styledShapes.push(styledShape);
43572                        styles[i].elements.push(styledShape);
43573                    }
43574                }
43575            }
43576
43577            CVShapeData.prototype.setAsAnimated = SVGShapeData.prototype.setAsAnimated;
43578
43579            function BaseElement() {
43580            }
43581
43582            BaseElement.prototype = {
43583                checkMasks: function () {
43584                    if (!this.data.hasMask) {
43585                        return false;
vendor: 4,117 bytes, lines 43586-43682
43586                    }
43587                    var i = 0, len = this.data.masksProperties.length;
43588                    while (i < len) {
43589                        if ((this.data.masksProperties[i].mode !== 'n' && this.data.masksProperties[i].cl !== false)) {
43590                            return true;
43591                        }
43592                        i += 1;
43593                    }
43594                    return false;
43595                },
43596                initExpressions: function () {
43597                    this.layerInterface = LayerExpressionInterface(this);
43598                    if (this.data.hasMask && this.maskManager) {
43599                        this.layerInterface.registerMaskInterface(this.maskManager);
43600                    }
43601                    var effectsInterface = EffectsExpressionInterface.createEffectsInterface(this, this.layerInterface);
43602                    this.layerInterface.registerEffectsInterface(effectsInterface);
43603
43604                    if (this.data.ty === 0 || this.data.xt) {
43605                        this.compInterface = CompExpressionInterface(this);
43606                    } else if (this.data.ty === 4) {
43607                        this.layerInterface.shapeInterface = ShapeExpressionInterface(this.shapesData, this.itemsData, this.layerInterface);
43608                        this.layerInterface.content = this.layerInterface.shapeInterface;
43609                    } else if (this.data.ty === 5) {
43610                        this.layerInterface.textInterface = TextExpressionInterface(this);
43611                        this.layerInterface.text = this.layerInterface.textInterface;
43612                    }
43613                },
43614                setBlendMode: function () {
43615                    var blendModeValue = getBlendMode(this.data.bm);
43616                    var elem = this.baseElement || this.layerElement;
43617
43618                    elem.style['mix-blend-mode'] = blendModeValue;
43619                },
43620                initBaseData: function (data, globalData, comp) {
43621                    this.globalData = globalData;
43622                    this.comp = comp;
43623                    this.data = data;
43624                    this.layerId = createElementID();
43625
43626                    //Stretch factor for old animations missing this property.
43627                    if (!this.data.sr) {
43628                        this.data.sr = 1;
43629                    }
43630                    // effects manager
43631                    this.effectsManager = new EffectsManager(this.data, this, this.dynamicProperties);
43632
43633                },
43634                getType: function () {
43635                    return this.type;
43636                }
43637                , sourceRectAtTime: function () {
43638                }
43639            }
43640
43641            function NullElement(data, globalData, comp) {
43642                this.initFrame();
43643                this.initBaseData(data, globalData, comp);
43644                this.initFrame();
43645                this.initTransform(data, globalData, comp);
43646                this.initHierarchy();
43647            }
43648
43649            NullElement.prototype.prepareFrame = function (num) {
43650                this.prepareProperties(num, true);
43651            };
43652
43653            NullElement.prototype.renderFrame = function () {
43654            };
43655
43656            NullElement.prototype.getBaseElement = function () {
43657                return null;
43658            };
43659
43660            NullElement.prototype.destroy = function () {
43661            };
43662
43663            NullElement.prototype.sourceRectAtTime = function () {
43664            };
43665
43666            NullElement.prototype.hide = function () {
43667            };
43668
43669            extendPrototype([BaseElement, TransformElement, HierarchyElement, FrameElement], NullElement);
43670
43671            function SVGBaseElement() {
43672            }
43673
43674            SVGBaseElement.prototype = {
43675                initRendererElement: function () {
43676                    this.layerElement = createNS('g');
43677                },
43678                createContainerElements: function () {
43679                    this.matteElement = createNS('g');
43680                    this.transformedElement = this.layerElement;
43681                    this.maskedElement = this.layerElement;
43682                    this._sizeChanged = false;
vendor: 5,409 bytes, lines 43683-43768
43683                    var layerElementParent = null;
43684                    //If this layer acts as a mask for the following layer
43685                    var filId, fil, gg;
43686                    if (this.data.td) {
43687                        if (this.data.td == 3 || this.data.td == 1) {
43688                            var masker = createNS('mask');
43689                            masker.setAttribute('id', this.layerId);
43690                            masker.setAttribute('mask-type', this.data.td == 3 ? 'luminance' : 'alpha');
43691                            masker.appendChild(this.layerElement);
43692                            layerElementParent = masker;
43693                            this.globalData.defs.appendChild(masker);
43694                            // This is only for IE and Edge when mask if of type alpha
43695                            if (!featureSupport.maskType && this.data.td == 1) {
43696                                masker.setAttribute('mask-type', 'luminance');
43697                                filId = createElementID();
43698                                fil = filtersFactory.createFilter(filId);
43699                                this.globalData.defs.appendChild(fil);
43700                                fil.appendChild(filtersFactory.createAlphaToLuminanceFilter());
43701                                gg = createNS('g');
43702                                gg.appendChild(this.layerElement);
43703                                layerElementParent = gg;
43704                                masker.appendChild(gg);
43705                                gg.setAttribute('filter', 'url(' + locationHref + '#' + filId + ')');
43706                            }
43707                        } else if (this.data.td == 2) {
43708                            var maskGroup = createNS('mask');
43709                            maskGroup.setAttribute('id', this.layerId);
43710                            maskGroup.setAttribute('mask-type', 'alpha');
43711                            var maskGrouper = createNS('g');
43712                            maskGroup.appendChild(maskGrouper);
43713                            filId = createElementID();
43714                            fil = filtersFactory.createFilter(filId);
43715                            ////
43716
43717                            // This solution doesn't work on Android when meta tag with viewport attribute is set
43718                            /*var feColorMatrix = createNS('feColorMatrix');
43719                feColorMatrix.setAttribute('type', 'matrix');
43720                feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');
43721                feColorMatrix.setAttribute('values','1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 -1 1');
43722                fil.appendChild(feColorMatrix);*/
43723                            ////
43724                            var feCTr = createNS('feComponentTransfer');
43725                            feCTr.setAttribute('in', 'SourceGraphic');
43726                            fil.appendChild(feCTr);
43727                            var feFunc = createNS('feFuncA');
43728                            feFunc.setAttribute('type', 'table');
43729                            feFunc.setAttribute('tableValues', '1.0 0.0');
43730                            feCTr.appendChild(feFunc);
43731                            ////
43732                            this.globalData.defs.appendChild(fil);
43733                            var alphaRect = createNS('rect');
43734                            alphaRect.setAttribute('width', this.comp.data.w);
43735                            alphaRect.setAttribute('height', this.comp.data.h);
43736                            alphaRect.setAttribute('x', '0');
43737                            alphaRect.setAttribute('y', '0');
43738                            alphaRect.setAttribute('fill', '#ffffff');
43739                            alphaRect.setAttribute('opacity', '0');
43740                            maskGrouper.setAttribute('filter', 'url(' + locationHref + '#' + filId + ')');
43741                            maskGrouper.appendChild(alphaRect);
43742                            maskGrouper.appendChild(this.layerElement);
43743                            layerElementParent = maskGrouper;
43744                            if (!featureSupport.maskType) {
43745                                maskGroup.setAttribute('mask-type', 'luminance');
43746                                fil.appendChild(filtersFactory.createAlphaToLuminanceFilter());
43747                                gg = createNS('g');
43748                                maskGrouper.appendChild(alphaRect);
43749                                gg.appendChild(this.layerElement);
43750                                layerElementParent = gg;
43751                                maskGrouper.appendChild(gg);
43752                            }
43753                            this.globalData.defs.appendChild(maskGroup);
43754                        }
43755                    } else if (this.data.tt) {
43756                        this.matteElement.appendChild(this.layerElement);
43757                        layerElementParent = this.matteElement;
43758                        this.baseElement = this.matteElement;
43759                    } else {
43760                        this.baseElement = this.layerElement;
43761                    }
43762                    if (this.data.ln) {
43763                        this.layerElement.setAttribute('id', this.data.ln);
43764                    }
43765                    if (this.data.cl) {
43766                        this.layerElement.setAttribute('class', this.data.cl);
43767                    }
43768                    //Clipping compositions to hide content that exceeds boun
43768daries. If collapsed transformations is on, component should not be clipped
43769                    if (this.data.ty === 0 && !this.data.hd) {
43770                        var cp = createNS('clipPath');
43771                        var pt = createNS('path');
43772                        pt.setAttribute('d', 'M0,0 L' + this.data.w + ',0' + ' L' + this.data.w + ',' + this.data.h + ' L0,' + this.data.h + 'z');
43773                        var clipId = createElementID();
43774                        cp.setAttribute('id', clipId);
43775                        cp.appendChild(pt);
43776                        this.globalData.defs.appendChild(cp);
43777
43778                        if (this.checkMasks()) {
43779                            var cpGroup = createNS('g');
43780                            cpGroup.setAttribute('clip-path', 'url(' + locationHref + '#' + clipId + ')');
43781                            cpGroup.appendChild(this.layerElement);
43782                            this.transformedElement = cpGroup;
43783                            if (layerElementParent) {
43784                                layerElementParent.appendChild(this.transformedElement);
43785                            } else {
43786                                this.baseElement = this.transformedElement;
43787                            }
43788                        } else {
43789                            this.layerElement.setAttribute('clip-path', 'url(' + locationHref + '#' + clipId + ')');
43790                        }
43791
43792                    }
43793                    if (this.data.bm !== 0) {
43794                        this.setBlendMode();
43795                    }
43796
43797                },
43798                renderElement: function () {
43799                    if (this.finalTransform._matMdf) {
43800                        this.transformedElement.setAttribute('transform', this.finalTransform.mat.to2dCSS());
43801                    }
43802                    if (this.finalTransform._opMdf) {
43803                        this.transformedElement.setAttribute('opacity', this.finalTransform.mProp.o.v);
43804                    }
43805                },
43806                destroyBaseElement: function () {
43807                    this.layerElement = null;
43808                    this.matteElement = null;
43809                    this.maskManager.destroy();
43810                },
43811                getBaseElement: function () {
43812                    if (this.data.hd) {
43813                        return null;
43814                    }
43815                    return this.baseElement;
43816                },
43817                createRenderableComponents: function () {
43818                    this.maskManager = new MaskElement(this.data, this, this.globalData);
43819                    this.renderableEffectsManager = new SVGEffects(this);
43820                },
43821                setMatte: function (id) {
43822                    if (!this.matteElement) {
43823                        return;
43824                    }
43825                    this.matteElement.setAttribute("mask", "url(" + locationHref + "#" + id + ")");
43826                }
43827            };
43828
43829            function IShapeElement() {
43830            }
43831
43832            IShapeElement.prototype = {
43833                addShapeToModifiers: function (data) {
43834                    var i, len = this.shapeModifiers.length;
43835                    for (i = 0; i < len; i += 1) {
43836                        this.shapeModifiers[i].addShape(data);
43837                    }
43838                },
43839                isShapeInAnimatedModifiers: function (data) {
43840                    var i = 0, len = this.shapeModifiers.length;
43841                    while (i < len) {
43842                        if (this.shapeModifiers[i].isAnimatedWithShape(data)) {
43843                            return true;
43844                        }
43845                    }
43846                    return false;
43847                },
43848                renderModifiers: function () {
43849                    if (!this.shapeModifiers.length) {
43850                        return;
43851                    }
43852                    var i, len = this.shapes.length;
43853                    for (i = 0; i < len; i += 1) {
43854                        this.shapes[i].sh.reset();
43855                    }
43856
43857                    len = this.shapeModifiers.length;
43858                    for (i = len - 1; i >= 0; i -= 1) {
43859                        this.shapeModifiers[i].processShapes(this._isFirstFrame);
43860                    }
43861                },
43862                lcEnum: {
43863                    '1': 'butt',
43864                    '2': 'round',
vendor: 6,186 bytes, lines 43865-44015
43865                    '3': 'square'
43866                },
43867                ljEnum: {
43868                    '1': 'miter',
43869                    '2': 'round',
43870                    '3': 'bevel'
43871                },
43872                searchProcessedElement: function (elem) {
43873                    var elements = this.processedElements;
43874                    var i = 0, len = elements.length;
43875                    while (i < len) {
43876                        if (elements[i].elem === elem) {
43877                            return elements[i].pos;
43878                        }
43879                        i += 1;
43880                    }
43881                    return 0;
43882                },
43883                addProcessedElement: function (elem, pos) {
43884                    var elements = this.processedElements;
43885                    var i = elements.length;
43886                    while (i) {
43887                        i -= 1;
43888                        if (elements[i].elem === elem) {
43889                            elements[i].pos = pos;
43890                            return;
43891                        }
43892                    }
43893                    elements.push(new ProcessedElement(elem, pos));
43894                },
43895                prepareFrame: function (num) {
43896                    this.prepareRenderableFrame(num);
43897                    this.prepareProperties(num, this.isInRange);
43898                }
43899            };
43900
43901            function ITextElement() {
43902            }
43903
43904            ITextElement.prototype.initElement = function (data, globalData, comp) {
43905                this.lettersChangedFlag = true;
43906                this.initFrame();
43907                this.initBaseData(data, globalData, comp);
43908                this.textProperty = new TextProperty(this, data.t, this.dynamicProperties);
43909                this.textAnimator = new TextAnimatorProperty(data.t, this.renderType, this);
43910                this.initTransform(data, globalData, comp);
43911                this.initHierarchy();
43912                this.initRenderable();
43913                this.initRendererElement();
43914                this.createContainerElements();
43915                this.createRenderableComponents();
43916                this.createContent();
43917                this.hide();
43918                this.textAnimator.searchProperties(this.dynamicProperties);
43919            };
43920
43921            ITextElement.prototype.prepareFrame = function (num) {
43922                this._mdf = false;
43923                this.prepareRenderableFrame(num);
43924                this.prepareProperties(num, this.isInRange);
43925                if (this.textProperty._mdf || this.textProperty._isFirstFrame) {
43926                    this.buildNewText();
43927                    this.textProperty._isFirstFrame = false;
43928                    this.textProperty._mdf = false;
43929                }
43930            };
43931
43932            ITextElement.prototype.createPathShape = function (matrixHelper, shapes) {
43933                var j, jLen = shapes.length;
43934                var k, kLen, pathNodes;
43935                var shapeStr = '';
43936                for (j = 0; j < jLen; j += 1) {
43937                    pathNodes = shapes[j].ks.k;
43938                    shapeStr += buildShapeString(pathNodes, pathNodes.i.length, true, matrixHelper);
43939                }
43940                return shapeStr;
43941            };
43942
43943            ITextElement.prototype.updateDocumentData = function (newData, index) {
43944                this.textProperty.updateDocumentData(newData, index);
43945            };
43946
43947            ITextElement.prototype.canResizeFont = function (_canResize) {
43948                this.textProperty.canResizeFont(_canResize);
43949            };
43950
43951            ITextElement.prototype.setMinimumFontSize = function (_fontSize) {
43952                this.textProperty.setMinimumFontSize(_fontSize);
43953            };
43954
43955            ITextElement.prototype.applyTextPropertiesToMatrix = function (documentData, matrixHelper, lineNumber, xPos, yPos) {
43956                if (documentData.ps) {
43957                    matrixHelper.translate(documentData.ps[0], documentData.ps[1] + documentData.ascent, 0);
43958                }
43959                matrixHelper.translate(0, -documentData.ls, 0);
43960                switch (documentData.j) {
43961                    case 1:
43962                        matrixHelper.translate(documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]), 0, 0);
43963                        break;
43964                    case 2:
43965                        matrixHelper.translate(documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]) / 2, 0, 0);
43966                        break;
43967                }
43968                matrixHelper.translate(xPos, yPos, 0);
43969            };
43970
43971
43972            ITextElement.prototype.buildColor = function (colorData) {
43973                return 'rgb(' + Math.round(colorData[0] * 255) + ',' + Math.round(colorData[1] * 255) + ',' + Math.round(colorData[2] * 255) + ')';
43974            };
43975
43976            ITextElement.prototype.emptyProp = new LetterProps();
43977
43978            ITextElement.prototype.destroy = function () {
43979
43980            };
43981
43982            function ICompElement() {
43983            }
43984
43985            extendPrototype([BaseElement, TransformElement, HierarchyElement, FrameElement, RenderableDOMElement], ICompElement);
43986
43987            ICompElement.prototype.initElement = function (data, globalData, comp) {
43988                this.initFrame();
43989                this.initBaseData(data, globalData, comp);
43990                this.initTransform(data, globalData, comp);
43991                this.initRenderable();
43992                this.initHierarchy();
43993                this.initRendererElement();
43994                this.createContainerElements();
43995                this.createRenderableComponents();
43996                if (this.data.xt || !globalData.progressiveLoad) {
43997                    this.buildAllItems();
43998                }
43999                this.hide();
44000            };
44001
44002            /*ICompElement.prototype.hide = function(){
44003    if(!this.hidden){
44004        this.hideElement();
44005        var i,len = this.elements.length;
44006        for( i = 0; i < len; i+=1 ){
44007            if(this.elements[i]){
44008                this.elements[i].hide();
44009            }
44010        }
44011    }
44012};*/
44013
44014            ICompElement.prototype.prepareFrame = function (num) {
44015                this._mdf = false;
vendor: 4,610 bytes, lines 44016-44125
44016                this.prepareRenderableFrame(num);
44017                this.prepareProperties(num, this.isInRange);
44018                if (!this.isInRange && !this.data.xt) {
44019                    return;
44020                }
44021
44022                if (!this.tm._placeholder) {
44023                    var timeRemapped = this.tm.v;
44024                    if (timeRemapped === this.data.op) {
44025                        timeRemapped = this.data.op - 1;
44026                    }
44027                    this.renderedFrame = timeRemapped;
44028                } else {
44029                    this.renderedFrame = num / this.data.sr;
44030                }
44031                var i, len = this.elements.length;
44032                if (!this.completeLayers) {
44033                    this.checkLayers(this.renderedFrame);
44034                }
44035                //This iteration needs to be backwards because of how expressions connect between each other
44036                for (i = len - 1; i >= 0; i -= 1) {
44037                    if (this.completeLayers || this.elements[i]) {
44038                        this.elements[i].prepareFrame(this.renderedFrame - this.layers[i].st);
44039                        if (this.elements[i]._mdf) {
44040                            this._mdf = true;
44041                        }
44042                    }
44043                }
44044            };
44045
44046            ICompElement.prototype.renderInnerContent = function () {
44047                var i, len = this.layers.length;
44048                for (i = 0; i < len; i += 1) {
44049                    if (this.completeLayers || this.elements[i]) {
44050                        this.elements[i].renderFrame();
44051                    }
44052                }
44053            };
44054
44055            ICompElement.prototype.setElements = function (elems) {
44056                this.elements = elems;
44057            };
44058
44059            ICompElement.prototype.getElements = function () {
44060                return this.elements;
44061            };
44062
44063            ICompElement.prototype.destroyElements = function () {
44064                var i, len = this.layers.length;
44065                for (i = 0; i < len; i += 1) {
44066                    if (this.elements[i]) {
44067                        this.elements[i].destroy();
44068                    }
44069                }
44070            };
44071
44072            ICompElement.prototype.destroy = function () {
44073                this.destroyElements();
44074                this.destroyBaseElement();
44075            };
44076
44077            function IImageElement(data, globalData, comp) {
44078                this.assetData = globalData.getAssetData(data.refId);
44079                this.initElement(data, globalData, comp);
44080                this.sourceRect = {top: 0, left: 0, width: this.assetData.w, height: this.assetData.h};
44081            }
44082
44083            extendPrototype([BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement, RenderableDOMElement], IImageElement);
44084
44085            IImageElement.prototype.createContent = function () {
44086
44087                var assetPath = this.globalData.getAssetsPath(this.assetData);
44088
44089                this.innerElem = createNS('image');
44090                this.innerElem.setAttribute('width', this.assetData.w + "px");
44091                this.innerElem.setAttribute('height', this.assetData.h + "px");
44092                this.innerElem.setAttribute('preserveAspectRatio', this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio);
44093                this.innerElem.setAttributeNS('http://www.w3.org/1999/xlink', 'href', assetPath);
44094
44095                this.layerElement.appendChild(this.innerElem);
44096            };
44097
44098            IImageElement.prototype.sourceRectAtTime = function () {
44099                return this.sourceRect;
44100            }
44101
44102            function ISolidElement(data, globalData, comp) {
44103                this.initElement(data, globalData, comp);
44104            }
44105
44106            extendPrototype([IImageElement], ISolidElement);
44107
44108            ISolidElement.prototype.createContent = function () {
44109
44110                var rect = createNS('rect');
44111                ////rect.style.width = this.data.sw;
44112                ////rect.style.height = this.data.sh;
44113                ////rect.style.fill = this.data.sc;
44114                rect.setAttribute('width', this.data.sw);
44115                rect.setAttribute('height', this.data.sh);
44116                rect.setAttribute('fill', this.data.sc);
44117                this.layerElement.appendChild(rect);
44118            };
44119
44120            function AudioElement(data, globalData, comp) {
44121                this.initFrame();
44122                this.initRenderable();
44123                this.assetData = globalData.getAssetData(data.refId);
44124                this.initBaseData(data, globalData, comp);
44125                this._isPlaying = false;
vendor: 10,168 bytes, lines 44126-44340
44126                this._canPlay = false;
44127                var assetPath = this.globalData.getAssetsPath(this.assetData);
44128                this.audio = this.globalData.audioController.createAudio(assetPath);
44129                this._currentTime = 0;
44130                this.globalData.audioController.addAudio(this);
44131                this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : {_placeholder: true};
44132            }
44133
44134            AudioElement.prototype.prepareFrame = function (num) {
44135                this.prepareRenderableFrame(num, true);
44136                this.prepareProperties(num, true);
44137                if (!this.tm._placeholder) {
44138                    var timeRemapped = this.tm.v;
44139                    this._currentTime = timeRemapped;
44140                } else {
44141                    this._currentTime = num / this.data.sr;
44142                }
44143            };
44144
44145            extendPrototype([RenderableElement, BaseElement, FrameElement], AudioElement);
44146
44147            AudioElement.prototype.renderFrame = function () {
44148                if (this.isInRange && this._canPlay) {
44149                    if (!this._isPlaying) {
44150                        this.audio.play();
44151                        this.audio.seek(this._currentTime / this.globalData.frameRate);
44152                        this._isPlaying = true;
44153                    } else if (!this.audio.playing()
44154                        || Math.abs(this._currentTime / this.globalData.frameRate - this.audio.seek()) > 0.1
44155                    ) {
44156                        this.audio.seek(this._currentTime / this.globalData.frameRate)
44157                    }
44158                }
44159            };
44160
44161            AudioElement.prototype.show = function () {
44162                // this.audio.play()
44163            };
44164
44165            AudioElement.prototype.hide = function () {
44166                this.audio.pause();
44167                this._isPlaying = false;
44168            };
44169
44170            AudioElement.prototype.pause = function () {
44171                this.audio.pause();
44172                this._isPlaying = false;
44173                this._canPlay = false;
44174            };
44175
44176            AudioElement.prototype.resume = function () {
44177                this._canPlay = true;
44178            };
44179
44180            AudioElement.prototype.setRate = function (rateValue) {
44181                this.audio.rate(rateValue);
44182            };
44183
44184            AudioElement.prototype.volume = function (volumeValue) {
44185                this.audio.volume(volumeValue);
44186            };
44187
44188            AudioElement.prototype.getBaseElement = function () {
44189                return null;
44190            };
44191
44192            AudioElement.prototype.destroy = function () {
44193            };
44194
44195            AudioElement.prototype.sourceRectAtTime = function () {
44196            };
44197
44198            AudioElement.prototype.initExpressions = function () {
44199            };
44200
44201
44202            function SVGCompElement(data, globalData, comp) {
44203                this.layers = data.layers;
44204                this.supports3d = true;
44205                this.completeLayers = false;
44206                this.pendingElements = [];
44207                this.elements = this.layers ? createSizedArray(this.layers.length) : [];
44208                //this.layerElement = createNS('g');
44209                this.initElement(data, globalData, comp);
44210                this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : {_placeholder: true};
44211            }
44212
44213            extendPrototype([SVGRenderer, ICompElement, SVGBaseElement], SVGCompElement);
44214
44215            function SVGTextElement(data, globalData, comp) {
44216                this.textSpans = [];
44217                this.renderType = 'svg';
44218                this.initElement(data, globalData, comp);
44219            }
44220
44221            extendPrototype([BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement, RenderableDOMElement, ITextElement], SVGTextElement);
44222
44223            SVGTextElement.prototype.createContent = function () {
44224
44225                if (this.data.singleShape && !this.globalData.fontManager.chars) {
44226                    this.textContainer = createNS('text');
44227                }
44228            };
44229
44230            SVGTextElement.prototype.buildTextContents = function (textArray) {
44231                var i = 0, len = textArray.length;
44232                var textContents = [], currentTextContent = '';
44233                while (i < len) {
44234                    if (textArray[i] === String.fromCharCode(13) || textArray[i] === String.fromCharCode(3)) {
44235                        textContents.push(currentTextContent);
44236                        currentTextContent = '';
44237                    } else {
44238                        currentTextContent += textArray[i];
44239                    }
44240                    i += 1;
44241                }
44242                textContents.push(currentTextContent);
44243                return textContents;
44244            }
44245
44246            SVGTextElement.prototype.buildNewText = function () {
44247                var i, len;
44248
44249                var documentData = this.textProperty.currentData;
44250                this.renderedLetters = createSizedArray(documentData ? documentData.l.length : 0);
44251                if (documentData.fc) {
44252                    this.layerElement.setAttribute('fill', this.buildColor(documentData.fc));
44253                } else {
44254                    this.layerElement.setAttribute('fill', 'rgba(0,0,0,0)');
44255                }
44256                if (documentData.sc) {
44257                    this.layerElement.setAttribute('stroke', this.buildColor(documentData.sc));
44258                    this.layerElement.setAttribute('stroke-width', documentData.sw);
44259                }
44260                this.layerElement.setAttribute('font-size', documentData.finalSize);
44261                var fontData = this.globalData.fontManager.getFontByName(documentData.f);
44262                if (fontData.fClass) {
44263                    this.layerElement.setAttribute('class', fontData.fClass);
44264                } else {
44265                    this.layerElement.setAttribute('font-family', fontData.fFamily);
44266                    var fWeight = documentData.fWeight, fStyle = documentData.fStyle;
44267                    this.layerElement.setAttribute('font-style', fStyle);
44268                    this.layerElement.setAttribute('font-weight', fWeight);
44269                }
44270                this.layerElement.setAttribute('aria-label', documentData.t);
44271
44272                var letters = documentData.l || [];
44273                var usesGlyphs = !!this.globalData.fontManager.chars;
44274                len = letters.length;
44275
44276                var tSpan;
44277                var matrixHelper = this.mHelper;
44278                var shapes, shapeStr = '', singleShape = this.data.singleShape;
44279                var xPos = 0, yPos = 0, firstLine = true;
44280                var trackingOffset = documentData.tr / 1000 * documentData.finalSize;
44281                if (singleShape && !usesGlyphs && !documentData.sz) {
44282                    var tElement = this.textContainer;
44283                    var justify = 'start';
44284                    switch (documentData.j) {
44285                        case 1:
44286                            justify = 'end';
44287                            break;
44288                        case 2:
44289                            justify = 'middle';
44290                            break;
44291                    }
44292                    tElement.setAttribute('text-anchor', justify);
44293                    tElement.setAttribute('letter-spacing', trackingOffset);
44294                    var textContent = this.buildTextContents(documentData.finalText);
44295                    len = textContent.length;
44296                    yPos = documentData.ps ? documentData.ps[1] + documentData.ascent : 0;
44297                    for (i = 0; i < len; i += 1) {
44298                        tSpan = this.textSpans[i] || createNS('tspan');
44299                        tSpan.textContent = textContent[i];
44300                        tSpan.setAttribute('x', 0);
44301                        tSpan.setAttribute('y', yPos);
44302                        tSpan.style.display = 'inherit';
44303                        tElement.appendChild(tSpan);
44304                        this.textSpans[i] = tSpan;
44305                        yPos += documentData.finalLineHeight;
44306                    }
44307
44308                    this.layerElement.appendChild(tElement);
44309                } else {
44310                    var cachedSpansLength = this.textSpans.length;
44311                    var shapeData, charData;
44312                    for (i = 0; i < len; i += 1) {
44313                        if (!usesGlyphs || !singleShape || i === 0) {
44314                            tSpan = cachedSpansLength > i ? this.textSpans[i] : createNS(usesGlyphs ? 'path' : 'text');
44315                            if (cachedSpansLength <= i) {
44316                                tSpan.setAttribute('stroke-linecap', 'butt');
44317                                tSpan.setAttribute('stroke-linejoin', 'round');
44318                                tSpan.setAttribute('stroke-miterlimit', '4');
44319                                this.textSpans[i] = tSpan;
44320                                this.layerElement.appendChild(tSpan);
44321                            }
44322                            tSpan.style.display = 'inherit';
44323                        }
44324
44325                        matrixHelper.reset();
44326                        matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100);
44327                        if (singleShape) {
44328                            if (letters[i].n) {
44329                                xPos = -trackingOffset;
44330                                yPos += documentData.yOffset;
44331                                yPos += firstLine ? 1 : 0;
44332                                firstLine = false;
44333                            }
44334                            this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos);
44335                            xPos += letters[i].l || 0;
44336                            //xPos += letters[i].val === ' ' ? 0 : trackingOffset;
44337                            xPos += trackingOffset;
44338                        }
44339                        if (usesGlyphs) {
44340                            charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(
44340documentData.f).fFamily);
44341                            shapeData = charData && charData.data || {};
44342                            shapes = shapeData.shapes ? shapeData.shapes[0].it : [];
44343                            if (!singleShape) {
44344                                tSpan.setAttribute('d', this.createPathShape(matrixHelper, shapes));
44345                            } else {
44346                                shapeStr += this.createPathShape(matrixHelper, shapes);
44347                            }
44348                        } else {
44349                            if (singleShape) {
44350                                tSpan.setAttribute("transform", "translate(" + matrixHelper.props[12] + "," + matrixHelper.props[13] + ")");
44351                            }
44352                            tSpan.textContent = letters[i].val;
44353                            tSpan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
44354                        }
44355                        //
44356                    }
44357                    if (singleShape && tSpan) {
44358                        tSpan.setAttribute('d', shapeStr);
44359                    }
44360                }
44361                while (i < this.textSpans.length) {
44362                    this.textSpans[i].style.display = 'none';
44363                    i += 1;
44364                }
44365
44366                this._sizeChanged = true;
44367            };
44368
44369            SVGTextElement.prototype.sourceRectAtTime = function (time) {
44370                this.prepareFrame(this.comp.renderedFrame - this.data.st);
44371                this.renderInnerContent();
44372                if (this._sizeChanged) {
44373                    this._sizeChanged = false;
44374                    var textBox = this.layerElement.getBBox();
44375                    this.bbox = {
44376                        top: textBox.y,
44377                        left: textBox.x,
44378                        width: textBox.width,
44379                        height: textBox.height
44380                    };
44381                }
44382                return this.bbox;
44383            };
44384
44385            SVGTextElement.prototype.renderInnerContent = function () {
44386
44387                if (!this.data.singleShape) {
44388                    this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);
44389                    if (this.lettersChangedFlag || this.textAnimator.lettersChangedFlag) {
44390                        this._sizeChanged = true;
44391                        var i, len;
44392                        var renderedLetters = this.textAnimator.renderedLetters;
44393
44394                        var letters = this.textProperty.currentData.l;
44395
44396                        len = letters.length;
44397                        var renderedLetter, textSpan;
44398                        for (i = 0; i < len; i += 1) {
44399                            if (letters[i].n) {
44400                                continue;
44401                            }
44402                            renderedLetter = renderedLetters[i];
44403                            textSpan = this.textSpans[i];
44404                            if (renderedLetter._mdf.m) {
44405                                textSpan.setAttribute('transform', renderedLetter.m);
44406                            }
44407                            if (renderedLetter._mdf.o) {
44408                                textSpan.setAttribute('opacity', renderedLetter.o);
44409                            }
44410                            if (renderedLetter._mdf.sw) {
44411                                textSpan.setAttribute('stroke-width', renderedLetter.sw);
44412                            }
44413                            if (renderedLetter._mdf.sc) {
44414                                textSpan.setAttribute('stroke', renderedLetter.sc);
44415                            }
44416                            if (renderedLetter._mdf.fc) {
44417                                textSpan.setAttribute('fill', renderedLetter.fc);
44418                            }
44419                        }
44420                    }
44421                }
44422            };
44423
44424            function SVGShapeElement(data, globalData, comp) {
44425                //List of drawable elements
44426                this.shapes = [];
44427                // Full shape data
44428                this.shapesData = data.shapes;
44429                //List of styles that will be applied to shapes
44430                this.stylesList = [];
44431                //List of modifiers that will be applied to shapes
44432                this.shapeModifiers = [];
44433                //List of items in shape tree
44434                this.itemsData = [];
44435                //List of items in previous shape tree
44436                this.processedElements = [];
44437                // List of animated components
44438                this.animatedContents = [];
44439                this.initElement(data, globalData, comp);
44440                //Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.
44441                // List of elements that have been created
44442                this.prevViewData = [];
44443                //Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.
44444            }
44445
44446            extendPrototype([BaseElement, TransformElement, SVGBaseElement, IShapeElement, HierarchyElement, FrameElement, RenderableDOMElement], SVGShapeElement);
44447
44448            SVGShapeElement.prototype.initSecondaryElement = function () {
44449            };
44450
44451            SVGShapeElement.prototype.identityMatrix = new Matrix();
44452
44453            SVGShapeElement.prototype.buildExpressionInterface = function () {
44454            };
44455
44456            SVGShapeElement.prototype.createContent = function () {
44457                this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.layerElement, 0, [], true);
44458                this.filterUniqueShapes();
44459            };
44460
44461            /*
44462This method searches for multiple shapes that affect a single element and one of them is animated
44463*/
44464            SVGShapeElement.prototype.filterUniqueShapes = function () {
44465                var i, len = this.shapes.length, shape;
44466                var j, jLen = this.stylesList.length;
44467                var style, count = 0;
44468                var tempShapes = [];
44469                var areAnimated = false;
vendor: 7,722 bytes, lines 44470-44636
44470                for (j = 0; j < jLen; j += 1) {
44471                    style = this.stylesList[j];
44472                    areAnimated = false;
44473                    tempShapes.length = 0;
44474                    for (i = 0; i < len; i += 1) {
44475                        shape = this.shapes[i];
44476                        if (shape.styles.indexOf(style) !== -1) {
44477                            tempShapes.push(shape);
44478                            areAnimated = shape._isAnimated || areAnimated;
44479                        }
44480                    }
44481                    if (tempShapes.length > 1 && areAnimated) {
44482                        this.setShapesAsAnimated(tempShapes);
44483                    }
44484                }
44485            }
44486
44487            SVGShapeElement.prototype.setShapesAsAnimated = function (shapes) {
44488                var i, len = shapes.length;
44489                for (i = 0; i < len; i += 1) {
44490                    shapes[i].setAsAnimated();
44491                }
44492            }
44493
44494            SVGShapeElement.prototype.createStyleElement = function (data, level) {
44495                //TODO: prevent drawing of hidden styles
44496                var elementData;
44497                var styleOb = new SVGStyleData(data, level);
44498
44499                var pathElement = styleOb.pElem;
44500                if (data.ty === 'st') {
44501                    elementData = new SVGStrokeStyleData(this, data, styleOb);
44502                } else if (data.ty === 'fl') {
44503                    elementData = new SVGFillStyleData(this, data, styleOb);
44504                } else if (data.ty === 'gf' || data.ty === 'gs') {
44505                    var gradientConstructor = data.ty === 'gf' ? SVGGradientFillStyleData : SVGGradientStrokeStyleData;
44506                    elementData = new gradientConstructor(this, data, styleOb);
44507                    this.globalData.defs.appendChild(elementData.gf);
44508                    if (elementData.maskId) {
44509                        this.globalData.defs.appendChild(elementData.ms);
44510                        this.globalData.defs.appendChild(elementData.of);
44511                        pathElement.setAttribute('mask', 'url(' + locationHref + '#' + elementData.maskId + ')');
44512                    }
44513                }
44514
44515                if (data.ty === 'st' || data.ty === 'gs') {
44516                    pathElement.setAttribute('stroke-linecap', this.lcEnum[data.lc] || 'round');
44517                    pathElement.setAttribute('stroke-linejoin', this.ljEnum[data.lj] || 'round');
44518                    pathElement.setAttribute('fill-opacity', '0');
44519                    if (data.lj === 1) {
44520                        pathElement.setAttribute('stroke-miterlimit', data.ml);
44521                    }
44522                }
44523
44524                if (data.r === 2) {
44525                    pathElement.setAttribute('fill-rule', 'evenodd');
44526                }
44527
44528                if (data.ln) {
44529                    pathElement.setAttribute('id', data.ln);
44530                }
44531                if (data.cl) {
44532                    pathElement.setAttribute('class', data.cl);
44533                }
44534                if (data.bm) {
44535                    pathElement.style['mix-blend-mode'] = getBlendMode(data.bm);
44536                }
44537                this.stylesList.push(styleOb);
44538                this.addToAnimatedContents(data, elementData);
44539                return elementData;
44540            };
44541
44542            SVGShapeElement.prototype.createGroupElement = function (data) {
44543                var elementData = new ShapeGroupData();
44544                if (data.ln) {
44545                    elementData.gr.setAttribute('id', data.ln);
44546                }
44547                if (data.cl) {
44548                    elementData.gr.setAttribute('class', data.cl);
44549                }
44550                if (data.bm) {
44551                    elementData.gr.style['mix-blend-mode'] = getBlendMode(data.bm);
44552                }
44553                return elementData;
44554            };
44555
44556            SVGShapeElement.prototype.createTransformElement = function (data, container) {
44557                var transformProperty = TransformPropertyFactory.getTransformProperty(this, data, this);
44558                var elementData = new SVGTransformData(transformProperty, transformProperty.o, container);
44559                this.addToAnimatedContents(data, elementData);
44560                return elementData;
44561            };
44562
44563            SVGShapeElement.prototype.createShapeElement = function (data, ownTransformers, level) {
44564                var ty = 4;
44565                if (data.ty === 'rc') {
44566                    ty = 5;
44567                } else if (data.ty === 'el') {
44568                    ty = 6;
44569                } else if (data.ty === 'sr') {
44570                    ty = 7;
44571                }
44572                var shapeProperty = ShapePropertyFactory.getShapeProp(this, data, ty, this);
44573                var elementData = new SVGShapeData(ownTransformers, level, shapeProperty);
44574                this.shapes.push(elementData);
44575                this.addShapeToModifiers(elementData);
44576                this.addToAnimatedContents(data, elementData);
44577                return elementData;
44578            };
44579
44580            SVGShapeElement.prototype.addToAnimatedContents = function (data, element) {
44581                var i = 0, len = this.animatedContents.length;
44582                while (i < len) {
44583                    if (this.animatedContents[i].element === element) {
44584                        return;
44585                    }
44586                    i += 1;
44587                }
44588                this.animatedContents.push({
44589                    fn: SVGElementsRenderer.createRenderFunction(data),
44590                    element: element,
44591                    data: data
44592                });
44593            };
44594
44595            SVGShapeElement.prototype.setElementStyles = function (elementData) {
44596                var arr = elementData.styles;
44597                var j, jLen = this.stylesList.length;
44598                for (j = 0; j < jLen; j += 1) {
44599                    if (!this.stylesList[j].closed) {
44600                        arr.push(this.stylesList[j]);
44601                    }
44602                }
44603            };
44604
44605            SVGShapeElement.prototype.reloadShapes = function () {
44606                this._isFirstFrame = true;
44607                var i, len = this.itemsData.length;
44608                for (i = 0; i < len; i += 1) {
44609                    this.prevViewData[i] = this.itemsData[i];
44610                }
44611                this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.layerElement, 0, [], true);
44612                this.filterUniqueShapes();
44613                len = this.dynamicProperties.length;
44614                for (i = 0; i < len; i += 1) {
44615                    this.dynamicProperties[i].getValue();
44616                }
44617                this.renderModifiers();
44618            };
44619
44620            SVGShapeElement.prototype.searchShapes = function (arr, itemsData, prevViewData, container, level, transformers, render) {
44621                var ownTransformers = [].concat(transformers);
44622                var i, len = arr.length - 1;
44623                var j, jLen;
44624                var ownStyles = [], ownModifiers = [], styleOb, currentTransform, modifier, processedPos;
44625                for (i = len; i >= 0; i -= 1) {
44626                    processedPos = this.searchProcessedElement(arr[i]);
44627                    if (!processedPos) {
44628                        arr[i]._render = render;
44629                    } else {
44630                        itemsData[i] = prevViewData[processedPos - 1];
44631                    }
44632                    if (arr[i].ty == 'fl' || arr[i].ty == 'st' || arr[i].ty == 'gf' || arr[i].ty == 'gs') {
44633                        if (!processedPos) {
44634                            itemsData[i] = this.createStyleElement(arr[i], level);
44635                        } else {
44636                            itemsData[i].style.closed = false;
44637                        }
44638                        if (arr[i]._render) {
44639                            container.appendChild(itemsData[i].style.pElem);
44640                        }
44641                        ownStyles.push(itemsData[i].style);
44642                    } else if (arr[i].ty == 'gr') {
44643                        if (!processedPos) {
44644                            itemsData[i] = this.createGroupElement(arr[i]);
44645                        } else {
44646                            jLen = itemsData[i].it.length;
44647                            for (j = 0; j < jLen; j += 1) {
44648                                itemsData[i].prevViewData[j] = itemsData[i].it[j];
44649                            }
44650                        }
44651                        this.searchShapes(arr[i].it, itemsData[i].it, itemsData[i].prevViewData, itemsData[i].gr, level + 1, ownTransformers, render);
44652                        if (arr[i]._render) {
44653                            container.appendChild(itemsData[i].gr);
44654                        }
44655                    } else if (arr[i].ty == 'tr') {
44656                        if (!processedPos) {
44657                            itemsData[i] = this.createTransformElement(arr[i], container);
44658                        }
44659                        currentTransform = itemsData[i].transform;
44660                        ownTransformers.push(currentTransform);
44661                    } else if (arr[i].ty == 'sh' || arr[i].ty == 'rc' || arr[i].ty == 'el' || arr[i].ty == 'sr') {
44662                        if (!processedPos) {
44663                            itemsData[i] = this.createShapeElement(arr[i], ownTransformers, level);
44664                        }
44665                        this.setElementStyles(itemsData[i]);
44666
44667                    } else if (arr[i].ty == 'tm' || arr[i].ty == 'rd' || arr[i].ty == 'ms' || arr[i].ty == 'pb') {
44668                        if (!processedPos) {
44669                            modifier = ShapeModifiers.getModifier(arr[i].ty);
44670                            modifier.init(this, arr[i]);
44671                            itemsData[i] = modifier;
44672                            this.shapeModifiers.push(modifier);
44673                        } else {
44674                            modifier = itemsData[i];
44675                            modifier.closed = false;
44676                        }
44677                        ownModifiers.push(modifier);
44678                    } else if (arr[i].ty == 'rp') {
44679                        if (!processedPos) {
44680                            modifier = ShapeModifiers.getModifier(arr[i].ty);
44681                            itemsData[i] = modifier;
44682                            modifier.init(this, arr, i, itemsData);
44683                            this.shapeModifiers.push(modifier);
44684                            render = false;
vendor: 28,594 bytes, lines 44685-45172
44685                        } else {
44686                            modifier = itemsData[i];
44687                            modifier.closed = true;
44688                        }
44689                        ownModifiers.push(modifier);
44690                    }
44691                    this.addProcessedElement(arr[i], i + 1);
44692                }
44693                len = ownStyles.length;
44694                for (i = 0; i < len; i += 1) {
44695                    ownStyles[i].closed = true;
44696                }
44697                len = ownModifiers.length;
44698                for (i = 0; i < len; i += 1) {
44699                    ownModifiers[i].closed = true;
44700                }
44701            };
44702
44703            SVGShapeElement.prototype.renderInnerContent = function () {
44704                this.renderModifiers();
44705                var i, len = this.stylesList.length;
44706                for (i = 0; i < len; i += 1) {
44707                    this.stylesList[i].reset();
44708                }
44709                this.renderShape();
44710
44711                for (i = 0; i < len; i += 1) {
44712                    if (this.stylesList[i]._mdf || this._isFirstFrame) {
44713                        if (this.stylesList[i].msElem) {
44714                            this.stylesList[i].msElem.setAttribute('d', this.stylesList[i].d);
44715                            //Adding M0 0 fixes same mask bug on all browsers
44716                            this.stylesList[i].d = 'M0 0' + this.stylesList[i].d;
44717                        }
44718                        this.stylesList[i].pElem.setAttribute('d', this.stylesList[i].d || 'M0 0');
44719                    }
44720                }
44721            };
44722
44723            SVGShapeElement.prototype.renderShape = function () {
44724                var i, len = this.animatedContents.length;
44725                var animatedContent;
44726                for (i = 0; i < len; i += 1) {
44727                    animatedContent = this.animatedContents[i];
44728                    if ((this._isFirstFrame || animatedContent.element._isAnimated) && animatedContent.data !== true) {
44729                        animatedContent.fn(animatedContent.data, animatedContent.element, this._isFirstFrame);
44730                    }
44731                }
44732            }
44733
44734            SVGShapeElement.prototype.destroy = function () {
44735                this.destroyBaseElement();
44736                this.shapesData = null;
44737                this.itemsData = null;
44738            };
44739
44740            function SVGTintFilter(filter, filterManager) {
44741                this.filterManager = filterManager;
44742                var feColorMatrix = createNS('feColorMatrix');
44743                feColorMatrix.setAttribute('type', 'matrix');
44744                feColorMatrix.setAttribute('color-interpolation-filters', 'linearRGB');
44745                feColorMatrix.setAttribute('values', '0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0');
44746                feColorMatrix.setAttribute('result', 'f1');
44747                filter.appendChild(feColorMatrix);
44748                feColorMatrix = createNS('feColorMatrix');
44749                feColorMatrix.setAttribute('type', 'matrix');
44750                feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');
44751                feColorMatrix.setAttribute('values', '1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0');
44752                feColorMatrix.setAttribute('result', 'f2');
44753                filter.appendChild(feColorMatrix);
44754                this.matrixFilter = feColorMatrix;
44755                if (filterManager.effectElements[2].p.v !== 100 || filterManager.effectElements[2].p.k) {
44756                    var feMerge = createNS('feMerge');
44757                    filter.appendChild(feMerge);
44758                    var feMergeNode;
44759                    feMergeNode = createNS('feMergeNode');
44760                    feMergeNode.setAttribute('in', 'SourceGraphic');
44761                    feMerge.appendChild(feMergeNode);
44762                    feMergeNode = createNS('feMergeNode');
44763                    feMergeNode.setAttribute('in', 'f2');
44764                    feMerge.appendChild(feMergeNode);
44765                }
44766            }
44767
44768            SVGTintFilter.prototype.renderFrame = function (forceRender) {
44769                if (forceRender || this.filterManager._mdf) {
44770                    var colorBlack = this.filterManager.effectElements[0].p.v;
44771                    var colorWhite = this.filterManager.effectElements[1].p.v;
44772                    var opacity = this.filterManager.effectElements[2].p.v / 100;
44773                    this.matrixFilter.setAttribute('values', (colorWhite[0] - colorBlack[0]) + ' 0 0 0 ' + colorBlack[0] + ' ' + (colorWhite[1] - colorBlack[1]) + ' 0 0 0 ' + colorBlack[1] + ' ' + (colorWhite[2] - colorBlack[2]) + ' 0 0 0 ' + colorBlack[2] + ' 0 0 0 ' + opacity + ' 0');
44774                }
44775            };
44776
44777            function SVGFillFilter(filter, filterManager) {
44778                this.filterManager = filterManager;
44779                var feColorMatrix = createNS('feColorMatrix');
44780                feColorMatrix.setAttribute('type', 'matrix');
44781                feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');
44782                feColorMatrix.setAttribute('values', '1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0');
44783                filter.appendChild(feColorMatrix);
44784                this.matrixFilter = feColorMatrix;
44785            }
44786
44787            SVGFillFilter.prototype.renderFrame = function (forceRender) {
44788                if (forceRender || this.filterManager._mdf) {
44789                    var color = this.filterManager.effectElements[2].p.v;
44790                    var opacity = this.filterManager.effectElements[6].p.v;
44791                    this.matrixFilter.setAttribute('values', '0 0 0 0 ' + color[0] + ' 0 0 0 0 ' + color[1] + ' 0 0 0 0 ' + color[2] + ' 0 0 0 ' + opacity + ' 0');
44792                }
44793            };
44794
44795            function SVGGaussianBlurEffect(filter, filterManager) {
44796                // Outset the filter region by 100% on all sides to accommodate blur expansion.
44797                filter.setAttribute('x', '-100%');
44798                filter.setAttribute('y', '-100%');
44799                filter.setAttribute('width', '300%');
44800                filter.setAttribute('height', '300%');
44801
44802                this.filterManager = filterManager;
44803                var feGaussianBlur = createNS('feGaussianBlur');
44804                filter.appendChild(feGaussianBlur);
44805                this.feGaussianBlur = feGaussianBlur;
44806            }
44807
44808            SVGGaussianBlurEffect.prototype.renderFrame = function (forceRender) {
44809                if (forceRender || this.filterManager._mdf) {
44810                    // Empirical value, matching AE's blur appearance.
44811                    var kBlurrinessToSigma = 0.3;
44812                    var sigma = this.filterManager.effectElements[0].p.v * kBlurrinessToSigma;
44813
44814                    // Dimensions mapping:
44815                    //
44816                    //   1 -> horizontal & vertical
44817                    //   2 -> horizontal only
44818                    //   3 -> vertical only
44819                    //
44820                    var dimensions = this.filterManager.effectElements[1].p.v;
44821                    var sigmaX = (dimensions == 3) ? 0 : sigma;
44822                    var sigmaY = (dimensions == 2) ? 0 : sigma;
44823
44824                    this.feGaussianBlur.setAttribute('stdDeviation', sigmaX + " " + sigmaY);
44825
44826                    // Repeat edges mapping:
44827                    //
44828                    //   0 -> off -> duplicate
44829                    //   1 -> on  -> wrap
44830                    var edgeMode = (this.filterManager.effectElements[2].p.v == 1) ? 'wrap' : 'duplicate';
44831                    this.feGaussianBlur.setAttribute('edgeMode', edgeMode);
44832                }
44833            }
44834
44835            function SVGStrokeEffect(elem, filterManager) {
44836                this.initialized = false;
44837                this.filterManager = filterManager;
44838                this.elem = elem;
44839                this.paths = [];
44840            }
44841
44842            SVGStrokeEffect.prototype.initialize = function () {
44843
44844                var elemChildren = this.elem.layerElement.children || this.elem.layerElement.childNodes;
44845                var path, groupPath, i, len;
44846                if (this.filterManager.effectElements[1].p.v === 1) {
44847                    len = this.elem.maskManager.masksProperties.length;
44848                    i = 0;
44849                } else {
44850                    i = this.filterManager.effectElements[0].p.v - 1;
44851                    len = i + 1;
44852                }
44853                groupPath = createNS('g');
44854                groupPath.setAttribute('fill', 'none');
44855                groupPath.setAttribute('stroke-linecap', 'round');
44856                groupPath.setAttribute('stroke-dashoffset', 1);
44857                for (i; i < len; i += 1) {
44858                    path = createNS('path');
44859                    groupPath.appendChild(path);
44860                    this.paths.push({p: path, m: i});
44861                }
44862                if (this.filterManager.effectElements[10].p.v === 3) {
44863                    var mask = createNS('mask');
44864                    var id = createElementID();
44865                    mask.setAttribute('id', id);
44866                    mask.setAttribute('mask-type', 'alpha');
44867                    mask.appendChild(groupPath);
44868                    this.elem.globalData.defs.appendChild(mask);
44869                    var g = createNS('g');
44870                    g.setAttribute('mask', 'url(' + locationHref + '#' + id + ')');
44871                    while (elemChildren[0]) {
44872                        g.appendChild(elemChildren[0]);
44873                    }
44874                    this.elem.layerElement.appendChild(g);
44875                    this.masker = mask;
44876                    groupPath.setAttribute('stroke', '#fff');
44877                } else if (this.filterManager.effectElements[10].p.v === 1 || this.filterManager.effectElements[10].p.v === 2) {
44878                    if (this.filterManager.effectElements[10].p.v === 2) {
44879                        elemChildren = this.elem.layerElement.children || this.elem.layerElement.childNodes;
44880                        while (elemChildren.length) {
44881                            this.elem.layerElement.removeChild(elemChildren[0]);
44882                        }
44883                    }
44884                    this.elem.layerElement.appendChild(groupPath);
44885                    this.elem.layerElement.removeAttribute('mask');
44886                    groupPath.setAttribute('stroke', '#fff');
44887                }
44888                this.initialized = true;
44889                this.pathMasker = groupPath;
44890            };
44891
44892            SVGStrokeEffect.prototype.renderFrame = function (forceRender) {
44893                if (!this.initialized) {
44894                    this.initialize();
44895                }
44896                var i, len = this.paths.length;
44897                var mask, path;
44898                for (i = 0; i < len; i += 1) {
44899                    if (this.paths[i].m === -1) {
44900                        continue;
44901                    }
44902                    mask = this.elem.maskManager.viewData[this.paths[i].m];
44903                    path = this.paths[i].p;
44904                    if (forceRender || this.filterManager._mdf || mask.prop._mdf) {
44905                        path.setAttribute('d', mask.lastPath);
44906                    }
44907                    if (forceRender || this.filterManager.effectElements[9].p._mdf || this.filterManager.effectElements[4].p._mdf || this.filterManager.effectElements[7].p._mdf || this.filterManager.effectElements[8].p._mdf || mask.prop._mdf) {
44908                        var dasharrayValue;
44909                        if (this.filterManager.effectElements[7].p.v !== 0 || this.filterManager.effectElements[8].p.v !== 100) {
44910                            var s = Math.min(this.filterManager.effectElements[7].p.v, this.filterManager.effectElements[8].p.v) / 100;
44911                            var e = Math.max(this.filterManager.effectElements[7].p.v, this.filterManager.effectElements[8].p.v) / 100;
44912                            var l = path.getTotalLength();
44913                            dasharrayValue = '0 0 0 ' + l * s + ' ';
44914                            var lineLength = l * (e - s);
44915                            var segment = 1 + this.filterManager.effectElements[4].p.v * 2 * this.filterManager.effectElements[9].p.v / 100;
44916                            var units = Math.floor(lineLength / segment);
44917                            var j;
44918                            for (j = 0; j < units; j += 1) {
44919                                dasharrayValue += '1 ' + this.filterManager.effectElements[4].p.v * 2 * this.filterManager.effectElements[9].p.v / 100 + ' ';
44920                            }
44921                            dasharrayValue += '0 ' + l * 10 + ' 0 0';
44922                        } else {
44923                            dasharrayValue = '1 ' + this.filterManager.effectElements[4].p.v * 2 * this.filterManager.effectElements[9].p.v / 100;
44924                        }
44925                        path.setAttribute('stroke-dasharray', dasharrayValue);
44926                    }
44927                }
44928                if (forceRender || this.filterManager.effectElements[4].p._mdf) {
44929                    this.pathMasker.setAttribute('stroke-width', this.filterManager.effectElements[4].p.v * 2);
44930                }
44931
44932                if (forceRender || this.filterManager.effectElements[6].p._mdf) {
44933                    this.pathMasker.setAttribute('opacity', this.filterManager.effectElements[6].p.v);
44934                }
44935                if (this.filterManager.effectElements[10].p.v === 1 || this.filterManager.effectElements[10].p.v === 2) {
44936                    if (forceRender || this.filterManager.effectElements[3].p._mdf) {
44937                        var color = this.filterManager.effectElements[3].p.v;
44938                        this.pathMasker.setAttribute('stroke', 'rgb(' + bm_floor(color[0] * 255) + ',' + bm_floor(color[1] * 255) + ',' + bm_floor(color[2] * 255) + ')');
44939                    }
44940                }
44941            };
44942
44943            function SVGTritoneFilter(filter, filterManager) {
44944                this.filterManager = filterManager;
44945                var feColorMatrix = createNS('feColorMatrix');
44946                feColorMatrix.setAttribute('type', 'matrix');
44947                feColorMatrix.setAttribute('color-interpolation-filters', 'linearRGB');
44948                feColorMatrix.setAttribute('values', '0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0');
44949                feColorMatrix.setAttribute('result', 'f1');
44950                filter.appendChild(feColorMatrix);
44951                var feComponentTransfer = createNS('feComponentTransfer');
44952                feComponentTransfer.setAttribute('color-interpolation-filters', 'sRGB');
44953                filter.appendChild(feComponentTransfer);
44954                this.matrixFilter = feComponentTransfer;
44955                var feFuncR = createNS('feFuncR');
44956                feFuncR.setAttribute('type', 'table');
44957                feComponentTransfer.appendChild(feFuncR);
44958                this.feFuncR = feFuncR;
44959                var feFuncG = createNS('feFuncG');
44960                feFuncG.setAttribute('type', 'table');
44961                feComponentTransfer.appendChild(feFuncG);
44962                this.feFuncG = feFuncG;
44963                var feFuncB = createNS('feFuncB');
44964                feFuncB.setAttribute('type', 'table');
44965                feComponentTransfer.appendChild(feFuncB);
44966                this.feFuncB = feFuncB;
44967            }
44968
44969            SVGTritoneFilter.prototype.renderFrame = function (forceRender) {
44970                if (forceRender || this.filterManager._mdf) {
44971                    var color1 = this.filterManager.effectElements[0].p.v;
44972                    var color2 = this.filterManager.effectElements[1].p.v;
44973                    var color3 = this.filterManager.effectElements[2].p.v;
44974                    var tableR = color3[0] + ' ' + color2[0] + ' ' + color1[0];
44975                    var tableG = color3[1] + ' ' + color2[1] + ' ' + color1[1];
44976                    var tableB = color3[2] + ' ' + color2[2] + ' ' + color1[2];
44977                    this.feFuncR.setAttribute('tableValues', tableR);
44978                    this.feFuncG.setAttribute('tableValues', tableG);
44979                    this.feFuncB.setAttribute('tableValues', tableB);
44980                    //var opacity = this.filterManager.effectElements[2].p.v/100;
44981                    //this.matrixFilter.setAttribute('values',(colorWhite[0]- colorBlack[0])+' 0 0 0 '+ colorBlack[0] +' '+ (colorWhite[1]- colorBlack[1]) +' 0 0 0 '+ colorBlack[1] +' '+ (colorWhite[2]- colorBlack[2]) +' 0 0 0 '+ colorBlack[2] +' 0 0 0 ' + opacity + ' 0');
44982                }
44983            };
44984
44985            function SVGProLevelsFilter(filter, filterManager) {
44986                this.filterManager = filterManager;
44987                var effectElements = this.filterManager.effectElements;
44988                var feComponentTransfer = createNS('feComponentTransfer');
44989                var feFuncR, feFuncG, feFuncB;
44990
44991                if (effectElements[10].p.k || effectElements[10].p.v !== 0 || effectElements[11].p.k || effectElements[11].p.v !== 1 || effectElements[12].p.k || effectElements[12].p.v !== 1 || effectElements[13].p.k || effectElements[13].p.v !== 0 || effectElements[14].p.k || effectElements[14].p.v !== 1) {
44992                    this.feFuncR = this.createFeFunc('feFuncR', feComponentTransfer);
44993                }
44994                if (effectElements[17].p.k || effectElements[17].p.v !== 0 || effectElements[18].p.k || effectElements[18].p.v !== 1 || effectElements[19].p.k || effectElements[19].p.v !== 1 || effectElements[20].p.k || effectElements[20].p.v !== 0 || effectElements[21].p.k || effectElements[21].p.v !== 1) {
44995                    this.feFuncG = this.createFeFunc('feFuncG', feComponentTransfer);
44996                }
44997                if (effectElements[24].p.k || effectElements[24].p.v !== 0 || effectElements[25].p.k || effectElements[25].p.v !== 1 || effectElements[26].p.k || effectElements[26].p.v !== 1 || effectElements[27].p.k || effectElements[27].p.v !== 0 || effectElements[28].p.k || effectElements[28].p.v !== 1) {
44998                    this.feFuncB = this.createFeFunc('feFuncB', feComponentTransfer);
44999                }
45000                if (effectElements[31].p.k || effectElements[31].p.v !== 0 || effectElements[32].p.k || effectElements[32].p.v !== 1 || effectElements[33].p.k || effectElements[33].p.v !== 1 || effectElements[34].p.k || effectElements[34].p.v !== 0 || effectElements[35].p.k || effectElements[35].p.v !== 1) {
45001                    this.feFuncA = this.createFeFunc('feFuncA', feComponentTransfer);
45002                }
45003
45004                if (this.feFuncR || this.feFuncG || this.feFuncB || this.feFuncA) {
45005                    feComponentTransfer.setAttribute('color-interpolation-filters', 'sRGB');
45006                    filter.appendChild(feComponentTransfer);
45007                    feComponentTransfer = createNS('feComponentTransfer');
45008                }
45009
45010                if (effectElements[3].p.k || effectElements[3].p.v !== 0 || effectElements[4].p.k || effectElements[4].p.v !== 1 || effectElements[5].p.k || effectElements[5].p.v !== 1 || effectElements[6].p.k || effectElements[6].p.v !== 0 || effectElements[7].p.k || effectElements[7].p.v !== 1) {
45011
45012                    feComponentTransfer.setAttribute('color-interpolation-filters', 'sRGB');
45013                    filter.appendChild(feComponentTransfer);
45014                    this.feFuncRComposed = this.createFeFunc('feFuncR', feComponentTransfer);
45015                    this.feFuncGComposed = this.createFeFunc('feFuncG', feComponentTransfer);
45016                    this.feFuncBComposed = this.createFeFunc('feFuncB', feComponentTransfer);
45017                }
45018            }
45019
45020            SVGProLevelsFilter.prototype.createFeFunc = function (type, feComponentTransfer) {
45021                var feFunc = createNS(type);
45022                feFunc.setAttribute('type', 'table');
45023                feComponentTransfer.appendChild(feFunc);
45024                return feFunc;
45025            };
45026
45027            SVGProLevelsFilter.prototype.getTableValue = function (inputBlack, inputWhite, gamma, outputBlack, outputWhite) {
45028                var cnt = 0;
45029                var segments = 256;
45030                var perc;
45031                var min = Math.min(inputBlack, inputWhite);
45032                var max = Math.max(inputBlack, inputWhite);
45033                var table = Array.call(null, {length: segments});
45034                var colorValue;
45035                var pos = 0;
45036                var outputDelta = outputWhite - outputBlack;
45037                var inputDelta = inputWhite - inputBlack;
45038                while (cnt <= 256) {
45039                    perc = cnt / 256;
45040                    if (perc <= min) {
45041                        colorValue = inputDelta < 0 ? outputWhite : outputBlack;
45042                    } else if (perc >= max) {
45043                        colorValue = inputDelta < 0 ? outputBlack : outputWhite;
45044                    } else {
45045                        colorValue = (outputBlack + outputDelta * Math.pow((perc - inputBlack) / inputDelta, 1 / gamma));
45046                    }
45047                    table[pos++] = colorValue;
45048                    cnt += 256 / (segments - 1);
45049                }
45050                return table.join(' ');
45051            };
45052
45053            SVGProLevelsFilter.prototype.renderFrame = function (forceRender) {
45054                if (forceRender || this.filterManager._mdf) {
45055                    var val, cnt, perc, bezier;
45056                    var effectElements = this.filterManager.effectElements;
45057                    if (this.feFuncRComposed && (forceRender || effectElements[3].p._mdf || effectElements[4].p._mdf || effectElements[5].p._mdf || effectElements[6].p._mdf || effectElements[7].p._mdf)) {
45058                        val = this.getTableValue(effectElements[3].p.v, effectElements[4].p.v, effectElements[5].p.v, effectElements[6].p.v, effectElements[7].p.v);
45059                        this.feFuncRComposed.setAttribute('tableValues', val);
45060                        this.feFuncGComposed.setAttribute('tableValues', val);
45061                        this.feFuncBComposed.setAttribute('tableValues', val);
45062                    }
45063
45064
45065                    if (this.feFuncR && (forceRender || effectElements[10].p._mdf || effectElements[11].p._mdf || effectElements[12].p._mdf || effectElements[13].p._mdf || effectElements[14].p._mdf)) {
45066                        val = this.getTableValue(effectElements[10].p.v, effectElements[11].p.v, effectElements[12].p.v, effectElements[13].p.v, effectElements[14].p.v);
45067                        this.feFuncR.setAttribute('tableValues', val);
45068                    }
45069
45070                    if (this.feFuncG && (forceRender || effectElements[17].p._mdf || effectElements[18].p._mdf || effectElements[19].p._mdf || effectElements[20].p._mdf || effectElements[21].p._mdf)) {
45071                        val = this.getTableValue(effectElements[17].p.v, effectElements[18].p.v, effectElements[19].p.v, effectElements[20].p.v, effectElements[21].p.v);
45072                        this.feFuncG.setAttribute('tableValues', val);
45073                    }
45074
45075                    if (this.feFuncB && (forceRender || effectElements[24].p._mdf || effectElements[25].p._mdf || effectElements[26].p._mdf || effectElements[27].p._mdf || effectElements[28].p._mdf)) {
45076                        val = this.getTableValue(effectElements[24].p.v, effectElements[25].p.v, effectElements[26].p.v, effectElements[27].p.v, effectElements[28].p.v);
45077                        this.feFuncB.setAttribute('tableValues', val);
45078                    }
45079
45080                    if (this.feFuncA && (forceRender || effectElements[31].p._mdf || effectElements[32].p._mdf || effectElements[33].p._mdf || effectElements[34].p._mdf || effectElements[35].p._mdf)) {
45081                        val = this.getTableValue(effectElements[31].p.v, effectElements[32].p.v, effectElements[33].p.v, effectElements[34].p.v, effectElements[35].p.v);
45082                        this.feFuncA.setAttribute('tableValues', val);
45083                    }
45084
45085                }
45086            };
45087
45088            function SVGDropShadowEffect(filter, filterManager) {
45089                var filterSize = filterManager.container.globalData.renderConfig.filterSize
45090                filter.setAttribute('x', filterSize.x);
45091                filter.setAttribute('y', filterSize.y);
45092                filter.setAttribute('width', filterSize.width);
45093                filter.setAttribute('height', filterSize.height);
45094                this.filterManager = filterManager;
45095
45096                var feGaussianBlur = createNS('feGaussianBlur');
45097                feGaussianBlur.setAttribute('in', 'SourceAlpha');
45098                feGaussianBlur.setAttribute('result', 'drop_shadow_1');
45099                feGaussianBlur.setAttribute('stdDeviation', '0');
45100                this.feGaussianBlur = feGaussianBlur;
45101                filter.appendChild(feGaussianBlur);
45102
45103                var feOffset = createNS('feOffset');
45104                feOffset.setAttribute('dx', '25');
45105                feOffset.setAttribute('dy', '0');
45106                feOffset.setAttribute('in', 'drop_shadow_1');
45107                feOffset.setAttribute('result', 'drop_shadow_2');
45108                this.feOffset = feOffset;
45109                filter.appendChild(feOffset);
45110                var feFlood = createNS('feFlood');
45111                feFlood.setAttribute('flood-color', '#00ff00');
45112                feFlood.setAttribute('flood-opacity', '1');
45113                feFlood.setAttribute('result', 'drop_shadow_3');
45114                this.feFlood = feFlood;
45115                filter.appendChild(feFlood);
45116
45117                var feComposite = createNS('feComposite');
45118                feComposite.setAttribute('in', 'drop_shadow_3');
45119                feComposite.setAttribute('in2', 'drop_shadow_2');
45120                feComposite.setAttribute('operator', 'in');
45121                feComposite.setAttribute('result', 'drop_shadow_4');
45122                filter.appendChild(feComposite);
45123
45124
45125                var feMerge = createNS('feMerge');
45126                filter.appendChild(feMerge);
45127                var feMergeNode;
45128                feMergeNode = createNS('feMergeNode');
45129                feMerge.appendChild(feMergeNode);
45130                feMergeNode = createNS('feMergeNode');
45131                feMergeNode.setAttribute('in', 'SourceGraphic');
45132                this.feMergeNode = feMergeNode;
45133                this.feMerge = feMerge;
45134                this.originalNodeAdded = false;
45135                feMerge.appendChild(feMergeNode);
45136            }
45137
45138            SVGDropShadowEffect.prototype.renderFrame = function (forceRender) {
45139                if (forceRender || this.filterManager._mdf) {
45140                    if (forceRender || this.filterManager.effectElements[4].p._mdf) {
45141                        this.feGaussianBlur.setAttribute('stdDeviation', this.filterManager.effectElements[4].p.v / 4);
45142                    }
45143                    if (forceRender || this.filterManager.effectElements[0].p._mdf) {
45144                        var col = this.filterManager.effectElements[0].p.v;
45145                        this.feFlood.setAttribute('flood-color', rgbToHex(Math.round(col[0] * 255), Math.round(col[1] * 255), Math.round(col[2] * 255)));
45146                    }
45147                    if (forceRender || this.filterManager.effectElements[1].p._mdf) {
45148                        this.feFlood.setAttribute('flood-opacity', this.filterManager.effectElements[1].p.v / 255);
45149                    }
45150                    if (forceRender || this.filterManager.effectElements[2].p._mdf || this.filterManager.effectElements[3].p._mdf) {
45151                        var distance = this.filterManager.effectElements[3].p.v;
45152                        var angle = (this.filterManager.effectElements[2].p.v - 90) * degToRads;
45153                        var x = distance * Math.cos(angle);
45154                        var y = distance * Math.sin(angle);
45155                        this.feOffset.setAttribute('dx', x);
45156                        this.feOffset.setAttribute('dy', y);
45157                    }
45158                    /*if(forceRender || this.filterManager.effectElements[5].p._mdf){
45159            if(this.filterManager.effectElements[5].p.v === 1 && this.originalNodeAdded) {
45160                this.feMerge.removeChild(this.feMergeNode);
45161                this.originalNodeAdded = false;
45162            } else if(this.filterManager.effectElements[5].p.v === 0 && !this.originalNodeAdded) {
45163                this.feMerge.appendChild(this.feMergeNode);
45164                this.originalNodeAdded = true;
45165            }
45166        }*/
45167                }
45168            };
45169            var _svgMatteSymbols = [];
45170
45171            function SVGMatte3Effect(filterElem, filterManager, elem) {
45172                this.initialized = false;
45173                this.filterManager = filterManager;
45174                this.filterElem = filterElem;
45175                this.elem = elem;
45176                elem.matteElement = createNS('g');
45177                elem.matteElement.appendChild(elem.layerElement);
45178                elem.matteElement.appendChild(elem.transformedElement);
45179                elem.baseElement = elem.matteElement;
45180            }
45181
45182            SVGMatte3Effect.prototype.findSymbol = function (mask) {
45183                var i = 0, len = _svgMatteSymbols.length;
45184                while (i < len) {
45185                    if (_svgMatteSymbols[i] === mask) {
45186                        return _svgMatteSymbols[i];
45187                    }
45188                    i += 1;
45189                }
45190                return null;
45191            };
45192
45193            SVGMatte3Effect.prototype.replaceInParent = function (mask, symbolId) {
45194                var parentNode = mask.layerElement.parentNode;
45195                if (!parentNode) {
45196                    return;
45197                }
45198                var children = parentNode.children;
45199                var i = 0, len = children.length;
45200                while (i < len) {
45201                    if (children[i] === mask.layerElement) {
45202                        break;
45203                    }
45204                    i += 1;
45205                }
45206                var nextChild;
45207                if (i <= len - 2) {
45208                    nextChild = children[i + 1];
45209                }
45210                var useElem = createNS('use');
45211                useElem.setAttribute('href', '#' + symbolId);
45212                if (nextChild) {
45213                    parentNode.insertBefore(useElem, nextChild);
45214                } else {
45215                    parentNode.appendChild(useElem);
45216                }
45217            };
45218
45219            SVGMatte3Effect.prototype.setElementAsMask = function (elem, mask) {
45220                if (!this.findSymbol(mask)) {
45221                    var symbolId = createElementID();
45222                    var masker = createNS('mask');
45223                    masker.setAttribute('id', mask.layerId);
45224                    masker.setAttribute('mask-type', 'alpha');
45225                    _svgMatteSymbols.push(mask);
45226                    var defs = elem.globalData.defs;
45227                    defs.appendChild(masker);
45228                    var symbol = createNS('symbol');
45229                    symbol.setAttribute('id', symbolId);
45230                    this.replaceInParent(mask, symbolId);
45231                    symbol.appendChild(mask.layerElement);
45232                    defs.appendChild(symbol);
45233                    var useElem = createNS('use');
45234                    useElem.setAttribute('href', '#' + symbolId);
45235                    masker.appendChild(useElem);
45236                    mask.data.hd = false;
45237                    mask.show();
45238                }
45239                elem.setMatte(mask.layerId);
45240            };
45241
45242            SVGMatte3Effect.prototype.initialize = function () {
45243                var ind = this.filterManager.effectElements[0].p.v;
45244                var elements = this.elem.comp.elements;
45245                var i = 0, len = elements.length;
45246                while (i < len) {
45247                    if (elements[i] && elements[i].data.ind === ind) {
45248                        this.setElementAsMask(this.elem, elements[i]);
45249                    }
45250                    i += 1;
45251                }
45252                this.initialized = true;
45253            };
45254
45255            SVGMatte3Effect.prototype.renderFrame = function () {
45256                if (!this.initialized) {
45257                    this.initialize();
45258                }
45259            };
45260
45261            function SVGEffects(elem) {
45262                var i, len = elem.data.ef ? elem.data.ef.length : 0;
45263                var filId = createElementID();
45264                var fil = filtersFactory.createFilter(filId);
45265                var count = 0;
45266                this.filters = [];
45267                var filterManager;
45268                for (i = 0; i < len; i += 1) {
45269                    filterManager = null;
45270                    if (elem.data.ef[i].ty === 20) {
45271                        count += 1;
45272                        filterManager = new SVGTintFilter(fil, elem.effectsManager.effectElements[i]);
45273                    } else if (elem.data.ef[i].ty === 21) {
45274                        count += 1;
45275                        filterManager = new SVGFillFilter(fil, elem.effectsManager.effectElements[i]);
45276                    } else if (elem.data.ef[i].ty === 22) {
45277                        filterManager = new SVGStrokeEffect(elem, elem.effectsManager.effectElements[i]);
45278                    } else if (elem.data.ef[i].ty === 23) {
45279                        count += 1;
45280                        filterManager = new SVGTritoneFilter(fil, elem.effectsManager.effectElements[i]);
45281                    } else if (elem.data.ef[i].ty === 24) {
45282                        count += 1;
45283                        filterManager = new SVGProLevelsFilter(fil, elem.effectsManager.effectElements[i]);
45284                    } else if (elem.data.ef[i].ty === 25) {
45285                        count += 1;
45286                        filterManager = new SVGDropShadowEffect(fil, elem.effectsManager.effectElements[i]);
45287                    } else if (elem.data.ef[i].ty === 28) {
45288                        //count += 1;
45289                        filterManager = new SVGMatte3Effect(fil, elem.effectsManager.effectElements[i], elem);
45290                    } else if (elem.data.ef[i].ty === 29) {
45291                        count += 1;
45292                        filterManager = new SVGGaussianBlurEffect(fil, elem.effectsManager.effectElements[i]);
45293                    }
45294                    if (filterManager) {
45295                        this.filters.push(filterManager);
45296                    }
45297                }
45298                if (count) {
45299                    elem.globalData.defs.appendChild(fil);
45300                    elem.layerElement.setAttribute('filter', 'url(' + locationHref + '#' + filId + ')');
45301                }
45302                if (this.filters.length) {
45303                    elem.addRenderableComponent(this);
45304                }
45305            }
45306
45307            SVGEffects.prototype.renderFrame = function (_isFirstFrame) {
45308                var i, len = this.filters.length;
45309                for (i = 0; i < len; i += 1) {
45310                    this.filters[i].renderFrame(_isFirstFrame);
45311                }
45312            };
45313
45314            function CVContextData() {
45315                this.saved = [];
45316                this.cArrPos = 0;
45317                this.cTr = new Matrix();
45318                this.cO = 1;
45319                var i, len = 15;
45320                this.savedOp = createTypedArray('float32', len);
45321                for (i = 0; i < len; i += 1) {
45322                    this.saved[i] = createTypedArray('float32', 16);
45323                }
45324                this._length = len;
45325            }
45326
45327            CVContextData.prototype.duplicate = function () {
45328                var newLength = this._length * 2;
45329                var currentSavedOp = this.savedOp;
45330                this.savedOp = createTypedArray('float32', newLength);
45331                this.savedOp.set(currentSavedOp);
45332                var i = 0;
45333                for (i = this._length; i < newLength; i += 1) {
45334                    this.saved[i] = createTypedArray('float32', 16);
45335                }
45336                this._length = newLength;
45337            };
45338
45339            CVContextData.prototype.reset = function () {
45340                this.cArrPos = 0;
45341                this.cTr.reset();
45342                this.cO = 1;
45343            };
45344
45345            function CVBaseElement() {
45346            }
45347
45348            CVBaseElement.prototype = {
45349                createElements: function () {
45350                },
45351                initRendererElement: function () {
45352                },
45353                createContainerElements: function () {
45354                    this.canvasContext = this.globalData.canvasContext;
vendor: 4,238 bytes, lines 45355-45439
45355                    this.renderableEffectsManager = new CVEffects(this);
45356                },
45357                createContent: function () {
45358                },
45359                setBlendMode: function () {
45360                    var globalData = this.globalData;
45361                    if (globalData.blendMode !== this.data.bm) {
45362                        globalData.blendMode = this.data.bm;
45363                        var blendModeValue = getBlendMode(this.data.bm);
45364                        globalData.canvasContext.globalCompositeOperation = blendModeValue;
45365                    }
45366                },
45367                createRenderableComponents: function () {
45368                    this.maskManager = new CVMaskElement(this.data, this);
45369                },
45370                hideElement: function () {
45371                    if (!this.hidden && (!this.isInRange || this.isTransparent)) {
45372                        this.hidden = true;
45373                    }
45374                },
45375                showElement: function () {
45376                    if (this.isInRange && !this.isTransparent) {
45377                        this.hidden = false;
45378                        this._isFirstFrame = true;
45379                        this.maskManager._isFirstFrame = true;
45380                    }
45381                },
45382                renderFrame: function () {
45383                    if (this.hidden || this.data.hd) {
45384                        return;
45385                    }
45386                    this.renderTransform();
45387                    this.renderRenderable();
45388                    this.setBlendMode();
45389                    var forceRealStack = this.data.ty === 0;
45390                    this.globalData.renderer.save(forceRealStack);
45391                    this.globalData.renderer.ctxTransform(this.finalTransform.mat.props);
45392                    this.globalData.renderer.ctxOpacity(this.finalTransform.mProp.o.v);
45393                    this.renderInnerContent();
45394                    this.globalData.renderer.restore(forceRealStack);
45395                    if (this.maskManager.hasMasks) {
45396                        this.globalData.renderer.restore(true);
45397                    }
45398                    if (this._isFirstFrame) {
45399                        this._isFirstFrame = false;
45400                    }
45401                },
45402                destroy: function () {
45403                    this.canvasContext = null;
45404                    this.data = null;
45405                    this.globalData = null;
45406                    this.maskManager.destroy();
45407                },
45408                mHelper: new Matrix()
45409            };
45410            CVBaseElement.prototype.hide = CVBaseElement.prototype.hideElement;
45411            CVBaseElement.prototype.show = CVBaseElement.prototype.showElement;
45412
45413            function CVImageElement(data, globalData, comp) {
45414                this.assetData = globalData.getAssetData(data.refId);
45415                this.img = globalData.imageLoader.getImage(this.assetData);
45416                this.initElement(data, globalData, comp);
45417            }
45418
45419            extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement], CVImageElement);
45420
45421            CVImageElement.prototype.initElement = SVGShapeElement.prototype.initElement;
45422            CVImageElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame;
45423
45424            CVImageElement.prototype.createContent = function () {
45425
45426                if (this.img.width && (this.assetData.w !== this.img.width || this.assetData.h !== this.img.height)) {
45427                    var canvas = createTag('canvas');
45428                    canvas.width = this.assetData.w;
45429                    canvas.height = this.assetData.h;
45430                    var ctx = canvas.getContext('2d');
45431
45432                    var imgW = this.img.width;
45433                    var imgH = this.img.height;
45434                    var imgRel = imgW / imgH;
45435                    var canvasRel = this.assetData.w / this.assetData.h;
45436                    var widthCrop, heightCrop;
45437                    var par = this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio;
45438                    if ((imgRel > canvasRel && par === 'xMidYMid slice') || (imgRel < canvasRel && par !== 'xMidYMid slice')) {
45439                        heightCrop = imgH;
vendor: 12,699 bytes, lines 45440-45714
45440                        widthCrop = heightCrop * canvasRel;
45441                    } else {
45442                        widthCrop = imgW;
45443                        heightCrop = widthCrop / canvasRel;
45444                    }
45445                    ctx.drawImage(this.img, (imgW - widthCrop) / 2, (imgH - heightCrop) / 2, widthCrop, heightCrop, 0, 0, this.assetData.w, this.assetData.h);
45446                    this.img = canvas;
45447                }
45448
45449            };
45450
45451            CVImageElement.prototype.renderInnerContent = function (parentMatrix) {
45452                this.canvasContext.drawImage(this.img, 0, 0);
45453            };
45454
45455            CVImageElement.prototype.destroy = function () {
45456                this.img = null;
45457            };
45458
45459            function CVCompElement(data, globalData, comp) {
45460                this.completeLayers = false;
45461                this.layers = data.layers;
45462                this.pendingElements = [];
45463                this.elements = createSizedArray(this.layers.length);
45464                this.initElement(data, globalData, comp);
45465                this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : {_placeholder: true};
45466            }
45467
45468            extendPrototype([CanvasRenderer, ICompElement, CVBaseElement], CVCompElement);
45469
45470            CVCompElement.prototype.renderInnerContent = function () {
45471                var ctx = this.canvasContext;
45472                ctx.beginPath();
45473                ctx.moveTo(0, 0);
45474                ctx.lineTo(this.data.w, 0);
45475                ctx.lineTo(this.data.w, this.data.h);
45476                ctx.lineTo(0, this.data.h);
45477                ctx.lineTo(0, 0);
45478                ctx.clip();
45479                var i, len = this.layers.length;
45480                for (i = len - 1; i >= 0; i -= 1) {
45481                    if (this.completeLayers || this.elements[i]) {
45482                        this.elements[i].renderFrame();
45483                    }
45484                }
45485            };
45486
45487            CVCompElement.prototype.destroy = function () {
45488                var i, len = this.layers.length;
45489                for (i = len - 1; i >= 0; i -= 1) {
45490                    if (this.elements[i]) {
45491                        this.elements[i].destroy();
45492                    }
45493                }
45494                this.layers = null;
45495                this.elements = null;
45496            };
45497
45498            function CVMaskElement(data, element) {
45499                this.data = data;
45500                this.element = element;
45501                this.masksProperties = this.data.masksProperties || [];
45502                this.viewData = createSizedArray(this.masksProperties.length);
45503                var i, len = this.masksProperties.length, hasMasks = false;
45504                for (i = 0; i < len; i++) {
45505                    if (this.masksProperties[i].mode !== 'n') {
45506                        hasMasks = true;
45507                    }
45508                    this.viewData[i] = ShapePropertyFactory.getShapeProp(this.element, this.masksProperties[i], 3);
45509                }
45510                this.hasMasks = hasMasks;
45511                if (hasMasks) {
45512                    this.element.addRenderableComponent(this);
45513                }
45514            }
45515
45516            CVMaskElement.prototype.renderFrame = function () {
45517                if (!this.hasMasks) {
45518                    return;
45519                }
45520                var transform = this.element.finalTransform.mat;
45521                var ctx = this.element.canvasContext;
45522                var i, len = this.masksProperties.length;
45523                var pt, pts, data;
45524                ctx.beginPath();
45525                for (i = 0; i < len; i++) {
45526                    if (this.masksProperties[i].mode !== 'n') {
45527                        if (this.masksProperties[i].inv) {
45528                            ctx.moveTo(0, 0);
45529                            ctx.lineTo(this.element.globalData.compSize.w, 0);
45530                            ctx.lineTo(this.element.globalData.compSize.w, this.element.globalData.compSize.h);
45531                            ctx.lineTo(0, this.element.globalData.compSize.h);
45532                            ctx.lineTo(0, 0);
45533                        }
45534                        data = this.viewData[i].v;
45535                        pt = transform.applyToPointArray(data.v[0][0], data.v[0][1], 0);
45536                        ctx.moveTo(pt[0], pt[1]);
45537                        var j, jLen = data._length;
45538                        for (j = 1; j < jLen; j++) {
45539                            pts = transform.applyToTriplePoints(data.o[j - 1], data.i[j], data.v[j]);
45540                            ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]);
45541                        }
45542                        pts = transform.applyToTriplePoints(data.o[j - 1], data.i[0], data.v[0]);
45543                        ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]);
45544                    }
45545                }
45546                this.element.globalData.renderer.save(true);
45547                ctx.clip();
45548            };
45549
45550            CVMaskElement.prototype.getMaskProperty = MaskElement.prototype.getMaskProperty;
45551
45552            CVMaskElement.prototype.destroy = function () {
45553                this.element = null;
45554            };
45555
45556            function CVShapeElement(data, globalData, comp) {
45557                this.shapes = [];
45558                this.shapesData = data.shapes;
45559                this.stylesList = [];
45560                this.itemsData = [];
45561                this.prevViewData = [];
45562                this.shapeModifiers = [];
45563                this.processedElements = [];
45564                this.transformsManager = new ShapeTransformManager();
45565                this.initElement(data, globalData, comp);
45566            }
45567
45568            extendPrototype([BaseElement, TransformElement, CVBaseElement, IShapeElement, HierarchyElement, FrameElement, RenderableElement], CVShapeElement);
45569
45570            CVShapeElement.prototype.initElement = RenderableDOMElement.prototype.initElement;
45571
45572            CVShapeElement.prototype.transformHelper = {opacity: 1, _opMdf: false};
45573
45574            CVShapeElement.prototype.dashResetter = [];
45575
45576            CVShapeElement.prototype.createContent = function () {
45577                this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, true, []);
45578            };
45579
45580            CVShapeElement.prototype.createStyleElement = function (data, transforms) {
45581                var styleElem = {
45582                    data: data,
45583                    type: data.ty,
45584                    preTransforms: this.transformsManager.addTransformSequence(transforms),
45585                    transforms: [],
45586                    elements: [],
45587                    closed: data.hd === true
45588                };
45589                var elementData = {};
45590                if (data.ty == 'fl' || data.ty == 'st') {
45591                    elementData.c = PropertyFactory.getProp(this, data.c, 1, 255, this);
45592                    if (!elementData.c.k) {
45593                        styleElem.co = 'rgb(' + bm_floor(elementData.c.v[0]) + ',' + bm_floor(elementData.c.v[1]) + ',' + bm_floor(elementData.c.v[2]) + ')';
45594                    }
45595                } else if (data.ty === 'gf' || data.ty === 'gs') {
45596                    elementData.s = PropertyFactory.getProp(this, data.s, 1, null, this);
45597                    elementData.e = PropertyFactory.getProp(this, data.e, 1, null, this);
45598                    elementData.h = PropertyFactory.getProp(this, data.h || {k: 0}, 0, 0.01, this);
45599                    elementData.a = PropertyFactory.getProp(this, data.a || {k: 0}, 0, degToRads, this);
45600                    elementData.g = new GradientProperty(this, data.g, this);
45601                }
45602                elementData.o = PropertyFactory.getProp(this, data.o, 0, 0.01, this);
45603                if (data.ty == 'st' || data.ty == 'gs') {
45604                    styleElem.lc = this.lcEnum[data.lc] || 'round';
45605                    styleElem.lj = this.ljEnum[data.lj] || 'round';
45606                    if (data.lj == 1) {
45607                        styleElem.ml = data.ml;
45608                    }
45609                    elementData.w = PropertyFactory.getProp(this, data.w, 0, null, this);
45610                    if (!elementData.w.k) {
45611                        styleElem.wi = elementData.w.v;
45612                    }
45613                    if (data.d) {
45614                        var d = new DashProperty(this, data.d, 'canvas', this);
45615                        elementData.d = d;
45616                        if (!elementData.d.k) {
45617                            styleElem.da = elementData.d.dashArray;
45618                            styleElem.do = elementData.d.dashoffset[0];
45619                        }
45620                    }
45621                } else {
45622                    styleElem.r = data.r === 2 ? 'evenodd' : 'nonzero';
45623                }
45624                this.stylesList.push(styleElem);
45625                elementData.style = styleElem;
45626                return elementData;
45627            };
45628
45629            CVShapeElement.prototype.createGroupElement = function (data) {
45630                var elementData = {
45631                    it: [],
45632                    prevViewData: []
45633                };
45634                return elementData;
45635            };
45636
45637            CVShapeElement.prototype.createTransformElement = function (data) {
45638                var elementData = {
45639                    transform: {
45640                        opacity: 1,
45641                        _opMdf: false,
45642                        key: this.transformsManager.getNewKey(),
45643                        op: PropertyFactory.getProp(this, data.o, 0, 0.01, this),
45644                        mProps: TransformPropertyFactory.getTransformProperty(this, data, this)
45645                    }
45646                };
45647                return elementData;
45648            };
45649
45650            CVShapeElement.prototype.createShapeElement = function (data) {
45651                var elementData = new CVShapeData(this, data, this.stylesList, this.transformsManager);
45652
45653                this.shapes.push(elementData);
45654                this.addShapeToModifiers(elementData);
45655                return elementData;
45656            };
45657
45658            CVShapeElement.prototype.reloadShapes = function () {
45659                this._isFirstFrame = true;
45660                var i, len = this.itemsData.length;
45661                for (i = 0; i < len; i += 1) {
45662                    this.prevViewData[i] = this.itemsData[i];
45663                }
45664                this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, true, []);
45665                len = this.dynamicProperties.length;
45666                for (i = 0; i < len; i += 1) {
45667                    this.dynamicProperties[i].getValue();
45668                }
45669                this.renderModifiers();
45670                this.transformsManager.processSequences(this._isFirstFrame);
45671            };
45672
45673            CVShapeElement.prototype.addTransformToStyleList = function (transform) {
45674                var i, len = this.stylesList.length;
45675                for (i = 0; i < len; i += 1) {
45676                    if (!this.stylesList[i].closed) {
45677                        this.stylesList[i].transforms.push(transform);
45678                    }
45679                }
45680            }
45681
45682            CVShapeElement.prototype.removeTransformFromStyleList = function () {
45683                var i, len = this.stylesList.length;
45684                for (i = 0; i < len; i += 1) {
45685                    if (!this.stylesList[i].closed) {
45686                        this.stylesList[i].transforms.pop();
45687                    }
45688                }
45689            }
45690
45691            CVShapeElement.prototype.closeStyles = function (styles) {
45692                var i, len = styles.length, j, jLen;
45693                for (i = 0; i < len; i += 1) {
45694                    styles[i].closed = true;
45695                }
45696            }
45697
45698            CVShapeElement.prototype.searchShapes = function (arr, itemsData, prevViewData, shouldRender, transforms) {
45699                var i, len = arr.length - 1;
45700                var j, jLen;
45701                var ownStyles = [], ownModifiers = [], processedPos, modifier, currentTransform;
45702                var ownTransforms = [].concat(transforms);
45703                for (i = len; i >= 0; i -= 1) {
45704                    processedPos = this.searchProcessedElement(arr[i]);
45705                    if (!processedPos) {
45706                        arr[i]._shouldRender = shouldRender;
45707                    } else {
45708                        itemsData[i] = prevViewData[processedPos - 1];
45709                    }
45710                    if (arr[i].ty == 'fl' || arr[i].ty == 'st' || arr[i].ty == 'gf' || arr[i].ty == 'gs') {
45711                        if (!processedPos) {
45712                            itemsData[i] = this.createStyleElement(arr[i], ownTransforms);
45713                        } else {
45714                            itemsData[i].style.closed = false;
vendor: 2,354 bytes, lines 45715-45757
45715                        }
45716
45717                        ownStyles.push(itemsData[i].style);
45718                    } else if (arr[i].ty == 'gr') {
45719                        if (!processedPos) {
45720                            itemsData[i] = this.createGroupElement(arr[i]);
45721                        } else {
45722                            jLen = itemsData[i].it.length;
45723                            for (j = 0; j < jLen; j += 1) {
45724                                itemsData[i].prevViewData[j] = itemsData[i].it[j];
45725                            }
45726                        }
45727                        this.searchShapes(arr[i].it, itemsData[i].it, itemsData[i].prevViewData, shouldRender, ownTransforms);
45728                    } else if (arr[i].ty == 'tr') {
45729                        if (!processedPos) {
45730                            currentTransform = this.createTransformElement(arr[i]);
45731                            itemsData[i] = currentTransform;
45732                        }
45733                        ownTransforms.push(itemsData[i]);
45734                        this.addTransformToStyleList(itemsData[i]);
45735                    } else if (arr[i].ty == 'sh' || arr[i].ty == 'rc' || arr[i].ty == 'el' || arr[i].ty == 'sr') {
45736                        if (!processedPos) {
45737                            itemsData[i] = this.createShapeElement(arr[i]);
45738                        }
45739
45740                    } else if (arr[i].ty == 'tm' || arr[i].ty == 'rd' || arr[i].ty == 'pb') {
45741                        if (!processedPos) {
45742                            modifier = ShapeModifiers.getModifier(arr[i].ty);
45743                            modifier.init(this, arr[i]);
45744                            itemsData[i] = modifier;
45745                            this.shapeModifiers.push(modifier);
45746                        } else {
45747                            modifier = itemsData[i];
45748                            modifier.closed = false;
45749                        }
45750                        ownModifiers.push(modifier);
45751                    } else if (arr[i].ty == 'rp') {
45752                        if (!processedPos) {
45753                            modifier = ShapeModifiers.getModifier(arr[i].ty);
45754                            itemsData[i] = modifier;
45755                            modifier.init(this, arr, i, itemsData);
45756                            this.shapeModifiers.push(modifier);
45757                            shouldRender = false;
45758                        } else {
45759                            modifier = itemsData[i];
45760                            modifier.closed = true;
45761                        }
45762                        ownModifiers.push(modifier);
45763                    }
45764                    this.addProcessedElement(arr[i], i + 1);
45765                }
45766                this.removeTransformFromStyleList();
45767                this.closeStyles(ownStyles);
45768                len = ownModifiers.length;
45769                for (i = 0; i < len; i += 1) {
45770                    ownModifiers[i].closed = true;
45771                }
45772            };
45773
45774            CVShapeElement.prototype.renderInnerContent = function () {
45775                this.transformHelper.opacity = 1;
45776                this.transformHelper._opMdf = false;
45777                this.renderModifiers();
45778                this.transformsManager.processSequences(this._isFirstFrame);
45779                this.renderShape(this.transformHelper, this.shapesData, this.itemsData, true);
45780            };
45781
45782            CVShapeElement.prototype.renderShapeTransform = function (parentTransform, groupTransform) {
45783                var props, groupMatrix;
45784                if (parentTransform._opMdf || groupTransform.op._mdf || this._isFirstFrame) {
45785                    groupTransform.opacity = parentTransform.opacity;
45786                    groupTransform.opacity *= groupTransform.op.v;
45787                    groupTransform._opMdf = true;
45788                }
45789            };
45790
45791            CVShapeElement.prototype.drawLayer = function () {
45792                var i, len = this.stylesList.length;
45793                var j, jLen, k, kLen, elems, nodes, renderer = this.globalData.renderer,
45794                    ctx = this.globalData.canvasContext, type, currentStyle;
45795                for (i = 0; i < len; i += 1) {
45796                    currentStyle = this.stylesList[i];
45797                    type = currentStyle.type;
45798
45799                    //Skipping style when
45800                    //Stroke width equals 0
45801                    //style should not be rendered (extra unused repeaters)
45802                    //current opacity equals 0
45803                    //global opacity equals 0
45804                    if (((type === 'st' || type === 'gs') && currentStyle.wi === 0) || !currentStyle.data._shouldRender || currentStyle.coOp === 0 || this.globalData.currentGlobalAlpha === 0) {
45805                        continue;
45806                    }
45807                    renderer.save();
45808                    elems = currentStyle.elements;
45809                    if (type === 'st' || type === 'gs') {
45810                        ctx.strokeStyle = type === 'st' ? currentStyle.co : currentStyle.grd;
45811                        ctx.lineWidth = currentStyle.wi;
45812                        ctx.lineCap = currentStyle.lc;
45813                        ctx.lineJoin = currentStyle.lj;
45814                        ctx.miterLimit = currentStyle.ml || 0;
45815                    } else {
45816                        ctx.fillStyle = type === 'fl' ? currentStyle.co : currentStyle.grd;
45817                    }
45818                    renderer.ctxOpacity(currentStyle.coOp);
45819                    if (type !== 'st' && type !== 'gs') {
45820                        ctx.beginPath();
45821                    }
45822                    renderer.ctxTransform(currentStyle.preTransforms.finalTransform.props);
45823                    jLen = elems.length;
45824                    for (j = 0; j < jLen; j += 1) {
45825                        if (type === 'st' || type === 'gs') {
45826                            ctx.beginPath();
45827                            if (currentStyle.da) {
45828                                ctx.setLineDash(currentStyle.da);
45829                                ctx.lineDashOffset = currentStyle.do;
45830                            }
45831                        }
45832                        nodes = elems[j].trNodes;
45833                        kLen = nodes.length;
45834
45835                        for (k = 0; k < kLen; k += 1) {
45836                            if (nodes[k].t == 'm') {
45837                                ctx.moveTo(nodes[k].p[0], nodes[k].p[1]);
45838                            } else if (nodes[k].t == 'c') {
45839                                ctx.bezierCurveTo(nodes[k].pts[0], nodes[k].pts[1], nodes[k].pts[2], nodes[k].pts[3], nodes[k].pts[4], nodes[k].pts[5]);
45840                            } else {
45841                                ctx.closePath();
45842                            }
45843                        }
45844                        if (type === 'st' || type === 'gs') {
45845                            ctx.stroke();
45846                            if (currentStyle.da) {
45847                                ctx.setLineDash(this.dashResetter);
45848                            }
45849                        }
45850                    }
45851                    if (type !== 'st' && type !== 'gs') {
45852                        ctx.fill(currentStyle.r);
45853                    }
45854                    renderer.restore();
45855                }
45856            };
45857
45858            CVShapeElement.prototype.renderShape = function (parentTransform, items, data, isMain) {
45859                var i, len = items.length - 1;
45860                var groupTransform;
45861                groupTransform = parentTransform;
45862                for (i = len; i >= 0; i -= 1) {
45863                    if (items[i].ty == 'tr') {
45864                        groupTransform = data[i].transform;
45865                        this.renderShapeTransform(parentTransform, groupTransform);
45866                    } else if (items[i].ty == 'sh' || items[i].ty == 'el' || items[i].ty == 'rc' || items[i].ty == 'sr') {
45867                        this.renderPath(items[i], data[i]);
45868                    } else if (items[i].ty == 'fl') {
45869                        this.renderFill(items[i], data[i], groupTransform);
45870                    } else if (items[i].ty == 'st') {
45871                        this.renderStroke(items[i], data[i], groupTransform);
45872                    } else if (items[i].ty == 'gf' || items[i].ty == 'gs') {
45873                        this.renderGradientFill(items[i], data[i], groupTransform);
45874                    } else if (items[i].ty == 'gr') {
45875                        this.renderShape(groupTransform, items[i].it, data[i].it);
45876                    } else if (items[i].ty == 'tm') {
45877                        //
45878                    }
45879                }
45880                if (isMain) {
45881                    this.drawLayer();
45882                }
45883
45884            };
45885
45886            CVShapeElement.prototype.renderStyledShape = function (styledShape, shape) {
45887                if (this._isFirstFrame || shape._mdf || styledShape.transforms._mdf) {
45888                    var shapeNodes = styledShape.trNodes;
45889                    var paths = shape.paths;
45890                    var i, len, j, jLen = paths._length;
45891                    shapeNodes.length = 0;
45892                    var groupTransformMat = styledShape.transforms.finalTransform;
45893                    for (j = 0; j < jLen; j += 1) {
45894                        var pathNodes = paths.shapes[j];
45895                        if (pathNodes && pathNodes.v) {
45896                            len = pathNodes._length;
45897                            for (i = 1; i < len; i += 1) {
45898                                if (i === 1) {
45899                                    shapeNodes.push({
45900                                        t: 'm',
45901                                        p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0)
45902                                    });
45903                                }
45904                                shapeNodes.push({
45905                                    t: 'c',
45906                                    pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[i], pathNodes.v[i])
45907                                });
45908                            }
45909                            if (len === 1) {
45910                                shapeNodes.push({
45911                                    t: 'm',
45912                                    p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0)
45913                                });
45914                            }
45915                            if (pathNodes.c && len) {
45916                                shapeNodes.push({
45917                                    t: 'c',
45918                                    pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[0], pathNodes.v[0])
45919                                });
45920                                shapeNodes.push({
45921                                    t: 'z'
45922                                });
45923                            }
45924                        }
45925                    }
45926                    styledShape.trNodes = shapeNodes;
45927                }
45928            }
45929
45930            CVShapeElement.prototype.renderPath = function (pathData, itemData) {
45931                if (pathData.hd !== true && pathData._shouldRender) {
45932                    var i, len = itemData.styledShapes.length;
45933                    for (i = 0; i < len; i += 1) {
45934                        this.renderStyledShape(itemData.styledShapes[i], itemData.sh);
45935                    }
45936                }
45937            };
45938
45939            CVShapeElement.prototype.renderFill = function (styleData, itemData, groupTransform) {
45940                var styleElem = itemData.style;
45941
45942                if (itemData.c._mdf || this._isFirstFrame) {
45943                    styleElem.co = 'rgb('
45944                        + bm_floor(itemData.c.v[0]) + ','
45945                        + bm_floor(itemData.c.v[1]) + ','
45946                        + bm_floor(itemData.c.v[2]) + ')';
45947                }
45948                if (itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame) {
vendor: 6,142 bytes, lines 45949-46079
45949                    styleElem.coOp = itemData.o.v * groupTransform.opacity;
45950                }
45951            };
45952
45953            CVShapeElement.prototype.renderGradientFill = function (styleData, itemData, groupTransform) {
45954                var styleElem = itemData.style;
45955                if (!styleElem.grd || itemData.g._mdf || itemData.s._mdf || itemData.e._mdf || (styleData.t !== 1 && (itemData.h._mdf || itemData.a._mdf))) {
45956                    var ctx = this.globalData.canvasContext;
45957                    var grd;
45958                    var pt1 = itemData.s.v, pt2 = itemData.e.v;
45959                    if (styleData.t === 1) {
45960                        grd = ctx.createLinearGradient(pt1[0], pt1[1], pt2[0], pt2[1]);
45961                    } else {
45962                        var rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));
45963                        var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0]);
45964
45965                        var percent = itemData.h.v >= 1 ? 0.99 : itemData.h.v <= -1 ? -0.99 : itemData.h.v;
45966                        var dist = rad * percent;
45967                        var x = Math.cos(ang + itemData.a.v) * dist + pt1[0];
45968                        var y = Math.sin(ang + itemData.a.v) * dist + pt1[1];
45969                        var grd = ctx.createRadialGradient(x, y, 0, pt1[0], pt1[1], rad);
45970                    }
45971
45972                    var i, len = styleData.g.p;
45973                    var cValues = itemData.g.c;
45974                    var opacity = 1;
45975
45976                    for (i = 0; i < len; i += 1) {
45977                        if (itemData.g._hasOpacity && itemData.g._collapsable) {
45978                            opacity = itemData.g.o[i * 2 + 1];
45979                        }
45980                        grd.addColorStop(cValues[i * 4] / 100, 'rgba(' + cValues[i * 4 + 1] + ',' + cValues[i * 4 + 2] + ',' + cValues[i * 4 + 3] + ',' + opacity + ')');
45981                    }
45982                    styleElem.grd = grd;
45983                }
45984                styleElem.coOp = itemData.o.v * groupTransform.opacity;
45985
45986            };
45987
45988            CVShapeElement.prototype.renderStroke = function (styleData, itemData, groupTransform) {
45989                var styleElem = itemData.style;
45990                var d = itemData.d;
45991                if (d && (d._mdf || this._isFirstFrame)) {
45992                    styleElem.da = d.dashArray;
45993                    styleElem.do = d.dashoffset[0];
45994                }
45995                if (itemData.c._mdf || this._isFirstFrame) {
45996                    styleElem.co = 'rgb(' + bm_floor(itemData.c.v[0]) + ',' + bm_floor(itemData.c.v[1]) + ',' + bm_floor(itemData.c.v[2]) + ')';
45997                }
45998                if (itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame) {
45999                    styleElem.coOp = itemData.o.v * groupTransform.opacity;
46000                }
46001                if (itemData.w._mdf || this._isFirstFrame) {
46002                    styleElem.wi = itemData.w.v;
46003                }
46004            };
46005
46006
46007            CVShapeElement.prototype.destroy = function () {
46008                this.shapesData = null;
46009                this.globalData = null;
46010                this.canvasContext = null;
46011                this.stylesList.length = 0;
46012                this.itemsData.length = 0;
46013            };
46014
46015
46016            function CVSolidElement(data, globalData, comp) {
46017                this.initElement(data, globalData, comp);
46018            }
46019
46020            extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement], CVSolidElement);
46021
46022            CVSolidElement.prototype.initElement = SVGShapeElement.prototype.initElement;
46023            CVSolidElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame;
46024
46025            CVSolidElement.prototype.renderInnerContent = function () {
46026                var ctx = this.canvasContext;
46027                ctx.fillStyle = this.data.sc;
46028                ctx.fillRect(0, 0, this.data.sw, this.data.sh);
46029                //
46030            };
46031
46032            function CVTextElement(data, globalData, comp) {
46033                this.textSpans = [];
46034                this.yOffset = 0;
46035                this.fillColorAnim = false;
46036                this.strokeColorAnim = false;
46037                this.strokeWidthAnim = false;
46038                this.stroke = false;
46039                this.fill = false;
46040                this.justifyOffset = 0;
46041                this.currentRender = null;
46042                this.renderType = 'canvas';
46043                this.values = {
46044                    fill: 'rgba(0,0,0,0)',
46045                    stroke: 'rgba(0,0,0,0)',
46046                    sWidth: 0,
46047                    fValue: ''
46048                };
46049                this.initElement(data, globalData, comp);
46050            }
46051
46052            extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement, ITextElement], CVTextElement);
46053
46054            CVTextElement.prototype.tHelper = createTag('canvas').getContext('2d');
46055
46056            CVTextElement.prototype.buildNewText = function () {
46057                var documentData = this.textProperty.currentData;
46058                this.renderedLetters = createSizedArray(documentData.l ? documentData.l.length : 0);
46059
46060                var hasFill = false;
46061                if (documentData.fc) {
46062                    hasFill = true;
46063                    this.values.fill = this.buildColor(documentData.fc);
46064                } else {
46065                    this.values.fill = 'rgba(0,0,0,0)';
46066                }
46067                this.fill = hasFill;
46068                var hasStroke = false;
46069                if (documentData.sc) {
46070                    hasStroke = true;
46071                    this.values.stroke = this.buildColor(documentData.sc);
46072                    this.values.sWidth = documentData.sw;
46073                }
46074                var fontData = this.globalData.fontManager.getFontByName(documentData.f);
46075                var i, len;
46076                var letters = documentData.l;
46077                var matrixHelper = this.mHelper;
46078                this.stroke = hasStroke;
46079                this.values.fValue = documentData.finalSize + 'px ' + this.globalData.fontManager.getFontByName(
46079documentData.f).fFamily;
46080                len = documentData.finalText.length;
46081                //this.tHelper.font = this.values.fValue;
46082                var charData, shapeData, k, kLen, shapes, j, jLen, pathNodes, commands, pathArr,
46083                    singleShape = this.data.singleShape;
46084                var trackingOffset = documentData.tr / 1000 * documentData.finalSize;
46085                var xPos = 0, yPos = 0, firstLine = true;
46086                var cnt = 0;
46087                for (i = 0; i < len; i += 1) {
46088                    charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);
46089                    shapeData = charData && charData.data || {};
46090                    matrixHelper.reset();
46091                    if (singleShape && letters[i].n) {
46092                        xPos = -trackingOffset;
46093                        yPos += documentData.yOffset;
46094                        yPos += firstLine ? 1 : 0;
46095                        firstLine = false;
46096                    }
46097
46098                    shapes = shapeData.shapes ? shapeData.shapes[0].it : [];
46099                    jLen = shapes.length;
46100                    matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100);
46101                    if (singleShape) {
46102                        this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos);
46103                    }
46104                    commands = createSizedArray(jLen);
46105                    for (j = 0; j < jLen; j += 1) {
46106                        kLen = shapes[j].ks.k.i.length;
46107                        pathNodes = shapes[j].ks.k;
46108                        pathArr = [];
46109                        for (k = 1; k < kLen; k += 1) {
46110                            if (k == 1) {
46111                                pathArr.push(matrixHelper.applyToX(pathNodes.v[0][0], pathNodes.v[0][1], 0), matrixHelper.applyToY(pathNodes.v[0][0], pathNodes.v[0][1], 0));
46112                            }
46113                            pathArr.push(matrixHelper.applyToX(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToY(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToX(pathNodes.i[k][0], pathNodes.i[k][1], 0), matrixHelper.applyToY(pathNodes.i[k][0], pathNodes.i[k][1], 0), matrixHelper.applyToX(pathNodes.v[k][0], pathNodes.v[k][1], 0), matrixHelper.applyToY(pathNodes.v[k][0], pathNodes.v[k][1], 0));
46114                        }
46115                        pathArr.push(matrixHelper.applyToX(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToY(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToX(pathNodes.i[0][0], pathNodes.i[0][1], 0), matrixHelper.applyToY(pathNodes.i[0][0], pathNodes.i[0][1], 0), matrixHelper.applyToX(pathNodes.v[0][0], pathNodes.v[0][1], 0), matrixHelper.applyToY(pathNodes.v[0][0], pathNodes.v[0][1], 0));
46116                        commands[j] = pathArr;
46117                    }
46118                    if (singleShape) {
46119                        xPos += letters[i].l;
46120                        xPos += trackingOffset;
46121                    }
46122                    if (this.textSpans[cnt]) {
46123                        this.textSpans[cnt].elem = commands;
46124                    } else {
46125                        this.textSpans[cnt] = {elem: commands};
46126                    }
46127                    cnt += 1;
46128                }
46129            };
46130
46131            CVTextElement.prototype.renderInnerContent = function () {
46132                var ctx = this.canvasContext;
46133                var finalMat = this.finalTransform.mat.props;
46134                ctx.font = this.values.fValue;
46135                ctx.lineCap = 'butt';
46136                ctx.lineJoin = 'miter';
46137                ctx.miterLimit = 4;
46138
46139                if (!this.data.singleShape) {
46140                    this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);
46141                }
46142
46143                var i, len, j, jLen, k, kLen;
46144                var renderedLetters = this.textAnimator.renderedLetters;
46145
46146                var letters = this.textProperty.currentData.l;
46147
46148                len = letters.length;
46149                var renderedLetter;
46150                var lastFill = null, lastStroke = null, lastStrokeW = null, commands, pathArr;
46151                for (i = 0; i < len; i += 1) {
46152                    if (letters[i].n) {
46153                        continue;
46154                    }
46155                    renderedLetter = renderedLetters[i];
46156                    if (renderedLetter) {
46157                        this.globalData.renderer.save();
46158                        this.globalData.renderer.ctxTransform(renderedLetter.p);
46159                        this.globalData.renderer.ctxOpacity(renderedLetter.o);
46160                    }
46161                    if (this.fill) {
46162                        if (renderedLetter && renderedLetter.fc) {
46163                            if (lastFill !== renderedLetter.fc) {
46164                                lastFill = renderedLetter.fc;
46165                                ctx.fillStyle = renderedLetter.fc;
46166                            }
46167                        } else if (lastFill !== this.values.fill) {
46168                            lastFill = this.values.fill;
46169                            ctx.fillStyle = this.values.fill;
46170                        }
46171                        commands = this.textSpans[i].elem;
46172                        jLen = commands.length;
46173                        this.globalData.canvasContext.beginPath();
46174                        for (j = 0; j < jLen; j += 1) {
46175                            pathArr = commands[j];
46176                            kLen = pathArr.length;
46177                            this.globalData.canvasContext.moveTo(p
46177athArr[0], pathArr[1]);
46178                            for (k = 2; k < kLen; k += 6) {
46179                                this.globalData.canvasContext.bezierCurveTo(pathArr[k], pathArr[k + 1], pathArr[k + 2], pathArr[k + 3], pathArr[k + 4], pathArr[k + 5]);
46180                            }
46181                        }
46182                        this.globalData.canvasContext.closePath();
46183                        this.globalData.canvasContext.fill();
46184                        ///ctx.fillText(this.textSpans[i].val,0,0);
46185                    }
46186                    if (this.stroke) {
46187                        if (renderedLetter && renderedLetter.sw) {
46188                            if (lastStrokeW !== renderedLetter.sw) {
46189                                lastStrokeW = renderedLetter.sw;
46190                                ctx.lineWidth = renderedLetter.sw;
46191                            }
46192                        } else if (lastStrokeW !== this.values.sWidth) {
46193                            lastStrokeW = this.values.sWidth;
46194                            ctx.lineWidth = this.values.sWidth;
46195                        }
46196                        if (renderedLetter && renderedLetter.sc) {
46197                            if (lastStroke !== renderedLetter.sc) {
46198                                lastStroke = renderedLetter.sc;
46199                                ctx.strokeStyle = renderedLetter.sc;
46200                            }
46201                        } else if (lastStroke !== this.values.stroke) {
46202                            lastStroke = this.values.stroke;
46203                            ctx.strokeStyle = this.values.stroke;
46204                        }
46205                        commands = this.textSpans[i].elem;
46206                        jLen = commands.length;
46207                        this.globalData.canvasContext.beginPath();
46208                        for (j = 0; j < jLen; j += 1) {
46209                            pathArr = commands[j];
46210                            kLen = pathArr.length;
46211                            this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1]);
46212                            for (k = 2; k < kLen; k += 6) {
46213                                this.globalData.canvasContext.bezierCurveTo(pathArr[k], pathArr[k + 1], pathArr[k + 2], pathArr[k + 3], pathArr[k + 4], pathArr[k + 5]);
46214                            }
46215                        }
46216                        this.globalData.canvasContext.closePath();
46217                        this.globalData.canvasContext.stroke();
46218                        ///ctx.strokeText(letters[i].val,0,0);
46219                    }
46220                    if (renderedLetter) {
46221                        this.globalData.renderer.restore();
46222                    }
46223                }
46224            };
46225
46226            function CVEffects() {
46227
46228            }
46229
46230            CVEffects.prototype.renderFrame = function () {
46231            };
46232
46233            function HBaseElement(data, globalData, comp) {
46234            }
46235
46236            HBaseElement.prototype = {
46237                checkBlendMode: function () {
46238                },
46239                initRendererElement: function () {
46240                    this.baseElement = createTag(this.data.tg || 'div');
46241                    if (this.data.hasMask) {
46242                        this.svgElement = createNS('svg');
46243                        this.layerElement = createNS('g');
46244                        this.maskedElement = this.layerElement;
46245                        this.svgElement.appendChild(this.layerElement);
46246                        this.baseElement.appendChild(this.svgElement);
46247                    } else {
46248                        this.layerElement = this.baseElement;
46249                    }
46250                    styleDiv(this.baseElement);
46251                },
46252                createContainerElements: function () {
46253                    this.renderableEffectsManager = new CVEffects(this);
46254                    this.transformedElement = this.baseElement;
46255                    this.maskedElement = this.layerElement;
46256                    if (this.data.ln) {
46257                        this.layerElement.setAttribute('id', this.data.ln);
46258                    }
46259                    if (this.data.cl) {
46260                        this.layerElement.setAttribute('class', this.data.cl);
46261                    }
46262                    if (this.data.bm !== 0) {
46263                        this.setBlendMode();
46264                    }
46265                },
46266                renderElement: function () {
46267                    if (this.finalTransform._matMdf) {
46268                        this.transformedElement.style.transform = this.transformedElement.style.webkitTransform = this.finalTransform.mat.toCSS();
46269                    }
46270                    if (this.finalTransform._opMdf) {
46271                        this.transformedElement.style.opacity = this.finalTransform.mProp.o.v;
46272                    }
46273                },
46274                renderFrame: function () {
46275                    //If it is exported as hidden (data.hd === true) no need to render
46276                    //If it is not visible no need to render
46277                    if (this.data.hd || this.hidden) {
46278                        return;
46279                    }
46280                    this.renderTransform();
46281                    this.renderRenderable();
46282                    this.renderElement();
46283                    this.renderInnerContent();
46284                    if (this._isFirstFrame) {
46285                        this._isFirstFrame = false;
vendor: 13,178 bytes, lines 46286-46573
46286                    }
46287                },
46288                destroy: function () {
46289                    this.layerElement = null;
46290                    this.transformedElement = null;
46291                    if (this.matteElement) {
46292                        this.matteElement = null;
46293                    }
46294                    if (this.maskManager) {
46295                        this.maskManager.destroy();
46296                        this.maskManager = null;
46297                    }
46298                },
46299                createRenderableComponents: function () {
46300                    this.maskManager = new MaskElement(this.data, this, this.globalData);
46301                },
46302                addEffects: function () {
46303                },
46304                setMatte: function () {
46305                }
46306            };
46307            HBaseElement.prototype.getBaseElement = SVGBaseElement.prototype.getBaseElement;
46308            HBaseElement.prototype.destroyBaseElement = HBaseElement.prototype.destroy;
46309            HBaseElement.prototype.buildElementParenting = HybridRenderer.prototype.buildElementParenting;
46310
46311            function HSolidElement(data, globalData, comp) {
46312                this.initElement(data, globalData, comp);
46313            }
46314
46315            extendPrototype([BaseElement, TransformElement, HBaseElement, HierarchyElement, FrameElement, RenderableDOMElement], HSolidElement);
46316
46317            HSolidElement.prototype.createContent = function () {
46318                var rect;
46319                if (this.data.hasMask) {
46320                    rect = createNS('rect');
46321                    rect.setAttribute('width', this.data.sw);
46322                    rect.setAttribute('height', this.data.sh);
46323                    rect.setAttribute('fill', this.data.sc);
46324                    this.svgElement.setAttribute('width', this.data.sw);
46325                    this.svgElement.setAttribute('height', this.data.sh);
46326                } else {
46327                    rect = createTag('div');
46328                    rect.style.width = this.data.sw + 'px';
46329                    rect.style.height = this.data.sh + 'px';
46330                    rect.style.backgroundColor = this.data.sc;
46331                }
46332                this.layerElement.appendChild(rect);
46333            };
46334
46335            function HCompElement(data, globalData, comp) {
46336                this.layers = data.layers;
46337                this.supports3d = !data.hasMask;
46338                this.completeLayers = false;
46339                this.pendingElements = [];
46340                this.elements = this.layers ? createSizedArray(this.layers.length) : [];
46341                this.initElement(data, globalData, comp);
46342                this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : {_placeholder: true};
46343            }
46344
46345            extendPrototype([HybridRenderer, ICompElement, HBaseElement], HCompElement);
46346            HCompElement.prototype._createBaseContainerElements = HCompElement.prototype.createContainerElements;
46347
46348            HCompElement.prototype.createContainerElements = function () {
46349                this._createBaseContainerElements();
46350                //divElement.style.clip = 'rect(0px, '+this.data.w+'px, '+this.data.h+'px, 0px)';
46351                if (this.data.hasMask) {
46352                    this.svgElement.setAttribute('width', this.data.w);
46353                    this.svgElement.setAttribute('height', this.data.h);
46354                    this.transformedElement = this.baseElement;
46355                } else {
46356                    this.transformedElement = this.layerElement;
46357                }
46358            };
46359
46360            HCompElement.prototype.addTo3dContainer = function (elem, pos) {
46361                var j = 0;
46362                var nextElement;
46363                while (j < pos) {
46364                    if (this.elements[j] && this.elements[j].getBaseElement) {
46365                        nextElement = this.elements[j].getBaseElement();
46366                    }
46367                    j += 1;
46368                }
46369                if (nextElement) {
46370                    this.layerElement.insertBefore(elem, nextElement);
46371                } else {
46372                    this.layerElement.appendChild(elem);
46373                }
46374            }
46375
46376            function HShapeElement(data, globalData, comp) {
46377                //List of drawable elements
46378                this.shapes = [];
46379                // Full shape data
46380                this.shapesData = data.shapes;
46381                //List of styles that will be applied to shapes
46382                this.stylesList = [];
46383                //List of modifiers that will be applied to shapes
46384                this.shapeModifiers = [];
46385                //List of items in shape tree
46386                this.itemsData = [];
46387                //List of items in previous shape tree
46388                this.processedElements = [];
46389                // List of animated components
46390                this.animatedContents = [];
46391                this.shapesContainer = createNS('g');
46392                this.initElement(data, globalData, comp);
46393                //Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.
46394                // List of elements that have been created
46395                this.prevViewData = [];
46396                this.currentBBox = {
46397                    x: 999999,
46398                    y: -999999,
46399                    h: 0,
46400                    w: 0
46401                };
46402            }
46403
46404            extendPrototype([BaseElement, TransformElement, HSolidElement, SVGShapeElement, HBaseElement, HierarchyElement, FrameElement, RenderableElement], HShapeElement);
46405            HShapeElement.prototype._renderShapeFrame = HShapeElement.prototype.renderInnerContent;
46406
46407            HShapeElement.prototype.createContent = function () {
46408                var cont;
46409                this.baseElement.style.fontSize = 0;
46410                if (this.data.hasMask) {
46411                    this.layerElement.appendChild(this.shapesContainer);
46412                    cont = this.svgElement;
46413                } else {
46414                    cont = createNS('svg');
46415                    var size = this.comp.data ? this.comp.data : this.globalData.compSize;
46416                    cont.setAttribute('width', size.w);
46417                    cont.setAttribute('height', size.h);
46418                    cont.appendChild(this.shapesContainer);
46419                    this.layerElement.appendChild(cont);
46420                }
46421
46422                this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.shapesContainer, 0, [], true);
46423                this.filterUniqueShapes();
46424                this.shapeCont = cont;
46425            };
46426
46427            HShapeElement.prototype.getTransformedPoint = function (transformers, point) {
46428                var i, len = transformers.length;
46429                for (i = 0; i < len; i += 1) {
46430                    point = transformers[i].mProps.v.applyToPointArray(point[0], point[1], 0);
46431                }
46432                return point;
46433            }
46434
46435            HShapeElement.prototype.calculateShapeBoundingBox = function (item, boundingBox) {
46436                var shape = item.sh.v;
46437                var transformers = item.transformers;
46438                var i, len = shape._length, vPoint, oPoint, nextIPoint, nextVPoint, bounds;
46439                if (len <= 1) {
46440                    return;
46441                }
46442                for (i = 0; i < len - 1; i += 1) {
46443                    vPoint = this.getTransformedPoint(transformers, shape.v[i]);
46444                    oPoint = this.getTransformedPoint(transformers, shape.o[i]);
46445                    nextIPoint = this.getTransformedPoint(transformers, shape.i[i + 1]);
46446                    nextVPoint = this.getTransformedPoint(transformers, shape.v[i + 1]);
46447                    this.checkBounds(vPoint, oPoint, nextIPoint, nextVPoint, boundingBox);
46448                }
46449                if (shape.c) {
46450                    vPoint = this.getTransformedPoint(transformers, shape.v[i]);
46451                    oPoint = this.getTransformedPoint(transformers, shape.o[i]);
46452                    nextIPoint = this.getTransformedPoint(transformers, shape.i[0]);
46453                    nextVPoint = this.getTransformedPoint(transformers, shape.v[0]);
46454                    this.checkBounds(vPoint, oPoint, nextIPoint, nextVPoint, boundingBox);
46455                }
46456            }
46457
46458            HShapeElement.prototype.checkBounds = function (vPoint, oPoint, nextIPoint, nextVPoint, boundingBox) {
46459                this.getBoundsOfCurve(vPoint, oPoint, nextIPoint, nextVPoint);
46460                var bounds = this.shapeBoundingBox;
46461                boundingBox.x = bm_min(bounds.left, boundingBox.x);
46462                boundingBox.xMax = bm_max(bounds.right, boundingBox.xMax);
46463                boundingBox.y = bm_min(bounds.top, boundingBox.y);
46464                boundingBox.yMax = bm_max(bounds.bottom, boundingBox.yMax);
46465            }
46466
46467            HShapeElement.prototype.shapeBoundingBox = {
46468                left: 0,
46469                right: 0,
46470                top: 0,
46471                bottom: 0,
46472            }
46473
46474            HShapeElement.prototype.tempBoundingBox = {
46475                x: 0,
46476                xMax: 0,
46477                y: 0,
46478                yMax: 0,
46479                width: 0,
46480                height: 0
46481            }
46482
46483            HShapeElement.prototype.getBoundsOfCurve = function (p0, p1, p2, p3) {
46484
46485                var bounds = [[p0[0], p3[0]], [p0[1], p3[1]]];
46486
46487                for (var a, b, c, t, b2ac, t1, t2, i = 0; i < 2; ++i) {
46488
46489                    b = 6 * p0[i] - 12 * p1[i] + 6 * p2[i];
46490                    a = -3 * p0[i] + 9 * p1[i] - 9 * p2[i] + 3 * p3[i];
46491                    c = 3 * p1[i] - 3 * p0[i];
46492
46493                    b = b | 0;
46494                    a = a | 0;
46495                    c = c | 0;
46496
46497                    if (a === 0) {
46498
46499                        if (b === 0) {
46500                            continue;
46501                        }
46502
46503                        t = -c / b;
46504
46505                        if (0 < t && t < 1) {
46506                            bounds[i].push(this.calculateF(t, p0, p1, p2, p3, i));
46507                        }
46508                        continue;
46509                    }
46510
46511                    b2ac = b * b - 4 * c * a;
46512
46513                    if (b2ac < 0) {
46514                        continue;
46515                    }
46516
46517                    t1 = (-b + bm_sqrt(b2ac)) / (2 * a);
46518                    if (0 < t1 && t1 < 1) bounds[i].push(this.calculateF(t1, p0, p1, p2, p3, i));
46519
46520                    t2 = (-b - bm_sqrt(b2ac)) / (2 * a);
46521                    if (0 < t2 && t2 < 1) bounds[i].push(this.calculateF(t2, p0, p1, p2, p3, i));
46522
46523                }
46524
46525                this.shapeBoundingBox.left = bm_min.apply(null, bounds[0]);
46526                this.shapeBoundingBox.top = bm_min.apply(null, bounds[1]);
46527                this.shapeBoundingBox.right = bm_max.apply(null, bounds[0]);
46528                this.shapeBoundingBox.bottom = bm_max.apply(null, bounds[1]);
46529            };
46530
46531            HShapeElement.prototype.calculateF = function (t, p0, p1, p2, p3, i) {
46532                return bm_pow(1 - t, 3) * p0[i]
46533                    + 3 * bm_pow(1 - t, 2) * t * p1[i]
46534                    + 3 * (1 - t) * bm_pow(t, 2) * p2[i]
46535                    + bm_pow(t, 3) * p3[i];
46536            }
46537
46538            HShapeElement.prototype.calculateBoundingBox = function (itemsData, boundingBox) {
46539                var i, len = itemsData.length, path;
46540                for (i = 0; i < len; i += 1) {
46541                    if (itemsData[i] && itemsData[i].sh) {
46542                        this.calculateShapeBoundingBox(itemsData[i], boundingBox)
46543                    } else if (itemsData[i] && itemsData[i].it) {
46544                        this.calculateBoundingBox(itemsData[i].it, boundingBox)
46545                    }
46546                }
46547            }
46548
46549            HShapeElement.prototype.currentBoxContains = function (box) {
46550                return this.currentBBox.x <= box.x
46551                    && this.currentBBox.y <= box.y
46552                    && this.currentBBox.width + this.currentBBox.x >= box.x + box.width
46553                    && this.currentBBox.height + this.currentBBox.y >= box.y + box.height
46554            }
46555
46556            HShapeElement.prototype.renderInnerContent = function () {
46557                this._renderShapeFrame();
46558
46559                if (!this.hidden && (this._isFirstFrame || this._mdf)) {
46560                    var tempBoundingBox = this.tempBoundingBox;
46561                    var max = 999999;
46562                    tempBoundingBox.x = max;
46563                    tempBoundingBox.xMax = -max;
46564                    tempBoundingBox.y = max;
46565                    tempBoundingBox.yMax = -max;
46566                    this.calculateBoundingBox(this.itemsData, tempBoundingBox);
46567                    tempBoundingBox.width = tempBoundingBox.xMax < tempBoundingBox.x ? 0 : tempBoundingBox.xMax - tempBoundingBox.x;
46568                    tempBoundingBox.height = tempBoundingBox.yMax < tempBoundingBox.y ? 0 : tempBoundingBox.yMax - tempBoundingBox.y;
46569                    //var tempBoundingBox = this.shapeCont.getBBox();
46570                    if (this.currentBoxContains(tempBoundingBox)) {
46571                        return;
46572                    }
46573                    var changed = false;
46574                    if (this.currentBBox.w !== tempBoundingBox.width) {
46575                        this.currentBBox.w = tempBoundingBox.width;
46576                        this.shapeCont.setAttribute('width', tempBoundingBox.width);
46577                        changed = true;
46578                    }
46579                    if (this.currentBBox.h !== tempBoundingBox.height) {
46580                        this.currentBBox.h = tempBoundingBox.height;
46581                        this.shapeCont.setAttribute('height', tempBoundingBox.height);
46582                        changed = true;
46583                    }
46584                    if (changed || this.currentBBox.x !== tempBoundingBox.x || this.currentBBox.y !== tempBoundingBox.y) {
46585                        this.currentBBox.w = tempBoundingBox.width;
46586                        this.currentBBox.h = tempBoundingBox.height;
46587                        this.currentBBox.x = tempBoundingBox.x;
46588                        this.currentBBox.y = tempBoundingBox.y;
46589
46590                        this.shapeCont.setAttribute('viewBox', this.currentBBox.x + ' ' + this.currentBBox.y + ' ' + this.currentBBox.w + ' ' + this.currentBBox.h);
46591                        this.shapeCont.style.transform = this.shapeCont.style.webkitTransform = 'translate(' + this.currentBBox.x + 'px,' + this.currentBBox.y + 'px)';
46592                    }
46593                }
46594
46595            };
46596
46597            function HTextElement(data, globalData, comp) {
46598                this.textSpans = [];
46599                this.textPaths = [];
46600                this.currentBBox = {
46601                    x: 999999,
46602                    y: -999999,
46603                    h: 0,
46604                    w: 0
46605                };
46606                this.renderType = 'svg';
46607                this.isMasked = false;
46608                this.initElement(data, globalData, comp);
46609
46610            }
46611
46612            extendPrototype([BaseElement, TransformElement, HBaseElement, HierarchyElement, FrameElement, RenderableDOMElement, ITextElement], HTextElement);
46613
46614            HTextElement.prototype.createContent = function () {
46615                this.isMasked = this.checkMasks();
46616                if (this.isMasked) {
46617                    this.renderType = 'svg';
46618                    this.compW = this.comp.data.w;
46619                    this.compH = this.comp.data.h;
46620                    this.svgElement.setAttribute('width', this.compW);
46621                    this.svgElement.setAttribute('height', this.compH);
46622                    var g = createNS('g');
46623                    this.maskedElement.appendChild(g);
46624                    this.innerElem = g;
46625                } else {
46626                    this.renderType = 'html';
46627                    this.innerElem = this.layerElement;
46628                }
46629
46630                this.checkParenting();
46631
46632            };
46633
46634            HTextElement.prototype.buildNewText = function () {
46635                var documentData = this.textProperty.currentData;
46636                this.renderedLetters = createSizedArray(documentData.l ? documentData.l.length : 0);
46637                var innerElemStyle = this.innerElem.style;
46638                innerElemStyle.color = innerElemStyle.fill = documentData.fc ? this.buildColor(documentData.fc) : 'rgba(0,0,0,0)';
46639                if (documentData.sc) {
46640                    innerElemStyle.stroke = this.buildColor(documentData.sc);
46641                    innerElemStyle.strokeWidth = documentData.sw + 'px';
46642                }
46643                var fontData = this.globalData.fontManager.getFontByName(documentData.f);
46644                if (!this.globalData.fontManager.chars) {
46645                    innerElemStyle.fontSize = documentData.finalSize + 'px';
46646                    innerElemStyle.lineHeight = documentData.finalSize + 'px';
46647                    if (fontData.fClass) {
46648                        this.innerElem.className = fontData.fClass;
46649                    } else {
46650                        innerElemStyle.fontFamily = fontData.fFamily;
46651                        var fWeight = documentData.fWeight, fStyle = documentData.fStyle;
46652                        innerElemStyle.fontStyle = fStyle;
46653                        innerElemStyle.fontWeight = fWeight;
46654                    }
46655                }
46656                var i, len;
46657
46658                var letters = documentData.l;
46659                len = letters.length;
46660                var tSpan, tParent, tCont;
46661                var matrixHelper = this.mHelper;
46662                var shapes, shapeStr = '';
46663                var cnt = 0;
46664                for (i = 0; i < len; i += 1) {
46665                    if (this.globalData.fontManager.chars) {
46666                        if (!this.textPaths[cnt]) {
46667                            tSpan = createNS('path');
46668                            tSpan.setAttribute('stroke-linecap', 'butt');
46669                            tSpan.setAttribute('stroke-linejoin', 'round');
46670                            tSpan.setAttribute('stroke-miterlimit', '4');
46671                        } else {
46672                            tSpan = this.textPaths[cnt];
46673                        }
46674                        if (!this.isMasked) {
46675                            if (this.textSpans[cnt]) {
46676                                tParent = this.textSpans[cnt];
46677                                tCont = tParent.children[0];
46678                            } else {
46679
46680                                tParent = createTag('div');
46681                                tParent.style.lineHeight = 0;
46682                                tCont = createNS('svg');
46683                                tCont.appendChild(tSpan);
46684                                styleDiv(tParent);
46685                            }
46686                        }
46687                    } else {
46688                        if (!this.isMasked) {
46689                            if (this.textSpans[cnt]) {
46690                                tParent = this.textSpans[cnt];
46691                                tSpan = this.textPaths[cnt];
46692                            } else {
46693                                tParent = createTag('span');
46694                                styleDiv(tParent);
46695                                tSpan = createTag('span');
46696                                styleDiv(tSpan);
46697                                tParent.appendChild(tSpan);
46698                            }
46699                        } else {
46700                            tSpan = this.textPaths[cnt] ? this.textPaths[cnt] : createNS('text');
46701                        }
46702                    }
46703                    //tSpan.setAttribute('visibility', 'hidden');
46704                    if (this.globalData.fontManager.chars) {
46705                        var charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(
46705documentData.f).fFamily);
46706                        var shapeData;
46707                        if (charData) {
46708                            shapeData = charData.data;
46709                        } else {
46710                            shapeData = null;
46711                        }
46712                        matrixHelper.reset();
46713                        if (shapeData && shapeData.shapes) {
46714                            shapes = shapeData.shapes[0].it;
46715                            matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100);
46716                            shapeStr = this.createPathShape(matrixHelper, shapes);
46717                            tSpan.setAttribute('d', shapeStr);
46718                        }
46719                        if (!this.isMasked) {
46720                            this.innerElem.appendChild(tParent);
46721                            if (shapeData && shapeData.shapes) {
46722
46723                                //document.body.appendChild is needed to get exact measure of shape
46724                                document.body.appendChild(tCont);
46725                                var boundingBox = tCont.getBBox();
46726                                tCont.setAttribute('width', boundingBox.width + 2);
46727                                tCont.setAttribute('height', boundingBox.height + 2);
46728                                tCont.setAttribute('viewBox', (boundingBox.x - 1) + ' ' + (boundingBox.y - 1) + ' ' + (boundingBox.width + 2) + ' ' + (boundingBox.height + 2));
46729                                tCont.style.transform = tCont.style.webkitTransform = 'translate(' + (boundingBox.x - 1) + 'px,' + (boundingBox.y - 1) + 'px)';
46730
46731                                letters[i].yOffset = boundingBox.y - 1;
46732
46733                            } else {
46734                                tCont.setAttribute('width', 1);
46735                                tCont.setAttribute('height', 1);
46736                            }
46737                            tParent.appendChild(tCont);
46738                        } else {
46739                            this.innerElem.appendChild(tSpan);
46740                        }
46741                    } else {
46742                        tSpan.textContent = letters[i].val;
46743                        tSpan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
46744                        if (!this.isMasked) {
46745                            this.innerElem.appendChild(tParent);
46746                            //
46747                            tSpan.style.transform = tSpan.style.webkitTransform = 'translate3d(0,' + -documentData.finalSize / 1.2 + 'px,0)';
46748                        } else {
46749                            this.innerElem.appendChild(tSpan);
46750                        }
46751                    }
46752                    //
46753                    if (!this.isMasked) {
46754                        this.textSpans[cnt] = tParent;
46755                    } else {
46756                        this.textSpans[cnt] = tSpan;
46757                    }
46758                    this.textSpans[cnt].style.display = 'block';
46759                    this.textPaths[cnt] = tSpan;
46760                    cnt += 1;
46761                }
46762                while (cnt < this.textSpans.length) {
46763                    this.textSpans[cnt].style.display = 'none';
46764                    cnt += 1;
46765                }
46766            };
46767
46768            HTextElement.prototype.renderInnerContent = function () {
46769
46770                if (this.data.singleShape) {
46771                    if (!this._isFirstFrame && !this.lettersChangedFlag) {
46772                        return;
46773                    } else {
46774                        // Todo Benchmark if using this is better than getBBox
46775                        if (this.isMasked && this.finalTransform._matMdf) {
46776                            this.svgElement.setAttribute('viewBox', -this.finalTransform.mProp.p.v[0] + ' ' + -this.finalTransform.mProp.p.v[1] + ' ' + this.compW + ' ' + this.compH);
46777                            this.svgElement.style.transform = this.svgElement.style.webkitTransform = 'translate(' + -this.finalTransform.mProp.p.v[0] + 'px,' + -this.finalTransform.mProp.p.v[1] + 'px)';
46778                        }
46779                    }
46780                }
46781
46782                this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);
46783                if (!this.lettersChangedFlag && !this.textAnimator.lettersChangedFlag) {
46784                    return;
46785                }
46786                var i, len, count = 0;
46787                var renderedLetters = this.textAnimator.renderedLetters;
46788
46789                var letters = this.textProperty.currentData.l;
46790
46791                len = letters.length;
46792                var renderedLetter, textSpan, textPath;
46793                for (i = 0; i < len; i += 1) {
46794                    if (letters[i].n) {
46795                        count += 1;
46796                        continue;
46797                    }
46798                    textSpan = this.textSpans[i];
46799                    textPath = this.textPaths[i];
46800                    renderedLetter = renderedLetters[count];
46801                    count += 1;
46802                    if (renderedLetter._mdf.m) {
46803                        if (!this.isMasked) {
46804                            textSpan.style.transform = textSpan.style.webkitTransform = renderedLetter.m;
46805                        } else {
46806                            textSpan.setAttribute('transform', renderedLetter.m);
46807                        }
46808                    }
46809                    ////textSpan.setAttribute('opacity',renderedLetter.o);
46810                    textSpan.style.opacity = renderedLetter.o;
46811                    if (renderedLetter.sw && renderedLetter._mdf.sw) {
46812                        textPath.setAttribute('stroke-width', renderedLetter.sw);
46813                    }
46814                    if (renderedLetter.sc && renderedLetter._mdf.sc) {
46815                        textPath.setAttribute('stroke', renderedLetter.sc);
46816                    }
46817                    if (renderedLetter.fc && renderedLetter._mdf.fc) {
46818                        textPath.setAttribute('fill', renderedLetter.fc);
46819                        textPath.style.color = renderedLetter.fc;
46820                    }
46821                }
46822
46823                if (this.innerElem.getBBox && !this.hidden && (this._isFirstFrame || this._mdf)) {
46824                    var boundingBox = this.innerElem.getBBox();
46825
vendor: 14,492 bytes, lines 46826-47125
46826                    if (this.currentBBox.w !== boundingBox.width) {
46827                        this.currentBBox.w = boundingBox.width;
46828                        this.svgElement.setAttribute('width', boundingBox.width);
46829                    }
46830                    if (this.currentBBox.h !== boundingBox.height) {
46831                        this.currentBBox.h = boundingBox.height;
46832                        this.svgElement.setAttribute('height', boundingBox.height);
46833                    }
46834
46835                    var margin = 1;
46836                    if (this.currentBBox.w !== (boundingBox.width + margin * 2) || this.currentBBox.h !== (boundingBox.height + margin * 2) || this.currentBBox.x !== (boundingBox.x - margin) || this.currentBBox.y !== (boundingBox.y - margin)) {
46837                        this.currentBBox.w = boundingBox.width + margin * 2;
46838                        this.currentBBox.h = boundingBox.height + margin * 2;
46839                        this.currentBBox.x = boundingBox.x - margin;
46840                        this.currentBBox.y = boundingBox.y - margin;
46841
46842                        this.svgElement.setAttribute('viewBox', this.currentBBox.x + ' ' + this.currentBBox.y + ' ' + this.currentBBox.w + ' ' + this.currentBBox.h);
46843                        this.svgElement.style.transform = this.svgElement.style.webkitTransform = 'translate(' + this.currentBBox.x + 'px,' + this.currentBBox.y + 'px)';
46844                    }
46845                }
46846            };
46847
46848            function HImageElement(data, globalData, comp) {
46849                this.assetData = globalData.getAssetData(data.refId);
46850                this.initElement(data, globalData, comp);
46851            }
46852
46853            extendPrototype([BaseElement, TransformElement, HBaseElement, HSolidElement, HierarchyElement, FrameElement, RenderableElement], HImageElement);
46854
46855
46856            HImageElement.prototype.createContent = function () {
46857                var assetPath = this.globalData.getAssetsPath(this.assetData);
46858                var img = new Image();
46859
46860                if (this.data.hasMask) {
46861                    this.imageElem = createNS('image');
46862                    this.imageElem.setAttribute('width', this.assetData.w + "px");
46863                    this.imageElem.setAttribute('height', this.assetData.h + "px");
46864                    this.imageElem.setAttributeNS('http://www.w3.org/1999/xlink', 'href', assetPath);
46865                    this.layerElement.appendChild(this.imageElem);
46866                    this.baseElement.setAttribute('width', this.assetData.w);
46867                    this.baseElement.setAttribute('height', this.assetData.h);
46868                } else {
46869                    this.layerElement.appendChild(img);
46870                }
46871                img.src = assetPath;
46872                if (this.data.ln) {
46873                    this.baseElement.setAttribute('id', this.data.ln);
46874                }
46875            };
46876
46877            function HCameraElement(data, globalData, comp) {
46878                this.initFrame();
46879                this.initBaseData(data, globalData, comp);
46880                this.initHierarchy();
46881                var getProp = PropertyFactory.getProp;
46882                this.pe = getProp(this, data.pe, 0, 0, this);
46883                if (data.ks.p.s) {
46884                    this.px = getProp(this, data.ks.p.x, 1, 0, this);
46885                    this.py = getProp(this, data.ks.p.y, 1, 0, this);
46886                    this.pz = getProp(this, data.ks.p.z, 1, 0, this);
46887                } else {
46888                    this.p = getProp(this, data.ks.p, 1, 0, this);
46889                }
46890                if (data.ks.a) {
46891                    this.a = getProp(this, data.ks.a, 1, 0, this);
46892                }
46893                if (data.ks.or.k.length && data.ks.or.k[0].to) {
46894                    var i, len = data.ks.or.k.length;
46895                    for (i = 0; i < len; i += 1) {
46896                        data.ks.or.k[i].to = null;
46897                        data.ks.or.k[i].ti = null;
46898                    }
46899                }
46900                this.or = getProp(this, data.ks.or, 1, degToRads, this);
46901                this.or.sh = true;
46902                this.rx = getProp(this, data.ks.rx, 0, degToRads, this);
46903                this.ry = getProp(this, data.ks.ry, 0, degToRads, this);
46904                this.rz = getProp(this, data.ks.rz, 0, degToRads, this);
46905                this.mat = new Matrix();
46906                this._prevMat = new Matrix();
46907                this._isFirstFrame = true;
46908
46909                // TODO: find a better way to make the HCamera element to be compatible with the LayerInterface and TransformInterface.
46910                this.finalTransform = {
46911                    mProp: this
46912                };
46913            }
46914
46915            extendPrototype([BaseElement, FrameElement, HierarchyElement], HCameraElement);
46916
46917            HCameraElement.prototype.setup = function () {
46918                var i, len = this.comp.threeDElements.length, comp;
46919                for (i = 0; i < len; i += 1) {
46920                    //[perspectiveElem,container]
46921                    comp = this.comp.threeDElements[i];
46922                    if (comp.type === '3d') {
46923                        comp.perspectiveElem.style.perspective = comp.perspectiveElem.style.webkitPerspective = this.pe.v + 'px';
46924                        comp.container.style.transformOrigin = comp.container.style.mozTransformOrigin = comp.container.style.webkitTransformOrigin = "0px 0px 0px";
46925                        comp.perspectiveElem.style.transform = comp.perspectiveElem.style.webkitTransform = 'matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)';
46926                    }
46927                }
46928            };
46929
46930            HCameraElement.prototype.createElements = function () {
46931            };
46932
46933            HCameraElement.prototype.hide = function () {
46934            };
46935
46936            HCameraElement.prototype.renderFrame = function () {
46937                var _mdf = this._isFirstFrame;
46938                var i, len;
46939                if (this.hierarchy) {
46940                    len = this.hierarchy.length;
46941                    for (i = 0; i < len; i += 1) {
46942                        _mdf = this.hierarchy[i].finalTransform.mProp._mdf || _mdf;
46943                    }
46944                }
46945                if (_mdf || this.pe._mdf || (this.p && this.p._mdf) || (this.px && (this.px._mdf || this.py._mdf || this.pz._mdf)) || this.rx._mdf || this.ry._mdf || this.rz._mdf || this.or._mdf || (this.a && this.a._mdf)) {
46946                    this.mat.reset();
46947
46948                    if (this.hierarchy) {
46949                        var mat;
46950                        len = this.hierarchy.length - 1;
46951                        for (i = len; i >= 0; i -= 1) {
46952                            var mTransf = this.hierarchy[i].finalTransform.mProp;
46953                            this.mat.translate(-mTransf.p.v[0], -mTransf.p.v[1], mTransf.p.v[2]);
46954                            this.mat.rotateX(-mTransf.or.v[0]).rotateY(-mTransf.or.v[1]).rotateZ(mTransf.or.v[2]);
46955                            this.mat.rotateX(-mTransf.rx.v).rotateY(-mTransf.ry.v).rotateZ(mTransf.rz.v);
46956                            this.mat.scale(1 / mTransf.s.v[0], 1 / mTransf.s.v[1], 1 / mTransf.s.v[2]);
46957                            this.mat.translate(mTransf.a.v[0], mTransf.a.v[1], mTransf.a.v[2]);
46958                        }
46959                    }
46960                    if (this.p) {
46961                        this.mat.translate(-this.p.v[0], -this.p.v[1], this.p.v[2]);
46962                    } else {
46963                        this.mat.translate(-this.px.v, -this.py.v, this.pz.v);
46964                    }
46965                    if (this.a) {
46966                        var diffVector
46967                        if (this.p) {
46968                            diffVector = [this.p.v[0] - this.a.v[0], this.p.v[1] - this.a.v[1], this.p.v[2] - this.a.v[2]];
46969                        } else {
46970                            diffVector = [this.px.v - this.a.v[0], this.py.v - this.a.v[1], this.pz.v - this.a.v[2]];
46971                        }
46972                        var mag = Math.sqrt(Math.pow(diffVector[0], 2) + Math.pow(diffVector[1], 2) + Math.pow(diffVector[2], 2));
46973                        //var lookDir = getNormalizedPoint(getDiffVector(this.a.v,this.p.v));
46974                        var lookDir = [diffVector[0] / mag, diffVector[1] / mag, diffVector[2] / mag];
46975                        var lookLengthOnXZ = Math.sqrt(lookDir[2] * lookDir[2] + lookDir[0] * lookDir[0]);
46976                        var m_rotationX = (Math.atan2(lookDir[1], lookLengthOnXZ));
46977                        var m_rotationY = (Math.atan2(lookDir[0], -lookDir[2]));
46978                        this.mat.rotateY(m_rotationY).rotateX(-m_rotationX);
46979
46980                    }
46981                    this.mat.rotateX(-this.rx.v).rotateY(-this.ry.v).rotateZ(this.rz.v);
46982                    this.mat.rotateX(-this.or.v[0]).rotateY(-this.or.v[1]).rotateZ(this.or.v[2]);
46983                    this.mat.translate(this.globalData.compSize.w / 2, this.globalData.compSize.h / 2, 0);
46984                    this.mat.translate(0, 0, this.pe.v);
46985
46986
46987                    var hasMatrixChanged = !this._prevMat.equals(this.mat);
46988                    if ((hasMatrixChanged || this.pe._mdf) && this.comp.threeDElements) {
46989                        len = this.comp.threeDElements.length;
46990                        var comp;
46991                        for (i = 0; i < len; i += 1) {
46992                            comp = this.comp.threeDElements[i];
46993                            if (comp.type === '3d') {
46994                                if (hasMatrixChanged) {
46995                                    comp.container.style.transform = comp.container.style.webkitTransform = this.mat.toCSS();
46996                                }
46997                                if (this.pe._mdf) {
46998                                    comp.perspectiveElem.style.perspective = comp.perspectiveElem.style.webkitPerspective = this.pe.v + 'px';
46999                                }
47000                            }
47001                        }
47002                        this.mat.clone(this._prevMat);
47003                    }
47004                }
47005                this._isFirstFrame = false;
47006            };
47007
47008            HCameraElement.prototype.prepareFrame = function (num) {
47009                this.prepareProperties(num, true);
47010            };
47011
47012            HCameraElement.prototype.destroy = function () {
47013            };
47014            HCameraElement.prototype.getBaseElement = function () {
47015                return null;
47016            };
47017
47018            function HEffects() {
47019            }
47020
47021            HEffects.prototype.renderFrame = function () {
47022            };
47023            var animationManager = (function () {
47024                var moduleOb = {};
47025                var registeredAnimations = [];
47026                var initTime = 0;
47027                var len = 0;
47028                var playingAnimationsNum = 0;
47029                var _stopped = true;
47030                var _isFrozen = false;
47031
47032                function removeElement(ev) {
47033                    var i = 0;
47034                    var animItem = ev.target;
47035                    while (i < len) {
47036                        if (registeredAnimations[i].animation === animItem) {
47037                            registeredAnimations.splice(i, 1);
47038                            i -= 1;
47039                            len -= 1;
47040                            if (!animItem.isPaused) {
47041                                subtractPlayingCount();
47042                            }
47043                        }
47044                        i += 1;
47045                    }
47046                }
47047
47048                function registerAnimation(element, animationData) {
47049                    if (!element) {
47050                        return null;
47051                    }
47052                    var i = 0;
47053                    while (i < len) {
47054                        if (registeredAnimations[i].elem == element && registeredAnimations[i].elem !== null) {
47055                            return registeredAnimations[i].animation;
47056                        }
47057                        i += 1;
47058                    }
47059                    var animItem = new AnimationItem();
47060                    setupAnimation(animItem, element);
47061                    animItem.setData(element, animationData);
47062                    return animItem;
47063                }
47064
47065                function getRegisteredAnimations() {
47066                    var i, len = registeredAnimations.length;
47067                    var animations = [];
47068                    for (i = 0; i < len; i += 1) {
47069                        animations.push(registeredAnimations[i].animation);
47070                    }
47071                    return animations;
47072                }
47073
47074                function addPlayingCount() {
47075                    playingAnimationsNum += 1;
47076                    activate();
47077                }
47078
47079                function subtractPlayingCount() {
47080                    playingAnimationsNum -= 1;
47081                }
47082
47083                function setupAnimation(animItem, element) {
47084                    animItem.addEventListener('destroy', removeElement);
47085                    animItem.addEventListener('_active', addPlayingCount);
47086                    animItem.addEventListener('_idle', subtractPlayingCount);
47087                    registeredAnimations.push({elem: element, animation: animItem});
47088                    len += 1;
47089                }
47090
47091                function loadAnimation(params) {
47092                    var animItem = new AnimationItem();
47093                    setupAnimation(animItem, null);
47094                    animItem.setParams(params);
47095                    return animItem;
47096                }
47097
47098
47099                function setSpeed(val, animation) {
47100                    var i;
47101                    for (i = 0; i < len; i += 1) {
47102                        registeredAnimations[i].animation.setSpeed(val, animation);
47103                    }
47104                }
47105
47106                function setDirection(val, animation) {
47107                    var i;
47108                    for (i = 0; i < len; i += 1) {
47109                        registeredAnimations[i].animation.setDirection(val, animation);
47110                    }
47111                }
47112
47113                function play(animation) {
47114                    var i;
47115                    for (i = 0; i < len; i += 1) {
47116                        registeredAnimations[i].animation.play(animation);
47117                    }
47118                }
47119
47120                function resume(nowTime) {
47121                    var elapsedTime = nowTime - initTime;
47122                    var i;
47123                    for (i = 0; i < len; i += 1) {
47124                        registeredAnimations[i].animation.advanceTime(elapsedTime);
47125                    }
vendor: 5,630 bytes, lines 47126-47271
47126                    initTime = nowTime;
47127                    if (playingAnimationsNum && !_isFrozen) {
47128                        window.requestAnimationFrame(resume);
47129                    } else {
47130                        _stopped = true;
47131                    }
47132                }
47133
47134                function first(nowTime) {
47135                    initTime = nowTime;
47136                    window.requestAnimationFrame(resume);
47137                }
47138
47139                function pause(animation) {
47140                    var i;
47141                    for (i = 0; i < len; i += 1) {
47142                        registeredAnimations[i].animation.pause(animation);
47143                    }
47144                }
47145
47146                function goToAndStop(value, isFrame, animation) {
47147                    var i;
47148                    for (i = 0; i < len; i += 1) {
47149                        registeredAnimations[i].animation.goToAndStop(value, isFrame, animation);
47150                    }
47151                }
47152
47153                function stop(animation) {
47154                    var i;
47155                    for (i = 0; i < len; i += 1) {
47156                        registeredAnimations[i].animation.stop(animation);
47157                    }
47158                }
47159
47160                function togglePause(animation) {
47161                    var i;
47162                    for (i = 0; i < len; i += 1) {
47163                        registeredAnimations[i].animation.togglePause(animation);
47164                    }
47165                }
47166
47167                function destroy(animation) {
47168                    var i;
47169                    for (i = (len - 1); i >= 0; i -= 1) {
47170                        registeredAnimations[i].animation.destroy(animation);
47171                    }
47172                }
47173
47174                function searchAnimations(animationData, standalone, renderer) {
47175                    var animElements = [].concat([].slice.call(document.getElementsByClassName('lottie')),
47176                        [].slice.call(document.getElementsByClassName('bodymovin')));
47177                    var i, len = animElements.length;
47178                    for (i = 0; i < len; i += 1) {
47179                        if (renderer) {
47180                            animElements[i].setAttribute('data-bm-type', renderer);
47181                        }
47182                        registerAnimation(animElements[i], animationData);
47183                    }
47184                    if (standalone && len === 0) {
47185                        if (!renderer) {
47186                            renderer = 'svg';
47187                        }
47188                        var body = document.getElementsByTagName('body')[0];
47189                        body.innerText = '';
47190                        var div = createTag('div');
47191                        div.style.width = '100%';
47192                        div.style.height = '100%';
47193                        div.setAttribute('data-bm-type', renderer);
47194                        body.appendChild(div);
47195                        registerAnimation(div, animationData);
47196                    }
47197                }
47198
47199                function resize() {
47200                    var i;
47201                    for (i = 0; i < len; i += 1) {
47202                        registeredAnimations[i].animation.resize();
47203                    }
47204                }
47205
47206                function activate() {
47207                    if (!_isFrozen && playingAnimationsNum) {
47208                        if (_stopped) {
47209                            window.requestAnimationFrame(first);
47210                            _stopped = false;
47211                        }
47212                    }
47213                }
47214
47215                function freeze() {
47216                    _isFrozen = true;
47217                }
47218
47219                function unfreeze() {
47220                    _isFrozen = false;
47221                    activate();
47222                }
47223
47224                function setVolume(val, animation) {
47225                    var i;
47226                    for (i = 0; i < len; i += 1) {
47227                        registeredAnimations[i].animation.setVolume(val, animation);
47228                    }
47229                }
47230
47231                function mute(animation) {
47232                    var i;
47233                    for (i = 0; i < len; i += 1) {
47234                        registeredAnimations[i].animation.mute(animation);
47235                    }
47236                }
47237
47238                function unmute(animation) {
47239                    var i;
47240                    for (i = 0; i < len; i += 1) {
47241                        registeredAnimations[i].animation.unmute(animation);
47242                    }
47243                }
47244
47245                moduleOb.registerAnimation = registerAnimation;
47246                moduleOb.loadAnimation = loadAnimation;
47247                moduleOb.setSpeed = setSpeed;
47248                moduleOb.setDirection = setDirection;
47249                moduleOb.play = play;
47250                moduleOb.pause = pause;
47251                moduleOb.stop = stop;
47252                moduleOb.togglePause = togglePause;
47253                moduleOb.searchAnimations = searchAnimations;
47254                moduleOb.resize = resize;
47255                //moduleOb.start = start;
47256                moduleOb.goToAndStop = goToAndStop;
47257                moduleOb.destroy = destroy;
47258                moduleOb.freeze = freeze;
47259                moduleOb.unfreeze = unfreeze;
47260                moduleOb.setVolume = setVolume;
47261                moduleOb.mute = mute;
47262                moduleOb.unmute = unmute;
47263                moduleOb.getRegisteredAnimations = getRegisteredAnimations;
47264                return moduleOb;
47265            }());
47266
47267            var AnimationItem = function () {
47268                this._cbs = [];
47269                this.name = '';
47270                this.path = '';
47271                this.isLoaded = false;
47272                this.currentFrame = 0;
47273                this.currentRawFrame = 0;
47274                this.firstFrame = 0;
47275                this.totalFrames = 0;
47276                this.frameRate = 0;
47277                this.frameMult = 0;
47278                this.playSpeed = 1;
47279                this.playDirection = 1;
47280                this.playCount = 0;
47281                this.animationData = {};
47282                this.assets = [];
47283                this.isPaused = true;
47284                this.autoplay = false;
47285                this.loop = true;
47286                this.renderer = null;
47287                this.animationID = createElementID();
47288                this.assetsPath = '';
47289                this.timeCompleted = 0;
47290                this.segmentPos = 0;
47291                this.isSubframeEnabled = subframeEnabled;
47292                this.segments = [];
47293                this._idle = true;
47294                this._completedLoop = false;
47295                this.projectInterface = ProjectInterface();
47296                this.imagePreloader = new ImagePreloader();
47297                this.audioController = audioControllerFactory();
47298            };
47299
47300            extendPrototype([BaseEvent], AnimationItem);
47301
47302            AnimationItem.prototype.setParams = function (params) {
47303                if (params.wrapper || params.container) {
47304                    this.wrapper = params.wrapper || params.container;
47305                }
47306                var animType = params.animType ? params.animType : params.renderer ? params.renderer : 'svg';
47307                switch (animType) {
47308                    case 'canvas':
47309                        this.renderer = new CanvasRenderer(this, params.rendererSettings);
47310                        break;
47311                    case 'svg':
47312                        this.renderer = new SVGRenderer(this, params.rendererSettings);
47313                        break;
47314                    default:
47315                        this.renderer = new HybridRenderer(this, params.rendererSettings);
47316                        break;
47317                }
47318                this.imagePreloader.setCacheType(animType);
47319                this.renderer.setProjectInterface(this.projectInterface);
47320                this.animType = animType;
47321                if (params.loop === ''
47322                    || params.loop === null
47323                    || params.loop === undefined
47324                    || params.loop === true) {
47325                    this.loop = true;
47326                } else if (params.loop === false) {
47327                    this.loop = false;
47328                } else {
47329                    this.loop = parseInt(params.loop);
47330                }
47331                this.autoplay = 'autoplay' in params ? params.autoplay : true;
47332                this.name = params.name ? params.name : '';
47333                this.autoloadSegments = params.hasOwnProperty('autoloadSegments') ? params.autoloadSegments : true;
47334                this.assetsPath = params.assetsPath;
47335                this.initialSegment = params.initialSegment;
47336                if (params.audioFactory) {
47337                    this.audioController.setAudioFactory(params.audioFactory);
47338                }
47339                if (params.animationData) {
47340                    this.configAnimation(params.animationData);
47341                } else if (params.path) {
47342
47343                    if (params.path.lastIndexOf('\\') !== -1) {
47344                        this.path = params.path.substr(0, params.path.lastIndexOf('\\') + 1);
47345                    } else {
47346                        this.path = params.path.substr(0, params.path.lastIndexOf('/') + 1);
47347                    }
47348                    this.fileName = params.path.substr(params.path.lastIndexOf('/') + 1);
47349                    this.fileName = this.fileName.substr(0, this.fileName.lastIndexOf('.json'));
47350
47351                    assetLoader.load(params.path, this.configAnimation.bind(this), function () {
47352                        this.trigger('data_failed');
47353                    }.bind(this));
47354                }
47355
47356            };
47357
47358            AnimationItem.prototype.setData = function (wrapper, animationData) {
47359                var params = {
47360                    wrapper: wrapper,
47361                    animationData: animationData ? (typeof animationData === "object") ? animationData : JSON.parse(animationData) : null
47362                };
47363                var wrapperAttributes = wrapper.attributes;
47364
47365                params.path = wrapperAttributes.getNamedItem('data-animation-path') ? wrapperAttributes.getNamedItem('data-animation-path').value : wrapperAttributes.getNamedItem('data-bm-path') ? wrapperAttributes.getNamedItem('data-bm-path').value : wrapperAttributes.getNamedItem('bm-path') ? wrapperAttributes.getNamedItem('bm-path').value : '';
47366                params.animType = wrapperAttributes.getNamedItem('data-anim-type') ? wrapperAttributes.getNamedItem('data-anim-type').value : wrapperAttributes.getNamedItem('data-bm-type') ? wrapperAttributes.getNamedItem('data-bm-type').value : wrapperAttributes.getNamedItem('bm-type') ? wrapperAttributes.getNamedItem('bm-type').value : wrapperAttributes.getNamedItem('data-bm-renderer') ? wrapperAttributes.getNamedItem('data-bm-renderer').value : wrapperAttributes.getNamedItem('bm-renderer') ? wrapperAttributes.getNamedItem('bm-renderer').value : 'canvas';
47367
47368                var loop = wrapperAttributes.getNamedItem('data-anim-loop') ? wrapperAttributes.getNamedItem('data-anim-loop').value : wrapperAttributes.getNamedItem('data-bm-loop') ? wrapperAttributes.getNamedItem('data-bm-loop').value : wrapperAttributes.getNamedItem('bm-loop') ? wrapperAttributes.getNamedItem('bm-loop').value : '';
47369                if (loop === '') {
47370                } else if (loop === 'false') {
47371                    params.loop = false;
47372                } else if (loop === 'true') {
47373                    params.loop = true;
47374                } else {
47375                    params.loop = parseInt(loop);
47376                }
47377                var autoplay = wrapperAttributes.getNamedItem('data-anim-autoplay') ? wrapperAttributes.getNamedItem('data-anim-autoplay').value : wrapperAttributes.getNamedItem('data-bm-autoplay') ? wrapperAttributes.getNamedItem('data-bm-autoplay').value : wrapperAttributes.getNamedItem('bm-autoplay') ? wrapperAttributes.getNamedItem('bm-autoplay').value : true;
47378                params.autoplay = autoplay !== "false";
47379
47380                params.name = wrapperAttributes.getNamedItem('data-name') ? wrapperAttributes.getNamedItem('data-name').value : wrapperAttributes.getNamedItem('data-bm-name') ? wrapperAttributes.getNamedItem('data-bm-name').value : wrapperAttributes.getNamedItem('bm-name') ? wrapperAttributes.getNamedItem('bm-name').value : '';
47381                var prerender = wrapperAttributes.getNamedItem('data-anim-prerender') ? wrapperAttributes.getNamedItem('data-anim-prerender').value : wrapperAttributes.getNamedItem('data-bm-prerender') ? wrapperAttributes.getNamedItem('data-bm-prerender').value : wrapperAttributes.getNamedItem('bm-prerender') ? wrapperAttributes.getNamedItem('bm-prerender').value : '';
47382
47383                if (prerender === 'false') {
47384                    params.prerender = false;
vendor: 7,274 bytes, lines 47385-47554
47385                }
47386                this.setParams(params);
47387            };
47388
47389            AnimationItem.prototype.includeLayers = function (data) {
47390                if (data.op > this.animationData.op) {
47391                    this.animationData.op = data.op;
47392                    this.totalFrames = Math.floor(data.op - this.animationData.ip);
47393                }
47394                var layers = this.animationData.layers;
47395                var i, len = layers.length;
47396                var newLayers = data.layers;
47397                var j, jLen = newLayers.length;
47398                for (j = 0; j < jLen; j += 1) {
47399                    i = 0;
47400                    while (i < len) {
47401                        if (layers[i].id == newLayers[j].id) {
47402                            layers[i] = newLayers[j];
47403                            break;
47404                        }
47405                        i += 1;
47406                    }
47407                }
47408                if (data.chars || data.fonts) {
47409                    this.renderer.globalData.fontManager.addChars(data.chars);
47410                    this.renderer.globalData.fontManager.addFonts(data.fonts, this.renderer.globalData.defs);
47411                }
47412                if (data.assets) {
47413                    len = data.assets.length;
47414                    for (i = 0; i < len; i += 1) {
47415                        this.animationData.assets.push(data.assets[i]);
47416                    }
47417                }
47418                this.animationData.__complete = false;
47419                dataManager.completeData(this.animationData, this.renderer.globalData.fontManager);
47420                this.renderer.includeLayers(data.layers);
47421                if (expressionsPlugin) {
47422                    expressionsPlugin.initExpressions(this);
47423                }
47424                this.loadNextSegment();
47425            };
47426
47427            AnimationItem.prototype.loadNextSegment = function () {
47428                var segments = this.animationData.segments;
47429                if (!segments || segments.length === 0 || !this.autoloadSegments) {
47430                    this.trigger('data_ready');
47431                    this.timeCompleted = this.totalFrames;
47432                    return;
47433                }
47434                var segment = segments.shift();
47435                this.timeCompleted = segment.time * this.frameRate;
47436                var segmentPath = this.path + this.fileName + '_' + this.segmentPos + '.json';
47437                this.segmentPos += 1;
47438                assetLoader.load(segmentPath, this.includeLayers.bind(this), function () {
47439                    this.trigger('data_failed');
47440                }.bind(this));
47441            };
47442
47443            AnimationItem.prototype.loadSegments = function () {
47444                var segments = this.animationData.segments;
47445                if (!segments) {
47446                    this.timeCompleted = this.totalFrames;
47447                }
47448                this.loadNextSegment();
47449            };
47450
47451            AnimationItem.prototype.imagesLoaded = function () {
47452                this.trigger('loaded_images');
47453                this.checkLoaded()
47454            }
47455
47456            AnimationItem.prototype.preloadImages = function () {
47457                this.imagePreloader.setAssetsPath(this.assetsPath);
47458                this.imagePreloader.setPath(this.path);
47459                this.imagePreloader.loadAssets(this.animationData.assets, this.imagesLoaded.bind(this));
47460            }
47461
47462            AnimationItem.prototype.configAnimation = function (animData) {
47463                if (!this.renderer) {
47464                    return;
47465                }
47466                try {
47467                    this.animationData = animData;
47468
47469                    if (this.initialSegment) {
47470                        this.totalFrames = Math.floor(this.initialSegment[1] - this.initialSegment[0]);
47471                        this.firstFrame = Math.round(this.initialSegment[0]);
47472                    } else {
47473                        this.totalFrames = Math.floor(this.animationData.op - this.animationData.ip);
47474                        this.firstFrame = Math.round(this.animationData.ip);
47475                    }
47476                    this.renderer.configAnimation(animData);
47477                    if (!animData.assets) {
47478                        animData.assets = [];
47479                    }
47480
47481                    this.assets = this.animationData.assets;
47482                    this.frameRate = this.animationData.fr;
47483                    this.frameMult = this.animationData.fr / 1000;
47484                    this.renderer.searchExtraCompositions(animData.assets);
47485                    this.trigger('config_ready');
47486                    this.preloadImages();
47487                    this.loadSegments();
47488                    this.updaFrameModifier();
47489                    this.waitForFontsLoaded();
47490                    if (this.isPaused) {
47491                        this.audioController.pause();
47492                    }
47493                } catch (error) {
47494                    this.triggerConfigError(error);
47495                }
47496            };
47497
47498            AnimationItem.prototype.waitForFontsLoaded = function () {
47499                if (!this.renderer) {
47500                    return;
47501                }
47502                if (this.renderer.globalData.fontManager.isLoaded) {
47503                    this.checkLoaded();
47504                } else {
47505                    setTimeout(this.waitForFontsLoaded.bind(this), 20);
47506                }
47507            }
47508
47509            AnimationItem.prototype.checkLoaded = function () {
47510                if (!this.isLoaded
47511                    && this.renderer.globalData.fontManager.isLoaded
47512                    && (this.imagePreloader.loaded() || this.renderer.rendererType !== 'canvas')
47513                ) {
47514                    this.isLoaded = true;
47515                    dataManager.completeData(this.animationData, this.renderer.globalData.fontManager);
47516                    if (expressionsPlugin) {
47517                        expressionsPlugin.initExpressions(this);
47518                    }
47519                    this.renderer.initItems();
47520                    setTimeout(function () {
47521                        this.trigger('DOMLoaded');
47522                    }.bind(this), 0);
47523                    this.gotoFrame();
47524                    if (this.autoplay) {
47525                        this.play();
47526                    }
47527                }
47528            };
47529
47530            AnimationItem.prototype.resize = function () {
47531                this.renderer.updateContainerSize();
47532            };
47533
47534            AnimationItem.prototype.setSubframe = function (flag) {
47535                this.isSubframeEnabled = !!flag;
47536            };
47537
47538            AnimationItem.prototype.gotoFrame = function () {
47539                this.currentFrame = this.isSubframeEnabled ? this.currentRawFrame : ~~this.currentRawFrame;
47540
47541                if (this.timeCompleted !== this.totalFrames && this.currentFrame > this.timeCompleted) {
47542                    this.currentFrame = this.timeCompleted;
47543                }
47544                this.trigger('enterFrame');
47545                this.renderFrame();
47546            };
47547
47548            AnimationItem.prototype.renderFrame = function () {
47549                if (this.isLoaded === false) {
47550                    return;
47551                }
47552                try {
47553                    this.renderer.renderFrame(this.currentFrame + this.firstFrame);
47554                } catch (error) {
47555                    this.triggerRenderFrameError(error);
47556                }
47557            };
47558
47559            AnimationItem.prototype.play = function (name) {
47560                if (name && this.name != name) {
47561                    return;
47562                }
47563                if (this.isPaused === true) {
47564                    this.isPaused = false;
47565                    this.audioController.resume();
47566                    if (this._idle) {
47567                        this._idle = false;
47568                        this.trigger('_active');
47569                    }
47570                }
47571            };
47572
47573            AnimationItem.prototype.pause = function (name) {
47574                if (name && this.name != name) {
47575                    return;
47576                }
47577                if (this.isPaused === false) {
47578                    this.isPaused = true;
47579                    this._idle = true;
47580                    this.trigger('_idle');
47581                    this.audioController.pause();
47582                }
47583            };
47584
47585            AnimationItem.prototype.togglePause = function (name) {
47586                if (name && this.name != name) {
47587                    return;
47588                }
47589                if (this.isPaused === true) {
47590                    this.play();
47591                } else {
47592                    this.pause();
47593                }
47594            };
47595
47596            AnimationItem.prototype.stop = function (name) {
47597                if (name && this.name != name) {
47598                    return;
47599                }
47600                this.pause();
47601                this.playCount = 0;
47602                this._completedLoop = false;
47603                this.setCurrentRawFrameValue(0);
47604            };
47605
47606            AnimationItem.prototype.goToAndStop = function (value, isFrame, name) {
47607                if (name && this.name != name) {
47608                    return;
47609                }
47610                if (isFrame) {
47611                    this.setCurrentRawFrameValue(value);
47612                } else {
47613                    this.setCurrentRawFrameValue(value * this.frameModifier);
47614                }
47615                this.pause();
47616            };
47617
47618            AnimationItem.prototype.goToAndPlay = function (value, isFrame, name) {
47619                this.goToAndStop(value, isFrame, name);
47620                this.play();
47621            };
47622
47623            AnimationItem.prototype.advanceTime = function (value) {
47624                if (this.isPaused === true || this.isLoaded === false) {
47625                    return;
47626                }
47627                var nextValue = this.currentRawFrame + value * this.frameModifier;
47628                var _isComplete = false;
47629                // Checking if nextValue > totalFrames - 1 for addressing non looping and looping animations.
47630                // If animation won't loop, it should stop at totalFrames - 1. If it will loop it should complete the last frame and then loop.
vendor: 27,673 bytes, lines 47631-48308
47631                if (nextValue >= this.totalFrames - 1 && this.frameModifier > 0) {
47632                    if (!this.loop || this.playCount === this.loop) {
47633                        if (!this.checkSegments(nextValue > this.totalFrames ? nextValue % this.totalFrames : 0)) {
47634                            _isComplete = true;
47635                            nextValue = this.totalFrames - 1;
47636                        }
47637                    } else if (nextValue >= this.totalFrames) {
47638                        this.playCount += 1;
47639                        if (!this.checkSegments(nextValue % this.totalFrames)) {
47640                            this.setCurrentRawFrameValue(nextValue % this.totalFrames);
47641                            this._completedLoop = true;
47642                            this.trigger('loopComplete');
47643                        }
47644                    } else {
47645                        this.setCurrentRawFrameValue(nextValue);
47646                    }
47647                } else if (nextValue < 0) {
47648                    if (!this.checkSegments(nextValue % this.totalFrames)) {
47649                        if (this.loop && !(this.playCount-- <= 0 && this.loop !== true)) {
47650                            this.setCurrentRawFrameValue(this.totalFrames + (nextValue % this.totalFrames));
47651                            if (!this._completedLoop) {
47652                                this._completedLoop = true;
47653                            } else {
47654                                this.trigger('loopComplete');
47655                            }
47656                        } else {
47657                            _isComplete = true;
47658                            nextValue = 0;
47659                        }
47660                    }
47661                } else {
47662                    this.setCurrentRawFrameValue(nextValue);
47663                }
47664                if (_isComplete) {
47665                    this.setCurrentRawFrameValue(nextValue);
47666                    this.pause();
47667                    this.trigger('complete');
47668                }
47669            };
47670
47671            AnimationItem.prototype.adjustSegment = function (arr, offset) {
47672                this.playCount = 0;
47673                if (arr[1] < arr[0]) {
47674                    if (this.frameModifier > 0) {
47675                        if (this.playSpeed < 0) {
47676                            this.setSpeed(-this.playSpeed);
47677                        } else {
47678                            this.setDirection(-1);
47679                        }
47680                    }
47681                    this.timeCompleted = this.totalFrames = arr[0] - arr[1];
47682                    this.firstFrame = arr[1];
47683                    this.setCurrentRawFrameValue(this.totalFrames - 0.001 - offset);
47684                } else if (arr[1] > arr[0]) {
47685                    if (this.frameModifier < 0) {
47686                        if (this.playSpeed < 0) {
47687                            this.setSpeed(-this.playSpeed);
47688                        } else {
47689                            this.setDirection(1);
47690                        }
47691                    }
47692                    this.timeCompleted = this.totalFrames = arr[1] - arr[0];
47693                    this.firstFrame = arr[0];
47694                    this.setCurrentRawFrameValue(0.001 + offset);
47695                }
47696                this.trigger('segmentStart');
47697            };
47698            AnimationItem.prototype.setSegment = function (init, end) {
47699                var pendingFrame = -1;
47700                if (this.isPaused) {
47701                    if (this.currentRawFrame + this.firstFrame < init) {
47702                        pendingFrame = init;
47703                    } else if (this.currentRawFrame + this.firstFrame > end) {
47704                        pendingFrame = end - init;
47705                    }
47706                }
47707
47708                this.firstFrame = init;
47709                this.timeCompleted = this.totalFrames = end - init;
47710                if (pendingFrame !== -1) {
47711                    this.goToAndStop(pendingFrame, true);
47712                }
47713            };
47714
47715            AnimationItem.prototype.playSegments = function (arr, forceFlag) {
47716                if (forceFlag) {
47717                    this.segments.length = 0;
47718                }
47719                if (typeof arr[0] === 'object') {
47720                    var i, len = arr.length;
47721                    for (i = 0; i < len; i += 1) {
47722                        this.segments.push(arr[i]);
47723                    }
47724                } else {
47725                    this.segments.push(arr);
47726                }
47727                if (this.segments.length && forceFlag) {
47728                    this.adjustSegment(this.segments.shift(), 0);
47729                }
47730                if (this.isPaused) {
47731                    this.play();
47732                }
47733            };
47734
47735            AnimationItem.prototype.resetSegments = function (forceFlag) {
47736                this.segments.length = 0;
47737                this.segments.push([this.animationData.ip, this.animationData.op]);
47738                //this.segments.push([this.animationData.ip*this.frameRate,Math.floor(this.animationData.op - this.animationData.ip+this.animationData.ip*this.frameRate)]);
47739                if (forceFlag) {
47740                    this.checkSegments(0);
47741                }
47742            };
47743            AnimationItem.prototype.checkSegments = function (offset) {
47744                if (this.segments.length) {
47745                    this.adjustSegment(this.segments.shift(), offset);
47746                    return true;
47747                }
47748                return false;
47749            };
47750
47751            AnimationItem.prototype.destroy = function (name) {
47752                if ((name && this.name != name) || !this.renderer) {
47753                    return;
47754                }
47755                this.renderer.destroy();
47756                this.imagePreloader.destroy();
47757                this.trigger('destroy');
47758                this._cbs = null;
47759                this.onEnterFrame = this.onLoopComplete = this.onComplete = this.onSegmentStart = this.onDestroy = null;
47760                this.renderer = null;
47761            };
47762
47763            AnimationItem.prototype.setCurrentRawFrameValue = function (value) {
47764                this.currentRawFrame = value;
47765                this.gotoFrame();
47766            };
47767
47768            AnimationItem.prototype.setSpeed = function (val) {
47769                this.playSpeed = val;
47770                this.updaFrameModifier();
47771            };
47772
47773            AnimationItem.prototype.setDirection = function (val) {
47774                this.playDirection = val < 0 ? -1 : 1;
47775                this.updaFrameModifier();
47776            };
47777
47778            AnimationItem.prototype.setVolume = function (val, name) {
47779                if (name && this.name !== name) {
47780                    return;
47781                }
47782                this.audioController.setVolume(val);
47783            };
47784
47785            AnimationItem.prototype.getVolume = function () {
47786                return this.audioController.getVolume();
47787            };
47788
47789            AnimationItem.prototype.mute = function (name) {
47790                if (name && this.name !== name) {
47791                    return;
47792                }
47793                this.audioController.mute();
47794            };
47795
47796            AnimationItem.prototype.unmute = function (name) {
47797                if (name && this.name !== name) {
47798                    return;
47799                }
47800                this.audioController.unmute();
47801            };
47802
47803            AnimationItem.prototype.updaFrameModifier = function () {
47804                this.frameModifier = this.frameMult * this.playSpeed * this.playDirection;
47805                this.audioController.setRate(this.playSpeed * this.playDirection)
47806            };
47807
47808            AnimationItem.prototype.getPath = function () {
47809                return this.path;
47810            };
47811
47812            AnimationItem.prototype.getAssetsPath = function (assetData) {
47813                var path = '';
47814                if (assetData.e) {
47815                    path = assetData.p;
47816                } else if (this.assetsPath) {
47817                    var imagePath = assetData.p;
47818                    if (imagePath.indexOf('images/') !== -1) {
47819                        imagePath = imagePath.split('/')[1];
47820                    }
47821                    path = this.assetsPath + imagePath;
47822                } else {
47823                    path = this.path;
47824                    path += assetData.u ? assetData.u : '';
47825                    path += assetData.p;
47826                }
47827                return path;
47828            };
47829
47830            AnimationItem.prototype.getAssetData = function (id) {
47831                var i = 0, len = this.assets.length;
47832                while (i < len) {
47833                    if (id == this.assets[i].id) {
47834                        return this.assets[i];
47835                    }
47836                    i += 1;
47837                }
47838            };
47839
47840            AnimationItem.prototype.hide = function () {
47841                this.renderer.hide();
47842            };
47843
47844            AnimationItem.prototype.show = function () {
47845                this.renderer.show();
47846            };
47847
47848            AnimationItem.prototype.getDuration = function (isFrame) {
47849                return isFrame ? this.totalFrames : this.totalFrames / this.frameRate;
47850            };
47851
47852            AnimationItem.prototype.trigger = function (name) {
47853                if (this._cbs && this._cbs[name]) {
47854                    switch (name) {
47855                        case 'enterFrame':
47856                            this.triggerEvent(name, new BMEnterFrameEvent(name, this.currentFrame, this.totalFrames, this.frameModifier));
47857                            break;
47858                        case 'loopComplete':
47859                            this.triggerEvent(name, new BMCompleteLoopEvent(name, this.loop, this.playCount, this.frameMult));
47860                            break;
47861                        case 'complete':
47862                            this.triggerEvent(name, new BMCompleteEvent(name, this.frameMult));
47863                            break;
47864                        case 'segmentStart':
47865                            this.triggerEvent(name, new BMSegmentStartEvent(name, this.firstFrame, this.totalFrames));
47866                            break;
47867                        case 'destroy':
47868                            this.triggerEvent(name, new BMDestroyEvent(name, this));
47869                            break;
47870                        default:
47871                            this.triggerEvent(name);
47872                    }
47873                }
47874                if (name === 'enterFrame' && this.onEnterFrame) {
47875                    this.onEnterFrame.call(this, new BMEnterFrameEvent(name, this.currentFrame, this.totalFrames, this.frameMult));
47876                }
47877                if (name === 'loopComplete' && this.onLoopComplete) {
47878                    this.onLoopComplete.call(this, new BMCompleteLoopEvent(name, this.loop, this.playCount, this.frameMult));
47879                }
47880                if (name === 'complete' && this.onComplete) {
47881                    this.onComplete.call(this, new BMCompleteEvent(name, this.frameMult));
47882                }
47883                if (name === 'segmentStart' && this.onSegmentStart) {
47884                    this.onSegmentStart.call(this, new BMSegmentStartEvent(name, this.firstFrame, this.totalFrames));
47885                }
47886                if (name === 'destroy' && this.onDestroy) {
47887                    this.onDestroy.call(this, new BMDestroyEvent(name, this));
47888                }
47889            };
47890
47891            AnimationItem.prototype.triggerRenderFrameError = function (nativeError) {
47892
47893                var error = new BMRenderFrameErrorEvent(nativeError, this.currentFrame);
47894                this.triggerEvent('error', error);
47895
47896                if (this.onError) {
47897                    this.onError.call(this, error);
47898                }
47899            }
47900
47901            AnimationItem.prototype.triggerConfigError = function (nativeError) {
47902
47903                var error = new BMConfigErrorEvent(nativeError, this.currentFrame);
47904                this.triggerEvent('error', error);
47905
47906                if (this.onError) {
47907                    this.onError.call(this, error);
47908                }
47909            }
47910            var Expressions = (function () {
47911                var ob = {};
47912                ob.initExpressions = initExpressions;
47913
47914
47915                function initExpressions(animation) {
47916
47917                    var stackCount = 0;
47918                    var registers = [];
47919
47920                    function pushExpression() {
47921                        stackCount += 1;
47922                    }
47923
47924                    function popExpression() {
47925                        stackCount -= 1;
47926                        if (stackCount === 0) {
47927                            releaseInstances();
47928                        }
47929                    }
47930
47931                    function registerExpressionProperty(expression) {
47932                        if (registers.indexOf(expression) === -1) {
47933                            registers.push(expression)
47934                        }
47935                    }
47936
47937                    function releaseInstances() {
47938                        var i, len = registers.length;
47939                        for (i = 0; i < len; i += 1) {
47940                            registers[i].release();
47941                        }
47942                        registers.length = 0;
47943                    }
47944
47945                    animation.renderer.compInterface = CompExpressionInterface(animation.renderer);
47946                    animation.renderer.globalData.projectInterface.registerComposition(animation.renderer);
47947                    animation.renderer.globalData.pushExpression = pushExpression;
47948                    animation.renderer.globalData.popExpression = popExpression;
47949                    animation.renderer.globalData.registerExpressionProperty = registerExpressionProperty;
47950                }
47951
47952                return ob;
47953            }());
47954
47955            expressionsPlugin = Expressions;
47956
47957            var ExpressionManager = (function () {
47958                'use strict';
47959                var ob = {};
47960                var Math = BMMath;
47961                var window = null;
47962                var document = null;
47963
47964                function $bm_isInstanceOfArray(arr) {
47965                    return arr.constructor === Array || arr.constructor === Float32Array;
47966                }
47967
47968                function isNumerable(tOfV, v) {
47969                    return tOfV === 'number' || tOfV === 'boolean' || tOfV === 'string' || v instanceof Number;
47970                }
47971
47972                function $bm_neg(a) {
47973                    var tOfA = typeof a;
47974                    if (tOfA === 'number' || tOfA === 'boolean' || a instanceof Number) {
47975                        return -a;
47976                    }
47977                    if ($bm_isInstanceOfArray(a)) {
47978                        var i, lenA = a.length;
47979                        var retArr = [];
47980                        for (i = 0; i < lenA; i += 1) {
47981                            retArr[i] = -a[i];
47982                        }
47983                        return retArr;
47984                    }
47985                    if (a.propType) {
47986                        return a.v;
47987                    }
47988                }
47989
47990                var easeInBez = BezierFactory.getBezierEasing(0.333, 0, .833, .833, 'easeIn').get;
47991                var easeOutBez = BezierFactory.getBezierEasing(0.167, 0.167, .667, 1, 'easeOut').get;
47992                var easeInOutBez = BezierFactory.getBezierEasing(.33, 0, .667, 1, 'easeInOut').get;
47993
47994                function sum(a, b) {
47995                    var tOfA = typeof a;
47996                    var tOfB = typeof b;
47997                    if (tOfA === 'string' || tOfB === 'string') {
47998                        return a + b;
47999                    }
48000                    if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {
48001                        return a + b;
48002                    }
48003                    if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {
48004                        a = a.slice(0);
48005                        a[0] = a[0] + b;
48006                        return a;
48007                    }
48008                    if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {
48009                        b = b.slice(0);
48010                        b[0] = a + b[0];
48011                        return b;
48012                    }
48013                    if ($bm_isInstanceOfArray(a) && $bm_isInstanceOfArray(b)) {
48014
48015                        var i = 0, lenA = a.length, lenB = b.length;
48016                        var retArr = [];
48017                        while (i < lenA || i < lenB) {
48018                            if ((typeof a[i] === 'number' || a[i] instanceof Number) && (typeof b[i] === 'number' || b[i] instanceof Number)) {
48019                                retArr[i] = a[i] + b[i];
48020                            } else {
48021                                retArr[i] = b[i] === undefined ? a[i] : a[i] || b[i];
48022                            }
48023                            i += 1;
48024                        }
48025                        return retArr;
48026                    }
48027                    return 0;
48028                }
48029
48030                var add = sum;
48031
48032                function sub(a, b) {
48033                    var tOfA = typeof a;
48034                    var tOfB = typeof b;
48035                    if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {
48036                        if (tOfA === 'string') {
48037                            a = parseInt(a);
48038                        }
48039                        if (tOfB === 'string') {
48040                            b = parseInt(b);
48041                        }
48042                        return a - b;
48043                    }
48044                    if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {
48045                        a = a.slice(0);
48046                        a[0] = a[0] - b;
48047                        return a;
48048                    }
48049                    if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {
48050                        b = b.slice(0);
48051                        b[0] = a - b[0];
48052                        return b;
48053                    }
48054                    if ($bm_isInstanceOfArray(a) && $bm_isInstanceOfArray(b)) {
48055                        var i = 0, lenA = a.length, lenB = b.length;
48056                        var retArr = [];
48057                        while (i < lenA || i < lenB) {
48058                            if ((typeof a[i] === 'number' || a[i] instanceof Number) && (typeof b[i] === 'number' || b[i] instanceof Number)) {
48059                                retArr[i] = a[i] - b[i];
48060                            } else {
48061                                retArr[i] = b[i] === undefined ? a[i] : a[i] || b[i];
48062                            }
48063                            i += 1;
48064                        }
48065                        return retArr;
48066                    }
48067                    return 0;
48068                }
48069
48070                function mul(a, b) {
48071                    var tOfA = typeof a;
48072                    var tOfB = typeof b;
48073                    var arr;
48074                    if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {
48075                        return a * b;
48076                    }
48077
48078                    var i, len;
48079                    if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {
48080                        len = a.length;
48081                        arr = createTypedArray('float32', len);
48082                        for (i = 0; i < len; i += 1) {
48083                            arr[i] = a[i] * b;
48084                        }
48085                        return arr;
48086                    }
48087                    if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {
48088                        len = b.length;
48089                        arr = createTypedArray('float32', len);
48090                        for (i = 0; i < len; i += 1) {
48091                            arr[i] = a * b[i];
48092                        }
48093                        return arr;
48094                    }
48095                    return 0;
48096                }
48097
48098                function div(a, b) {
48099                    var tOfA = typeof a;
48100                    var tOfB = typeof b;
48101                    var arr;
48102                    if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {
48103                        return a / b;
48104                    }
48105                    var i, len;
48106                    if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {
48107                        len = a.length;
48108                        arr = createTypedArray('float32', len);
48109                        for (i = 0; i < len; i += 1) {
48110                            arr[i] = a[i] / b;
48111                        }
48112                        return arr;
48113                    }
48114                    if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {
48115                        len = b.length;
48116                        arr = createTypedArray('float32', len);
48117                        for (i = 0; i < len; i += 1) {
48118                            arr[i] = a / b[i];
48119                        }
48120                        return arr;
48121                    }
48122                    return 0;
48123                }
48124
48125                function mod(a, b) {
48126                    if (typeof a === 'string') {
48127                        a = parseInt(a);
48128                    }
48129                    if (typeof b === 'string') {
48130                        b = parseInt(b);
48131                    }
48132                    return a % b;
48133                }
48134
48135                var $bm_sum = sum;
48136                var $bm_sub = sub;
48137                var $bm_mul = mul;
48138                var $bm_div = div;
48139                var $bm_mod = mod;
48140
48141                function clamp(num, min, max) {
48142                    if (min > max) {
48143                        var mm = max;
48144                        max = min;
48145                        min = mm;
48146                    }
48147                    return Math.min(Math.max(num, min), max);
48148                }
48149
48150                function radiansToDegrees(val) {
48151                    return val / degToRads;
48152                }
48153
48154                var radians_to_degrees = radiansToDegrees;
48155
48156                function degreesToRadians(val) {
48157                    return val * degToRads;
48158                }
48159
48160                var degrees_to_radians = radiansToDegrees;
48161
48162                var helperLengthArray = [0, 0, 0, 0, 0, 0];
48163
48164                function length(arr1, arr2) {
48165                    if (typeof arr1 === 'number' || arr1 instanceof Number) {
48166                        arr2 = arr2 || 0;
48167                        return Math.abs(arr1 - arr2);
48168                    }
48169                    if (!arr2) {
48170                        arr2 = helperLengthArray;
48171                    }
48172                    var i, len = Math.min(arr1.length, arr2.length);
48173                    var addedLength = 0;
48174                    for (i = 0; i < len; i += 1) {
48175                        addedLength += Math.pow(arr2[i] - arr1[i], 2);
48176                    }
48177                    return Math.sqrt(addedLength);
48178                }
48179
48180                function normalize(vec) {
48181                    return div(vec, length(vec));
48182                }
48183
48184                function rgbToHsl(val) {
48185                    var r = val[0];
48186                    var g = val[1];
48187                    var b = val[2];
48188                    var max = Math.max(r, g, b), min = Math.min(r, g, b);
48189                    var h, s, l = (max + min) / 2;
48190
48191                    if (max == min) {
48192                        h = s = 0; // achromatic
48193                    } else {
48194                        var d = max - min;
48195                        s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
48196                        switch (max) {
48197                            case r:
48198                                h = (g - b) / d + (g < b ? 6 : 0);
48199                                break;
48200                            case g:
48201                                h = (b - r) / d + 2;
48202                                break;
48203                            case b:
48204                                h = (r - g) / d + 4;
48205                                break;
48206                        }
48207                        h /= 6;
48208                    }
48209
48210                    return [h, s, l, val[3]];
48211                }
48212
48213                function hue2rgb(p, q, t) {
48214                    if (t < 0) t += 1;
48215                    if (t > 1) t -= 1;
48216                    if (t < 1 / 6) return p + (q - p) * 6 * t;
48217                    if (t < 1 / 2) return q;
48218                    if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
48219                    return p;
48220                }
48221
48222                function hslToRgb(val) {
48223                    var h = val[0];
48224                    var s = val[1];
48225                    var l = val[2];
48226
48227                    var r, g, b;
48228
48229                    if (s === 0) {
48230                        r = g = b = l; // achromatic
48231                    } else {
48232
48233                        var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
48234                        var p = 2 * l - q;
48235                        r = hue2rgb(p, q, h + 1 / 3);
48236                        g = hue2rgb(p, q, h);
48237                        b = hue2rgb(p, q, h - 1 / 3);
48238                    }
48239
48240                    return [r, g, b, val[3]];
48241                }
48242
48243                function linear(t, tMin, tMax, value1, value2) {
48244                    if (value1 === undefined || value2 === undefined) {
48245                        value1 = tMin;
48246                        value2 = tMax;
48247                        tMin = 0;
48248                        tMax = 1;
48249                    }
48250                    if (tMax < tMin) {
48251                        var _tMin = tMax;
48252                        tMax = tMin;
48253                        tMin = _tMin;
48254                    }
48255                    if (t <= tMin) {
48256                        return value1;
48257                    } else if (t >= tMax) {
48258                        return value2;
48259                    }
48260                    var perc = tMax === tMin ? 0 : (t - tMin) / (tMax - tMin);
48261                    if (!value1.length) {
48262                        return value1 + (value2 - value1) * perc;
48263                    }
48264                    var i, len = value1.length;
48265                    var arr = createTypedArray('float32', len);
48266                    for (i = 0; i < len; i += 1) {
48267                        arr[i] = value1[i] + (value2[i] - value1[i]) * perc;
48268                    }
48269                    return arr;
48270                }
48271
48272                function random(min, max) {
48273                    if (max === undefined) {
48274                        if (min === undefined) {
48275                            min = 0;
48276                            max = 1;
48277                        } else {
48278                            max = min;
48279                            min = undefined;
48280                        }
48281                    }
48282                    if (max.length) {
48283                        var i, len = max.length;
48284                        if (!min) {
48285                            min = createTypedArray('float32', len);
48286                        }
48287                        var arr = createTypedArray('float32', len);
48288                        var rnd = BMMath.random();
48289                        for (i = 0; i < len; i += 1) {
48290                            arr[i] = min[i] + rnd * (max[i] - min[i]);
48291                        }
48292                        return arr;
48293                    }
48294                    if (min === undefined) {
48295                        min = 0;
48296                    }
48297                    var rndm = BMMath.random();
48298                    return min + rndm * (max - min);
48299                }
48300
48301                function createPath(points, inTangents, outTangents, closed) {
48302                    var i, len = points.length;
48303                    var path = shape_pool.newElement();
48304                    path.setPathData(!!closed, len);
48305                    var arrPlaceholder = [0, 0], inVertexPoint, outVertexPoint;
48306                    for (i = 0; i < len; i += 1) {
48307                        inVertexPoint = (inTangents && inTangents[i]) ? inTangents[i] : arrPlaceholder;
48308                        outVertexPoint = (outTangents
48308 && outTangents[i]) ? outTangents[i] : arrPlaceholder;
48309                        path.setTripleAt(points[i][0], points[i][1], outVertexPoint[0] + points[i][0], outVertexPoint[1] + points[i][1], inVertexPoint[0] + points[i][0], inVertexPoint[1] + points[i][1], i, true);
48310                    }
48311                    return path;
48312                }
48313
48314                function initiateExpression(elem, data, property) {
48315                    var val = data.x;
48316                    var needsVelocity = /velocity(?![\w\d])/.test(val);
48317                    var _needsRandom = val.indexOf('random') !== -1;
48318                    var elemType = elem.data.ty;
48319                    var transform, $bm_transform, content, effect;
48320                    var thisProperty = property;
48321                    thisProperty.valueAtTime = thisProperty.getValueAtTime;
48322                    Object.defineProperty(thisProperty, 'value', {
48323                        get: function () {
48324                            return thisProperty.v
48325                        }
48326                    })
48327                    elem.comp.frameDuration = 1 / elem.comp.globalData.frameRate;
48328                    elem.comp.displayStartTime = 0;
48329                    var inPoint = elem.data.ip / elem.comp.globalData.frameRate;
48330                    var outPoint = elem.data.op / elem.comp.globalData.frameRate;
48331                    var width = elem.data.sw ? elem.data.sw : 0;
48332                    var height = elem.data.sh ? elem.data.sh : 0;
48333                    var name = elem.data.nm;
48334                    var loopIn, loop_in, loopOut, loop_out, smooth;
48335                    var toWorld, fromWorld, fromComp, toComp, fromCompToSurface, position, rotation, anchorPoint, scale,
48336                        thisLayer, thisComp, mask, valueAtTime, velocityAtTime;
48337                    var __expression_functions = [];
48338                    if (data.xf) {
48339                        var i, len = data.xf.length;
48340                        for (i = 0; i < len; i += 1) {
48341                            __expression_functions[i] = eval('(function(){ return ' + data.xf[i] + '}())');
48342                        }
48343                    }
48344
48345                    var scoped_bm_rt;
48346                    var expression_function = eval('[function _expression_function(){' + val + ';scoped_bm_rt=$bm_rt}' + ']')[0];
48347                    var numKeys = property.kf ? data.k.length : 0;
48348
48349                    var active = !this.data || this.data.hd !== true;
48350
48351                    var wiggle = function wiggle(freq, amp) {
48352                        var i, j, len = this.pv.length ? this.pv.length : 1;
vendor: 21,662 bytes, lines 48353-48801
48353                        var addedAmps = createTypedArray('float32', len);
48354                        freq = 5;
48355                        var iterations = Math.floor(time * freq);
48356                        i = 0;
48357                        j = 0;
48358                        while (i < iterations) {
48359                            //var rnd = BMMath.random();
48360                            for (j = 0; j < len; j += 1) {
48361                                addedAmps[j] += -amp + amp * 2 * BMMath.random();
48362                                //addedAmps[j] += -amp + amp*2*rnd;
48363                            }
48364                            i += 1;
48365                        }
48366                        //var rnd2 = BMMath.random();
48367                        var periods = time * freq;
48368                        var perc = periods - Math.floor(periods);
48369                        var arr = createTypedArray('float32', len);
48370                        if (len > 1) {
48371                            for (j = 0; j < len; j += 1) {
48372                                arr[j] = this.pv[j] + addedAmps[j] + (-amp + amp * 2 * BMMath.random()) * perc;
48373                                //arr[j] = this.pv[j] + addedAmps[j] + (-amp + amp*2*rnd)*perc;
48374                                //arr[i] = this.pv[i] + addedAmp + amp1*perc + amp2*(1-perc);
48375                            }
48376                            return arr;
48377                        } else {
48378                            return this.pv + addedAmps[0] + (-amp + amp * 2 * BMMath.random()) * perc;
48379                        }
48380                    }.bind(this);
48381
48382                    if (thisProperty.loopIn) {
48383                        loopIn = thisProperty.loopIn.bind(thisProperty);
48384                        loop_in = loopIn;
48385                    }
48386
48387                    if (thisProperty.loopOut) {
48388                        loopOut = thisProperty.loopOut.bind(thisProperty);
48389                        loop_out = loopOut;
48390                    }
48391
48392                    if (thisProperty.smooth) {
48393                        smooth = thisProperty.smooth.bind(thisProperty);
48394                    }
48395
48396                    function loopInDuration(type, duration) {
48397                        return loopIn(type, duration, true);
48398                    }
48399
48400                    function loopOutDuration(type, duration) {
48401                        return loopOut(type, duration, true);
48402                    }
48403
48404                    if (this.getValueAtTime) {
48405                        valueAtTime = this.getValueAtTime.bind(this);
48406                    }
48407
48408                    if (this.getVelocityAtTime) {
48409                        velocityAtTime = this.getVelocityAtTime.bind(this);
48410                    }
48411
48412                    var comp = elem.comp.globalData.projectInterface.bind(elem.comp.globalData.projectInterface);
48413
48414                    function lookAt(elem1, elem2) {
48415                        var fVec = [elem2[0] - elem1[0], elem2[1] - elem1[1], elem2[2] - elem1[2]];
48416                        var pitch = Math.atan2(fVec[0], Math.sqrt(fVec[1] * fVec[1] + fVec[2] * fVec[2])) / degToRads;
48417                        var yaw = -Math.atan2(fVec[1], fVec[2]) / degToRads;
48418                        return [yaw, pitch, 0];
48419                    }
48420
48421                    function easeOut(t, tMin, tMax, val1, val2) {
48422                        return applyEase(easeOutBez, t, tMin, tMax, val1, val2);
48423                    }
48424
48425                    function easeIn(t, tMin, tMax, val1, val2) {
48426                        return applyEase(easeInBez, t, tMin, tMax, val1, val2);
48427                    }
48428
48429                    function ease(t, tMin, tMax, val1, val2) {
48430                        return applyEase(easeInOutBez, t, tMin, tMax, val1, val2);
48431                    }
48432
48433                    function applyEase(fn, t, tMin, tMax, val1, val2) {
48434                        if (val1 === undefined) {
48435                            val1 = tMin;
48436                            val2 = tMax;
48437                        } else {
48438                            t = (t - tMin) / (tMax - tMin);
48439                        }
48440                        t = t > 1 ? 1 : t < 0 ? 0 : t;
48441                        var mult = fn(t);
48442                        if ($bm_isInstanceOfArray(val1)) {
48443                            var i, len = val1.length;
48444                            var arr = createTypedArray('float32', len);
48445                            for (i = 0; i < len; i += 1) {
48446                                arr[i] = (val2[i] - val1[i]) * mult + val1[i];
48447                            }
48448                            return arr;
48449                        } else {
48450                            return (val2 - val1) * mult + val1;
48451                        }
48452                    }
48453
48454                    function nearestKey(time) {
48455                        var i, len = data.k.length, index, keyTime;
48456                        if (!data.k.length || typeof (data.k[0]) === 'number') {
48457                            index = 0;
48458                            keyTime = 0;
48459                        } else {
48460                            index = -1;
48461                            time *= elem.comp.globalData.frameRate;
48462                            if (time < data.k[0].t) {
48463                                index = 1;
48464                                keyTime = data.k[0].t;
48465                            } else {
48466                                for (i = 0; i < len - 1; i += 1) {
48467                                    if (time === data.k[i].t) {
48468                                        index = i + 1;
48469                                        keyTime = data.k[i].t;
48470                                        break;
48471                                    } else if (time > data.k[i].t && time < data.k[i + 1].t) {
48472                                        if (time - data.k[i].t > data.k[i + 1].t - time) {
48473                                            index = i + 2;
48474                                            keyTime = data.k[i + 1].t;
48475                                        } else {
48476                                            index = i + 1;
48477                                            keyTime = data.k[i].t;
48478                                        }
48479                                        break;
48480                                    }
48481                                }
48482                                if (index === -1) {
48483                                    index = i + 1;
48484                                    keyTime = data.k[i].t;
48485                                }
48486                            }
48487
48488                        }
48489                        var ob = {};
48490                        ob.index = index;
48491                        ob.time = keyTime / elem.comp.globalData.frameRate;
48492                        return ob;
48493                    }
48494
48495                    function key(ind) {
48496                        var ob, i, len;
48497                        if (!data.k.length || typeof (data.k[0]) === 'number') {
48498                            throw new Error('The property has no keyframe at index ' + ind);
48499                        }
48500                        ind -= 1;
48501                        ob = {
48502                            time: data.k[ind].t / elem.comp.globalData.frameRate,
48503                            value: []
48504                        };
48505                        var arr = data.k[ind].hasOwnProperty('s') ? data.k[ind].s : data.k[ind - 1].e;
48506
48507                        len = arr.length;
48508                        for (i = 0; i < len; i += 1) {
48509                            ob[i] = arr[i];
48510                            ob.value[i] = arr[i]
48511                        }
48512                        return ob;
48513                    }
48514
48515                    function framesToTime(frames, fps) {
48516                        if (!fps) {
48517                            fps = elem.comp.globalData.frameRate;
48518                        }
48519                        return frames / fps;
48520                    }
48521
48522                    function timeToFrames(t, fps) {
48523                        if (!t && t !== 0) {
48524                            t = time;
48525                        }
48526                        if (!fps) {
48527                            fps = elem.comp.globalData.frameRate;
48528                        }
48529                        return t * fps;
48530                    }
48531
48532                    function seedRandom(seed) {
48533                        BMMath.seedrandom(randSeed + seed);
48534                    }
48535
48536                    function sourceRectAtTime() {
48537                        return elem.sourceRectAtTime();
48538                    }
48539
48540                    function substring(init, end) {
48541                        if (typeof value === 'string') {
48542                            if (end === undefined) {
48543                                return value.substring(init)
48544                            }
48545                            return value.substring(init, end)
48546                        }
48547                        return '';
48548                    }
48549
48550                    function substr(init, end) {
48551                        if (typeof value === 'string') {
48552                            if (end === undefined) {
48553                                return value.substr(init)
48554                            }
48555                            return value.substr(init, end)
48556                        }
48557                        return '';
48558                    }
48559
48560                    function posterizeTime(framesPerSecond) {
48561                        time = framesPerSecond === 0 ? 0 : Math.floor(time * framesPerSecond) / framesPerSecond
48562                        value = valueAtTime(time)
48563                    }
48564
48565                    var time, velocity, value, text, textIndex, textTotal, selectorValue;
48566                    var index = elem.data.ind;
48567                    var hasParent = !!(elem.hierarchy && elem.hierarchy.length);
48568                    var parent;
48569                    var randSeed = Math.floor(Math.random() * 1000000);
48570                    var globalData = elem.globalData;
48571
48572                    function executeExpression(_value) {
48573                        // globalData.pushExpression();
48574                        value = _value;
48575                        if (_needsRandom) {
48576                            seedRandom(randSeed);
48577                        }
48578                        if (this.frameExpressionId === elem.globalData.frameId && this.propType !== 'textSelector') {
48579                            return value;
48580                        }
48581                        if (this.propType === 'textSelector') {
48582                            textIndex = this.textIndex;
48583                            textTotal = this.textTotal;
48584                            selectorValue = this.selectorValue;
48585                        }
48586                        if (!thisLayer) {
48587                            text = elem.layerInterface.text;
48588                            thisLayer = elem.layerInterface;
48589                            thisComp = elem.comp.compInterface;
48590                            toWorld = thisLayer.toWorld.bind(thisLayer);
48591                            fromWorld = thisLayer.fromWorld.bind(thisLayer);
48592                            fromComp = thisLayer.fromComp.bind(thisLayer);
48593                            toComp = thisLayer.toComp.bind(thisLayer);
48594                            mask = thisLayer.mask ? thisLayer.mask.bind(thisLayer) : null;
48595                            fromCompToSurface = fromComp;
48596                        }
48597                        if (!transform) {
48598                            transform = elem.layerInterface("ADBE Transform Group");
48599                            $bm_transform = transform;
48600                            if (transform) {
48601                                anchorPoint = transform.anchorPoint;
48602                                /*position = transform.position;
48603                    rotation = transform.rotation;
48604                    scale = transform.scale;*/
48605                            }
48606                        }
48607
48608                        if (elemType === 4 && !content) {
48609                            content = thisLayer("ADBE Root Vectors Group");
48610                        }
48611                        if (!effect) {
48612                            effect = thisLayer(4);
48613                        }
48614                        hasParent = !!(elem.hierarchy && elem.hierarchy.length);
48615                        if (hasParent && !parent) {
48616                            parent = elem.hierarchy[0].layerInterface;
48617                        }
48618                        time = this.comp.renderedFrame / this.comp.globalData.frameRate;
48619                        if (needsVelocity) {
48620                            velocity = velocityAtTime(time);
48621                        }
48622                        expression_function();
48623                        this.frameExpressionId = elem.globalData.frameId;
48624
48625                        //TODO: Check if it's possible to return on ShapeInterface the .v value
48626                        if (scoped_bm_rt.propType === "shape") {
48627                            scoped_bm_rt = scoped_bm_rt.v;
48628                        }
48629                        // globalData.popExpression();
48630                        return scoped_bm_rt;
48631                    }
48632
48633                    return executeExpression;
48634                }
48635
48636                ob.initiateExpression = initiateExpression;
48637                return ob;
48638            }());
48639            var expressionHelpers = (function () {
48640
48641                function searchExpressions(elem, data, prop) {
48642                    if (data.x) {
48643                        prop.k = true;
48644                        prop.x = true;
48645                        prop.initiateExpression = ExpressionManager.initiateExpression;
48646                        prop.effectsSequence.push(prop.initiateExpression(elem, data, prop).bind(prop));
48647                    }
48648                }
48649
48650                function getValueAtTime(frameNum) {
48651                    frameNum *= this.elem.globalData.frameRate;
48652                    frameNum -= this.offsetTime;
48653                    if (frameNum !== this._cachingAtTime.lastFrame) {
48654                        this._cachingAtTime.lastIndex = this._cachingAtTime.lastFrame < frameNum ? this._cachingAtTime.lastIndex : 0;
48655                        this._cachingAtTime.value = this.interpolateValue(frameNum, this._cachingAtTime);
48656                        this._cachingAtTime.lastFrame = frameNum;
48657                    }
48658                    return this._cachingAtTime.value;
48659
48660                }
48661
48662                function getSpeedAtTime(frameNum) {
48663                    var delta = -0.01;
48664                    var v1 = this.getValueAtTime(frameNum);
48665                    var v2 = this.getValueAtTime(frameNum + delta);
48666                    var speed = 0;
48667                    if (v1.length) {
48668                        var i;
48669                        for (i = 0; i < v1.length; i += 1) {
48670                            speed += Math.pow(v2[i] - v1[i], 2);
48671                        }
48672                        speed = Math.sqrt(speed) * 100;
48673                    } else {
48674                        speed = 0;
48675                    }
48676                    return speed;
48677                }
48678
48679                function getVelocityAtTime(frameNum) {
48680                    if (this.vel !== undefined) {
48681                        return this.vel;
48682                    }
48683                    var delta = -0.001;
48684                    //frameNum += this.elem.data.st;
48685                    var v1 = this.getValueAtTime(frameNum);
48686                    var v2 = this.getValueAtTime(frameNum + delta);
48687                    var velocity;
48688                    if (v1.length) {
48689                        velocity = createTypedArray('float32', v1.length);
48690                        var i;
48691                        for (i = 0; i < v1.length; i += 1) {
48692                            //removing frameRate
48693                            //if needed, don't add it here
48694                            //velocity[i] = this.elem.globalData.frameRate*((v2[i] - v1[i])/delta);
48695                            velocity[i] = (v2[i] - v1[i]) / delta;
48696                        }
48697                    } else {
48698                        velocity = (v2 - v1) / delta;
48699                    }
48700                    return velocity;
48701                }
48702
48703                function getStaticValueAtTime() {
48704                    return this.pv;
48705                }
48706
48707                function setGroupProperty(propertyGroup) {
48708                    this.propertyGroup = propertyGroup;
48709                }
48710
48711                return {
48712                    searchExpressions: searchExpressions,
48713                    getSpeedAtTime: getSpeedAtTime,
48714                    getVelocityAtTime: getVelocityAtTime,
48715                    getValueAtTime: getValueAtTime,
48716                    getStaticValueAtTime: getStaticValueAtTime,
48717                    setGroupProperty: setGroupProperty,
48718                }
48719            }());
48720            (function addPropertyDecorator() {
48721
48722                function loopOut(type, duration, durationFlag) {
48723                    if (!this.k || !this.keyframes) {
48724                        return this.pv;
48725                    }
48726                    type = type ? type.toLowerCase() : '';
48727                    var currentFrame = this.comp.renderedFrame;
48728                    var keyframes = this.keyframes;
48729                    var lastKeyFrame = keyframes[keyframes.length - 1].t;
48730                    if (currentFrame <= lastKeyFrame) {
48731                        return this.pv;
48732                    } else {
48733                        var cycleDuration, firstKeyFrame;
48734                        if (!durationFlag) {
48735                            if (!duration || duration > keyframes.length - 1) {
48736                                duration = keyframes.length - 1;
48737                            }
48738                            firstKeyFrame = keyframes[keyframes.length - 1 - duration].t;
48739                            cycleDuration = lastKeyFrame - firstKeyFrame;
48740                        } else {
48741                            if (!duration) {
48742                                cycleDuration = Math.max(0, lastKeyFrame - this.elem.data.ip);
48743                            } else {
48744                                cycleDuration = Math.abs(lastKeyFrame - elem.comp.globalData.frameRate * duration);
48745                            }
48746                            firstKeyFrame = lastKeyFrame - cycleDuration;
48747                        }
48748                        var i, len, ret;
48749                        if (type === 'pingpong') {
48750                            var iterations = Math.floor((currentFrame - firstKeyFrame) / cycleDuration);
48751                            if (iterations % 2 !== 0) {
48752                                return this.getValueAtTime(((cycleDuration - (currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0);
48753                            }
48754                        } else if (type === 'offset') {
48755                            var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);
48756                            var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);
48757                            var current = this.getValueAtTime(((currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0);
48758                            var repeats = Math.floor((currentFrame - firstKeyFrame) / cycleDuration);
48759                            if (this.pv.length) {
48760                                ret = new Array(initV.length);
48761                                len = ret.length;
48762                                for (i = 0; i < len; i += 1) {
48763                                    ret[i] = (endV[i] - initV[i]) * repeats + current[i];
48764                                }
48765                                return ret;
48766                            }
48767                            return (endV - initV) * repeats + current;
48768                        } else if (type === 'continue') {
48769                            var lastValue = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);
48770                            var nextLastValue = this.getValueAtTime((lastKeyFrame - 0.001) / this.comp.globalData.frameRate, 0);
48771                            if (this.pv.length) {
48772                                ret = new Array(lastValue.length);
48773                                len = ret.length;
48774                                for (i = 0; i < len; i += 1) {
48775                                    ret[i] = lastValue[i] + (lastValue[i] - nextLastValue[i]) * ((currentFrame - lastKeyFrame) / this.comp.globalData.frameRate) / 0.0005;
48776                                }
48777                                return ret;
48778                            }
48779                            return lastValue + (lastValue - nextLastValue) * (((currentFrame - lastKeyFrame)) / 0.001);
48780                        }
48781                        return this.getValueAtTime((((currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0);
48782                    }
48783                }
48784
48785                function loopIn(type, duration, durationFlag) {
48786                    if (!this.k) {
48787                        return this.pv;
48788                    }
48789                    type = type ? type.toLowerCase() : '';
48790                    var currentFrame = this.comp.renderedFrame;
48791                    var keyframes = this.keyframes;
48792                    var firstKeyFrame = keyframes[0].t;
48793                    if (currentFrame >= firstKeyFrame) {
48794                        return this.pv;
48795                    } else {
48796                        var cycleDuration, lastKeyFrame;
48797                        if (!durationFlag) {
48798                            if (!duration || duration > keyframes.length - 1) {
48799                                duration = keyframes.length - 1;
48800                            }
48801                            lastKeyFrame = keyframes[duration].t;
vendor: 4,752 bytes, lines 48802-48881
48802                            cycleDuration = lastKeyFrame - firstKeyFrame;
48803                        } else {
48804                            if (!duration) {
48805                                cycleDuration = Math.max(0, this.elem.data.op - firstKeyFrame);
48806                            } else {
48807                                cycleDuration = Math.abs(elem.comp.globalData.frameRate * duration);
48808                            }
48809                            lastKeyFrame = firstKeyFrame + cycleDuration;
48810                        }
48811                        var i, len, ret;
48812                        if (type === 'pingpong') {
48813                            var iterations = Math.floor((firstKeyFrame - currentFrame) / cycleDuration);
48814                            if (iterations % 2 === 0) {
48815                                return this.getValueAtTime((((firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0);
48816                            }
48817                        } else if (type === 'offset') {
48818                            var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);
48819                            var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);
48820                            var current = this.getValueAtTime((cycleDuration - (firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0);
48821                            var repeats = Math.floor((firstKeyFrame - currentFrame) / cycleDuration) + 1;
48822                            if (this.pv.length) {
48823                                ret = new Array(initV.length);
48824                                len = ret.length;
48825                                for (i = 0; i < len; i += 1) {
48826                                    ret[i] = current[i] - (endV[i] - initV[i]) * repeats;
48827                                }
48828                                return ret;
48829                            }
48830                            return current - (endV - initV) * repeats;
48831                        } else if (type === 'continue') {
48832                            var firstValue = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);
48833                            var nextFirstValue = this.getValueAtTime((firstKeyFrame + 0.001) / this.comp.globalData.frameRate, 0);
48834                            if (this.pv.length) {
48835                                ret = new Array(firstValue.length);
48836                                len = ret.length;
48837                                for (i = 0; i < len; i += 1) {
48838                                    ret[i] = firstValue[i] + (firstValue[i] - nextFirstValue[i]) * (firstKeyFrame - currentFrame) / 0.001;
48839                                }
48840                                return ret;
48841                            }
48842                            return firstValue + (firstValue - nextFirstValue) * (firstKeyFrame - currentFrame) / 0.001;
48843                        }
48844                        return this.getValueAtTime(((cycleDuration - (firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0);
48845                    }
48846                }
48847
48848                function smooth(width, samples) {
48849                    if (!this.k) {
48850                        return this.pv;
48851                    }
48852                    width = (width || 0.4) * 0.5;
48853                    samples = Math.floor(samples || 5);
48854                    if (samples <= 1) {
48855                        return this.pv;
48856                    }
48857                    var currentTime = this.comp.renderedFrame / this.comp.globalData.frameRate;
48858                    var initFrame = currentTime - width;
48859                    var endFrame = currentTime + width;
48860                    var sampleFrequency = samples > 1 ? (endFrame - initFrame) / (samples - 1) : 1;
48861                    var i = 0, j = 0;
48862                    var value;
48863                    if (this.pv.length) {
48864                        value = createTypedArray('float32', this.pv.length);
48865                    } else {
48866                        value = 0;
48867                    }
48868                    var sampleValue;
48869                    while (i < samples) {
48870                        sampleValue = this.getValueAtTime(initFrame + i * sampleFrequency);
48871                        if (this.pv.length) {
48872                            for (j = 0; j < this.pv.length; j += 1) {
48873                                value[j] += sampleValue[j];
48874                            }
48875                        } else {
48876                            value += sampleValue;
48877                        }
48878                        i += 1;
48879                    }
48880                    if (this.pv.length) {
48881                        for (j = 0; j < this.pv.length; j += 1) {
48882                            value[j] /= samples;
48883                        }
48884                    } else {
48885                        value /= samples;
48886                    }
48887                    return value;
48888                }
48889
48890                function getValueAtTime(frameNum) {
48891                    frameNum *= this.elem.globalData.frameRate;
48892                    frameNum -= this.offsetTime;
48893                    if (frameNum !== this._cachingAtTime.lastFrame) {
48894                        this._cachingAtTime.lastIndex = this._cachingAtTime.lastFrame < frameNum ? this._cachingAtTime.lastIndex : 0;
48895                        this._cachingAtTime.value = this.interpolateValue(frameNum, this._cachingAtTime);
48896                        this._cachingAtTime.lastFrame = frameNum;
48897                    }
48898                    return this._cachingAtTime.value;
48899
48900                }
48901
48902                function getTransformValueAtTime(time) {
48903                    if (!this._transformCachingAtTime) {
48904                        this._transformCachingAtTime = {
48905                            v: new Matrix(),
48906                        };
48907                    }
48908                    ////
48909                    var matrix = this._transformCachingAtTime.v;
48910                    matrix.cloneFromProps(this.pre.props);
48911                    if (this.appliedTransformations < 1) {
48912                        var anchor = this.a.getValueAtTime(time);
48913                        matrix.translate(-anchor[0], -anchor[1], anchor[2]);
48914                    }
48915                    if (this.appliedTransformations < 2) {
48916                        var scale = this.s.getValueAtTime(time);
48917                        matrix.scale(scale[0], scale[1], scale[2]);
48918                    }
48919                    if (this.sk && this.appliedTransformations < 3) {
48920                        var skew = this.sk.getValueAtTime(time);
48921                        var skewAxis = this.sa.getValueAtTime(time);
48922                        matrix.skewFromAxis(-skew, skewAxis);
48923                    }
48924                    if (this.r && this.appliedTransformations < 4) {
48925                        var rotation = this.r.getValueAtTime(time);
48926                        matrix.rotate(-rotation);
48927                    } else if (!this.r && this.appliedTransformations < 4) {
48928                        var rotationZ = this.rz.getValueAtTime(time);
48929                        var rotationY = this.ry.getValueAtTime(time);
48930                        var rotationX = this.rx.getValueAtTime(time);
48931                        var orientation = this.or.getValueAtTime(time);
48932                        matrix.rotateZ(-rotationZ.v)
48933                            .rotateY(rotationY.v)
48934                            .rotateX(rotationX.v)
48935                            .rotateZ(-orientation[2])
48936                            .rotateY(orientation[1])
48937                            .rotateX(orientation[0]);
48938                    }
48939                    if (this.data.p && this.data.p.s) {
48940                        var positionX = this.px.getValueAtTime(time);
48941                        var positionY = this.py.getValueAtTime(time);
48942                        if (this.data.p.z) {
48943                            var positionZ = this.pz.getValueAtTime(time);
48944                            matrix.translate(positionX, positionY, -positionZ);
48945                        } else {
48946                            matrix.translate(positionX, positionY, 0);
48947                        }
48948                    } else {
48949                        var position = this.p.getValueAtTime(time);
48950                        matrix.translate(position[0], position[1], -position[2]);
48951                    }
48952                    return matrix;
48953                    ////
48954                }
48955
48956                function getTransformStaticValueAtTime(time) {
48957
48958                }
48959
48960                var getTransformProperty = TransformPropertyFactory.getTransformProperty;
48961                TransformPropertyFactory.getTransformProperty = function (elem, data, container) {
48962                    var prop = getTransformProperty(elem, data, container);
48963                    if (prop.dynamicProperties.length) {
48964                        prop.getValueAtTime = getTransformValueAtTime.bind(prop);
48965                    } else {
48966                        prop.getValueAtTime = getTransformStaticValueAtTime.bind(prop);
48967                    }
48968                    prop.setGroupProperty = expressionHelpers.setGroupProperty;
48969                    return prop;
48970                };
48971
48972                var propertyGetProp = PropertyFactory.getProp;
48973                PropertyFactory.getProp = function (elem, data, type, mult, container) {
48974                    var prop = propertyGetProp(elem, data, type, mult, container);
48975                    //prop.getVelocityAtTime = getVelocityAtTime;
48976                    //prop.loopOut = loopOut;
48977                    //prop.loopIn = loopIn;
vendor: 8,419 bytes, lines 48978-49133
48978                    if (prop.kf) {
48979                        prop.getValueAtTime = expressionHelpers.getValueAtTime.bind(prop);
48980                    } else {
48981                        prop.getValueAtTime = expressionHelpers.getStaticValueAtTime.bind(prop);
48982                    }
48983                    prop.setGroupProperty = expressionHelpers.setGroupProperty;
48984                    prop.loopOut = loopOut;
48985                    prop.loopIn = loopIn;
48986                    prop.smooth = smooth;
48987                    prop.getVelocityAtTime = expressionHelpers.getVelocityAtTime.bind(prop);
48988                    prop.getSpeedAtTime = expressionHelpers.getSpeedAtTime.bind(prop);
48989                    prop.numKeys = data.a === 1 ? data.k.length : 0;
48990                    prop.propertyIndex = data.ix;
48991                    var value = 0;
48992                    if (type !== 0) {
48993                        value = createTypedArray('float32', data.a === 1 ? data.k[0].s.length : data.k.length);
48994                    }
48995                    prop._cachingAtTime = {
48996                        lastFrame: initialDefaultFrame,
48997                        lastIndex: 0,
48998                        value: value
48999                    };
49000                    expressionHelpers.searchExpressions(elem, data, prop);
49001                    if (prop.k) {
49002                        container.addDynamicProperty(prop);
49003                    }
49004
49005                    return prop;
49006                };
49007
49008                function getShapeValueAtTime(frameNum) {
49009                    //For now this caching object is created only when needed instead of creating it when the shape is initialized.
49010                    if (!this._cachingAtTime) {
49011                        this._cachingAtTime = {
49012                            shapeValue: shape_pool.clone(this.pv),
49013                            lastIndex: 0,
49014                            lastTime: initialDefaultFrame
49015                        };
49016                    }
49017
49018                    frameNum *= this.elem.globalData.frameRate;
49019                    frameNum -= this.offsetTime;
49020                    if (frameNum !== this._cachingAtTime.lastTime) {
49021                        this._cachingAtTime.lastIndex = this._cachingAtTime.lastTime < frameNum ? this._caching.lastIndex : 0;
49022                        this._cachingAtTime.lastTime = frameNum;
49023                        this.interpolateShape(frameNum, this._cachingAtTime.shapeValue, this._cachingAtTime);
49024                    }
49025                    return this._cachingAtTime.shapeValue;
49026                }
49027
49028                var ShapePropertyConstructorFunction = ShapePropertyFactory.getConstructorFunction();
49029                var KeyframedShapePropertyConstructorFunction = ShapePropertyFactory.getKeyframedConstructorFunction();
49030
49031                function ShapeExpressions() {
49032                }
49033
49034                ShapeExpressions.prototype = {
49035                    vertices: function (prop, time) {
49036                        if (this.k) {
49037                            this.getValue();
49038                        }
49039                        var shapePath = this.v;
49040                        if (time !== undefined) {
49041                            shapePath = this.getValueAtTime(time, 0);
49042                        }
49043                        var i, len = shapePath._length;
49044                        var vertices = shapePath[prop];
49045                        var points = shapePath.v;
49046                        var arr = createSizedArray(len);
49047                        for (i = 0; i < len; i += 1) {
49048                            if (prop === 'i' || prop === 'o') {
49049                                arr[i] = [vertices[i][0] - points[i][0], vertices[i][1] - points[i][1]];
49050                            } else {
49051                                arr[i] = [vertices[i][0], vertices[i][1]];
49052                            }
49053
49054                        }
49055                        return arr;
49056                    },
49057                    points: function (time) {
49058                        return this.vertices('v', time);
49059                    },
49060                    inTangents: function (time) {
49061                        return this.vertices('i', time);
49062                    },
49063                    outTangents: function (time) {
49064                        return this.vertices('o', time);
49065                    },
49066                    isClosed: function () {
49067                        return this.v.c;
49068                    },
49069                    pointOnPath: function (perc, time) {
49070                        var shapePath = this.v;
49071                        if (time !== undefined) {
49072                            shapePath = this.getValueAtTime(time, 0);
49073                        }
49074                        if (!this._segmentsLength) {
49075                            this._segmentsLength = bez.getSegmentsLength(shapePath);
49076                        }
49077
49078                        var segmentsLength = this._segmentsLength;
49079                        var lengths = segmentsLength.lengths;
49080                        var lengthPos = segmentsLength.totalLength * perc;
49081                        var i = 0, len = lengths.length;
49082                        var j = 0, jLen;
49083                        var accumulatedLength = 0, pt;
49084                        while (i < len) {
49085                            if (accumulatedLength + lengths[i].addedLength > lengthPos) {
49086                                var initIndex = i;
49087                                var endIndex = (shapePath.c && i === len - 1) ? 0 : i + 1;
49088                                var segmentPerc = (lengthPos - accumulatedLength) / lengths[i].addedLength;
49089                                pt = bez.getPointInSegment(shapePath.v[initIndex], shapePath.v[endIndex], shapePath.o[initIndex], shapePath.i[endIndex], segmentPerc, lengths[i]);
49090                                break;
49091                            } else {
49092                                accumulatedLength += lengths[i].addedLength;
49093                            }
49094                            i += 1;
49095                        }
49096                        if (!pt) {
49097                            pt = shapePath.c ? [shapePath.v[0][0], shapePath.v[0][1]] : [shapePath.v[shapePath._length - 1][0], shapePath.v[shapePath._length - 1][1]];
49098                        }
49099                        return pt;
49100                    },
49101                    vectorOnPath: function (perc, time, vectorType) {
49102                        //perc doesn't use triple equality because it can be a Number object as well as a primitive.
49103                        perc = perc == 1 ? this.v.c ? 0 : 0.999 : perc;
49104                        var pt1 = this.pointOnPath(perc, time);
49105                        var pt2 = this.pointOnPath(perc + 0.001, time);
49106                        var xLength = pt2[0] - pt1[0];
49107                        var yLength = pt2[1] - pt1[1];
49108                        var magnitude = Math.sqrt(Math.pow(xLength, 2) + Math.pow(yLength, 2));
49109                        if (magnitude === 0) {
49110                            return [0, 0];
49111                        }
49112                        var unitVector = vectorType === 'tangent' ? [xLength / magnitude, yLength / magnitude] : [-yLength / magnitude, xLength / magnitude];
49113                        return unitVector;
49114                    },
49115                    tangentOnPath: function (perc, time) {
49116                        return this.vectorOnPath(perc, time, 'tangent');
49117                    },
49118                    normalOnPath: function (perc, time) {
49119                        return this.vectorOnPath(perc, time, 'normal');
49120                    },
49121                    setGroupProperty: expressionHelpers.setGroupProperty,
49122                    getValueAtTime: expressionHelpers.getStaticValueAtTime
49123                };
49124                extendPrototype([ShapeExpressions], ShapePropertyConstructorFunction);
49125                extendPrototype([ShapeExpressions], KeyframedShapePropertyConstructorFunction);
49126                KeyframedShapePropertyConstructorFunction.prototype.getValueAtTime = getShapeValueAtTime;
49127                KeyframedShapePropertyConstructorFunction.prototype.initiateExpression = ExpressionManager.initiateExpression;
49128
49129                var propertyGetShapeProp = ShapePropertyFactory.getShapeProp;
49130                ShapePropertyFactory.getShapeProp = function (elem, data, type, arr, trims) {
49131                    var prop = propertyGetShapeProp(elem, data, type, arr, trims);
49132                    prop.propertyIndex = data.ix;
49133                    prop.lock = false;
49134                    if (type === 3) {
49135                        expressionHelpers.searchExpressions(elem, data.pt, prop);
49136                    } else if (type === 4) {
49137                        expressionHelpers.searchExpressions(elem, data.ks, prop);
49138                    }
49139                    if (prop.k) {
49140                        elem.addDynamicProperty(prop);
49141                    }
49142                    return prop;
49143                };
49144            }());
49145            (function addDecorator() {
49146
49147                function searchExpressions() {
49148                    if (this.data.d.x) {
49149                        this.calculateExpression = ExpressionManager.initiateExpression.bind(this)(this.elem, this.data.d, this);
49150                        this.addEffect(this.getExpressionValue.bind(this));
49151                        return true;
49152                    }
49153                }
49154
49155                TextProperty.prototype.getExpressionValue = function (currentValue, text) {
49156                    var newValue = this.calculateExpression(text);
49157                    if (currentValue.t !== newValue) {
49158                        var newData = {};
49159                        this.copyData(newData, currentValue);
49160                        newData.t = newValue.toString();
49161                        newData.__complete = false;
49162                        return newData;
49163                    }
49164                    return currentValue;
49165                }
49166
49167                TextProperty.prototype.searchProperty = function () {
49168
49169                    var isKeyframed = this.searchKeyframes();
49170                    var hasExpressions = this.searchExpressions();
49171                    this.kf = isKeyframed || hasExpressions;
49172                    return this.kf;
49173                };
49174
49175                TextProperty.prototype.searchExpressions = searchExpressions;
49176
49177            }());
49178            var ShapePathInterface = (
49179
49180                function () {
49181
49182                    return function pathInterfaceFactory(shape, view, propertyGroup) {
49183                        var prop = view.sh;
49184
49185                        function interfaceFunction(val) {
49186                            if (val === 'Shape' || val === 'shape' || val === 'Path' || val === 'path' || val === 'ADBE Vector Shape' || val === 2) {
49187                                return interfaceFunction.path;
49188                            }
49189                        }
49190
49191                        var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);
49192                        prop.setGroupProperty(PropertyInterface('Path', _propertyGroup));
49193                        Object.defineProperties(interfaceFunction, {
49194                            'path': {
49195                                get: function () {
49196                                    if (prop.k) {
49197                                        prop.getValue();
49198                                    }
49199                                    return prop;
49200                                }
49201                            },
49202                            'shape': {
49203                                get: function () {
49204                                    if (prop.k) {
49205                                        prop.getValue();
49206                                    }
49207                                    return prop;
49208                                }
49209                            },
49210                            '_name': {value: shape.nm},
49211                            'ix': {value: shape.ix},
49212                            'propertyIndex': {value: shape.ix},
49213                            'mn': {value: shape.mn},
49214                            'propertyGroup': {value: propertyGroup},
49215                        });
49216                        return interfaceFunction;
49217                    }
49218                }()
49219            )
49220            var propertyGroupFactory = (function () {
49221                return function (interfaceFunction, parentPropertyGroup) {
49222                    return function (val) {
49223                        val = val === undefined ? 1 : val
49224                        if (val <= 0) {
49225                            return interfaceFunction;
49226                        } else {
49227                            return parentPropertyGroup(val - 1);
49228                        }
49229                    }
49230                }
49231            }())
49232            var PropertyInterface = (function () {
49233                return function (propertyName, propertyGroup) {
49234
49235                    var interfaceFunction = {
49236                        _name: propertyName
49237                    }
49238
49239                    function _propertyGroup(val) {
49240                        val = val === undefined ? 1 : val
49241                        if (val <= 0) {
49242                            return interfaceFunction;
49243                        } else {
49244                            return propertyGroup(--val);
49245                        }
49246                    }
49247
49248                    return _propertyGroup;
49249                }
49250            }())
49251            var ShapeExpressionInterface = (function () {
49252
49253                function iterateElements(shapes, view, propertyGroup) {
49254                    var arr = [];
49255                    var i, len = shapes ? shapes.length : 0;
49256                    for (i = 0; i < len; i += 1) {
49257                        if (shapes[i].ty == 'gr') {
49258                            arr.push(groupInterfaceFactory(shapes[i], view[i], propertyGroup));
49259                        } else if (shapes[i].ty == 'fl') {
49260                            arr.push(fillInterfaceFactory(shapes[i], view[i], propertyGroup));
49261                        } else if (shapes[i].ty == 'st') {
49262                            arr.push(strokeInterfaceFactory(shapes[i], view[i], propertyGroup));
49263                        } else if (shapes[i].ty == 'tm') {
49264                            arr.push(trimInterfaceFactory(shapes[i], view[i], propertyGroup));
49265                        } else if (shapes[i].ty == 'tr') {
49266                            //arr.push(transformInterfaceFactory(shapes[i],view[i],propertyGroup));
49267                        } else if (shapes[i].ty == 'el') {
49268                            arr.push(ellipseInterfaceFactory(shapes[i], view[i], propertyGroup));
49269                        } else if (shapes[i].ty == 'sr') {
49270                            arr.push(starInterfaceFactory(shapes[i], view[i], propertyGroup));
49271                        } else if (shapes[i].ty == 'sh') {
49272                            arr.push(ShapePathInterface(shapes[i], view[i], propertyGroup));
49273                        } else if (shapes[i].ty == 'rc') {
49274                            arr.push(rectInterfaceFactory(shapes[i], view[i], propertyGroup));
49275                        } else if (shapes[i].ty == 'rd') {
49276                            arr.push(roundedInterfaceFactory(shapes[i], view[i], propertyGroup));
49277                        } else if (shapes[i].ty == 'rp') {
49278                            arr.push(repeaterInterfaceFactory(shapes[i], view[i], propertyGroup));
49279                        }
49280                    }
49281                    return arr;
49282                }
49283
49284                function contentsInterfaceFactory(shape, view, propertyGroup) {
49285                    var interfaces;
49286                    var interfaceFunction = function _interfaceFunction(value) {
49287                        var i = 0, len = interfaces.length;
49288                        while (i < len) {
49289                            if (interfaces[i]._name === value || interfaces[i].mn === value || interfaces[i].propertyIndex === value || interfaces[i].ix === value || interfaces[i].ind === value) {
49290                                return interfaces[i];
49291                            }
49292                            i += 1;
49293                        }
49294                        if (typeof value === 'number') {
49295                            return interfaces[value - 1];
49296                        }
49297                    };
49298
49299                    interfaceFunction.propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);
49300                    interfaces = iterateElements(shape.it, view.it, interfaceFunction.propertyGroup);
49301                    interfaceFunction.numProperties = interfaces.length;
49302                    var transformInterface = transformInterfaceFactory(shape.it[shape.it.length - 1], view.it[view.it.length - 1], interfaceFunction.propertyGroup);
49303                    interfaceFunction.transform = transformInterface;
49304                    interfaceFunction.propertyIndex = shape.cix;
49305                    interfaceFunction._name = shape.nm;
49306
49307                    return interfaceFunction;
49308                }
49309
49310                function groupInterfaceFactory(shape, view, propertyGroup) {
49311                    var interfaceFunction = function _interfaceFunction(value) {
49312                        switch (value) {
49313                            case 'ADBE Vectors Group':
49314                            case 'Contents':
49315                            case 2:
49316                                return interfaceFunction.content;
49317                            //Not necessary for now. Keeping them here in case a new case appears
49318                            //case 'ADBE Vector Transform Group':
49319                            //case 3:
49320                            default:
49321                                return interfaceFunction.transform;
49322                        }
49323                    };
49324                    interfaceFunction.propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);
49325                    var content = contentsInterfaceFactory(shape, view, interfaceFunction.propertyGroup);
49326                    var transformInterface = transformInterfaceFactory(shape.it[shape.it.length - 1], view.it[view.it.length - 1], interfaceFunction.propertyGroup);
49327                    interfaceFunction.content = content;
49328                    interfaceFunction.transform = transformInterface;
49329                    Object.defineProperty(interfaceFunction, '_name', {
49330                        get: function () {
49331                            return shape.nm;
49332                        }
49333                    });
49334                    //interfaceFunction.content = interfaceFunction;
49335                    interfaceFunction.numProperties = shape.np;
49336                    interfaceFunction.propertyIndex = shape.ix;
49337                    interfaceFunction.nm = shape.nm;
49338                    interfaceFunction.mn = shape.mn;
49339                    return interfaceFunction;
49340                }
49341
49342                function fillInterfaceFactory(shape, view, propertyGroup) {
49343                    function interfaceFunction(val) {
49344                        if (val === 'Color' || val === 'color') {
49345                            return interfaceFunction.color;
49346                        } else if (val === 'Opacity' || val === 'opacity') {
49347                            return interfaceFunction.opacity;
49348                        }
49349                    }
49350
49351                    Object.defineProperties(interfaceFunction, {
49352                        'color': {
49353                            get: ExpressionPropertyInterface(view.c)
49354                        },
49355                        'opacity': {
49356                            get: ExpressionPropertyInterface(view.o)
49357                        },
49358                        '_name': {value: shape.nm},
49359                        'mn': {value: shape.mn}
49360                    });
49361
49362                    view.c.setGroupProperty(PropertyInterface('Color', propertyGroup));
49363                    view.o.setGroupProperty(PropertyInterface('Opacity', propertyGroup));
49364                    return interfaceFunction;
49365                }
49366
49367                function strokeInterfaceFactory(shape, view, propertyGroup) {
49368                    var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);
49369                    var _dashPropertyGroup = propertyGroupFactory(dashOb, _propertyGroup);
49370
49371                    function addPropertyToDashOb(i) {
49372                        Object.defineProperty(dashOb, shape.d[i].nm, {
49373                            get: ExpressionPropertyInterface(view.d.dataProps[i].p)
49374                        });
49375                    }
49376
49377                    var i, len = shape.d ? shape.d.length : 0;
49378                    var dashOb = {};
49379                    for (i = 0; i < len; i += 1) {
49380                        addPropertyToDashOb(i);
49381                        view.d.dataProps[i].p.setGroupProperty(_dashPropertyGroup);
49382                    }
49383
49384                    function interfaceFunction(val) {
49385                        if (val === 'Color' || val === 'color') {
49386                            return interfaceFunction.color;
49387                        } else if (val === 'Opacity' || val === 'opacity') {
49388                            return interfaceFunction.opacity;
49389                        } else if (val === 'Stroke Width' || val === 'stroke width') {
49390                            return interfaceFunction.strokeWidth;
49391                        }
49392                    }
49393
49394                    Object.defineProperties(interfaceFunction, {
49395                        'color': {
49396                            get: ExpressionPropertyInterface(view.c)
49397                        },
49398                        'opacity': {
49399                            get: ExpressionPropertyInterface(view.o)
49400                        },
49401                        'strokeWidth': {
49402                            get: ExpressionPropertyInterface(view.w)
49403                        },
49404                        'dash': {
49405                            get: function () {
49406                                return dashOb;
49407                            }
49408                        },
49409                        '_name': {value: shape.nm},
49410                        'mn': {value: shape.mn}
49411                    });
49412
49413                    view.c.setGroupProperty(PropertyInterface('Color', _propertyGroup));
49414                    view.o.setGroupProperty(PropertyInterface('Opacity', _propertyGroup));
49415                    view.w.setGroupProperty(PropertyInterface('Stroke Width', _propertyGroup));
49416                    return interfaceFunction;
49417                }
49418
49419                function trimInterfaceFactory(shape, view, propertyGroup) {
49420
49421                    function interfaceFunction(val) {
49422                        if (val === shape.e.ix || val === 'End' || val === 'end') {
49423                            return interfaceFunction.end;
49424                        }
49425                        if (val === shape.s.ix) {
49426                            return interfaceFunction.start;
49427                        }
49428                        if (val === shape.o.ix) {
49429                            return interfaceFunction.offset;
49430                        }
49431                    }
49432
49433                    var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);
49434                    interfaceFunction.propertyIndex = shape.ix;
49435
49436                    view.s.setGroupProperty(PropertyInterface('Start', _propertyGroup));
49437                    view.e.setGroupProperty(PropertyInterface('End', _propertyGroup));
49438                    view.o.setGroupProperty(PropertyInterface('Offset', _propertyGroup));
49439                    interfaceFunction.propertyIndex = shape.ix;
49440                    interfaceFunction.propertyGroup = propertyGroup;
49441
49442                    Object.defineProperties(interfaceFunction, {
49443                        'start': {
49444                            get: ExpressionPropertyInterface(view.s)
49445                        },
49446                        'end': {
49447                            get: ExpressionPropertyInterface(view.e)
49448                        },
49449                        'offset': {
49450                            get: ExpressionPropertyInterface(view.o)
49451                        },
49452                        '_name': {value: shape.nm}
49453                    });
49454                    interfaceFunction.mn = shape.mn;
49455                    return interfaceFunction;
49456                }
49457
49458                function transformInterfaceFactory(shape, view, propertyGroup) {
49459
49460                    function interfaceFunction(value) {
49461                        if (shape.a.ix === value || value === 'Anchor Point') {
49462                            return interfaceFunction.anchorPoint;
49463                        }
49464                        if (shape.o.ix === value || value === 'Opacity') {
49465                            return interfaceFunction.opacity;
49466                        }
49467                        if (shape.p.ix === value || value === 'Position') {
49468                            return interfaceFunction.position;
49469                    
49469    }
49470                        if (shape.r.ix === value || value === 'Rotation' || value === 'ADBE Vector Rotation') {
49471                            return interfaceFunction.rotation;
49472                        }
49473                        if (shape.s.ix === value || value === 'Scale') {
49474                            return interfaceFunction.scale;
49475                        }
49476                        if (shape.sk && shape.sk.ix === value || value === 'Skew') {
49477                            return interfaceFunction.skew;
49478                        }
49479                        if (shape.sa && shape.sa.ix === value || value === 'Skew Axis') {
49480                            return interfaceFunction.skewAxis;
49481                        }
49482                    }
49483
49484                    var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);
49485                    view.transform.mProps.o.setGroupProperty(PropertyInterface('Opacity', _propertyGroup));
49486                    view.transform.mProps.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));
49487                    view.transform.mProps.a.setGroupProperty(PropertyInterface('Anchor Point', _propertyGroup));
49488                    view.transform.mProps.s.setGroupProperty(PropertyInterface('Scale', _propertyGroup));
49489                    view.transform.mProps.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup));
49490                    if (view.transform.mProps.sk) {
49491                        view.transform.mProps.sk.setGroupProperty(PropertyInterface('Skew', _propertyGroup));
49492                        view.transform.mProps.sa.setGroupProperty(PropertyInterface('Skew Angle', _propertyGroup));
49493                    }
49494                    view.transform.op.setGroupProperty(PropertyInterface('Opacity', _propertyGroup));
49495                    Object.defineProperties(interfaceFunction, {
49496                        'opacity': {
49497                            get: ExpressionPropertyInterface(view.transform.mProps.o)
49498                        },
49499                        'position': {
49500                            get: ExpressionPropertyInterface(view.transform.mProps.p)
49501                        },
49502                        'anchorPoint': {
49503                            get: ExpressionPropertyInterface(view.transform.mProps.a)
49504                        },
49505                        'scale': {
49506                            get: ExpressionPropertyInterface(view.transform.mProps.s)
49507                        },
49508                        'rotation': {
49509                            get: ExpressionPropertyInterface(view.transform.mProps.r)
49510                        },
49511                        'skew': {
49512                            get: ExpressionPropertyInterface(view.transform.mProps.sk)
49513                        },
49514                        'skewAxis': {
49515                            get: ExpressionPropertyInterface(view.transform.mProps.sa)
49516                        },
49517                        '_name': {value: shape.nm}
49518                    });
49519                    interfaceFunction.ty = 'tr';
49520                    interfaceFunction.mn = shape.mn;
49521                    interfaceFunction.propertyGroup = propertyGroup;
49522                    return interfaceFunction;
49523                }
49524
49525                function ellipseInterfaceFactory(shape, view, propertyGroup) {
49526
49527                    function interfaceFunction(value) {
49528                        if (shape.p.ix === value) {
49529                            return interfaceFunction.position;
49530                        }
49531                        if (shape.s.ix === value) {
49532                            return interfaceFunction.size;
49533                        }
49534                    }
49535
49536                    var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);
49537                    interfaceFunction.propertyIndex = shape.ix;
49538                    var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;
49539                    prop.s.setGroupProperty(PropertyInterface('Size', _propertyGroup));
49540                    prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));
49541
49542                    Object.defineProperties(interfaceFunction, {
49543                        'size': {
49544                            get: ExpressionPropertyInterface(prop.s)
49545                        },
49546                        'position': {
49547                            get: ExpressionPropertyInterface(prop.p)
49548                        },
49549                        '_name': {value: shape.nm}
49550                    });
49551                    interfaceFunction.mn = shape.mn;
49552                    return interfaceFunction;
49553                }
49554
49555                function starInterfaceFactory(shape, view, propertyGroup) {
49556
49557                    function interfaceFunction(value) {
49558                        if (shape.p.ix === value) {
49559                            return interfaceFunction.position;
49560                        }
49561                        if (shape.r.ix === value) {
49562                            return interfaceFunction.rotation;
49563                        }
49564                        if (shape.pt.ix === value) {
49565                            return interfaceFunction.points;
49566                        }
49567                        if (shape.or.ix === value || 'ADBE Vector Star Outer Radius' === value) {
49568                            return interfaceFunction.outerRadius;
49569                        }
49570                        if (shape.os.ix === value) {
49571                            return interfaceFunction.outerRoundness;
49572                        }
49573                        if (shape.ir && (shape.ir.ix === value || 'ADBE Vector Star Inner Radius' === value)) {
49574                            return interfaceFunction.innerRadius;
49575                        }
49576                        if (shape.is && shape.is.ix === value) {
49577                            return interfaceFunction.innerRoundness;
49578                        }
49579
49580                    }
49581
49582                    var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);
49583                    var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;
49584                    interfaceFunction.propertyIndex = shape.ix;
49585                    prop.or.setGroupProperty(PropertyInterface('Outer Radius', _propertyGroup));
49586                    prop.os.setGroupProperty(PropertyInterface('Outer Roundness', _propertyGroup));
49587                    prop.pt.setGroupProperty(PropertyInterface('Points', _propertyGroup));
49588                    prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));
49589                    prop.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup));
49590                    if (shape.ir) {
49591                        prop.ir.setGroupProperty(PropertyInterface('Inner Radius', _propertyGroup));
49592                        prop.is.setGroupProperty(PropertyInterface('Inner Roundness', _propertyGroup));
49593                    }
49594
49595                    Object.defineProperties(interfaceFunction, {
49596                        'position': {
49597                            get: ExpressionPropertyInterface(prop.p)
49598                        },
49599                        'rotation': {
49600                            get: ExpressionPropertyInterface(prop.r)
49601                        },
49602                        'points': {
49603                            get: ExpressionPropertyInterface(prop.pt)
49604                        },
49605                        'outerRadius': {
49606                            get: ExpressionPropertyInterface(prop.or)
49607                        },
49608                        'outerRoundness': {
49609                            get: ExpressionPropertyInterface(prop.os)
49610                        },
49611                        'innerRadius': {
49612                            get: ExpressionPropertyInterface(prop.ir)
49613                        },
49614                        'innerRoundness': {
49615                            get: ExpressionPropertyInterface(prop.is)
49616                        },
49617                        '_name': {value: shape.nm}
49618                    });
49619                    interfaceFunction.mn = shape.mn;
49620                    return interfaceFunction;
49621                }
49622
49623                function rectInterfaceFactory(shape, view, propertyGroup) {
49624
49625                    function interfaceFunction(value) {
49626                        if (shape.p.ix === value) {
49627                            return interfaceFunction.position;
49628                        }
49629                        if (shape.r.ix === value) {
49630                            return interfaceFunction.roundness;
49631                        }
49632                        if (shape.s.ix === value || value === 'Size' || value === 'ADBE Vector Rect Size') {
49633                            return interfaceFunction.size;
49634                        }
49635
49636                    }
49637
49638                    var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);
49639
49640                    var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;
49641                    interfaceFunction.propertyIndex = shape.ix;
49642                    prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));
49643                    prop.s.setGroupProperty(PropertyInterface('Size', _propertyGroup));
49644                    prop.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup));
49645
49646                    Object.defineProperties(interfaceFunction, {
49647                        'position': {
49648                            get: ExpressionPropertyInterface(prop.p)
49649                        },
49650                        'roundness': {
49651                            get: ExpressionPropertyInterface(prop.r)
49652                        },
49653                        'size': {
49654                            get: ExpressionPropertyInterface(prop.s)
49655                        },
49656                        '_name': {value: shape.nm}
49657                    });
49658                    interfaceFunction.mn = shape.mn;
49659                    return interfaceFunction;
49660                }
49661
49662                function roundedInterfaceFactory(shape, view, propertyGroup) {
49663
49664                    function interfaceFunction(value) {
49665                        if (shape.r.ix === value || 'Round Corners 1' === value) {
49666                            return interfaceFunction.radius;
49667                        }
49668                    }
49669
49670                    var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);
49671                    var prop = view;
49672                    interfaceFunction.propertyIndex = shape.ix;
49673                    prop.rd.setGroupProperty(PropertyInterface('Radius', _propertyGroup));
49674
49675                    Object.defineProperties(interfaceFunction, {
49676                        'radius': {
49677                            get: ExpressionPropertyInterface(prop.rd)
49678                        },
49679                        '_name': {value: shape.nm}
49680                    });
49681                    interfaceFunction.mn = shape.mn;
49682                    return interfaceFunction;
49683                }
49684
49685                function repeaterInterfaceFactory(shape, view, propertyGroup) {
49686
49687                    function interfaceFunction(value) {
49688                        if (shape.c.ix === value || 'Copies' === value) {
49689                            return interfaceFunction.copies;
49690                        } else if (shape.o.ix === value || 'Offset' === value) {
49691                            return interfaceFunction.offset;
49692                        }
49693                    }
49694
49695                    var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);
49696                    var prop = view;
49697                    interfaceFunction.propertyIndex = shape.ix;
49698                    prop.c.setGroupProperty(PropertyInterface('Copies', _propertyGroup));
49699                    prop.o.setGroupProperty(PropertyInterface('Offset', _propertyGroup));
49700                    Object.defineProperties(interfaceFunction, {
49701                        'copies': {
49702                            get: ExpressionPropertyInterface(prop.c)
49703                        },
49704                        'offset': {
49705                            get: ExpressionPropertyInterface(prop.o)
49706                        },
49707                        '_name': {value: shape.nm}
49708                    });
49709                    interfaceFunction.mn = shape.mn;
49710                    return interfaceFunction;
49711                }
49712
49713                return function (shapes, view, propertyGroup) {
49714                    var interfaces;
49715
49716                    function _interfaceFunction(value) {
49717                        if (typeof value === 'number') {
49718                            value = value === undefined ? 1 : value
49719                            if (value === 0) {
49720                                return propertyGroup
49721                            } else {
49722                                return interfaces[value - 1];
49723                            }
49724                        } else {
49725                            var i = 0, len = interfaces.length;
49726                            while (i < len) {
49727                                if (interfaces[i]._name === value) {
49728                                    return interfaces[i];
49729                                }
49730                                i += 1;
49731                            }
49732                        }
49733                    }
49734
49735                    _interfaceFunction.propertyGroup = propertyGroup;
49736                    interfaces = iterateElements(shapes, view, _interfaceFunction);
49737                    _interfaceFunction.numProperties = interfaces.length;
49738                    return _interfaceFunction;
49739                };
49740            }());
49741
49742            var TextExpressionInterface = (function () {
49743                return function (elem) {
49744                    var _prevValue, _sourceText;
49745
49746                    function _thisLayerFunction(name) {
49747                        switch (name) {
49748                            case "ADBE Text Document":
49749                                return _thisLayerFunction.sourceText;
49750                        }
49751                    }
49752
49753                    Object.defineProperty(_thisLayerFunction, "sourceText", {
49754                        get: function () {
49755                            elem.textProperty.getValue()
49756                            var stringValue = elem.textProperty.currentData.t;
49757                            if (stringValue !== _prevValue) {
49758                                elem.textProperty.currentData.t = _prevValue;
49759                                _sourceText = new String(stringValue);
49760                                //If stringValue is an empty string, eval returns undefined, so it has to be returned as a String primitive
49761                                _sourceText.value = stringValue ? stringValue : new String(stringValue);
49762                            }
49763                            return _sourceText;
49764                        }
49765                    });
49766                    return _thisLayerFunction;
49767                };
49768            }());
49769            var LayerExpressionInterface = (function () {
49770                function toWorld(arr, time) {
49771                    var toWorldMat = new Matrix();
49772                    toWorldMat.reset();
49773                    var transformMat;
49774                    if (time !== undefined) {
49775                        toWorldMat = this._elem.finalTransform.mProp.getValueAtTime(time);
49776                    } else {
49777                        transformMat = this._elem.finalTransform.mProp;
49778                        transformMat.applyToMatrix(toWorldMat);
49779                    }
49780                    if (this._elem.hierarchy && this._elem.hierarchy.length) {
49781                        var i, len = this._elem.hierarchy.length;
49782                        for (i = 0; i < len; i += 1) {
49783                            this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(toWorldMat);
49784                        }
49785                        return toWorldMat.applyToPointArray(arr[0], arr[1], arr[2] || 0);
49786                    }
49787                    return toWorldMat.applyToPointArray(arr[0], arr[1], arr[2] || 0);
49788                }
49789
49790                function fromWorld(arr, time) {
49791                    var toWorldMat = new Matrix();
49792                    toWorldMat.reset();
49793                    var transformMat;
49794                    if (time !== undefined) {
49795                        toWorldMat = this._elem.finalTransform.mProp.getValueAtTime(time);
49796                    } else {
49797                        transformMat = this._elem.finalTransform.mProp;
49798                        transformMat.applyToMatrix(toWorldMat);
49799                    }
49800                    if (this._elem.hierarchy && this._elem.hierarchy.length) {
49801                        var i, len = this._elem.hierarchy.length;
49802                        for (i = 0; i < len; i += 1) {
49803                            this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(toWorldMat);
49804                        }
49805                        return toWorldMat.inversePoint(arr);
49806                    }
49807                    return toWorldMat.inversePoint(arr);
49808                }
49809
49810                function fromComp(arr) {
49811                    var toWorldMat = new Matrix();
49812                    toWorldMat.reset();
49813                    this._elem.finalTransform.mProp.applyToMatrix(toWorldMat);
49814                    if (this._elem.hierarchy && this._elem.hierarchy.length) {
49815                        var i, len = this._elem.hierarchy.length;
49816                        for (i = 0; i < len; i += 1) {
49817                            this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(toWorldMat);
49818                        }
49819                        return toWorldMat.inversePoint(arr);
49820                    }
49821                    return toWorldMat.inversePoint(arr);
49822                }
49823
49824                function sampleImage() {
49825                    return [1, 1, 1, 1];
49826                }
49827
49828
49829                return function (elem) {
49830
49831                    var transformInterface;
49832
49833                    function _registerMaskInterface(maskManager) {
49834                        _thisLayerFunction.mask = new MaskManagerInterface(maskManager, elem);
49835                    }
49836
49837                    function _registerEffectsInterface(effects) {
49838                        _thisLayerFunction.effect = effects;
49839                    }
49840
49841                    function _thisLayerFunction(name) {
49842                        switch (name) {
49843                            case "ADBE Root Vectors Group":
49844                            case "Contents":
49845                            case 2:
49846                                return _thisLayerFunction.shapeInterface;
49847                            case 1:
49848                            case 6:
49849                            case "Transform":
49850                            case "transform":
49851                            case "ADBE Transform Group":
49852                                return transformInterface;
49853                            case 4:
49854                            case "ADBE Effect Parade":
49855                            case "effects":
49856                            case "Effects":
49857                                return _thisLayerFunction.effect;
49858                            case "ADBE Text Properties":
49859                                return _thisLayerFunction.textInterface;
49860                        }
49861                    }
49862
49863                    _thisLayerFunction.toWorld = toWorld;
49864                    _thisLayerFunction.fromWorld = fromWorld;
49865                    _thisLayerFunction.toComp = toWorld;
49866                    _thisLayerFunction.fromComp = fromComp;
49867                    _thisLayerFunction.sampleImage = sampleImage;
49868                    _thisLayerFunction.sourceRectAtTime = elem.sourceRectAtTime.bind(elem);
49869                    _thisLayerFunction._elem = elem;
49870                    transformInterface = TransformExpressionInterface(elem.finalTransform.mProp);
49871                    var anchorPointDescriptor = getDescriptor(transformInterface, 'anchorPoint');
49872                    Object.defineProperties(_thisLayerFunction, {
49873                        hasParent: {
49874                            get: function () {
49875                                return elem.hierarchy.length;
49876                            }
49877                        },
49878                        parent: {
49879                            get: function () {
49880                                return elem.hierarchy[0].layerInterface;
49881                            }
49882                        },
49883                        rotation: getDescriptor(transformInterface, 'rotation'),
49884                        scale: getDescriptor(transformInterface, 'scale'),
49885                        position: getDescriptor(transformInterface, 'position'),
49886                        opacity: getDescriptor(transformInterface, 'opacity'),
49887                        anchorPoint: anchorPointDescriptor,
49888                        anchor_point: anchorPointDescriptor,
49889                        transform: {
49890                            get: function () {
49891                                return transformInterface;
49892                            }
49893                        },
49894                        active: {
49895                            get: function () {
49896                                return elem.isInRange;
49897                            }
49898                        }
49899                    });
49900
49901                    _thisLayerFunction.startTime = elem.data.st;
49902                    _thisLayerFunction.index = elem.data.ind;
49903                    _thisLayerFunction.source = elem.data.refId;
49904                    _thisLayerFunction.height = elem.data.ty === 0 ? elem.data.h : 100;
49905                    _thisLayerFunction.width = elem.data.ty === 0 ? elem.data.w : 100;
49906                    _thisLayerFunction.inPoint = elem.data.ip / elem.comp.globalData.frameRate;
49907                    _thisLayerFunction.outPoint = elem.data.op / elem.comp.globalData.frameRate;
49908                    _thisLayerFunction._name = elem.data.nm;
49909
49910                    _thisLayerFunction.registerMaskInterface = _registerMaskInterface;
49911                    _thisLayerFunction.registerEffectsInterface = _registerEffectsInterface;
49912                    return _thisLayerFunction;
49913                };
49914            }());
49915
49916            var CompExpressionInterface = (function () {
49917                return function (comp) {
49918                    function _thisLayerFunction(name) {
49919                        var i = 0, len = comp.layers.length;
49920                        while (i < len) {
49921                            if (comp.layers[i].nm === name || comp.layers[i].ind === name) {
49922                                return comp.elements[i].layerInterface;
49923                            }
49924                            i += 1;
49925                        }
49926                        return null;
49927                        //return {active:false};
49928                    }
49929
49930                    Object.defineProperty(_thisLayerFunction, "_name", {value: comp.data.nm});
49931                    _thisLayerFunction.layer = _thisLayerFunction;
49932                    _thisLayerFunction.pixelAspect = 1;
49933                    _thisLayerFunction.height = comp.data.h || comp.globalData.compSize.h;
49934                    _thisLayerFunction.width = comp.data.w || comp.globalData.compSize.w;
49935                    _thisLayerFunction.pixelAspect = 1;
49936                    _thisLayerFunction.frameDuration = 1 / comp.globalData.frameRate;
49937                    _thisLayerFunction.displayStartTime = 0;
49938                    _thisLayerFunction.numLayers = comp.layers.length;
49939                    return _thisLayerFunction;
49940                };
49941            }());
49942            var TransformExpressionInterface = (function () {
49943                return function (transform) {
49944                    function _thisFunction(name) {
49945                        switch (name) {
49946                            case "scale":
49947                            case "Scale":
49948                            case "ADBE Scale":
49949                            case 6:
49950                                return _thisFunction.scale;
49951                            case "rotation":
49952                            case "Rotation":
49953                            case "ADBE Rotation":
49954                            case "ADBE Rotate Z":
49955                            case 10:
49956                                return _thisFunction.rotation;
49957                            case "ADBE Rotate X":
49958                                return _thisFunction.xRotation;
49959                            case "ADBE Rotate Y":
49960                                return _thisFunction.yRotation;
49961                            case "position":
49962                            case "Position":
49963                            case "ADBE Position":
49964                            case 2:
49965                                return _thisFunction.position;
49966                            case 'ADBE Position_0':
49967                                return _thisFunction.xPosition;
49968                            case 'ADBE Position_1':
49969                                return _thisFunction.yPosition;
49970                            case 'ADBE Position_2':
49971                                return _thisFunction.zPosition;
49972                            case "anchorPoint":
49973                            case "AnchorPoint":
49974                            case "Anchor Point":
49975                            case "ADBE AnchorPoint":
49976                            case 1:
49977                                return _thisFunction.anchorPoint;
49978                            case "opacity":
49979                            case "Opacity":
49980                            case 11:
49981                                return _thisFunction.opacity;
49982                        }
49983                    }
49984
49985                    Object.defineProperty(_thisFunction, "rotation", {
49986                        get: ExpressionPropertyInterface(transform.r || transform.rz)
49987                    });
49988
49989                    Object.defineProperty(_thisFunction, "zRotation", {
49990                        get: ExpressionPropertyInterface(transform.rz || transform.r)
49991                    });
49992
49993                    Object.defineProperty(_thisFunction, "xRotation", {
49994                        get: ExpressionPropertyInterface(transform.rx)
49995                    });
49996
49997                    Object.defineProperty(_thisFunction, "yRotation", {
49998                        get: ExpressionPropertyInterface(transform.ry)
49999                    });
50000                    Object.defineProperty(_thisFunction, "scale", {
50001                        get: ExpressionPropertyInterface(transform.s)
50002                    });
50003
50004                    if (transform.p) {
50005                        var _transformFactory = ExpressionPropertyInterface(transform.p);
50006                    } else {
50007                        var _px = ExpressionPropertyInterface(transform.px);
50008                        var _py = ExpressionPropertyInterface(transform.py);
50009                        var _pz;
50010                        if (transform.pz) {
50011                            _pz = ExpressionPropertyInterface(transform.pz);
50012                        }
50013                    }
50014                    Object.defineProperty(_thisFunction, "position", {
50015                       
50015 get: function () {
50016                            if (transform.p) {
50017                                return _transformFactory();
50018                            } else {
50019                                return [
50020                                    _px(),
50021                                    _py(),
50022                                    _pz ? _pz() : 0];
50023                            }
50024                        }
50025                    });
50026
50027                    Object.defineProperty(_thisFunction, "xPosition", {
50028                        get: ExpressionPropertyInterface(transform.px)
50029                    });
50030
50031                    Object.defineProperty(_thisFunction, "yPosition", {
50032                        get: ExpressionPropertyInterface(transform.py)
50033                    });
50034
50035                    Object.defineProperty(_thisFunction, "zPosition", {
50036                        get: ExpressionPropertyInterface(transform.pz)
50037                    });
50038
50039                    Object.defineProperty(_thisFunction, "anchorPoint", {
50040                        get: ExpressionPropertyInterface(transform.a)
50041                    });
50042
50043                    Object.defineProperty(_thisFunction, "opacity", {
50044                        get: ExpressionPropertyInterface(transform.o)
50045                    });
50046
50047                    Object.defineProperty(_thisFunction, "skew", {
50048                        get: ExpressionPropertyInterface(transform.sk)
50049                    });
50050
50051                    Object.defineProperty(_thisFunction, "skewAxis", {
50052                        get: ExpressionPropertyInterface(transform.sa)
50053                    });
50054
50055                    Object.defineProperty(_thisFunction, "orientation", {
50056                        get: ExpressionPropertyInterface(transform.or)
50057                    });
50058
50059                    return _thisFunction;
50060                };
50061            }());
50062            var ProjectInterface = (function () {
50063
50064                function registerComposition(comp) {
50065                    this.compositions.push(comp);
50066                }
50067
50068                return function () {
50069                    function _thisProjectFunction(name) {
50070                        var i = 0, len = this.compositions.length;
50071                        while (i < len) {
50072                            if (this.compositions[i].data && this.compositions[i].data.nm === name) {
50073                                if (this.compositions[i].prepareFrame && this.compositions[i].data.xt) {
50074                                    this.compositions[i].prepareFrame(this.currentFrame);
50075                                }
50076                                return this.compositions[i].compInterface;
50077                            }
50078                            i += 1;
50079                        }
50080                    }
50081
50082                    _thisProjectFunction.compositions = [];
50083                    _thisProjectFunction.currentFrame = 0;
50084
50085                    _thisProjectFunction.registerComposition = registerComposition;
50086
50087
50088                    return _thisProjectFunction;
50089                };
50090            }());
50091            var EffectsExpressionInterface = (function () {
50092                var ob = {
50093                    createEffectsInterface: createEffectsInterface
50094                };
50095
50096                function createEffectsInterface(elem, propertyGroup) {
50097                    if (elem.effectsManager) {
50098
50099                        var effectElements = [];
50100                        var effectsData = elem.data.ef;
50101                        var i, len = elem.effectsManager.effectElements.length;
50102                        for (i = 0; i < len; i += 1) {
50103                            effectElements.push(createGroupInterface(effectsData[i], elem.effectsManager.effectElements[i], propertyGroup, elem));
50104                        }
50105
50106                        var effects = elem.data.ef || [];
50107                        var groupInterface = function (name) {
50108                            i = 0, len = effects.length;
50109                            while (i < len) {
50110                                if (name === effects[i].nm || name === effects[i].mn || name === effects[i].ix) {
50111                                    return effectElements[i];
50112                                }
50113                                i += 1;
50114                            }
50115                        };
50116                        Object.defineProperty(groupInterface, 'numProperties', {
50117                            get: function () {
50118                                return effects.length;
50119                            }
50120                        });
50121                        return groupInterface
50122                    }
50123                }
50124
50125                function createGroupInterface(data, elements, propertyGroup, elem) {
50126
50127                    function groupInterface(name) {
50128                        var effects = data.ef, i = 0, len = effects.length;
50129                        while (i < len) {
50130                            if (name === effects[i].nm || name === effects[i].mn || name === effects[i].ix) {
50131                                if (effects[i].ty === 5) {
50132                                    return effectElements[i];
50133                                } else {
50134                                    return effectElements[i]();
50135                                }
50136                            }
50137                            i += 1;
50138                        }
50139                        throw new Error();
50140                    };
50141                    var _propertyGroup = propertyGroupFactory(groupInterface, propertyGroup);
50142
50143                    var effectElements = [];
50144                    var i, len = data.ef.length;
50145                    for (i = 0; i < len; i += 1) {
50146                        if (data.ef[i].ty === 5) {
50147                            effectElements.push(createGroupInterface(data.ef[i], elements.effectElements[i], elements.effectElements[i].propertyGroup, elem));
50148                        } else {
50149                            effectElements.push(createValueInterface(elements.effectElements[i], data.ef[i].ty, elem, _propertyGroup));
50150                        }
50151                    }
50152
50153                    if (data.mn === 'ADBE Color Control') {
50154                        Object.defineProperty(groupInterface, 'color', {
50155                            get: function () {
50156                                return effectElements[0]();
50157                            }
50158                        });
50159                    }
50160                    Object.defineProperties(groupInterface, {
50161                        numProperties: {
50162                            get: function () {
50163                                return data.np;
50164                            }
50165                        },
50166                        _name: {value: data.nm},
50167                        propertyGroup: {value: _propertyGroup},
50168                    });
50169                    groupInterface.active = groupInterface.enabled = data.en !== 0;
50170                    return groupInterface;
50171                }
50172
50173                function createValueInterface(element, type, elem, propertyGroup) {
50174                    var expressionProperty = ExpressionPropertyInterface(element.p);
50175
50176                    function interfaceFunction() {
50177                        if (type === 10) {
50178                            return elem.comp.compInterface(element.p.v);
50179                        }
50180                        return expressionProperty();
50181                    }
50182
50183                    if (element.p.setGroupProperty) {
50184                        element.p.setGroupProperty(PropertyInterface('', propertyGroup));
50185                    }
50186
50187                    return interfaceFunction;
50188                }
50189
50190                return ob;
50191
50192            }());
50193            var MaskManagerInterface = (function () {
50194
50195                function MaskInterface(mask, data) {
50196                    this._mask = mask;
50197                    this._data = data;
50198                }
50199
50200                Object.defineProperty(MaskInterface.prototype, 'maskPath', {
50201                    get: function () {
50202                        if (this._mask.prop.k) {
50203                            this._mask.prop.getValue();
50204                        }
50205                        return this._mask.prop;
50206                    }
50207                });
50208                Object.defineProperty(MaskInterface.prototype, 'maskOpacity', {
50209                    get: function () {
50210                        if (this._mask.op.k) {
50211                            this._mask.op.getValue();
50212                        }
50213                        return this._mask.op.v * 100;
50214                    }
50215                });
50216
50217                var MaskManager = function (maskManager, elem) {
50218                    var _maskManager = maskManager;
50219                    var _elem = elem;
50220                    var _masksInterfaces = createSizedArray(maskManager.viewD
50220ata.length);
50221                    var i, len = maskManager.viewData.length;
50222                    for (i = 0; i < len; i += 1) {
50223                        _masksInterfaces[i] = new MaskInterface(maskManager.viewData[i], maskManager.masksProperties[i]);
50224                    }
50225
50226                    var maskFunction = function (name) {
50227                        i = 0;
50228                        while (i < len) {
50229                            if (maskManager.masksProperties[i].nm === name) {
50230                                return _masksInterfaces[i];
50231                            }
50232                            i += 1;
50233                        }
50234                    };
50235                    return maskFunction;
50236                };
50237                return MaskManager;
50238            }());
50239
50240            var ExpressionPropertyInterface = (function () {
50241
50242                var defaultUnidimensionalValue = {pv: 0, v: 0, mult: 1}
50243                var defaultMultidimensionalValue = {pv: [0, 0, 0], v: [0, 0, 0], mult: 1}
50244
50245                function completeProperty(expressionValue, property, type) {
50246                    Object.defineProperty(expressionValue, 'velocity', {
50247                        get: function () {
50248                            return property.getVelocityAtTime(property.comp.currentFrame);
50249                        }
50250                    });
50251                    expressionValue.numKeys = property.keyframes ? property.keyframes.length : 0;
50252                    expressionValue.key = function (pos) {
50253                        if (!expressionValue.numKeys) {
50254                            return 0;
50255                        } else {
50256                            var value = '';
50257                            if ('s' in property.keyframes[pos - 1]) {
50258                                value = property.keyframes[pos - 1].s;
50259                            } else if ('e' in property.keyframes[pos - 2]) {
50260                                value = property.keyframes[pos - 2].e;
50261                            } else {
50262                                value = property.keyframes[pos - 2].s;
50263                            }
50264                            var valueProp = type === 'unidimensional' ? new Number(value) : Object.assign({}, value);
50265                            valueProp.time = property.keyframes[pos - 1].t / property.elem.comp.globalData.frameRate;
50266                            valueProp.value = type === 'unidimensional' ? value[0] : value;
50267                            return valueProp;
50268                        }
50269                    };
50270                    expressionValue.valueAtTime = property.getValueAtTime;
50271                    expressionValue.speedAtTime = property.getSpeedAtTime;
50272                    expressionValue.velocityAtTime = property.getVelocityAtTime;
50273                    expressionValue.propertyGroup = property.propertyGroup;
50274                }
50275
50276                function UnidimensionalPropertyInterface(property) {
50277                    if (!property || !('pv' in property)) {
50278                        property = defaultUnidimensionalValue;
50279                    }
50280                    var mult = 1 / property.mult;
50281                    var val = property.pv * mult;
50282                    var expressionValue = new Number(val);
50283                    expressionValue.value = val;
50284                    completeProperty(expressionValue, property, 'unidimensional');
50285
50286                    return function () {
50287                        if (property.k) {
50288                            property.getValue();
50289                        }
50290                        val = property.v * mult;
50291                        if (expressionValue.value !== val) {
50292                            expressionValue = new Number(val);
50293                            expressionValue.value = val;
50294                            completeProperty(expressionValue, property, 'unidimensional');
50295                        }
50296                        return expressionValue;
50297                    }
50298                }
50299
50300                function MultidimensionalPropertyInterface(property) {
50301                    if (!property || !('pv' in property)) {
50302                        property = defaultMultidimensionalValue;
50303                    }
50304                    var mult = 1 / property.mult;
50305                    var len = property.pv.length;
50306                    var expressionValue = createTypedArray('float32', len);
50307                    var arrValue = createTypedArray('float32', len);
50308                    expressionValue.value = arrValue;
50309                    completeProperty(expressionValue, property, 'multidimensional');
50310
50311                    return function () {
50312                        if (property.k) {
50313                            property.getValue();
50314                        }
50315                        for (var i = 0; i < len; i += 1) {
50316                            expressionValue[i] = arrValue[i] = property.v[i] * mult;
50317                        }
50318                        return expressionValue;
50319                    }
50320                }
50321
50322                //TODO: try to avoid using this getter
50323                function defaultGetter() {
50324                    return defaultUnidimensionalValue;
50325                }
50326
50327                return function (property) {
50328                    if (!property) {
50329                        return defaultGetter;
50330                    } else if (property.propType === 'unidimensional') {
50331                        return UnidimensionalPropertyInterface(property);
50332                    } else {
50333                        return MultidimensionalPropertyInterface(property);
50334                    }
50335                }
50336            }());
50337
50338            (function () {
50339
50340                var TextExpressionSelectorProp = (function () {
50341
50342                    function getValueProxy(index, total) {
50343                        this.textIndex = index + 1;
50344                        this.textTotal = total;
50345                        this.v = this.getValue() * this.mult;
50346                        return this.v;
50347                    }
50348
50349                    return function TextExpressionSelectorProp(elem, data) {
50350                        this.pv = 1;
50351                        this.comp = elem.comp;
50352                        this.elem = elem;
50353                        this.mult = 0.01;
50354                        this.propType = 'textSelector';
50355                        this.textTotal = data.totalChars;
50356                        this.selectorValue = 100;
50357                        this.lastValue = [1, 1, 1];
50358                        this.k = true;
50359                        this.x = true;
50360                        this.getValue = ExpressionManager.initiateExpression.bind(this)(elem, data, this);
50361                        this.getMult = getValueProxy;
50362                        this.getVelocityAtTime = expressionHelpers.getVelocityAtTime;
50363                        if (this.kf) {
50364                            this.getValueAtTime = expressionHelpers.getValueAtTime.bind(this);
50365                        } else {
50366                            this.getValueAtTime = expressionHelpers.getStaticValueAtTime.bind(this);
50367                        }
50368                        this.setGroupProperty = expressionHelpers.setGroupProperty;
50369                    };
50370                }());
50371
50372                var propertyGetTextProp = TextSelectorProp.getTextSelectorProp;
50373                TextSelectorProp.getTextSelectorProp = function (elem, data, arr) {
50374                    if (data.t === 1) {
50375                        return new TextExpressionSelectorProp(elem, data, arr);
50376                    } else {
50377                        return propertyGetTextProp(elem, data, arr);
50378                    }
50379                };
50380            }());
50381
50382            function SliderEffect(data, elem, container) {
50383                this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);
50384            }
50385
50386            function AngleEffect(data, elem, container) {
50387                this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);
50388            }
50389
50390            function ColorEffect(data, elem, container) {
50391                this.p = PropertyFactory.getProp(elem, data.v, 1, 0, container);
50392            }
50393
50394            function PointEffect(data, elem, container) {
50395                this.p = PropertyFactory.getProp(elem, data.v, 1, 0, container);
50396            }
50397
50398            function LayerIndexEffect(data, elem, container) {
50399                this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);
50400            }
50401
50402            function MaskIndexEffect(data, elem, container) {
50403                this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);
50404            }
50405
50406            function CheckboxEffect(data, elem, container) {
50407                this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);
50408            }
50409
50410            function NoValueEffect() {
50411                this.p = {};
50412            }
50413
50414            function EffectsManager() {
50415            }
50416
50417            function EffectsManager(data, element) {
50418                var effects = data.ef || [];
50419                this.effectElements = [];
50420                var i, len = effects.length;
50421                var effectItem;
50422                for (i = 0; i < len; i++) {
50423                    effectItem = new GroupEffect(effects[i], element);
50424                    this.effectElements.push(effectItem);
50425                }
50426            }
50427
50428            function GroupEffect(data, element) {
50429                this.init(data, element);
50430            }
50431
50432            extendPrototype([DynamicPropertyContainer], GroupEffect);
50433
50434            GroupEffect.prototype.getValue = GroupEffect.prototype.iterateDynamicProperties;
50435
50436            GroupEffect.prototype.init = function (data, element) {
50437                this.data = data;
50438                this.effectElements = [];
50439                this.initDynamicPropertyContainer(element);
50440                var i, len = this.data.ef.length;
50441                var eff, effects = this.data.ef;
50442                for (i = 0; i < len; i += 1) {
50443                    eff = null;
50444                    switch (effects[i].ty) {
50445                        case 0:
50446                            eff = new SliderEffect(effects[i], element, this);
50447                            break;
50448                        case 1:
50449                            eff = new AngleEffect(effects[i], element, this);
50450                            break;
50451                        case 2:
50452                            eff = new ColorEffect(effects[i], element, this);
50453                            break;
50454                        case 3:
50455                            eff = new PointEffect(effects[i], element, this);
50456                            break;
50457                        case 4:
50458                        case 7:
50459                            eff = new CheckboxEffect(effects[i], element, this);
50460                            break;
50461                        case 10:
50462                            eff = new LayerIndexEffect(effects[i], element, this);
50463                            break;
50464                        case 11:
50465                            eff = new MaskIndexEffect(effects[i], element, this);
50466                            break;
50467                        case 5:
50468                            eff = new EffectsManager(effects[i], element, this);
50469                            break;
50470                        //case 6:
50471                        default:
50472                            eff = new NoValueEffect(effects[i], element, this);
50473                            break;
50474                    }
50475                    if (eff) {
50476                        this.effectElements.push(eff);
50477                    }
50478                }
50479            };
50480
50481            var lottie = {};
50482
50483            var _isFrozen = false;
50484
50485            function setLocationHref(href) {
50486                locationHref = href;
50487            }
50488
50489            function searchAnimations() {
50490                if (standalone === true) {
50491                    animationManager.searchAnimations(animationData, standalone, renderer);
50492                } else {
50493                    animationManager.searchAnimations();
50494                }
50495            }
50496
50497            function setSubframeRendering(flag) {
50498                subframeEnabled = flag;
50499            }
50500
50501            function loadAnimation(params) {
50502                if (standalone === true) {
50503                    params.animationData = JSON.parse(animationData);
50504                }
50505                return animationManager.loadAnimation(params);
50506            }
50507
50508            function setQuality(value) {
50509                if (typeof value === 'string') {
50510                    switch (value) {
50511                        case 'high':
50512                            defaultCurveSegments = 200;
50513                            break;
50514                        case 'medium':
50515                            defaultCurveSegments = 50;
50516                            break;
50517                        case 'low':
50518                            defaultCurveSegments = 10;
50519                            break;
50520                    }
50521                } else if (!isNaN(value) && value > 1) {
50522                    defaultCurveSegments = value;
50523                }
50524                if (defaultCurveSegments >= 50) {
50525                    roundValues(false);
50526                } else {
50527                    roundValues(true);
50528                }
50529            }
50530
50531            function inBrowser() {
50532                return typeof navigator !== 'undefined';
50533            }
50534
50535            function installPlugin(type, plugin) {
50536                if (type === 'expressions') {
50537                    expressionsPlugin = plugin;
50538                }
50539            }
50540
50541            function getFactory(name) {
50542                switch (name) {
50543                    case "propertyFactory":
50544                        return PropertyFactory;
50545                    case "shapePropertyFactory":
50546                        return ShapePropertyFactory;
50547                    case "matrix":
50548                        return Matrix;
50549                }
50550            }
50551
50552            lottie.play = animationManager.play;
50553            lottie.pause = animationManager.pause;
50554            lottie.setLocationHref = setLocationHref;
50555            lottie.togglePause = animationManager.togglePause;
50556            lottie.setSpeed = animationManager.setSpeed;
50557            lottie.setDirection = animationManager.setDirection;
50558            lottie.stop = animationManager.stop;
50559            lottie.searchAnimations = searchAnimations;
50560            lottie.registerAnimation = animationManager.registerAnimation;
50561            lottie.loadAnimation = loadAnimation;
50562            lottie.setSubframeRendering = setSubframeRendering;
50563            lottie.resize = animationManager.resize;
50564//lottie.start = start;
50565            lottie.goToAndStop = animationManager.goToAndStop;
50566            lottie.destroy = animationManager.destroy;
50567            lottie.setQuality = setQuality;
50568            lottie.inBrowser = inBrowser;
50569            lottie.installPlugin = installPlugin;
50570            lottie.freeze = animationManager.freeze;
50571            lottie.unfreeze = animationManager.unfreeze;
50572            lottie.setVolume = animationManager.setVolume;
50573            lottie.mute = animationManager.mute;
50574            lottie.unmute = animationManager.unmute;
50575            lottie.getRegisteredAnimations = animationManager.getRegisteredAnimations;
50576            lottie.__getFactory = getFactory;
50577            lottie.version = '5.7.3';
50578
50579            function checkReady() {
50580                if (document.readyState === "complete") {
50581                    clearInterval(readyStateCheckInterval);
50582                    searchAnimations();
50583                }
50584            }
50585
50586            function getQueryVariable(variable) {
50587                var vars = queryString.split('&');
50588                for (var i = 0; i < vars.length; i++) {
50589                    var pair = vars[i].split('=');
50590                    if (decodeURIComponent(pair[0]) == variable) {
50591                        return decodeURIComponent(pair[1]);
50592                    }
50593                }
50594            }
50595
50596            var standalone = '__[STANDALONE]__';
50597            var animationData = '__[ANIMATIONDATA]__';
50598            var renderer = '';
50599            if (standalone) {
50600                var scripts = document.getElementsByTagName('script');
50601                var index = scripts.length - 1;
50602                var myScript = scripts[index] || {
50603                    src: ''
50604                };
50605                var queryString = myScript.src.replace(/^[^\?]+\??/, '');
50606                renderer = getQueryVariable('renderer');
50607            }
50608            var readyStateCheckInterval = setInterval(checkReady, 100);
50609
50610            return lottie;
50611        }));
50612    }, {}],
50613    8: [function (require, module, exports) {
50614//! moment.js locale configuration
50615//! locale : French [fr]
50616//! author : John Fischer : https://github.com/jfroffice
50617
50618        ;(function (global, factory) {
50619            typeof exports === 'object' && typeof module !== 'undefined'
50620            && typeof require === 'function' ? factory(require('../moment')) :
50621                typeof define === 'function' && define.amd ? define(['../moment'], factory) :
50622                    factory(global.moment)
50623        }(this, (function (moment) {
50624            'use strict';
50625
50626            //! moment.js locale configuration
50627
50628            var monthsStrictRegex = /^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i,
50629                monthsShortStrictRegex = /(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?)/i,
50630                monthsRegex = /(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?|janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i,
50631                monthsParse = [
50632                    /^janv/i,
50633                    /^févr/i,
50634                    /^mars/i,
50635                    /^avr/i,
50636                    /^mai/i,
50637                    /^juin/i,
50638                    /^juil/i,
50639                    /^août/i,
50640                    /^sept/i,
50641                    /^oct/i,
50642                    /^nov/i,
50643                    /^déc/i,
50644                ];
50645
50646            var fr = moment.defineLocale('fr', {
50647                months: 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split(
50648                    '_'
50649                ),
50650                monthsShort: 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split(
50651                    '_'
50652                ),
50653                monthsRegex: monthsRegex,
50654                monthsShortRegex: monthsRegex,
50655                monthsStrictRegex: monthsStrictRegex,
50656                monthsShortStrictRegex: monthsShortStrictRegex,
50657                monthsParse: monthsParse,
50658                longMonthsParse: monthsParse,
50659                shortMonthsParse: monthsParse,
50660                weekdays: 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'),
50661                weekdaysShort: 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'),
50662                weekdaysMin: 'di_lu_ma_me_je_ve_sa'.split('_'),
50663                weekdaysParseExact: true,
50664                longDateFormat: {
50665                    LT: 'HH:mm',
50666                    LTS: 'HH:mm:ss',
50667                    L: 'DD/MM/YYYY',
50668                    LL: 'D MMMM YYYY',
50669                    LLL: 'D MMMM YYYY HH:mm',
50670                    LLLL: 'dddd D MMMM YYYY HH:mm',
50671                },
50672                calendar: {
50673                    sameDay: '[Aujourd’hui à] LT',
50674                    nextDay: '[Demain à] LT',
50675                    nextWeek: 'dddd [à] LT',
50676                    lastDay: '[Hier à] LT',
50677                    lastWeek: 'dddd [dernier à] LT',
50678                    sameElse: 'L',
50679                },
50680                relativeTime: {
50681                    future: 'dans %s',
50682                    past: 'il y a %s',
50683                    s: 'quelques secondes',
50684                    ss: '%d secondes',
50685                    m: 'une minute',
50686                    mm: '%d minutes',
50687                    h: 'une heure',
50688                    hh: '%d heures',
50689                    d: 'un jour',
50690                    dd: '%d jours',
50691                    w: 'une semaine',
50692                    ww: '%d semaines',
50693                    M: 'un mois',
50694                    MM: '%d mois',
50695                    y: 'un an',
50696                    yy: '%d ans',
50697                },
50698                dayOfMonthOrdinalParse: /\d{1,2}(er|)/,
50699                ordinal: function (number, period) {
50700                    switch (period) {
50701                        // TODO: Return 'e' when day of month > 1. Move this case inside
50702                        // block for masculine words below.
50703                        // See https://github.com/moment/moment/issues/3375
50704                        case 'D':
50705                            return number + (number === 1 ? 'er' : '');
50706
50707                        // Words with masculine grammatical gender: mois, trimestre, jour
50708                        default:
50709                        case 'M':
50710                        case 'Q':
50711                        case 'DDD':
50712                        case 'd':
50713                            return number + (number === 1 ? 'er' : 'e');
50714
50715                        // Words with feminine grammatical gender: semaine
50716                        case 'w':
50717                        case 'W':
50718                            return number + (number === 1 ? 're' : 'e');
50719                    }
50720                },
50721                week: {
50722                    dow: 1, // Monday is the first day of the week.
50723                    doy: 4, // The week that contains Jan 4th is the first week of the year.
50724                },
50725            });
50726
50727            return fr;
vendor: 16,284 bytes, lines 50728-51182
50728
50729        })));
50730
50731    }, {"../moment": 9}],
50732    9: [function (require, module, exports) {
50733//! moment.js
50734//! version : 2.29.1
50735//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
50736//! license : MIT
50737//! momentjs.com
50738
50739        ;(function (global, factory) {
50740            typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
50741                typeof define === 'function' && define.amd ? define(factory) :
50742                    global.moment = factory()
50743        }(this, (function () {
50744            'use strict';
50745
50746            var hookCallback;
50747
50748            function hooks() {
50749                return hookCallback.apply(null, arguments);
50750            }
50751
50752            // This is done to register the method called with moment()
50753            // without creating circular dependencies.
50754            function setHookCallback(callback) {
50755                hookCallback = callback;
50756            }
50757
50758            function isArray(input) {
50759                return (
50760                    input instanceof Array ||
50761                    Object.prototype.toString.call(input) === '[object Array]'
50762                );
50763            }
50764
50765            function isObject(input) {
50766                // IE8 will treat undefined and null as object if it wasn't for
50767                // input != null
50768                return (
50769                    input != null &&
50770                    Object.prototype.toString.call(input) === '[object Object]'
50771                );
50772            }
50773
50774            function hasOwnProp(a, b) {
50775                return Object.prototype.hasOwnProperty.call(a, b);
50776            }
50777
50778            function isObjectEmpty(obj) {
50779                if (Object.getOwnPropertyNames) {
50780                    return Object.getOwnPropertyNames(obj).length === 0;
50781                } else {
50782                    var k;
50783                    for (k in obj) {
50784                        if (hasOwnProp(obj, k)) {
50785                            return false;
50786                        }
50787                    }
50788                    return true;
50789                }
50790            }
50791
50792            function isUndefined(input) {
50793                return input === void 0;
50794            }
50795
50796            function isNumber(input) {
50797                return (
50798                    typeof input === 'number' ||
50799                    Object.prototype.toString.call(input) === '[object Number]'
50800                );
50801            }
50802
50803            function isDate(input) {
50804                return (
50805                    input instanceof Date ||
50806                    Object.prototype.toString.call(input) === '[object Date]'
50807                );
50808            }
50809
50810            function map(arr, fn) {
50811                var res = [],
50812                    i;
50813                for (i = 0; i < arr.length; ++i) {
50814                    res.push(fn(arr[i], i));
50815                }
50816                return res;
50817            }
50818
50819            function extend(a, b) {
50820                for (var i in b) {
50821                    if (hasOwnProp(b, i)) {
50822                        a[i] = b[i];
50823                    }
50824                }
50825
50826                if (hasOwnProp(b, 'toString')) {
50827                    a.toString = b.toString;
50828                }
50829
50830                if (hasOwnProp(b, 'valueOf')) {
50831                    a.valueOf = b.valueOf;
50832                }
50833
50834                return a;
50835            }
50836
50837            function createUTC(input, format, locale, strict) {
50838                return createLocalOrUTC(input, format, locale, strict, true).utc();
50839            }
50840
50841            function defaultParsingFlags() {
50842                // We need to deep clone this object.
50843                return {
50844                    empty: false,
50845                    unusedTokens: [],
50846                    unusedInput: [],
50847                    overflow: -2,
50848                    charsLeftOver: 0,
50849                    nullInput: false,
50850                    invalidEra: null,
50851                    invalidMonth: null,
50852                    invalidFormat: false,
50853                    userInvalidated: false,
50854                    iso: false,
50855                    parsedDateParts: [],
50856                    era: null,
50857                    meridiem: null,
50858                    rfc2822: false,
50859                    weekdayMismatch: false,
50860                };
50861            }
50862
50863            function getParsingFlags(m) {
50864                if (m._pf == null) {
50865                    m._pf = defaultParsingFlags();
50866                }
50867                return m._pf;
50868            }
50869
50870            var some;
50871            if (Array.prototype.some) {
50872                some = Array.prototype.some;
50873            } else {
50874                some = function (fun) {
50875                    var t = Object(this),
50876                        len = t.length >>> 0,
50877                        i;
50878
50879                    for (i = 0; i < len; i++) {
50880                        if (i in t && fun.call(this, t[i], i, t)) {
50881                            return true;
50882                        }
50883                    }
50884
50885                    return false;
50886                };
50887            }
50888
50889            function isValid(m) {
50890                if (m._isValid == null) {
50891                    var flags = getParsingFlags(m),
50892                        parsedParts = some.call(flags.parsedDateParts, function (i) {
50893                            return i != null;
50894                        }),
50895                        isNowValid =
50896                            !isNaN(m._d.getTime()) &&
50897                            flags.overflow < 0 &&
50898                            !flags.empty &&
50899                            !flags.invalidEra &&
50900                            !flags.invalidMonth &&
50901                            !flags.invalidWeekday &&
50902                            !flags.weekdayMismatch &&
50903                            !flags.nullInput &&
50904                            !flags.invalidFormat &&
50905                            !flags.userInvalidated &&
50906                            (!flags.meridiem || (flags.meridiem && parsedParts));
50907
50908                    if (m._strict) {
50909                        isNowValid =
50910                            isNowValid &&
50911                            flags.charsLeftOver === 0 &&
50912                            flags.unusedTokens.length === 0 &&
50913                            flags.bigHour === undefined;
50914                    }
50915
50916                    if (Object.isFrozen == null || !Object.isFrozen(m)) {
50917                        m._isValid = isNowValid;
50918                    } else {
50919                        return isNowValid;
50920                    }
50921                }
50922                return m._isValid;
50923            }
50924
50925            function createInvalid(flags) {
50926                var m = createUTC(NaN);
50927                if (flags != null) {
50928                    extend(getParsingFlags(m), flags);
50929                } else {
50930                    getParsingFlags(m).userInvalidated = true;
50931                }
50932
50933                return m;
50934            }
50935
50936            // Plugins that add properties should also add the key here (null value),
50937            // so we can properly clone ourselves.
50938            var momentProperties = (hooks.momentProperties = []),
50939                updateInProgress = false;
50940
50941            function copyConfig(to, from) {
50942                var i, prop, val;
50943
50944                if (!isUndefined(from._isAMomentObject)) {
50945                    to._isAMomentObject = from._isAMomentObject;
50946                }
50947                if (!isUndefined(from._i)) {
50948                    to._i = from._i;
50949                }
50950                if (!isUndefined(from._f)) {
50951                    to._f = from._f;
50952                }
50953                if (!isUndefined(from._l)) {
50954                    to._l = from._l;
50955                }
50956                if (!isUndefined(from._strict)) {
50957                    to._strict = from._strict;
50958                }
50959                if (!isUndefined(from._tzm)) {
50960                    to._tzm = from._tzm;
50961                }
50962                if (!isUndefined(from._isUTC)) {
50963                    to._isUTC = from._isUTC;
50964                }
50965                if (!isUndefined(from._offset)) {
50966                    to._offset = from._offset;
50967                }
50968                if (!isUndefined(from._pf)) {
50969                    to._pf = getParsingFlags(from);
50970                }
50971                if (!isUndefined(from._locale)) {
50972                    to._locale = from._locale;
50973                }
50974
50975                if (momentProperties.length > 0) {
50976                    for (i = 0; i < momentProperties.length; i++) {
50977                        prop = momentProperties[i];
50978                        val = from[prop];
50979                        if (!isUndefined(val)) {
50980                            to[prop] = val;
50981                        }
50982                    }
50983                }
50984
50985                return to;
50986            }
50987
50988            // Moment prototype object
50989            function Moment(config) {
50990                copyConfig(this, config);
50991                this._d = new Date(config._d != null ? config._d.getTime() : NaN);
50992                if (!this.isValid()) {
50993                    this._d = new Date(NaN);
50994                }
50995                // Prevent infinite loop in case updateOffset creates new moment
50996                // objects.
50997                if (updateInProgress === false) {
50998                    updateInProgress = true;
50999                    hooks.updateOffset(this);
51000                    updateInProgress = false;
51001                }
51002            }
51003
51004            function isMoment(obj) {
51005                return (
51006                    obj instanceof Moment || (obj != null && obj._isAMomentObject != null)
51007                );
51008            }
51009
51010            function warn(msg) {
51011                if (
51012                    hooks.suppressDeprecationWarnings === false &&
51013                    typeof console !== 'undefined' &&
51014                    console.warn
51015                ) {
51016                    console.warn('Deprecation warning: ' + msg);
51017                }
51018            }
51019
51020            function deprecate(msg, fn) {
51021                var firstTime = true;
51022
51023                return extend(function () {
51024                    if (hooks.deprecationHandler != null) {
51025                        hooks.deprecationHandler(null, msg);
51026                    }
51027                    if (firstTime) {
51028                        var args = [],
51029                            arg,
51030                            i,
51031                            key;
51032                        for (i = 0; i < arguments.length; i++) {
51033                            arg = '';
51034                            if (typeof arguments[i] === 'object') {
51035                                arg += '\n[' + i + '] ';
51036                                for (key in arguments[0]) {
51037                                    if (hasOwnProp(arguments[0], key)) {
51038                                        arg += key + ': ' + arguments[0][key] + ', ';
51039                                    }
51040                                }
51041                                arg = arg.slice(0, -2); // Remove trailing comma and space
51042                            } else {
51043                                arg = arguments[i];
51044                            }
51045                            args.push(arg);
51046                        }
51047                        warn(
51048                            msg +
51049                            '\nArguments: ' +
51050                            Array.prototype.slice.call(args).join('') +
51051                            '\n' +
51052                            new Error().stack
51053                        );
51054                        firstTime = false;
51055                    }
51056                    return fn.apply(this, arguments);
51057                }, fn);
51058            }
51059
51060            var deprecations = {};
51061
51062            function deprecateSimple(name, msg) {
51063                if (hooks.deprecationHandler != null) {
51064                    hooks.deprecationHandler(name, msg);
51065                }
51066                if (!deprecations[name]) {
51067                    warn(msg);
51068                    deprecations[name] = true;
51069                }
51070            }
51071
51072            hooks.suppressDeprecationWarnings = false;
51073            hooks.deprecationHandler = null;
51074
51075            function isFunction(input) {
51076                return (
51077                    (typeof Function !== 'undefined' && input instanceof Function) ||
51078                    Object.prototype.toString.call(input) === '[object Function]'
51079                );
51080            }
51081
51082            function set(config) {
51083                var prop, i;
51084                for (i in config) {
51085                    if (hasOwnProp(config, i)) {
51086                        prop = config[i];
51087                        if (isFunction(prop)) {
51088                            this[i] = prop;
51089                        } else {
51090                            this['_' + i] = prop;
51091                        }
51092                    }
51093                }
51094                this._config = config;
51095                // Lenient ordinal parsing accepts just a number in addition to
51096                // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
51097                // TODO: Remove "ordinalParse" fallback in next major release.
51098                this._dayOfMonthOrdinalParseLenient = new RegExp(
51099                    (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
51100                    '|' +
51101                    /\d{1,2}/.source
51102                );
51103            }
51104
51105            function mergeConfigs(parentConfig, childConfig) {
51106                var res = extend({}, parentConfig),
51107                    prop;
51108                for (prop in childConfig) {
51109                    if (hasOwnProp(childConfig, prop)) {
51110                        if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
51111                            res[prop] = {};
51112                            extend(res[prop], parentConfig[prop]);
51113                            extend(res[prop], childConfig[prop]);
51114                        } else if (childConfig[prop] != null) {
51115                            res[prop] = childConfig[prop];
51116                        } else {
51117                            delete res[prop];
51118                        }
51119                    }
51120                }
51121                for (prop in parentConfig) {
51122                    if (
51123                        hasOwnProp(parentConfig, prop) &&
51124                        !hasOwnProp(childConfig, prop) &&
51125                        isObject(parentConfig[prop])
51126                    ) {
51127                        // make sure changes to properties don't modify parent config
51128                        res[prop] = extend({}, res[prop]);
51129                    }
51130                }
51131                return res;
51132            }
51133
51134            function Locale(config) {
51135                if (config != null) {
51136                    this.set(config);
51137                }
51138            }
51139
51140            var keys;
51141
51142            if (Object.keys) {
51143                keys = Object.keys;
51144            } else {
51145                keys = function (obj) {
51146                    var i,
51147                        res = [];
51148                    for (i in obj) {
51149                        if (hasOwnProp(obj, i)) {
51150                            res.push(i);
51151                        }
51152                    }
51153                    return res;
51154                };
51155            }
51156
51157            var defaultCalendar = {
51158                sameDay: '[Today at] LT',
51159                nextDay: '[Tomorrow at] LT',
51160                nextWeek: 'dddd [at] LT',
51161                lastDay: '[Yesterday at] LT',
51162                lastWeek: '[Last] dddd [at] LT',
51163                sameElse: 'L',
51164            };
51165
51166            function calendar(key, mom, now) {
51167                var output = this._calendar[key] || this._calendar['sameElse'];
51168                return isFunction(output) ? output.call(mom, now) : output;
51169            }
51170
51171            function zeroFill(number, targetLength, forceSign) {
51172                var absNumber = '' + Math.abs(number),
51173                    zerosToFill = targetLength - absNumber.length,
51174                    sign = number >= 0;
51175                return (
51176                    (sign ? (forceSign ? '+' : '') : '-') +
51177                    Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) +
51178                    absNumber
51179                );
51180            }
51181
51182            var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}
vendor: 4,777 bytes, lines 51182-51317
51182|x|X|zz?|ZZ?|.)/g,
51183                localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,
51184                formatFunctions = {},
51185                formatTokenFunctions = {};
51186
51187            // token:    'M'
51188            // padded:   ['MM', 2]
51189            // ordinal:  'Mo'
51190            // callback: function () { this.month() + 1 }
51191            function addFormatToken(token, padded, ordinal, callback) {
51192                var func = callback;
51193                if (typeof callback === 'string') {
51194                    func = function () {
51195                        return this[callback]();
51196                    };
51197                }
51198                if (token) {
51199                    formatTokenFunctions[token] = func;
51200                }
51201                if (padded) {
51202                    formatTokenFunctions[padded[0]] = function () {
51203                        return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
51204                    };
51205                }
51206                if (ordinal) {
51207                    formatTokenFunctions[ordinal] = function () {
51208                        return this.localeData().ordinal(
51209                            func.apply(this, arguments),
51210                            token
51211                        );
51212                    };
51213                }
51214            }
51215
51216            function removeFormattingTokens(input) {
51217                if (input.match(/\[[\s\S]/)) {
51218                    return input.replace(/^\[|\]$/g, '');
51219                }
51220                return input.replace(/\\/g, '');
51221            }
51222
51223            function makeFormatFunction(format) {
51224                var array = format.match(formattingTokens),
51225                    i,
51226                    length;
51227
51228                for (i = 0, length = array.length; i < length; i++) {
51229                    if (formatTokenFunctions[array[i]]) {
51230                        array[i] = formatTokenFunctions[array[i]];
51231                    } else {
51232                        array[i] = removeFormattingTokens(array[i]);
51233                    }
51234                }
51235
51236                return function (mom) {
51237                    var output = '',
51238                        i;
51239                    for (i = 0; i < length; i++) {
51240                        output += isFunction(array[i])
51241                            ? array[i].call(mom, format)
51242                            : array[i];
51243                    }
51244                    return output;
51245                };
51246            }
51247
51248            // format date using native date object
51249            function formatMoment(m, format) {
51250                if (!m.isValid()) {
51251                    return m.localeData().invalidDate();
51252                }
51253
51254                format = expandFormat(format, m.localeData());
51255                formatFunctions[format] =
51256                    formatFunctions[format] || makeFormatFunction(format);
51257
51258                return formatFunctions[format](m);
51259            }
51260
51261            function expandFormat(format, locale) {
51262                var i = 5;
51263
51264                function replaceLongDateFormatTokens(input) {
51265                    return locale.longDateFormat(input) || input;
51266                }
51267
51268                localFormattingTokens.lastIndex = 0;
51269                while (i >= 0 && localFormattingTokens.test(format)) {
51270                    format = format.replace(
51271                        localFormattingTokens,
51272                        replaceLongDateFormatTokens
51273                    );
51274                    localFormattingTokens.lastIndex = 0;
51275                    i -= 1;
51276                }
51277
51278                return format;
51279            }
51280
51281            var defaultLongDateFormat = {
51282                LTS: 'h:mm:ss A',
51283                LT: 'h:mm A',
51284                L: 'MM/DD/YYYY',
51285                LL: 'MMMM D, YYYY',
51286                LLL: 'MMMM D, YYYY h:mm A',
51287                LLLL: 'dddd, MMMM D, YYYY h:mm A',
51288            };
51289
51290            function longDateFormat(key) {
51291                var format = this._longDateFormat[key],
51292                    formatUpper = this._longDateFormat[key.toUpperCase()];
51293
51294                if (format || !formatUpper) {
51295                    return format;
51296                }
51297
51298                this._longDateFormat[key] = formatUpper
51299                    .match(formattingTokens)
51300                    .map(function (tok) {
51301                        if (
51302                            tok === 'MMMM' ||
51303                            tok === 'MM' ||
51304                            tok === 'DD' ||
51305                            tok === 'dddd'
51306                        ) {
51307                            return tok.slice(1);
51308                        }
51309                        return tok;
51310                    })
51311                    .join('');
51312
51313                return this._longDateFormat[key];
51314            }
51315
51316            var defaultInvalidDate = 'Invalid date';
51317
vendor: 18,008 bytes, lines 51318-51803
51318            function invalidDate() {
51319                return this._invalidDate;
51320            }
51321
51322            var defaultOrdinal = '%d',
51323                defaultDayOfMonthOrdinalParse = /\d{1,2}/;
51324
51325            function ordinal(number) {
51326                return this._ordinal.replace('%d', number);
51327            }
51328
51329            var defaultRelativeTime = {
51330                future: 'in %s',
51331                past: '%s ago',
51332                s: 'a few seconds',
51333                ss: '%d seconds',
51334                m: 'a minute',
51335                mm: '%d minutes',
51336                h: 'an hour',
51337                hh: '%d hours',
51338                d: 'a day',
51339                dd: '%d days',
51340                w: 'a week',
51341                ww: '%d weeks',
51342                M: 'a month',
51343                MM: '%d months',
51344                y: 'a year',
51345                yy: '%d years',
51346            };
51347
51348            function relativeTime(number, withoutSuffix, string, isFuture) {
51349                var output = this._relativeTime[string];
51350                return isFunction(output)
51351                    ? output(number, withoutSuffix, string, isFuture)
51352                    : output.replace(/%d/i, number);
51353            }
51354
51355            function pastFuture(diff, output) {
51356                var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
51357                return isFunction(format) ? format(output) : format.replace(/%s/i, output);
51358            }
51359
51360            var aliases = {};
51361
51362            function addUnitAlias(unit, shorthand) {
51363                var lowerCase = unit.toLowerCase();
51364                aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
51365            }
51366
51367            function normalizeUnits(units) {
51368                return typeof units === 'string'
51369                    ? aliases[units] || aliases[units.toLowerCase()]
51370                    : undefined;
51371            }
51372
51373            function normalizeObjectUnits(inputObject) {
51374                var normalizedInput = {},
51375                    normalizedProp,
51376                    prop;
51377
51378                for (prop in inputObject) {
51379                    if (hasOwnProp(inputObject, prop)) {
51380                        normalizedProp = normalizeUnits(prop);
51381                        if (normalizedProp) {
51382                            normalizedInput[normalizedProp] = inputObject[prop];
51383                        }
51384                    }
51385                }
51386
51387                return normalizedInput;
51388            }
51389
51390            var priorities = {};
51391
51392            function addUnitPriority(unit, priority) {
51393                priorities[unit] = priority;
51394            }
51395
51396            function getPrioritizedUnits(unitsObj) {
51397                var units = [],
51398                    u;
51399                for (u in unitsObj) {
51400                    if (hasOwnProp(unitsObj, u)) {
51401                        units.push({unit: u, priority: priorities[u]});
51402                    }
51403                }
51404                units.sort(function (a, b) {
51405                    return a.priority - b.priority;
51406                });
51407                return units;
51408            }
51409
51410            function isLeapYear(year) {
51411                return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
51412            }
51413
51414            function absFloor(number) {
51415                if (number < 0) {
51416                    // -0 -> 0
51417                    return Math.ceil(number) || 0;
51418                } else {
51419                    return Math.floor(number);
51420                }
51421            }
51422
51423            function toInt(argumentForCoercion) {
51424                var coercedNumber = +argumentForCoercion,
51425                    value = 0;
51426
51427                if (coercedNumber !== 0 && isFinite(coercedNumber)) {
51428                    value = absFloor(coercedNumber);
51429                }
51430
51431                return value;
51432            }
51433
51434            function makeGetSet(unit, keepTime) {
51435                return function (value) {
51436                    if (value != null) {
51437                        set$1(this, unit, value);
51438                        hooks.updateOffset(this, keepTime);
51439                        return this;
51440                    } else {
51441                        return get(this, unit);
51442                    }
51443                };
51444            }
51445
51446            function get(mom, unit) {
51447                return mom.isValid()
51448                    ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]()
51449                    : NaN;
51450            }
51451
51452            function set$1(mom, unit, value) {
51453                if (mom.isValid() && !isNaN(value)) {
51454                    if (
51455                        unit === 'FullYear' &&
51456                        isLeapYear(mom.year()) &&
51457                        mom.month() === 1 &&
51458                        mom.date() === 29
51459                    ) {
51460                        value = toInt(value);
51461                        mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](
51462                            value,
51463                            mom.month(),
51464                            daysInMonth(value, mom.month())
51465                        );
51466                    } else {
51467                        mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
51468                    }
51469                }
51470            }
51471
51472            // MOMENTS
51473
51474            function stringGet(units) {
51475                units = normalizeUnits(units);
51476                if (isFunction(this[units])) {
51477                    return this[units]();
51478                }
51479                return this;
51480            }
51481
51482            function stringSet(units, value) {
51483                if (typeof units === 'object') {
51484                    units = normalizeObjectUnits(units);
51485                    var prioritized = getPrioritizedUnits(units),
51486                        i;
51487                    for (i = 0; i < prioritized.length; i++) {
51488                        this[prioritized[i].unit](units[prioritized[i].unit]);
51489                    }
51490                } else {
51491                    units = normalizeUnits(units);
51492                    if (isFunction(this[units])) {
51493                        return this[units](value);
51494                    }
51495                }
51496                return this;
51497            }
51498
51499            var match1 = /\d/, //       0 - 9
51500                match2 = /\d\d/, //      00 - 99
51501                match3 = /\d{3}/, //     000 - 999
51502                match4 = /\d{4}/, //    0000 - 9999
51503                match6 = /[+-]?\d{6}/, // -999999 - 999999
51504                match1to2 = /\d\d?/, //       0 - 99
51505                match3to4 = /\d\d\d\d?/, //     999 - 9999
51506                match5to6 = /\d\d\d\d\d\d?/, //   99999 - 999999
51507                match1to3 = /\d{1,3}/, //       0 - 999
51508                match1to4 = /\d{1,4}/, //       0 - 9999
51509                match1to6 = /[+-]?\d{1,6}/, // -999999 - 999999
51510                matchUnsigned = /\d+/, //       0 - inf
51511                matchSigned = /[+-]?\d+/, //    -inf - inf
51512                matchOffset = /Z|[+-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z
51513                matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z
51514                matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
51515                // any word (or two) characters or numbers including two/three word month in arabic.
51516                // includes scottish gaelic two word and hyphenated months
51517                matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,
51518                regexes;
51519
51520            regexes = {};
51521
51522            function addRegexToken(token, regex, strictRegex) {
51523                regexes[token] = isFunction(regex)
51524                    ? regex
51525                    : function (isStrict, localeData) {
51526                        return isStrict && strictRegex ? strictRegex : regex;
51527                    };
51528            }
51529
51530            function getParseRegexForToken(token, config) {
51531                if (!hasOwnProp(regexes, token)) {
51532                    return new RegExp(unescapeFormat(token));
51533                }
51534
51535                return regexes[token](config._strict, config._locale);
51536            }
51537
51538            // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
51539            function unescapeFormat(s) {
51540                return regexEscape(
51541                    s
51542                        .replace('\\', '')
51543                        .replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (
51544                            matched,
51545                            p1,
51546                            p2,
51547                            p3,
51548                            p4
51549                        ) {
51550                            return p1 || p2 || p3 || p4;
51551                        })
51552                );
51553            }
51554
51555            function regexEscape(s) {
51556                return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
51557            }
51558
51559            var tokens = {};
51560
51561            function addParseToken(token, callback) {
51562                var i,
51563                    func = callback;
51564                if (typeof token === 'string') {
51565                    token = [token];
51566                }
51567                if (isNumber(callback)) {
51568                    func = function (input, array) {
51569                        array[callback] = toInt(input);
51570                    };
51571                }
51572                for (i = 0; i < token.length; i++) {
51573                    tokens[token[i]] = func;
51574                }
51575            }
51576
51577            function addWeekParseToken(token, callback) {
51578                addParseToken(token, function (input, array, config, token) {
51579                    config._w = config._w || {};
51580                    callback(input, config._w, config, token);
51581                });
51582            }
51583
51584            function addTimeToArrayFromToken(token, input, config) {
51585                if (input != null && hasOwnProp(tokens, token)) {
51586                    tokens[token](input, config._a, config, token);
51587                }
51588            }
51589
51590            var YEAR = 0,
51591                MONTH = 1,
51592                DATE = 2,
51593                HOUR = 3,
51594                MINUTE = 4,
51595                SECOND = 5,
51596                MILLISECOND = 6,
51597                WEEK = 7,
51598                WEEKDAY = 8;
51599
51600            function mod(n, x) {
51601                return ((n % x) + x) % x;
51602            }
51603
51604            var indexOf;
51605
51606            if (Array.prototype.indexOf) {
51607                indexOf = Array.prototype.indexOf;
51608            } else {
51609                indexOf = function (o) {
51610                    // I know
51611                    var i;
51612                    for (i = 0; i < this.length; ++i) {
51613                        if (this[i] === o) {
51614                            return i;
51615                        }
51616                    }
51617                    return -1;
51618                };
51619            }
51620
51621            function daysInMonth(year, month) {
51622                if (isNaN(year) || isNaN(month)) {
51623                    return NaN;
51624                }
51625                var modMonth = mod(month, 12);
51626                year += (month - modMonth) / 12;
51627                return modMonth === 1
51628                    ? isLeapYear(year)
51629                        ? 29
51630                        : 28
51631                    : 31 - ((modMonth % 7) % 2);
51632            }
51633
51634            // FORMATTING
51635
51636            addFormatToken('M', ['MM', 2], 'Mo', function () {
51637                return this.month() + 1;
51638            });
51639
51640            addFormatToken('MMM', 0, 0, function (format) {
51641                return this.localeData().monthsShort(this, format);
51642            });
51643
51644            addFormatToken('MMMM', 0, 0, function (format) {
51645                return this.localeData().months(this, format);
51646            });
51647
51648            // ALIASES
51649
51650            addUnitAlias('month', 'M');
51651
51652            // PRIORITY
51653
51654            addUnitPriority('month', 8);
51655
51656            // PARSING
51657
51658            addRegexToken('M', match1to2);
51659            addRegexToken('MM', match1to2, match2);
51660            addRegexToken('MMM', function (isStrict, locale) {
51661                return locale.monthsShortRegex(isStrict);
51662            });
51663            addRegexToken('MMMM', function (isStrict, locale) {
51664                return locale.monthsRegex(isStrict);
51665            });
51666
51667            addParseToken(['M', 'MM'], function (input, array) {
51668                array[MONTH] = toInt(input) - 1;
51669            });
51670
51671            addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
51672                var month = config._locale.monthsParse(input, token, config._strict);
51673                // if we didn't find a month name, mark the date as invalid.
51674                if (month != null) {
51675                    array[MONTH] = month;
51676                } else {
51677                    getParsingFlags(config).invalidMonth = input;
51678                }
51679            });
51680
51681            // LOCALES
51682
51683            var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
51684                    '_'
51685                ),
51686                defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split(
51687                    '_'
51688                ),
51689                MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,
51690                defaultMonthsShortRegex = matchWord,
51691                defaultMonthsRegex = matchWord;
51692
51693            function localeMonths(m, format) {
51694                if (!m) {
51695                    return isArray(this._months)
51696                        ? this._months
51697                        : this._months['standalone'];
51698                }
51699                return isArray(this._months)
51700                    ? this._months[m.month()]
51701                    : this._months[
51702                        (this._months.isFormat || MONTHS_IN_FORMAT).test(format)
51703                            ? 'format'
51704                            : 'standalone'
51705                        ][m.month()];
51706            }
51707
51708            function localeMonthsShort(m, format) {
51709                if (!m) {
51710                    return isArray(this._monthsShort)
51711                        ? this._monthsShort
51712                        : this._monthsShort['standalone'];
51713                }
51714                return isArray(this._monthsShort)
51715                    ? this._monthsShort[m.month()]
51716                    : this._monthsShort[
51717                        MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'
51718                        ][m.month()];
51719            }
51720
51721            function handleStrictParse(monthName, format, strict) {
51722                var i,
51723                    ii,
51724                    mom,
51725                    llc = monthName.toLocaleLowerCase();
51726                if (!this._monthsParse) {
51727                    // this is not used
51728                    this._monthsParse = [];
51729                    this._longMonthsParse = [];
51730                    this._shortMonthsParse = [];
51731                    for (i = 0; i < 12; ++i) {
51732                        mom = createUTC([2000, i]);
51733                        this._shortMonthsParse[i] = this.monthsShort(
51734                            mom,
51735                            ''
51736                        ).toLocaleLowerCase();
51737                        this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
51738                    }
51739                }
51740
51741                if (strict) {
51742                    if (format === 'MMM') {
51743                        ii = indexOf.call(this._shortMonthsParse, llc);
51744                        return ii !== -1 ? ii : null;
51745                    } else {
51746                        ii = indexOf.call(this._longMonthsParse, llc);
51747                        return ii !== -1 ? ii : null;
51748                    }
51749                } else {
51750                    if (format === 'MMM') {
51751                        ii = indexOf.call(this._shortMonthsParse, llc);
51752                        if (ii !== -1) {
51753                            return ii;
51754                        }
51755                        ii = indexOf.call(this._longMonthsParse, llc);
51756                        return ii !== -1 ? ii : null;
51757                    } else {
51758                        ii = indexOf.call(this._longMonthsParse, llc);
51759                        if (ii !== -1) {
51760                            return ii;
51761                        }
51762                        ii = indexOf.call(this._shortMonthsParse, llc);
51763                        return ii !== -1 ? ii : null;
51764                    }
51765                }
51766            }
51767
51768            function localeMonthsParse(monthName, format, strict) {
51769                var i, mom, regex;
51770
51771                if (this._monthsParseExact) {
51772                    return handleStrictParse.call(this, monthName, format, strict);
51773                }
51774
51775                if (!this._monthsParse) {
51776                    this._monthsParse = [];
51777                    this._longMonthsParse = [];
51778                    this._shortMonthsParse = [];
51779                }
51780
51781                // TODO: add sorting
51782                // Sorting makes sure if one month (or abbr) is a prefix of another
51783                // see sorting in computeMonthsParse
51784                for (i = 0; i < 12; i++) {
51785                    // make the regex if we don't have it already
51786                    mom = createUTC([2000, i]);
51787                    if (strict && !this._longMonthsParse[i]) {
51788                        this._longMonthsParse[i] = new RegExp(
51789                            '^' + this.months(mom, '').replace('.', '') + '$',
51790                            'i'
51791                        );
51792                        this._shortMonthsParse[i] = new RegExp(
51793                            '^' + this.monthsShort(mom, '').replace('.', '') + '$',
51794                            'i'
51795                        );
51796                    }
51797                    if (!strict && !this._monthsParse[i]) {
51798                        regex =
51799                            '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
51800                        this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
51801                    }
51802                    // test the regex
51803                    if (
vendor: 34,430 bytes, lines 51804-52717
51804                        strict &&
51805                        format === 'MMMM' &&
51806                        this._longMonthsParse[i].test(monthName)
51807                    ) {
51808                        return i;
51809                    } else if (
51810                        strict &&
51811                        format === 'MMM' &&
51812                        this._shortMonthsParse[i].test(monthName)
51813                    ) {
51814                        return i;
51815                    } else if (!strict && this._monthsParse[i].test(monthName)) {
51816                        return i;
51817                    }
51818                }
51819            }
51820
51821            // MOMENTS
51822
51823            function setMonth(mom, value) {
51824                var dayOfMonth;
51825
51826                if (!mom.isValid()) {
51827                    // No op
51828                    return mom;
51829                }
51830
51831                if (typeof value === 'string') {
51832                    if (/^\d+$/.test(value)) {
51833                        value = toInt(value);
51834                    } else {
51835                        value = mom.localeData().monthsParse(value);
51836                        // TODO: Another silent failure?
51837                        if (!isNumber(value)) {
51838                            return mom;
51839                        }
51840                    }
51841                }
51842
51843                dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
51844                mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
51845                return mom;
51846            }
51847
51848            function getSetMonth(value) {
51849                if (value != null) {
51850                    setMonth(this, value);
51851                    hooks.updateOffset(this, true);
51852                    return this;
51853                } else {
51854                    return get(this, 'Month');
51855                }
51856            }
51857
51858            function getDaysInMonth() {
51859                return daysInMonth(this.year(), this.month());
51860            }
51861
51862            function monthsShortRegex(isStrict) {
51863                if (this._monthsParseExact) {
51864                    if (!hasOwnProp(this, '_monthsRegex')) {
51865                        computeMonthsParse.call(this);
51866                    }
51867                    if (isStrict) {
51868                        return this._monthsShortStrictRegex;
51869                    } else {
51870                        return this._monthsShortRegex;
51871                    }
51872                } else {
51873                    if (!hasOwnProp(this, '_monthsShortRegex')) {
51874                        this._monthsShortRegex = defaultMonthsShortRegex;
51875                    }
51876                    return this._monthsShortStrictRegex && isStrict
51877                        ? this._monthsShortStrictRegex
51878                        : this._monthsShortRegex;
51879                }
51880            }
51881
51882            function monthsRegex(isStrict) {
51883                if (this._monthsParseExact) {
51884                    if (!hasOwnProp(this, '_monthsRegex')) {
51885                        computeMonthsParse.call(this);
51886                    }
51887                    if (isStrict) {
51888                        return this._monthsStrictRegex;
51889                    } else {
51890                        return this._monthsRegex;
51891                    }
51892                } else {
51893                    if (!hasOwnProp(this, '_monthsRegex')) {
51894                        this._monthsRegex = defaultMonthsRegex;
51895                    }
51896                    return this._monthsStrictRegex && isStrict
51897                        ? this._monthsStrictRegex
51898                        : this._monthsRegex;
51899                }
51900            }
51901
51902            function computeMonthsParse() {
51903                function cmpLenRev(a, b) {
51904                    return b.length - a.length;
51905                }
51906
51907                var shortPieces = [],
51908                    longPieces = [],
51909                    mixedPieces = [],
51910                    i,
51911                    mom;
51912                for (i = 0; i < 12; i++) {
51913                    // make the regex if we don't have it already
51914                    mom = createUTC([2000, i]);
51915                    shortPieces.push(this.monthsShort(mom, ''));
51916                    longPieces.push(this.months(mom, ''));
51917                    mixedPieces.push(this.months(mom, ''));
51918                    mixedPieces.push(this.monthsShort(mom, ''));
51919                }
51920                // Sorting makes sure if one month (or abbr) is a prefix of another it
51921                // will match the longer piece.
51922                shortPieces.sort(cmpLenRev);
51923                longPieces.sort(cmpLenRev);
51924                mixedPieces.sort(cmpLenRev);
51925                for (i = 0; i < 12; i++) {
51926                    shortPieces[i] = regexEscape(shortPieces[i]);
51927                    longPieces[i] = regexEscape(longPieces[i]);
51928                }
51929                for (i = 0; i < 24; i++) {
51930                    mixedPieces[i] = regexEscape(mixedPieces[i]);
51931                }
51932
51933                this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
51934                this._monthsShortRegex = this._monthsRegex;
51935                this._monthsStrictRegex = new RegExp(
51936                    '^(' + longPieces.join('|') + ')',
51937                    'i'
51938                );
51939                this._monthsShortStrictRegex = new RegExp(
51940                    '^(' + shortPieces.join('|') + ')',
51941                    'i'
51942                );
51943            }
51944
51945            // FORMATTING
51946
51947            addFormatToken('Y', 0, 0, function () {
51948                var y = this.year();
51949                return y <= 9999 ? zeroFill(y, 4) : '+' + y;
51950            });
51951
51952            addFormatToken(0, ['YY', 2], 0, function () {
51953                return this.year() % 100;
51954            });
51955
51956            addFormatToken(0, ['YYYY', 4], 0, 'year');
51957            addFormatToken(0, ['YYYYY', 5], 0, 'year');
51958            addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
51959
51960            // ALIASES
51961
51962            addUnitAlias('year', 'y');
51963
51964            // PRIORITIES
51965
51966            addUnitPriority('year', 1);
51967
51968            // PARSING
51969
51970            addRegexToken('Y', matchSigned);
51971            addRegexToken('YY', match1to2, match2);
51972            addRegexToken('YYYY', match1to4, match4);
51973            addRegexToken('YYYYY', match1to6, match6);
51974            addRegexToken('YYYYYY', match1to6, match6);
51975
51976            addParseToken(['YYYYY', 'YYYYYY'], YEAR);
51977            addParseToken('YYYY', function (input, array) {
51978                array[YEAR] =
51979                    input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
51980            });
51981            addParseToken('YY', function (input, array) {
51982                array[YEAR] = hooks.parseTwoDigitYear(input);
51983            });
51984            addParseToken('Y', function (input, array) {
51985                array[YEAR] = parseInt(input, 10);
51986            });
51987
51988            // HELPERS
51989
51990            function daysInYear(year) {
51991                return isLeapYear(year) ? 366 : 365;
51992            }
51993
51994            // HOOKS
51995
51996            hooks.parseTwoDigitYear = function (input) {
51997                return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
51998            };
51999
52000            // MOMENTS
52001
52002            var getSetYear = makeGetSet('FullYear', true);
52003
52004            function getIsLeapYear() {
52005                return isLeapYear(this.year());
52006            }
52007
52008            function createDate(y, m, d, h, M, s, ms) {
52009                // can't just apply() to create a date:
52010                // https://stackoverflow.com/q/181348
52011                var date;
52012                // the date constructor remaps years 0-99 to 1900-1999
52013                if (y < 100 && y >= 0) {
52014                    // preserve leap years using a full 400 year cycle, then reset
52015                    date = new Date(y + 400, m, d, h, M, s, ms);
52016                    if (isFinite(date.getFullYear())) {
52017                        date.setFullYear(y);
52018                    }
52019                } else {
52020                    date = new Date(y, m, d, h, M, s, ms);
52021                }
52022
52023                return date;
52024            }
52025
52026            function createUTCDate(y) {
52027                var date, args;
52028                // the Date.UTC function remaps years 0-99 to 1900-1999
52029                if (y < 100 && y >= 0) {
52030                    args = Array.prototype.slice.call(arguments);
52031                    // preserve leap years using a full 400 year cycle, then reset
52032                    args[0] = y + 400;
52033                    date = new Date(Date.UTC.apply(null, args));
52034                    if (isFinite(date.getUTCFullYear())) {
52035                        date.setUTCFullYear(y);
52036                    }
52037                } else {
52038                    date = new Date(Date.UTC.apply(null, arguments));
52039                }
52040
52041                return date;
52042            }
52043
52044            // start-of-first-week - start-of-year
52045            function firstWeekOffset(year, dow, doy) {
52046                var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
52047                    fwd = 7 + dow - doy,
52048                    // first-week day local weekday -- which local weekday is fwd
52049                    fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
52050
52051                return -fwdlw + fwd - 1;
52052            }
52053
52054            // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
52055            function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
52056                var localWeekday = (7 + weekday - dow) % 7,
52057                    weekOffset = firstWeekOffset(year, dow, doy),
52058                    dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
52059                    resYear,
52060                    resDayOfYear;
52061
52062                if (dayOfYear <= 0) {
52063                    resYear = year - 1;
52064                    resDayOfYear = daysInYear(resYear) + dayOfYear;
52065                } else if (dayOfYear > daysInYear(year)) {
52066                    resYear = year + 1;
52067                    resDayOfYear = dayOfYear - daysInYear(year);
52068                } else {
52069                    resYear = year;
52070                    resDayOfYear = dayOfYear;
52071                }
52072
52073                return {
52074                    year: resYear,
52075                    dayOfYear: resDayOfYear,
52076                };
52077            }
52078
52079            function weekOfYear(mom, dow, doy) {
52080                var weekOffset = firstWeekOffset(mom.year(), dow, doy),
52081                    week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
52082                    resWeek,
52083                    resYear;
52084
52085                if (week < 1) {
52086                    resYear = mom.year() - 1;
52087                    resWeek = week + weeksInYear(resYear, dow, doy);
52088                } else if (week > weeksInYear(mom.year(), dow, doy)) {
52089                    resWeek = week - weeksInYear(mom.year(), dow, doy);
52090                    resYear = mom.year() + 1;
52091                } else {
52092                    resYear = mom.year();
52093                    resWeek = week;
52094                }
52095
52096                return {
52097                    week: resWeek,
52098                    year: resYear,
52099                };
52100            }
52101
52102            function weeksInYear(year, dow, doy) {
52103                var weekOffset = firstWeekOffset(year, dow, doy),
52104                    weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
52105                return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
52106            }
52107
52108            // FORMATTING
52109
52110            addFormatToken('w', ['ww', 2], 'wo', 'week');
52111            addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
52112
52113            // ALIASES
52114
52115            addUnitAlias('week', 'w');
52116            addUnitAlias('isoWeek', 'W');
52117
52118            // PRIORITIES
52119
52120            addUnitPriority('week', 5);
52121            addUnitPriority('isoWeek', 5);
52122
52123            // PARSING
52124
52125            addRegexToken('w', match1to2);
52126            addRegexToken('ww', match1to2, match2);
52127            addRegexToken('W', match1to2);
52128            addRegexToken('WW', match1to2, match2);
52129
52130            addWeekParseToken(['w', 'ww', 'W', 'WW'], function (
52131                input,
52132                week,
52133                config,
52134                token
52135            ) {
52136                week[token.substr(0, 1)] = toInt(input);
52137            });
52138
52139            // HELPERS
52140
52141            // LOCALES
52142
52143            function localeWeek(mom) {
52144                return weekOfYear(mom, this._week.dow, this._week.doy).week;
52145            }
52146
52147            var defaultLocaleWeek = {
52148                dow: 0, // Sunday is the first day of the week.
52149                doy: 6, // The week that contains Jan 6th is the first week of the year.
52150            };
52151
52152            function localeFirstDayOfWeek() {
52153                return this._week.dow;
52154            }
52155
52156            function localeFirstDayOfYear() {
52157                return this._week.doy;
52158            }
52159
52160            // MOMENTS
52161
52162            function getSetWeek(input) {
52163                var week = this.localeData().week(this);
52164                return input == null ? week : this.add((input - week) * 7, 'd');
52165            }
52166
52167            function getSetISOWeek(input) {
52168                var week = weekOfYear(this, 1, 4).week;
52169                return input == null ? week : this.add((input - week) * 7, 'd');
52170            }
52171
52172            // FORMATTING
52173
52174            addFormatToken('d', 0, 'do', 'day');
52175
52176            addFormatToken('dd', 0, 0, function (format) {
52177                return this.localeData().weekdaysMin(this, format);
52178            });
52179
52180            addFormatToken('ddd', 0, 0, function (format) {
52181                return this.localeData().weekdaysShort(this, format);
52182            });
52183
52184            addFormatToken('dddd', 0, 0, function (format) {
52185                return this.localeData().weekdays(this, format);
52186            });
52187
52188            addFormatToken('e', 0, 0, 'weekday');
52189            addFormatToken('E', 0, 0, 'isoWeekday');
52190
52191            // ALIASES
52192
52193            addUnitAlias('day', 'd');
52194            addUnitAlias('weekday', 'e');
52195            addUnitAlias('isoWeekday', 'E');
52196
52197            // PRIORITY
52198            addUnitPriority('day', 11);
52199            addUnitPriority('weekday', 11);
52200            addUnitPriority('isoWeekday', 11);
52201
52202            // PARSING
52203
52204            addRegexToken('d', match1to2);
52205            addRegexToken('e', match1to2);
52206            addRegexToken('E', match1to2);
52207            addRegexToken('dd', function (isStrict, locale) {
52208                return locale.weekdaysMinRegex(isStrict);
52209            });
52210            addRegexToken('ddd', function (isStrict, locale) {
52211                return locale.weekdaysShortRegex(isStrict);
52212            });
52213            addRegexToken('dddd', function (isStrict, locale) {
52214                return locale.weekdaysRegex(isStrict);
52215            });
52216
52217            addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
52218                var weekday = config._locale.weekdaysParse(input, token, config._strict);
52219                // if we didn't get a weekday name, mark the date as invalid
52220                if (weekday != null) {
52221                    week.d = weekday;
52222                } else {
52223                    getParsingFlags(config).invalidWeekday = input;
52224                }
52225            });
52226
52227            addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
52228                week[token] = toInt(input);
52229            });
52230
52231            // HELPERS
52232
52233            function parseWeekday(input, locale) {
52234                if (typeof input !== 'string') {
52235                    return input;
52236                }
52237
52238                if (!isNaN(input)) {
52239                    return parseInt(input, 10);
52240                }
52241
52242                input = locale.weekdaysParse(input);
52243                if (typeof input === 'number') {
52244                    return input;
52245                }
52246
52247                return null;
52248            }
52249
52250            function parseIsoWeekday(input, locale) {
52251                if (typeof input === 'string') {
52252                    return locale.weekdaysParse(input) % 7 || 7;
52253                }
52254                return isNaN(input) ? null : input;
52255            }
52256
52257            // LOCALES
52258            function shiftWeekdays(ws, n) {
52259                return ws.slice(n, 7).concat(ws.slice(0, n));
52260            }
52261
52262            var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
52263                    '_'
52264                ),
52265                defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
52266                defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
52267                defaultWeekdaysRegex = matchWord,
52268                defaultWeekdaysShortRegex = matchWord,
52269                defaultWeekdaysMinRegex = matchWord;
52270
52271            function localeWeekdays(m, format) {
52272                var weekdays = isArray(this._weekdays)
52273                    ? this._weekdays
52274                    : this._weekdays[
52275                        m && m !== true && this._weekdays.isFormat.test(format)
52276                            ? 'format'
52277                            : 'standalone'
52278                        ];
52279                return m === true
52280                    ? shiftWeekdays(weekdays, this._week.dow)
52281                    : m
52282                        ? weekdays[m.day()]
52283                        : weekdays;
52284            }
52285
52286            function localeWeekdaysShort(m) {
52287                return m === true
52288                    ? shiftWeekdays(this._weekdaysShort, this._week.dow)
52289                    : m
52290                        ? this._weekdaysShort[m.day()]
52291                        : this._weekdaysShort;
52292            }
52293
52294            function localeWeekdaysMin(m) {
52295                return m === true
52296                    ? shiftWeekdays(this._weekdaysMin, this._week.dow)
52297                    : m
52298                        ? this._weekdaysMin[m.day()]
52299                        : this._weekdaysMin;
52300            }
52301
52302            function handleStrictParse$1(weekdayName, format, strict) {
52303                var i,
52304                    ii,
52305                    mom,
52306                    llc = weekdayName.toLocaleLowerCase();
52307                if (!this._weekdaysParse) {
52308                    this._weekdaysParse = [];
52309                    this._shortWeekdaysParse = [];
52310                    this._minWeekdaysParse = [];
52311
52312                    for (i = 0; i < 7; ++i) {
52313                        mom = createUTC([2000, 1]).day(i);
52314                        this._minWeekdaysParse[i] = this.weekdaysMin(
52315                            mom,
52316                            ''
52317                        ).toLocaleLowerCase();
52318                        this._shortWeekdaysParse[i] = this.weekdaysShort(
52319                            mom,
52320                            ''
52321                        ).toLocaleLowerCase();
52322                        this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
52323                    }
52324                }
52325
52326                if (strict) {
52327                    if (format === 'dddd') {
52328                        ii = indexOf.call(this._weekdaysParse, llc);
52329                        return ii !== -1 ? ii : null;
52330                    } else if (format === 'ddd') {
52331                        ii = indexOf.call(this._shortWeekdaysParse, llc);
52332                        return ii !== -1 ? ii : null;
52333                    } else {
52334                        ii = indexOf.call(this._minWeekdaysParse, llc);
52335                        return ii !== -1 ? ii : null;
52336                    }
52337                } else {
52338                    if (format === 'dddd') {
52339                        ii = indexOf.call(this._weekdaysParse, llc);
52340                        if (ii !== -1) {
52341                            return ii;
52342                        }
52343                        ii = indexOf.call(this._shortWeekdaysParse, llc);
52344                        if (ii !== -1) {
52345                            return ii;
52346                        }
52347                        ii = indexOf.call(this._minWeekdaysParse, llc);
52348                        return ii !== -1 ? ii : null;
52349                    } else if (format === 'ddd') {
52350                        ii = indexOf.call(this._shortWeekdaysParse, llc);
52351                        if (ii !== -1) {
52352                            return ii;
52353                        }
52354                        ii = indexOf.call(this._weekdaysParse, llc);
52355                        if (ii !== -1) {
52356                            return ii;
52357                        }
52358                        ii = indexOf.call(this._minWeekdaysParse, llc);
52359                        return ii !== -1 ? ii : null;
52360                    } else {
52361                        ii = indexOf.call(this._minWeekdaysParse, llc);
52362                        if (ii !== -1) {
52363                            return ii;
52364                        }
52365                        ii = indexOf.call(this._weekdaysParse, llc);
52366                        if (ii !== -1) {
52367                            return ii;
52368                        }
52369                        ii = indexOf.call(this._shortWeekdaysParse, llc);
52370                        return ii !== -1 ? ii : null;
52371                    }
52372                }
52373            }
52374
52375            function localeWeekdaysParse(weekdayName, format, strict) {
52376                var i, mom, regex;
52377
52378                if (this._weekdaysParseExact) {
52379                    return handleStrictParse$1.call(this, weekdayName, format, strict);
52380                }
52381
52382                if (!this._weekdaysParse) {
52383                    this._weekdaysParse = [];
52384                    this._minWeekdaysParse = [];
52385                    this._shortWeekdaysParse = [];
52386                    this._fullWeekdaysParse = [];
52387                }
52388
52389                for (i = 0; i < 7; i++) {
52390                    // make the regex if we don't have it already
52391
52392                    mom = createUTC([2000, 1]).day(i);
52393                    if (strict && !this._fullWeekdaysParse[i]) {
52394                        this._fullWeekdaysParse[i] = new RegExp(
52395                            '^' + this.weekdays(mom, '').replace('.', '\\.?') + '$',
52396                            'i'
52397                        );
52398                        this._shortWeekdaysParse[i] = new RegExp(
52399                            '^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$',
52400                            'i'
52401                        );
52402                        this._minWeekdaysParse[i] = new RegExp(
52403                            '^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$',
52404                            'i'
52405                        );
52406                    }
52407                    if (!this._weekdaysParse[i]) {
52408                        regex =
52409                            '^' +
52410                            this.weekdays(mom, '') +
52411                            '|^' +
52412                            this.weekdaysShort(mom, '') +
52413                            '|^' +
52414                            this.weekdaysMin(mom, '');
52415                        this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
52416                    }
52417                    // test the regex
52418                    if (
52419                        strict &&
52420                        format === 'dddd' &&
52421                        this._fullWeekdaysParse[i].test(weekdayName)
52422                    ) {
52423                        return i;
52424                    } else if (
52425                        strict &&
52426                        format === 'ddd' &&
52427                        this._shortWeekdaysParse[i].test(weekdayName)
52428                    ) {
52429                        return i;
52430                    } else if (
52431                        strict &&
52432                        format === 'dd' &&
52433                        this._minWeekdaysParse[i].test(weekdayName)
52434                    ) {
52435                        return i;
52436                    } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
52437                        return i;
52438                    }
52439                }
52440            }
52441
52442            // MOMENTS
52443
52444            function getSetDayOfWeek(input) {
52445                if (!this.isValid()) {
52446                    return input != null ? this : NaN;
52447                }
52448                var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
52449                if (input != null) {
52450                    input = parseWeekday(input, this.localeData());
52451                    return this.add(input - day, 'd');
52452                } else {
52453                    return day;
52454                }
52455            }
52456
52457            function getSetLocaleDayOfWeek(input) {
52458                if (!this.isValid()) {
52459                    return input != null ? this : NaN;
52460                }
52461                var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
52462                return input == null ? weekday : this.add(input - weekday, 'd');
52463            }
52464
52465            function getSetISODayOfWeek(input) {
52466                if (!this.isValid()) {
52467                    return input != null ? this : NaN;
52468                }
52469
52470                // behaves the same as moment#day except
52471                // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
52472                // as a setter, sunday should belong to the previous week.
52473
52474                if (input != null) {
52475                    var weekday = parseIsoWeekday(input, this.localeData());
52476                    return this.day(this.day() % 7 ? weekday : weekday - 7);
52477                } else {
52478                    return this.day() || 7;
52479                }
52480            }
52481
52482            function weekdaysRegex(isStrict) {
52483                if (this._weekdaysParseExact) {
52484                    if (!hasOwnProp(this, '_weekdaysRegex')) {
52485                        computeWeekdaysParse.call(this);
52486                    }
52487                    if (isStrict) {
52488                        return this._weekdaysStrictRegex;
52489                    } else {
52490                        return this._weekdaysRegex;
52491                    }
52492                } else {
52493                    if (!hasOwnProp(this, '_weekdaysRegex')) {
52494                        this._weekdaysRegex = defaultWeekdaysRegex;
52495                    }
52496                    return this._weekdaysStrictRegex && isStrict
52497                        ? this._weekdaysStrictRegex
52498                        : this._weekdaysRegex;
52499                }
52500            }
52501
52502            function weekdaysShortRegex(isStrict) {
52503                if (this._weekdaysParseExact) {
52504                    if (!hasOwnProp(this, '_weekdaysRegex')) {
52505                        computeWeekdaysParse.call(this);
52506                    }
52507                    if (isStrict) {
52508                        return this._weekdaysShortStrictRegex;
52509                    } else {
52510                        return this._weekdaysShortRegex;
52511                    }
52512                } else {
52513                    if (!hasOwnProp(this, '_weekdaysShortRegex')) {
52514                        this._weekdaysShortRegex = defaultWeekdaysShortRegex;
52515                    }
52516                    return this._weekdaysShortStrictRegex && isStrict
52517                        ? this._weekdaysShortStrictRegex
52518                        : this._weekdaysShortRegex;
52519                }
52520            }
52521
52522            function weekdaysMinRegex(isStrict) {
52523                if (this._weekdaysParseExact) {
52524                    if (!hasOwnProp(this, '_weekdaysRegex')) {
52525                        computeWeekdaysParse.call(this);
52526                    }
52527                    if (isStrict) {
52528                        return this._weekdaysMinStrictRegex;
52529                    } else {
52530                        return this._weekdaysMinRegex;
52531                    }
52532                } else {
52533                    if (!hasOwnProp(this, '_weekdaysMinRegex')) {
52534                        this._weekdaysMinRegex = defaultWeekdaysMinRegex;
52535                    }
52536                    return this._weekdaysMinStrictRegex && isStrict
52537                        ? this._weekdaysMinStrictRegex
52538                        : this._weekdaysMinRegex;
52539                }
52540            }
52541
52542            function computeWeekdaysParse() {
52543                function cmpLenRev(a, b) {
52544                    return b.length - a.length;
52545                }
52546
52547                var minPieces = [],
52548                    shortPieces = [],
52549                    longPieces = [],
52550                    mixedPieces = [],
52551                    i,
52552                    mom,
52553                    minp,
52554                    shortp,
52555                    longp;
52556                for (i = 0; i < 7; i++) {
52557                    // make the regex if we don't have it already
52558                    mom = createUTC([2000, 1]).day(i);
52559                    minp = regexEscape(this.weekdaysMin(mom, ''));
52560                    shortp = regexEscape(this.weekdaysShort(mom, ''));
52561                    longp = regexEscape(this.weekdays(mom, ''));
52562                    minPieces.push(minp);
52563                    shortPieces.push(shortp);
52564                    longPieces.push(longp);
52565                    mixedPieces.push(minp);
52566                    mixedPieces.push(shortp);
52567                    mixedPieces.push(longp);
52568                }
52569                // Sorting makes sure if one weekday (or abbr) is a prefix of another it
52570                // will match the longer piece.
52571                minPieces.sort(cmpLenRev);
52572                shortPieces.sort(cmpLenRev);
52573                longPieces.sort(cmpLenRev);
52574                mixedPieces.sort(cmpLenRev);
52575
52576                this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
52577                this._weekdaysShortRegex = this._weekdaysRegex;
52578                this._weekdaysMinRegex = this._weekdaysRegex;
52579
52580                this._weekdaysStrictRegex = new RegExp(
52581                    '^(' + longPieces.join('|') + ')',
52582                    'i'
52583                );
52584                this._weekdaysShortStrictRegex = new RegExp(
52585                    '^(' + shortPieces.join('|') + ')',
52586                    'i'
52587                );
52588                this._weekdaysMinStrictRegex = new RegExp(
52589                    '^(' + minPieces.join('|') + ')',
52590                    'i'
52591                );
52592            }
52593
52594            // FORMATTING
52595
52596            function hFormat() {
52597                return this.hours() % 12 || 12;
52598            }
52599
52600            function kFormat() {
52601                return this.hours() || 24;
52602            }
52603
52604            addFormatToken('H', ['HH', 2], 0, 'hour');
52605            addFormatToken('h', ['hh', 2], 0, hFormat);
52606            addFormatToken('k', ['kk', 2], 0, kFormat);
52607
52608            addFormatToken('hmm', 0, 0, function () {
52609                return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
52610            });
52611
52612            addFormatToken('hmmss', 0, 0, function () {
52613                return (
52614                    '' +
52615                    hFormat.apply(this) +
52616                    zeroFill(this.minutes(), 2) +
52617                    zeroFill(this.seconds(), 2)
52618                );
52619            });
52620
52621            addFormatToken('Hmm', 0, 0, function () {
52622                return '' + this.hours() + zeroFill(this.minutes(), 2);
52623            });
52624
52625            addFormatToken('Hmmss', 0, 0, function () {
52626                return (
52627                    '' +
52628                    this.hours() +
52629                    zeroFill(this.minutes(), 2) +
52630                    zeroFill(this.seconds(), 2)
52631                );
52632            });
52633
52634            function meridiem(token, lowercase) {
52635                addFormatToken(token, 0, 0, function () {
52636                    return this.localeData().meridiem(
52637                        this.hours(),
52638                        this.minutes(),
52639                        lowercase
52640                    );
52641                });
52642            }
52643
52644            meridiem('a', true);
52645            meridiem('A', false);
52646
52647            // ALIASES
52648
52649            addUnitAlias('hour', 'h');
52650
52651            // PRIORITY
52652            addUnitPriority('hour', 13);
52653
52654            // PARSING
52655
52656            function matchMeridiem(isStrict, locale) {
52657                return locale._meridiemParse;
52658            }
52659
52660            addRegexToken('a', matchMeridiem);
52661            addRegexToken('A', matchMeridiem);
52662            addRegexToken('H', match1to2);
52663            addRegexToken('h', match1to2);
52664            addRegexToken('k', match1to2);
52665            addRegexToken('HH', match1to2, match2);
52666            addRegexToken('hh', match1to2, match2);
52667            addRegexToken('kk', match1to2, match2);
52668
52669            addRegexToken('hmm', match3to4);
52670            addRegexToken('hmmss', match5to6);
52671            addRegexToken('Hmm', match3to4);
52672            addRegexToken('Hmmss', match5to6);
52673
52674            addParseToken(['H', 'HH'], HOUR);
52675            addParseToken(['k', 'kk'], function (input, array, config) {
52676                var kInput = toInt(input);
52677                array[HOUR] = kInput === 24 ? 0 : kInput;
52678            });
52679            addParseToken(['a', 'A'], function (input, array, config) {
52680                config._isPm = config._locale.isPM(input);
52681                config._meridiem = input;
52682            });
52683            addParseToken(['h', 'hh'], function (input, array, config) {
52684                array[HOUR] = toInt(input);
52685                getParsingFlags(config).bigHour = true;
52686            });
52687            addParseToken('hmm', function (input, array, config) {
52688                var pos = input.length - 2;
52689                array[HOUR] = toInt(input.substr(0, pos));
52690                array[MINUTE] = toInt(input.substr(pos));
52691                getParsingFlags(config).bigHour = true;
52692            });
52693            addParseToken('hmmss', function (input, array, config) {
52694                var pos1 = input.length - 4,
52695                    pos2 = input.length - 2;
52696                array[HOUR] = toInt(input.substr(0, pos1));
52697                array[MINUTE] = toInt(input.substr(pos1, 2));
52698                array[SECOND] = toInt(input.substr(pos2));
52699                getParsingFlags(config).bigHour = true;
52700            });
52701            addParseToken('Hmm', function (input, array, config) {
52702                var pos = input.length - 2;
52703                array[HOUR] = toInt(input.substr(0, pos));
52704                array[MINUTE] = toInt(input.substr(pos));
52705            });
52706            addParseToken('Hmmss', function (input, array, config) {
52707                var pos1 = input.length - 4,
52708                    pos2 = input.length - 2;
52709                array[HOUR] = toInt(input.substr(0, pos1));
52710                array[MINUTE] = toInt(input.substr(pos1, 2));
52711                array[SECOND] = toInt(input.substr(pos2));
52712            });
52713
52714            // LOCALES
52715
52716            function localeIsPM(input) {
52717                // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing str
vendor: 20,055 bytes, lines 52717-53193
52717ings like arrays
52718                // Using charAt should be more compatible.
52719                return (input + '').toLowerCase().charAt(0) === 'p';
52720            }
52721
52722            var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i,
52723                // Setting the hour should keep the time, because the user explicitly
52724                // specified which hour they want. So trying to maintain the same hour (in
52725                // a new timezone) makes sense. Adding/subtracting hours does not follow
52726                // this rule.
52727                getSetHour = makeGetSet('Hours', true);
52728
52729            function localeMeridiem(hours, minutes, isLower) {
52730                if (hours > 11) {
52731                    return isLower ? 'pm' : 'PM';
52732                } else {
52733                    return isLower ? 'am' : 'AM';
52734                }
52735            }
52736
52737            var baseConfig = {
52738                calendar: defaultCalendar,
52739                longDateFormat: defaultLongDateFormat,
52740                invalidDate: defaultInvalidDate,
52741                ordinal: defaultOrdinal,
52742                dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
52743                relativeTime: defaultRelativeTime,
52744
52745                months: defaultLocaleMonths,
52746                monthsShort: defaultLocaleMonthsShort,
52747
52748                week: defaultLocaleWeek,
52749
52750                weekdays: defaultLocaleWeekdays,
52751                weekdaysMin: defaultLocaleWeekdaysMin,
52752                weekdaysShort: defaultLocaleWeekdaysShort,
52753
52754                meridiemParse: defaultLocaleMeridiemParse,
52755            };
52756
52757            // internal storage for locale config files
52758            var locales = {},
52759                localeFamilies = {},
52760                globalLocale;
52761
52762            function commonPrefix(arr1, arr2) {
52763                var i,
52764                    minl = Math.min(arr1.length, arr2.length);
52765                for (i = 0; i < minl; i += 1) {
52766                    if (arr1[i] !== arr2[i]) {
52767                        return i;
52768                    }
52769                }
52770                return minl;
52771            }
52772
52773            function normalizeLocale(key) {
52774                return key ? key.toLowerCase().replace('_', '-') : key;
52775            }
52776
52777            // pick the locale from the array
52778            // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
52779            // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
52780            function chooseLocale(names) {
52781                var i = 0,
52782                    j,
52783                    next,
52784                    locale,
52785                    split;
52786
52787                while (i < names.length) {
52788                    split = normalizeLocale(names[i]).split('-');
52789                    j = split.length;
52790                    next = normalizeLocale(names[i + 1]);
52791                    next = next ? next.split('-') : null;
52792                    while (j > 0) {
52793                        locale = loadLocale(split.slice(0, j).join('-'));
52794                        if (locale) {
52795                            return locale;
52796                        }
52797                        if (
52798                            next &&
52799                            next.length >= j &&
52800                            commonPrefix(split, next) >= j - 1
52801                        ) {
52802                            //the next array item is better than a shallower substring of this one
52803                            break;
52804                        }
52805                        j--;
52806                    }
52807                    i++;
52808                }
52809                return globalLocale;
52810            }
52811
52812            function loadLocale(name) {
52813                var oldLocale = null,
52814                    aliasedRequire;
52815                // TODO: Find a better way to register and load all the locales in Node
52816                if (
52817                    locales[name] === undefined &&
52818                    typeof module !== 'undefined' &&
52819                    module &&
52820                    module.exports
52821                ) {
52822                    try {
52823                        oldLocale = globalLocale._abbr;
52824                        aliasedRequire = require;
52825                        aliasedRequire('./locale/' + name);
52826                        getSetGlobalLocale(oldLocale);
52827                    } catch (e) {
52828                        // mark as not found to avoid repeating expensive file require call causing high CPU
52829                        // when trying to find en-US, en_US, en-us for every format call
52830                        locales[name] = null; // null means not found
52831                    }
52832                }
52833                return locales[name];
52834            }
52835
52836            // This function will load locale and then set the global locale.  If
52837            // no arguments are passed in, it will simply return the current global
52838            // locale key.
52839            function getSetGlobalLocale(key, values) {
52840                var data;
52841                if (key) {
52842                    if (isUndefined(values)) {
52843                        data = getLocale(key);
52844                    } else {
52845                        data = defineLocale(key, values);
52846                    }
52847
52848                    if (data) {
52849                        // moment.duration._locale = moment._locale = data;
52850                        globalLocale = data;
52851                    } else {
52852                        if (typeof console !== 'undefined' && console.warn) {
52853                            //warn user if arguments are passed but the locale could not be set
52854                            console.warn(
52855                                'Locale ' + key + ' not found. Did you forget to load it?'
52856                            );
52857                        }
52858                    }
52859                }
52860
52861                return globalLocale._abbr;
52862            }
52863
52864            function defineLocale(name, config) {
52865                if (config !== null) {
52866                    var locale,
52867                        parentConfig = baseConfig;
52868                    config.abbr = name;
52869                    if (locales[name] != null) {
52870                        deprecateSimple(
52871                            'defineLocaleOverride',
52872                            'use moment.updateLocale(localeName, config) to change ' +
52873                            'an existing locale. moment.defineLocale(localeName, ' +
52874                            'config) should only be used for creating a new locale ' +
52875                            'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'
52876                        );
52877                        parentConfig = locales[name]._config;
52878                    } else if (config.parentLocale != null) {
52879                        if (locales[config.parentLocale] != null) {
52880                            parentConfig = locales[config.parentLocale]._config;
52881                        } else {
52882                            locale = loadLocale(config.parentLocale);
52883                            if (locale != null) {
52884                                parentConfig = locale._config;
52885                            } else {
52886                                if (!localeFamilies[config.parentLocale]) {
52887                                    localeFamilies[config.parentLocale] = [];
52888                                }
52889                                localeFamilies[config.parentLocale].push({
52890                                    name: name,
52891                                    config: config,
52892                                });
52893                                return null;
52894                            }
52895                        }
52896                    }
52897                    locales[name] = new Locale(mergeConfigs(parentConfig, config));
52898
52899                    if (localeFamilies[name]) {
52900                        localeFamilies[name].forEach(function (x) {
52901                            defineLocale(x.name, x.config);
52902                        });
52903                    }
52904
52905                    // backwards compat for now: also set the locale
52906                    // make sure we set the locale AFTER all child locales have been
52907                    // created, so we won't end up with the child locale set.
52908                    getSetGlobalLocale(name);
52909
52910                    return locales[name];
52911                } else {
52912                    // useful for testing
52913                    delete locales[name];
52914                    return null;
52915                }
52916            }
52917
52918            function updateLocale(name, config) {
52919                if (config != null) {
52920                    var locale,
52921                        tmpLocale,
52922                        parentConfig = baseConfig;
52923
52924                    if (locales[name] != null && locales[name].parentLocale != null) {
52925                        // Update existing child locale in-place to avoid memory-leaks
52926                        locales[name].set(mergeConfigs(locales[name]._config, config));
52927                    } else {
52928                        // MERGE
52929                        tmpLocale = loadLocale(name);
52930                        if (tmpLocale != null) {
52931                            parentConfig = tmpLocale._config;
52932                        }
52933                        config = mergeConfigs(parentConfig, config);
52934                        if (tmpLocale == null) {
52935                            // updateLocale is called for creating a new locale
52936                            // Set abbr so it will have a name (getters return
52937                            // undefined otherwise).
52938                            config.abbr = name;
52939                        }
52940                        locale = new Locale(config);
52941                        locale.parentLocale = locales[name];
52942                        locales[name] = locale;
52943                    }
52944
52945                    // backwards compat for now: also set the locale
52946                    getSetGlobalLocale(name);
52947                } else {
52948                    // pass null for config to unupdate, useful for tests
52949                    if (locales[name] != null) {
52950                        if (locales[name].parentLocale != null) {
52951                            locales[name] = locales[name].parentLocale;
52952                            if (name === getSetGlobalLocale()) {
52953                                getSetGlobalLocale(name);
52954                            }
52955                        } else if (locales[name] != null) {
52956                            delete locales[name];
52957                        }
52958                    }
52959                }
52960                return locales[name];
52961            }
52962
52963            // returns locale data
52964            function getLocale(key) {
52965                var locale;
52966
52967                if (key && key._locale && key._locale._abbr) {
52968                    key = key._locale._abbr;
52969                }
52970
52971                if (!key) {
52972                    return globalLocale;
52973                }
52974
52975                if (!isArray(key)) {
52976                    //short-circuit everything else
52977                    locale = loadLocale(key);
52978                    if (locale) {
52979                        return locale;
52980                    }
52981                    key = [key];
52982                }
52983
52984                return chooseLocale(key);
52985            }
52986
52987            function listLocales() {
52988                return keys(locales);
52989            }
52990
52991            function checkOverflow(m) {
52992                var overflow,
52993                    a = m._a;
52994
52995                if (a && getParsingFlags(m).overflow === -2) {
52996                    overflow =
52997                        a[MONTH] < 0 || a[MONTH] > 11
52998                            ? MONTH
52999                            : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH])
53000                                ? DATE
53001                                : a[HOUR] < 0 ||
53002                                a[HOUR] > 24 ||
53003                                (a[HOUR] === 24 &&
53004                                    (a[MINUTE] !== 0 ||
53005                                        a[SECOND] !== 0 ||
53006                                        a[MILLISECOND] !== 0))
53007                                    ? HOUR
53008                                    : a[MINUTE] < 0 || a[MINUTE] > 59
53009                                        ? MINUTE
53010                                        : a[SECOND] < 0 || a[SECOND] > 59
53011                                            ? SECOND
53012                                            : a[MILLISECOND] < 0 || a[MILLISECOND] > 999
53013                                                ? MILLISECOND
53014                                                : -1;
53015
53016                    if (
53017                        getParsingFlags(m)._overflowDayOfYear &&
53018                        (overflow < YEAR || overflow > DATE)
53019                    ) {
53020                        overflow = DATE;
53021                    }
53022                    if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
53023                        overflow = WEEK;
53024                    }
53025                    if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
53026                        overflow = WEEKDAY;
53027                    }
53028
53029                    getParsingFlags(m).overflow = overflow;
53030                }
53031
53032                return m;
53033            }
53034
53035            // iso 8601 regex
53036            // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
53037            var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
53038                basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
53039                tzRegex = /Z|[+-]\d\d(?::?\d\d)?/,
53040                isoDates = [
53041                    ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
53042                    ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
53043                    ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
53044                    ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
53045                    ['YYYY-DDD', /\d{4}-\d{3}/],
53046                    ['YYYY-MM', /\d{4}-\d\d/, false],
53047                    ['YYYYYYMMDD', /[+-]\d{10}/],
53048                    ['YYYYMMDD', /\d{8}/],
53049                    ['GGGG[W]WWE', /\d{4}W\d{3}/],
53050                    ['GGGG[W]WW', /\d{4}W\d{2}/, false],
53051                    ['YYYYDDD', /\d{7}/],
53052                    ['YYYYMM', /\d{6}/, false],
53053                    ['YYYY', /\d{4}/, false],
53054                ],
53055                // iso time formats and regexes
53056                isoTimes = [
53057                    ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
53058                    ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
53059                    ['HH:mm:ss', /\d\d:\d\d:\d\d/],
53060                    ['HH:mm', /\d\d:\d\d/],
53061                    ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
53062                    ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
53063                    ['HHmmss', /\d\d\d\d\d\d/],
53064                    ['HHmm', /\d\d\d\d/],
53065                    ['HH', /\d\d/],
53066                ],
53067                aspNetJsonRegex = /^\/?Date\((-?\d+)/i,
53068                // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
53069                rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,
53070                obsOffsets = {
53071                    UT: 0,
53072                    GMT: 0,
53073                    EDT: -4 * 60,
53074                    EST: -5 * 60,
53075                    CDT: -5 * 60,
53076                    CST: -6 * 60,
53077                    MDT: -6 * 60,
53078                    MST: -7 * 60,
53079                    PDT: -7 * 60,
53080                    PST: -8 * 60,
53081                };
53082
53083            // date from iso format
53084            function configFromISO(config) {
53085                var i,
53086                    l,
53087                    string = config._i,
53088                    match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
53089                    allowTime,
53090                    dateFormat,
53091                    timeFormat,
53092                    tzFormat;
53093
53094                if (match) {
53095                    getParsingFlags(config).iso = true;
53096
53097                    for (i = 0, l = isoDates.length; i < l; i++) {
53098                        if (isoDates[i][1].exec(match[1])) {
53099                            dateFormat = isoDates[i][0];
53100                            allowTime = isoDates[i][2] !== false;
53101                            break;
53102                        }
53103                    }
53104                    if (dateFormat == null) {
53105                        config._isValid = false;
53106                        return;
53107                    }
53108                    if (match[3]) {
53109                        for (i = 0, l = isoTimes.length; i < l; i++) {
53110                            if (isoTimes[i][1].exec(match[3])) {
53111                                // match[2] should be 'T' or space
53112                                timeFormat = (match[2] || ' ') + isoTimes[i][0];
53113                                break;
53114                            }
53115                        }
53116                        if (timeFormat == null) {
53117                            config._isValid = false;
53118                            return;
53119                        }
53120                    }
53121                    if (!allowTime && timeFormat != null) {
53122                        config._isValid = false;
53123                        return;
53124                    }
53125                    if (match[4]) {
53126                        if (tzRegex.exec(match[4])) {
53127                            tzFormat = 'Z';
53128                        } else {
53129                            config._isValid = false;
53130                            return;
53131                        }
53132                    }
53133                    config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
53134                    configFromStringAndFormat(config);
53135                } else {
53136                    config._isValid = false;
53137                }
53138            }
53139
53140            function extractFromRFC2822Strings(
53141                yearStr,
53142                monthStr,
53143                dayStr,
53144                hourStr,
53145                minuteStr,
53146                secondStr
53147            ) {
53148                var result = [
53149                    untruncateYear(yearStr),
53150                    defaultLocaleMonthsShort.indexOf(monthStr),
53151                    parseInt(dayStr, 10),
53152                    parseInt(hourStr, 10),
53153                    parseInt(minuteStr, 10),
53154                ];
53155
53156                if (secondStr) {
53157                    result.push(parseInt(secondStr, 10));
53158                }
53159
53160                return result;
53161            }
53162
53163            function untruncateYear(yearStr) {
53164                var year = parseInt(yearStr, 10);
53165                if (year <= 49) {
53166                    return 2000 + year;
53167                } else if (year <= 999) {
53168                    return 1900 + year;
53169                }
53170                return year;
53171            }
53172
53173            function preprocessRFC2822(s) {
53174                // Remove comments and folding whitespace and replace multiple-spaces with a single space
53175                return s
53176                    .replace(/\([^)]*\)|[\n\t]/g, ' ')
53177                    .replace(/(\s\s+)/g, ' ')
53178                    .replace(/^\s\s*/, '')
53179                    .replace(/\s\s*$/, '');
53180            }
53181
53182            function checkWeekday(weekdayStr, parsedInput, config) {
53183                if (weekdayStr) {
53184                    // TODO: Replace the vanilla JS Date object with an independent day-of-week check.
53185                    var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
53186                        weekdayActual = new Date(
53187                            parsedInput[0],
53188                            parsedInput[1],
53189                            parsedInput[2]
53190                        ).getDay();
53191                    if (weekdayProvided !== weekdayActual) {
53192                        getParsingFlags(config).weekdayMismatch = true;
53193                        config._isValid = false;
vendor: 10,694 bytes, lines 53194-53467
53194                        return false;
53195                    }
53196                }
53197                return true;
53198            }
53199
53200            function calculateOffset(obsOffset, militaryOffset, numOffset) {
53201                if (obsOffset) {
53202                    return obsOffsets[obsOffset];
53203                } else if (militaryOffset) {
53204                    // the only allowed military tz is Z
53205                    return 0;
53206                } else {
53207                    var hm = parseInt(numOffset, 10),
53208                        m = hm % 100,
53209                        h = (hm - m) / 100;
53210                    return h * 60 + m;
53211                }
53212            }
53213
53214            // date and time from ref 2822 format
53215            function configFromRFC2822(config) {
53216                var match = rfc2822.exec(preprocessRFC2822(config._i)),
53217                    parsedArray;
53218                if (match) {
53219                    parsedArray = extractFromRFC2822Strings(
53220                        match[4],
53221                        match[3],
53222                        match[2],
53223                        match[5],
53224                        match[6],
53225                        match[7]
53226                    );
53227                    if (!checkWeekday(match[1], parsedArray, config)) {
53228                        return;
53229                    }
53230
53231                    config._a = parsedArray;
53232                    config._tzm = calculateOffset(match[8], match[9], match[10]);
53233
53234                    config._d = createUTCDate.apply(null, config._a);
53235                    config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
53236
53237                    getParsingFlags(config).rfc2822 = true;
53238                } else {
53239                    config._isValid = false;
53240                }
53241            }
53242
53243            // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict
53244            function configFromString(config) {
53245                var matched = aspNetJsonRegex.exec(config._i);
53246                if (matched !== null) {
53247                    config._d = new Date(+matched[1]);
53248                    return;
53249                }
53250
53251                configFromISO(config);
53252                if (config._isValid === false) {
53253                    delete config._isValid;
53254                } else {
53255                    return;
53256                }
53257
53258                configFromRFC2822(config);
53259                if (config._isValid === false) {
53260                    delete config._isValid;
53261                } else {
53262                    return;
53263                }
53264
53265                if (config._strict) {
53266                    config._isValid = false;
53267                } else {
53268                    // Final attempt, use Input Fallback
53269                    hooks.createFromInputFallback(config);
53270                }
53271            }
53272
53273            hooks.createFromInputFallback = deprecate(
53274                'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
53275                'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
53276                'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.',
53277                function (config) {
53278                    config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
53279                }
53280            );
53281
53282            // Pick the first defined of two or three arguments.
53283            function defaults(a, b, c) {
53284                if (a != null) {
53285                    return a;
53286                }
53287                if (b != null) {
53288                    return b;
53289                }
53290                return c;
53291            }
53292
53293            function currentDateArray(config) {
53294                // hooks is actually the exported moment object
53295                var nowValue = new Date(hooks.now());
53296                if (config._useUTC) {
53297                    return [
53298                        nowValue.getUTCFullYear(),
53299                        nowValue.getUTCMonth(),
53300                        nowValue.getUTCDate(),
53301                    ];
53302                }
53303                return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
53304            }
53305
53306            // convert an array to a date.
53307            // the array should mirror the parameters below
53308            // note: all values past the year are optional and will default to the lowest possible value.
53309            // [year, month, day , hour, minute, second, millisecond]
53310            function configFromArray(config) {
53311                var i,
53312                    date,
53313                    input = [],
53314                    currentDate,
53315                    expectedWeekday,
53316                    yearToUse;
53317
53318                if (config._d) {
53319                    return;
53320                }
53321
53322                currentDate = currentDateArray(config);
53323
53324                //compute day of the year from weeks and weekdays
53325                if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
53326                    dayOfYearFromWeekInfo(config);
53327                }
53328
53329                //if the day of the year is set, figure out what it is
53330                if (config._dayOfYear != null) {
53331                    yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
53332
53333                    if (
53334                        config._dayOfYear > daysInYear(yearToUse) ||
53335                        config._dayOfYear === 0
53336                    ) {
53337                        getParsingFlags(config)._overflowDayOfYear = true;
53338                    }
53339
53340                    date = createUTCDate(yearToUse, 0, config._dayOfYear);
53341                    config._a[MONTH] = date.getUTCMonth();
53342                    config._a[DATE] = date.getUTCDate();
53343                }
53344
53345                // Default to current date.
53346                // * if no year, month, day of month are given, default to today
53347                // * if day of month is given, default month and year
53348                // * if month is given, default only year
53349                // * if year is given, don't default anything
53350                for (i = 0; i < 3 && config._a[i] == null; ++i) {
53351                    config._a[i] = input[i] = currentDate[i];
53352                }
53353
53354                // Zero out whatever was not defaulted, including time
53355                for (; i < 7; i++) {
53356                    config._a[i] = input[i] =
53357                        config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i];
53358                }
53359
53360                // Check for 24:00:00.000
53361                if (
53362                    config._a[HOUR] === 24 &&
53363                    config._a[MINUTE] === 0 &&
53364                    config._a[SECOND] === 0 &&
53365                    config._a[MILLISECOND] === 0
53366                ) {
53367                    config._nextDay = true;
53368                    config._a[HOUR] = 0;
53369                }
53370
53371                config._d = (config._useUTC ? createUTCDate : createDate).apply(
53372                    null,
53373                    input
53374                );
53375                expectedWeekday = config._useUTC
53376                    ? config._d.getUTCDay()
53377                    : config._d.getDay();
53378
53379                // Apply timezone offset from input. The actual utcOffset can be changed
53380                // with parseZone.
53381                if (config._tzm != null) {
53382                    config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
53383                }
53384
53385                if (config._nextDay) {
53386                    config._a[HOUR] = 24;
53387                }
53388
53389                // check for mismatching day of week
53390                if (
53391                    config._w &&
53392                    typeof config._w.d !== 'undefined' &&
53393                    config._w.d !== expectedWeekday
53394                ) {
53395                    getParsingFlags(config).weekdayMismatch = true;
53396                }
53397            }
53398
53399            function dayOfYearFromWeekInfo(config) {
53400                var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;
53401
53402                w = config._w;
53403                if (w.GG != null || w.W != null || w.E != null) {
53404                    dow = 1;
53405                    doy = 4;
53406
53407                    // TODO: We need to take the current isoWeekYear, but that depends on
53408                    // how we interpret now (local, utc, fixed offset). So create
53409                    // a now version of current config (take local/utc/offset flags, and
53410                    // create now).
53411                    weekYear = defaults(
53412                        w.GG,
53413                        config._a[YEAR],
53414                        weekOfYear(createLocal(), 1, 4).year
53415                    );
53416                    week = defaults(w.W, 1);
53417                    weekday = defaults(w.E, 1);
53418                    if (weekday < 1 || weekday > 7) {
53419                        weekdayOverflow = true;
53420                    }
53421                } else {
53422                    dow = config._locale._week.dow;
53423                    doy = config._locale._week.doy;
53424
53425                    curWeek = weekOfYear(createLocal(), dow, doy);
53426
53427                    weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
53428
53429                    // Default to current week.
53430                    week = defaults(w.w, curWeek.week);
53431
53432                    if (w.d != null) {
53433                        // weekday -- low day numbers are considered next week
53434                        weekday = w.d;
53435                        if (weekday < 0 || weekday > 6) {
53436                            weekdayOverflow = true;
53437                        }
53438                    } else if (w.e != null) {
53439                        // local weekday -- counting starts from beginning of week
53440                        weekday = w.e + dow;
53441                        if (w.e < 0 || w.e > 6) {
53442                            weekdayOverflow = true;
53443                        }
53444                    } else {
53445                        // default to beginning of week
53446                        weekday = dow;
53447                    }
53448                }
53449                if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
53450                    getParsingFlags(config)._overflowWeeks = true;
53451                } else if (weekdayOverflow != null) {
53452                    getParsingFlags(config)._overflowWeekday = true;
53453                } else {
53454                    temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
53455                    config._a[YEAR] = temp.year;
53456                    config._dayOfYear = temp.dayOfYear;
53457                }
53458            }
53459
53460            // constant that refers to the ISO standard
53461            hooks.ISO_8601 = function () {
53462            };
53463
53464            // constant that refers to the RFC 2822 form
53465            hooks.RFC_2822 = function () {
53466            };
53467
vendor: 21,364 bytes, lines 53468-54032
53468            // date from string and format string
53469            function configFromStringAndFormat(config) {
53470                // TODO: Move this to another part of the creation flow to prevent circular deps
53471                if (config._f === hooks.ISO_8601) {
53472                    configFromISO(config);
53473                    return;
53474                }
53475                if (config._f === hooks.RFC_2822) {
53476                    configFromRFC2822(config);
53477                    return;
53478                }
53479                config._a = [];
53480                getParsingFlags(config).empty = true;
53481
53482                // This array is used to make a Date, either with `new Date` or `Date.UTC`
53483                var string = '' + config._i,
53484                    i,
53485                    parsedInput,
53486                    tokens,
53487                    token,
53488                    skipped,
53489                    stringLength = string.length,
53490                    totalParsedInputLength = 0,
53491                    era;
53492
53493                tokens =
53494                    expandFormat(config._f, config._locale).match(formattingTokens) || [];
53495
53496                for (i = 0; i < tokens.length; i++) {
53497                    token = tokens[i];
53498                    parsedInput = (string.match(getParseRegexForToken(token, config)) ||
53499                        [])[0];
53500                    if (parsedInput) {
53501                        skipped = string.substr(0, string.indexOf(parsedInput));
53502                        if (skipped.length > 0) {
53503                            getParsingFlags(config).unusedInput.push(skipped);
53504                        }
53505                        string = string.slice(
53506                            string.indexOf(parsedInput) + parsedInput.length
53507                        );
53508                        totalParsedInputLength += parsedInput.length;
53509                    }
53510                    // don't parse if it's not a known token
53511                    if (formatTokenFunctions[token]) {
53512                        if (parsedInput) {
53513                            getParsingFlags(config).empty = false;
53514                        } else {
53515                            getParsingFlags(config).unusedTokens.push(token);
53516                        }
53517                        addTimeToArrayFromToken(token, parsedInput, config);
53518                    } else if (config._strict && !parsedInput) {
53519                        getParsingFlags(config).unusedTokens.push(token);
53520                    }
53521                }
53522
53523                // add remaining unparsed input length to the string
53524                getParsingFlags(config).charsLeftOver =
53525                    stringLength - totalParsedInputLength;
53526                if (string.length > 0) {
53527                    getParsingFlags(config).unusedInput.push(string);
53528                }
53529
53530                // clear _12h flag if hour is <= 12
53531                if (
53532                    config._a[HOUR] <= 12 &&
53533                    getParsingFlags(config).bigHour === true &&
53534                    config._a[HOUR] > 0
53535                ) {
53536                    getParsingFlags(config).bigHour = undefined;
53537                }
53538
53539                getParsingFlags(config).parsedDateParts = config._a.slice(0);
53540                getParsingFlags(config).meridiem = config._meridiem;
53541                // handle meridiem
53542                config._a[HOUR] = meridiemFixWrap(
53543                    config._locale,
53544                    config._a[HOUR],
53545                    config._meridiem
53546                );
53547
53548                // handle era
53549                era = getParsingFlags(config).era;
53550                if (era !== null) {
53551                    config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]);
53552                }
53553
53554                configFromArray(config);
53555                checkOverflow(config);
53556            }
53557
53558            function meridiemFixWrap(locale, hour, meridiem) {
53559                var isPm;
53560
53561                if (meridiem == null) {
53562                    // nothing to do
53563                    return hour;
53564                }
53565                if (locale.meridiemHour != null) {
53566                    return locale.meridiemHour(hour, meridiem);
53567                } else if (locale.isPM != null) {
53568                    // Fallback
53569                    isPm = locale.isPM(meridiem);
53570                    if (isPm && hour < 12) {
53571                        hour += 12;
53572                    }
53573                    if (!isPm && hour === 12) {
53574                        hour = 0;
53575                    }
53576                    return hour;
53577                } else {
53578                    // this is not supposed to happen
53579                    return hour;
53580                }
53581            }
53582
53583            // date from string and array of format strings
53584            function configFromStringAndArray(config) {
53585                var tempConfig,
53586                    bestMoment,
53587                    scoreToBeat,
53588                    i,
53589                    currentScore,
53590                    validFormatFound,
53591                    bestFormatIsValid = false;
53592
53593                if (config._f.length === 0) {
53594                    getParsingFlags(config).invalidFormat = true;
53595                    config._d = new Date(NaN);
53596                    return;
53597                }
53598
53599                for (i = 0; i < config._f.length; i++) {
53600                    currentScore = 0;
53601                    validFormatFound = false;
53602                    tempConfig = copyConfig({}, config);
53603                    if (config._useUTC != null) {
53604                        tempConfig._useUTC = config._useUTC;
53605                    }
53606                    tempConfig._f = config._f[i];
53607                    configFromStringAndFormat(tempConfig);
53608
53609                    if (isValid(tempConfig)) {
53610                        validFormatFound = true;
53611                    }
53612
53613                    // if there is any input that was not parsed add a penalty for that format
53614                    currentScore += getParsingFlags(tempConfig).charsLeftOver;
53615
53616                    //or tokens
53617                    currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
53618
53619                    getParsingFlags(tempConfig).score = currentScore;
53620
53621                    if (!bestFormatIsValid) {
53622                        if (
53623                            scoreToBeat == null ||
53624                            currentScore < scoreToBeat ||
53625                            validFormatFound
53626                        ) {
53627                            scoreToBeat = currentScore;
53628                            bestMoment = tempConfig;
53629                            if (validFormatFound) {
53630                                bestFormatIsValid = true;
53631                            }
53632                        }
53633                    } else {
53634                        if (currentScore < scoreToBeat) {
53635                            scoreToBeat = currentScore;
53636                            bestMoment = tempConfig;
53637                        }
53638                    }
53639                }
53640
53641                extend(config, bestMoment || tempConfig);
53642            }
53643
53644            function configFromObject(config) {
53645                if (config._d) {
53646                    return;
53647                }
53648
53649                var i = normalizeObjectUnits(config._i),
53650                    dayOrDate = i.day === undefined ? i.date : i.day;
53651                config._a = map(
53652                    [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond],
53653                    function (obj) {
53654                        return obj && parseInt(obj, 10);
53655                    }
53656                );
53657
53658                configFromArray(config);
53659            }
53660
53661            function createFromConfig(config) {
53662                var res = new Moment(checkOverflow(prepareConfig(config)));
53663                if (res._nextDay) {
53664                    // Adding is smart enough around DST
53665                    res.add(1, 'd');
53666                    res._nextDay = undefined;
53667                }
53668
53669                return res;
53670            }
53671
53672            function prepareConfig(config) {
53673                var input = config._i,
53674                    format = config._f;
53675
53676                config._locale = config._locale || getLocale(config._l);
53677
53678                if (input === null || (format === undefined && input === '')) {
53679                    return createInvalid({nullInput: true});
53680                }
53681
53682                if (typeof input === 'string') {
53683                    config._i = input = config._locale.preparse(input);
53684                }
53685
53686                if (isMoment(input)) {
53687                    return new Moment(checkOverflow(input));
53688                } else if (isDate(input)) {
53689                    config._d = input;
53690                } else if (isArray(format)) {
53691                    configFromStringAndArray(config);
53692                } else if (format) {
53693                    configFromStringAndFormat(config);
53694                } else {
53695                    configFromInput(config);
53696                }
53697
53698                if (!isValid(config)) {
53699                    config._d = null;
53700                }
53701
53702                return config;
53703            }
53704
53705            function configFromInput(config) {
53706                var input = config._i;
53707                if (isUndefined(input)) {
53708                    config._d = new Date(hooks.now());
53709                } else if (isDate(input)) {
53710                    config._d = new Date(input.valueOf());
53711                } else if (typeof input === 'string') {
53712                    configFromString(config);
53713                } else if (isArray(input)) {
53714                    config._a = map(input.slice(0), function (obj) {
53715                        return parseInt(obj, 10);
53716                    });
53717                    configFromArray(config);
53718                } else if (isObject(input)) {
53719                    configFromObject(config);
53720                } else if (isNumber(input)) {
53721                    // from milliseconds
53722                    config._d = new Date(input);
53723                } else {
53724                    hooks.createFromInputFallback(config);
53725                }
53726            }
53727
53728            function createLocalOrUTC(input, format, locale, strict, isUTC) {
53729                var c = {};
53730
53731                if (format === true || format === false) {
53732                    strict = format;
53733                    format = undefined;
53734                }
53735
53736                if (locale === true || locale === false) {
53737                    strict = locale;
53738                    locale = undefined;
53739                }
53740
53741                if (
53742                    (isObject(input) && isObjectEmpty(input)) ||
53743                    (isArray(input) && input.length === 0)
53744                ) {
53745                    input = undefined;
53746                }
53747                // object construction must be done this way.
53748                // https://github.com/moment/moment/issues/1423
53749                c._isAMomentObject = true;
53750                c._useUTC = c._isUTC = isUTC;
53751                c._l = locale;
53752                c._i = input;
53753                c._f = format;
53754                c._strict = strict;
53755
53756                return createFromConfig(c);
53757            }
53758
53759            function createLocal(input, format, locale, strict) {
53760                return createLocalOrUTC(input, format, locale, strict, false);
53761            }
53762
53763            var prototypeMin = deprecate(
53764                    'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
53765                    function () {
53766                        var other = createLocal.apply(null, arguments);
53767                        if (this.isValid() && other.isValid()) {
53768                            return other < this ? this : other;
53769                        } else {
53770                            return createInvalid();
53771                        }
53772                    }
53773                ),
53774                prototypeMax = deprecate(
53775                    'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
53776                    function () {
53777                        var other = createLocal.apply(null, arguments);
53778                        if (this.isValid() && other.isValid()) {
53779                            return other > this ? this : other;
53780                        } else {
53781                            return createInvalid();
53782                        }
53783                    }
53784                );
53785
53786            // Pick a moment m from moments so that m[fn](other) is true for all
53787            // other. This relies on the function fn to be transitive.
53788            //
53789            // moments should either be an array of moment objects or an array, whose
53790            // first element is an array of moment objects.
53791            function pickBy(fn, moments) {
53792                var res, i;
53793                if (moments.length === 1 && isArray(moments[0])) {
53794                    moments = moments[0];
53795                }
53796                if (!moments.length) {
53797                    return createLocal();
53798                }
53799                res = moments[0];
53800                for (i = 1; i < moments.length; ++i) {
53801                    if (!moments[i].isValid() || moments[i][fn](res)) {
53802                        res = moments[i];
53803                    }
53804                }
53805                return res;
53806            }
53807
53808            // TODO: Use [].sort instead?
53809            function min() {
53810                var args = [].slice.call(arguments, 0);
53811
53812                return pickBy('isBefore', args);
53813            }
53814
53815            function max() {
53816                var args = [].slice.call(arguments, 0);
53817
53818                return pickBy('isAfter', args);
53819            }
53820
53821            var now = function () {
53822                return Date.now ? Date.now() : +new Date();
53823            };
53824
53825            var ordering = [
53826                'year',
53827                'quarter',
53828                'month',
53829                'week',
53830                'day',
53831                'hour',
53832                'minute',
53833                'second',
53834                'millisecond',
53835            ];
53836
53837            function isDurationValid(m) {
53838                var key,
53839                    unitHasDecimal = false,
53840                    i;
53841                for (key in m) {
53842                    if (
53843                        hasOwnProp(m, key) &&
53844                        !(
53845                            indexOf.call(ordering, key) !== -1 &&
53846                            (m[key] == null || !isNaN(m[key]))
53847                        )
53848                    ) {
53849                        return false;
53850                    }
53851                }
53852
53853                for (i = 0; i < ordering.length; ++i) {
53854                    if (m[ordering[i]]) {
53855                        if (unitHasDecimal) {
53856                            return false; // only allow non-integers for smallest unit
53857                        }
53858                        if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
53859                            unitHasDecimal = true;
53860                        }
53861                    }
53862                }
53863
53864                return true;
53865            }
53866
53867            function isValid$1() {
53868                return this._isValid;
53869            }
53870
53871            function createInvalid$1() {
53872                return createDuration(NaN);
53873            }
53874
53875            function Duration(duration) {
53876                var normalizedInput = normalizeObjectUnits(duration),
53877                    years = normalizedInput.year || 0,
53878                    quarters = normalizedInput.quarter || 0,
53879                    months = normalizedInput.month || 0,
53880                    weeks = normalizedInput.week || normalizedInput.isoWeek || 0,
53881                    days = normalizedInput.day || 0,
53882                    hours = normalizedInput.hour || 0,
53883                    minutes = normalizedInput.minute || 0,
53884                    seconds = normalizedInput.second || 0,
53885                    milliseconds = normalizedInput.millisecond || 0;
53886
53887                this._isValid = isDurationValid(normalizedInput);
53888
53889                // representation for dateAddRemove
53890                this._milliseconds =
53891                    +milliseconds +
53892                    seconds * 1e3 + // 1000
53893                    minutes * 6e4 + // 1000 * 60
53894                    hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
53895                // Because of dateAddRemove treats 24 hours as different from a
53896                // day when working around DST, we need to store them separately
53897                this._days = +days + weeks * 7;
53898                // It is impossible to translate months into days without knowing
53899                // which months you are are talking about, so we have to store
53900                // it separately.
53901                this._months = +months + quarters * 3 + years * 12;
53902
53903                this._data = {};
53904
53905                this._locale = getLocale();
53906
53907                this._bubble();
53908            }
53909
53910            function isDuration(obj) {
53911                return obj instanceof Duration;
53912            }
53913
53914            function absRound(number) {
53915                if (number < 0) {
53916                    return Math.round(-1 * number) * -1;
53917                } else {
53918                    return Math.round(number);
53919                }
53920            }
53921
53922            // compare two arrays, return the number of differences
53923            function compareArrays(array1, array2, dontConvert) {
53924                var len = Math.min(array1.length, array2.length),
53925                    lengthDiff = Math.abs(array1.length - array2.length),
53926                    diffs = 0,
53927                    i;
53928                for (i = 0; i < len; i++) {
53929                    if (
53930                        (dontConvert && array1[i] !== array2[i]) ||
53931                        (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))
53932                    ) {
53933                        diffs++;
53934                    }
53935                }
53936                return diffs + lengthDiff;
53937            }
53938
53939            // FORMATTING
53940
53941            function offset(token, separator) {
53942                addFormatToken(token, 0, 0, function () {
53943                    var offset = this.utcOffset(),
53944                        sign = '+';
53945                    if (offset < 0) {
53946                        offset = -offset;
53947                        sign = '-';
53948                    }
53949                    return (
53950                        sign +
53951                        zeroFill(~~(offset / 60), 2) +
53952                        separator +
53953                        zeroFill(~~offset % 60, 2)
53954                    );
53955                });
53956            }
53957
53958            offset('Z', ':');
53959            offset('ZZ', '');
53960
53961            // PARSING
53962
53963            addRegexToken('Z', matchShortOffset);
53964            addRegexToken('ZZ', matchShortOffset);
53965            addParseToken(['Z', 'ZZ'], function (input, array, config) {
53966                config._useUTC = true;
53967                config._tzm = offsetFromString(matchShortOffset, input);
53968            });
53969
53970            // HELPERS
53971
53972            // timezone chunker
53973            // '+10:00' > ['10',  '00']
53974            // '-1530'  > ['-15', '30']
53975            var chunkOffset = /([\+\-]|\d\d)/gi;
53976
53977            function offsetFromString(matcher, string) {
53978                var matches = (string || '').match(matcher),
53979                    chunk,
53980                    parts,
53981                    minutes;
53982
53983                if (matches === null) {
53984                    return null;
53985                }
53986
53987                chunk = matches[matches.length - 1] || [];
53988                parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
53989                minutes = +(parts[1] * 60) + toInt(parts[2]);
53990
53991                return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes;
53992            }
53993
53994            // Return a moment from input, that is local/utc/zone equivalent to model.
53995            function cloneWithOffset(input, model) {
53996                var res, diff;
53997                if (model._isUTC) {
53998                    res = model.clone();
53999                    diff =
54000                        (isMoment(input) || isDate(input)
54001                            ? input.valueOf()
54002                            : createLocal(input).valueOf()) - res.valueOf();
54003                    // Use low-level api, because this fn is low-level api.
54004                    res._d.setTime(res._d.valueOf() + diff);
54005                    hooks.updateOffset(res, false);
54006                    return res;
54007                } else {
54008                    return createLocal(input).local();
54009                }
54010            }
54011
54012            function getDateOffset(m) {
54013                // On Firefox.24 Date#getTimezoneOffset returns a floating point.
54014                // https://github.com/moment/moment/pull/1871
54015                return -Math.round(m._d.getTimezoneOffset());
54016            }
54017
54018            // HOOKS
54019
54020            // This function will be called whenever a moment is mutated.
54021            // It is intended to keep the offset in sync with the timezone.
54022            hooks.updateOffset = function () {
54023            };
54024
54025            // MOMENTS
54026
54027            // keepLocalTime = true means only change the timezone, without
54028            // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
54029            // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
54030            // +0200, so we adjust the time as needed, to be valid.
54031            //
54032            // Keeping the time actually adds/subtracts (one hour)
vendor: 37,149 bytes, lines 54033-54993
54033            // from the actual represented time. That is why we call updateOffset
54034            // a second time. In case it wants us to change the offset again
54035            // _changeInProgress == true case, then we have to adjust, because
54036            // there is no such time in the given timezone.
54037            function getSetOffset(input, keepLocalTime, keepMinutes) {
54038                var offset = this._offset || 0,
54039                    localAdjust;
54040                if (!this.isValid()) {
54041                    return input != null ? this : NaN;
54042                }
54043                if (input != null) {
54044                    if (typeof input === 'string') {
54045                        input = offsetFromString(matchShortOffset, input);
54046                        if (input === null) {
54047                            return this;
54048                        }
54049                    } else if (Math.abs(input) < 16 && !keepMinutes) {
54050                        input = input * 60;
54051                    }
54052                    if (!this._isUTC && keepLocalTime) {
54053                        localAdjust = getDateOffset(this);
54054                    }
54055                    this._offset = input;
54056                    this._isUTC = true;
54057                    if (localAdjust != null) {
54058                        this.add(localAdjust, 'm');
54059                    }
54060                    if (offset !== input) {
54061                        if (!keepLocalTime || this._changeInProgress) {
54062                            addSubtract(
54063                                this,
54064                                createDuration(input - offset, 'm'),
54065                                1,
54066                                false
54067                            );
54068                        } else if (!this._changeInProgress) {
54069                            this._changeInProgress = true;
54070                            hooks.updateOffset(this, true);
54071                            this._changeInProgress = null;
54072                        }
54073                    }
54074                    return this;
54075                } else {
54076                    return this._isUTC ? offset : getDateOffset(this);
54077                }
54078            }
54079
54080            function getSetZone(input, keepLocalTime) {
54081                if (input != null) {
54082                    if (typeof input !== 'string') {
54083                        input = -input;
54084                    }
54085
54086                    this.utcOffset(input, keepLocalTime);
54087
54088                    return this;
54089                } else {
54090                    return -this.utcOffset();
54091                }
54092            }
54093
54094            function setOffsetToUTC(keepLocalTime) {
54095                return this.utcOffset(0, keepLocalTime);
54096            }
54097
54098            function setOffsetToLocal(keepLocalTime) {
54099                if (this._isUTC) {
54100                    this.utcOffset(0, keepLocalTime);
54101                    this._isUTC = false;
54102
54103                    if (keepLocalTime) {
54104                        this.subtract(getDateOffset(this), 'm');
54105                    }
54106                }
54107                return this;
54108            }
54109
54110            function setOffsetToParsedOffset() {
54111                if (this._tzm != null) {
54112                    this.utcOffset(this._tzm, false, true);
54113                } else if (typeof this._i === 'string') {
54114                    var tZone = offsetFromString(matchOffset, this._i);
54115                    if (tZone != null) {
54116                        this.utcOffset(tZone);
54117                    } else {
54118                        this.utcOffset(0, true);
54119                    }
54120                }
54121                return this;
54122            }
54123
54124            function hasAlignedHourOffset(input) {
54125                if (!this.isValid()) {
54126                    return false;
54127                }
54128                input = input ? createLocal(input).utcOffset() : 0;
54129
54130                return (this.utcOffset() - input) % 60 === 0;
54131            }
54132
54133            function isDaylightSavingTime() {
54134                return (
54135                    this.utcOffset() > this.clone().month(0).utcOffset() ||
54136                    this.utcOffset() > this.clone().month(5).utcOffset()
54137                );
54138            }
54139
54140            function isDaylightSavingTimeShifted() {
54141                if (!isUndefined(this._isDSTShifted)) {
54142                    return this._isDSTShifted;
54143                }
54144
54145                var c = {},
54146                    other;
54147
54148                copyConfig(c, this);
54149                c = prepareConfig(c);
54150
54151                if (c._a) {
54152                    other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
54153                    this._isDSTShifted =
54154                        this.isValid() && compareArrays(c._a, other.toArray()) > 0;
54155                } else {
54156                    this._isDSTShifted = false;
54157                }
54158
54159                return this._isDSTShifted;
54160            }
54161
54162            function isLocal() {
54163                return this.isValid() ? !this._isUTC : false;
54164            }
54165
54166            function isUtcOffset() {
54167                return this.isValid() ? this._isUTC : false;
54168            }
54169
54170            function isUtc() {
54171                return this.isValid() ? this._isUTC && this._offset === 0 : false;
54172            }
54173
54174            // ASP.NET json date format regex
54175            var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,
54176                // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
54177                // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
54178                // and further modified to allow for strings containing both week and day
54179                isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
54180
54181            function createDuration(input, key) {
54182                var duration = input,
54183                    // matching against regexp is expensive, do it on demand
54184                    match = null,
54185                    sign,
54186                    ret,
54187                    diffRes;
54188
54189                if (isDuration(input)) {
54190                    duration = {
54191                        ms: input._milliseconds,
54192                        d: input._days,
54193                        M: input._months,
54194                    };
54195                } else if (isNumber(input) || !isNaN(+input)) {
54196                    duration = {};
54197                    if (key) {
54198                        duration[key] = +input;
54199                    } else {
54200                        duration.milliseconds = +input;
54201                    }
54202                } else if ((match = aspNetRegex.exec(input))) {
54203                    sign = match[1] === '-' ? -1 : 1;
54204                    duration = {
54205                        y: 0,
54206                        d: toInt(match[DATE]) * sign,
54207                        h: toInt(match[HOUR]) * sign,
54208                        m: toInt(match[MINUTE]) * sign,
54209                        s: toInt(match[SECOND]) * sign,
54210                        ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match
54211                    };
54212                } else if ((match = isoRegex.exec(input))) {
54213                    sign = match[1] === '-' ? -1 : 1;
54214                    duration = {
54215                        y: parseIso(match[2], sign),
54216                        M: parseIso(match[3], sign),
54217                        w: parseIso(match[4], sign),
54218                        d: parseIso(match[5], sign),
54219                        h: parseIso(match[6], sign),
54220                        m: parseIso(match[7], sign),
54221                        s: parseIso(match[8], sign),
54222                    };
54223                } else if (duration == null) {
54224                    // checks for null or undefined
54225                    duration = {};
54226                } else if (
54227                    typeof duration === 'object' &&
54228                    ('from' in duration || 'to' in duration)
54229                ) {
54230                    diffRes = momentsDifference(
54231                        createLocal(duration.from),
54232                        createLocal(duration.to)
54233                    );
54234
54235                    duration = {};
54236                    duration.ms = diffRes.milliseconds;
54237                    duration.M = diffRes.months;
54238                }
54239
54240                ret = new Duration(duration);
54241
54242                if (isDuration(input) && hasOwnProp(input, '_locale')) {
54243                    ret._locale = input._locale;
54244                }
54245
54246                if (isDuration(input) && hasOwnProp(input, '_isValid')) {
54247                    ret._isValid = input._isValid;
54248                }
54249
54250                return ret;
54251            }
54252
54253            createDuration.fn = Duration.prototype;
54254            createDuration.invalid = createInvalid$1;
54255
54256            function parseIso(inp, sign) {
54257                // We'd normally use ~~inp for this, but unfortunately it also
54258                // converts floats to ints.
54259                // inp may be undefined, so careful calling replace on it.
54260                var res = inp && parseFloat(inp.replace(',', '.'));
54261                // apply sign while we're at it
54262                return (isNaN(res) ? 0 : res) * sign;
54263            }
54264
54265            function positiveMomentsDifference(base, other) {
54266                var res = {};
54267
54268                res.months =
54269                    other.month() - base.month() + (other.year() - base.year()) * 12;
54270                if (base.clone().add(res.months, 'M').isAfter(other)) {
54271                    --res.months;
54272                }
54273
54274                res.milliseconds = +other - +base.clone().add(res.months, 'M');
54275
54276                return res;
54277            }
54278
54279            function momentsDifference(base, other) {
54280                var res;
54281                if (!(base.isValid() && other.isValid())) {
54282                    return {milliseconds: 0, months: 0};
54283                }
54284
54285                other = cloneWithOffset(other, base);
54286                if (base.isBefore(other)) {
54287                    res = positiveMomentsDifference(base, other);
54288                } else {
54289                    res = positiveMomentsDifference(other, base);
54290                    res.milliseconds = -res.milliseconds;
54291                    res.months = -res.months;
54292                }
54293
54294                return res;
54295            }
54296
54297            // TODO: remove 'name' arg after deprecation is removed
54298            function createAdder(direction, name) {
54299                return function (val, period) {
54300                    var dur, tmp;
54301                    //invert the arguments, but complain about it
54302                    if (period !== null && !isNaN(+period)) {
54303                        deprecateSimple(
54304                            name,
54305                            'moment().' +
54306                            name +
54307                            '(period, number) is deprecated. Please use moment().' +
54308                            name +
54309                            '(number, period). ' +
54310                            'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'
54311                        );
54312                        tmp = val;
54313                        val = period;
54314                        period = tmp;
54315                    }
54316
54317                    dur = createDuration(val, period);
54318                    addSubtract(this, dur, direction);
54319                    return this;
54320                };
54321            }
54322
54323            function addSubtract(mom, duration, isAdding, updateOffset) {
54324                var milliseconds = duration._milliseconds,
54325                    days = absRound(duration._days),
54326                    months = absRound(duration._months);
54327
54328                if (!mom.isValid()) {
54329                    // No op
54330                    return;
54331                }
54332
54333                updateOffset = updateOffset == null ? true : updateOffset;
54334
54335                if (months) {
54336                    setMonth(mom, get(mom, 'Month') + months * isAdding);
54337                }
54338                if (days) {
54339                    set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
54340                }
54341                if (milliseconds) {
54342                    mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
54343                }
54344                if (updateOffset) {
54345                    hooks.updateOffset(mom, days || months);
54346                }
54347            }
54348
54349            var add = createAdder(1, 'add'),
54350                subtract = createAdder(-1, 'subtract');
54351
54352            function isString(input) {
54353                return typeof input === 'string' || input instanceof String;
54354            }
54355
54356            // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined
54357            function isMomentInput(input) {
54358                return (
54359                    isMoment(input) ||
54360                    isDate(input) ||
54361                    isString(input) ||
54362                    isNumber(input) ||
54363                    isNumberOrStringArray(input) ||
54364                    isMomentInputObject(input) ||
54365                    input === null ||
54366                    input === undefined
54367                );
54368            }
54369
54370            function isMomentInputObject(input) {
54371                var objectTest = isObject(input) && !isObjectEmpty(input),
54372                    propertyTest = false,
54373                    properties = [
54374                        'years',
54375                        'year',
54376                        'y',
54377                        'months',
54378                        'month',
54379                        'M',
54380                        'days',
54381                        'day',
54382                        'd',
54383                        'dates',
54384                        'date',
54385                        'D',
54386                        'hours',
54387                        'hour',
54388                        'h',
54389                        'minutes',
54390                        'minute',
54391                        'm',
54392                        'seconds',
54393                        'second',
54394                        's',
54395                        'milliseconds',
54396                        'millisecond',
54397                        'ms',
54398                    ],
54399                    i,
54400                    property;
54401
54402                for (i = 0; i < properties.length; i += 1) {
54403                    property = properties[i];
54404                    propertyTest = propertyTest || hasOwnProp(input, property);
54405                }
54406
54407                return objectTest && propertyTest;
54408            }
54409
54410            function isNumberOrStringArray(input) {
54411                var arrayTest = isArray(input),
54412                    dataTypeTest = false;
54413                if (arrayTest) {
54414                    dataTypeTest =
54415                        input.filter(function (item) {
54416                            return !isNumber(item) && isString(input);
54417                        }).length === 0;
54418                }
54419                return arrayTest && dataTypeTest;
54420            }
54421
54422            function isCalendarSpec(input) {
54423                var objectTest = isObject(input) && !isObjectEmpty(input),
54424                    propertyTest = false,
54425                    properties = [
54426                        'sameDay',
54427                        'nextDay',
54428                        'lastDay',
54429                        'nextWeek',
54430                        'lastWeek',
54431                        'sameElse',
54432                    ],
54433                    i,
54434                    property;
54435
54436                for (i = 0; i < properties.length; i += 1) {
54437                    property = properties[i];
54438                    propertyTest = propertyTest || hasOwnProp(input, property);
54439                }
54440
54441                return objectTest && propertyTest;
54442            }
54443
54444            function getCalendarFormat(myMoment, now) {
54445                var diff = myMoment.diff(now, 'days', true);
54446                return diff < -6
54447                    ? 'sameElse'
54448                    : diff < -1
54449                        ? 'lastWeek'
54450                        : diff < 0
54451                            ? 'lastDay'
54452                            : diff < 1
54453                                ? 'sameDay'
54454                                : diff < 2
54455                                    ? 'nextDay'
54456                                    : diff < 7
54457                                        ? 'nextWeek'
54458                                        : 'sameElse';
54459            }
54460
54461            function calendar$1(time, formats) {
54462                // Support for single parameter, formats only overload to the calendar function
54463                if (arguments.length === 1) {
54464                    if (!arguments[0]) {
54465                        time = undefined;
54466                        formats = undefined;
54467                    } else if (isMomentInput(arguments[0])) {
54468                        time = arguments[0];
54469                        formats = undefined;
54470                    } else if (isCalendarSpec(arguments[0])) {
54471                        formats = arguments[0];
54472                        time = undefined;
54473                    }
54474                }
54475                // We want to compare the start of today, vs this.
54476                // Getting start-of-today depends on whether we're local/utc/offset or not.
54477                var now = time || createLocal(),
54478                    sod = cloneWithOffset(now, this).startOf('day'),
54479                    format = hooks.calendarFormat(this, sod) || 'sameElse',
54480                    output =
54481                        formats &&
54482                        (isFunction(formats[format])
54483                            ? formats[format].call(this, now)
54484                            : formats[format]);
54485
54486                return this.format(
54487                    output || this.localeData().calendar(format, this, createLocal(now))
54488                );
54489            }
54490
54491            function clone() {
54492                return new Moment(this);
54493            }
54494
54495            function isAfter(input, units) {
54496                var localInput = isMoment(input) ? input : createLocal(input);
54497                if (!(this.isValid() && localInput.isValid())) {
54498                    return false;
54499                }
54500                units = normalizeUnits(units) || 'millisecond';
54501                if (units === 'millisecond') {
54502                    return this.valueOf() > localInput.valueOf();
54503                } else {
54504                    return localInput.valueOf() < this.clone().startOf(units).valueOf();
54505                }
54506            }
54507
54508            function isBefore(input, units) {
54509                var localInput = isMoment(input) ? input : createLocal(input);
54510                if (!(this.isValid() && localInput.isValid())) {
54511                    return false;
54512                }
54513                units = normalizeUnits(units) || 'millisecond';
54514                if (units === 'millisecond') {
54515                    return this.valueOf() < localInput.valueOf();
54516                } else {
54517                    return this.clone().endOf(units).valueOf() < localInput.valueOf();
54518                }
54519            }
54520
54521            function isBetween(from, to, units, inclusivity) {
54522                var localFrom = isMoment(from) ? from : createLocal(from),
54523                    localTo = isMoment(to) ? to : createLocal(to);
54524                if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
54525                    return false;
54526                }
54527                inclusivity = inclusivity || '()';
54528                return (
54529                    (inclusivity[0] === '('
54530                        ? this.isAfter(localFrom, units)
54531                        : !this.isBefore(localFrom, units)) &&
54532                    (inclusivity[1] === ')'
54533                        ? this.isBefore(localTo, units)
54534                        : !this.isAfter(localTo, units))
54535                );
54536            }
54537
54538            function isSame(input, units) {
54539                var localInput = isMoment(input) ? input : createLocal(input),
54540                    inputMs;
54541                if (!(this.isValid() && localInput.isValid())) {
54542                    return false;
54543                }
54544                units = normalizeUnits(units) || 'millisecond';
54545                if (units === 'millisecond') {
54546                    return this.valueOf() === localInput.valueOf();
54547                } else {
54548                    inputMs = localInput.valueOf();
54549                    return (
54550                        this.clone().startOf(units).valueOf() <= inputMs &&
54551                        inputMs <= this.clone().endOf(units).valueOf()
54552                    );
54553                }
54554            }
54555
54556            function isSameOrAfter(input, units) {
54557                return this.isSame(input, units) || this.isAfter(input, units);
54558            }
54559
54560            function isSameOrBefore(input, units) {
54561                return this.isSame(input, units) || this.isBefore(input, units);
54562            }
54563
54564            function diff(input, units, asFloat) {
54565                var that, zoneDelta, output;
54566
54567                if (!this.isValid()) {
54568                    return NaN;
54569                }
54570
54571                that = cloneWithOffset(input, this);
54572
54573                if (!that.isValid()) {
54574                    return NaN;
54575                }
54576
54577                zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
54578
54579                units = normalizeUnits(units);
54580
54581                switch (units) {
54582                    case 'year':
54583                        output = monthDiff(this, that) / 12;
54584                        break;
54585                    case 'month':
54586                        output = monthDiff(this, that);
54587                        break;
54588                    case 'quarter':
54589                        output = monthDiff(this, that) / 3;
54590                        break;
54591                    case 'second':
54592                        output = (this - that) / 1e3;
54593                        break; // 1000
54594                    case 'minute':
54595                        output = (this - that) / 6e4;
54596                        break; // 1000 * 60
54597                    case 'hour':
54598                        output = (this - that) / 36e5;
54599                        break; // 1000 * 60 * 60
54600                    case 'day':
54601                        output = (this - that - zoneDelta) / 864e5;
54602                        break; // 1000 * 60 * 60 * 24, negate dst
54603                    case 'week':
54604                        output = (this - that - zoneDelta) / 6048e5;
54605                        break; // 1000 * 60 * 60 * 24 * 7, negate dst
54606                    default:
54607                        output = this - that;
54608                }
54609
54610                return asFloat ? output : absFloor(output);
54611            }
54612
54613            function monthDiff(a, b) {
54614                if (a.date() < b.date()) {
54615                    // end-of-month calculations work correct when the start month has more
54616                    // days than the end month.
54617                    return -monthDiff(b, a);
54618                }
54619                // difference in months
54620                var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()),
54621                    // b is in (anchor - 1 month, anchor + 1 month)
54622                    anchor = a.clone().add(wholeMonthDiff, 'months'),
54623                    anchor2,
54624                    adjust;
54625
54626                if (b - anchor < 0) {
54627                    anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
54628                    // linear across the month
54629                    adjust = (b - anchor) / (anchor - anchor2);
54630                } else {
54631                    anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
54632                    // linear across the month
54633                    adjust = (b - anchor) / (anchor2 - anchor);
54634                }
54635
54636                //check for negative zero, return zero if negative zero
54637                return -(wholeMonthDiff + adjust) || 0;
54638            }
54639
54640            hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
54641            hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
54642
54643            function toString() {
54644                return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
54645            }
54646
54647            function toISOString(keepOffset) {
54648                if (!this.isValid()) {
54649                    return null;
54650                }
54651                var utc = keepOffset !== true,
54652                    m = utc ? this.clone().utc() : this;
54653                if (m.year() < 0 || m.year() > 9999) {
54654                    return formatMoment(
54655                        m,
54656                        utc
54657                            ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'
54658                            : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'
54659                    );
54660                }
54661                if (isFunction(Date.prototype.toISOString)) {
54662                    // native implementation is ~50x faster, use it when we can
54663                    if (utc) {
54664                        return this.toDate().toISOString();
54665                    } else {
54666                        return new Date(this.valueOf() + this.utcOffset() * 60 * 1000)
54667                            .toISOString()
54668                            .replace('Z', formatMoment(m, 'Z'));
54669                    }
54670                }
54671                return formatMoment(
54672                    m,
54673                    utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'
54674                );
54675            }
54676
54677            /**
54678             * Return a human readable representation of a moment that can
54679             * also be evaluated to get a new moment which is the same
54680             *
54681             * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
54682             */
54683            function inspect() {
54684                if (!this.isValid()) {
54685                    return 'moment.invalid(/* ' + this._i + ' */)';
54686                }
54687                var func = 'moment',
54688                    zone = '',
54689                    prefix,
54690                    year,
54691                    datetime,
54692                    suffix;
54693                if (!this.isLocal()) {
54694                    func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
54695                    zone = 'Z';
54696                }
54697                prefix = '[' + func + '("]';
54698                year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY';
54699                datetime = '-MM-DD[T]HH:mm:ss.SSS';
54700                suffix = zone + '[")]';
54701
54702                return this.format(prefix + year + datetime + suffix);
54703            }
54704
54705            function format(inputString) {
54706                if (!inputString) {
54707                    inputString = this.isUtc()
54708                        ? hooks.defaultFormatUtc
54709                        : hooks.defaultFormat;
54710                }
54711                var output = formatMoment(this, inputString);
54712                return this.localeData().postformat(output);
54713            }
54714
54715            function from(time, withoutSuffix) {
54716                if (
54717                    this.isValid() &&
54718                    ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
54719                ) {
54720                    return createDuration({to: this, from: time})
54721                        .locale(this.locale())
54722                        .humanize(!withoutSuffix);
54723                } else {
54724                    return this.localeData().invalidDate();
54725                }
54726            }
54727
54728            function fromNow(withoutSuffix) {
54729                return this.from(createLocal(), withoutSuffix);
54730            }
54731
54732            function to(time, withoutSuffix) {
54733                if (
54734                    this.isValid() &&
54735                    ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
54736                ) {
54737                    return createDuration({from: this, to: time})
54738                        .locale(this.locale())
54739                        .humanize(!withoutSuffix);
54740                } else {
54741                    return this.localeData().invalidDate();
54742                }
54743            }
54744
54745            function toNow(withoutSuffix) {
54746                return this.to(createLocal(), withoutSuffix);
54747            }
54748
54749            // If passed a locale key, it will set the locale for this
54750            // instance.  Otherwise, it will return the locale configuration
54751            // variables for this instance.
54752            function locale(key) {
54753                var newLocaleData;
54754
54755                if (key === undefined) {
54756                    return this._locale._abbr;
54757                } else {
54758                    newLocaleData = getLocale(key);
54759                    if (newLocaleData != null) {
54760                        this._locale = newLocaleData;
54761                    }
54762                    return this;
54763                }
54764            }
54765
54766            var lang = deprecate(
54767                'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
54768                function (key) {
54769                    if (key === undefined) {
54770                        return this.localeData();
54771                    } else {
54772                        return this.locale(key);
54773                    }
54774                }
54775            );
54776
54777            function localeData() {
54778                return this._locale;
54779            }
54780
54781            var MS_PER_SECOND = 1000,
54782                MS_PER_MINUTE = 60 * MS_PER_SECOND,
54783                MS_PER_HOUR = 60 * MS_PER_MINUTE,
54784                MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
54785
54786            // actual modulo - handles negative numbers (for dates before 1970):
54787            function mod$1(dividend, divisor) {
54788                return ((dividend % divisor) + divisor) % divisor;
54789            }
54790
54791            function localStartOfDate(y, m, d) {
54792                // the date constructor remaps years 0-99 to 1900-1999
54793                if (y < 100 && y >= 0) {
54794                    // preserve leap years using a full 400 year cycle, then reset
54795                    return new Date(y + 400, m, d) - MS_PER_400_YEARS;
54796                } else {
54797                    return new Date(y, m, d).valueOf();
54798                }
54799            }
54800
54801            function utcStartOfDate(y, m, d) {
54802                // Date.UTC remaps years 0-99 to 1900-1999
54803                if (y < 100 && y >= 0) {
54804                    // preserve leap years using a full 400 year cycle, then reset
54805                    return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
54806                } else {
54807                    return Date.UTC(y, m, d);
54808                }
54809            }
54810
54811            function startOf(units) {
54812                var time, startOfDate;
54813                units = normalizeUnits(units);
54814                if (units === undefined || units === 'millisecond' || !this.isValid()) {
54815                    return this;
54816                }
54817
54818                startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
54819
54820                switch (units) {
54821                    case 'year':
54822                        time = startOfDate(this.year(), 0, 1);
54823                        break;
54824                    case 'quarter':
54825                        time = startOfDate(
54826                            this.year(),
54827                            this.month() - (this.month() % 3),
54828                            1
54829                        );
54830                        break;
54831                    case 'month':
54832                        time = startOfDate(this.year(), this.month(), 1);
54833                        break;
54834                    case 'week':
54835                        time = startOfDate(
54836                            this.year(),
54837                            this.month(),
54838                            this.date() - this.weekday()
54839                        );
54840                        break;
54841                    case 'isoWeek':
54842                        time = startOfDate(
54843                            this.year(),
54844                            this.month(),
54845                            this.date() - (this.isoWeekday() - 1)
54846                        );
54847                        break;
54848                    case 'day':
54849                    case 'date':
54850                        time = startOfDate(this.year(), this.month(), this.date());
54851                        break;
54852                    case 'hour':
54853                        time = this._d.valueOf();
54854                        time -= mod$1(
54855                            time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
54856                            MS_PER_HOUR
54857                        );
54858                        break;
54859                    case 'minute':
54860                        time = this._d.valueOf();
54861                        time -= mod$1(time, MS_PER_MINUTE);
54862                        break;
54863                    case 'second':
54864                        time = this._d.valueOf();
54865                        time -= mod$1(time, MS_PER_SECOND);
54866                        break;
54867                }
54868
54869                this._d.setTime(time);
54870                hooks.updateOffset(this, true);
54871                return this;
54872            }
54873
54874            function endOf(units) {
54875                var time, startOfDate;
54876                units = normalizeUnits(units);
54877                if (units === undefined || units === 'millisecond' || !this.isValid()) {
54878                    return this;
54879                }
54880
54881                startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
54882
54883                switch (units) {
54884                    case 'year':
54885                        time = startOfDate(this.year() + 1, 0, 1) - 1;
54886                        break;
54887                    case 'quarter':
54888                        time =
54889                            startOfDate(
54890                                this.year(),
54891                                this.month() - (this.month() % 3) + 3,
54892                                1
54893                            ) - 1;
54894                        break;
54895                    case 'month':
54896                        time = startOfDate(this.year(), this.month() + 1, 1) - 1;
54897                        break;
54898                    case 'week':
54899                        time =
54900                            startOfDate(
54901                                this.year(),
54902                                this.month(),
54903                                this.date() - this.weekday() + 7
54904                            ) - 1;
54905                        break;
54906                    case 'isoWeek':
54907                        time =
54908                            startOfDate(
54909                                this.year(),
54910                                this.month(),
54911                                this.date() - (this.isoWeekday() - 1) + 7
54912                            ) - 1;
54913                        break;
54914                    case 'day':
54915                    case 'date':
54916                        time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
54917                        break;
54918                    case 'hour':
54919                        time = this._d.valueOf();
54920                        time +=
54921                            MS_PER_HOUR -
54922                            mod$1(
54923                                time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
54924                                MS_PER_HOUR
54925                            ) -
54926                            1;
54927                        break;
54928                    case 'minute':
54929                        time = this._d.valueOf();
54930                        time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
54931                        break;
54932                    case 'second':
54933                        time = this._d.valueOf();
54934                        time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
54935                        break;
54936                }
54937
54938                this._d.setTime(time);
54939                hooks.updateOffset(this, true);
54940                return this;
54941            }
54942
54943            function valueOf() {
54944                return this._d.valueOf() - (this._offset || 0) * 60000;
54945            }
54946
54947            function unix() {
54948                return Math.floor(this.valueOf() / 1000);
54949            }
54950
54951            function toDate() {
54952                return new Date(this.valueOf());
54953            }
54954
54955            function toArray() {
54956                var m = this;
54957                return [
54958                    m.year(),
54959                    m.month(),
54960                    m.date(),
54961                    m.hour(),
54962                    m.minute(),
54963                    m.second(),
54964                    m.millisecond(),
54965                ];
54966            }
54967
54968            function toObject() {
54969                var m = this;
54970                return {
54971                    years: m.year(),
54972                    months: m.month(),
54973                    date: m.date(),
54974                    hours: m.hours(),
54975                    minutes: m.minutes(),
54976                    seconds: m.seconds(),
54977                    milliseconds: m.milliseconds(),
54978                };
54979            }
54980
54981            function toJSON() {
54982                // new Date(NaN).toJSON() === null
54983                return this.isValid() ? this.toISOString() : null;
54984            }
54985
54986            function isValid$2() {
54987                return isValid(this);
54988            }
54989
54990            function parsingFlags() {
54991                return extend({}, getParsingFlags(this));
54992            }
54993
vendor: 11,198 bytes, lines 54994-55302
54994            function invalidAt() {
54995                return getParsingFlags(this).overflow;
54996            }
54997
54998            function creationData() {
54999                return {
55000                    input: this._i,
55001                    format: this._f,
55002                    locale: this._locale,
55003                    isUTC: this._isUTC,
55004                    strict: this._strict,
55005                };
55006            }
55007
55008            addFormatToken('N', 0, 0, 'eraAbbr');
55009            addFormatToken('NN', 0, 0, 'eraAbbr');
55010            addFormatToken('NNN', 0, 0, 'eraAbbr');
55011            addFormatToken('NNNN', 0, 0, 'eraName');
55012            addFormatToken('NNNNN', 0, 0, 'eraNarrow');
55013
55014            addFormatToken('y', ['y', 1], 'yo', 'eraYear');
55015            addFormatToken('y', ['yy', 2], 0, 'eraYear');
55016            addFormatToken('y', ['yyy', 3], 0, 'eraYear');
55017            addFormatToken('y', ['yyyy', 4], 0, 'eraYear');
55018
55019            addRegexToken('N', matchEraAbbr);
55020            addRegexToken('NN', matchEraAbbr);
55021            addRegexToken('NNN', matchEraAbbr);
55022            addRegexToken('NNNN', matchEraName);
55023            addRegexToken('NNNNN', matchEraNarrow);
55024
55025            addParseToken(['N', 'NN', 'NNN', 'NNNN', 'NNNNN'], function (
55026                input,
55027                array,
55028                config,
55029                token
55030            ) {
55031                var era = config._locale.erasParse(input, token, config._strict);
55032                if (era) {
55033                    getParsingFlags(config).era = era;
55034                } else {
55035                    getParsingFlags(config).invalidEra = input;
55036                }
55037            });
55038
55039            addRegexToken('y', matchUnsigned);
55040            addRegexToken('yy', matchUnsigned);
55041            addRegexToken('yyy', matchUnsigned);
55042            addRegexToken('yyyy', matchUnsigned);
55043            addRegexToken('yo', matchEraYearOrdinal);
55044
55045            addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR);
55046            addParseToken(['yo'], function (input, array, config, token) {
55047                var match;
55048                if (config._locale._eraYearOrdinalRegex) {
55049                    match = input.match(config._locale._eraYearOrdinalRegex);
55050                }
55051
55052                if (config._locale.eraYearOrdinalParse) {
55053                    array[YEAR] = config._locale.eraYearOrdinalParse(input, match);
55054                } else {
55055                    array[YEAR] = parseInt(input, 10);
55056                }
55057            });
55058
55059            function localeEras(m, format) {
55060                var i,
55061                    l,
55062                    date,
55063                    eras = this._eras || getLocale('en')._eras;
55064                for (i = 0, l = eras.length; i < l; ++i) {
55065                    switch (typeof eras[i].since) {
55066                        case 'string':
55067                            // truncate time
55068                            date = hooks(eras[i].since).startOf('day');
55069                            eras[i].since = date.valueOf();
55070                            break;
55071                    }
55072
55073                    switch (typeof eras[i].until) {
55074                        case 'undefined':
55075                            eras[i].until = +Infinity;
55076                            break;
55077                        case 'string':
55078                            // truncate time
55079                            date = hooks(eras[i].until).startOf('day').valueOf();
55080                            eras[i].until = date.valueOf();
55081                            break;
55082                    }
55083                }
55084                return eras;
55085            }
55086
55087            function localeErasParse(eraName, format, strict) {
55088                var i,
55089                    l,
55090                    eras = this.eras(),
55091                    name,
55092                    abbr,
55093                    narrow;
55094                eraName = eraName.toUpperCase();
55095
55096                for (i = 0, l = eras.length; i < l; ++i) {
55097                    name = eras[i].name.toUpperCase();
55098                    abbr = eras[i].abbr.toUpperCase();
55099                    narrow = eras[i].narrow.toUpperCase();
55100
55101                    if (strict) {
55102                        switch (format) {
55103                            case 'N':
55104                            case 'NN':
55105                            case 'NNN':
55106                                if (abbr === eraName) {
55107                                    return eras[i];
55108                                }
55109                                break;
55110
55111                            case 'NNNN':
55112                                if (name === eraName) {
55113                                    return eras[i];
55114                                }
55115                                break;
55116
55117                            case 'NNNNN':
55118                                if (narrow === eraName) {
55119                                    return eras[i];
55120                                }
55121                                break;
55122                        }
55123                    } else if ([name, abbr, narrow].indexOf(eraName) >= 0) {
55124                        return eras[i];
55125                    }
55126                }
55127            }
55128
55129            function localeErasConvertYear(era, year) {
55130                var dir = era.since <= era.until ? +1 : -1;
55131                if (year === undefined) {
55132                    return hooks(era.since).year();
55133                } else {
55134                    return hooks(era.since).year() + (year - era.offset) * dir;
55135                }
55136            }
55137
55138            function getEraName() {
55139                var i,
55140                    l,
55141                    val,
55142                    eras = this.localeData().eras();
55143                for (i = 0, l = eras.length; i < l; ++i) {
55144                    // truncate time
55145                    val = this.clone().startOf('day').valueOf();
55146
55147                    if (eras[i].since <= val && val <= eras[i].until) {
55148                        return eras[i].name;
55149                    }
55150                    if (eras[i].until <= val && val <= eras[i].since) {
55151                        return eras[i].name;
55152                    }
55153                }
55154
55155                return '';
55156            }
55157
55158            function getEraNarrow() {
55159                var i,
55160                    l,
55161                    val,
55162                    eras = this.localeData().eras();
55163                for (i = 0, l = eras.length; i < l; ++i) {
55164                    // truncate time
55165                    val = this.clone().startOf('day').valueOf();
55166
55167                    if (eras[i].since <= val && val <= eras[i].until) {
55168                        return eras[i].narrow;
55169                    }
55170                    if (eras[i].until <= val && val <= eras[i].since) {
55171                        return eras[i].narrow;
55172                    }
55173                }
55174
55175                return '';
55176            }
55177
55178            function getEraAbbr() {
55179                var i,
55180                    l,
55181                    val,
55182                    eras = this.localeData().eras();
55183                for (i = 0, l = eras.length; i < l; ++i) {
55184                    // truncate time
55185                    val = this.clone().startOf('day').valueOf();
55186
55187                    if (eras[i].since <= val && val <= eras[i].until) {
55188                        return eras[i].abbr;
55189                    }
55190                    if (eras[i].until <= val && val <= eras[i].since) {
55191                        return eras[i].abbr;
55192                    }
55193                }
55194
55195                return '';
55196            }
55197
55198            function getEraYear() {
55199                var i,
55200                    l,
55201                    dir,
55202                    val,
55203                    eras = this.localeData().eras();
55204                for (i = 0, l = eras.length; i < l; ++i) {
55205                    dir = eras[i].since <= eras[i].until ? +1 : -1;
55206
55207                    // truncate time
55208                    val = this.clone().startOf('day').valueOf();
55209
55210                    if (
55211                        (eras[i].since <= val && val <= eras[i].until) ||
55212                        (eras[i].until <= val && val <= eras[i].since)
55213                    ) {
55214                        return (
55215                            (this.year() - hooks(eras[i].since).year()) * dir +
55216                            eras[i].offset
55217                        );
55218                    }
55219                }
55220
55221                return this.year();
55222            }
55223
55224            function erasNameRegex(isStrict) {
55225                if (!hasOwnProp(this, '_erasNameRegex')) {
55226                    computeErasParse.call(this);
55227                }
55228                return isStrict ? this._erasNameRegex : this._erasRegex;
55229            }
55230
55231            function erasAbbrRegex(isStrict) {
55232                if (!hasOwnProp(this, '_erasAbbrRegex')) {
55233                    computeErasParse.call(this);
55234                }
55235                return isStrict ? this._erasAbbrRegex : this._erasRegex;
55236            }
55237
55238            function erasNarrowRegex(isStrict) {
55239                if (!hasOwnProp(this, '_erasNarrowRegex')) {
55240                    computeErasParse.call(this);
55241                }
55242                return isStrict ? this._erasNarrowRegex : this._erasRegex;
55243            }
55244
55245            function matchEraAbbr(isStrict, locale) {
55246                return locale.erasAbbrRegex(isStrict);
55247            }
55248
55249            function matchEraName(isStrict, locale) {
55250                return locale.erasNameRegex(isStrict);
55251            }
55252
55253            function matchEraNarrow(isStrict, locale) {
55254                return locale.erasNarrowRegex(isStrict);
55255            }
55256
55257            function matchEraYearOrdinal(isStrict, locale) {
55258                return locale._eraYearOrdinalRegex || matchUnsigned;
55259            }
55260
55261            function computeErasParse() {
55262                var abbrPieces = [],
55263                    namePieces = [],
55264                    narrowPieces = [],
55265                    mixedPieces = [],
55266                    i,
55267                    l,
55268                    eras = this.eras();
55269
55270                for (i = 0, l = eras.length; i < l; ++i) {
55271                    namePieces.push(regexEscape(eras[i].name));
55272                    abbrPieces.push(regexEscape(eras[i].abbr));
55273                    narrowPieces.push(regexEscape(eras[i].narrow));
55274
55275                    mixedPieces.push(regexEscape(eras[i].name));
55276                    mixedPieces.push(regexEscape(eras[i].abbr));
55277                    mixedPieces.push(regexEscape(eras[i].narrow));
55278                }
55279
55280                this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
55281                this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i');
55282                this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i');
55283                this._erasNarrowRegex = new RegExp(
55284                    '^(' + narrowPieces.join('|') + ')',
55285                    'i'
55286                );
55287            }
55288
55289            // FORMATTING
55290
55291            addFormatToken(0, ['gg', 2], 0, function () {
55292                return this.weekYear() % 100;
55293            });
55294
55295            addFormatToken(0, ['GG', 2], 0, function () {
55296                return this.isoWeekYear() % 100;
55297            });
55298
55299            function addWeekYearFormatToken(token, getter) {
55300                addFormatToken(0, [token, token.length], 0, getter);
55301            }
55302
vendor: 11,065 bytes, lines 55303-55659
55303            addWeekYearFormatToken('gggg', 'weekYear');
55304            addWeekYearFormatToken('ggggg', 'weekYear');
55305            addWeekYearFormatToken('GGGG', 'isoWeekYear');
55306            addWeekYearFormatToken('GGGGG', 'isoWeekYear');
55307
55308            // ALIASES
55309
55310            addUnitAlias('weekYear', 'gg');
55311            addUnitAlias('isoWeekYear', 'GG');
55312
55313            // PRIORITY
55314
55315            addUnitPriority('weekYear', 1);
55316            addUnitPriority('isoWeekYear', 1);
55317
55318            // PARSING
55319
55320            addRegexToken('G', matchSigned);
55321            addRegexToken('g', matchSigned);
55322            addRegexToken('GG', match1to2, match2);
55323            addRegexToken('gg', match1to2, match2);
55324            addRegexToken('GGGG', match1to4, match4);
55325            addRegexToken('gggg', match1to4, match4);
55326            addRegexToken('GGGGG', match1to6, match6);
55327            addRegexToken('ggggg', match1to6, match6);
55328
55329            addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (
55330                input,
55331                week,
55332                config,
55333                token
55334            ) {
55335                week[token.substr(0, 2)] = toInt(input);
55336            });
55337
55338            addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
55339                week[token] = hooks.parseTwoDigitYear(input);
55340            });
55341
55342            // MOMENTS
55343
55344            function getSetWeekYear(input) {
55345                return getSetWeekYearHelper.call(
55346                    this,
55347                    input,
55348                    this.week(),
55349                    this.weekday(),
55350                    this.localeData()._week.dow,
55351                    this.localeData()._week.doy
55352                );
55353            }
55354
55355            function getSetISOWeekYear(input) {
55356                return getSetWeekYearHelper.call(
55357                    this,
55358                    input,
55359                    this.isoWeek(),
55360                    this.isoWeekday(),
55361                    1,
55362                    4
55363                );
55364            }
55365
55366            function getISOWeeksInYear() {
55367                return weeksInYear(this.year(), 1, 4);
55368            }
55369
55370            function getISOWeeksInISOWeekYear() {
55371                return weeksInYear(this.isoWeekYear(), 1, 4);
55372            }
55373
55374            function getWeeksInYear() {
55375                var weekInfo = this.localeData()._week;
55376                return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
55377            }
55378
55379            function getWeeksInWeekYear() {
55380                var weekInfo = this.localeData()._week;
55381                return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy);
55382            }
55383
55384            function getSetWeekYearHelper(input, week, weekday, dow, doy) {
55385                var weeksTarget;
55386                if (input == null) {
55387                    return weekOfYear(this, dow, doy).year;
55388                } else {
55389                    weeksTarget = weeksInYear(input, dow, doy);
55390                    if (week > weeksTarget) {
55391                        week = weeksTarget;
55392                    }
55393                    return setWeekAll.call(this, input, week, weekday, dow, doy);
55394                }
55395            }
55396
55397            function setWeekAll(weekYear, week, weekday, dow, doy) {
55398                var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
55399                    date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
55400
55401                this.year(date.getUTCFullYear());
55402                this.month(date.getUTCMonth());
55403                this.date(date.getUTCDate());
55404                return this;
55405            }
55406
55407            // FORMATTING
55408
55409            addFormatToken('Q', 0, 'Qo', 'quarter');
55410
55411            // ALIASES
55412
55413            addUnitAlias('quarter', 'Q');
55414
55415            // PRIORITY
55416
55417            addUnitPriority('quarter', 7);
55418
55419            // PARSING
55420
55421            addRegexToken('Q', match1);
55422            addParseToken('Q', function (input, array) {
55423                array[MONTH] = (toInt(input) - 1) * 3;
55424            });
55425
55426            // MOMENTS
55427
55428            function getSetQuarter(input) {
55429                return input == null
55430                    ? Math.ceil((this.month() + 1) / 3)
55431                    : this.month((input - 1) * 3 + (this.month() % 3));
55432            }
55433
55434            // FORMATTING
55435
55436            addFormatToken('D', ['DD', 2], 'Do', 'date');
55437
55438            // ALIASES
55439
55440            addUnitAlias('date', 'D');
55441
55442            // PRIORITY
55443            addUnitPriority('date', 9);
55444
55445            // PARSING
55446
55447            addRegexToken('D', match1to2);
55448            addRegexToken('DD', match1to2, match2);
55449            addRegexToken('Do', function (isStrict, locale) {
55450                // TODO: Remove "ordinalParse" fallback in next major release.
55451                return isStrict
55452                    ? locale._dayOfMonthOrdinalParse || locale._ordinalParse
55453                    : locale._dayOfMonthOrdinalParseLenient;
55454            });
55455
55456            addParseToken(['D', 'DD'], DATE);
55457            addParseToken('Do', function (input, array) {
55458                array[DATE] = toInt(input.match(match1to2)[0]);
55459            });
55460
55461            // MOMENTS
55462
55463            var getSetDayOfMonth = makeGetSet('Date', true);
55464
55465            // FORMATTING
55466
55467            addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
55468
55469            // ALIASES
55470
55471            addUnitAlias('dayOfYear', 'DDD');
55472
55473            // PRIORITY
55474            addUnitPriority('dayOfYear', 4);
55475
55476            // PARSING
55477
55478            addRegexToken('DDD', match1to3);
55479            addRegexToken('DDDD', match3);
55480            addParseToken(['DDD', 'DDDD'], function (input, array, config) {
55481                config._dayOfYear = toInt(input);
55482            });
55483
55484            // HELPERS
55485
55486            // MOMENTS
55487
55488            function getSetDayOfYear(input) {
55489                var dayOfYear =
55490                    Math.round(
55491                        (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5
55492                    ) + 1;
55493                return input == null ? dayOfYear : this.add(input - dayOfYear, 'd');
55494            }
55495
55496            // FORMATTING
55497
55498            addFormatToken('m', ['mm', 2], 0, 'minute');
55499
55500            // ALIASES
55501
55502            addUnitAlias('minute', 'm');
55503
55504            // PRIORITY
55505
55506            addUnitPriority('minute', 14);
55507
55508            // PARSING
55509
55510            addRegexToken('m', match1to2);
55511            addRegexToken('mm', match1to2, match2);
55512            addParseToken(['m', 'mm'], MINUTE);
55513
55514            // MOMENTS
55515
55516            var getSetMinute = makeGetSet('Minutes', false);
55517
55518            // FORMATTING
55519
55520            addFormatToken('s', ['ss', 2], 0, 'second');
55521
55522            // ALIASES
55523
55524            addUnitAlias('second', 's');
55525
55526            // PRIORITY
55527
55528            addUnitPriority('second', 15);
55529
55530            // PARSING
55531
55532            addRegexToken('s', match1to2);
55533            addRegexToken('ss', match1to2, match2);
55534            addParseToken(['s', 'ss'], SECOND);
55535
55536            // MOMENTS
55537
55538            var getSetSecond = makeGetSet('Seconds', false);
55539
55540            // FORMATTING
55541
55542            addFormatToken('S', 0, 0, function () {
55543                return ~~(this.millisecond() / 100);
55544            });
55545
55546            addFormatToken(0, ['SS', 2], 0, function () {
55547                return ~~(this.millisecond() / 10);
55548            });
55549
55550            addFormatToken(0, ['SSS', 3], 0, 'millisecond');
55551            addFormatToken(0, ['SSSS', 4], 0, function () {
55552                return this.millisecond() * 10;
55553            });
55554            addFormatToken(0, ['SSSSS', 5], 0, function () {
55555                return this.millisecond() * 100;
55556            });
55557            addFormatToken(0, ['SSSSSS', 6], 0, function () {
55558                return this.millisecond() * 1000;
55559            });
55560            addFormatToken(0, ['SSSSSSS', 7], 0, function () {
55561                return this.millisecond() * 10000;
55562            });
55563            addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
55564                return this.millisecond() * 100000;
55565            });
55566            addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
55567                return this.millisecond() * 1000000;
55568            });
55569
55570            // ALIASES
55571
55572            addUnitAlias('millisecond', 'ms');
55573
55574            // PRIORITY
55575
55576            addUnitPriority('millisecond', 16);
55577
55578            // PARSING
55579
55580            addRegexToken('S', match1to3, match1);
55581            addRegexToken('SS', match1to3, match2);
55582            addRegexToken('SSS', match1to3, match3);
55583
55584            var token, getSetMillisecond;
55585            for (token = 'SSSS'; token.length <= 9; token += 'S') {
55586                addRegexToken(token, matchUnsigned);
55587            }
55588
55589            function parseMs(input, array) {
55590                array[MILLISECOND] = toInt(('0.' + input) * 1000);
55591            }
55592
55593            for (token = 'S'; token.length <= 9; token += 'S') {
55594                addParseToken(token, parseMs);
55595            }
55596
55597            getSetMillisecond = makeGetSet('Milliseconds', false);
55598
55599            // FORMATTING
55600
55601            addFormatToken('z', 0, 0, 'zoneAbbr');
55602            addFormatToken('zz', 0, 0, 'zoneName');
55603
55604            // MOMENTS
55605
55606            function getZoneAbbr() {
55607                return this._isUTC ? 'UTC' : '';
55608            }
55609
55610            function getZoneName() {
55611                return this._isUTC ? 'Coordinated Universal Time' : '';
55612            }
55613
55614            var proto = Moment.prototype;
55615
55616            proto.add = add;
55617            proto.calendar = calendar$1;
55618            proto.clone = clone;
55619            proto.diff = diff;
55620            proto.endOf = endOf;
55621            proto.format = format;
55622            proto.from = from;
55623            proto.fromNow = fromNow;
55624            proto.to = to;
55625            proto.toNow = toNow;
55626            proto.get = stringGet;
55627            proto.invalidAt = invalidAt;
55628            proto.isAfter = isAfter;
55629            proto.isBefore = isBefore;
55630            proto.isBetween = isBetween;
55631            proto.isSame = isSame;
55632            proto.isSameOrAfter = isSameOrAfter;
55633            proto.isSameOrBefore = isSameOrBefore;
55634            proto.isValid = isValid$2;
55635            proto.lang = lang;
55636            proto.locale = locale;
55637            proto.localeData = localeData;
55638            proto.max = prototypeMax;
55639            proto.min = prototypeMin;
55640            proto.parsingFlags = parsingFlags;
55641            proto.set = stringSet;
55642            proto.startOf = startOf;
55643            proto.subtract = subtract;
55644            proto.toArray = toArray;
55645            proto.toObject = toObject;
55646            proto.toDate = toDate;
55647            proto.toISOString = toISOString;
55648            proto.inspect = inspect;
55649            if (typeof Symbol !== 'undefined' && Symbol.for != null) {
55650                proto[Symbol.for('nodejs.util.inspect.custom')] = function () {
55651                    return 'Moment<' + this.format() + '>';
55652                };
55653            }
55654            proto.toJSON = toJSON;
55655            proto.toString = toString;
55656            proto.unix = unix;
55657            proto.valueOf = valueOf;
55658            proto.creationData = creationData;
55659            proto.eraName = getEraName;
55660            proto.eraNarrow = getEraNarrow;
55661            proto.eraAbbr = getEraAbbr;
55662            proto.eraYear = getEraYear;
55663            proto.year = getSetYear;
55664            proto.isLeapYear = getIsLeapYear;
55665            proto.weekYear = getSetWeekYear;
55666            proto.isoWeekYear = getSetISOWeekYear;
55667            proto.quarter = proto.quarters = getSetQuarter;
55668            proto.month = getSetMonth;
55669            proto.daysInMonth = getDaysInMonth;
55670            proto.week = proto.weeks = getSetWeek;
55671            proto.isoWeek = proto.isoWeeks = getSetISOWeek;
55672            proto.weeksInYear = getWeeksInYear;
55673            proto.weeksInWeekYear = getWeeksInWeekYear;
55674            proto.isoWeeksInYear = getISOWeeksInYear;
55675            proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;
55676            proto.date = getSetDayOfMonth;
55677            proto.day = proto.days = getSetDayOfWeek;
55678            proto.weekday = getSetLocaleDayOfWeek;
55679            proto.isoWeekday = getSetISODayOfWeek;
55680            proto.dayOfYear = getSetDayOfYear;
55681            proto.hour = proto.hours = getSetHour;
55682            proto.minute = proto.minutes = getSetMinute;
55683            proto.second = proto.seconds = getSetSecond;
55684            proto.millisecond = proto.milliseconds = getSetMillisecond;
55685            proto.utcOffset = getSetOffset;
55686            proto.utc = setOffsetToUTC;
55687            proto.local = setOffsetToLocal;
55688            proto.parseZone = setOffsetToParsedOffset;
55689            proto.hasAlignedHourOffset = hasAlignedHourOffset;
55690            proto.isDST = isDaylightSavingTime;
55691            proto.isLocal = isLocal;
55692            proto.isUtcOffset = isUtcOffset;
55693            proto.isUtc = isUtc;
55694            proto.isUTC = isUtc;
55695            proto.zoneAbbr = getZoneAbbr;
55696            proto.zoneName = getZoneName;
55697            proto.dates = deprecate(
55698                'dates accessor is deprecated. Use date instead.',
55699                getSetDayOfMonth
55700            );
55701            proto.months = deprecate(
55702                'months accessor is deprecated. Use month instead',
55703                getSetMonth
55704            );
55705            proto.years = deprecate(
55706                'years accessor is deprecated. Use year instead',
55707                getSetYear
55708            );
55709            proto.zone = deprecate(
55710                'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/',
55711                getSetZone
55712            );
55713            proto.isDSTShifted = deprecate(
55714                'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information',
55715                isDaylightSavingTimeShifted
55716            );
55717
55718            function createUnix(input) {
55719                return createLocal(input * 1000);
55720            }
55721
55722            function createInZone() {
55723                return createLocal.apply(null, arguments).parseZone();
55724            }
55725
55726            function preParsePostFormat(string) {
55727                return string;
55728            }
55729
55730            var proto$1 = Locale.prototype;
55731
55732            proto$1.calendar = calendar;
55733            proto$1.longDateFormat = longDateFormat;
55734            proto$1.invalidDate = invalidDate;
55735            proto$1.ordinal = ordinal;
55736            proto$1.preparse = preParsePostFormat;
55737            proto$1.postformat = preParsePostFormat;
55738            proto$1.relativeTime = relativeTime;
55739            proto$1.pastFuture = pastFuture;
55740            proto$1.set = set;
55741            proto$1.eras = localeEras;
55742            proto$1.erasParse = localeErasParse;
55743            proto$1.erasConvertYear = localeErasConvertYear;
55744            proto$1.erasAbbrRegex = erasAbbrRegex;
55745            proto$1.erasNameRegex = erasNameRegex;
55746            proto$1.erasNarrowRegex = erasNarrowRegex;
55747
55748            proto$1.months = localeMonths;
55749            proto$1.monthsShort = localeMonthsShort;
55750            proto$1.monthsParse = localeMonthsParse;
55751            proto$1.monthsRegex = monthsRegex;
55752            proto$1.monthsShortRegex = monthsShortRegex;
55753            proto$1.week = localeWeek;
55754            proto$1.firstDayOfYear = localeFirstDayOfYear;
55755            proto$1.firstDayOfWeek = localeFirstDayOfWeek;
55756
55757            proto$1.weekdays = localeWeekdays;
55758            proto$1.weekdaysMin = localeWeekdaysMin;
55759            proto$1.weekdaysShort = localeWeekdaysShort;
55760            proto$1.weekdaysParse = localeWeekdaysParse;
55761
55762            proto$1.weekdaysRegex = weekdaysRegex;
55763            proto$1.weekdaysShortRegex = weekdaysShortRegex;
55764            proto$1.weekdaysMinRegex = weekdaysMinRegex;
55765
55766            proto$1.isPM = localeIsPM;
55767            proto$1.meridiem = localeMeridiem;
55768
55769            function get$1(format, index, field, setter) {
55770                var locale = getLocale(),
55771                    utc = createUTC().set(setter, index);
vendor: 23,742 bytes, lines 55772-56408
55772                return locale[field](utc, format);
55773            }
55774
55775            function listMonthsImpl(format, index, field) {
55776                if (isNumber(format)) {
55777                    index = format;
55778                    format = undefined;
55779                }
55780
55781                format = format || '';
55782
55783                if (index != null) {
55784                    return get$1(format, index, field, 'month');
55785                }
55786
55787                var i,
55788                    out = [];
55789                for (i = 0; i < 12; i++) {
55790                    out[i] = get$1(format, i, field, 'month');
55791                }
55792                return out;
55793            }
55794
55795            // ()
55796            // (5)
55797            // (fmt, 5)
55798            // (fmt)
55799            // (true)
55800            // (true, 5)
55801            // (true, fmt, 5)
55802            // (true, fmt)
55803            function listWeekdaysImpl(localeSorted, format, index, field) {
55804                if (typeof localeSorted === 'boolean') {
55805                    if (isNumber(format)) {
55806                        index = format;
55807                        format = undefined;
55808                    }
55809
55810                    format = format || '';
55811                } else {
55812                    format = localeSorted;
55813                    index = format;
55814                    localeSorted = false;
55815
55816                    if (isNumber(format)) {
55817                        index = format;
55818                        format = undefined;
55819                    }
55820
55821                    format = format || '';
55822                }
55823
55824                var locale = getLocale(),
55825                    shift = localeSorted ? locale._week.dow : 0,
55826                    i,
55827                    out = [];
55828
55829                if (index != null) {
55830                    return get$1(format, (index + shift) % 7, field, 'day');
55831                }
55832
55833                for (i = 0; i < 7; i++) {
55834                    out[i] = get$1(format, (i + shift) % 7, field, 'day');
55835                }
55836                return out;
55837            }
55838
55839            function listMonths(format, index) {
55840                return listMonthsImpl(format, index, 'months');
55841            }
55842
55843            function listMonthsShort(format, index) {
55844                return listMonthsImpl(format, index, 'monthsShort');
55845            }
55846
55847            function listWeekdays(localeSorted, format, index) {
55848                return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
55849            }
55850
55851            function listWeekdaysShort(localeSorted, format, index) {
55852                return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
55853            }
55854
55855            function listWeekdaysMin(localeSorted, format, index) {
55856                return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
55857            }
55858
55859            getSetGlobalLocale('en', {
55860                eras: [
55861                    {
55862                        since: '0001-01-01',
55863                        until: +Infinity,
55864                        offset: 1,
55865                        name: 'Anno Domini',
55866                        narrow: 'AD',
55867                        abbr: 'AD',
55868                    },
55869                    {
55870                        since: '0000-12-31',
55871                        until: -Infinity,
55872                        offset: 1,
55873                        name: 'Before Christ',
55874                        narrow: 'BC',
55875                        abbr: 'BC',
55876                    },
55877                ],
55878                dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
55879                ordinal: function (number) {
55880                    var b = number % 10,
55881                        output =
55882                            toInt((number % 100) / 10) === 1
55883                                ? 'th'
55884                                : b === 1
55885                                    ? 'st'
55886                                    : b === 2
55887                                        ? 'nd'
55888                                        : b === 3
55889                                            ? 'rd'
55890                                            : 'th';
55891                    return number + output;
55892                },
55893            });
55894
55895            // Side effect imports
55896
55897            hooks.lang = deprecate(
55898                'moment.lang is deprecated. Use moment.locale instead.',
55899                getSetGlobalLocale
55900            );
55901            hooks.langData = deprecate(
55902                'moment.langData is deprecated. Use moment.localeData instead.',
55903                getLocale
55904            );
55905
55906            var mathAbs = Math.abs;
55907
55908            function abs() {
55909                var data = this._data;
55910
55911                this._milliseconds = mathAbs(this._milliseconds);
55912                this._days = mathAbs(this._days);
55913                this._months = mathAbs(this._months);
55914
55915                data.milliseconds = mathAbs(data.milliseconds);
55916                data.seconds = mathAbs(data.seconds);
55917                data.minutes = mathAbs(data.minutes);
55918                data.hours = mathAbs(data.hours);
55919                data.months = mathAbs(data.months);
55920                data.years = mathAbs(data.years);
55921
55922                return this;
55923            }
55924
55925            function addSubtract$1(duration, input, value, direction) {
55926                var other = createDuration(input, value);
55927
55928                duration._milliseconds += direction * other._milliseconds;
55929                duration._days += direction * other._days;
55930                duration._months += direction * other._months;
55931
55932                return duration._bubble();
55933            }
55934
55935            // supports only 2.0-style add(1, 's') or add(duration)
55936            function add$1(input, value) {
55937                return addSubtract$1(this, input, value, 1);
55938            }
55939
55940            // supports only 2.0-style subtract(1, 's') or subtract(duration)
55941            function subtract$1(input, value) {
55942                return addSubtract$1(this, input, value, -1);
55943            }
55944
55945            function absCeil(number) {
55946                if (number < 0) {
55947                    return Math.floor(number);
55948                } else {
55949                    return Math.ceil(number);
55950                }
55951            }
55952
55953            function bubble() {
55954                var milliseconds = this._milliseconds,
55955                    days = this._days,
55956                    months = this._months,
55957                    data = this._data,
55958                    seconds,
55959                    minutes,
55960                    hours,
55961                    years,
55962                    monthsFromDays;
55963
55964                // if we have a mix of positive and negative values, bubble down first
55965                // check: https://github.com/moment/moment/issues/2166
55966                if (
55967                    !(
55968                        (milliseconds >= 0 && days >= 0 && months >= 0) ||
55969                        (milliseconds <= 0 && days <= 0 && months <= 0)
55970                    )
55971                ) {
55972                    milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
55973                    days = 0;
55974                    months = 0;
55975                }
55976
55977                // The following code bubbles up values, see the tests for
55978                // examples of what that means.
55979                data.milliseconds = milliseconds % 1000;
55980
55981                seconds = absFloor(milliseconds / 1000);
55982                data.seconds = seconds % 60;
55983
55984                minutes = absFloor(seconds / 60);
55985                data.minutes = minutes % 60;
55986
55987                hours = absFloor(minutes / 60);
55988                data.hours = hours % 24;
55989
55990                days += absFloor(hours / 24);
55991
55992                // convert days to months
55993                monthsFromDays = absFloor(daysToMonths(days));
55994                months += monthsFromDays;
55995                days -= absCeil(monthsToDays(monthsFromDays));
55996
55997                // 12 months -> 1 year
55998                years = absFloor(months / 12);
55999                months %= 12;
56000
56001                data.days = days;
56002                data.months = months;
56003                data.years = years;
56004
56005                return this;
56006            }
56007
56008            function daysToMonths(days) {
56009                // 400 years have 146097 days (taking into account leap year rules)
56010                // 400 years have 12 months === 4800
56011                return (days * 4800) / 146097;
56012            }
56013
56014            function monthsToDays(months) {
56015                // the reverse of daysToMonths
56016                return (months * 146097) / 4800;
56017            }
56018
56019            function as(units) {
56020                if (!this.isValid()) {
56021                    return NaN;
56022                }
56023                var days,
56024                    months,
56025                    milliseconds = this._milliseconds;
56026
56027                units = normalizeUnits(units);
56028
56029                if (units === 'month' || units === 'quarter' || units === 'year') {
56030                    days = this._days + milliseconds / 864e5;
56031                    months = this._months + daysToMonths(days);
56032                    switch (units) {
56033                        case 'month':
56034                            return months;
56035                        case 'quarter':
56036                            return months / 3;
56037                        case 'year':
56038                            return months / 12;
56039                    }
56040                } else {
56041                    // handle milliseconds separately because of floating point math errors (issue #1867)
56042                    days = this._days + Math.round(monthsToDays(this._months));
56043                    switch (units) {
56044                        case 'week':
56045                            return days / 7 + milliseconds / 6048e5;
56046                        case 'day':
56047                            return days + milliseconds / 864e5;
56048                        case 'hour':
56049                            return days * 24 + milliseconds / 36e5;
56050                        case 'minute':
56051                            return days * 1440 + milliseconds / 6e4;
56052                        case 'second':
56053                            return days * 86400 + milliseconds / 1000;
56054                        // Math.floor prevents floating point math errors here
56055                        case 'millisecond':
56056                            return Math.floor(days * 864e5) + milliseconds;
56057                        default:
56058                            throw new Error('Unknown unit ' + units);
56059                    }
56060                }
56061            }
56062
56063            // TODO: Use this.as('ms')?
56064            function valueOf$1() {
56065                if (!this.isValid()) {
56066                    return NaN;
56067                }
56068                return (
56069                    this._milliseconds +
56070                    this._days * 864e5 +
56071                    (this._months % 12) * 2592e6 +
56072                    toInt(this._months / 12) * 31536e6
56073                );
56074            }
56075
56076            function makeAs(alias) {
56077                return function () {
56078                    return this.as(alias);
56079                };
56080            }
56081
56082            var asMilliseconds = makeAs('ms'),
56083                asSeconds = makeAs('s'),
56084                asMinutes = makeAs('m'),
56085                asHours = makeAs('h'),
56086                asDays = makeAs('d'),
56087                asWeeks = makeAs('w'),
56088                asMonths = makeAs('M'),
56089                asQuarters = makeAs('Q'),
56090                asYears = makeAs('y');
56091
56092            function clone$1() {
56093                return createDuration(this);
56094            }
56095
56096            function get$2(units) {
56097                units = normalizeUnits(units);
56098                return this.isValid() ? this[units + 's']() : NaN;
56099            }
56100
56101            function makeGetter(name) {
56102                return function () {
56103                    return this.isValid() ? this._data[name] : NaN;
56104                };
56105            }
56106
56107            var milliseconds = makeGetter('milliseconds'),
56108                seconds = makeGetter('seconds'),
56109                minutes = makeGetter('minutes'),
56110                hours = makeGetter('hours'),
56111                days = makeGetter('days'),
56112                months = makeGetter('months'),
56113                years = makeGetter('years');
56114
56115            function weeks() {
56116                return absFloor(this.days() / 7);
56117            }
56118
56119            var round = Math.round,
56120                thresholds = {
56121                    ss: 44, // a few seconds to seconds
56122                    s: 45, // seconds to minute
56123                    m: 45, // minutes to hour
56124                    h: 22, // hours to day
56125                    d: 26, // days to month/week
56126                    w: null, // weeks to month
56127                    M: 11, // months to year
56128                };
56129
56130            // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
56131            function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
56132                return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
56133            }
56134
56135            function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) {
56136                var duration = createDuration(posNegDuration).abs(),
56137                    seconds = round(duration.as('s')),
56138                    minutes = round(duration.as('m')),
56139                    hours = round(duration.as('h')),
56140                    days = round(duration.as('d')),
56141                    months = round(duration.as('M')),
56142                    weeks = round(duration.as('w')),
56143                    years = round(duration.as('y')),
56144                    a =
56145                        (seconds <= thresholds.ss && ['s', seconds]) ||
56146                        (seconds < thresholds.s && ['ss', seconds]) ||
56147                        (minutes <= 1 && ['m']) ||
56148                        (minutes < thresholds.m && ['mm', minutes]) ||
56149                        (hours <= 1 && ['h']) ||
56150                        (hours < thresholds.h && ['hh', hours]) ||
56151                        (days <= 1 && ['d']) ||
56152                        (days < thresholds.d && ['dd', days]);
56153
56154                if (thresholds.w != null) {
56155                    a =
56156                        a ||
56157                        (weeks <= 1 && ['w']) ||
56158                        (weeks < thresholds.w && ['ww', weeks]);
56159                }
56160                a = a ||
56161                    (months <= 1 && ['M']) ||
56162                    (months < thresholds.M && ['MM', months]) ||
56163                    (years <= 1 && ['y']) || ['yy', years];
56164
56165                a[2] = withoutSuffix;
56166                a[3] = +posNegDuration > 0;
56167                a[4] = locale;
56168                return substituteTimeAgo.apply(null, a);
56169            }
56170
56171            // This function allows you to set the rounding function for relative time strings
56172            function getSetRelativeTimeRounding(roundingFunction) {
56173                if (roundingFunction === undefined) {
56174                    return round;
56175                }
56176                if (typeof roundingFunction === 'function') {
56177                    round = roundingFunction;
56178                    return true;
56179                }
56180                return false;
56181            }
56182
56183            // This function allows you to set a threshold for relative time strings
56184            function getSetRelativeTimeThreshold(threshold, limit) {
56185                if (thresholds[threshold] === undefined) {
56186                    return false;
56187                }
56188                if (limit === undefined) {
56189                    return thresholds[threshold];
56190                }
56191                thresholds[threshold] = limit;
56192                if (threshold === 's') {
56193                    thresholds.ss = limit - 1;
56194                }
56195                return true;
56196            }
56197
56198            function humanize(argWithSuffix, argThresholds) {
56199                if (!this.isValid()) {
56200                    return this.localeData().invalidDate();
56201                }
56202
56203                var withSuffix = false,
56204                    th = thresholds,
56205                    locale,
56206                    output;
56207
56208                if (typeof argWithSuffix === 'object') {
56209                    argThresholds = argWithSuffix;
56210                    argWithSuffix = false;
56211                }
56212                if (typeof argWithSuffix === 'boolean') {
56213                    withSuffix = argWithSuffix;
56214                }
56215                if (typeof argThresholds === 'object') {
56216                    th = Object.assign({}, thresholds, argThresholds);
56217                    if (argThresholds.s != null && argThresholds.ss == null) {
56218                        th.ss = argThresholds.s - 1;
56219                    }
56220                }
56221
56222                locale = this.localeData();
56223                output = relativeTime$1(this, !withSuffix, th, locale);
56224
56225                if (withSuffix) {
56226                    output = locale.pastFuture(+this, output);
56227                }
56228
56229                return locale.postformat(output);
56230            }
56231
56232            var abs$1 = Math.abs;
56233
56234            function sign(x) {
56235                return (x > 0) - (x < 0) || +x;
56236            }
56237
56238            function toISOString$1() {
56239                // for ISO strings we do not use the normal bubbling rules:
56240                //  * milliseconds bubble up until they become hours
56241                //  * days do not bubble at all
56242                //  * months bubble up until they become years
56243                // This is because there is no context-free conversion between hours and days
56244                // (think of clock changes)
56245                // and also not between days and months (28-31 days per month)
56246                if (!this.isValid()) {
56247                    return this.localeData().invalidDate();
56248                }
56249
56250                var seconds = abs$1(this._milliseconds) / 1000,
56251                    days = abs$1(this._days),
56252                    months = abs$1(this._months),
56253                    minutes,
56254                    hours,
56255                    years,
56256                    s,
56257                    total = this.asSeconds(),
56258                    totalSign,
56259                    ymSign,
56260                    daysSign,
56261                    hmsSign;
56262
56263                if (!total) {
56264                    // this is the same as C#'s (Noda) and python (isodate)...
56265                    // but not other JS (goog.date)
56266                    return 'P0D';
56267                }
56268
56269                // 3600 seconds -> 60 minutes -> 1 hour
56270                minutes = absFloor(seconds / 60);
56271                hours = absFloor(minutes / 60);
56272                seconds %= 60;
56273                minutes %= 60;
56274
56275                // 12 months -> 1 year
56276                years = absFloor(months / 12);
56277                months %= 12;
56278
56279                // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
56280                s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
56281
56282                totalSign = total < 0 ? '-' : '';
56283                ymSign = sign(this._months) !== sign(total) ? '-' : '';
56284                daysSign = sign(this._days) !== sign(total) ? '-' : '';
56285                hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
56286
56287                return (
56288                    totalSign +
56289                    'P' +
56290                    (years ? ymSign + years + 'Y' : '') +
56291                    (months ? ymSign + months + 'M' : '') +
56292                    (days ? daysSign + days + 'D' : '') +
56293                    (hours || minutes || seconds ? 'T' : '') +
56294                    (hours ? hmsSign + hours + 'H' : '') +
56295                    (minutes ? hmsSign + minutes + 'M' : '') +
56296                    (seconds ? hmsSign + s + 'S' : '')
56297                );
56298            }
56299
56300            var proto$2 = Duration.prototype;
56301
56302            proto$2.isValid = isValid$1;
56303            proto$2.abs = abs;
56304            proto$2.add = add$1;
56305            proto$2.subtract = subtract$1;
56306            proto$2.as = as;
56307            proto$2.asMilliseconds = asMilliseconds;
56308            proto$2.asSeconds = asSeconds;
56309            proto$2.asMinutes = asMinutes;
56310            proto$2.asHours = asHours;
56311            proto$2.asDays = asDays;
56312            proto$2.asWeeks = asWeeks;
56313            proto$2.asMonths = asMonths;
56314            proto$2.asQuarters = asQuarters;
56315            proto$2.asYears = asYears;
56316            proto$2.valueOf = valueOf$1;
56317            proto$2._bubble = bubble;
56318            proto$2.clone = clone$1;
56319            proto$2.get = get$2;
56320            proto$2.milliseconds = milliseconds;
56321            proto$2.seconds = seconds;
56322            proto$2.minutes = minutes;
56323            proto$2.hours = hours;
56324            proto$2.days = days;
56325            proto$2.weeks = weeks;
56326            proto$2.months = months;
56327            proto$2.years = years;
56328            proto$2.humanize = humanize;
56329            proto$2.toISOString = toISOString$1;
56330            proto$2.toString = toISOString$1;
56331            proto$2.toJSON = toISOString$1;
56332            proto$2.locale = locale;
56333            proto$2.localeData = localeData;
56334
56335            proto$2.toIsoString = deprecate(
56336                'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)',
56337                toISOString$1
56338            );
56339            proto$2.lang = lang;
56340
56341            // FORMATTING
56342
56343            addFormatToken('X', 0, 0, 'unix');
56344            addFormatToken('x', 0, 0, 'valueOf');
56345
56346            // PARSING
56347
56348            addRegexToken('x', matchSigned);
56349            addRegexToken('X', matchTimestamp);
56350            addParseToken('X', function (input, array, config) {
56351                config._d = new Date(parseFloat(input) * 1000);
56352            });
56353            addParseToken('x', function (input, array, config) {
56354                config._d = new Date(toInt(input));
56355            });
56356
56357            //! moment.js
56358
56359            hooks.version = '2.29.1';
56360
56361            setHookCallback(createLocal);
56362
56363            hooks.fn = proto;
56364            hooks.min = min;
56365            hooks.max = max;
56366            hooks.now = now;
56367            hooks.utc = createUTC;
56368            hooks.unix = createUnix;
56369            hooks.months = listMonths;
56370            hooks.isDate = isDate;
56371            hooks.locale = getSetGlobalLocale;
56372            hooks.invalid = createInvalid;
56373            hooks.duration = createDuration;
56374            hooks.isMoment = isMoment;
56375            hooks.weekdays = listWeekdays;
56376            hooks.parseZone = createInZone;
56377            hooks.localeData = getLocale;
56378            hooks.isDuration = isDuration;
56379            hooks.monthsShort = listMonthsShort;
56380            hooks.weekdaysMin = listWeekdaysMin;
56381            hooks.defineLocale = defineLocale;
56382            hooks.updateLocale = updateLocale;
56383            hooks.locales = listLocales;
56384            hooks.weekdaysShort = listWeekdaysShort;
56385            hooks.normalizeUnits = normalizeUnits;
56386            hooks.relativeTimeRounding = getSetRelativeTimeRounding;
56387            hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
56388            hooks.calendarFormat = getCalendarFormat;
56389            hooks.prototype = proto;
56390
56391            // currently HTML5 input type only supports 24-hour formats
56392            hooks.HTML5_FMT = {
56393                DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" />
56394                DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" />
56395                DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" />
56396                DATE: 'YYYY-MM-DD', // <input type="date" />
56397                TIME: 'HH:mm', // <input type="time" />
56398                TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" />
56399                TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" />
56400                WEEK: 'GGGG-[W]WW', // <input type="week" />
56401                MONTH: 'YYYY-MM', // <input type="month" />
56402            };
56403
56404            return hooks;
56405
56406        })));
56407
56408    }, {}],
vendor: 6,293 bytes, lines 56409-56599
56409    10: [function (require, module, exports) {
56410        /**
56411         * SSR Window 3.0.0-alpha.4
56412         * Better handling for window object in SSR environment
56413         * https://github.com/nolimits4web/ssr-window
56414         *
56415         * Copyright 2020, Vladimir Kharlampidi
56416         *
56417         * Licensed under MIT
56418         *
56419         * Released on: May 20, 2020
56420         */
56421        (function (global, factory) {
56422            typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
56423                typeof define === 'function' && define.amd ? define(['exports'], factory) :
56424                    (global = global || self, factory(global.ssrWindow = {}));
56425        }(this, (function (exports) {
56426            'use strict';
56427
56428            /* eslint-disable no-param-reassign */
56429            function isObject(obj) {
56430                return (obj !== null &&
56431                    typeof obj === 'object' &&
56432                    'constructor' in obj &&
56433                    obj.constructor === Object);
56434            }
56435
56436            function extend(target, src) {
56437                if (target === void 0) {
56438                    target = {};
56439                }
56440                if (src === void 0) {
56441                    src = {};
56442                }
56443                Object.keys(src).forEach(function (key) {
56444                    if (typeof target[key] === 'undefined')
56445                        target[key] = src[key];
56446                    else if (isObject(src[key]) &&
56447                        isObject(target[key]) &&
56448                        Object.keys(src[key]).length > 0) {
56449                        extend(target[key], src[key]);
56450                    }
56451                });
56452            }
56453
56454            var ssrDocument = {
56455                body: {},
56456                addEventListener: function () {
56457                },
56458                removeEventListener: function () {
56459                },
56460                activeElement: {
56461                    blur: function () {
56462                    },
56463                    nodeName: '',
56464                },
56465                querySelector: function () {
56466                    return null;
56467                },
56468                querySelectorAll: function () {
56469                    return [];
56470                },
56471                getElementById: function () {
56472                    return null;
56473                },
56474                createEvent: function () {
56475                    return {
56476                        initEvent: function () {
56477                        },
56478                    };
56479                },
56480                createElement: function () {
56481                    return {
56482                        children: [],
56483                        childNodes: [],
56484                        style: {},
56485                        setAttribute: function () {
56486                        },
56487                        getElementsByTagName: function () {
56488                            return [];
56489                        },
56490                    };
56491                },
56492                createElementNS: function () {
56493                    return {};
56494                },
56495                importNode: function () {
56496                    return null;
56497                },
56498                location: {
56499                    hash: '',
56500                    host: '',
56501                    hostname: '',
56502                    href: '',
56503                    origin: '',
56504                    pathname: '',
56505                    protocol: '',
56506                    search: '',
56507                },
56508            };
56509
56510            function getDocument() {
56511                var doc = typeof document !== 'undefined' ? document : {};
56512                extend(doc, ssrDocument);
56513                return doc;
56514            }
56515
56516            var ssrWindow = {
56517                document: ssrDocument,
56518                navigator: {
56519                    userAgent: '',
56520                },
56521                location: {
56522                    hash: '',
56523                    host: '',
56524                    hostname: '',
56525                    href: '',
56526                    origin: '',
56527                    pathname: '',
56528                    protocol: '',
56529                    search: '',
56530                },
56531                history: {
56532                    replaceState: function () {
56533                    },
56534                    pushState: function () {
56535                    },
56536                    go: function () {
56537                    },
56538                    back: function () {
56539                    },
56540                },
56541                CustomEvent: function CustomEvent() {
56542                    return this;
56543                },
56544                addEventListener: function () {
56545                },
56546                removeEventListener: function () {
56547                },
56548                getComputedStyle: function () {
56549                    return {
56550                        getPropertyValue: function () {
56551                            return '';
56552                        },
56553                    };
56554                },
56555                Image: function () {
56556                },
56557                Date: function () {
56558                },
56559                screen: {},
56560                setTimeout: function () {
56561                },
56562                clearTimeout: function () {
56563                },
56564                matchMedia: function () {
56565                    return {};
56566                },
56567                requestAnimationFrame: function (callback) {
56568                    if (typeof setTimeout === 'undefined') {
56569                        callback();
56570                        return null;
56571                    }
56572                    return setTimeout(callback, 0);
56573                },
56574                cancelAnimationFrame: function (id) {
56575                    if (typeof setTimeout === 'undefined') {
56576                        return;
56577                    }
56578                    clearTimeout(id);
56579                },
56580            };
56581
56582            function getWindow() {
56583                var win = typeof window !== 'undefined' ? window : {};
56584                extend(win, ssrWindow);
56585                return win;
56586            }
56587
56588            exports.extend = extend;
56589            exports.getDocument = getDocument;
56590            exports.getWindow = getWindow;
56591            exports.ssrDocument = ssrDocument;
56592            exports.ssrWindow = ssrWindow;
56593
56594            Object.defineProperty(exports, '__esModule', {value: true});
56595
56596        })));
56597
56598
56599    }, {}],
56600    11: [function (require, module, exports) {
56601        "use strict";
56602
56603        exports.__esModule = true;
56604        exports.default = void 0;
56605
56606        var _dom = _interopRequireDefault(require("../../utils/dom"));
56607
56608        var _utils = require("../../utils/utils");
56609
56610        function _interopRequireDefault(obj) {
56611            return obj && obj.__esModule ? obj : {default: obj};
56612        }
56613
56614        function _extends() {
56615            _extends = Object.assign || function (target) {
56616                for (var i = 1; i < arguments.length; i++) {
56617                    var source = arguments[i];
56618                    for (var key in source) {
56619                        if (Object.prototype.hasOwnProperty.call(source, key)) {
56620                            target[key] = source[key];
56621                        }
56622                    }
56623                }
56624                return target;
56625            };
56626            return _extends.apply(this, arguments);
56627        }
56628
56629        var A11y = {
56630            getRandomNumber: function getRandomNumber(size) {
56631                if (size === void 0) {
56632                    size = 16;
56633                }
56634
56635                var randomChar = function randomChar() {
56636                    return Math.round(16 * Math.random()).toString(16);
56637                };
56638
56639                return 'x'.repeat(size).replace(/x/g, randomChar);
56640            },
56641            makeElFocusable: function makeElFocusable($el) {
56642                $el.attr('tabIndex', '0');
56643                return $el;
56644            },
56645            makeElNotFocusable: function makeElNotFocusable($el) {
56646                $el.attr('tabIndex', '-1');
56647                return $el;
56648            },
56649            addElRole: function addElRole($el, role) {
56650                $el.attr('role', role);
56651                return $el;
56652            },
56653            addElRoleDescription: function addElRoleDescription($el, description) {
56654                $el.attr('aria-role-description', description);
56655                return $el;
56656            },
56657            addElControls: function addElControls($el, controls) {
56658                $el.attr('aria-controls', controls);
56659                return $el;
56660            },
56661            addElLabel: function addElLabel($el, label) {
56662                $el.attr('aria-label', label);
56663                return $el;
56664            },
56665            addElId: function addElId($el, id) {
56666                $el.attr('id', id);
56667                return $el;
56668            },
56669            addElLive: function addElLive($el, live) {
56670                $el.attr('aria-live', live);
56671                return $el;
56672            },
56673            disableEl: function disableEl($el) {
56674                $el.attr('aria-disabled', true);
56675                return $el;
56676            },
56677            enableEl: function enableEl($el) {
56678                $el.attr('aria-disabled', false);
56679                return $el;
56680            },
56681            onEnterKey: function onEnterKey(e) {
56682                var swiper = this;
56683                var params = swiper.params.a11y;
56684                if (e.keyCode !== 13) return;
56685                var $targetEl = (0, _dom.default)(e.target);
56686
56687                if (swiper.navigation && swiper.navigation.$nextEl && $targetEl.is(swiper.navigation.$nextEl)) {
56688                    if (!(swiper.isEnd && !swiper.params.loop)) {
56689                        swiper.slideNext();
56690                    }
56691
56692                    if (swiper.isEnd) {
56693                        swiper.a11y.notify(params.lastSlideMessage);
56694                    } else {
56695                        swiper.a11y.notify(params.nextSlideMessage);
56696                    }
56697                }
56698
56699                if (swiper.navigation && swiper.navigation.$prevEl && $targetEl.is(swiper.navigation.$prevEl)) {
56700                    if (!(swiper.isBeginning && !swiper.params.loop)) {
56701                        swiper.slidePrev();
56702                    }
56703
56704                    if (swiper.isBeginning) {
56705                        swiper.a11y.notify(params.firstSlideMessage);
56706                    } else {
56707                        swiper.a11y.notify(params.prevSlideMessage);
56708                    }
56709                }
56710
56711                if (swiper.pagination && $targetEl.is("." + swiper.params.pagination.bulletClass)) {
56712                    $targetEl[0].click();
56713                }
56714            },
56715            notify: function notify(message) {
56716                var swiper = this;
56717                var notification = swiper.a11y.liveRegion;
56718                if (notification.length === 0) return;
56719                notification.html('');
56720                notification.html(message);
56721            },
56722            updateNavigation: function updateNavigation() {
56723                var swiper = this;
56724                if (swiper.params.loop || !swiper.navigation) return;
56725                var _swiper$navigation = swiper.navigation,
56726                    $nextEl = _swiper$navigation.$nextEl,
56727                    $prevEl = _swiper$navigation.$prevEl;
56728
56729                if ($prevEl && $prevEl.length > 0) {
56730                    if (swiper.isBeginning) {
56731                        swiper.a11y.disableEl($prevEl);
56732                        swiper.a11y.makeElNotFocusable($prevEl);
56733                    } else {
56734                        swiper.a11y.enableEl($prevEl);
56735                        swiper.a11y.makeElFocusable($prevEl);
56736                    }
56737                }
56738
56739                if ($nextEl && $nextEl.length > 0) {
56740                    if (swiper.isEnd) {
56741                        swiper.a11y.disableEl($nextEl);
56742                        swiper.a11y.makeElNotFocusable($nextEl);
56743                    } else {
56744                        swiper.a11y.enableEl($nextEl);
56745                        swiper.a11y.makeElFocusable($nextEl);
56746                    }
56747                }
56748            },
56749            updatePagination: function updatePagination() {
56750                var swiper = this;
56751                var params = swiper.params.a11y;
56752
56753                if (swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length) {
56754                    swiper.pagination.bullets.each(function (bulletEl) {
56755                        var $bulletEl = (0, _dom.default)(bulletEl);
56756                        swiper.a11y.makeElFocusable($bulletEl);
56757
56758                        if (!swiper.params.pagination.renderBullet) {
56759                            swiper.a11y.addElRole($bulletEl, 'button');
56760                            swiper.a11y.addElLabel($bulletEl, params.paginationBulletMessage.replace(/\{\{index\}\}/, $bulletEl.index() + 1));
56761                        }
56762                    });
56763                }
56764            },
56765            init: function init() {
56766                var swiper = this;
56767                var params = swiper.params.a11y;
56768                swiper.$el.append(swiper.a11y.liveRegion); // Container
56769
56770                var $containerEl = swiper.$el;
56771
56772                if (params.containerRoleDescriptionMessage) {
56773                    swiper.a11y.addElRoleDescription($containerEl, params.containerRoleDescriptionMessage);
56774                }
56775
56776                if (params.containerMessage) {
56777                    swiper.a11y.addElLabel($containerEl, params.containerMessage);
56778                } // Wrapper
56779
56780
56781                var $wrapperEl = swiper.$wrapperEl;
56782                var wrapperId = $wrapperEl.attr('id') || "swiper-wrapper-" + swiper.a11y.getRandomNumber(16);
56783                var live;
56784                swiper.a11y.addElId($wrapperEl, wrapperId);
56785
56786                if (swiper.params.autoplay && swiper.params.autoplay.enabled) {
56787                    live = 'off';
56788                } else {
56789                    live = 'polite';
56790                }
56791
56792                swiper.a11y.addElLive($wrapperEl, live); // Slide
56793
56794                if (params.itemRoleDescriptionMessage) {
56795                    swiper.a11y.addElRoleDescription((0, _dom.default)(swiper.slides), params.itemRoleDescriptionMessage);
56796                }
56797
56798                swiper.a11y.addElRole((0, _dom.default)(swiper.slides), 'group');
56799                swiper.slides.each(function (slideEl) {
56800                    var $slideEl = (0, _dom.default)(slideEl);
56801                    swiper.a11y.addElLabel($slideEl, $slideEl.index() + 1 + " / " + swiper.slides.length);
56802                }); // Navigation
56803
56804                var $nextEl;
56805                var $prevEl;
56806
56807                if (swiper.navigation && swiper.navigation.$nextEl) {
56808                    $nextEl = swiper.navigation.$nextEl;
56809                }
56810
56811                if (swiper.navigation && swiper.navigation.$prevEl) {
56812                    $prevEl = swiper.navigation.$prevEl;
56813                }
56814
56815                if ($nextEl && $nextEl.length) {
56816                    swiper.a11y.makeElFocusable($nextEl);
56817
56818                    if ($nextEl[0].tagName !== 'BUTTON') {
56819                        swiper.a11y.addElRole($nextEl, 'button');
56820                        $nextEl.on('keydown', swiper.a11y.onEnterKey);
56821                    }
56822
56823                    swiper.a11y.addElLabel($nextEl, params.nextSlideMessage);
56824                    swiper.a11y.addElControls($nextEl, wrapperId);
56825                }
56826
56827                if ($prevEl && $prevEl.length) {
56828                    swiper.a11y.makeElFocusable($prevEl);
56829
56830                    if ($prevEl[0].tagName !== 'BUTTON') {
56831                        swiper.a11y.addElRole($prevEl, 'button');
56832                        $prevEl.on('keydown', swiper.a11y.onEnterKey);
56833                    }
56834
56835                    swiper.a11y.addElLabel($prevEl, params.prevSlideMessage);
56836                    swiper.a11y.addElControls($prevEl, wrapperId);
56837                } // Pagination
56838
56839
56840                if (swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length) {
56841                    swiper.pagination.$el.on('keydown', "." + swiper.params.pagination.bulletClass, swiper.a11y.onEnterKey);
56842                }
56843            },
56844            destroy: function destroy() {
56845                var swiper = this;
56846                if (swiper.a11y.liveRegion && swiper.a11y.liveRegion.length > 0) swiper.a11y.liveRegion.remove();
56847                var $nextEl;
56848                var $prevEl;
56849
56850                if (swiper.navigation && swiper.navigation.$nextEl) {
56851                    $nextEl = swiper.navigation.$nextEl;
56852                }
56853
56854                if (swiper.navigation && swiper.navigation.$prevEl) {
56855                    $prevEl = swiper.navigation.$prevEl;
56856                }
56857
56858                if ($nextEl) {
56859                    $nextEl.off('keydown', swiper.a11y.onEnterKey);
56860                }
56861
56862                if ($prevEl) {
56863                    $prevEl.off('keydown', swiper.a11y.onEnterKey);
56864                } // Pagination
56865
56866
56867                if (swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length) {
56868                    swiper.pagination.$el.off('keydown', "." + swiper.params.pagination.bulletClass, swiper.a11y.onEnterKey);
56869                }
56870            }
56871        };
56872        var _default = {
56873            name: 'a11y',
56874            params: {
56875                a11y: {
56876                    enabled: true,
56877                    notificationClass: 'swiper-notification',
56878                    prevSlideMessage: 'Previous slide',
56879                    nextSlideMessage: 'Next slide',
56880                    firstSlideMessage: 'This is the first slide',
56881                    lastSlideMessage: 'This is the last slide',
56882                    paginationBulletMessage: 'Go to slide {{index}}',
56883                    containerMessage: null,
56884                    containerRoleDescriptionMessage: null,
56885                    itemRoleDescriptionMessage: null
56886                }
56887            },
56888            create: function create() {
56889                var swiper = this;
56890                (0, _utils.bindModuleMethods)(swiper, {
56891                    a11y: _extends(_extends({}, A11y), {}, {
56892                        liveRegion: (0, _dom.default)("<span class=\"" + swiper.params.a11y.notificationClass + "\" aria-live=\"assertive\" aria-atomic=\"true\"></span>")
56893                    })
56894                });
56895            },
56896            on: {
56897                afterInit: function afterInit(swiper) {
56898                    if (!swiper.params.a11y.enabled) return;
56899                    swiper.a11y.init();
56900                    swiper.a11y.updateNavigation();
56901                },
56902                toEdge: function toEdge(swiper) {
56903                    if (!swiper.params.a11y.enabled) return;
56904                    swiper.a11y.updateNavigation();
56905                },
56906                fromEdge: function fromEdge(swiper) {
56907                    if (!swiper.params.a11y.enabled) return;
56908                    swiper.a11y.updateNavigation();
56909                },
56910                paginationUpdate: function paginationUpdate(swiper) {
56911                    if (!swiper.params.a11y.enabled) return;
56912                    swiper.a11y.updatePagination();
56913                },
56914                destroy: function destroy(swiper) {
56915                    if (!swiper.params.a11y.enabled) return;
56916                    swiper.a11y.destroy();
56917                }
56918            }
56919        };
56920        exports.default = _default;
56921    }, {"../../utils/dom": 94, "../../utils/utils": 98}],
56922    12: [function (require, module, exports) {
56923        "use strict";
56924
56925        exports.__esModule = true;
56926        exports.default = void 0;
56927
56928        var _ssrWindow = require("ssr-window");
56929
56930        var _utils = require("../../utils/utils");
56931
56932        function _extends() {
56933            _extends = Object.assign || function (target) {
56934                for (var i = 1; i < arguments.length; i++) {
56935                    var source = arguments[i];
56936                    for (var key in source) {
56937                        if (Object.prototype.hasOwnProperty.call(source, key)) {
56938                            target[key] = source[key];
56939                        }
56940                    }
56941                }
56942                return target;
56943            };
56944            return _extends.apply(this, arguments);
56945        }
56946
56947        var Autoplay = {
56948            run: function run() {
56949                var swiper = this;
56950                var $activeSlideEl = swiper.slides.eq(swiper.activeIndex);
56951                var delay = swiper.params.autoplay.delay;
56952
56953                if ($activeSlideEl.attr('data-swiper-autoplay')) {
56954                    delay = $activeSlideEl.attr('data-swiper-autoplay') || swiper.params.autoplay.delay;
56955                }
56956
56957                clearTimeout(swiper.autoplay.timeout);
56958                swiper.autoplay.timeout = (0, _utils.nextTick)(function () {
56959                    var autoplayResult;
56960
56961                    if (swiper.params.autoplay.reverseDirection) {
56962                        if (swiper.params.loop) {
56963                            swiper.loopFix();
56964                            autoplayResult = swiper.slidePrev(swiper.params.speed, true, true);
56965                            swiper.emit('autoplay');
56966                        } else if (!swiper.isBeginning) {
56967                            autoplayResult = swiper.slidePrev(swiper.params.speed, true, true);
56968                            swiper.emit('autoplay');
56969                        } else if (!swiper.params.autoplay.stopOnLastSlide) {
56970                            autoplayResult = swiper.slideTo(swiper.slides.length - 1, swiper.params.speed, true, true);
56971                            swiper.emit('autoplay');
56972                        } else {
56973                            swiper.autoplay.stop();
56974                        }
56975                    } else if (swiper.params.loop) {
56976                        swiper.loopFix();
56977                        autoplayResult = swiper.slideNext(swiper.params.speed, true, true);
56978                        swiper.emit('autoplay');
56979                    } else if (!swiper.isEnd) {
56980                        autoplayResult = swiper.slideNext(swiper.params.speed, true, true);
56981                        swiper.emit('autoplay');
56982                    } else if (!swiper.params.autoplay.stopOnLastSlide) {
56983                        autoplayResult = swiper.slideTo(0, swiper.params.speed, true, true);
56984                        swiper.emit('autoplay');
56985                    } else {
56986                        swiper.autoplay.stop();
56987                    }
56988
56989                    if (swiper.params.cssMode && swiper.autoplay.running) swiper.autoplay.run(); else if (autoplayResult === false) {
56990                        swiper.autoplay.run();
56991                    }
56992                }, delay);
56993            },
56994            start: function start() {
56995                var swiper = this;
56996                if (typeof swiper.autoplay.timeout !== 'undefined') return false;
56997                if (swiper.autoplay.running) return false;
56998                swiper.autoplay.running = true;
56999                swiper.emit('autoplayStart');
57000                swiper.autoplay.run();
57001                return true;
57002            },
57003            stop: function stop() {
57004                var swiper = this;
57005                if (!swiper.autoplay.running) return false;
57006                if (typeof swiper.autoplay.timeout === 'undefined') return false;
57007
57008                if (swiper.autoplay.timeout) {
57009                    clearTimeout(swiper.autoplay.timeout);
57010                    swiper.autoplay.timeout = undefined;
57011                }
57012
57013                swiper.autoplay.running = false;
57014                swiper.emit('autoplayStop');
57015                return true;
57016            },
57017            pause: function pause(speed) {
57018                var swiper = this;
57019                if (!swiper.autoplay.running) return;
57020                if (swiper.autoplay.paused) return;
57021                if (swiper.autoplay.timeout) clearTimeout(swiper.autoplay.timeout);
57022                swiper.autoplay.paused = true;
57023
57024                if (speed === 0 || !swiper.params.autoplay.waitForTransition) {
57025                    swiper.autoplay.paused = false;
57026                    swiper.autoplay.run();
57027                } else {
57028                    swiper.$wrapperEl[0].addEventListener('transitionend', swiper.autoplay.onTransitionEnd);
57029                    swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.autoplay.onTransitionEnd);
57030                }
57031            },
57032            onVisibilityChange: function onVisibilityChange() {
57033                var swiper = this;
57034                var document = (0, _ssrWindow.getDocument)();
57035
57036                if (document.visibilityState === 'hidden' && swiper.autoplay.running) {
57037                    swiper.autoplay.pause();
57038                }
57039
57040                if (document.visibilityState === 'visible' && swiper.autoplay.paused) {
57041                    swiper.autoplay.run();
57042                    swiper.autoplay.paused = false;
57043                }
57044            },
57045            onTransitionEnd: function onTransitionEnd(e) {
57046                var swiper = this;
57047                if (!swiper || swiper.destroyed || !swiper.$wrapperEl) return;
57048                if (e.target !== swiper.$wrapperEl[0]) return;
57049                swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.autoplay.onTransitionEnd);
57050                swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.autoplay.onTransitionEnd);
57051                swiper.autoplay.paused = false;
57052
57053                if (!swiper.autoplay.running) {
57054                    swiper.autoplay.stop();
57055                } else {
57056                    swiper.autoplay.run();
57057                }
57058            }
57059        };
57060        var _default = {
57061            name: 'autoplay',
57062            params: {
57063                autoplay: {
57064                    enabled: false,
57065                    delay: 3000,
57066                    waitForTransition: true,
57067                    disableOnInteraction: true,
57068                    stopOnLastSlide: false,
57069                    reverseDirection: false
57070                }
57071            },
57072            create: function create() {
57073                var swiper = this;
57074                (0, _utils.bindModuleMethods)(swiper, {
57075                    autoplay: _extends(_extends({}, Autoplay), {}, {
57076                        running: false,
57077                        paused: false
57078                    })
57079                });
57080            },
57081            on: {
57082                init: function init(swiper) {
57083                    if (swiper.params.autoplay.enabled) {
57084                        swiper.autoplay.start();
57085                        var document = (0, _ssrWindow.getDocument)();
57086                        document.addEventListener('visibilitychange', swiper.autoplay.onVisibilityChange);
57087                    }
57088                },
57089                beforeTransitionStart: function beforeTransitionStart(swiper, speed, internal) {
57090                    if (swiper.autoplay.running) {
57091                        if (internal || !swiper.params.autoplay.disableOnInteraction) {
57092                            swiper.autoplay.pause(speed);
57093                        } else {
57094                            swiper.autoplay.stop();
57095                        }
57096                    }
57097                },
57098                sliderFirstMove: function sliderFirstMove(swiper) {
57099                    if (swiper.autoplay.running) {
57100                        if (swiper.params.autoplay.disableOnInteraction) {
57101                            swiper.autoplay.stop();
57102                        } else {
57103                            swiper.autoplay.pause();
57104                        }
57105                    }
57106                },
57107                touchEnd: function touchEnd(swiper) {
57108                    if (swiper.params.cssMode && swiper.autoplay.paused && !swiper.params.autoplay.disableOnInteraction) {
57109                        swiper.autoplay.run();
57110                    }
57111                },
57112                destroy: function destroy(swiper) {
57113                    if (swiper.autoplay.running) {
57114                        swiper.autoplay.stop();
57115                    }
57116
57117                    var document = (0, _ssrWindow.getDocument)();
57118                    document.removeEventListener('visibilitychange', swiper.autoplay.onVisibilityChange);
57119                }
57120            }
57121        };
57122        exports.default = _default;
57123    }, {"../../utils/utils": 98, "ssr-window": 10}],
57124    13: [function (require, module, exports) {
57125        "use strict";
57126
57127        exports.__esModule = true;
57128        exports.default = void 0;
57129
57130        var _utils = require("../../utils/utils");
57131
57132        function _extends() {
57133            _extends = Object.assign || function (target) {
57134                for (var i = 1; i < arguments.length; i++) {
57135                    var source = arguments[i];
57136                    for (var key in source) {
57137                        if (Object.prototype.hasOwnProperty.call(source, key)) {
57138                            target[key] = source[key];
57139                        }
57140                    }
57141                }
57142                return target;
57143            };
57144            return _extends.apply(this, arguments);
57145        }
57146
57147        var Controller = {
57148            LinearSpline: function LinearSpline(x, y) {
57149                var binarySearch = function search() {
57150                    var maxIndex;
57151                    var minIndex;
57152                    var guess;
57153                    return function (array, val) {
57154                        minIndex = -1;
57155                        maxIndex = array.length;
57156
57157                        while (maxIndex - minIndex > 1) {
57158                            guess = maxIndex + minIndex >> 1;
57159
57160                            if (array[guess] <= val) {
57161                                minIndex = guess;
57162                            } else {
57163                                maxIndex = guess;
57164                            }
57165                        }
57166
57167                        return maxIndex;
57168                    };
57169                }();
57170
57171                this.x = x;
57172                this.y = y;
57173                this.lastIndex = x.length - 1; // Given an x value (x2), return the expected y2 value:
57174                // (x1,y1) is the known point before given value,
57175                // (x3,y3) is the known point after given value.
57176
57177                var i1;
57178                var i3;
57179
57180                this.interpolate = function interpolate(x2) {
57181                    if (!x2) return 0; // Get the indexes of x1 and x3 (the array indexes before and after given x2):
57182
57183                    i3 = binarySearch(this.x, x2);
57184                    i1 = i3 - 1; // We have our indexes i1 & i3, so we can calculate already:
57185                    // y2 := ((x2−x1) × (y3−y1)) ÷ (x3−x1) + y1
57186
57187                    return (x2 - this.x[i1]) * (this.y[i3] - this.y[i1]) / (this.x[i3] - this.x[i1]) + this.y[i1];
57188                };
57189
57190                return this;
57191            },
57192            // xxx: for now i will just save one spline function to to
57193            getInterpolateFunction: function getInterpolateFunction(c) {
57194                var swiper = this;
57195
57196                if (!swiper.controller.spline) {
57197                    swiper.controller.spline = swiper.params.loop ? new Controller.LinearSpline(swiper.slidesGrid, c.slidesGrid) : new Controller.LinearSpline(swiper.snapGrid, c.snapGrid);
57198                }
57199            },
57200            setTranslate: function setTranslate(_setTranslate, byController) {
57201                var swiper = this;
57202                var controlled = swiper.controller.control;
57203                var multiplier;
57204                var controlledTranslate;
57205                var Swiper = swiper.constructor;
57206
57207                function setControlledTranslate(c) {
57208                    // this will create an Interpolate function based on the snapGrids
57209                    // x is the Grid of the scrolled scroller and y will be the controlled scroller
57210                    // it makes sense to create this only once and recall it for the interpolation
57211                    // the function does a lot of value caching for performance
57212                    var translate = swiper.rtlTranslate ? -swiper.translate : swiper.translate;
57213
57214                    if (swiper.params.controller.by === 'slide') {
57215                        swiper.controller.getInterpolateFunction(c); // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid
57216                        // but it did not work out
57217
57218                        controlledTranslate = -swiper.controller.spline.interpolate(-translate);
57219                    }
57220
57221                    if (!controlledTranslate || swiper.params.controller.by === 'container') {
57222                        multiplier = (c.maxTranslate() - c.minTranslate()) / (swiper.maxTranslate() - swiper.minTranslate());
57223                        controlledTranslate = (translate - swiper.minTranslate()) * multiplier + c.minTranslate();
57224                    }
57225
57226                    if (swiper.params.controller.inverse) {
57227                        controlledTranslate = c.maxTranslate() - controlledTranslate;
57228                    }
57229
57230                    c.updateProgress(controlledTranslate);
57231                    c.setTranslate(controlledTranslate, swiper);
57232                    c.updateActiveIndex();
57233                    c.updateSlidesClasses();
57234                }
57235
57236                if (Array.isArray(controlled)) {
57237                    for (var i = 0; i < controlled.length; i += 1) {
57238                        if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
57239                            setControlledTranslate(controlled[i]);
57240                        }
57241                    }
57242                } else if (controlled instanceof Swiper && byController !== controlled) {
57243                    setControlledTranslate(controlled);
57244                }
57245            },
57246            setTransition: function setTransition(duration, byController) {
57247                var swiper = this;
57248                var Swiper = swiper.constructor;
57249                var controlled = swiper.controller.control;
57250                var i;
57251
57252                function setControlledTransition(c) {
57253                    c.setTransition(duration, swiper);
57254
57255                    if (duration !== 0) {
57256                        c.transitionStart();
57257
57258                        if (c.params.autoHeight) {
57259                            (0, _utils.nextTick)(function () {
57260                                c.updateAutoHeight();
57261                            });
57262                        }
57263
57264                        c.$wrapperEl.transitionEnd(function () {
57265                            if (!controlled) return;
57266
57267                            if (c.params.loop && swiper.params.controller.by === 'slide') {
57268                                c.loopFix();
57269                            }
57270
57271                            c.transitionEnd();
57272                        });
57273                    }
57274                }
57275
57276                if (Array.isArray(controlled)) {
57277                    for (i = 0; i < controlled.length; i += 1) {
57278                        if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
57279                            setControlledTransition(controlled[i]);
57280                        }
57281                    }
57282                } else if (controlled instanceof Swiper && byController !== controlled) {
57283                    setControlledTransition(controlled);
57284                }
57285            }
57286        };
57287        var _default = {
57288            name: 'controller',
57289            params: {
57290                controller: {
57291                    control: undefined,
57292                    inverse: false,
57293                    by: 'slide' // or 'container'
57294
57295                }
57296            },
57297            create: function create() {
57298                var swiper = this;
57299                (0, _utils.bindModuleMethods)(swiper, {
57300                    controller: _extends({
57301                        control: swiper.params.controller.control
57302                    }, Controller)
57303                });
57304            },
57305            on: {
57306                update: function update(swiper) {
57307                    if (!swiper.controller.control) return;
57308
57309                    if (swiper.controller.spline) {
57310                        swiper.controller.spline = undefined;
57311                        delete swiper.controller.spline;
57312                    }
57313                },
57314                resize: function resize(swiper) {
57315                    if (!swiper.controller.control) return;
57316
57317                    if (swiper.controller.spline) {
57318                        swiper.controller.spline = undefined;
57319                        delete swiper.controller.spline;
57320                    }
57321                },
57322                observerUpdate: function observerUpdate(swiper) {
57323                    if (!swiper.controller.control) return;
57324
57325                    if (swiper.controller.spline) {
57326                        swiper.controller.spline = undefined;
57327                        delete swiper.controller.spline;
57328                    }
57329                },
57330                setTranslate: function setTranslate(swiper, translate, byController) {
57331                    if (!swiper.controller.control) return;
57332                    swiper.controller.setTranslate(translate, byController);
57333                },
57334                setTransition: function setTransition(swiper, duration, byController) {
57335                    if (!swiper.controller.control) return;
57336                    swiper.controller.setTransition(duration, byController);
57337                }
57338            }
57339        };
57340        exports.default = _default;
57341    }, {"../../utils/utils": 98}],
57342    14: [function (require, module, exports) {
57343        "use strict";
57344
57345        exports.__esModule = true;
57346        exports.default = getBreakpoints;
57347
57348        var _ssrWindow = require("ssr-window");
57349
57350        function getBreakpoints(breakpoints) {
57351            var window = (0, _ssrWindow.getWindow)(); // Get breakpoint for window width
57352
57353            if (!breakpoints) return undefined;
57354            var breakpoint = false;
57355            var points = Object.keys(breakpoints).map(function (point) {
57356                if (typeof point === 'string' && point.indexOf('@') === 0) {
57357                    var minRatio = parseFloat(point.substr(1));
57358                    var value = window.innerHeight * minRatio;
57359                    return {
57360                        value: value,
57361                        point: point
57362                    };
57363                }
57364
57365                return {
57366                    value: point,
57367                    point: point
57368                };
57369            });
57370            points.sort(function (a, b) {
57371                return parseInt(a.value, 10) - parseInt(b.value, 10);
57372            });
57373
57374            for (var i = 0; i < points.length; i += 1) {
57375                var _points$i = points[i],
57376                    point = _points$i.point,
57377                    value = _points$i.value;
57378
57379                if (value <= window.innerWidth) {
57380                    breakpoint = point;
57381                }
57382            }
57383
57384            return breakpoint || 'max';
57385        }
57386    }, {"ssr-window": 10}],
57387    15: [function (require, module, exports) {
57388        "use strict";
57389
57390        exports.__esModule = true;
57391        exports.default = void 0;
57392
57393        var _setBreakpoint = _interopRequireDefault(require("./setBreakpoint"));
57394
57395        var _getBreakpoint = _interopRequireDefault(require("./getBreakpoint"));
57396
57397        function _interopRequireDefault(obj) {
57398            return obj && obj.__esModule ? obj : {default: obj};
57399        }
57400
57401        var _default = {
57402            setBreakpoint: _setBreakpoint.default,
57403            getBreakpoint: _getBreakpoint.default
57404        };
57405        exports.default = _default;
57406    }, {"./getBreakpoint": 14, "./setBreakpoint": 16}],
57407    16: [function (require, module, exports) {
57408        "use strict";
57409
57410        exports.__esModule = true;
57411        exports.default = setBreakpoint;
57412
57413        var _utils = require("../../../utils/utils");
57414
57415        function setBreakpoint() {
57416            var swiper = this;
57417            var activeIndex = swiper.activeIndex,
57418                initialized = swiper.initialized,
57419                _swiper$loopedSlides = swiper.loopedSlides,
57420                loopedSlides = _swiper$loopedSlides === void 0 ? 0 : _swiper$loopedSlides,
57421                params = swiper.params,
57422                $el = swiper.$el;
57423            var breakpoints = params.breakpoints;
57424            if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return; // Get breakpoint for window width and update parameters
57425
57426            var breakpoint = swiper.getBreakpoint(breakpoints);
57427
57428            if (breakpoint && swiper.currentBreakpoint !== breakpoint) {
57429                var breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined;
57430
57431                if (breakpointOnlyParams) {
57432                    ['slidesPerView', 'spaceBetween', 'slidesPerGroup', 'slidesPerGroupSkip', 'slidesPerColumn'].forEach(function (param) {
57433                        var paramValue = breakpointOnlyParams[param];
57434                        if (typeof paramValue === 'undefined') return;
57435
57436                        if (param === 'slidesPerView' && (paramValue === 'AUTO' || paramValue === 'auto')) {
57437                            breakpointOnlyParams[param] = 'auto';
57438                        } else if (param === 'slidesPerView') {
57439                            breakpointOnlyParams[param] = parseFloat(paramValue);
57440                        } else {
57441                            breakpointOnlyParams[param] = parseInt(paramValue, 10);
57442                        }
57443                    });
57444                }
57445
57446                var breakpointParams = breakpointOnlyParams || swiper.originalParams;
57447                var wasMultiRow = params.slidesPerColumn > 1;
57448                var isMultiRow = breakpointParams.slidesPerColumn > 1;
57449
57450                if (wasMultiRow && !isMultiRow) {
57451                    $el.removeClass(params.containerModifierClass + "multirow " + params.containerModifierClass + "multirow-column");
57452                    swiper.emitContainerClasses();
57453                } else if (!wasMultiRow && isMultiRow) {
57454                    $el.addClass(params.containerModifierClass + "multirow");
57455
57456                    if (breakpointParams.slidesPerColumnFill === 'column') {
57457                        $el.addClass(params.containerModifierClass + "multirow-column");
57458                    }
57459
57460                    swiper.emitContainerClasses();
57461                }
57462
57463                var directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction;
57464                var needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged);
57465
57466                if (directionChanged && initialized) {
57467                    swiper.changeDirection();
57468                }
57469
57470                (0, _utils.extend)(swiper.params, breakpointParams);
57471                (0, _utils.extend)(swiper, {
57472                    allowTouchMove: swiper.params.allowTouchMove,
57473                    allowSlideNext: swiper.params.allowSlideNext,
57474                    allowSlidePrev: swiper.params.allowSlidePrev
57475                });
57476                swiper.currentBreakpoint = breakpoint;
57477                swiper.emit('_beforeBreakpoint', breakpointParams);
57478
57479                if (needsReLoop && initialized) {
57480                    swiper.loopDestroy();
57481                    swiper.loopCreate();
57482                    swiper.updateSlides();
57483                    swiper.slideTo(activeIndex - loopedSlides + swiper.loopedSlides, 0, false);
57484                }
57485
57486                swiper.emit('breakpoint', breakpointParams);
57487            }
57488        }
57489    }, {"../../../utils/utils": 98}],
57490    17: [function (require, module, exports) {
57491        "use strict";
57492
57493        exports.__esModule = true;
57494        exports.default = void 0;
57495
57496        function checkOverflow() {
57497            var swiper = this;
57498            var params = swiper.params;
57499            var wasLocked = swiper.isLocked;
57500            var lastSlidePosition = swiper.slides.length > 0 && params.slidesOffsetBefore + params.spaceBetween * (swiper.slides.length - 1) + swiper.slides[0].offsetWidth * swiper.slides.length;
57501
57502            if (params.slidesOffsetBefore && params.slidesOffsetAfter && lastSlidePosition) {
57503                swiper.isLocked = lastSlidePosition <= swiper.size;
57504            } else {
57505                swiper.isLocked = swiper.snapGrid.length === 1;
57506            }
57507
57508            swiper.allowSlideNext = !swiper.isLocked;
57509            swiper.allowSlidePrev = !swiper.isLocked; // events
57510
57511            if (wasLocked !== swiper.isLocked) swiper.emit(swiper.isLocked ? 'lock' : 'unlock');
57512
57513            if (wasLocked && wasLocked !== swiper.isLocked) {
57514                swiper.isEnd = false;
57515                if (swiper.navigation) swiper.navigation.update();
57516            }
57517        }
57518
57519        var _default = {
57520            checkOverflow: checkOverflow
57521        };
57522        exports.default = _default;
57523    }, {}],
57524    18: [function (require, module, exports) {
57525        "use strict";
57526
57527        exports.__esModule = true;
57528        exports.default = addClasses;
57529
57530        function addClasses() {
57531            var swiper = this;
57532            var classNames = swiper.classNames,
57533                params = swiper.params,
57534                rtl = swiper.rtl,
57535                $el = swiper.$el,
57536                device = swiper.device;
57537            var suffixes = [];
57538            suffixes.push('initialized');
57539            suffixes.push(params.direction);
57540
57541            if (params.freeMode) {
57542                suffixes.push('free-mode');
57543            }
57544
57545            if (params.autoHeight) {
57546                suffixes.push('autoheight');
57547            }
57548
57549            if (rtl) {
57550                suffixes.push('rtl');
57551            }
57552
57553            if (params.slidesPerColumn > 1) {
57554                suffixes.push('multirow');
57555
57556                if (params.slidesPerColumnFill === 'column') {
57557                    suffixes.push('multirow-column');
57558                }
57559            }
57560
57561            if (device.android) {
57562                suffixes.push('android');
57563            }
57564
57565            if (device.ios) {
57566                suffixes.push('ios');
57567            }
57568
57569            if (params.cssMode) {
57570                suffixes.push('css-mode');
57571            }
57572
57573            suffixes.forEach(function (suffix) {
57574                classNames.push(params.containerModifierClass + suffix);
57575            });
57576            $el.addClass(classNames.join(' '));
57577            swiper.emitContainerClasses();
57578        }
57579    }, {}],
57580    19: [function (require, module, exports) {
57581        "use strict";
57582
57583        exports.__esModule = true;
57584        exports.default = void 0;
57585
57586        var _addClasses = _interopRequireDefault(require("./addClasses"));
57587
57588        var _removeClasses = _interopRequireDefault(require("./removeClasses"));
57589
57590        function _interopRequireDefault(obj) {
57591            return obj && obj.__esModule ? obj : {default: obj};
57592        }
57593
57594        var _default = {
57595            addClasses: _addClasses.default,
57596            removeClasses: _removeClasses.default
57597        };
57598        exports.default = _default;
57599    }, {"./addClasses": 18, "./removeClasses": 20}],
57600    20: [function (require, module, exports) {
57601        "use strict";
57602
57603        exports.__esModule = true;
57604        exports.default = removeClasses;
57605
57606        function removeClasses() {
57607            var swiper = this;
57608            var $el = swiper.$el,
57609                classNames = swiper.classNames;
57610            $el.removeClass(classNames.join(' '));
57611            swiper.emitContainerClasses();
57612        }
57613    }, {}],
57614    21: [function (require, module, exports) {
57615        "use strict";
57616
57617        exports.__esModule = true;
57618        exports.default = void 0;
57619
57620        var _dom = _interopRequireDefault(require("../../utils/dom"));
57621
57622        var _utils = require("../../utils/utils");
57623
57624        var _getSupport = require("../../utils/get-support");
57625
57626        var _getDevice = require("../../utils/get-device");
57627
57628        var _getBrowser = require("../../utils/get-browser");
57629
57630        var _resize = _interopRequireDefault(require("../../modules/resize/resize"));
57631
57632        var _observer = _interopRequireDefault(require("../../modules/observer/observer"));
57633
57634        var _modular = _interopRequireDefault(require("./modular"));
57635
57636        var _eventsEmitter = _interopRequireDefault(require("./events-emitter"));
57637
57638        var _index = _interopRequireDefault(require("./update/index"));
57639
57640        var _index2 = _interopRequireDefault(require("./translate/index"));
57641
57642        var _index3 = _interopRequireDefault(require("./transition/index"));
57643
57644        var _index4 = _interopRequireDefault(require("./slide/index"));
57645
57646        var _index5 = _interopRequireDefault(require("./loop/index"));
57647
57648        var _index6 = _interopRequireDefault(require("./grab-cursor/index"));
57649
57650        var _index7 = _interopRequireDefault(require("./manipulation/index"));
57651
57652        var _index8 = _interopRequireDefault(require("./events/index"));
57653
57654        var _index9 = _interopRequireDefault(require("./breakpoints/index"));
57655
57656        var _index10 = _interopRequireDefault(require("./classes/index"));
57657
57658        var _index11 = _interopRequireDefault(require("./images/index"));
57659
57660        var _index12 = _interopRequireDefault(require("./check-overflow/index"));
57661
57662        var _defaults = _interopRequireDefault(require("./defaults"));
57663
57664        function _interopRequireDefault(obj) {
57665            return obj && obj.__esModule ? obj : {default: obj};
57666        }
57667
57668        function _defineProperties(target, props) {
57669            for (var i = 0; i < props.length; i++) {
57670                var descriptor = props[i];
57671                descriptor.enumerable = descriptor.enumerable || false;
57672                descriptor.configurable = true;
57673                if ("value" in descriptor) descriptor.writable = true;
57674                Object.defineProperty(target, descriptor.key, descriptor);
57675            }
57676        }
57677
57678        function _createClass(Constructor, protoProps, staticProps) {
57679            if (protoProps) _defineProperties(Constructor.prototype, protoProps);
57680            if (staticProps) _defineProperties(Constructor, staticProps);
57681            return Constructor;
57682        }
57683
57684        var prototypes = {
57685            modular: _modular.default,
57686            eventsEmitter: _eventsEmitter.default,
57687            update: _index.default,
57688            translate: _index2.default,
57689            transition: _index3.default,
57690            slide: _index4.default,
57691            loop: _index5.default,
57692            grabCursor: _index6.default,
57693            manipulation: _index7.default,
57694            events: _index8.default,
57695            breakpoints: _index9.default,
57696            checkOverflow: _index12.default,
57697            classes: _index10.default,
57698            images: _index11.default
57699        };
57700        var extendedDefaults = {};
57701
57702        var Swiper = /*#__PURE__*/function () {
57703            function Swiper() {
57704                var el;
57705                var params;
57706
57707                for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
57708                    args[_key] = arguments[_key];
57709                }
57710
57711                if (args.length === 1 && args[0].constructor && args[0].constructor === Object) {
57712                    params = args[0];
57713                } else {
57714                    el = args[0];
57715                    params = args[1];
57716                }
57717
57718                if (!params) params = {};
57719                params = (0, _utils.extend)({}, params);
57720                if (el && !params.el) params.el = el; // Swiper Instance
57721
57722                var swiper = this;
57723                swiper.support = (0, _getSupport.getSupport)();
57724                swiper.device = (0, _getDevice.getDevice)({
57725                    userAgent: params.userAgent
57726                });
57727                swiper.browser = (0, _getBrowser.getBrowser)();
57728                swiper.eventsListeners = {};
57729                swiper.eventsAnyListeners = [];
57730
57731                if (typeof swiper.modules === 'undefined') {
57732                    swiper.modules = {};
57733                }
57734
57735                Object.keys(swiper.modules).forEach(function (moduleName) {
57736                    var module = swiper.modules[moduleName];
57737
57738                    if (module.params) {
57739                        var moduleParamName = Object.keys(module.params)[0];
57740                        var moduleParams = module.params[moduleParamName];
57741                        if (typeof moduleParams !== 'object' || moduleParams === null) return;
57742                        if (!(moduleParamName in params && 'enabled' in moduleParams)) return;
57743
57744                        if (params[moduleParamName] === true) {
57745                            params[moduleParamName] = {
57746                                enabled: true
57747                            };
57748                        }
57749
57750                        if (typeof params[moduleParamName] === 'object' && !('enabled' in params[moduleParamName])) {
57751                            params[moduleParamName].enabled = true;
57752                        }
57753
57754                        if (!params[moduleParamName]) params[moduleParamName] = {
57755                            enabled: false
57756                        };
57757                    }
57758                }); // Extend defaults with modules params
57759
57760                var swiperParams = (0, _utils.extend)({}, _defaults.default);
57761                swiper.useParams(swiperParams); // Extend defaults with passed params
57762
57763                swiper.params = (0, _utils.extend)({}, swiperParams, extendedDefaults, params);
57764                swiper.originalParams = (0, _utils.extend)({}, swiper.params);
57765                swiper.passedParams = (0, _utils.extend)({}, params); // add event listeners
57766
57767                if (swiper.params && swiper.params.on) {
57768                    Object.keys(swiper.params.on).forEach(function (eventName) {
57769                        swiper.on(eventName, swiper.params.on[eventName]);
57770                    });
57771                }
57772
57773                if (swiper.params && swiper.params.onAny) {
57774                    swiper.onAny(swiper.params.onAny);
57775                } // Save Dom lib
57776
57777
57778                swiper.$ = _dom.default; // Find el
57779
57780                var $el = (0, _dom.default)(swiper.params.el);
57781                el = $el[0];
57782
57783                if (!el) {
57784                    return undefined;
57785                }
57786
57787                if ($el.length > 1) {
57788                    var swipers = [];
57789                    $el.each(function (containerEl) {
57790                        var newParams = (0, _utils.extend)({}, params, {
57791                            el: containerEl
57792                        });
57793                        swipers.push(new Swiper(newParams));
57794                    });
57795                    return swipers;
57796                }
57797
57798                el.swiper = swiper; // Find Wrapper
57799
57800                var $wrapperEl;
57801
57802                if (el && el.shadowRoot && el.shadowRoot.querySelector) {
57803                    $wrapperEl = (0, _dom.default)(el.shadowRoot.querySelector("." + swiper.params.wrapperClass)); // Children needs to return slot items
57804
57805                    $wrapperEl.children = function (options) {
57806                        return $el.children(options);
57807                    };
57808                } else {
57809                    $wrapperEl = $el.children("." + swiper.params.wrapperClass);
57810                } // Extend Swiper
57811
57812
57813                (0, _utils.extend)(swiper, {
57814                    $el: $el,
57815                    el: el,
57816                    $wrapperEl: $wrapperEl,
57817                    wrapperEl: $wrapperEl[0],
57818                    // Classes
57819                    classNames: [],
57820                    // Slides
57821                    slides: (0, _dom.default)(),
57822                    slidesGrid: [],
57823                    snapGrid: [],
57824                    slidesSizesGrid: [],
57825                    // isDirection
57826                    isHorizontal: function isHorizontal() {
57827                        return swiper.params.direction === 'horizontal';
57828                    },
57829                    isVertical: function isVertical() {
57830                        return swiper.params.direction === 'vertical';
57831                    },
57832                    // RTL
57833                    rtl: el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl',
57834                    rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl'),
57835                    wrongRTL: $wrapperEl.css('display') === '-webkit-box',
57836                    // Indexes
57837                    activeIndex: 0,
57838                    realIndex: 0,
57839                    //
57840                    isBeginning: true,
57841                    isEnd: false,
57842                    // Props
57843                    translate: 0,
57844                    previousTranslate: 0,
57845                    progress: 0,
57846                    velocity: 0,
57847                    animating: false,
57848                    // Locks
57849                    allowSlideNext: swiper.params.allowSlideNext,
57850                    allowSlidePrev: swiper.params.allowSlidePrev,
57851                    // Touch Events
57852                    touchEvents: function touchEvents() {
57853                        var touch = ['touchstart', 'touchmove', 'touchend', 'touchcancel'];
57854                        var desktop = ['mousedown', 'mousemove', 'mouseup'];
57855
57856                        if (swiper.support.pointerEvents) {
57857                            desktop = ['pointerdown', 'pointermove', 'pointerup'];
57858                        }
57859
57860                        swiper.touchEventsTouch = {
57861                            start: touch[0],
57862                            move: touch[1],
57863                            end: touch[2],
57864                            cancel: touch[3]
57865                        };
57866                        swiper.touchEventsDesktop = {
57867                            start: desktop[0],
57868                            move: desktop[1],
57869                            end: desktop[2]
57870                        };
57871                        return swiper.support.touch || !swiper.params.simulateTouch ? swiper.touchEventsTouch : swiper.touchEventsDesktop;
57872                    }(),
57873                    touchEventsData: {
57874                        isTouched: undefined,
57875                        isMoved: undefined,
57876                        allowTouchCallbacks: undefined,
57877                        touchStartTime: undefined,
57878                        isScrolling: undefined,
57879                        currentTranslate: undefined,
57880                        startTranslate: undefined,
57881                        allowThresholdMove: undefined,
57882                        // Form elements to match
57883                        formElements: 'input, select, option, textarea, button, video, label',
57884                        // Last click time
57885                        lastClickTime: (0, _utils.now)(),
57886                        clickTimeout: undefined,
57887                        // Velocities
57888                        velocities: [],
57889                        allowMomentumBounce: undefined,
57890                        isTouchEvent: undefined,
57891                        startMoving: undefined
57892                    },
57893                    // Clicks
57894                    allowClick: true,
57895                    // Touches
57896                    allowTouchMove: swiper.params.allowTouchMove,
57897                    touches: {
57898                        startX: 0,
57899                        startY: 0,
57900                        currentX: 0,
57901                        currentY: 0,
57902                        diff: 0
57903                    },
57904                    // Images
57905                    imagesToLoad: [],
57906                    imagesLoaded: 0
57907                }); // Install Modules
57908
57909                swiper.useModules();
57910                swiper.emit('_swiper'); // Init
57911
57912                if (swiper.params.init) {
57913                    swiper.init();
57914                } // Return app instance
57915
57916
57917                return swiper;
57918            }
57919
57920            var _proto = Swiper.prototype;
57921
57922            _proto.emitContainerClasses = function emitContainerClasses() {
57923                var swiper = this;
57924                if (!swiper.params._emitClasses || !swiper.el) return;
57925                var classes = swiper.el.className.split(' ').filter(function (className) {
57926                    return className.indexOf('swiper-container') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0;
57927                });
57928                swiper.emit('_containerClasses', classes.join(' '));
57929            };
57930
57931            _proto.getSlideClasses = function getSlideClasses(sli
57931deEl) {
57932                var swiper = this;
57933                return slideEl.className.split(' ').filter(function (className) {
57934                    return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0;
57935                }).join(' ');
57936            };
57937
57938            _proto.emitSlidesClasses = function emitSlidesClasses() {
57939                var swiper = this;
57940                if (!swiper.params._emitClasses || !swiper.el) return;
57941                swiper.slides.each(function (slideEl) {
57942                    var classNames = swiper.getSlideClasses(slideEl);
57943                    swiper.emit('_slideClass', slideEl, classNames);
57944                });
57945            };
57946
57947            _proto.slidesPerViewDynamic = function slidesPerViewDynamic() {
57948                var swiper = this;
57949                var params = swiper.params,
57950                    slides = swiper.slides,
57951                    slidesGrid = swiper.slidesGrid,
57952                    swiperSize = swiper.size,
57953                    activeIndex = swiper.activeIndex;
57954                var spv = 1;
57955
57956                if (params.centeredSlides) {
57957                    var slideSize = slides[activeIndex].swiperSlideSize;
57958                    var breakLoop;
57959
57960                    for (var i = activeIndex + 1; i < slides.length; i += 1) {
57961                        if (slides[i] && !breakLoop) {
57962                            slideSize += slides[i].swiperSlideSize;
57963                            spv += 1;
57964                            if (slideSize > swiperSize) breakLoop = true;
57965                        }
57966                    }
57967
57968                    for (var _i = activeIndex - 1; _i >= 0; _i -= 1) {
57969                        if (slides[_i] && !breakLoop) {
57970                            slideSize += slides[_i].swiperSlideSize;
57971                            spv += 1;
57972                            if (slideSize > swiperSize) breakLoop = true;
57973                        }
57974                    }
57975                } else {
57976                    for (var _i2 = activeIndex + 1; _i2 < slides.length; _i2 += 1) {
57977                        if (slidesGrid[_i2] - slidesGrid[activeIndex] < swiperSize) {
57978                            spv += 1;
57979                        }
57980                    }
57981                }
57982
57983                return spv;
57984            };
57985
57986            _proto.update = function update() {
57987                var swiper = this;
57988                if (!swiper || swiper.destroyed) return;
57989                var snapGrid = swiper.snapGrid,
57990                    params = swiper.params; // Breakpoints
57991
57992                if (params.breakpoints) {
57993                    swiper.setBreakpoint();
57994                }
57995
57996                swiper.updateSize();
57997                swiper.updateSlides();
57998                swiper.updateProgress();
57999                swiper.updateSlidesClasses();
58000
58001                function setTranslate() {
58002                    var translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate;
58003                    var newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate());
58004                    swiper.setTranslate(newTranslate);
58005                    swiper.updateActiveIndex();
58006                    swiper.updateSlidesClasses();
58007                }
58008
58009                var translated;
58010
58011                if (swiper.params.freeMode) {
58012                    setTranslate();
58013
58014                    if (swiper.params.autoHeight) {
58015                        swiper.updateAutoHeight();
58016                    }
58017                } else {
58018                    if ((swiper.params.slidesPerView === 'auto' || swiper.params.slidesPerView > 1) && swiper.isEnd && !swiper.params.centeredSlides) {
58019                        translated = swiper.slideTo(swiper.slides.length - 1, 0, false, true);
58020                    } else {
58021                        translated = swiper.slideTo(swiper.activeIndex, 0, false, true);
58022                    }
58023
58024                    if (!translated) {
58025                        setTranslate();
58026                    }
58027                }
58028
58029                if (params.watchOverflow && snapGrid !== swiper.snapGrid) {
58030                    swiper.checkOverflow();
58031                }
58032
58033                swiper.emit('update');
58034            };
58035
58036            _proto.changeDirection = function changeDirection(newDirection, needUpdate) {
58037                if (needUpdate === void 0) {
58038                    needUpdate = true;
58039                }
58040
58041                var swiper = this;
58042                var currentDirection = swiper.params.direction;
58043
58044                if (!newDirection) {
58045                    // eslint-disable-next-line
58046                    newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal';
58047                }
58048
58049                if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') {
58050                    return swiper;
58051                }
58052
58053                swiper.$el.removeClass("" + swiper.params.containerModifierClass + currentDirection).addClass("" + swiper.params.containerModifierClass + newDirection);
58054                swiper.emitContainerClasses();
58055                swiper.params.direction = newDirection;
58056                swiper.slides.each(function (slideEl) {
58057                    if (newDirection === 'vertical') {
58058                        slideEl.style.width = '';
58059                    } else {
58060                        slideEl.style.height = '';
58061                    }
58062                });
58063                swiper.emit('changeDirection');
58064                if (needUpdate) swiper.update();
58065                return swiper;
58066            };
58067
58068            _proto.init = function init() {
58069                var swiper = this;
58070                if (swiper.initialized) return;
58071                swiper.emit('beforeInit'); // Set breakpoint
58072
58073                if (swiper.params.breakpoints) {
58074                    swiper.setBreakpoint();
58075                } // Add Classes
58076
58077
58078                swiper.addClasses(); // Create loop
58079
58080                if (swiper.params.loop) {
58081                    swiper.loopCreate();
58082                } // Update size
58083
58084
58085                swiper.updateSize(); // Update slides
58086
58087                swiper.updateSlides();
58088
58089                if (swiper.params.watchOverflow) {
58090                    swiper.checkOverflow();
58091                } // Set Grab Cursor
58092
58093
58094                if (swiper.params.grabCursor) {
58095                    swiper.setGrabCursor();
58096                }
58097
58098                if (swiper.params.preloadImages) {
58099                    swiper.preloadImages();
58100                } // Slide To Initial Slide
58101
58102
58103                if (swiper.params.loop) {
58104                    swiper.slideTo(swiper.params.initialSlide + swiper.loopedSlides, 0, swiper.params.runCallbacksOnInit);
58105                } else {
58106                    swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit);
58107                } // Attach events
58108
58109
58110                swiper.attachEvents(); // Init Flag
58111
58112                swiper.initialized = true; // Emit
58113
58114                swiper.emit('init');
58115                swiper.emit('afterInit');
58116            };
58117
58118            _proto.destroy = function destroy(deleteInstance, cleanStyles) {
58119                if (deleteInstance === void 0) {
58120                    deleteInstance = true;
58121                }
58122
58123                if (cleanStyles === void 0) {
58124                    cleanStyles = true;
58125                }
58126
58127                var swiper = this;
58128                var params = swiper.params,
58129                    $el = swiper.$el,
58130                    $wrapperEl = swiper.$wrapperEl,
58131                    slides = swiper.slides;
58132
58133                if (typeof swiper.params === 'undefined' || swiper.destroyed) {
58134                    return null;
58135                }
58136
58137                swiper.emit('beforeDestroy'); // Init Flag
58138
58139                swiper.initialized = false; // Detach events
58140
58141                swiper.detachEvents(); // Destroy loop
58142
58143                if (params.loop) {
58144                    swiper.loopDestroy();
58145                } // Cleanup styles
58146
58147
58148                if (cleanStyles) {
58149                    swiper.removeClasses();
58150                    $el.removeAttr('style');
58151                    $wrapperEl.removeAttr('style');
58152
58153                    if (slides && slides.length) {
58154                        slides.removeClass([params.slideVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass].join(' ')).removeAttr('style').removeAttr('data-swiper-slide-index');
58155                    }
58156                }
58157
58158                swiper.emit('destroy'); // Detach emitter events
58159
58160                Object.keys(swiper.eventsListeners).forEach(function (eventName) {
58161                    swiper.off(eventName);
58162                });
58163
58164                if (deleteInstance !== false) {
58165                    swiper.$el[0].swiper = null;
58166                    (0, _utils.deleteProps)(swiper);
58167                }
58168
58169                swiper.destroyed = true;
58170                return null;
58171            };
58172
58173            Swiper.extendDefaults = function extendDefaults(newDefaults) {
58174                (0, _utils.extend)(extendedDefaults, newDefaults);
58175            };
58176
58177            Swiper.installModule = function installModule(module) {
58178                if (!Swiper.prototype.modules) Swiper.prototype.modules = {};
58179                var name = module.name || Object.keys(Swiper.prototype.modules).length + "_" + (0, _utils.now)();
58180                Swiper.prototype.modules[name] = module;
58181            };
58182
58183            Swiper.use = function use(module) {
58184                if (Array.isArray(module)) {
58185                    module.forEach(function (m) {
58186                        return Swiper.installModule(m);
58187                    });
58188                    return Swiper;
58189                }
58190
58191                Swiper.installModule(module);
58192                return Swiper;
58193            };
58194
58195            _createClass(Swiper, null, [{
58196                key: "extendedDefaults",
58197                get: function get() {
58198                    return extendedDefaults;
58199                }
58200            }, {
58201                key: "defaults",
58202                get: function get() {
58203                    return _defaults.default;
58204                }
58205            }]);
58206
58207            return Swiper;
58208        }();
58209
58210        Object.keys(prototypes).forEach(function (prototypeGroup) {
58211            Object.keys(prototypes[prototypeGroup]).forEach(function (protoMethod) {
58212                Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod];
58213            });
58214        });
58215        Swiper.use([_resize.default, _observer.default]);
58216        var _default = Swiper;
58217        exports.default = _default;
58218    }, {
58219        "../../modules/observer/observer": 92,
58220        "../../modules/resize/resize": 93,
58221        "../../utils/dom": 94,
58222        "../../utils/get-browser": 95,
58223        "../../utils/get-device": 96,
58224        "../../utils/get-support": 97,
58225        "../../utils/utils": 98,
58226        "./breakpoints/index": 15,
58227        "./check-overflow/index": 17,
58228        "./classes/index": 19,
58229        "./defaults": 22,
58230        "./events-emitter": 23,
58231        "./events/index": 24,
58232        "./grab-cursor/index": 31,
58233        "./images/index": 34,
58234        "./loop/index": 37,
58235        "./manipulation/index": 43,
58236        "./modular": 47,
58237        "./slide/index": 48,
58238        "./transition/index": 56,
58239        "./translate/index": 61,
58240        "./update/index": 66
58241    }],
58242    22: [function (require, module, exports) {
58243        "use strict";
58244
58245        exports.__esModule = true;
58246        exports.default = void 0;
58247        var _default = {
58248            init: true,
58249            direction: 'horizontal',
58250            touchEventsTarget: 'container',
58251            initialSlide: 0,
58252            speed: 300,
58253            cssMode: false,
58254            updateOnWindowResize: true,
58255            nested: false,
58256            // Overrides
58257            width: null,
58258            height: null,
58259            //
58260            preventInteractionOnTransition: false,
58261            // ssr
58262            userAgent: null,
58263            url: null,
58264            // To support iOS's swipe-to-go-back gesture (when being used in-app).
58265            edgeSwipeDetection: false,
58266            edgeSwipeThreshold: 20,
58267            // Free mode
58268            freeMode: false,
58269            freeModeMomentum: true,
58270            freeModeMomentumRatio: 1,
58271            freeModeMomentumBounce: true,
58272            freeModeMomentumBounceRatio: 1,
58273            freeModeMomentumVelocityRatio: 1,
58274            freeModeSticky: false,
58275            freeModeMinimumVelocity: 0.02,
58276            // Autoheight
58277            autoHeight: false,
58278            // Set wrapper width
58279            setWrapperSize: false,
58280            // Virtual Translate
58281            virtualTranslate: false,
58282            // Effects
58283            effect: 'slide',
58284            // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'
58285            // Breakpoints
58286            breakpoints: undefined,
58287            // Slides grid
58288            spaceBetween: 0,
58289            slidesPerView: 1,
58290            slidesPerColumn: 1,
58291            slidesPerColumnFill: 'column',
58292            slidesPerGroup: 1,
58293            slidesPerGroupSkip: 0,
58294            centeredSlides: false,
58295            centeredSlidesBounds: false,
58296            slidesOffsetBefore: 0,
58297            // in px
58298            slidesOffsetAfter: 0,
58299            // in px
58300            normalizeSlideIndex: true,
58301            centerInsufficientSlides: false,
58302            // Disable swiper and hide navigation when container not overflow
58303            watchOverflow: false,
58304            // Round length
58305            roundLengths: false,
58306            // Touches
58307            touchRatio: 1,
58308            touchAngle: 45,
58309            simulateTouch: true,
58310            shortSwipes: true,
58311            longSwipes: true,
58312            longSwipesRatio: 0.5,
58313            longSwipesMs: 300,
58314            followFinger: true,
58315            allowTouchMove: true,
58316            threshold: 0,
58317            touchMoveStopPropagation: false,
58318            touchStartPreventDefault: true,
58319            touchStartForcePreventDefault: false,
58320            touchReleaseOnEdges: false,
58321            // Unique Navigation Elements
58322            uniqueNavElements: true,
58323            // Resistance
58324            resistance: true,
58325            resistanceRatio: 0.85,
58326            // Progress
58327            watchSlidesProgress: false,
58328            watchSlidesVisibility: false,
58329            // Cursor
58330            grabCursor: false,
58331            // Clicks
58332            preventClicks: true,
58333            preventClicksPropagation: true,
58334            slideToClickedSlide: false,
58335            // Images
58336            preloadImages: true,
58337            updateOnImagesReady: true,
58338            // loop
58339            loop: false,
58340            loopAdditionalSlides: 0,
58341            loopedSlides: null,
58342            loopFillGroupWithBlank: false,
58343            loopPreventsSlide: true,
58344            // Swiping/no swiping
58345            allowSlidePrev: true,
58346            allowSlideNext: true,
58347            swipeHandler: null,
58348            // '.swipe-handler',
58349            noSwiping: true,
58350            noSwipingClass: 'swiper-no-swiping',
58351            noSwipingSelector: null,
58352            // Passive Listeners
58353            passiveListeners: true,
58354            // NS
58355            containerModifierClass: 'swiper-container-',
58356            // NEW
58357            slideClass: 'swiper-slide',
58358            slideBlankClass: 'swiper-slide-invisible-blank',
58359            slideActiveClass: 'swiper-slide-active',
58360            slideDuplicateActiveClass: 'swiper-slide-duplicate-active',
58361            slideVisibleClass: 'swiper-slide-visible',
58362            slideDuplicateClass: 'swiper-slide-duplicate',
58363            slideNextClass: 'swiper-slide-next',
58364            slideDuplicateNextClass: 'swiper-slide-duplicate-next',
58365            slidePrevClass: 'swiper-slide-prev',
58366            slideDuplicatePrevClass: 'swiper-slide-duplicate-prev',
58367            wrapperClass: 'swiper-wrapper',
58368            // Callbacks
58369            runCallbacksOnInit: true,
58370            // Internals
58371            _emitClasses: false
58372        };
58373        exports.default = _default;
58374    }, {}],
58375    23: [function (require, module, exports) {
58376        "use strict";
58377
58378        exports.__esModule = true;
58379        exports.default = void 0;
58380
58381        /* eslint-disable no-underscore-dangle */
58382        var _default = {
58383            on: function on(events, handler, priority) {
58384                var self = this;
58385                if (typeof handler !== 'function') return self;
58386                var method = priority ? 'unshift' : 'push';
58387                events.split(' ').forEach(function (event) {
58388                    if (!self.eventsListeners[event]) self.eventsListeners[event] = [];
58389                    self.eventsListeners[event][method](handler);
58390                });
58391                return self;
58392            },
58393            once: function once(events, handler, priority) {
58394                var self = this;
58395                if (typeof handler !== 'function') return self;
58396
58397                function onceHandler() {
58398                    self.off(events, onceHandler);
58399
58400                    if (onceHandler.__emitterProxy) {
58401                        delete onceHandler.__emitterProxy;
58402                    }
58403
58404                    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
58405                        args[_key] = arguments[_key];
58406                    }
58407
58408                    handler.apply(self, args);
58409                }
58410
58411                onceHandler.__emitterProxy = handler;
58412                return self.on(events, onceHandler, priority);
58413            },
58414            onAny: function onAny(handler, priority) {
58415                var self = this;
58416                if (typeof handler !== 'function') return self;
58417                var method = priority ? 'unshift' : 'push';
58418
58419                if (self.eventsAnyListeners.indexOf(handler) < 0) {
58420                    self.eventsAnyListeners[method](handler);
58421                }
58422
58423                return self;
58424            },
58425            offAny: function offAny(handler) {
58426                var self = this;
58427                if (!self.eventsAnyListeners) return self;
58428                var index = self.eventsAnyListeners.indexOf(handler);
58429
58430                if (index >= 0) {
58431                    self.eventsAnyListeners.splice(index, 1);
58432                }
58433
58434                return self;
58435            },
58436            off: function off(events, handler) {
58437                var self = this;
58438                if (!self.eventsListeners) return self;
58439                events.split(' ').forEach(function (event) {
58440                    if (typeof handler === 'undefined') {
58441                        self.eventsListeners[event] = [];
58442                    } else if (self.eventsListeners[event]) {
58443                        self.eventsListeners[event].forEach(function (eventHandler, index) {
58444                            if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) {
58445                                self.eventsListeners[event].splice(index, 1);
58446                            }
58447                        });
58448                    }
58449                });
58450                return self;
58451            },
58452            emit: function emit() {
58453                var self = this;
58454                if (!self.eventsListeners) return self;
58455                var events;
58456                var data;
58457                var context;
58458
58459                for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
58460                    args[_key2] = arguments[_key2];
58461                }
58462
58463                if (typeof args[0] === 'string' || Array.isArray(args[0])) {
58464                    events = args[0];
58465                    data = args.slice(1, args.length);
58466                    context = self;
58467                } else {
58468                    events = args[0].events;
58469                    data = args[0].data;
58470                    context = args[0].context || self;
58471                }
58472
58473                data.unshift(context);
58474                var eventsArray = Array.isArray(events) ? events : events.split(' ');
58475                eventsArray.forEach(function (event) {
58476                    if (self.eventsAnyListeners && self.eventsAnyListeners.length) {
58477                        self.eventsAnyListeners.forEach(function (eventHandler) {
58478                            eventHandler.apply(context, [event].concat(data));
58479                        });
58480                    }
58481
58482                    if (self.eventsListeners && self.eventsListeners[event]) {
58483                        var handlers = [];
58484                        self.eventsListeners[event].forEach(function (eventHandler) {
58485                            handlers.push(eventHandler);
58486                        });
58487                        handlers.forEach(function (eventHandler) {
58488                            eventHandler.apply(context, data);
58489                        });
58490                    }
58491                });
58492                return self;
58493            }
58494        };
58495        exports.default = _default;
58496    }, {}],
58497    24: [function (require, module, exports) {
58498        "use strict";
58499
58500        exports.__esModule = true;
58501        exports.default = void 0;
58502
58503        var _ssrWindow = require("ssr-window");
58504
58505        var _onTouchStart = _interopRequireDefault(require("./onTouchStart"));
58506
58507        var _onTouchMove = _interopRequireDefault(require("./onTouchMove"));
58508
58509        var _onTouchEnd = _interopRequireDefault(require("./onTouchEnd"));
58510
58511        var _onResize = _interopRequireDefault(require("./onResize"));
58512
58513        var _onClick = _interopRequireDefault(require("./onClick"));
58514
58515        var _onScroll = _interopRequireDefault(require("./onScroll"));
58516
58517        function _interopRequireDefault(obj) {
58518            return obj && obj.__esModule ? obj : {default: obj};
58519        }
58520
58521        var dummyEventAttached = false;
58522
58523        function dummyEventListener() {
58524        }
58525
58526        function attachEvents() {
58527            var swiper = this;
58528            var document = (0, _ssrWindow.getDocument)();
58529            var params = swiper.params,
58530                touchEvents = swiper.touchEvents,
58531                el = swiper.el,
58532                wrapperEl = swiper.wrapperEl,
58533                device = swiper.device,
58534                support = swiper.support;
58535            swiper.onTouchStart = _onTouchStart.default.bind(swiper);
58536            swiper.onTouchMove = _onTouchMove.default.bind(swiper);
58537            swiper.onTouchEnd = _onTouchEnd.default.bind(swiper);
58538
58539            if (params.cssMode) {
58540                swiper.onScroll = _onScroll.default.bind(swiper);
58541            }
58542
58543            swiper.onClick = _onClick.default.bind(swiper);
58544            var capture = !!params.nested; // Touch Events
58545
58546            if (!support.touch && support.pointerEvents) {
58547                el.addEventListener(touchEvents.start, swiper.onTouchStart, false);
58548                document.addEventListener(touchEvents.move, swiper.onTouchMove, capture);
58549                document.addEventListener(touchEvents.end, swiper.onTouchEnd, false);
58550            } else {
58551                if (support.touch) {
58552                    var passiveListener = touchEvents.start === 'touchstart' && support.passiveListener && params.passiveListeners ? {
58553                        passive: true,
58554                        capture: false
58555                    } : false;
58556                    el.addEventListener(touchEvents.start, swiper.onTouchStart, passiveListener);
58557                    el.addEventListener(touchEvents.move, swiper.onTouchMove, support.passiveListener ? {
58558                        passive: false,
58559                        capture: capture
58560                    } : capture);
58561                    el.addEventListener(touchEvents.end, swiper.onTouchEnd, passiveListener);
58562
58563                    if (touchEvents.cancel) {
58564                        el.addEventListener(touchEvents.cancel, swiper.onTouchEnd, passiveListener);
58565                    }
58566
58567                    if (!dummyEventAttached) {
58568                        document.addEventListener('touchstart', dummyEventListener);
58569                        dummyEventAttached = true;
58570                    }
58571                }
58572
58573                if (params.simulateTouch && !device.ios && !device.android || params.simulateTouch && !support.touch && device.ios) {
58574                    el.addEventListener('mousedown', swiper.onTouchStart, false);
58575                    document.addEventListener('mousemove', swiper.onTouchMove, capture);
58576                    document.addEventListener('mouseup', swiper.onTouchEnd, false);
58577                }
58578            } // Prevent Links Clicks
58579
58580
58581            if (params.preventClicks || params.preventClicksPropagation) {
58582                el.addEventListener('click', swiper.onClick, true);
58583            }
58584
58585            if (params.cssMode) {
58586                wrapperEl.addEventListener('scroll', swiper.onScroll);
58587            } // Resize handler
58588
58589
58590            if (params.updateOnWindowResize) {
58591                swiper.on(device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', _onResize.default, true);
58592            } else {
58593                swiper.on('observerUpdate', _onResize.default, true);
58594            }
58595        }
58596
58597        function detachEvents() {
58598            var swiper = this;
58599            var document = (0, _ssrWindow.getDocument)();
58600            var params = swiper.params,
58601                touchEvents = swiper.touchEvents,
58602                el = swiper.el,
58603                wrapperEl = swiper.wrapperEl,
58604                device = swiper.device,
58605                support = swiper.support;
58606            var capture = !!params.nested; // Touch Events
58607
58608            if (!support.touch && support.pointerEvents) {
58609                el.removeEventListener(touchEvents.start, swiper.onTouchStart, false);
58610                document.removeEventListener(touchEvents.move, swiper.onTouchMove, capture);
58611                document.removeEventListener(touchEvents.end, swiper.onTouchEnd, false);
58612            } else {
58613                if (support.touch) {
58614                    var passiveListener = touchEvents.start === 'onTouchStart' && support.passiveListener && params.passiveListeners ? {
58615                        passive: true,
58616                        capture: false
58617                    } : false;
58618                    el.removeEventListener(touchEvents.start, swiper.onTouchStart, passiveListener);
58619                    el.removeEventListener(touchEvents.move, swiper.onTouchMove, capture);
58620                    el.removeEventListener(touchEvents.end, swiper.onTouchEnd, passiveListener);
58621
58622                    if (touchEvents.cancel) {
58623                        el.removeEventListener(touchEvents.cancel, swiper.onTouchEnd, passiveListener);
58624                    }
58625                }
58626
58627                if (params.simulateTouch && !device.ios && !device.android || params.simulateTouch && !support.touch && device.ios) {
58628                    el.removeEventListener('mousedown', swiper.onTouchStart, false);
58629                    document.removeEventListener('mousemove', swiper.onTouchMove, capture);
58630                    document.removeEventListener('mouseup', swiper.onTouchEnd, false);
58631                }
58632            } // Prevent Links Clicks
58633
58634
58635            if (params.preventClicks || params.preventClicksPropagation) {
58636                el.removeEventListener('click', swiper.onClick, true);
58637            }
58638
58639            if (params.cssMode) {
58640                wrapperEl.removeEventListener('scroll', swiper.onScroll);
58641            } // Resize handler
58642
58643
58644            swiper.off(device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', _onResize.default);
58645        }
58646
58647        var _default = {
58648            attachEvents: attachEvents,
58649            detachEvents: detachEvents
58650        };
58651        exports.default = _default;
58652    }, {
58653        "./onClick": 25,
58654        "./onResize": 26,
58655        "./onScroll": 27,
58656        "./onTouchEnd": 28,
58657        "./onTouchMove": 29,
58658        "./onTouchStart": 30,
58659        "ssr-window": 10
58660    }],
58661    25: [function (require, module, exports) {
58662        "use strict";
58663
58664        exports.__esModule = true;
58665        exports.default = onClick;
58666
58667        function onClick(e) {
58668            var swiper = this;
58669
58670            if (!swiper.allowClick) {
58671                if (swiper.params.preventClicks) e.preventDefault();
58672
58673                if (swiper.params.preventClicksPropagation && swiper.animating) {
58674                    e.stopPropagation();
58675                    e.stopImmediatePropagation();
58676                }
58677            }
58678        }
58679    }, {}],
58680    26: [function (require, module, exports) {
58681        "use strict";
58682
58683        exports.__esModule = true;
58684        exports.default = onResize;
58685
58686        function onResize() {
58687            var swiper = this;
58688            var params = swiper.params,
58689                el = swiper.el;
58690            if (el && el.offsetWidth === 0) return; // Breakpoints
58691
58692            if (params.breakpoints) {
58693                swiper.setBreakpoint();
58694            } // Save locks
58695
58696
58697            var allowSlideNext = swiper.allowSlideNext,
58698                allowSlidePrev = swiper.allowSlidePrev,
58699                snapGrid = swiper.snapGrid; // Disable locks on resize
58700
58701            swiper.allowSlideNext = true;
58702            swiper.allowSlidePrev = true;
58703            swiper.updateSize();
58704            swiper.updateSlides();
58705            swiper.updateSlidesClasses();
58706
58707            if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides) {
58708                swiper.slideTo(swiper.slides.length - 1, 0, false, true);
58709            } else {
58710                swiper.slideTo(swiper.activeIndex, 0, false, true);
58711            }
58712
58713            if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {
58714                swiper.autoplay.run();
58715            } // Return locks after resize
58716
58717
58718            swiper.allowSlidePrev = allowSlidePrev;
58719            swiper.allowSlideNext = allowSlideNext;
58720
58721            if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) {
58722                swiper.checkOverflow();
58723            }
58724        }
58725    }, {}],
58726    27: [function (require, module, exports) {
58727        "use strict";
58728
58729        exports.__esModule = true;
58730        exports.default = onScroll;
58731
58732        function onScroll() {
58733            var swiper = this;
58734            var wrapperEl = swiper.wrapperEl,
58735                rtlTranslate = swiper.rtlTranslate;
58736            swiper.previousTranslate = swiper.translate;
58737
58738            if (swiper.isHorizontal()) {
58739                if (rtlTranslate) {
58740                    swiper.translate = wrapperEl.scrollWidth - wrapperEl.offsetWidth - wrapperEl.scrollLeft;
58741                } else {
58742                    swiper.translate = -wrapperEl.scrollLeft;
58743                }
58744            } else {
58745                swiper.translate = -wrapperEl.scrollTop;
58746            } // eslint-disable-next-line
58747
58748
58749            if (swiper.translate === -0) swiper.translate = 0;
58750            swiper.updateActiveIndex();
58751            swiper.updateSlidesClasses();
58752            var newProgress;
58753            var translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
58754
58755            if (translatesDiff === 0) {
58756                newProgress = 0;
58757            } else {
58758                newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff;
58759            }
58760
58761            if (newProgress !== swiper.progress) {
58762                swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate);
58763            }
58764
58765            swiper.emit('setTranslate', swiper.translate, false);
58766        }
58767    }, {}],
58768    28: [function (require, module, exports) {
58769        "use strict";
58770
58771        exports.__esModule = true;
58772        exports.default = onTouchEnd;
58773
58774        var _utils = require("../../../utils/utils");
58775
58776        function onTouchEnd(event) {
58777            var swiper = this;
58778            var data = swiper.touchEventsData;
58779            var params = swiper.params,
58780                touches = swiper.touches,
58781                rtl = swiper.rtlTranslate,
58782                $wrapperEl = swiper.$wrapperEl,
58783                slidesGrid = swiper.slidesGrid,
58784                snapGrid = swiper.snapGrid;
58785            var e = event;
58786            if (e.originalEvent) e = e.originalEvent;
58787
58788            if (data.allowTouchCallbacks) {
58789                swiper.emit('touchEnd', e);
58790            }
58791
58792            data.allowTouchCallbacks = false;
58793
58794            if (!data.isTouched) {
58795                if (data.isMoved && params.grabCursor) {
58796                    swiper.setGrabCursor(false);
58797                }
58798
58799                data.isMoved = false;
58800                data.startMoving = false;
58801                return;
58802            } // Return Grab Cursor
58803
58804
58805            if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
58806                swiper.setGrabCursor(false);
58807            } // Time diff
58808
58809
58810            var touchEndTime = (0, _utils.now)();
58811            var timeDiff = touchEndTime - data.touchStartTime; // Tap, doubleTap, Click
58812
58813            if (swiper.allowClick) {
58814                swiper.updateClickedSlide(e);
58815                swiper.emit('tap click', e);
58816
58817                if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) {
58818                    swiper.emit('doubleTap doubleClick', e);
58819                }
58820            }
58821
58822            data.lastClickTime = (0, _utils.now)();
58823            (0, _utils.nextTick)(function () {
58824                if (!swiper.destroyed) swiper.allowClick = true;
58825            });
58826
58827            if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 || data.currentTranslate === data.startTranslate) {
58828                data.isTouched = false;
58829                data.isMoved = false;
58830                data.startMoving = false;
58831                return;
58832            }
58833
58834            data.isTouched = false;
58835            data.isMoved = false;
58836            data.startMoving = false;
58837            var currentPos;
58838
58839            if (params.followFinger) {
58840                currentPos = rtl ? swiper.translate : -swiper.translate;
58841            } else {
58842                currentPos = -data.currentTranslate;
58843            }
58844
58845            if (params.cssMode) {
58846                return;
58847            }
58848
58849            if (params.freeMode) {
58850                if (currentPos < -swiper.minTranslate()) {
58851                    swiper.slideTo(swiper.activeIndex);
58852                    return;
58853                }
58854
58855                if (currentPos > -swiper.maxTranslate()) {
58856                    if (swiper.slides.length < snapGrid.length) {
58857                        swiper.slideTo(snapGrid.length - 1);
58858                    } else {
58859                        swiper.slideTo(swiper.slides.length - 1);
58860                    }
58861
58862                    return;
58863                }
58864
58865                if (params.freeModeMomentum) {
58866                    if (data.velocities.length > 1) {
58867                        var lastMoveEvent = data.velocities.pop();
58868                        var velocityEvent = data.velocities.pop();
58869                        var distance = lastMoveEvent.position - velocityEvent.position;
58870                        var time = lastMoveEvent.time - velocityEvent.time;
58871                        swiper.velocity = distance / time;
58872                        swiper.velocity /= 2;
58873
58874                        if (Math.abs(swiper.velocity) < params.freeModeMinimumVelocity) {
58875                            swiper.velocity = 0;
58876                        } // this implies that the user stopped moving a finger then released.
58877                        // There would be no events with distance zero, so the last event is stale.
58878
58879
58880                        if (time > 150 || (0, _utils.now)() - lastMoveEvent.time > 300) {
58881                            swiper.velocity = 0;
58882                        }
58883                    } else {
58884                        swiper.velocity = 0;
58885                    }
58886
58887                    swiper.velocity *= params.freeModeMomentumVelocityRatio;
58888                    data.velocities.length = 0;
58889                    var momentumDuration = 1000 * params.freeModeMomentumRatio;
58890                    var momentumDistance = swiper.velocity * momentumDuration;
58891                    var newPosition = swiper.translate + momentumDistance;
58892                    if (rtl) newPosition = -newPosition;
58893                    var doBounce = false;
58894                    var afterBouncePosition;
58895                    var bounceAmount = Math.abs(swiper.velocity) * 20 * params.freeModeMomentumBounceRatio;
58896                    var needsLoopFix;
58897
58898                    if (newPosition < swiper.maxTranslate()) {
58899                        if (params.freeModeMomentumBounce) {
58900                            if (newPosition + swiper.maxTranslate() < -bounceAmount) {
58901                                newPosition = swiper.maxTranslate() - bounceAmount;
58902                            }
58903
58904                            afterBouncePosition = swiper.maxTranslate();
58905                            doBounce = true;
58906                            data.allowMomentumBounce = true;
58907                        } else {
58908                            newPosition = swiper.maxTranslate();
58909                        }
58910
58911                        if (params.loop && params.centeredSlides) needsLoopFix = true;
58912                    } else if (newPosition > swiper.minTranslate()) {
58913                        if (params.freeModeMomentumBounce) {
58914                            if (newPosition - swiper.minTranslate() > bounceAmount) {
58915                                newPosition = swiper.minTranslate() + bounceAmount;
58916                            }
58917
58918                            afterBouncePosition = swiper.minTranslate();
58919                            doBounce = true;
58920                            data.allowMomentumBounce = true;
58921                        } else {
58922                            newPosition = swiper.minTranslate();
58923                        }
58924
58925                        if (params.loop && params.centeredSlides) needsLoopFix = true;
58926                    } else if (params.freeModeSticky) {
58927                        var nextSlide;
58928
58929                        for (var j = 0; j < snapGrid.length; j += 1) {
58930                            if (snapGrid[j] > -newPosition) {
58931                                nextSlide = j;
58932                                break;
58933                            }
58934                        }
58935
58936                        if (Math.abs(snapGrid[nextSlide] - newPosition) < Math.abs(snapGrid[nextSlide - 1] - newPosition) || swiper.swipeDirection === 'next') {
58937                            newPosition = snapGrid[nextSlide];
58938                        } else {
58939                            newPosition = snapGrid[nextSlide - 1];
58940                        }
58941
58942                        newPosition = -newPosition;
58943                    }
58944
58945                    if (needsLoopFix) {
58946                        swiper.once('transitionEnd', function () {
58947                            swiper.loopFix();
58948                        });
58949                    } // Fix duration
58950
58951
58952                    if (swiper.velocity !== 0) {
58953                        if (rtl) {
58954                            momentumDuration = Math.abs((-newPosition - swiper.translate) / swiper.velocity);
58955                        } else {
58956                            momentumDuration = Math.abs((newPosition - swiper.translate) / swiper.velocity);
58957                        }
58958
58959                        if (params.freeModeSticky) {
58960                            // If freeModeSticky is active and the user ends a swipe with a slow-velocity
58961                            // event, then durations can be 20+ seconds to slide one (or zero!) slides.
58962                            // It's easy to see this when simulating touch with mouse events. To fix this,
58963                            // limit single-slide swipes to the default slide duration. This also has the
58964                            // nice side effect of matching slide speed if the user stopped moving before
58965                            // lifting finger or mouse vs. moving slowly before lifting the finger/mouse.
58966                            // For faster swipes, also apply limits (albeit higher ones).
58967                            var moveDistance = Math.abs((rtl ? -newPosition : newPosition) - swiper.translate);
58968                            var currentSlideSize = swiper.slidesSizesGrid[swiper.activeIndex];
58969
58970                            if (moveDistance < currentSlideSize) {
58971                                momentumDuration = params.speed;
58972                            } else if (moveDistance < 2 * currentSlideSize) {
58973                                momentumDuration = params.speed * 1.5;
58974                            } else {
58975                                momentumDuration = params.speed * 2.5;
58976                            }
58977                        }
58978                    } else if (params.freeModeSticky) {
58979                        swiper.slideToClosest();
58980                        return;
58981                    }
58982
58983                    if (params.freeModeMomentumBounce && doBounce) {
58984                        swiper.updateProgress(afterBouncePosition);
58985                        swiper.setTransition(momentumDuration);
58986                        swiper.setTranslate(newPosition);
58987                        swiper.transitionStart(true, swiper.swipeDirection);
58988                        swiper.animating = true;
58989                        $wrapperEl.transitionEnd(function () {
58990                            if (!swiper || swiper.destroyed || !data.allowMomentumBounce) return;
58991                            swiper.emit('momentumBounce');
58992                            swiper.setTransition(params.speed);
58993                            setTimeout(function () {
58994                                swiper.setTranslate(afterBouncePosition);
58995                                $wrapperEl.transitionEnd(function () {
58996                                    if (!swiper || swiper.destroyed) return;
58997                                    swiper.transitionEnd();
58998                                });
58999                            }, 0);
59000                        });
59001                    } else if (swiper.velocity) {
59002                        swiper.updateProgress(newPosition);
59003                        swiper.setTransition(momentumDuration);
59004                        swiper.setTranslate(newPosition);
59005                        swiper.transitionStart(true, swiper.swipeDirection);
59006
59007                        if (!swiper.animating) {
59008                            swiper.animating = true;
59009                            $wrapperEl.transitionEnd(function () {
59010                                if (!swiper || swiper.destroyed) return;
59011                                swiper.transitionEnd();
59012                            });
59013                        }
59014                    } else {
59015                        swiper.updateProgress(newPosition);
59016                    }
59017
59018                    swiper.updateActiveIndex();
59019                    swiper.updateSlidesClasses();
59020                } else if (params.freeModeSticky) {
59021                    swiper.slideToClosest();
59022                    return;
59023                }
59024
59025                if (!params.freeModeMomentum || timeDiff >= params.longSwipesMs) {
59026                    swiper.updateProgress();
59027                    swiper.updateActiveIndex();
59028                    swiper.updateSlidesClasses();
59029                }
59030
59031                return;
59032            } // Find current slide
59033
59034
59035            var stopIndex = 0;
59036            var groupSize = swiper.slidesSizesGrid[0];
59037
59038            for (var i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) {
59039                var _increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
59040
59041                if (typeof slidesGrid[i + _increment] !== 'undefined') {
59042                    if (currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + _increment]) {
59043                        stopIndex = i;
59044                        groupSize = slidesGrid[i + _increment] - slidesGrid[i];
59045                    }
59046                } else if (currentPos >= slidesGrid[i]) {
59047                    stopIndex = i;
59048                    groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2];
59049                }
59050            } // Find current slide size
59051
59052
59053            var ratio = (currentPos - slidesGrid[stopIndex]) / groupSize;
59054            var increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
59055
59056            if (timeDiff > params.longSwipesMs) {
59057                // Long touches
59058                if (!params.longSwipes) {
59059                    swiper.slideTo(swiper.activeIndex);
59060                    return;
59061                }
59062
59063                if (swiper.swipeDirection === 'next') {
59064                    if (ratio >= params.longSwipesRatio) swiper.slideTo(stopIndex + increment); else swiper.slideTo(stopIndex);
59065                }
59066
59067                if (swiper.swipeDirection === 'prev') {
59068                    if (ratio > 1 - params.longSwipesRatio) swiper.slideTo(stopIndex + increment); else swiper.slideTo(stopIndex);
59069                }
59070            } else {
59071                // Short swipes
59072                if (!params.shortSwipes) {
59073                    swiper.slideTo(swiper.activeIndex);
59074                    return;
59075                }
59076
59077                var isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl);
59078
59079                if (!isNavButtonTarget) {
59080                    if (swiper.swipeDirection === 'next') {
59081                        swiper.slideTo(stopIndex + increment);
59082                    }
59083
59084                    if (swiper.swipeDirection === 'prev') {
59085                        swiper.slideTo(stopIndex);
59086                    }
59087                } else if (e.target === swiper.navigation.nextEl) {
59088                    swiper.slideTo(stopIndex + increment);
59089                } else {
59090                    swiper.slideTo(stopIndex);
59091                }
59092            }
59093        }
59094    }, {"../../../utils/utils": 98}],
59095    29: [function (require, module, exports) {
59096        "use strict";
59097
59098        exports.__esModule = true;
59099        exports.default = onTouchMove;
59100
59101        var _ssrWindow = require("ssr-window");
59102
59103        var _dom = _interopRequireDefault(require("../../../utils/dom"));
59104
59105        var _utils = require("../../../utils/utils");
59106
59107        function _interopRequireDefault(obj) {
59108            return obj && obj.__esModule ? obj : {default: obj};
59109        }
59110
59111        function onTouchMove(event) {
59112            var document = (0, _ssrWindow.getDocument)();
59113            var swiper = this;
59114            var data = swiper.touchEventsData;
59115            var params = swiper.params,
59116                touches = swiper.touches,
59117                rtl = swiper.rtlTranslate;
59118            var e = event;
59119            if (e.originalEvent) e = e.originalEvent;
59120
59121            if (!data.isTouched) {
59122                if (data.startMoving && data.isScrolling) {
59123                    swiper.emit('touchMoveOpposite', e);
59124                }
59125
59126                return;
59127            }
59128
59129            if (data.isTouchEvent && e.type !== 'touchmove') return;
59130            var targetTouch = e.type === 'touchmove' && e.targetTouches && (e.targetTouches[0] || e.changedTouches[0]);
59131            var pageX = e.type === 'touchmove' ? targetTouch.pageX : e.pageX;
59132            var pageY = e.type === 'touchmove' ? targetTouch.pageY : e.pageY;
59133
59134            if (e.preventedByNestedSwiper) {
59135                touches.startX = pageX;
59136                touches.startY = pageY;
59137                return;
59138            }
59139
59140            if (!swiper.allowTouchMove) {
59141                // isMoved = true;
59142                swiper.allowClick = false;
59143
59144                if (data.isTouched) {
59145                    (0, _utils.extend)(touches, {
59146                        startX: pageX,
59147                        startY: pageY,
59148                        currentX: pageX,
59149                        currentY: pageY
59150                    });
59151                    data.touchStartTime = (0, _utils.now)();
59152                }
59153
59154                return;
59155            }
59156
59157            if (data.isTouchEvent && params.touchReleaseOnEdges && !params.loop) {
59158                if (swiper.isVertical()) {
59159                    // Vertical
59160                    if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) {
59161                        data.isTouched = false;
59162                        data.isMoved = false;
59163                        return;
59164                    }
59165                } else if (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate()) {
59166                    return;
59167                }
59168            }
59169
59170            if (data.isTouchEvent && document.activeElement) {
59171                if (e.target === document.activeElement && (0, _dom.default)(e.target).is(data.formElements)) {
59172                    data.isMoved = true;
59173                    swiper.allowClick = false;
59174                    return;
59175                }
59176            }
59177
59178            if (data.allowTouchCallbacks) {
59179                swiper.emit('touchMove', e);
59180            }
59181
59182            if (e.targetTouches && e.targetTouches.length > 1) return;
59183            touches.currentX = pageX;
59184            touches.currentY = pageY;
59185            var diffX = touches.currentX - touches.startX;
59186            var diffY = touches.currentY - touches.startY;
59187            if (swiper.params.threshold && Math.sqrt(Math.pow(diffX, 2) + Math.pow(diffY, 2)) < swiper.params.threshold) return;
59188
59189            if (typeof data.isScrolling === 'undefined') {
59190                var touchAngle;
59191
59192                if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) {
59193                    data.isScrolling = false;
59194                } else {
59195                    // eslint-disable-next-line
59196                    if (diffX * diffX + diffY * diffY >= 25) {
59197                        touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI;
59198                        data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle;
59199                    }
59200                }
59201            }
59202
59203            if (data.isScrolling) {
59204                swiper.emit('touchMoveOpposite', e);
59205            }
59206
59207            if (typeof data.startMoving === 'undefined') {
59208                if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) {
59209                    data.startMoving = true;
59210                }
59211            }
59212
59213            if (data.isScrolling) {
59214                data.isTouched = false;
vendor: 1,754 bytes, lines 59215-59269
59215                return;
59216            }
59217
59218            if (!data.startMoving) {
59219                return;
59220            }
59221
59222            swiper.allowClick = false;
59223
59224            if (!params.cssMode && e.cancelable) {
59225                e.preventDefault();
59226            }
59227
59228            if (params.touchMoveStopPropagation && !params.nested) {
59229                e.stopPropagation();
59230            }
59231
59232            if (!data.isMoved) {
59233                if (params.loop) {
59234                    swiper.loopFix();
59235                }
59236
59237                data.startTranslate = swiper.getTranslate();
59238                swiper.setTransition(0);
59239
59240                if (swiper.animating) {
59241                    swiper.$wrapperEl.trigger('webkitTransitionEnd transitionend');
59242                }
59243
59244                data.allowMomentumBounce = false; // Grab Cursor
59245
59246                if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
59247                    swiper.setGrabCursor(true);
59248                }
59249
59250                swiper.emit('sliderFirstMove', e);
59251            }
59252
59253            swiper.emit('sliderMove', e);
59254            data.isMoved = true;
59255            var diff = swiper.isHorizontal() ? diffX : diffY;
59256            touches.diff = diff;
59257            diff *= params.touchRatio;
59258            if (rtl) diff = -diff;
59259            swiper.swipeDirection = diff > 0 ? 'prev' : 'next';
59260            data.currentTranslate = diff + data.startTranslate;
59261            var disableParentSwiper = true;
59262            var resistanceRatio = params.resistanceRatio;
59263
59264            if (params.touchReleaseOnEdges) {
59265                resistanceRatio = 0;
59266            }
59267
59268            if (diff > 0 && data.currentTranslate > swiper.minTranslate()) {
59269                disableParentSwiper = false;
59270                if (params.resistance) data.currentTranslate = swiper.minTranslate() - 1 + Math.pow(-swiper.minTranslate() + data.startTranslate + diff, resistanceRatio);
59271            } else if (diff < 0 && data.currentTranslate < swiper.maxTranslate()) {
59272                disableParentSwiper = false;
59273                if (params.resistance) data.currentTranslate = swiper.maxTranslate() + 1 - Math.pow(swiper.maxTranslate() - data.startTranslate - diff, resistanceRatio);
59274            }
59275
59276            if (disableParentSwiper) {
59277                e.preventedByNestedSwiper = true;
59278            } // Directions locks
59279
59280
59281            if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) {
59282                data.currentTranslate = data.startTranslate;
59283            }
59284
59285            if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) {
59286                data.currentTranslate = data.startTranslate;
59287            } // Threshold
59288
59289
59290            if (params.threshold > 0) {
59291                if (Math.abs(diff) > params.threshold || data.allowThresholdMove) {
59292                    if (!data.allowThresholdMove) {
59293                        data.allowThresholdMove = true;
59294                        touches.startX = touches.currentX;
59295                        touches.startY = touches.currentY;
59296                        data.currentTranslate = data.startTranslate;
59297                        touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY;
59298                        return;
59299                    }
59300                } else {
59301                    data.currentTranslate = data.startTranslate;
59302                    return;
59303                }
59304            }
59305
59306            if (!params.followFinger || params.cssMode) return; // Update active index in free mode
59307
59308            if (params.freeMode || params.watchSlidesProgress || params.watchSlidesVisibility) {
59309                swiper.updateActiveIndex();
59310                swiper.updateSlidesClasses();
59311            }
59312
59313            if (params.freeMode) {
59314                // Velocity
59315                if (data.velocities.length === 0) {
59316                    data.velocities.push({
59317                        position: touches[swiper.isHorizontal() ? 'startX' : 'startY'],
59318                        time: data.touchStartTime
59319                    });
59320                }
59321
59322                data.velocities.push({
59323                    position: touches[swiper.isHorizontal() ? 'currentX' : 'currentY'],
59324                    time: (0, _utils.now)()
59325                });
59326            } // Update progress
59327
59328
59329            swiper.updateProgress(data.currentTranslate); // Update translate
59330
59331            swiper.setTranslate(data.currentTranslate);
59332        }
59333    }, {"../../../utils/dom": 94, "../../../utils/utils": 98, "ssr-window": 10}],
59334    30: [function (require, module, exports) {
59335        "use strict";
59336
59337        exports.__esModule = true;
59338        exports.default = onTouchStart;
59339
59340        var _ssrWindow = require("ssr-window");
59341
59342        var _dom = _interopRequireDefault(require("../../../utils/dom"));
59343
59344        var _utils = require("../../../utils/utils");
59345
59346        function _interopRequireDefault(obj) {
59347            return obj && obj.__esModule ? obj : {default: obj};
59348        }
59349
59350        function onTouchStart(event) {
59351            var swiper = this;
59352            var document = (0, _ssrWindow.getDocument)();
59353            var window = (0, _ssrWindow.getWindow)();
59354            var data = swiper.touchEventsData;
59355            var params = swiper.params,
59356                touches = swiper.touches;
59357
59358            if (swiper.animating && params.preventInteractionOnTransition) {
59359                return;
59360            }
59361
59362            var e = event;
59363            if (e.originalEvent) e = e.originalEvent;
59364            var $targetEl = (0, _dom.default)(e.target);
59365
59366            if (params.touchEventsTarget === 'wrapper') {
59367                if (!$targetEl.closest(swiper.wrapperEl).length) return;
59368            }
59369
59370            data.isTouchEvent = e.type === 'touchstart';
59371            if (!data.isTouchEvent && 'which' in e && e.which === 3) return;
59372            if (!data.isTouchEvent && 'button' in e && e.button > 0) return;
59373            if (data.isTouched && data.isMoved) return;
59374
59375            if (params.noSwiping && $targetEl.closest(params.noSwipingSelector ? params.noSwipingSelector : "." + params.noSwipingClass)[0]) {
59376                swiper.allowClick = true;
59377                return;
59378            }
59379
59380            if (params.swipeHandler) {
59381                if (!$targetEl.closest(params.swipeHandler)[0]) return;
59382            }
59383
59384            touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
59385            touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
59386            var startX = touches.currentX;
59387            var startY = touches.currentY; // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore
59388
59389            var edgeSwipeDetection = params.edgeSwipeDetection || params.iOSEdgeSwipeDetection;
59390            var edgeSwipeThreshold = params.edgeSwipeThreshold || params.iOSEdgeSwipeThreshold;
59391
59392            if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.screen.width - edgeSwipeThreshold)) {
59393                return;
59394            }
59395
59396            (0, _utils.extend)(data, {
59397                isTouched: true,
59398                isMoved: false,
59399                allowTouchCallbacks: true,
59400                isScrolling: undefined,
59401                startMoving: undefined
59402            });
59403            touches.startX = startX;
59404            touches.startY = startY;
59405            data.touchStartTime = (0, _utils.now)();
59406            swiper.allowClick = true;
59407            swiper.updateSize();
59408            swiper.swipeDirection = undefined;
59409            if (params.threshold > 0) data.allowThresholdMove = false;
59410
59411            if (e.type !== 'touchstart') {
59412                var preventDefault = true;
59413                if ($targetEl.is(data.formElements)) preventDefault = false;
59414
59415                if (document.activeElement && (0, _dom.default)(document.activeElement).is(data.formElements) && document.activeElement !== $targetEl[0]) {
59416                    document.activeElement.blur();
59417                }
59418
59419                var shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault;
59420
59421                if (params.touchStartForcePreventDefault || shouldPreventDefault) {
59422                    e.preventDefault();
59423                }
59424            }
59425
59426            swiper.emit('touchStart', e);
59427        }
59428    }, {"../../../utils/dom": 94, "../../../utils/utils": 98, "ssr-window": 10}],
59429    31: [function (require, module, exports) {
59430        "use strict";
59431
59432        exports.__esModule = true;
59433        exports.default = void 0;
59434
59435        var _setGrabCursor = _interopRequireDefault(require("./setGrabCursor"));
59436
59437        var _unsetGrabCursor = _interopRequireDefault(require("./unsetGrabCursor"));
59438
59439        function _interopRequireDefault(obj) {
59440            return obj && obj.__esModule ? obj : {default: obj};
59441        }
59442
59443        var _default = {
59444            setGrabCursor: _setGrabCursor.default,
59445            unsetGrabCursor: _unsetGrabCursor.default
59446        };
59447        exports.default = _default;
59448    }, {"./setGrabCursor": 32, "./unsetGrabCursor": 33}],
59449    32: [function (require, module, exports) {
59450        "use strict";
59451
59452        exports.__esModule = true;
59453        exports.default = setGrabCursor;
59454
59455        function setGrabCursor(moving) {
59456            var swiper = this;
59457            if (swiper.support.touch || !swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return;
59458            var el = swiper.el;
59459            el.style.cursor = 'move';
59460            el.style.cursor = moving ? '-webkit-grabbing' : '-webkit-grab';
59461            el.style.cursor = moving ? '-moz-grabbin' : '-moz-grab';
59462            el.style.cursor = moving ? 'grabbing' : 'grab';
59463        }
59464    }, {}],
59465    33: [function (require, module, exports) {
59466        "use strict";
59467
59468        exports.__esModule = true;
59469        exports.default = unsetGrabCursor;
59470
59471        function unsetGrabCursor() {
59472            var swiper = this;
59473
59474            if (swiper.support.touch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) {
59475                return;
59476            }
59477
59478            swiper.el.style.cursor = '';
59479        }
59480    }, {}],
59481    34: [function (require, module, exports) {
59482        "use strict";
59483
59484        exports.__esModule = true;
59485        exports.default = void 0;
59486
59487        var _loadImage = _interopRequireDefault(require("./loadImage"));
59488
59489        var _preloadImages = _interopRequireDefault(require("./preloadImages"));
59490
59491        function _interopRequireDefault(obj) {
59492            return obj && obj.__esModule ? obj : {default: obj};
59493        }
59494
59495        var _default = {
59496            loadImage: _loadImage.default,
59497            preloadImages: _preloadImages.default
59498        };
59499        exports.default = _default;
59500    }, {"./loadImage": 35, "./preloadImages": 36}],
59501    35: [function (require, module, exports) {
59502        "use strict";
59503
59504        exports.__esModule = true;
59505        exports.default = loadImage;
59506
59507        var _ssrWindow = require("ssr-window");
59508
59509        var _dom = _interopRequireDefault(require("../../../utils/dom"));
59510
59511        function _interopRequireDefault(obj) {
59512            return obj && obj.__esModule ? obj : {default: obj};
59513        }
59514
59515        function loadImage(imageEl, src, srcset, sizes, checkForComplete, callback) {
59516            var window = (0, _ssrWindow.getWindow)();
59517            var image;
59518
59519            function onReady() {
59520                if (callback) callback();
59521            }
59522
59523            var isPicture = (0, _dom.default)(imageEl).parent('picture')[0];
59524
59525            if (!isPicture && (!imageEl.complete || !checkForComplete)) {
59526                if (src) {
59527                    image = new window.Image();
59528                    image.onload = onReady;
59529                    image.onerror = onReady;
59530
59531                    if (sizes) {
59532                        image.sizes = sizes;
59533                    }
59534
59535                    if (srcset) {
59536                        image.srcset = srcset;
59537                    }
59538
59539                    if (src) {
59540                        image.src = src;
59541                    }
59542                } else {
59543                    onReady();
59544                }
59545            } else {
59546                // image already loaded...
59547                onReady();
59548            }
59549        }
59550    }, {"../../../utils/dom": 94, "ssr-window": 10}],
59551    36: [function (require, module, exports) {
59552        "use strict";
59553
59554        exports.__esModule = true;
59555        exports.default = preloadImages;
59556
59557        function preloadImages() {
59558            var swiper = this;
59559            swiper.imagesToLoad = swiper.$el.find('img');
59560
59561            function onReady() {
59562                if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper.destroyed) return;
59563                if (swiper.imagesLoaded !== undefined) swiper.imagesLoaded += 1;
59564
59565                if (swiper.imagesLoaded === swiper.imagesToLoad.length) {
59566                    if (swiper.params.updateOnImagesReady) swiper.update();
59567                    swiper.emit('imagesReady');
59568                }
59569            }
59570
59571            for (var i = 0; i < swiper.imagesToLoad.length; i += 1) {
59572                var imageEl = swiper.imagesToLoad[i];
59573                swiper.loadImage(imageEl, imageEl.currentSrc || imageEl.getAttribute('src'), imageEl.srcset || imageEl.getAttribute('srcset'), imageEl.sizes || imageEl.getAttribute('sizes'), true, onReady);
59574            }
59575        }
59576    }, {}],
59577    37: [function (require, module, exports) {
59578        "use strict";
59579
59580        exports.__esModule = true;
59581        exports.default = void 0;
59582
59583        var _loopCreate = _interopRequireDefault(require("./loopCreate"));
59584
59585        var _loopFix = _interopRequireDefault(require("./loopFix"));
59586
59587        var _loopDestroy = _interopRequireDefault(require("./loopDestroy"));
59588
59589        function _interopRequireDefault(obj) {
59590            return obj && obj.__esModule ? obj : {default: obj};
59591        }
59592
59593        var _default = {
59594            loopCreate: _loopCreate.default,
59595            loopFix: _loopFix.default,
59596            loopDestroy: _loopDestroy.default
59597        };
59598        exports.default = _default;
59599    }, {"./loopCreate": 38, "./loopDestroy": 39, "./loopFix": 40}],
59600    38: [function (require, module, exports) {
59601        "use strict";
59602
59603        exports.__esModule = true;
59604        exports.default = loopCreate;
59605
59606        var _ssrWindow = require("ssr-window");
59607
59608        var _dom = _interopRequireDefault(require("../../../utils/dom"));
59609
59610        function _interopRequireDefault(obj) {
59611            return obj && obj.__esModule ? obj : {default: obj};
59612        }
59613
59614        function loopCreate() {
59615            var swiper = this;
59616            var document = (0, _ssrWindow.getDocument)();
59617            var params = swiper.params,
59618                $wrapperEl = swiper.$wrapperEl; // Remove duplicated slides
59619
59620            $wrapperEl.children("." + params.slideClass + "." + params.slideDuplicateClass).remove();
59621            var slides = $wrapperEl.children("." + params.slideClass);
59622
59623            if (params.loopFillGroupWithBlank) {
59624                var blankSlidesNum = params.slidesPerGroup - slides.length % params.slidesPerGroup;
59625
59626                if (blankSlidesNum !== params.slidesPerGroup) {
59627                    for (var i = 0; i < blankSlidesNum; i += 1) {
59628                        var blankNode = (0, _dom.default)(document.createElement('div')).addClass(params.slideClass + " " + params.slideBlankClass);
59629                        $wrapperEl.append(blankNode);
59630                    }
59631
59632                    slides = $wrapperEl.children("." + params.slideClass);
59633                }
59634            }
59635
59636            if (params.slidesPerView === 'auto' && !params.loopedSlides) params.loopedSlides = slides.length;
59637            swiper.loopedSlides = Math.ceil(parseFloat(params.loopedSlides || params.slidesPerView, 10));
59638            swiper.loopedSlides += params.loopAdditionalSlides;
59639
59640            if (swiper.loopedSlides > slides.length) {
59641                swiper.loopedSlides = slides.length;
59642            }
59643
59644            var prependSlides = [];
59645            var appendSlides = [];
59646            slides.each(function (el, index) {
59647                var slide = (0, _dom.default)(el);
59648
59649                if (index < swiper.loopedSlides) {
59650                    appendSlides.push(el);
59651                }
59652
59653                if (index < slides.length && index >= slides.length - swiper.loopedSlides) {
59654                    prependSlides.push(el);
59655                }
59656
59657                slide.attr('data-swiper-slide-index', index);
59658            });
59659
59660            for (var _i = 0; _i < appendSlides.length; _i += 1) {
59661                $wrapperEl.append((0, _dom.default)(appendSlides[_i].cloneNode(true)).addClass(params.slideDuplicateClass));
59662            }
59663
59664            for (var _i2 = prependSlides.length - 1; _i2 >= 0; _i2 -= 1) {
59665                $wrapperEl.prepend((0, _dom.default)(prependSlides[_i2].cloneNode(true)).addClass(params.slideDuplicateClass));
59666            }
59667        }
59668    }, {"../../../utils/dom": 94, "ssr-window": 10}],
59669    39: [function (require, module, exports) {
59670        "use strict";
59671
59672        exports.__esModule = true;
59673        exports.default = loopDestroy;
59674
59675        function loopDestroy() {
59676            var swiper = this;
59677            var $wrapperEl = swiper.$wrapperEl,
59678                params = swiper.params,
59679                slides = swiper.slides;
59680            $wrapperEl.children("." + params.slideClass + "." + params.slideDuplicateClass + ",." + params.slideClass + "." + params.slideBlankClass).remove();
59681            slides.removeAttr('data-swiper-slide-index');
59682        }
59683    }, {}],
59684    40: [function (require, module, exports) {
59685        "use strict";
59686
59687        exports.__esModule = true;
59688        exports.default = loopFix;
59689
59690        function loopFix() {
59691            var swiper = this;
59692            swiper.emit('beforeLoopFix');
59693            var activeIndex = swiper.activeIndex,
59694                slides = swiper.slides,
59695                loopedSlides = swiper.loopedSlides,
59696                allowSlidePrev = swiper.allowSlidePrev,
59697                allowSlideNext = swiper.allowSlideNext,
59698                snapGrid = swiper.snapGrid,
59699                rtl = swiper.rtlTranslate;
59700            var newIndex;
59701            swiper.allowSlidePrev = true;
59702            swiper.allowSlideNext = true;
59703            var snapTranslate = -snapGrid[activeIndex];
59704            var diff = snapTranslate - swiper.getTranslate(); // Fix For Negative Oversliding
59705
59706            if (activeIndex < loopedSlides) {
59707                newIndex = slides.length - loopedSlides * 3 + activeIndex;
59708                newIndex += loopedSlides;
59709                var slideChanged = swiper.slideTo(newIndex, 0, false, true);
59710
59711                if (slideChanged && diff !== 0) {
59712                    swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff);
59713                }
59714            } else if (activeIndex >= slides.length - loopedSlides) {
59715                // Fix For Positive Oversliding
59716                newIndex = -slides.length + activeIndex + loopedSlides;
59717                newIndex += loopedSlides;
59718
59719                var _slideChanged = swiper.slideTo(newIndex, 0, false, true);
59720
59721                if (_slideChanged && diff !== 0) {
59722                    swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff);
59723                }
59724            }
59725
59726            swiper.allowSlidePrev = allowSlidePrev;
59727            swiper.allowSlideNext = allowSlideNext;
59728            swiper.emit('loopFix');
59729        }
59730    }, {}],
59731    41: [function (require, module, exports) {
59732        "use strict";
59733
59734        exports.__esModule = true;
59735        exports.default = addSlide;
59736
59737        function addSlide(index, slides) {
59738            var swiper = this;
59739            var $wrapperEl = swiper.$wrapperEl,
59740                params = swiper.params,
59741                activeIndex = swiper.activeIndex;
59742            var activeIndexBuffer = activeIndex;
59743
59744            if (params.loop) {
59745                activeIndexBuffer -= swiper.loopedSlides;
59746                swiper.loopDestroy();
59747                swiper.slides = $wrapperEl.children("." + params.slideClass);
59748            }
59749
59750            var baseLength = swiper.slides.length;
59751
59752            if (index <= 0) {
59753                swiper.prependSlide(slides);
59754                return;
59755            }
59756
59757            if (index >= baseLength) {
59758                swiper.appendSlide(slides);
59759                return;
59760            }
59761
59762            var newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + 1 : activeIndexBuffer;
59763            var slidesBuffer = [];
59764
59765            for (var i = baseLength - 1; i >= index; i -= 1) {
59766                var currentSlide = swiper.slides.eq(i);
59767                currentSlide.remove();
59768                slidesBuffer.unshift(currentSlide);
59769            }
59770
59771            if (typeof slides === 'object' && 'length' in slides) {
59772                for (var _i = 0; _i < slides.length; _i += 1) {
59773                    if (slides[_i]) $wrapperEl.append(slides[_i]);
59774                }
59775
59776                newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + slides.length : activeIndexBuffer;
59777            } else {
59778                $wrapperEl.append(slides);
59779            }
59780
59781            for (var _i2 = 0; _i2 < slidesBuffer.length; _i2 += 1) {
59782                $wrapperEl.append(slidesBuffer[_i2]);
59783            }
59784
59785            if (params.loop) {
59786                swiper.loopCreate();
59787            }
59788
59789            if (!(params.observer && swiper.support.observer)) {
59790                swiper.update();
59791            }
59792
59793            if (params.loop) {
59794                swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false);
59795            } else {
59796                swiper.slideTo(newActiveIndex, 0, false);
59797            }
59798        }
59799    }, {}],
59800    42: [function (require, module, exports) {
59801        "use strict";
59802
59803        exports.__esModule = true;
59804        exports.default = appendSlide;
59805
59806        function appendSlide(slides) {
59807            var swiper = this;
59808            var $wrapperEl = swiper.$wrapperEl,
59809                params = swiper.params;
59810
59811            if (params.loop) {
59812                swiper.loopDestroy();
59813            }
59814
59815            if (typeof slides === 'object' && 'length' in slides) {
59816                for (var i = 0; i < slides.length; i += 1) {
59817                    if (slides[i]) $wrapperEl.append(slides[i]);
59818                }
59819            } else {
59820                $wrapperEl.append(slides);
59821            }
59822
59823            if (params.loop) {
59824                swiper.loopCreate();
59825            }
59826
59827            if (!(params.observer && swiper.support.observer)) {
59828                swiper.update();
59829            }
59830        }
59831    }, {}],
59832    43: [function (require, module, exports) {
59833        "use strict";
59834
59835        exports.__esModule = true;
59836        exports.default = void 0;
59837
59838        var _appendSlide = _interopRequireDefault(require("./appendSlide"));
59839
59840        var _prependSlide = _interopRequireDefault(require("./prependSlide"));
59841
59842        var _addSlide = _interopRequireDefault(require("./addSlide"));
59843
59844        var _removeSlide = _interopRequireDefault(require("./removeSlide"));
59845
59846        var _removeAllSlides = _interopRequireDefault(require("./removeAllSlides"));
59847
59848        function _interopRequireDefault(obj) {
59849            return obj && obj.__esModule ? obj : {default: obj};
59850        }
59851
59852        var _default = {
59853            appendSlide: _appendSlide.default,
59854            prependSlide: _prependSlide.default,
59855            addSlide: _addSlide.default,
59856            removeSlide: _removeSlide.default,
59857            removeAllSlides: _removeAllSlides.default
59858        };
59859        exports.default = _default;
59860    }, {"./addSlide": 41, "./appendSlide": 42, "./prependSlide": 44, "./removeAllSlides": 45, "./removeSlide": 46}],
59861    44: [function (require, module, exports) {
59862        "use strict";
59863
59864        exports.__esModule = true;
59865        exports.default = prependSlide;
59866
59867        function prependSlide(slides) {
59868            var swiper = this;
59869            var params = swiper.params,
59870                $wrapperEl = swiper.$wrapperEl,
59871                activeIndex = swiper.activeIndex;
59872
59873            if (params.loop) {
59874                swiper.loopDestroy();
59875            }
59876
59877            var newActiveIndex = activeIndex + 1;
59878
59879            if (typeof slides === 'object' && 'length' in slides) {
59880                for (var i = 0; i < slides.length; i += 1) {
59881                    if (slides[i]) $wrapperEl.prepend(slides[i]);
59882                }
59883
59884                newActiveIndex = activeIndex + slides.length;
59885            } else {
59886                $wrapperEl.prepend(slides);
59887            }
59888
59889            if (params.loop) {
59890                swiper.loopCreate();
59891            }
59892
59893            if (!(params.observer && swiper.support.observer)) {
59894                swiper.update();
59895            }
59896
59897            swiper.slideTo(newActiveIndex, 0, false);
59898        }
59899    }, {}],
59900    45: [function (require, module, exports) {
59901        "use strict";
59902
59903        exports.__esModule = true;
59904        exports.default = removeAllSlides;
59905
59906        function removeAllSlides() {
59907            var swiper = this;
59908            var slidesIndexes = [];
59909
59910            for (var i = 0; i < swiper.slides.length; i += 1) {
59911                slidesIndexes.push(i);
59912            }
59913
59914            swiper.removeSlide(slidesIndexes);
59915        }
59916    }, {}],
59917    46: [function (require, module, exports) {
59918        "use strict";
59919
59920        exports.__esModule = true;
59921        exports.default = removeSlide;
59922
59923        function removeSlide(slidesIndexes) {
59924            var swiper = this;
59925            var params = swiper.params,
59926                $wrapperEl = swiper.$wrapperEl,
59927                activeIndex = swiper.activeIndex;
59928            var activeIndexBuffer = activeIndex;
59929
59930            if (params.loop) {
59931                activeIndexBuffer -= swiper.loopedSlides;
59932                swiper.loopDestroy();
59933                swiper.slides = $wrapperEl.children("." + params.slideClass);
59934            }
59935
59936            var newActiveIndex = activeIndexBuffer;
59937            var indexToRemove;
59938
59939            if (typeof slidesIndexes === 'object' && 'length' in slidesIndexes) {
59940                for (var i = 0; i < slidesIndexes.length; i += 1) {
59941                    indexToRemove = slidesIndexes[i];
59942                    if (swiper.slides[indexToRemove]) swiper.slides.eq(indexToRemove).remove();
59943                    if (indexToRemove < newActiveIndex) newActiveIndex -= 1;
59944                }
59945
59946                newActiveIndex = Math.max(newActiveIndex, 0);
59947            } else {
59948                indexToRemove = slidesIndexes;
59949                if (swiper.slides[indexToRemove]) swiper.slides.eq(indexToRemove).remove();
59950                if (indexToRemove < newActiveIndex) newActiveIndex -= 1;
59951                newActiveIndex = Math.max(newActiveIndex, 0);
59952            }
59953
59954            if (params.loop) {
59955                swiper.loopCreate();
59956            }
59957
59958            if (!(params.observer && swiper.support.observer)) {
59959                swiper.update();
59960            }
59961
59962            if (params.loop) {
59963                swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false);
59964            } else {
59965                swiper.slideTo(newActiveIndex, 0, false);
59966            }
59967        }
59968    }, {}],
59969    47: [function (require, module, exports) {
59970        "use strict";
59971
59972        exports.__esModule = true;
59973        exports.default = void 0;
59974
59975        var _utils = require("../../utils/utils");
59976
59977        var _default = {
59978            useParams: function useParams(instanceParams) {
59979                var instance = this;
59980                if (!instance.modules) return;
59981                Object.keys(instance.modules).forEach(function (moduleName) {
59982                    var module = instance.modules[moduleName]; // Extend params
59983
59984                    if (module.params) {
59985                        (0, _utils.extend)(instanceParams, module.params);
59986                    }
59987                });
59988            },
59989            useModules: function useModules(modulesParams) {
59990                if (modulesParams === void 0) {
59991                    modulesParams = {};
59992                }
59993
59994                var instance = this;
59995                if (!instance.modules) return;
59996                Object.keys(instance.modules).forEach(function (moduleName) {
59997                    var module = instance.modules[moduleName];
59998                    var moduleParams = modulesParams[moduleName] || {}; // Add event listeners
59999
60000                    if (module.on && instance.on) {
60001                        Object.keys(module.on).forEach(function (moduleEventName) {
60002                            instance.on(moduleEventName, module.on[moduleEventName]);
60003                        });
60004                    } // Module create callback
60005
60006
60007                    if (module.create) {
60008                        module.create.bind(instance)(moduleParams);
60009                    }
60010                });
60011            }
60012        };
60013        exports.default = _default;
60014    }, {"../../utils/utils": 98}],
60015    48: [function (require, module, exports) {
60016        "use strict";
60017
60018        exports.__esModule = true;
60019        exports.default = void 0;
60020
60021        var _slideTo = _interopRequireDefault(require("./slideTo"));
60022
60023        var _slideToLoop = _interopRequireDefault(require("./slideToLoop"));
60024
60025        var _slideNext = _interopRequireDefault(require("./slideNext"));
60026
60027        var _slidePrev = _interopRequireDefault(require("./slidePrev"));
60028
60029        var _slideReset = _interopRequireDefault(require("./slideReset"));
60030
60031        var _slideToClosest = _interopRequireDefault(require("./slideToClosest"));
60032
60033        var _slideToClickedSlide = _interopRequireDefault(require("./slideToClickedSlide"));
60034
60035        function _interopRequireDefault(obj) {
60036            return obj && obj.__esModule ? obj : {default: obj};
60037        }
60038
60039        var _default = {
60040            slideTo: _slideTo.default,
60041            slideToLoop: _slideToLoop.default,
60042            slideNext: _slideNext.default,
60043            slidePrev: _slidePrev.default,
60044            slideReset: _slideReset.default,
60045            slideToClosest: _slideToClosest.default,
60046            slideToClickedSlide: _slideToClickedSlide.default
60047        };
60048        exports.default = _default;
60049    }, {
60050        "./slideNext": 49,
60051        "./slidePrev": 50,
60052        "./slideReset": 51,
60053        "./slideTo": 52,
60054        "./slideToClickedSlide": 53,
60055        "./slideToClosest": 54,
60056        "./slideToLoop": 55
60057    }],
60058    49: [function (require, module, exports) {
60059        "use strict";
60060
60061        exports.__esModule = true;
60062        exports.default = slideNext;
60063
60064        /* eslint no-unused-vars: "off" */
60065        function slideNext(speed, runCallbacks, internal) {
60066            if (speed === void 0) {
60067                speed = this.params.speed;
60068            }
60069
60070            if (runCallbacks === void 0) {
60071                runCallbacks = true;
60072            }
60073
60074            var swiper = this;
60075            var params = swiper.params,
60076                animating = swiper.animating;
60077            var increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup;
60078
60079            if (params.loop) {
60080                if (animating && params.loopPreventsSlide) return false;
60081                swiper.loopFix(); // eslint-disable-next-line
60082
60083                swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
60084            }
60085
60086            return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);
60087        }
60088    }, {}],
60089    50: [function (require, module, exports) {
60090        "use strict";
60091
60092        exports.__esModule = true;
60093        exports.default = slidePrev;
60094
60095        /* eslint no-unused-vars: "off" */
60096        function slidePrev(speed, runCallbacks, internal) {
60097            if (speed === void 0) {
60098                speed = this.params.speed;
60099            }
60100
60101            if (runCallbacks === void 0) {
60102                runCallbacks = true;
60103            }
60104
60105            var swiper = this;
60106            var params = swiper.params,
60107                animating = swiper.animating,
60108                snapGrid = swiper.snapGrid,
60109                slidesGrid = swiper.slidesGrid,
60110                rtlTranslate = swiper.rtlTranslate;
60111
60112            if (params.loop) {
60113                if (animating && params.loopPreventsSlide) return false;
60114                swiper.loopFix(); // eslint-disable-next-line
60115
60116                swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
60117            }
60118
60119            var translate = rtlTranslate ? swiper.translate : -swiper.translate;
60120
60121            function normalize(val) {
60122                if (val < 0) return -Math.floor(Math.abs(val));
60123                return Math.floor(val);
60124            }
60125
60126            var normalizedTranslate = normalize(translate);
60127            var normalizedSnapGrid = snapGrid.map(function (val) {
60128                return normalize(val);
60129            });
60130            var currentSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate)];
60131            var prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1];
60132
60133            if (typeof prevSnap === 'undefined' && params.cssMode) {
60134                snapGrid.forEach(function (snap) {
60135                    if (!prevSnap && normalizedTranslate >= snap) prevSnap = snap;
60136                });
60137            }
60138
60139            var prevIndex;
60140
60141            if (typeof prevSnap !== 'undefined') {
60142                prevIndex = slidesGrid.indexOf(prevSnap);
60143                if (prevIndex < 0) prevIndex = swiper.activeIndex - 1;
60144            }
60145
60146            return swiper.slideTo(prevIndex, speed, runCallbacks, internal);
60147        }
60148    }, {}],
60149    51: [function (require, module, exports) {
60150        "use strict";
60151
60152        exports.__esModule = true;
60153        exports.default = slideReset;
60154
60155        /* eslint no-unused-vars: "off" */
60156        function slideReset(speed, runCallbacks, internal) {
60157            if (speed === void 0) {
60158                speed = this.params.speed;
60159            }
60160
60161            if (runCallbacks === void 0) {
60162                runCallbacks = true;
60163            }
60164
60165            var swiper = this;
60166            return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal);
60167        }
60168    }, {}],
60169    52: [function (require, module, exports) {
60170        "use strict";
60171
60172        exports.__esModule = true;
60173        exports.default = slideTo;
60174
60175        function slideTo(index, speed, runCallbacks, internal) {
60176            if (index === void 0) {
60177                index = 0;
60178            }
60179
60180            if (speed === void 0) {
60181                speed = this.params.speed;
60182            }
60183
60184            if (runCallbacks === void 0) {
60185                runCallbacks = true;
60186            }
60187
60188            var swiper = this;
60189            var slideIndex = index;
60190            if (slideIndex < 0) slideIndex = 0;
60191            var params = swiper.params,
60192                snapGrid = swiper.snapGrid,
60193                slidesGrid = swiper.slidesGrid,
60194                previousIndex = swiper.previousIndex,
60195                activeIndex = swiper.activeIndex,
60196                rtl = swiper.rtlTranslate,
60197                wrapperEl = swiper.wrapperEl;
60198
60199            if (swiper.animating && params.preventInteractionOnTransition) {
60200                return false;
60201            }
60202
60203            var skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex);
60204            var snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup);
60205            if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
60206
60207            if ((activeIndex || params.initialSlide || 0) === (previousIndex || 0) && runCallbacks) {
60208                swiper.emit('beforeSlideChangeStart');
60209            }
60210
60211            var translate = -snapGrid[snapIndex]; // Update progress
60212
60213            swiper.updateProgress(translate); // Normalize slideIndex
60214
60215            if (params.normalizeSlideIndex) {
60216                for (var i = 0; i < slidesGrid.length; i += 1) {
60217                    if (-Math.floor(translate * 100) >= Math.floor(slidesGrid[i] * 100)) {
60218                        slideIndex = i;
60219                    }
60220                }
60221            } // Directions locks
60222
60223
60224            if (swiper.initialized && slideIndex !== activeIndex) {
60225                if (!swiper.allowSlideNext && translate < swiper.translate && translate < swiper.minTranslate()) {
60226                    return false;
60227                }
60228
60229                if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) {
60230                    if ((activeIndex || 0) !== slideIndex) return false;
60231                }
60232            }
60233
60234            var direction;
60235            if (slideIndex > activeIndex) direction = 'next'; else if (slideIndex < activeIndex) direction = 'prev'; else direction = 'reset'; // Update Index
60236
60237            if (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate) {
60238                swiper.updateActiveIndex(slideIndex); // Update Height
60239
60240                if (params.autoHeight) {
60241                    swiper.updateAutoHeight();
60242                }
60243
60244                swiper.updateSlidesClasses();
60245
60246                if (params.effect !== 'slide') {
60247                    swiper.setTranslate(translate);
60248                }
60249
60250                if (direction !== 'reset') {
60251                    swiper.transitionStart(runCallbacks, direction);
60252                    swiper.transitionEnd(runCallbacks, direction);
60253                }
60254
60255                return false;
60256            }
60257
60258            if (params.cssMode) {
60259                var isH = swiper.isHorizontal();
60260                var t = -translate;
60261
60262                if (rtl) {
60263                    t = wrapperEl.scrollWidth - wrapperEl.offsetWidth - t;
60264                }
60265
60266                if (speed === 0) {
60267                    wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;
60268                } else {
60269                    // eslint-disable-next-line
60270                    if (wrapperEl.scrollTo) {
60271                        var _wrapperEl$scrollTo;
60272
60273                        wrapperEl.scrollTo((_wrapperEl$scrollTo = {}, _wrapperEl$scrollTo[isH ? 'left' : 'top'] = t, _wrapperEl$scrollTo.behavior = 'smooth', _wrapperEl$scrollTo));
60274                    } else {
60275                        wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;
60276                    }
60277                }
60278
60279                return true;
60280            }
60281
60282            if (speed === 0) {
60283                swiper.setTransition(0);
60284                swiper.setTranslate(translate);
60285                swiper.updateActiveIndex(slideIndex);
60286                swiper.updateSlidesClasses();
60287                swiper.emit('beforeTransitionStart', speed, internal);
60288                swiper.transitionStart(runCallbacks, direction);
60289                swiper.transitionEnd(runCallbacks, direction);
60290            } else {
60291                swiper.setTransition(speed);
60292                swiper.setTranslate(translate);
60293                swiper.updateActiveIndex(slideIndex);
60294                swiper.updateSlidesClasses();
60295                swiper.emit('beforeTransitionStart', speed, internal);
60296                swiper.transitionStart(runCallbacks, direction);
60297
60298                if (!swiper.animating) {
60299                    swiper.animating = true;
60300
60301                    if (!swiper.onSlideToWrapperTransitionEnd) {
60302                        swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) {
60303                            if (!swiper || swiper.destroyed) return;
60304                            if (e.target !== this) return;
60305                            swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);
60306                            swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd);
60307                            swiper.onSlideToWrapperTransitionEnd = null;
60308                            delete swiper.onSlideToWrapperTransitionEnd;
60309                            swiper.transitionEnd(runCallbacks, direction);
60310                        };
60311                    }
60312
60313                    swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);
60314                    swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd);
60315                }
60316            }
60317
60318            return true;
60319        }
60320    }, {}],
60321    53: [function (require, module, exports) {
60322        "use strict";
60323
60324        exports.__esModule = true;
60325        exports.default = slideToClickedSlide;
60326
60327        var _dom = _interopRequireDefault(require("../../../utils/dom"));
60328
60329        var _utils = require("../../../utils/utils");
60330
60331        function _interopRequireDefault(obj) {
60332            return obj && obj.__esModule ? obj : {default: obj};
60333        }
60334
60335        function slideToClickedSlide() {
60336            var swiper = this;
60337            var params = swiper.params,
60338                $wrapperEl = swiper.$wrapperEl;
60339            var slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView;
60340            var slideToIndex = swiper.clickedIndex;
60341            var realIndex;
60342
60343            if (params.loop) {
60344                if (swiper.animating) return;
60345                realIndex = parseInt((0, _dom.default)(swiper.clickedSlide).attr('data-swiper-slide-index'), 10);
60346
60347                if (params.centeredSlides) {
60348                    if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) {
60349                        swiper.loopFix();
60350                        slideToIndex = $wrapperEl.children("." + params.slideClass + "[data-swiper-slide-index=\"" + realIndex + "\"]:not(." + params.slideDuplicateClass + ")").eq(0).index();
60351                        (0, _utils.nextTick)(function () {
60352                            swiper.slideTo(slideToIndex);
60353                        });
60354                    } else {
60355                        swiper.slideTo(slideToIndex);
60356                    }
60357                } else if (slideToIndex > swiper.slides.length - slidesPerView) {
60358                    swiper.loopFix();
60359                    slideToIndex = $wrapperEl.children("." + params.slideClass + "[data-swiper-slide-index=\"" + realIndex + "\"]:not(." + params.slideDuplicateClass + ")").eq(0).index();
60360                    (0, _utils.nextTick)(function () {
60361                        swiper.slideTo(slideToIndex);
60362                    });
60363                } else {
60364                    swiper.slideTo(slideToIndex);
60365                }
60366            } else {
60367                swiper.slideTo(slideToIndex);
60368            }
60369        }
60370    }, {"../../../utils/dom": 94, "../../../utils/utils": 98}],
60371    54: [function (require, module, exports) {
60372        "use strict";
60373
60374        exports.__esModule = true;
60375        exports.default = slideToClosest;
60376
60377        /* eslint no-unused-vars: "off" */
60378        function slideToClosest(speed, runCallbacks, internal, threshold) {
60379            if (speed === void 0) {
60380                speed = this.params.speed;
60381            }
60382
60383            if (runCallbacks === void 0) {
60384                runCallbacks = true;
60385            }
60386
60387            if (threshold === void 0) {
60388                threshold = 0.5;
60389            }
60390
60391            var swiper = this;
60392            var index = swiper.activeIndex;
60393            var skip = Math.min(swiper.params.slidesPerGroupSkip, index);
60394            var snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup);
60395            var translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
60396
60397            if (translate >= swiper.snapGrid[snapIndex]) {
60398                // The current translate is on or after the current snap index, so the choice
60399                // is between the current index and the one after it.
60400                var currentSnap = swiper.snapGrid[snapIndex];
60401                var nextSnap = swiper.snapGrid[snapIndex + 1];
60402
60403                if (translate - currentSnap > (nextSnap - currentSnap) * threshold) {
60404                    index += swiper.params.slidesPerGroup;
60405                }
60406            } else {
60407                // The current translate is before the current snap index, so the choice
60408                // is between the current index and the one before it.
60409                var prevSnap = swiper.snapGrid[snapIndex - 1];
60410                var _currentSnap = swiper.snapGrid[snapIndex];
60411
60412                if (translate - prevSnap <= (_currentSnap - prevSnap) * threshold) {
60413                    index -= swiper.params.slidesPerGroup;
60414                }
60415            }
60416
60417            index = Math.max(index, 0);
60418            index = Math.min(index, swiper.slidesGrid.length - 1);
60419            return swiper.slideTo(index, speed, runCallbacks, internal);
60420        }
60421    }, {}],
60422    55: [function (require, module, exports) {
60423        "use strict";
60424
60425        exports.__esModule = true;
60426        exports.default = slideToLoop;
60427
60428        function slideToLoop(index, speed, runCallbacks, internal) {
60429            if (index === void 0) {
60430                index = 0;
60431            }
60432
60433            if (speed === void 0) {
60434                speed = this.params.speed;
60435            }
60436
60437            if (runCallbacks === void 0) {
60438                runCallbacks = true;
60439            }
60440
60441            var swiper = this;
60442            var newIndex = index;
60443
60444            if (swiper.params.loop) {
60445                newIndex += swiper.loopedSlides;
60446            }
60447
60448            return swiper.slideTo(newIndex, speed, runCallbacks, internal);
60449        }
60450    }, {}],
60451    56: [function (require, module, exports) {
60452        "use strict";
60453
60454        exports.__esModule = true;
60455        exports.default = void 0;
60456
60457        var _setTransition = _interopRequireDefault(require("./setTransition"));
60458
60459        var _transitionStart = _interopRequireDefault(require("./transitionStart"));
60460
60461        var _transitionEnd = _interopRequireDefault(require("./transitionEnd"));
60462
60463        function _interopRequireDefault(obj) {
60464            return obj && obj.__esModule ? obj : {default: obj};
60465        }
60466
60467        var _default = {
60468            setTransition: _setTransition.default,
60469            transitionStart: _transitionStart.default,
60470            transitionEnd: _transitionEnd.default
60471        };
60472        exports.default = _default;
60473    }, {"./setTransition": 57, "./transitionEnd": 58, "./transitionStart": 59}],
60474    57: [function (require, module, exports) {
60475        "use strict";
60476
60477        exports.__esModule = true;
60478        exports.default = setTransition;
60479
60480        function setTransition(duration, byController) {
60481            var swiper = this;
60482
60483            if (!swiper.params.cssMode) {
60484                swiper.$wrapperEl.transition(duration);
60485            }
60486
60487            swiper.emit('setTransition', duration, byController);
60488        }
60489    }, {}],
60490    58: [function (require, module, exports) {
60491        "use strict";
60492
60493        exports.__esModule = true;
60494        exports.default = transitionEnd;
60495
60496        function transitionEnd(runCallbacks, direction) {
60497            if (runCallbacks === void 0) {
60498                runCallbacks = true;
60499            }
60500
60501            var swiper = this;
60502            var activeIndex = swiper.activeIndex,
60503                previousIndex = swiper.previousIndex,
60504                params = swiper.params;
60505            swiper.animating = false;
60506            if (params.cssMode) return;
60507            swiper.setTransition(0);
60508            var dir = direction;
60509
60510            if (!dir) {
60511                if (activeIndex > previousIndex) dir = 'next'; else if (activeIndex < previousIndex) dir = 'prev'; else dir = 'reset';
60512            }
60513
60514            swiper.emit('transitionEnd');
60515
60516            if (runCallbacks && activeIndex !== previousIndex) {
60517                if (dir === 'reset') {
60518                    swiper.emit('slideResetTransitionEnd');
60519                    return;
60520                }
60521
60522                swiper.emit('slideChangeTransitionEnd');
60523
60524                if (dir === 'next') {
60525                    swiper.emit('slideNextTransitionEnd');
60526                } else {
60527                    swiper.emit('slidePrevTransitionEnd');
60528                }
60529            }
60530        }
60531    }, {}],
60532    59: [function (require, module, exports) {
60533        "use strict";
60534
60535        exports.__esModule = true;
60536        exports.default = transitionStart;
60537
60538        function transitionStart(runCallbacks, direction) {
60539            if (runCallbacks === void 0) {
60540                runCallbacks = true;
60541            }
60542
60543            var swiper = this;
60544            var activeIndex = swiper.activeIndex,
60545                params = swiper.params,
60546                previousIndex = swiper.previousIndex;
60547            if (params.cssMode) return;
60548
60549            if (params.autoHeight) {
60550                swiper.updateAutoHeight();
60551            }
60552
60553            var dir = direction;
60554
60555            if (!dir) {
60556                if (activeIndex > previousIndex) dir = 'next'; else if (activeIndex < previousIndex) dir = 'prev'; else dir = 'reset';
60557            }
60558
60559            swiper.emit('transitionStart');
60560
60561            if (runCallbacks && activeIndex !== previousIndex) {
60562                if (dir === 'reset') {
60563                    swiper.emit('slideResetTransitionStart');
60564                    return;
60565                }
60566
60567                swiper.emit('slideChangeTransitionStart');
60568
60569                if (dir === 'next') {
60570                    swiper.emit('slideNextTransitionStart');
60571                } else {
60572                    swiper.emit('slidePrevTransitionStart');
60573                }
60574            }
60575        }
60576    }, {}],
60577    60: [function (require, module, exports) {
60578        "use strict";
60579
60580        exports.__esModule = true;
60581        exports.default = getSwiperTranslate;
60582
60583        var _utils = require("../../../utils/utils");
60584
60585        function getSwiperTranslate(axis) {
60586            if (axis === void 0) {
60587                axis = this.isHorizontal() ? 'x' : 'y';
60588            }
60589
60590            var swiper = this;
60591            var params = swiper.params,
60592                rtl = swiper.rtlTranslate,
60593                translate = swiper.translate,
60594                $wrapperEl = swiper.$wrapperEl;
60595
60596            if (params.virtualTranslate) {
60597                return rtl ? -translate : translate;
60598            }
60599
60600            if (params.cssMode) {
60601                return translate;
60602            }
60603
60604            var currentTranslate = (0, _utils.getTranslate)($wrapperEl[0], axis);
60605            if (rtl) currentTranslate = -currentTranslate;
60606            return currentTranslate || 0;
60607        }
60608    }, {"../../../utils/utils": 98}],
60609    61: [function (require, module, exports) {
60610        "use strict";
60611
60612        exports.__esModule = true;
60613        exports.default = void 0;
60614
60615        var _getTranslate = _interopRequireDefault(require("./getTranslate"));
60616
60617        var _setTranslate = _interopRequireDefault(require("./setTranslate"));
60618
60619        var _minTranslate = _interopRequireDefault(require("./minTranslate"));
60620
60621        var _maxTranslate = _interopRequireDefault(require("./maxTranslate"));
60622
60623        var _translateTo = _interopRequireDefault(require("./translateTo"));
60624
60625        function _interopRequireDefault(obj) {
60626            return obj && obj.__esModule ? obj : {default: obj};
60627        }
60628
60629        var _default = {
60630            getTranslate: _getTranslate.default,
60631            setTranslate: _setTranslate.default,
60632            minTranslate: _minTranslate.default,
60633            maxTranslate: _maxTranslate.default,
60634            translateTo: _translateTo.default
60635        };
60636        exports.default = _default;
60637    }, {"./getTranslate": 60, "./maxTranslate": 62, "./minTranslate": 63, "./setTranslate": 64, "./translateTo": 65}],
60638    62: [function (require, module, exports) {
60639        "use strict";
60640
60641        exports.__esModule = true;
60642        exports.default = maxTranslate;
60643
60644        function maxTranslate() {
60645            return -this.snapGrid[this.snapGrid.length - 1];
60646        }
60647    }, {}],
60648    63: [function (require, module, exports) {
60649        "use strict";
60650
60651        exports.__esModule = true;
60652        exports.default = minTranslate;
60653
60654        function minTranslate() {
60655            return -this.snapGrid[0];
60656        }
60657    }, {}],
60658    64: [function (require, module, exports) {
60659        "use strict";
60660
60661        exports.__esModule = true;
60662        exports.default = setTranslate;
60663
60664        function setTranslate(translate, byController) {
60665            var swiper = this;
60666            var rtl = swiper.rtlTranslate,
60667                params = swiper.params,
60668                $wrapperEl = swiper.$wrapperEl,
60669                wrapperEl = swiper.wrapperEl,
60670                progress = swiper.progress;
60671            var x = 0;
60672            var y = 0;
60673            var z = 0;
60674
60675            if (swiper.isHorizontal()) {
60676                x = rtl ? -translate : translate;
60677            } else {
60678                y = translate;
60679            }
60680
60681            if (params.roundLengths) {
60682                x = Math.floor(x);
60683                y = Math.floor(y);
60684            }
60685
60686            if (params.cssMode) {
60687                wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y;
60688            } else if (!params.virtualTranslate) {
60689                $wrapperEl.transform("translate3d(" + x + "px, " + y + "px, " + z + "px)");
60690            }
60691
60692            swiper.previousTranslate = swiper.translate;
60693            swiper.translate = swiper.isHorizontal() ? x : y; // Check if we need to update progress
60694
60695            var newProgress;
60696            var translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
60697
60698            if (translatesDiff === 0) {
60699                newProgress = 0;
60700            } else {
60701                newProgress = (translate - swiper.minTranslate()) / translatesDiff;
60702            }
60703
60704            if (newProgress !== progress) {
60705                swiper.updateProgress(translate);
60706            }
60707
60708            swiper.emit('setTranslate', swiper.translate, byController);
60709        }
60710    }, {}],
60711    65: [function (require, module, exports) {
60712        "use strict";
60713
60714        exports.__esModule = true;
60715        exports.default = translateTo;
60716
60717        function translateTo(translate, speed, runCallbacks, translateBounds, internal) {
60718            if (translate === void 0) {
60719                translate = 0;
60720            }
60721
60722            if (speed === void 0) {
60723                speed = this.params.speed;
60724            }
60725
60726            if (runCallbacks === void 0) {
60727                runCallbacks = true;
60728            }
60729
60730            if (translateBounds === void 0) {
60731                translateBounds = true;
60732            }
60733
60734            var swiper = this;
60735            var params = swiper.params,
60736                wrapperEl = swiper.wrapperEl;
60737
60738            if (swiper.animating && params.preventInteractionOnTransition) {
60739                return false;
60740            }
60741
60742            var minTranslate = swiper.minTranslate();
60743            var maxTranslate = swiper.maxTranslate();
60744            var newTranslate;
60745            if (translateBounds && translate > minTranslate) newTranslate = minTranslate; else if (translateBounds && translate < maxTranslate) newTranslate = maxTranslate; else newTranslate = translate; // Update progress
60746
60747            swiper.updateProgress(newTranslate);
60748
60749            if (params.cssMode) {
60750                var isH = swiper.isHorizontal();
60751
60752                if (speed === 0) {
60753                    wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate;
60754                } else {
60755                    // eslint-disable-next-line
60756                    if (wrapperEl.scrollTo) {
60757                        var _wrapperEl$scrollTo;
60758
60759                        wrapperEl.scrollTo((_wrapperEl$scrollTo = {}, _wrapperEl$scrollTo[isH ? 'left' : 'top'] = -newTranslate, _wrapperEl$scrollTo.behavior = 'smooth', _wrapperEl$scrollTo));
60760                    } else {
60761                        wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate;
60762                    }
60763                }
60764
60765                return true;
60766            }
60767
60768            if (speed === 0) {
60769                swiper.setTransition(0);
60770                swiper.setTranslate(newTranslate);
60771
60772                if (runCallbacks) {
60773                    swiper.emit('beforeTransitionStart', speed, internal);
60774                    swiper.emit('transitionEnd');
60775                }
60776            } else {
60777                swiper.setTransition(speed);
60778                swiper.setTranslate(newTranslate);
60779
60780                if (runCallbacks) {
60781                    swiper.emit('beforeTransitionStart', speed, internal);
60782                    swiper.emit('transitionStart');
60783                }
60784
60785                if (!swiper.animating) {
60786                    swiper.animating = true;
60787
60788                    if (!swiper.onTranslateToWrapperTransitionEnd) {
60789                        swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e) {
60790                            if (!swiper || swiper.destroyed) return;
60791                            if (e.target !== this) return;
60792                            swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
60793                            swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd);
60794                            swiper.onTranslateToWrapperTransitionEnd = null;
60795                            delete swiper.onTranslateToWrapperTransitionEnd;
60796
60797                            if (runCallbacks) {
60798                                swiper.emit('transitionEnd');
60799                            }
60800                        };
60801                    }
60802
60803                    swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
60804                    swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd);
60805                }
60806            }
60807
60808            return true;
60809        }
60810    }, {}],
60811    66: [function (require, module, exports) {
60812        "use strict";
60813
60814        exports.__esModule = true;
60815        exports.default = void 0;
60816
60817        var _updateSize = _interopRequireDefault(require("./updateSize"));
60818
60819        var _updateSlides = _interopRequireDefault(require("./updateSlides"));
60820
60821        var _updateAutoHeight = _interopRequireDefault(require("./updateAutoHeight"));
60822
60823        var _updateSlidesOffset = _interopRequireDefault(require("./updateSlidesOffset"));
60824
60825        var _updateSlidesProgress = _interopRequireDefault(require("./updateSlidesProgress"));
60826
60827        var _updateProgress = _interopRequireDefault(require("./updateProgress"));
60828
60829        var _updateSlidesClasses = _interopRequireDefault(require("./updateSlidesClasses"));
60830
60831        var _updateActiveIndex = _interopRequireDefault(require("./updateActiveIndex"));
60832
60833        var _updateClickedSlide = _interopRequireDefault(require("./updateClickedSlide"));
60834
60835        function _interopRequireDefault(obj) {
60836            return obj && obj.__esModule ? obj : {default: obj};
60837        }
60838
60839        var _default = {
60840            updateSize: _updateSize.default,
60841            updateSlides: _updateSlides.default,
60842            updateAutoHeight: _updateAutoHeight.default,
60843            updateSlidesOffset: _updateSlidesOffset.default,
60844            updateSlidesProgress: _updateSlidesProgress.default,
60845            updateProgress: _updateProgress.default,
60846            updateSlidesClasses: _updateSlidesClasses.default,
60847            updateActiveIndex: _updateActiveIndex.default,
60848            updateClickedSlide: _updateClickedSlide.default
60849        };
60850        exports.default = _default;
60851    }, {
60852        "./updateActiveIndex": 67,
60853        "./updateAutoHeight": 68,
60854        "./updateClickedSlide": 69,
60855        "./updateProgress": 70,
60856        "./updateSize": 71,
60857        "./updateSlides": 72,
60858        "./updateSlidesClasses": 73,
60859        "./updateSlidesOffset": 74,
60860        "./updateSlidesProgress": 75
60861    }],
60862    67: [function (require, module, exports) {
60863        "use strict";
60864
60865        exports.__esModule = true;
60866        exports.default = updateActiveIndex;
60867
60868        var _utils = require("../../../utils/utils");
60869
60870        function updateActiveIndex(newActiveIndex) {
60871            var swiper = this;
60872            var translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
60873            var slidesGrid = swiper.slidesGrid,
60874                snapGrid = swiper.snapGrid,
60875                params = swiper.params,
60876                previousIndex = swiper.activeIndex,
60877                previousRealIndex = swiper.realIndex,
60878                previousSnapIndex = swiper.snapIndex;
60879            var activeIndex = newActiveIndex;
60880            var snapIndex;
60881
60882            if (typeof activeIndex === 'undefined') {
60883                for (var i = 0; i < slidesGrid.length; i += 1) {
60884                    if (typeof slidesGrid[i + 1] !== 'undefined') {
60885                        if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - (slidesGrid[i + 1] - slidesGrid[i]) / 2) {
60886                            activeIndex = i;
60887                        } else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) {
60888                            activeIndex = i + 1;
60889                        }
60890                    } else if (translate >= slidesGrid[i]) {
60891                        activeIndex = i;
60892                    }
60893                } // Normalize slideIndex
60894
60895
60896                if (params.normalizeSlideIndex) {
60897                    if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0;
60898                }
60899            }
60900
60901            if (snapGrid.indexOf(translate) >= 0) {
60902                snapIndex = snapGrid.indexOf(translate);
60903            } else {
60904                var skip = Math.min(params.slidesPerGroupSkip, activeIndex);
60905                snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup);
60906            }
60907
60908            if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
60909
60910            if (activeIndex === previousIndex) {
60911                if (snapIndex !== previousSnapIndex) {
60912                    swiper.snapIndex = snapIndex;
60913                    swiper.emit('snapIndexChange');
60914                }
60915
60916                return;
60917            } // Get real index
60918
60919
60920            var realIndex = parseInt(swiper.slides.eq(activeIndex).attr('data-swiper-slide-index') || activeIndex, 10);
60921            (0, _utils.extend)(swiper, {
60922                snapIndex: snapIndex,
60923                realIndex: realIndex,
60924                previousIndex: previousIndex,
60925                activeIndex: activeIndex
60926            });
60927            swiper.emit('activeIndexChange');
60928            swiper.emit('snapIndexChange');
60929
60930            if (previousRealIndex !== realIndex) {
60931                swiper.emit('realIndexChange');
60932            }
60933
60934            if (swiper.initialized || swiper.params.runCallbacksOnInit) {
60935                swiper.emit('slideChange');
60936            }
60937        }
60938    }, {"../../../utils/utils": 98}],
60939    68: [function (require, module, exports) {
60940        "use strict";
60941
60942        exports.__esModule = true;
60943        exports.default = updateAutoHeight;
60944
60945        function updateAutoHeight(speed) {
60946            var swiper = this;
60947            var activeSlides = [];
60948            var newHeight = 0;
60949            var i;
60950
60951            if (typeof speed === 'number') {
60952                swiper.setTransition(speed);
60953            } else if (speed === true) {
60954                swiper.setTransition(swiper.params.speed);
60955            } // Find slides currently in view
60956
60957
60958            if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) {
60959                if (swiper.params.centeredSlides) {
60960                    swiper.visibleSlides.each(function (slide) {
60961                        activeSlides.push(slide);
60962                    });
60963                } else {
60964                    for (i = 0;
60964 i < Math.ceil(swiper.params.slidesPerView); i += 1) {
60965                        var index = swiper.activeIndex + i;
60966                        if (index > swiper.slides.length) break;
60967                        activeSlides.push(swiper.slides.eq(index)[0]);
60968                    }
60969                }
60970            } else {
60971                activeSlides.push(swiper.slides.eq(swiper.activeIndex)[0]);
60972            } // Find new height from highest slide in view
60973
60974
60975            for (i = 0; i < activeSlides.length; i += 1) {
60976                if (typeof activeSlides[i] !== 'undefined') {
60977                    var height = activeSlides[i].offsetHeight;
60978                    newHeight = height > newHeight ? height : newHeight;
60979                }
60980            } // Update Height
60981
60982
60983            if (newHeight) swiper.$wrapperEl.css('height', newHeight + "px");
60984        }
60985    }, {}],
60986    69: [function (require, module, exports) {
60987        "use strict";
60988
60989        exports.__esModule = true;
60990        exports.default = updateClickedSlide;
60991
60992        var _dom = _interopRequireDefault(require("../../../utils/dom"));
60993
60994        function _interopRequireDefault(obj) {
60995            return obj && obj.__esModule ? obj : {default: obj};
60996        }
60997
60998        function updateClickedSlide(e) {
60999            var swiper = this;
61000            var params = swiper.params;
61001            var slide = (0, _dom.default)(e.target).closest("." + params.slideClass)[0];
61002            var slideFound = false;
61003
61004            if (slide) {
61005                for (var i = 0; i < swiper.slides.length; i += 1) {
61006                    if (swiper.slides[i] === slide) slideFound = true;
61007                }
61008            }
61009
61010            if (slide && slideFound) {
61011                swiper.clickedSlide = slide;
61012
61013                if (swiper.virtual && swiper.params.virtual.enabled) {
61014                    swiper.clickedIndex = parseInt((0, _dom.default)(slide).attr('data-swiper-slide-index'), 10);
61015                } else {
61016                    swiper.clickedIndex = (0, _dom.default)(slide).index();
61017                }
61018            } else {
61019                swiper.clickedSlide = undefined;
61020                swiper.clickedIndex = undefined;
61021                return;
61022            }
61023
61024            if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) {
61025                swiper.slideToClickedSlide();
61026            }
61027        }
61028    }, {"../../../utils/dom": 94}],
61029    70: [function (require, module, exports) {
61030        "use strict";
61031
61032        exports.__esModule = true;
61033        exports.default = updateProgress;
61034
61035        var _utils = require("../../../utils/utils");
61036
61037        function updateProgress(translate) {
61038            var swiper = this;
61039
61040            if (typeof translate === 'undefined') {
61041                var multiplier = swiper.rtlTranslate ? -1 : 1; // eslint-disable-next-line
61042
61043                translate = swiper && swiper.translate && swiper.translate * multiplier || 0;
61044            }
61045
61046            var params = swiper.params;
61047            var translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
61048            var progress = swiper.progress,
61049                isBeginning = swiper.isBeginning,
61050                isEnd = swiper.isEnd;
61051            var wasBeginning = isBeginning;
61052            var wasEnd = isEnd;
61053
61054            if (translatesDiff === 0) {
61055                progress = 0;
61056                isBeginning = true;
61057                isEnd = true;
61058            } else {
61059                progress = (translate - swiper.minTranslate()) / translatesDiff;
61060                isBeginning = progress <= 0;
61061                isEnd = progress >= 1;
61062            }
61063
61064            (0, _utils.extend)(swiper, {
61065                progress: progress,
61066                isBeginning: isBeginning,
61067                isEnd: isEnd
61068            });
61069            if (params.watchSlidesProgress || params.watchSlidesVisibility || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate);
61070
61071            if (isBeginning && !wasBeginning) {
61072                swiper.emit('reachBeginning toEdge');
61073            }
61074
61075            if (isEnd && !wasEnd) {
61076                swiper.emit('reachEnd toEdge');
61077            }
61078
61079            if (wasBeginning && !isBeginning || wasEnd && !isEnd) {
61080                swiper.emit('fromEdge');
61081            }
61082
61083            swiper.emit('progress', progress);
61084        }
61085    }, {"../../../utils/utils": 98}],
61086    71: [function (require, module, exports) {
61087        "use strict";
61088
61089        exports.__esModule = true;
61090        exports.default = updateSize;
61091
61092        var _utils = require("../../../utils/utils");
61093
61094        function updateSize() {
61095            var swiper = this;
61096            var width;
61097            var height;
61098            var $el = swiper.$el;
61099
61100            if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) {
61101                width = swiper.params.width;
61102            } else {
61103                width = $el[0].clientWidth;
61104            }
61105
61106            if (typeof swiper.params.height !== 'undefined' && swiper.params.width !== null) {
61107                height = swiper.params.height;
61108            } else {
61109                height = $el[0].clientHeight;
61110            }
61111
61112            if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) {
61113                return;
61114            } // Subtract paddings
61115
61116
61117            width = width - parseInt($el.css('padding-left') || 0, 10) - parseInt($el.css('padding-right') || 0, 10);
61118            height = height - parseInt($el.css('padding-top') || 0, 10) - parseInt($el.css('padding-bottom') || 0, 10);
61119            if (Number.isNaN(width)) width = 0;
61120            if (Number.isNaN(height)) height = 0;
61121            (0, _utils.extend)(swiper, {
61122                width: width,
61123                height: height,
61124                size: swiper.isHorizontal() ? width : height
61125            });
61126        }
61127    }, {"../../../utils/utils": 98}],
61128    72: [function (require, module, exports) {
61129        "use strict";
61130
61131        exports.__esModule = true;
61132        exports.default = updateSlides;
61133
61134        var _ssrWindow = require("ssr-window");
61135
61136        var _utils = require("../../../utils/utils");
61137
61138        function updateSlides() {
61139            var swiper = this;
61140            var window = (0, _ssrWindow.getWindow)();
61141            var params = swiper.params;
61142            var $wrapperEl = swiper.$wrapperEl,
61143                swiperSize = swiper.size,
61144                rtl = swiper.rtlTranslate,
61145                wrongRTL = swiper.wrongRTL;
61146            var isVirtual = swiper.virtual && params.virtual.enabled;
61147            var previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length;
61148            var slides = $wrapperEl.children("." + swiper.params.slideClass);
61149            var slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length;
61150            var snapGrid = [];
61151            var slidesGrid = [];
61152            var slidesSizesGrid = [];
61153
61154            function slidesForMargin(slideEl, slideIndex) {
61155                if (!params.cssMode) return true;
61156
61157                if (slideIndex === slides.length - 1) {
61158                    return false;
61159                }
61160
61161                return true;
61162            }
61163
61164            var offsetBefore = params.slidesOffsetBefore;
61165
61166            if (typeof offsetBefore === 'function') {
61167                offsetBefore = params.slidesOffsetBefore.call(swiper);
61168            }
61169
61170            var offsetAfter = params.slidesOffsetAfter;
61171
61172            if (typeof offsetAfter === 'function') {
61173                offsetAfter = params.slidesOffsetAfter.call(swiper);
61174            }
61175
61176            var previousSnapGridLength = swiper.snapGrid.length;
61177            var previousSlidesGridLength = swiper.snapGrid.length;
61178            var spaceBetween = params.spaceBetween;
61179            var slidePosition = -offsetBefore;
61180            var prevSlideSize = 0;
61181            var index = 0;
61182
61183            if (typeof swiperSize === 'undefined') {
61184                return;
61185            }
61186
61187            if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
61188                spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize;
61189            }
61190
61191            swiper.virtualSize = -spaceBetween; // reset margins
61192
61193            if (rtl) slides.css({
61194                marginLeft: '',
61195                marginTop: ''
61196            }); else slides.css({
61197                marginRight: '',
61198                marginBottom: ''
61199            });
61200            var slidesNumberEvenToRows;
61201
61202            if (params.slidesPerColumn > 1) {
61203                if (Math.floor(slidesLength / params.slidesPerColumn) === slidesLength / swiper.params.slidesPerColumn) {
61204                    slidesNumberEvenToRows = slidesLength;
61205                } else {
61206                    slidesNumberEvenToRows = Math.ceil(slidesLength / params.slidesPerColumn) * params.slidesPerColumn;
61207                }
61208
61209                if (params.slidesPerView !== 'auto' && params.slidesPerColumnFill === 'row') {
61210                    slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, params.slidesPerView * params.slidesPerColumn);
61211                }
61212            } // Calc slides
61213
61214
61215            var slideSize;
61216            var slidesPerColumn = params.slidesPerColumn;
61217            var slidesPerRow = slidesNumberEvenToRows / slidesPerColumn;
61218            var numFullColumns = Math.floor(slidesLength / params.slidesPerColumn);
61219
61220            for (var i = 0; i < slidesLength; i += 1) {
61221                slideSize = 0;
61222                var slide = slides.eq(i);
61223
61224                if (params.slidesPerColumn > 1) {
61225                    // Set slides order
61226                    var newSlideOrderIndex = void 0;
61227                    var column = void 0;
61228                    var row = void 0;
61229
61230                    if (params.slidesPerColumnFill === 'row' && params.slidesPerGroup > 1) {
61231                        var groupIndex = Math.floor(i / (params.slidesPerGroup * params.slidesPerColumn));
61232                        var slideIndexInGroup = i - params.slidesPerColumn * params.slidesPerGroup * groupIndex;
61233                        var columnsInGroup = groupIndex === 0 ? params.slidesPerGroup : Math.min(Math.ceil((slidesLength - groupIndex * slidesPerColumn * params.slidesPerGroup) / slidesPerColumn), params.slidesPerGroup);
61234                        row = Math.floor(slideIndexInGroup / columnsInGroup);
61235                        column = slideIndexInGroup - row * columnsInGroup + groupIndex * params.slidesPerGroup;
61236                        newSlideOrderIndex = column + row * slidesNumberEvenToRows / slidesPerColumn;
61237                        slide.css({
61238                            '-webkit-box-ordinal-group': newSlideOrderIndex,
61239                            '-moz-box-ordinal-group': newSlideOrderIndex,
61240                            '-ms-flex-order': newSlideOrderIndex,
61241                            '-webkit-order': newSlideOrderIndex,
61242                            order: newSlideOrderIndex
61243                        });
61244                    } else if (params.slidesPerColumnFill === 'column') {
61245                        column = Math.floor(i / slidesPerColumn);
61246                        row = i - column * slidesPerColumn;
61247
61248                        if (column > numFullColumns || column === numFullColumns && row === slidesPerColumn - 1) {
61249                            row += 1;
61250
61251                            if (row >= slidesPerColumn) {
61252                                row = 0;
61253                                column += 1;
61254                            }
61255                        }
61256                    } else {
61257                        row = Math.floor(i / slidesPerRow);
61258                        column = i - row * slidesPerRow;
61259                    }
61260
61261                    slide.css("margin-" + (swiper.isHorizontal() ? 'top' : 'left'), row !== 0 && params.spaceBetween && params.spaceBetween + "px");
61262                }
61263
61264                if (slide.css('display') === 'none') continue; // eslint-disable-line
61265
61266                if (params.slidesPerView === 'auto') {
61267                    var slideStyles = window.getComputedStyle(slide[0], null);
61268                    var currentTransform = slide[0].style.transform;
61269                    var currentWebKitTransform = slide[0].style.webkitTransform;
61270
61271                    if (currentTransform) {
61272                        slide[0].style.transform = 'none';
61273                    }
61274
61275                    if (currentWebKitTransform) {
61276                        slide[0].style.webkitTransform = 'none';
61277                    }
61278
61279                    if (params.roundLengths) {
61280                        slideSize = swiper.isHorizontal() ? slide.outerWidth(true) : slide.outerHeight(true);
61281                    } else {
61282                        // eslint-disable-next-line
61283                        if (swiper.isHorizontal()) {
61284                            var width = parseFloat(slideStyles.getPropertyValue('width') || 0);
61285                            var paddingLeft = parseFloat(slideStyles.getPropertyValue('padding-left') || 0);
61286                            var paddingRight = parseFloat(slideStyles.getPropertyValue('padding-right') || 0);
61287                            var marginLeft = parseFloat(slideStyles.getPropertyValue('margin-left') || 0);
61288                            var marginRight = parseFloat(slideStyles.getPropertyValue('margin-right') || 0);
61289                            var boxSizing = slideStyles.getPropertyValue('box-sizing');
61290
61291                            if (boxSizing && boxSizing === 'border-box') {
61292                                slideSize = width + marginLeft + marginRight;
61293                            } else {
61294                                var _slide$ = slide[0],
61295                                    clientWidth = _slide$.clientWidth,
61296                                    offsetWidth = _slide$.offsetWidth;
61297                                slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth);
61298                            }
61299                        } else {
61300                            var height = parseFloat(slideStyles.getPropertyValue('height') || 0);
61301                            var paddingTop = parseFloat(slideStyles.getPropertyValue('padding-top') || 0);
61302                            var paddingBottom = parseFloat(slideStyles.getPropertyValue('padding-bottom') || 0);
61303                            var marginTop = parseFloat(slideStyles.getPropertyValue('margin-top') || 0);
61304                            var marginBottom = parseFloat(slideStyles.getPropertyValue('margin-bottom') || 0);
61305
61306                            var _boxSizing = slideStyles.getPropertyValue('box-sizing');
61307
61308                            if (_boxSizing && _boxSizing === 'border-box') {
61309                                slideSize = height + marginTop + marginBottom;
61310                            } else {
61311                                var _slide$2 = slide[0],
61312                                    clientHeight = _slide$2.clientHeight,
61313                                    offsetHeight = _slide$2.offsetHeight;
61314                                slideSize = height + paddingTop + paddingBottom + marginTop + marginBottom + (offsetHeight - clientHeight);
61315                            }
61316                        }
61317                    }
61318
61319                    if (currentTransform) {
61320                        slide[0].style.transform = currentTransform;
61321                    }
61322
61323                    if (currentWebKitTransform) {
61324                        slide[0].style.webkitTransform = currentWebKitTransform;
61325                    }
61326
61327                    if (params.roundLengths) slideSize = Math.floor(slideSize);
61328                } else {
61329                    slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView;
61330                    if (params.roundLengths) slideSize = Math.floor(slideSize);
61331
61332                    if (slides[i]) {
61333                        if (swiper.isHorizontal()) {
61334                            slides[i].style.width = slideSize + "px";
61335                        } else {
61336                            slides[i].style.height = slideSize + "px";
61337                        }
61338                    }
61339                }
61340
61341                if (slides[i]) {
61342                    slides[i].swiperSlideSize = slideSize;
61343                }
61344
61345                slidesSizesGrid.push(slideSize);
61346
61347                if (params.centeredSlides) {
61348                    slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;
61349                    if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;
61350                    if (i === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;
61351                    if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0;
61352                    if (params.roundLengths) slidePosition = Math.floor(slidePosition);
61353                    if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition);
61354                    slidesGrid.push(slidePosition);
61355                } else {
61356                    if (params.roundLengths) slidePosition = Math.floor(slidePosition);
61357                    if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition);
61358                    slidesGrid.push(slidePosition);
61359                    slidePosition = slidePosition + slideSize + spaceBetween;
61360                }
61361
61362                swiper.virtualSize += slideSize + spaceBetween;
61363                prevSlideSize = slideSize;
61364                index += 1;
61365            }
61366
61367            swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter;
61368            var newSlidesGrid;
61369
61370            if (rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) {
61371                $wrapperEl.css({
61372                    width: swiper.virtualSize + params.spaceBetween + "px"
61373                });
61374            }
61375
61376            if (params.setWrapperSize) {
61377                if (swiper.isHorizontal()) $wrapperEl.css({
61378                    width: swiper.virtualSize + params.spaceBetween + "px"
61379                }); else $wrapperEl.css({
61380                    height: swiper.virtualSize + params.spaceBetween + "px"
61381                });
61382            }
61383
61384            if (params.slidesPerColumn > 1) {
61385                swiper.virtualSize = (slideSize + params.spaceBetween) * slidesNumber
61385EvenToRows;
61386                swiper.virtualSize = Math.ceil(swiper.virtualSize / params.slidesPerColumn) - params.spaceBetween;
61387                if (swiper.isHorizontal()) $wrapperEl.css({
61388                    width: swiper.virtualSize + params.spaceBetween + "px"
61389                }); else $wrapperEl.css({
61390                    height: swiper.virtualSize + params.spaceBetween + "px"
61391                });
61392
61393                if (params.centeredSlides) {
61394                    newSlidesGrid = [];
61395
61396                    for (var _i = 0; _i < snapGrid.length; _i += 1) {
61397                        var slidesGridItem = snapGrid[_i];
61398                        if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem);
61399                        if (snapGrid[_i] < swiper.virtualSize + snapGrid[0]) newSlidesGrid.push(slidesGridItem);
61400                    }
61401
61402                    snapGrid = newSlidesGrid;
61403                }
61404            } // Remove last grid elements depending on width
61405
61406
61407            if (!params.centeredSlides) {
61408                newSlidesGrid = [];
61409
61410                for (var _i2 = 0; _i2 < snapGrid.length; _i2 += 1) {
61411                    var _slidesGridItem = snapGrid[_i2];
61412                    if (params.roundLengths) _slidesGridItem = Math.floor(_slidesGridItem);
61413
61414                    if (snapGrid[_i2] <= swiper.virtualSize - swiperSize) {
61415                        newSlidesGrid.push(_slidesGridItem);
61416                    }
61417                }
61418
61419                snapGrid = newSlidesGrid;
61420
61421                if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) {
61422                    snapGrid.push(swiper.virtualSize - swiperSize);
61423                }
61424            }
61425
61426            if (snapGrid.length === 0) snapGrid = [0];
61427
61428            if (params.spaceBetween !== 0) {
61429                if (swiper.isHorizontal()) {
61430                    if (rtl) slides.filter(slidesForMargin).css({
61431                        marginLeft: spaceBetween + "px"
61432                    }); else slides.filter(slidesForMargin).css({
61433                        marginRight: spaceBetween + "px"
61434                    });
61435                } else slides.filter(slidesForMargin).css({
61436                    marginBottom: spaceBetween + "px"
61437                });
61438            }
61439
61440            if (params.centeredSlides && params.centeredSlidesBounds) {
61441                var allSlidesSize = 0;
61442                slidesSizesGrid.forEach(function (slideSizeValue) {
61443                    allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0);
61444                });
61445                allSlidesSize -= params.spaceBetween;
61446                var maxSnap = allSlidesSize - swiperSize;
61447                snapGrid = snapGrid.map(function (snap) {
61448                    if (snap < 0) return -offsetBefore;
61449                    if (snap > maxSnap) return maxSnap + offsetAfter;
61450                    return snap;
61451                });
61452            }
61453
61454            if (params.centerInsufficientSlides) {
61455                var _allSlidesSize = 0;
61456                slidesSizesGrid.forEach(function (slideSizeValue) {
61457                    _allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0);
61458                });
61459                _allSlidesSize -= params.spaceBetween;
61460
61461                if (_allSlidesSize < swiperSize) {
61462                    var allSlidesOffset = (swiperSize - _allSlidesSize) / 2;
61463                    snapGrid.forEach(function (snap, snapIndex) {
61464                        snapGrid[snapIndex] = snap - allSlidesOffset;
61465                    });
61466                    slidesGrid.forEach(function (snap, snapIndex) {
61467                        slidesGrid[snapIndex] = snap + allSlidesOffset;
61468                    });
61469                }
61470            }
61471
61472            (0, _utils.extend)(swiper, {
61473                slides: slides,
61474                snapGrid: snapGrid,
61475                slidesGrid: slidesGrid,
61476                slidesSizesGrid: slidesSizesGrid
61477            });
61478
61479            if (slidesLength !== previousSlidesLength) {
61480                swiper.emit('slidesLengthChange');
61481            }
61482
61483            if (snapGrid.length !== previousSnapGridLength) {
61484                if (swiper.params.watchOverflow) swiper.checkOverflow();
61485                swiper.emit('snapGridLengthChange');
61486            }
61487
61488            if (slidesGrid.length !== previousSlidesGridLength) {
61489                swiper.emit('slidesGridLengthChange');
61490            }
61491
61492            if (params.watchSlidesProgress || params.watchSlidesVisibility) {
61493                swiper.updateSlidesOffset();
61494            }
61495        }
61496    }, {"../../../utils/utils": 98, "ssr-window": 10}],
61497    73: [function (require, module, exports) {
61498        "use strict";
61499
61500        exports.__esModule = true;
61501        exports.default = updateSlidesClasses;
61502
61503        function updateSlidesClasses() {
61504            var swiper = this;
61505            var slides = swiper.slides,
61506                params = swiper.params,
61507                $wrapperEl = swiper.$wrapperEl,
61508                activeIndex = swiper.activeIndex,
61509                realIndex = swiper.realIndex;
61510            var isVirtual = swiper.virtual && params.virtual.enabled;
61511            slides.removeClass(params.slideActiveClass + " " + params.slideNextClass + " " + params.slidePrevClass + " " + params.slideDuplicateActiveClass + " " + params.slideDuplicateNextClass + " " + params.slideDuplicatePrevClass);
61512            var activeSlide;
61513
61514            if (isVirtual) {
61515                activeSlide = swiper.$wrapperEl.find("." + params.slideClass + "[data-swiper-slide-index=\"" + activeIndex + "\"]");
61516            } else {
61517                activeSlide = slides.eq(activeIndex);
61518            } // Active classes
61519
61520
61521            activeSlide.addClass(params.slideActiveClass);
61522
61523            if (params.loop) {
61524                // Duplicate to all looped slides
61525                if (activeSlide.hasClass(params.slideDuplicateClass)) {
61526                    $wrapperEl.children("." + params.slideClass + ":not(." + params.slideDuplicateClass + ")[data-swiper-slide-index=\"" + realIndex + "\"]").addClass(params.slideDuplicateActiveClass);
61527                } else {
61528                    $wrapperEl.children("." + params.slideClass + "." + params.slideDuplicateClass + "[data-swiper-slide-index=\"" + realIndex + "\"]").addClass(params.slideDuplicateActiveClass);
61529                }
61530            } // Next Slide
61531
61532
61533            var nextSlide = activeSlide.nextAll("." + params.slideClass).eq(0).addClass(params.slideNextClass);
61534
61535            if (params.loop && nextSlide.length === 0) {
61536                nextSlide = slides.eq(0);
61537                nextSlide.addClass(params.slideNextClass);
61538            } // Prev Slide
61539
61540
61541            var prevSlide = activeSlide.prevAll("." + params.slideClass).eq(0).addClass(params.slidePrevClass);
61542
61543            if (params.loop && prevSlide.length === 0) {
61544                prevSlide = slides.eq(-1);
61545                prevSlide.addClass(params.slidePrevClass);
61546            }
61547
61548            if (params.loop) {
61549                // Duplicate to all looped slides
61550                if (nextSlide.hasClass(params.slideDuplicateClass)) {
61551                    $wrapperEl.children("." + params.slideClass + ":not(." + params.slideDuplicateClass + ")[data-swiper-slide-index=\"" + nextSlide.attr('data-swiper-slide-index') + "\"]").addClass(params.slideDuplicateNextClass);
61552                } else {
61553                    $wrapperEl.children("." + params.slideClass + "." + params.slideDuplicateClass + "[data-swiper-slide-index=\"" + nextSlide.attr('data-swiper-slide-index') + "\"]").addClass(params.slideDuplicateNextClass);
61554                }
61555
61556                if (prevSlide.hasClass(params.slideDuplicateClass)) {
61557                    $wrapperEl.children("." + params.slideClass + ":not(." + params.slideDuplicateClass + ")[data-swiper-slide-index=\"" + prevSlide.attr('data-swiper-slide-index') + "\"]").addClass(params.slideDuplicatePrevClass);
61558                } else {
61559                    $wrapperEl.children("." + params.slideClass + "." + params.slideDuplicateClass + "[data-swiper-slide-index=\"" + prevSlide.attr('data-swiper-slide-index') + "\"]").addClass(params.slideDuplicatePrevClass);
61560                }
61561            }
61562
61563            swiper.emitSlidesClasses();
61564        }
61565    }, {}],
61566    74: [function (require, module, exports) {
61567        "use strict";
61568
61569        exports.__esModule = true;
61570        exports.default = updateSlidesOffset;
61571
61572        function updateSlidesOffset() {
61573            var swiper = this;
61574            var slides = swiper.slides;
61575
61576            for (var i = 0; i < slides.length; i += 1) {
61577                slides[i].swiperSlideOffset = swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop;
61578            }
61579        }
61580    }, {}],
61581    75: [function (require, module, exports) {
61582        "use strict";
61583
61584        exports.__esModule = true;
61585        exports.default = updateSlidesProgress;
61586
61587        var _dom = _interopRequireDefault(require("../../../utils/dom"));
61588
61589        function _interopRequireDefault(obj) {
61590            return obj && obj.__esModule ? obj : {default: obj};
61591        }
61592
61593        function updateSlidesProgress(translate) {
61594            if (translate === void 0) {
61595                translate = this && this.translate || 0;
61596            }
61597
61598            var swiper = this;
61599            var params = swiper.params;
61600            var slides = swiper.slides,
61601                rtl = swiper.rtlTranslate;
61602            if (slides.length === 0) return;
61603            if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset();
61604            var offsetCenter = -translate;
61605            if (rtl) offsetCenter = translate; // Visible Slides
61606
61607            slides.removeClass(params.slideVisibleClass);
61608            swiper.visibleSlidesIndexes = [];
61609            swiper.visibleSlides = [];
61610
61611            for (var i = 0; i < slides.length; i += 1) {
61612                var slide = slides[i];
61613                var slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slide.swiperSlideOffset) / (slide.swiperSlideSize + params.spaceBetween);
61614
61615                if (params.watchSlidesVisibility || params.centeredSlides && params.autoHeight) {
61616                    var slideBefore = -(offsetCenter - slide.swiperSlideOffset);
61617                    var slideAfter = slideBefore + swiper.slidesSizesGrid[i];
61618                    var isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size;
61619
61620                    if (isVisible) {
61621                        swiper.visibleSlides.push(slide);
61622                        swiper.visibleSlidesIndexes.push(i);
61623                        slides.eq(i).addClass(params.slideVisibleClass);
61624                    }
61625                }
61626
61627                slide.progress = rtl ? -slideProgress : slideProgress;
61628            }
61629
61630            swiper.visibleSlides = (0, _dom.default)(swiper.visibleSlides);
61631        }
61632    }, {"../../../utils/dom": 94}],
61633    76: [function (require, module, exports) {
61634        "use strict";
61635
61636        exports.__esModule = true;
61637        exports.default = void 0;
61638
61639        var _dom = _interopRequireDefault(require("../../utils/dom"));
61640
61641        var _utils = require("../../utils/utils");
61642
61643        function _interopRequireDefault(obj) {
61644            return obj && obj.__esModule ? obj : {default: obj};
61645        }
61646
61647        function _extends() {
61648            _extends = Object.assign || function (target) {
61649                for (var i = 1; i < arguments.length; i++) {
61650                    var source = arguments[i];
61651                    for (var key in source) {
61652                        if (Object.prototype.hasOwnProperty.call(source, key)) {
61653                            target[key] = source[key];
61654                        }
61655                    }
61656                }
61657                return target;
61658            };
61659            return _extends.apply(this, arguments);
61660        }
61661
61662        var Coverflow = {
61663            setTranslate: function setTranslate() {
61664                var swiper = this;
61665                var swiperWidth = swiper.width,
61666                    swiperHeight = swiper.height,
61667                    slides = swiper.slides,
61668                    slidesSizesGrid = swiper.slidesSizesGrid;
61669                var params = swiper.params.coverflowEffect;
61670                var isHorizontal = swiper.isHorizontal();
61671                var transform = swiper.translate;
61672                var center = isHorizontal ? -transform + swiperWidth / 2 : -transform + swiperHeight / 2;
61673                var rotate = isHorizontal ? params.rotate : -params.rotate;
61674                var translate = params.depth; // Each slide offset from center
61675
61676                for (var i = 0, length = slides.length; i < length; i += 1) {
61677                    var $slideEl = slides.eq(i);
61678                    var slideSize = slidesSizesGrid[i];
61679                    var slideOffset = $slideEl[0].swiperSlideOffset;
61680                    var offsetMultiplier = (center - slideOffset - slideSize / 2) / slideSize * params.modifier;
61681                    var rotateY = isHorizontal ? rotate * offsetMultiplier : 0;
61682                    var rotateX = isHorizontal ? 0 : rotate * offsetMultiplier; // var rotateZ = 0
61683
61684                    var translateZ = -translate * Math.abs(offsetMultiplier);
61685                    var stretch = params.stretch; // Allow percentage to make a relative stretch for responsive sliders
61686
61687                    if (typeof stretch === 'string' && stretch.indexOf('%') !== -1) {
61688                        stretch = parseFloat(params.stretch) / 100 * slideSize;
61689                    }
61690
61691                    var translateY = isHorizontal ? 0 : stretch * offsetMultiplier;
61692                    var translateX = isHorizontal ? stretch * offsetMultiplier : 0;
61693                    var scale = 1 - (1 - params.scale) * Math.abs(offsetMultiplier); // Fix for ultra small values
61694
61695                    if (Math.abs(translateX) < 0.001) translateX = 0;
61696                    if (Math.abs(translateY) < 0.001) translateY = 0;
61697                    if (Math.abs(translateZ) < 0.001) translateZ = 0;
61698                    if (Math.abs(rotateY) < 0.001) rotateY = 0;
61699                    if (Math.abs(rotateX) < 0.001) rotateX = 0;
61700                    if (Math.abs(scale) < 0.001) scale = 0;
61701                    var slideTransform = "translate3d(" + translateX + "px," + translateY + "px," + translateZ + "px)  rotateX(" + rotateX + "deg) rotateY(" + rotateY + "deg) scale(" + scale + ")";
61702                    $slideEl.transform(slideTransform);
61703                    $slideEl[0].style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1;
61704
61705                    if (params.slideShadows) {
61706                        // Set shadows
61707                        var $shadowBeforeEl = isHorizontal ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top');
61708                        var $shadowAfterEl = isHorizontal ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom');
61709
61710                        if ($shadowBeforeEl.length === 0) {
61711                            $shadowBeforeEl = (0, _dom.default)("<div class=\"swiper-slide-shadow-" + (isHorizontal ? 'left' : 'top') + "\"></div>");
61712                            $slideEl.append($shadowBeforeEl);
61713                        }
61714
61715                        if ($shadowAfterEl.length === 0) {
61716                            $shadowAfterEl = (0, _dom.default)("<div class=\"swiper-slide-shadow-" + (isHorizontal ? 'right' : 'bottom') + "\"></div>");
61717                            $slideEl.append($shadowAfterEl);
61718                        }
61719
61720                        if ($shadowBeforeEl.length) $shadowBeforeEl[0].style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0;
61721                        if ($shadowAfterEl.length) $shadowAfterEl[0].style.opacity = -offsetMultiplier > 0 ? -offsetMultiplier : 0;
61722                    }
61723                }
61724            },
61725            setTransition: function setTransition(duration) {
61726                var swiper = this;
61727                swiper.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
61728            }
61729        };
61730        var _default = {
61731            name: 'effect-coverflow',
61732            params: {
61733                coverflowEffect: {
61734                    rotate: 50,
61735                    stretch: 0,
61736                    depth: 100,
61737                    scale: 1,
61738                    modifier: 1,
61739                    slideShadows: true
61740                }
61741            },
61742            create: function create() {
61743                var swiper = this;
61744                (0, _utils.bindModuleMethods)(swiper, {
61745                    coverflowEffect: _extends({}
61745, Coverflow)
61746                });
61747            },
61748            on: {
61749                beforeInit: function beforeInit(swiper) {
61750                    if (swiper.params.effect !== 'coverflow') return;
61751                    swiper.classNames.push(swiper.params.containerModifierClass + "coverflow");
61752                    swiper.classNames.push(swiper.params.containerModifierClass + "3d");
61753                    swiper.params.watchSlidesProgress = true;
61754                    swiper.originalParams.watchSlidesProgress = true;
61755                },
61756                setTranslate: function setTranslate(swiper) {
61757                    if (swiper.params.effect !== 'coverflow') return;
61758                    swiper.coverflowEffect.setTranslate();
61759                },
61760                setTransition: function setTransition(swiper, duration) {
61761                    if (swiper.params.effect !== 'coverflow') return;
61762                    swiper.coverflowEffect.setTransition(duration);
61763                }
61764            }
61765        };
61766        exports.default = _default;
61767    }, {"../../utils/dom": 94, "../../utils/utils": 98}],
61768    77: [function (require, module, exports) {
61769        "use strict";
61770
61771        exports.__esModule = true;
61772        exports.default = void 0;
61773
61774        var _dom = _interopRequireDefault(require("../../utils/dom"));
61775
61776        var _utils = require("../../utils/utils");
61777
61778        function _interopRequireDefault(obj) {
61779            return obj && obj.__esModule ? obj : {default: obj};
61780        }
61781
61782        function _extends() {
61783            _extends = Object.assign || function (target) {
61784                for (var i = 1; i < arguments.length; i++) {
61785                    var source = arguments[i];
61786                    for (var key in source) {
61787                        if (Object.prototype.hasOwnProperty.call(source, key)) {
61788                            target[key] = source[key];
61789                        }
61790                    }
61791                }
61792                return target;
61793            };
61794            return _extends.apply(this, arguments);
61795        }
61796
61797        var Cube = {
61798            setTranslate: function setTranslate() {
61799                var swiper = this;
61800                var $el = swiper.$el,
61801                    $wrapperEl = swiper.$wrapperEl,
61802                    slides = swiper.slides,
61803                    swiperWidth = swiper.width,
61804                    swiperHeight = swiper.height,
61805                    rtl = swiper.rtlTranslate,
61806                    swiperSize = swiper.size,
61807                    browser = swiper.browser;
61808                var params = swiper.params.cubeEffect;
61809                var isHorizontal = swiper.isHorizontal();
61810                var isVirtual = swiper.virtual && swiper.params.virtual.enabled;
61811                var wrapperRotate = 0;
61812                var $cubeShadowEl;
61813
61814                if (params.shadow) {
61815                    if (isHorizontal) {
61816                        $cubeShadowEl = $wrapperEl.find('.swiper-cube-shadow');
61817
61818                        if ($cubeShadowEl.length === 0) {
61819                            $cubeShadowEl = (0, _dom.default)('<div class="swiper-cube-shadow"></div>');
61820                            $wrapperEl.append($cubeShadowEl);
61821                        }
61822
61823                        $cubeShadowEl.css({
61824                            height: swiperWidth + "px"
61825                        });
61826                    } else {
61827                        $cubeShadowEl = $el.find('.swiper-cube-shadow');
61828
61829                        if ($cubeShadowEl.length === 0) {
61830                            $cubeShadowEl = (0, _dom.default)('<div class="swiper-cube-shadow"></div>');
61831                            $el.append($cubeShadowEl);
61832                        }
61833                    }
61834                }
61835
61836                for (var i = 0; i < slides.length; i += 1) {
61837                    var $slideEl = slides.eq(i);
61838                    var slideIndex = i;
61839
61840                    if (isVirtual) {
61841                        slideIndex = parseInt($slideEl.attr('data-swiper-slide-index'), 10);
61842                    }
61843
61844                    var slideAngle = slideIndex * 90;
61845                    var round = Math.floor(slideAngle / 360);
61846
61847                    if (rtl) {
61848                        slideAngle = -slideAngle;
61849                        round = Math.floor(-slideAngle / 360);
61850                    }
61851
61852                    var progress = Math.max(Math.min($slideEl[0].progress, 1), -1);
61853                    var tx = 0;
61854                    var ty = 0;
61855                    var tz = 0;
61856
61857                    if (slideIndex % 4 === 0) {
61858                        tx = -round * 4 * swiperSize;
61859                        tz = 0;
61860                    } else if ((slideIndex - 1) % 4 === 0) {
61861                        tx = 0;
61862                        tz = -round * 4 * swiperSize;
61863                    } else if ((slideIndex - 2) % 4 === 0) {
61864                        tx = swiperSize + round * 4 * swiperSize;
61865                        tz = swiperSize;
61866                    } else if ((slideIndex - 3) % 4 === 0) {
61867                        tx = -swiperSize;
61868                        tz = 3 * swiperSize + swiperSize * 4 * round;
61869                    }
61870
61871                    if (rtl) {
61872                        tx = -tx;
61873                    }
61874
61875                    if (!isHorizontal) {
61876                        ty = tx;
61877                        tx = 0;
61878                    }
61879
61880                    var transform = "rotateX(" + (isHorizontal ? 0 : -slideAngle) + "deg) rotateY(" + (isHorizontal ? slideAngle : 0) + "deg) translate3d(" + tx + "px, " + ty + "px, " + tz + "px)";
61881
61882                    if (progress <= 1 && progress > -1) {
61883                        wrapperRotate = slideIndex * 90 + progress * 90;
61884                        if (rtl) wrapperRotate = -slideIndex * 90 - progress * 90;
61885                    }
61886
61887                    $slideEl.transform(transform);
61888
61889                    if (params.slideShadows) {
61890                        // Set shadows
61891                        var shadowBefore = isHorizontal ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top');
61892                        var shadowAfter = isHorizontal ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom');
61893
61894                        if (shadowBefore.length === 0) {
61895                            shadowBefore = (0, _dom.default)("<div class=\"swiper-slide-shadow-" + (isHorizontal ? 'left' : 'top') + "\"></div>");
61896                            $slideEl.append(shadowBefore);
61897                        }
61898
61899                        if (shadowAfter.length === 0) {
61900                            shadowAfter = (0, _dom.default)("<div class=\"swiper-slide-shadow-" + (isHorizontal ? 'right' : 'bottom') + "\"></div>");
61901                            $slideEl.append(shadowAfter);
61902                        }
61903
61904                        if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0);
61905                        if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0);
61906                    }
61907                }
61908
61909                $wrapperEl.css({
61910                    '-webkit-transform-origin': "50% 50% -" + swiperSize / 2 + "px",
61911                    '-moz-transform-origin': "50% 50% -" + swiperSize / 2 + "px",
61912                    '-ms-transform-origin': "50% 50% -" + swiperSize / 2 + "px",
61913                    'transform-origin': "50% 50% -" + swiperSize / 2 + "px"
61914                });
61915
61916                if (params.shadow) {
61917                    if (isHorizontal) {
61918                        $cubeShadowEl.transform("translate3d(0px, " + (swiperWidth / 2 + params.shadowOffset) + "px, " + -swiperWidth / 2 + "px) rotateX(90deg) rotateZ(0deg) scale(" + params.shadowScale + ")");
61919                    } else {
61920                        var shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90;
61921                        var multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2);
61922                        var scale1 = params.shadowScale;
61923                        var scale2 = params.shadowScale / multiplier;
61924                        var offset = params.shadowOffset;
61925                        $cubeShadowEl.transform("scale3d(" + scale1 + ", 1, " + scale2 + ") translate3d(0px, " + (swiperHeight / 2 + offset) + "px, " + -swiperHeight / 2 / scale2 + "px) rotateX(-90deg)");
61926                    }
61927                }
61928
61929                var zFactor = browser.isSafari || browser.isWebView ? -swiperSize / 2 : 0;
61930                $wrapperEl.transform("translate3d(0px,0," + zFactor + "px) rotateX(" + (swiper.isHorizontal() ? 0 : wrapperRotate) + "deg) rotateY(" + (swiper.isHorizontal() ? -wrapperRotate : 0) + "deg)");
61931            },
61932            setTransition: function setTransition(duration) {
61933                var swiper = this;
61934                var $el = swiper.$el,
61935                    slides = swiper.slides;
61936                slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
61937
61938                if (swiper.params.cubeEffect.shadow && !swiper.isHorizontal()) {
61939                    $el.find('.swiper-cube-shadow').transition(duration);
61940                }
61941            }
61942        };
61943        var _default = {
61944            name: 'effect-cube',
61945            params: {
61946                cubeEffect: {
61947                    slideShadows: true,
61948                    shadow: true,
61949                    shadowOffset: 20,
61950                    shadowScale: 0.94
61951                }
61952            },
61953            create: function create() {
61954                var swiper = this;
61955                (0, _utils.bindModuleMethods)(swiper, {
61956                    cubeEffect: _extends({}, Cube)
61957                });
61958            },
61959            on: {
61960                beforeInit: function beforeInit(swiper) {
61961                    if (swiper.params.effect !== 'cube') return;
61962                    swiper.classNames.push(swiper.params.containerModifierClass + "cube");
61963                    swiper.classNames.push(swiper.params.containerModifierClass + "3d");
61964                    var overwriteParams = {
61965                        slidesPerView: 1,
61966                        slidesPerColumn: 1,
61967                        slidesPerGroup: 1,
61968                        watchSlidesProgress: true,
61969                        resistanceRatio: 0,
61970                        spaceBetween: 0,
61971                        centeredSlides: false,
61972                        virtualTranslate: true
61973                    };
61974                    (0, _utils.extend)(swiper.params, overwriteParams);
61975                    (0, _utils.extend)(swiper.originalParams, overwriteParams);
61976                },
61977                setTranslate: function setTranslate(swiper) {
61978                    if (swiper.params.effect !== 'cube') return;
61979                    swiper.cubeEffect.setTranslate();
61980                },
61981                setTransition: function setTransition(swiper, duration) {
61982                    if (swiper.params.effect !== 'cube') return;
61983                    swiper.cubeEffect.setTransition(duration);
61984                }
61985            }
61986        };
61987        exports.default = _default;
61988    }, {"../../utils/dom": 94, "../../utils/utils": 98}],
61989    78: [function (require, module, exports) {
61990        "use strict";
61991
61992        exports.__esModule = true;
61993        exports.default = void 0;
61994
61995        var _utils = require("../../utils/utils");
61996
61997        function _extends() {
61998            _extends = Object.assign || function (target) {
61999                for (var i = 1; i < arguments.length; i++) {
62000                    var source = arguments[i];
62001                    for (var key in source) {
62002                        if (Object.prototype.hasOwnProperty.call(source, key)) {
62003                            target[key] = source[key];
62004                        }
62005                    }
62006                }
62007                return target;
62008            };
62009            return _extends.apply(this, arguments);
62010        }
62011
62012        var Fade = {
62013            setTranslate: function setTranslate() {
62014                var swiper = this;
62015                var slides = swiper.slides;
62016
62017                for (var i = 0; i < slides.length; i += 1) {
62018                    var $slideEl = swiper.slides.eq(i);
62019                    var offset = $slideEl[0].swiperSlideOffset;
62020                    var tx = -offset;
62021                    if (!swiper.params.virtualTranslate) tx -= swiper.translate;
62022                    var ty = 0;
62023
62024                    if (!swiper.isHorizontal()) {
62025                        ty = tx;
62026                        tx = 0;
62027                    }
62028
62029                    var slideOpacity = swiper.params.fadeEffect.crossFade ? Math.max(1 - Math.abs($slideEl[0].progress), 0) : 1 + Math.min(Math.max($slideEl[0].progress, -1), 0);
62030                    $slideEl.css({
62031                        opacity: slideOpacity
62032                    }).transform("translate3d(" + tx + "px, " + ty + "px, 0px)");
62033                }
62034            },
62035            setTransition: function setTransition(duration) {
62036                var swiper = this;
62037                var slides = swiper.slides,
62038                    $wrapperEl = swiper.$wrapperEl;
62039                slides.transition(duration);
62040
62041                if (swiper.params.virtualTranslate && duration !== 0) {
62042                    var eventTriggered = false;
62043                    slides.transitionEnd(function () {
62044                        if (eventTriggered) return;
62045                        if (!swiper || swiper.destroyed) return;
62046                        eventTriggered = true;
62047                        swiper.animating = false;
62048                        var triggerEvents = ['webkitTransitionEnd', 'transitionend'];
62049
62050                        for (var i = 0; i < triggerEvents.length; i += 1) {
62051                            $wrapperEl.trigger(triggerEvents[i]);
62052                        }
62053                    });
62054                }
62055            }
62056        };
62057        var _default = {
62058            name: 'effect-fade',
62059            params: {
62060                fadeEffect: {
62061                    crossFade: false
62062                }
62063            },
62064            create: function create() {
62065                var swiper = this;
62066                (0, _utils.bindModuleMethods)(swiper, {
62067                    fadeEffect: _extends({}, Fade)
62068                });
62069            },
62070            on: {
62071                beforeInit: function beforeInit(swiper) {
62072                    if (swiper.params.effect !== 'fade') return;
62073                    swiper.classNames.push(swiper.params.containerModifierClass + "fade");
62074                    var overwriteParams = {
62075                        slidesPerView: 1,
62076                        slidesPerColumn: 1,
62077                        slidesPerGroup: 1,
62078                        watchSlidesProgress: true,
62079                        spaceBetween: 0,
62080                        virtualTranslate: true
62081                    };
62082                    (0, _utils.extend)(swiper.params, overwriteParams);
62083                    (0, _utils.extend)(swiper.originalParams, overwriteParams);
62084                },
62085                setTranslate: function setTranslate(swiper) {
62086                    if (swiper.params.effect !== 'fade') return;
62087                    swiper.fadeEffect.setTranslate();
62088                },
62089                setTransition: function setTransition(swiper, duration) {
62090                    if (swiper.params.effect !== 'fade') return;
62091                    swiper.fadeEffect.setTransition(duration);
62092                }
62093            }
62094        };
62095        exports.default = _default;
62096    }, {"../../utils/utils": 98}],
62097    79: [function (require, module, exports) {
62098        "use strict";
62099
62100        exports.__esModule = true;
62101        exports.default = void 0;
62102
62103        var _dom = _interopRequireDefault(require("../../utils/dom"));
62104
62105        var _utils = require("../../utils/utils");
62106
62107        function _interopRequireDefault(obj) {
62108            return obj && obj.__esModule ? obj : {default: obj};
62109        }
62110
62111        function _extends() {
62112            _extends = Object.assign || function (target) {
62113                for (var i = 1; i < arguments.length; i++) {
62114                    var source = arguments[i];
62115                    for (var key in source) {
62116                        if (Object.prototype.hasOwnProperty.call(source, key)) {
62117                            target[key] = source[key];
62118                        }
62119                    }
62120                }
62121                return target;
62122            };
62123            return _extends.apply(this, arguments);
62124        }
62125
62126        var Flip = {
62127            setTranslate: function setTranslate() {
62128                var swiper = this;
62129                var slides = swiper.slides,
62130                    rtl = swiper.rtlTranslate;
62131
62132                for (var i = 0; i < slides.length; i += 1) {
62133                    var $slideEl = slides.eq(i);
62134                    var progress = $slideEl[0].progress;
62135
62136                    if (swiper.params.flipEffect.limitRotation) {
62137                        progress = Math.max(Math.min($slideEl[0].progress, 1), -1);
62138                    }
62139
62140                    var offset = $slideEl[0].swiperSlideOffset;
62141                    var rotate = -180 * progress;
62142                    var rotateY = rotate;
62143                    var rotateX = 0;
62144                    var tx = -offset;
62145                    var ty = 0;
62146
62147                    if (!swiper.isHorizontal()) {
62148                        ty = tx;
62149                        tx = 0;
62150                        rotateX = -rotateY;
62151                        rotateY = 0;
62152                    } else if (rtl) {
62153                        rotateY = -rotateY;
62154                    }
62155
62156                    $slideEl[0].style.zIndex = -Math.abs(Math.round(progress)) + slides.length;
62157
62158                    if (swiper.params.flipEffect.slideShadows) {
62159                        // Set shadows
62160                        var shadowBefore = swiper.isHorizontal() ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top');
62161                        var shadowAfter = swiper.isHorizontal() ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom');
62162
62163                        if (shadowBefore.length === 0) {
62164                            shadowBefore = (0, _dom.default)("<div class=\"swiper-slide-shadow-" + (swiper.isHorizontal() ? 'left' : 'top') + "\"></div>");
62165                            $slideEl.append(shadowBefore);
62166                        }
62167
62168                        if (shadowAfter.length === 0) {
62169                            shadowAfter = (0, _dom.default)("<div class=\"swiper-slide-shadow-" + (swiper.isHorizontal() ? 'right' : 'bottom') + "\"></div>");
62170                            $slideEl.append(shadowAfter);
62171                        }
62172
62173                        if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0);
62174                        if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0);
62175                    }
62176
62177                    $slideEl.transform("translate3d(" + tx + "px, " + ty + "px, 0px) rotateX(" + rotateX + "deg) rotateY(" + rotateY + "deg)");
62178                }
62179            },
62180            setTransition: function setTransition(duration) {
62181                var swiper = this;
62182                var slides = swiper.slides,
62183                    activeIndex = swiper.activeIndex,
62184                    $wrapperEl = swiper.$wrapperEl;
62185                slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
62186
62187                if (swiper.params.virtualTranslate && duration !== 0) {
62188                    var eventTriggered = false; // eslint-disable-next-line
62189
62190                    slides.eq(activeIndex).transitionEnd(function onTransitionEnd() {
62191                        if (eventTriggered) return;
62192                        if (!swiper || swiper.destroyed) return; // if (!$(this).hasClass(swiper.params.slideActiveClass)) return;
62193
62194                        eventTriggered = true;
62195                        swiper.animating = false;
62196                        var triggerEvents = ['webkitTransitionEnd', 'transitionend'];
62197
62198                        for (var i = 0; i < triggerEvents.length; i += 1) {
62199                            $wrapperEl.trigger(triggerEvents[i]);
62200                        }
62201                    });
62202                }
62203            }
62204        };
62205        var _default = {
62206            name: 'effect-flip',
62207            params: {
62208                flipEffect: {
62209                    slideShadows: true,
62210                    limitRotation: true
62211                }
62212            },
62213            create: function create() {
62214                var swiper = this;
62215                (0, _utils.bindModuleMethods)(swiper, {
62216                    flipEffect: _extends({}, Flip)
62217                });
62218            },
62219            on: {
62220                beforeInit: function beforeInit(swiper) {
62221                    if (swiper.params.effect !== 'flip') return;
62222                    swiper.classNames.push(swiper.params.containerModifierClass + "flip");
62223                    swiper.classNames.push(swiper.params.containerModifierClass + "3d");
62224                    var overwriteParams = {
62225                        slidesPerView: 1,
62226                        slidesPerColumn: 1,
62227                        slidesPerGroup: 1,
62228                        watchSlidesProgress: true,
62229                        spaceBetween: 0,
62230                        virtualTranslate: true
62231                    };
62232                    (0, _utils.extend)(swiper.params, overwriteParams);
62233                    (0, _utils.extend)(swiper.originalParams, overwriteParams);
62234                },
62235                setTranslate: function setTranslate(swiper) {
62236                    if (swiper.params.effect !== 'flip') return;
62237                    swiper.flipEffect.setTranslate();
62238                },
62239                setTransition: function setTransition(swiper, duration) {
62240                    if (swiper.params.effect !== 'flip') return;
62241                    swiper.flipEffect.setTransition(duration);
62242                }
62243            }
62244        };
62245        exports.default = _default;
62246    }, {"../../utils/dom": 94, "../../utils/utils": 98}],
62247    80: [function (require, module, exports) {
62248        "use strict";
62249
62250        exports.__esModule = true;
62251        exports.default = void 0;
62252
62253        var _ssrWindow = require("ssr-window");
62254
62255        var _dom = _interopRequireDefault(require("../../utils/dom"));
62256
62257        var _utils = require("../../utils/utils");
62258
62259        function _interopRequireDefault(obj) {
62260            return obj && obj.__esModule ? obj : {default: obj};
62261        }
62262
62263        function _extends() {
62264            _extends = Object.assign || function (target) {
62265                for (var i = 1; i < arguments.length; i++) {
62266                    var source = arguments[i];
62267                    for (var key in source) {
62268                        if (Object.prototype.hasOwnProperty.call(source, key)) {
62269                            target[key] = source[key];
62270                        }
62271                    }
62272                }
62273                return target;
62274            };
62275            return _extends.apply(this, arguments);
62276        }
62277
62278        var HashNavigation = {
62279            onHashCange: function onHashCange() {
62280                var swiper = this;
62281                var document = (0, _ssrWindow.getDocument)();
62282                swiper.emit('hashChange');
62283                var newHash = document.location.hash.replace('#', '');
62284                var activeSlideHash = swiper.slides.eq(swiper.activeIndex).attr('data-hash');
62285
62286                if (newHash !== activeSlideHash) {
62287                    var newIndex = swiper.$wrapperEl.children("." + swiper.params.slideClass + "[data-hash=\"" + newHash + "\"]").index();
62288                    if (typeof newIndex === 'undefined') return;
62289                    swiper.slideTo(newIndex);
62290                }
62291            },
62292            setHash: function setHash() {
62293                var swiper = this;
62294                var window = (0, _ssrWindow.getWindow)();
62295                var document = (0, _ssrWindow.getDocument)();
62296                if (!swiper.hashNavigation.initialized || !swiper.params.hashNavigation.enabled) return;
62297
62298                if (swiper.params.hashNavigation.replaceState && window.history && window.history.replaceState) {
62299                    window.history.replaceState(null, null, "#" + swiper.slides.eq(swiper.activeIndex).attr('data-hash') || '');
62300                    swiper.emit('hashSet');
62301                } else {
62302                    var slide = swiper.slides.eq(swiper.activeIndex);
62303                    var hash = slide.attr('data-hash') || slide.attr('data-history');
62304                    document.location.hash = hash || '';
62305                    swiper.emit('hashSet');
62306                }
62307            },
62308            init: function init() {
62309                var swiper = this;
62310                var document = (0, _ssrWindow.getDocument)();
62311                var window = (0, _ssrWindow.getWindow)();
62312                if (!swiper.params.hashNavigation.enabled || swiper.params.history && swiper.params.history.enabled) return;
62313                swiper.hashNavigation.initialized = true;
62314                var hash = document.location.hash.replace('#', '');
62315
62316                if (hash) {
62317                    var speed = 0;
62318
62319                    for (var i = 0, length = swiper.slides.length; i < length; i += 1) {
62320                        var slide = swiper.slides.eq(i);
62321                        var slideHash = slide.attr('data-hash') || slide.attr('data-history');
62322
62323                        if (slideHash === hash && !slide.hasClass(swiper.params.slideDuplicateClass)) {
62324                            var index = slide.index();
62325                            swiper.slideTo(index, speed, swiper.params.runCallbacksOnInit, true);
62326                        }
62327                    }
62328                }
62329
62330                if (swiper.params.hashNavigation.watchState) {
62331                    (0, _dom.default)(window).on('hashchange', swiper.hashNavigation.onHashCange);
62332                }
62333            },
62334            destroy: function destroy() {
62335                var swiper = this;
62336                var window = (0, _ssrWindow.getWindow)();
62337
62338                if (swiper.params.hashNavigation.watchState) {
62339                    (0, _dom.default)(window).off('hashchange', swiper.hashNavigation.onHashCange);
62340                }
62341            }
62342        };
62343        var _default = {
62344            name: 'hash-navigation',
62345            params: {
62346                hashNavigation: {
62347                    enabled: false,
62348                    replaceState: false,
62349                    watchState: false
62350                }
62351            },
62352            create: function create() {
62353                var swiper = this;
62354                (0, _utils.bindModuleMethods)(swiper, {
62355                    hashNavigation: _extends({
62356                        initialized: false
62357                    }, HashNavigation)
62358                });
62359            },
62360            on: {
62361                init: function init(swiper) {
62362                    if (swiper.params.hashNavigation.enabled) {
62363                        swiper.hashNavigation.init();
62364                    }
62365                },
62366                destroy: function destroy(swiper) {
62367                    if (swiper.params.hashNavigation.enabled) {
62368                        swiper.hashNavigation.destroy();
62369                    }
62370                },
62371                transitionEnd: function transitionEnd(swiper) {
62372                    if (swiper.hashNavigation.initialized) {
62373                        swiper.hashNavigation.setHash();
62374                    }
62375                },
62376                slideChange: function slideChange(swiper) {
62377                    if (swiper.hashNavigation.initialized && swiper.params.cssMode) {
62378                        swiper.hashNavigation.setHash();
62379                    }
62380                }
62381            }
62382        };
62383        exports.default = _default;
62384    }, {"../../utils/dom": 94, "../../utils/utils": 98, "ssr-window": 10}],
62385    81: [function (require, module, exports) {
62386        "use strict";
62387
62388        exports.__esModule = true;
62389        exports.default = void 0;
62390
62391        var _ssrWindow = require("ssr-window");
62392
62393        var _utils = require("../../utils/utils");
62394
62395        function _extends() {
62396            _extends = Object.assign || function (target) {
62397                for (var i = 1; i < arguments.length; i++) {
62398                    var source = arguments[i];
62399                    for (var key in source) {
62400                        if (Object.prototype.hasOwnProperty.call(source, key)) {
62401                            target[key] = source[key];
62402                        }
62403                    }
62404                }
62405                return target;
62406            };
62407            return _extends.apply(this, arguments);
62408        }
62409
62410        var History = {
62411            init: function init() {
62412                var swiper = this;
62413                var window = (0, _ssrWindow.getWindow)();
62414                if (!swiper.params.history) return;
62415
62416                if (!window.history || !window.history.pushState) {
62417                    swiper.params.history.enabled = false;
62418                    swiper.params.hashNavigation.enabled = true;
62419                    return;
62420                }
62421
62422                var history = swiper.history;
62423                history.initialized = true;
62424                history.paths = History.getPathValues(swiper.params.url);
62425                if (!history.paths.key && !history.paths.value) return;
62426                history.scrollToSlide(0, history.paths.value, swiper.params.runCallbacksOnInit);
62427
62428                if (!swiper.params.history.replaceState) {
62429                    window.addEventListener('popstate', swiper.history.setHistoryPopState);
62430                }
62431            },
62432            destroy: function destroy() {
62433                var swiper = this;
62434                var window = (0, _ssrWindow.getWindow)();
62435
62436                if (!swiper.params.history.replaceState) {
62437                    window.removeEventListener('popstate', swiper.history.setHistoryPopState);
62438                }
62439            },
62440            setHistoryPopState: function setHistoryPopState() {
62441                var swiper = this;
62442                swiper.history.paths = History.getPathValues(swiper.params.url);
62443                swiper.history.scrollToSlide(swiper.params.speed, swiper.history.paths.value, false);
62444            },
62445            getPathValues: function getPathValues(urlOverride) {
62446                var window = (0, _ssrWindow.getWindow)();
62447                var location;
62448
62449                if (urlOverride) {
62450                    location = new URL(urlOverride);
62451                } else {
62452                    location = window.location;
62453                }
62454
62455                var pathArray = location.pathname.slice(1).split('/').filter(function (part) {
62456                    return part !== '';
62457                });
62458                var total = pathArray.length;
62459                var key = pathArray[total - 2];
62460                var value = pathArray[total - 1];
62461                return {
62462                    key: key,
62463                    value: value
62464                };
62465            },
62466            setHistory: function setHistory(key, index) {
62467                var swiper = this;
62468                var window = (0, _ssrWindow.getWindow)();
62469                if (!swiper.history.initialized || !swiper.params.history.enabled) return;
62470                var location;
62471
62472                if (swiper.params.url) {
62473                    location = new URL(swiper.params.url);
62474                } else {
62475                    location = window.location;
62476                }
62477
62478                var slide = swiper.slides.eq(index);
62479                var value = History.slugify(slide.attr('data-history'));
62480
62481                if (!location.pathname.includes(key)) {
62482                    value = key + "/" + value;
62483                }
62484
62485                var currentState = window.history.state;
62486
62487                if (currentState && currentState.value === value) {
62488                    return;
62489                }
62490
62491                if (swiper.params.history.replaceState) {
62492                    window.history.replaceState({
62493                        value: value
62494                    }, null, value);
62495                } else {
62496                    window.history.pushState({
62497                        value: value
62498                    }, null, value);
62499                }
62500            },
62501            slugify: function slugify(text) {
62502                return text.toString().replace(/\s+/g, '-').replace(/[^\w-]+/g, '').replace(/--+/g, '-').replace(/^-+/, '').replace(/-+$/, '');
62503            },
62504            scrollToSlide: function scrollToSlide(speed, value, runCallbacks) {
62505                var swiper = this;
62506
62507                if (value) {
62508                    for (var i = 0, length = swiper.slides.length; i < length; i += 1) {
62509                        var slide = swiper.slides.eq(i);
62510                        var slideHistory = History.slugify(slide.attr('data-history'));
62511
62512                        if (slideHistory === value && !slide.hasClass(swiper.params.slideDuplicateClass)) {
62513                            var index = slide.index();
62514                            swiper.slideTo(index, speed, runCallbacks);
62515                        }
62516                    }
62517                } else {
62518                    swiper.slideTo(0, speed, runCallbacks);
62519                }
62520            }
62521        };
62522        var _default = {
62523            name: 'history',
62524            params: {
62525                history: {
62526                    enabled: false,
62527                    replaceState: false,
62528                    key: 'slides'
62529                }
62530            },
62531            create: function create() {
62532                var swiper = this;
62533                (0, _utils.bindModuleMethods)(swiper, {
62534                    history: _extends({}, History)
62535                });
62536            },
62537            on: {
62538                init: function init(swiper) {
62539                    if (swiper.params.history.enabled) {
62540                        swiper.history.init();
62541                    }
62542                },
62543                destroy: function destroy(swiper) {
62544                    if (swiper.params.history.enabled) {
62545                        swiper.history.destroy();
62546                    }
62547                },
62548                transitionEnd: function transitionEnd(swiper) {
62549                    if (swiper.history.initialized) {
62550                        swiper.history.setHistory(swiper.params.history.key, swiper.activeIndex);
62551                    }
62552                },
62553                slideChange: function slideChange(swiper) {
62554                    if (swiper.history.initialized && swiper.params.cssMode) {
62555                        swiper.history.setHistory(swiper.params.history.key, swiper.activeIndex);
62556                    }
62557                }
62558            }
62559        };
62560        exports.default = _default;
62561    }, {"../../utils/utils": 98, "ssr-window": 10}],
62562    82: [function (require, module, exports) {
62563        "use strict";
62564
62565        exports.__esModule = true;
62566        exports.default = void 0;
62567
62568        var _ssrWindow = require("ssr-window");
62569
62570        var _dom = _interopRequireDefault(require("../../utils/dom"));
62571
62572        var _utils = require("../../utils/utils");
62573
62574        function _interopRequireDefault(obj) {
62575            return obj && obj.__esModule ? obj : {default: obj};
62576        }
62577
62578        function _extends() {
62579            _extends = Object.assign || function (target) {
62580                for (var i = 1; i < arguments.length; i++) {
62581                    var source = arguments[i];
62582                    for (var key in source) {
62583                        if (Object.prototype.hasOwnProperty.call(source, key)) {
62584                            target[key] = source[key];
62585                        }
62586                    }
62587                }
62588                return target;
62589            };
62590            return _extends.apply(this, arguments);
62591        }
62592
62593        var Keyboard = {
62594            handle: function handle(event) {
62595                var swiper = this;
62596                var window = (0, _ssrWindow.getWindow)();
62597                var document = (0, _ssrWindow.getDocument)();
62598                var rtl = swiper.rtlTranslate;
62599                var e = event;
62600                if (e.originalEvent) e = e.originalEvent; // jquery fix
62601
62602                var kc = e.keyCode || e.charCode;
62603                var pageUpDown = swiper.params.keyboard.pageUpDown;
62604                var isPageUp = pageUpDown && kc === 33;
62605                var isPageDown = pageUpDown && kc === 34;
62606                var isArrowLeft = kc === 37;
62607                var isArrowRight = kc === 39;
62608                var isArrowUp = kc === 38;
62609                var isArrowDown = kc === 40; // Directions locks
62610
62611                if (!swiper.allowSlideNext && (swiper.isHorizontal() && isArrowRight || swiper.isVertical() && isArrowDown || isPageDown)) {
62612                    return false;
62613                }
62614
62615                if (!swiper.allowSlidePrev && (swiper.isHorizontal() && isArrowLeft || swiper.isVertical() && isArrowUp || isPageUp)) {
62616                    return false;
62617                }
62618
62619                if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {
62620                    return undefined;
62621                }
62622
62623                if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) {
62624                    return undefined;
62625                }
62626
62627                if (swiper.params.keyboard.onlyInViewport && (isPageUp || isPageDown || isArrowLeft || isArrowRight || isArrowUp || isArrowDown)) {
62628                    var inView = false; // Check that swiper should be inside of visible area of window
62629
62630                    if (swiper.$el.parents("." + swiper.params.slideClass).length > 0 && swiper.$el.parents("." + swiper.params.slideActiveClass).length === 0) {
62631                        return undefined;
62632                    }
62633
62634                    var windowWidth = window.innerWidth;
62635                    var windowHeight = window.innerHeight;
62636                    var swiperOffset = swiper.$el.offset();
62637                    if (rtl) swiperOffset.left -= swiper.$el[0].scrollLeft;
62638                    var swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + swiper.width, swiperOffset.top], [swiperOffset.left, swiperOffset.top + swiper.height], [swiperOffset.left + swiper.width, swiperOffset.top + swiper.height]];
62639
62640                    for (var i = 0; i < swiperCoord.length; i += 1) {
62641                        var point = swiperCoord[i];
62642
62643                        if (point[0] >= 0 && point[0] <= windowWidth && point[1] >= 0 && point[1] <= windowHeight) {
62644                            inView = true;
62645                        }
62646                    }
62647
62648                    if (!inView) return undefined;
62649                }
62650
62651                if (swiper.isHorizontal()) {
62652                    if (isPageUp || isPageDown || isArrowLeft || isArrowRight) {
62653                        if (e.preventDefault) e.preventDefault(); else e.returnValue = false;
62654                    }
62655
62656                    if ((isPageDown || isArrowRight) && !rtl || (isPageUp || isArrowLeft) && rtl) swiper.slideNext();
62657                    if ((isPageUp || isArrowLeft) && !rtl || (isPageDown || isArrowRight) && rtl) swiper.slidePrev();
62658                } else {
62659                    if (isPageUp || isPageDown || isArrowUp || isArrowDown) {
62660                        if (e.preventDefault) e.preventDefault(); else e.returnValue = false;
62661                    }
62662
62663                    if (isPageDown || isArrowDown) swiper.slideNext();
62664                    if (isPageUp || isArrowUp) swiper.slidePrev();
62665                }
62666
62667                swiper.emit('keyPress', kc);
62668                return undefined;
62669            },
62670            enable: function enable() {
62671                var swiper = this;
62672                var document = (0, _ssrWindow.getDocument)();
62673                if (swiper.keyboard.enabled) return;
62674                (0, _dom.default)(document).on('keydown', swiper.keyboard.handle);
62675                swiper.keyboard.enabled = true;
62676            },
62677            disable: function disable() {
62678                var swiper = this;
62679                var document = (0, _ssrWindow.getDocument)();
62680                if (!swiper.keyboard.enabled) return;
62681                (0, _dom.default)(document).off('keydown', swiper.keyboard.handle);
62682                swiper.keyboard.enabled = false;
62683            }
62684        };
62685        var _default = {
62686            name: 'keyboard',
62687            params: {
62688                keyboard: {
62689                    enabled: false,
62690                    onlyInViewport: true,
62691                    pageUpDown: true
62692                }
62693            },
62694            create: function create() {
62695                var swiper = this;
62696                (0, _utils.bindModuleMethods)(swiper, {
62697                    keyboard: _extends({
62698                        enabled: false
62699                    }, Keyboard)
62700                });
62701            },
62702            on: {
62703                init: function init(swiper) {
62704                    if (swiper.params.keyboard.enabled) {
62705                        swiper.keyboard.enable();
62706                    }
62707                },
62708                destroy: function destroy(swiper) {
62709                    if (swiper.keyboard.enabled) {
62710                        swiper.keyboard.disable();
62711                    }
62712                }
62713            }
62714        };
62715        exports.default = _default;
62716    }, {"../../utils/dom": 94, "../../utils/utils": 98, "ssr-window": 10}],
62717    83: [function (require, module, exports) {
62718        "use strict";
62719
62720        exports.__esModule = true;
62721        exports.default = void 0;
62722
62723        var _dom = _interopRequireDefault(require("../../utils/dom"));
62724
62725        var _utils = require("../../utils/utils");
62726
62727        function _interopRequireDefault(obj) {
62728            return obj && obj.__esModule ? obj : {default: obj};
62729        }
62730
62731        function _extends() {
62732            _extends = Object.assign || function (target) {
62733                for (var i = 1; i < arguments.length; i++) {
62734                    var source = arguments[i];
62735                    for (var key in source) {
62736                        if (Object.prototype.hasOwnProperty.call(source, key)) {
62737                            target[key] = source[key];
62738                        }
62739                    }
62740                }
62741                return target;
62742            };
62743            return _extends.apply(this, arguments);
62744        }
62745
62746        var Lazy = {
62747            loadInSlide: function loadInSlide(index, loadInDuplicate) {
62748                if (loadInDuplicate === void 0) {
62749                    loadInDuplicate = true;
62750                }
62751
62752                var swiper = this;
62753                var params = swiper.params.lazy;
62754                if (typeof index === 'undefined') return;
62755                if (swiper.slides.length === 0) return;
62756                var isVirtual = swiper.virtual && swiper.params.virtual.enabled;
62757                var $slideEl = isVirtual ? swiper.$wrapperEl.children("." + swiper.params.slideClass + "[data-swiper-slide-index=\"" + index + "\"]") : swiper.slides.eq(index);
62758                var $images = $slideEl.find("." + params.elementClass + ":not(." + params.loadedClass + "):not(." + params.loadingClass + ")");
62759
62760                if ($slideEl.hasClass(params.elementClass) && !$slideEl.hasClass(params.loadedClass) && !$slideEl.hasClass(params.loadingClass)) {
62761                    $images.push($slideEl[0]);
62762                }
62763
62764                if ($images.length === 0) return;
62765                $images.each(function (imageEl) {
62766                    var $imageEl = (0, _dom.default)(imageEl);
62767                    $imageEl.addClass(params.loadingClass);
62768                    var background = $imageEl.attr('data-background');
62769                    var src = $imageEl.attr('data-src');
62770                    var srcset = $imageEl.attr('data-srcset');
62771                    var sizes = $imageEl.attr('data-sizes');
62772                    var $pictureEl = $imageEl.parent('picture');
62773                    swiper.loadImage($imageEl[0], src || background, srcset, sizes, false, function () {
62774                        if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper && !swiper.params || swiper.destroyed) return;
62775
62776                        if (background) {
62777                            $imageEl.css('background-image', "url(\"" + background + "\")");
62778                            $imageEl.removeAttr('data-background');
62779                        } else {
62780                            if (srcset) {
62781                                $imageEl.attr('srcset', srcset);
62782                                $imageEl.removeAttr('data-srcset');
62783                            }
62784
62785                            if (sizes) {
62786                                $imageEl.attr('sizes', sizes);
62787                                $imageEl.removeAttr('data-sizes');
62788                            }
62789
62790                            if ($pictureEl.length) {
62791                                $pictureEl.children('source').each(function (sourceEl) {
62792                                    var $source = (0, _dom.default)(sourceEl);
62793
62794                                    if ($source.attr('data-srcset')) {
62795                                        $source.attr('srcset', $source.attr('data-srcset'));
62796                                        $source.removeAttr('data-srcset');
62797                                    }
62798                                });
62799                            }
62800
62801                            if (src) {
62802                                $imageEl.attr('src', src);
62803                                $imageEl.removeAttr('data-src');
62804                            }
62805                        }
62806
62807                        $imageEl.addClass(params.loadedClass).removeClass(params.loadingClass);
62808                        $slideEl.find("." + params.preloaderClass).remove();
62809
62810                        if (swiper.params.loop && loadInDuplicate) {
62811                            var slideOriginalIndex = $slideEl.attr('data-swiper-slide-index');
62812
62813                            if ($slideEl.hasClass(swiper.params.slideDuplicateClass)) {
62814                                var originalSlide = swiper.$wrapperEl.children("[data-swiper-slide-index=\"" + slideOriginalIndex + "\"]:not(." + swiper.params.slideDuplicateClass + ")");
62815                                swiper.lazy.loadInSlide(originalSlide.index(), false);
62816                            } else {
62817                                var duplicatedSlide = swiper.$wrapperEl.children("." + swiper.params.slideDuplicateClass + "[data-swiper-slide-index=\"" + slideOriginalIndex + "\"]");
62818                                swiper.lazy.loadInSlide(duplicatedSlide.index(), false);
62819                            }
62820                        }
62821
62822                        swiper.emit('lazyImageReady', $slideEl[0], $imageEl[0]);
62823
62824                        if (swiper.params.autoHeight) {
62825                            swiper.updateAutoHeight();
62826                        }
62827                    });
62828                    swiper.emit('lazyImageLoad', $slideEl[0], $imageEl[0]);
62829                });
62830            },
62831            load: function load() {
62832                var swiper = this;
62833                var $wrapperEl = swiper.$wrapperEl,
62834                    swiperParams = swiper.params,
62835                    slides = swiper.slides,
62836                    activeIndex = swiper.activeIndex;
62837                var isVirtual = swiper.virtual && swiperParams.virtual.enabled;
62838                var params = swiperParams.lazy;
62839                var slidesPerView = swiperParams.slidesPerView;
62840
62841                if (slidesPerView === 'auto') {
62842                    slidesPerView = 0;
62843                }
62844
62845                function slideExist(index) {
62846                    if (isVirtual) {
62847                        if ($wrapperEl.children("." + swiperParams.slideClass + "[data-swiper-slide-index=\"" + index + "\"]").length) {
62848                            return true;
62849                        }
62850                    } else if (slides[index]) return true;
62851
62852                    return false;
62853                }
62854
62855                function slideIndex(slideEl) {
62856                    if (isVirtual) {
62857                        return (0, _dom.default)(slideEl).attr('data-swiper-slide-index');
62858                    }
62859
62860                    return (0, _dom.default)(slideEl).index();
62861                }
62862
62863                if (!swiper.lazy.initialImageLoaded) swiper.lazy.initialImageLoaded = true;
62864
62865                if (swiper.params.watchSlidesVisibility) {
62866                    $wrapperEl.children("." + swiperParams.slideVisibleClass).each(function (slideEl) {
62867                        var index = isVirtual ? (0, _dom.default)(slideEl).attr('data-swiper-slide-index') : (0, _dom.default)(slideEl).index();
62868                        swiper.lazy.loadInSlide(index);
62869                    });
62870                } else if (slidesPerView > 1) {
62871                    for (var i = activeIndex; i < activeIndex + slidesPerView; i += 1) {
62872                        if (slideExist(i)) swiper.lazy.loadInSlide(i);
62873                    }
62874                } else {
62875                    swiper.lazy.loadInSlide(activeIndex);
62876                }
62877
62878                if (params.loadPrevNext) {
62879                    if (slidesPerView > 1 || params.loadPrevNextAmount && params.loadPrevNextAmount > 1) {
62880                        var amount = params.loadPrevNextAmount;
62881                        var spv = slidesPerView;
62882                        var maxIndex = Math.min(activeIndex + spv + Math.max(amount, spv), slides.length);
62883                        var minIndex = Math.max(activeIndex - Math.max(spv, amount), 0); // Next Slides
62884
62885                        for (var _i = activeIndex + slidesPerView; _i < maxIndex; _i += 1) {
62886                            if (slideExist(_i)) swiper.lazy.loadInSlide(_i);
62887                        } // Prev Slides
62888
62889
62890                        for (var _i2 = minIndex; _i2 < activeIndex; _i2 += 1) {
62891                            if (slideExist(_i2)) swiper.lazy.loadInSlide(_i2);
62892                        }
62893                    } else {
62894                        var nextSlide = $wrapperEl.children("." + swiperParams.slideNextClass);
62895                        if (nextSlide.length > 0) swiper.lazy.loadInSlide(slideIndex(nextSlide));
62896                        var prevSlide = $wrapperEl.children("." + swiperParams.slidePrevClass);
62897                        if (prevSlide.length > 0) swiper.lazy.loadInSlide(slideIndex(prevSlide));
62898                    }
62899                }
62900            }
62901        };
62902        var _default = {
62903            name: 'lazy',
62904            params: {
62905                lazy: {
62906                    enabled: false,
62907                    loadPrevNext: false,
62908                    loadPrevNextAmount: 1,
62909                    loadOnTransitionStart: false,
62910                    elementClass: 'swiper-lazy',
62911                    loadingClass: 'swiper-lazy-loading',
62912                    loadedClass: 'swiper-lazy-loaded',
62913                    preloaderClass: 'swiper-lazy-preloader'
62914                }
62915            },
62916            create: function create() {
62917                var swiper = this;
62918                (0, _utils.bindModuleMethods)(swiper, {
62919                    lazy: _extends({
62920                        initialImageLoaded: false
62921                    }, Lazy)
62922                });
62923            },
62924            on: {
62925                beforeInit: function beforeInit(swiper) {
62926                    if (swiper.params.lazy.enabled && swiper.params.preloadImages) {
62927                        swiper.params.preloadImages = false;
62928                    }
62929                },
62930                init: function init(swiper) {
62931                    if (swiper.params.lazy.enabled && !swiper.params.loop && swiper.params.initialSlide === 0) {
62932                        swiper.lazy.load();
62933                    }
62934                },
62935                scroll: function scroll(swiper) {
62936                    if (swiper.params.freeMode && !swiper.params.freeModeSticky) {
62937                        swiper.lazy.load();
62938                    }
62939                },
62940                resize: function resize(swiper) {
62941                    if (swiper.params.lazy.enabled) {
62942                        swiper.lazy.load();
62943                    }
62944                },
62945                scrollbarDragMove: function scrollbarDragMove(swiper) {
62946                    if (swiper.params.lazy.enabled) {
62947                        swiper.lazy.load();
62948                    }
62949                },
62950                transitionStart: function transitionStart(swiper) {
62951                    if (swiper.params.lazy.enabled) {
62952                        if (swiper.params.lazy.loadOnTransitionStart || !swiper.params.lazy.loadOnTransitionStart && !swiper.lazy.initialImageLoaded) {
62953                            swiper.lazy.load();
62954                        }
62955                    }
62956                },
62957                transitionEnd: function transitionEnd(swiper) {
62958                    if (swiper.params.lazy.enabled && !swiper.params.lazy.loadOnTransitionStart) {
62959                        swiper.lazy.load();
62960                    }
62961                },
62962                slideChange: function slideChange(swiper) {
62963                    if (swiper.params.lazy.enabled && swiper.params.cssMode) {
62964                        swiper.lazy.load();
62965                    }
62966                }
62967            }
62968        };
62969        exports.default = _default;
62970    }, {"../../utils/dom": 94, "../../utils/utils": 98}],
62971    84: [function (require, module, exports) {
62972        "use strict";
62973
62974        exports.__esModule = true;
62975        exports.default = void 0;
62976
62977        var _ssrWindow = require("ssr-window");
62978
62979        var _dom = _interopRequireDefault(require("../../utils/dom"));
62980
62981        var _utils = require("../../utils/utils");
62982
62983        function _interopRequireDefault(obj) {
62984            return obj && obj.__esModule ? obj : {default: obj};
62985        }
62986
62987        function isEventSupported() {
62988            var document = (0, _ssrWindow.getDocument)();
62989            var eventName = 'onwheel';
62990            var isSupported = (eventName in document);
62991
62992            if (!isSupported) {
62993                var element = document.createElement('div');
62994                element.setAttribute(eventName, 'return;');
62995                isSupported = typeof element[eventName] === 'function';
62996            }
62997
62998            if (!isSupported && document.implementation && document.implementation.hasFeature && // always returns true in newer browsers as per the standard.
62999                // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
63000                document.implementation.hasFeature('', '') !== true) {
63001                // This is the only way to test support for the `wheel` event in IE9+.
63002                isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
63003            }
63004
63005            return isSupported;
63006        }
63007
63008        var Mousewheel = {
63009            lastScrollTime: (0, _utils.now)(),
63010            lastEventBeforeSnap: undefined,
63011            recentWheelEvents: [],
63012            event: function event() {
63013                var window = (0, _ssrWindow.getWindow)();
63014                if (window.navigator.userAgent.indexOf('firefox') > -1) return 'DOMMouseScroll';
63015                return isEventSupported() ? 'wheel' : 'mousewheel';
63016            },
63017            normalize: function normalize(e) {
63018                // Reasonable defaults
63019                var PIXEL_STEP = 10;
63020                var LINE_HEIGHT = 40;
63021                var PAGE_HEIGHT = 800;
63022                var sX = 0;
63023                var sY = 0; // spinX, spinY
63024
63025                var pX = 0;
63026                var pY = 0; // pixelX, pixelY
63027                // Legacy
63028
63029                if ('detail' in e) {
63030                    sY = e.detail;
63031                }
63032
63033                if ('wheelDelta' in e) {
63034                    sY = -e.wheelDelta / 120;
63035                }
63036
63037                if ('wheelDeltaY' in e) {
63038                    sY = -e.wheelDeltaY / 120;
63039                }
63040
63041                if ('wheelDeltaX' in e) {
63042                    sX = -e.wheelDeltaX / 120;
63043                } // side scrolling on FF with DOMMouseScroll
63044
63045
63046                if ('axis' in e && e.axis === e.HORIZONTAL_AXIS) {
63047                    sX = sY;
63048                    sY = 0;
63049                }
63050
63051                pX = sX * PIXEL_STEP;
63052                pY = sY * PIXEL_STEP;
63053
63054                if ('deltaY' in e) {
63055                    pY = e.deltaY;
63056                }
63057
63058                if ('deltaX' in e) {
63059                    pX = e.deltaX;
63060                }
63061
63062                if (e.shiftKey && !pX) {
63063                    // if user scrolls with shift he wants horizontal scroll
63064                    pX = pY;
63065                    pY = 0;
63066                }
63067
63068                if ((pX || pY) && e.deltaMode) {
63069                    if (e.deltaMode === 1) {
63070                        // delta in LINE units
63071                        pX *= LINE_HEIGHT;
63072                        pY *= LINE_HEIGHT;
63073                    } else {
63074                        // delta in PAGE units
63075                        pX *= PAGE_HEIGHT;
63076                        pY *= PAGE_HEIGHT;
63077                    }
63078                } // Fall-back if spin cannot be determined
63079
63080
63081                if (pX && !sX) {
63082                    sX = pX < 1 ? -1 : 1;
63083                }
63084
63085                if (pY && !sY) {
63086                    sY = pY < 1 ? -1 : 1;
63087                }
63088
63089                return {
63090                    spinX: sX,
63091                    spinY: sY,
63092                    pixelX: pX,
63093                    pixelY: pY
63094                };
63095            },
63096            handleMouseEnter: function handleMouseEnter() {
63097                var swiper = this;
63098                swiper.mouseEntered = true;
63099            },
63100            handleMouseLeave: function handleMouseLeave() {
63101                var swiper = this;
63102                swiper.mouseEntered = false;
63103            },
63104            handle: function handle(event) {
63105                var e = event;
63106                var swiper = this;
63107                var params = swiper.params.mousewheel;
63108
63109                if (swiper.params.cssMode) {
63110                    e.preventDefault();
63111                }
63112
63113                var target = swiper.$el;
63114
63115                if (swiper.params.mousewheel.eventsTarget !== 'container') {
63116                    target = (0, _dom.default)(swiper.params.mousewheel.eventsTarget);
63117                }
63118
63119                if (!swiper.mouseEntered && !target[0].contains(e.target) && !params.releaseOnEdges) return true;
63120                if (e.originalEvent) e = e.originalEvent; // jquery fix
63121
63122                var delta = 0;
63123                var rtlFactor = swiper.rtlTranslate ? -1 : 1;
63124                var data = Mousewheel.normalize(e);
63125
63126                if (params.forceToAxis) {
63127                    if (swiper.isHorizontal()) {
63128                        if (Math.abs(data.pixelX) > Math.abs(data.pixelY)) delta = -data.pixelX * rtlFactor; else return true;
63129                    } else if (Math.abs(data.pixelY) > Math.abs(data.pixelX)) delta = -data.pixelY; else return true;
63130                } else {
63131                    delta = Math.abs(data.pixelX) > Math.abs(data.pixelY) ? -data.pixelX * rtlFactor : -data.pixelY;
63132                }
63133
63134                if (delta === 0) return true;
63135                if (params.invert) delta = -delta;
63136
63137                if (!swiper.params.freeMode) {
63138                    // Register the new event in a variable which stores the relevant data
63139                    var newEvent = {
63140                        time: (0, _utils.now)(),
63141                        delta: Math.abs(delta),
63142                        direction: Math.sign(delta),
63143                        raw: event
63144                    }; // Keep the most recent events
63145
63146                    var recentWheelEvents = swiper.mousewheel.recentWheelEvents;
63147
63148                    if (recentWheelEvents.length >= 2) {
63149                        recentWheelEvents.shift(); // only store the last N events
63150                    }
63151
63152                    var prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined;
63153                    recentWheelEvents.push(newEvent); // If there is at least one previous recorded event:
63154                    //   If direction has changed or
63155                    //   if the scroll is quicker than the previous one:
63156                    //     Animate the slider.
63157                    // Else (this is the first time the wheel is moved):
63158                    //     Animate the slider.
63159
63160                    if (prevEvent) {
63161                        if (newEvent.direction !== prevEvent.direction || newEvent.delta > prevEvent.delta || newEvent.time > prevEvent.time + 150) {
63162                            swiper.mousewheel.animateSlider(newEvent);
63163                        }
63164                    } else {
63165                        swiper.mousewheel.animateSlider(newEvent);
63166                    } // If it's time to release the scroll:
63167                    //   Return now so you don't hit the preventDefault.
63168
63169
63170                    if (swiper.mousewheel.releaseScroll(newEvent)) {
63171                        return true;
63172                    }
63173                } else {
63174                    // Freemode or scrollContainer:
63175                    // If we recently snapped after a momentum scroll, then ignore wheel events
63176                    // to give time for the deceleration to finish. Stop ignoring after 500 msecs
63177                    // or if it's a new scroll (larger delta or inverse sign as last event before
63178                    // an end-of-momentum snap).
63179                    var _newEvent = {
63180                        time: (0, _utils.now)(),
63181                        delta: Math.abs(delta),
63182                        direction: Math.sign(delta)
63183                    };
63184                    var lastEventBeforeSnap = swiper.mousewheel.lastEventBeforeSnap;
63185                    var ignoreWheelEvents = lastEventBeforeSnap && _newEvent.time < lastEventBeforeSnap.time + 500 && _newEvent.delta <= lastEventBeforeSnap.delta && _newEvent.direction === lastEventBeforeSnap.direction;
63186
63187                    if (!ignoreWheelEvents) {
63188                        swiper.mousewheel.lastEventBeforeSnap = undefined;
63189
63190                        if (swiper.params.loop) {
63191                            swiper.loopFix();
63192                        }
63193
63194                        var position = swiper.getTranslate() + delta * params.sensitivity;
63195                        var wasBeginning = swiper.isBeginning;
63196                        var wasEnd = swiper.isEnd;
63197                        if (position >= swiper.minTranslate()) position = swiper.minTranslate();
63198                        if (position <= swiper.maxTranslate()) position = swiper.maxTranslate();
63199                        swiper.setTransition(0);
63200                        swiper.setTranslate(position);
63201                        swiper.updateProgress();
63202                        swiper.updateActiveIndex();
63203                        swiper.updateSlidesClasses();
63204
63205                        if (!wasBeginning && swiper.isBeginning || !wasEnd && swiper.isEnd) {
63206                            swiper.updateSlidesClasses();
63207                        }
63208
63209                        if (swiper.params.freeModeSticky) {
63210                            // When wheel scrolling starts with sticky (aka snap) enabled, then detect
63211                            // the end of a momentum scroll by storing recent (N=15?) wheel events.
63212                            // 1. do all N events have decreasing or same (
63212absolute value) delta?
63213                            // 2. did all N events arrive in the last M (M=500?) msecs?
63214                            // 3. does the earliest event have an (absolute value) delta that's
63215                            //    at least P (P=1?) larger than the most recent event's delta?
63216                            // 4. does the latest event have a delta that's smaller than Q (Q=6?) pixels?
63217                            // If 1-4 are "yes" then we're near the end of a momentum scroll deceleration.
63218                            // Snap immediately and ignore remaining wheel events in this scroll.
63219                            // See comment above for "remaining wheel events in this scroll" determination.
63220                            // If 1-4 aren't satisfied, then wait to snap until 500ms after the last event.
63221                            clearTimeout(swiper.mousewheel.timeout);
63222                            swiper.mousewheel.timeout = undefined;
63223                            var _recentWheelEvents = swiper.mousewheel.recentWheelEvents;
63224
63225                            if (_recentWheelEvents.length >= 15) {
63226                                _recentWheelEvents.shift(); // only store the last N events
63227
63228                            }
63229
63230                            var _prevEvent = _recentWheelEvents.length ? _recentWheelEvents[_recentWheelEvents.length - 1] : undefined;
63231
63232                            var firstEvent = _recentWheelEvents[0];
63233
63234                            _recentWheelEvents.push(_newEvent);
63235
63236                            if (_prevEvent && (_newEvent.delta > _prevEvent.delta || _newEvent.direction !== _prevEvent.direction)) {
63237                                // Increasing or reverse-sign delta means the user started scrolling again. Clear the wheel event log.
63238                                _recentWheelEvents.splice(0);
63239                            } else if (_recentWheelEvents.length >= 15 && _newEvent.time - firstEvent.time < 500 && firstEvent.delta - _newEvent.delta >= 1 && _newEvent.delta <= 6) {
63240                                // We're at the end of the deceleration of a momentum scroll, so there's no need
63241                                // to wait for more events. Snap ASAP on the next tick.
63242                                // Also, because there's some remaining momentum we'll bias the snap in the
63243                                // direction of the ongoing scroll because it's better UX for the scroll to snap
63244                                // in the same direction as the scroll instead of reversing to snap.  Therefore,
63245                                // if it's already scrolled more than 20% in the current direction, keep going.
63246                                var snapToThreshold = delta > 0 ? 0.8 : 0.2;
63247                                swiper.mousewheel.lastEventBeforeSnap = _newEvent;
63248
63249                                _recentWheelEvents.splice(0);
63250
63251                                swiper.mousewheel.timeout = (0, _utils.nextTick)(function () {
63252                                    swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold);
63253                                }, 0); // no delay; move on next tick
63254                            }
63255
63256                            if (!swiper.mousewheel.timeout) {
63257                                // if we get here, then we haven't detected the end of a momentum scroll, so
63258                                // we'll consider a scroll "complete" when there haven't been any wheel events
63259                                // for 500ms.
63260                                swiper.mousewheel.timeout = (0, _utils.nextTick)(function () {
63261                                    var snapToThreshold = 0.5;
63262                                    swiper.mousewheel.lastEventBeforeSnap = _newEvent;
63263
63264                                    _recentWheelEvents.splice(0);
63265
63266                                    swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold);
63267                                }, 500);
63268                            }
63269                        } // Emit event
63270
63271
63272                        if (!ignoreWheelEvents) swiper.emit('scroll', e); // Stop autoplay
63273
63274                        if (swiper.params.autoplay && swiper.params.autoplayDisableOnInteraction) swiper.autoplay.stop(); // Return page scroll on edge positions
63275
63276                        if (position === swiper.minTranslate() || position === swiper.maxTranslate()) return true;
63277                    }
63278                }
63279
63280                if (e.preventDefault) e.preventDefault(); else e.returnValue = false;
63281                return false;
63282            },
63283            animateSlider: function animateSlider(newEvent) {
63284                var swiper = this;
63285                var window = (0, _ssrWindow.getWindow)();
63286
63287                if (this.params.mousewheel.thresholdDelta && newEvent.delta < this.params.mousewheel.thresholdDelta) {
63288                    // Prevent if delta of wheel scroll delta is below configured threshold
63289                    return false;
63290                }
63291
63292                if (this.params.mousewheel.thresholdTime && (0, _utils.now)() - swiper.mousewheel.lastScrollTime < this.params.mousewheel.thresholdTime) {
63293                    // Prevent if time between scrolls is below configured threshold
63294                    return false;
63295                } // If the movement is NOT big enough and
63296                // if the last time the user scrolled was too close to the current one (avoid continuously triggering the slider):
63297                //   Don't go any further (avoid insignificant scroll movement).
63298
63299
63300                if (newEvent.delta >= 6 && (0, _utils.now)() - swiper.mousewheel.lastScrollTime < 60) {
63301                    // Return false as a default
63302                    return true;
63303                } // If user is scrolling towards the end:
63304                //   If the slider hasn't hit the latest slide or
63305                //   if the slider is a loop and
63306                //   if the slider isn't moving right now:
63307                //     Go to next slide and
63308                //     emit a scroll event.
63309                // Else (the user is scrolling towards the beginning) and
63310                // if the slider hasn't hit the first slide or
63311                // if the slider is a loop and
63312                // if the slider isn't moving right now:
63313                //   Go to prev slide and
63314                //   emit a scroll event.
63315
63316
63317                if (newEvent.direction < 0) {
63318                    if ((!swiper.isEnd || swiper.params.loop) && !swiper.animating) {
63319                        swiper.slideNext();
63320                        swiper.emit('scroll', newEvent.raw);
63321                    }
63322                } else if ((!swiper.isBeginning || swiper.params.loop) && !swiper.animating) {
63323                    swiper.slidePrev();
63324                    swiper.emit('scroll', newEvent.raw);
63325                } // If you got here is because an animation has been triggered so store the current time
63326
63327
63328                swiper.mousewheel.lastScrollTime = new window.Date().getTime(); // Return false as a default
63329
63330                return false;
63331            },
63332            releaseScroll: function releaseScroll(newEvent) {
63333                var swiper = this;
63334                var params = swiper.params.mousewheel;
63335
63336                if (newEvent.direction < 0) {
63337                    if (swiper.isEnd && !swiper.params.loop && params.releaseOnEdges) {
63338                        // Return true to animate scroll on edges
63339                        return true;
63340                    }
63341                } else if (swiper.isBeginning && !swiper.params.loop && params.releaseOnEdges) {
63342                    // Return true to animate scroll on edges
63343                    return true;
63344                }
63345
63346                return false;
63347            },
63348            enable: function enable() {
63349                var swiper = this;
63350                var event = Mousewheel.event();
63351
63352                if (swiper.params.cssMode) {
63353                    swiper.wrapperEl.removeEventListener(event, swiper.mousewheel.handle);
63354                    return true;
63355                }
63356
63357                if (!event) return false;
63358                if (swiper.mousewheel.enabled) return false;
63359                var target = swiper.$el;
63360
63361                if (swiper.params.mousewheel.eventsTarget !== 'container') {
63362                    target = (0, _dom.default)(swiper.params.mousewheel.eventsTarget);
63363                }
63364
63365                target.on('mouseenter', swiper.mousewheel.handleMouseEnter);
63366                target.on('mouseleave', swiper.mousewheel.handleMouseLeave);
63367                target.on(event, swiper.mousewheel.handle);
63368                swiper.mousewheel.enabled = true;
63369                return true;
63370            },
63371            disable: function disable() {
63372                var swiper = this;
63373                var event = Mousewheel.event();
63374
63375                if (swiper.params.cssMode) {
63376                    swiper.wrapperEl.addEventListener(event, swiper.mousewheel.handle);
63377                    return true;
63378                }
63379
63380                if (!event) return false;
63381                if (!swiper.mousewheel.enabled) return false;
63382                var target = swiper.$el;
63383
63384                if (swiper.params.mousewheel.eventsTarget !== 'container') {
63385                    target = (0, _dom.default)(swiper.params.mousewheel.eventsTarget);
63386                }
63387
63388                target.off(event, swiper.mousewheel.handle);
63389                swiper.mousewheel.enabled = false;
63390                return true;
63391            }
63392        };
63393        var _default = {
63394            name: 'mousewheel',
63395            params: {
63396                mousewheel: {
63397                    enabled: false,
63398                    releaseOnEdges: false,
63399                    invert: false,
63400                    forceToAxis: false,
63401                    sensitivity: 1,
63402                    eventsTarget: 'container',
63403                    thresholdDelta: null,
63404                    thresholdTime: null
63405                }
63406            },
63407            create: function create() {
63408                var swiper = this;
63409                (0, _utils.bindModuleMethods)(swiper, {
63410                    mousewheel: {
63411                        enabled: false,
63412                        lastScrollTime: (0, _utils.now)(),
63413                        lastEventBeforeSnap: undefined,
63414                        recentWheelEvents: [],
63415                        enable: Mousewheel.enable,
63416                        disable: Mousewheel.disable,
63417                        handle: Mousewheel.handle,
63418                        handleMouseEnter: Mousewheel.handleMouseEnter,
63419                        handleMouseLeave: Mousewheel.handleMouseLeave,
63420                        animateSlider: Mousewheel.animateSlider,
63421                        releaseScroll: Mousewheel.releaseScroll
63422                    }
63423                });
63424            },
63425            on: {
63426                init: function init(swiper) {
63427                    if (!swiper.params.mousewheel.enabled && swiper.params.cssMode) {
63428                        swiper.mousewheel.disable();
63429                    }
63430
63431                    if (swiper.params.mousewheel.enabled) swiper.mousewheel.enable();
63432                },
63433                destroy: function destroy(swiper) {
63434                    if (swiper.params.cssMode) {
63435                        swiper.mousewheel.enable();
63436                    }
63437
63438                    if (swiper.mousewheel.enabled) swiper.mousewheel.disable();
63439                }
63440            }
63441        };
63442        exports.default = _default;
63443    }, {"../../utils/dom": 94, "../../utils/utils": 98, "ssr-window": 10}],
63444    85: [function (require, module, exports) {
63445        "use strict";
63446
63447        exports.__esModule = true;
63448        exports.default = void 0;
63449
63450        var _dom = _interopRequireDefault(require("../../utils/dom"));
63451
63452        var _utils = require("../../utils/utils");
63453
63454        function _interopRequireDefault(obj) {
63455            return obj && obj.__esModule ? obj : {default: obj};
63456        }
63457
63458        function _extends() {
63459            _extends = Object.assign || function (target) {
63460                for (var i = 1; i < arguments.length; i++) {
63461                    var source = arguments[i];
63462                    for (var key in source) {
63463                        if (Object.prototype.hasOwnProperty.call(source, key)) {
63464                            target[key] = source[key];
63465                        }
63466                    }
63467                }
63468                return target;
63469            };
63470            return _extends.apply(this, arguments);
63471        }
63472
63473        var Navigation = {
63474            update: function update() {
63475                // Update Navigation Buttons
63476                var swiper = this;
63477                var params = swiper.params.navigation;
63478                if (swiper.params.loop) return;
63479                var _swiper$navigation = swiper.navigation,
63480                    $nextEl = _swiper$navigation.$nextEl,
63481                    $prevEl = _swiper$navigation.$prevEl;
63482
63483                if ($prevEl && $prevEl.length > 0) {
63484                    if (swiper.isBeginning) {
63485                        $prevEl.addClass(params.disabledClass);
63486                    } else {
63487                        $prevEl.removeClass(params.disabledClass);
63488                    }
63489
63490                    $prevEl[swiper.params.watchOverflow && swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass);
63491                }
63492
63493                if ($nextEl && $nextEl.length > 0) {
63494                    if (swiper.isEnd) {
63495                        $nextEl.addClass(params.disabledClass);
63496                    } else {
63497                        $nextEl.removeClass(params.disabledClass);
63498                    }
63499
63500                    $nextEl[swiper.params.watchOverflow && swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass);
63501                }
63502            },
63503            onPrevClick: function onPrevClick(e) {
63504                var swiper = this;
63505                e.preventDefault();
63506                if (swiper.isBeginning && !swiper.params.loop) return;
63507                swiper.slidePrev();
63508            },
63509            onNextClick: function onNextClick(e) {
63510                var swiper = this;
63511                e.preventDefault();
63512                if (swiper.isEnd && !swiper.params.loop) return;
63513                swiper.slideNext();
63514            },
63515            init: function init() {
63516                var swiper = this;
63517                var params = swiper.params.navigation;
63518                if (!(params.nextEl || params.prevEl)) return;
63519                var $nextEl;
63520                var $prevEl;
63521
63522                if (params.nextEl) {
63523                    $nextEl = (0, _dom.default)(params.nextEl);
63524
63525                    if (swiper.params.uniqueNavElements && typeof params.nextEl === 'string' && $nextEl.length > 1 && swiper.$el.find(params.nextEl).length === 1) {
63526                        $nextEl = swiper.$el.find(params.nextEl);
63527                    }
63528                }
63529
63530                if (params.prevEl) {
63531                    $prevEl = (0, _dom.default)(params.prevEl);
63532
63533                    if (swiper.params.uniqueNavElements && typeof params.prevEl === 'string' && $prevEl.length > 1 && swiper.$el.find(params.prevEl).length === 1) {
63534                        $prevEl = swiper.$el.find(params.prevEl);
63535                    }
63536                }
63537
63538                if ($nextEl && $nextEl.length > 0) {
63539                    $nextEl.on('click', swiper.navigation.onNextClick);
63540                }
63541
63542                if ($prevEl && $prevEl.length > 0) {
63543                    $prevEl.on('click', swiper.navigation.onPrevClick);
63544                }
63545
63546                (0, _utils.extend)(swiper.navigation, {
63547                    $nextEl: $nextEl,
63548                    nextEl: $nextEl && $nextEl[0],
63549                    $prevEl: $prevEl,
63550                    prevEl: $prevEl && $prevEl[0]
63551                });
63552            },
63553            destroy: function destroy() {
63554                var swiper = this;
63555                var _swiper$navigation2 = swiper.navigation,
63556                    $nextEl = _swiper$navigation2.$nextEl,
63557                    $prevEl = _swiper$navigation2.$prevEl;
63558
63559                if ($nextEl && $nextEl.length) {
63560                    $nextEl.off('click', swiper.navigation.onNextClick);
63561                    $nextEl.removeClass(swiper.params.navigation.disabledClass);
63562                }
63563
63564                if ($prevEl && $prevEl.length) {
63565                    $prevEl.off('click', swiper.navigation.onPrevClick);
63566                    $prevEl.removeClass(swiper.params.navigation.disabledClass);
63567                }
63568            }
63569        };
63570        var _default = {
63571            name: 'navigation',
63572            params: {
63573                navigation: {
63574                    nextEl: null,
63575                    prevEl: null,
63576                    hideOnClick: false,
63577                    disabledClass: 'swiper-button-disabled',
63578                    hiddenClass: 'swiper-button-hidden',
63579                    lockClass: 'swiper-button-lock'
63580                }
63581            },
63582            create: function create() {
63583                var swiper = this;
63584                (0, _utils.bindModuleMethods)(swiper, {
63585                    navigation: _extends({}, Navigation)
63586                });
63587            },
63588            on: {
63589                init: function init(swiper) {
63590                    swiper.navigation.init();
63591                    swiper.navigation.update();
63592                },
63593                toEdge: function toEdge(swiper) {
63594                    swiper.navigation.update();
63595                },
63596                fromEdge: function fromEdge(swiper) {
63597                    swiper.navigation.update();
63598                },
63599                destroy: function destroy(swiper) {
63600                    swiper.navigation.destroy();
63601                },
63602                click: function click(swiper, e) {
63603                    var _swiper$navigation3 = swiper.navigation,
63604                        $nextEl = _swiper$navigation3.$nextEl,
63605                        $prevEl = _swiper$navigation3.$prevEl;
63606
63607                    if (swiper.params.navigation.hideOnClick && !(0, _dom.default)(e.target).is($prevEl) && !(0, _dom.default)(e.target).is($nextEl)) {
63608                        var isHidden;
63609
63610                        if ($nextEl) {
63611                            isHidden = $nextEl.hasClass(swiper.params.navigation.hiddenClass);
63612                        } else if ($prevEl) {
63613                            isHidden = $prevEl.hasClass(swiper.params.navigation.hiddenClass);
63614                        }
63615
63616                        if (isHidden === true) {
63617                            swiper.emit('navigationShow');
63618                        } else {
63619                            swiper.emit('navigationHide');
63620                        }
63621
63622                        if ($nextEl) {
63623                            $nextEl.toggleClass(swiper.params.navigation.hiddenClass);
63624                        }
63625
63626                        if ($prevEl) {
63627                            $prevEl.toggleClass(swiper.params.navigation.hiddenClass);
63628                        }
63629                    }
63630                }
63631            }
63632        };
63633        exports.default = _default;
63634    }, {"../../utils/dom": 94, "../../utils/utils": 98}],
63635    86: [function (require, module, exports) {
63636        "use strict";
63637
63638        exports.__esModule = true;
63639        exports.default = void 0;
63640
63641        var _dom = _interopRequireDefault(require("../../utils/dom"));
63642
63643        var _utils = require("../../utils/utils");
63644
63645        function _interopRequireDefault(obj) {
63646            return obj && obj.__esModule ? obj : {default: obj};
63647        }
63648
63649        function _extends() {
63650            _extends = Object.assign || function (target) {
63651                for (var i = 1; i < arguments.length; i++) {
63652                    var source = arguments[i];
63653                    for (var key in source) {
63654                        if (Object.prototype.hasOwnProperty.call(source, key)) {
63655                            target[key] = source[key];
63656                        }
63657                    }
63658                }
63659                return target;
63660            };
63661            return _extends.apply(this, arguments);
63662        }
63663
63664        var Pagination = {
63665            update: function update() {
63666                // Render || Update Pagination bullets/items
63667                var swiper = this;
63668                var rtl = swiper.rtl;
63669                var params = swiper.params.pagination;
63670                if (!params.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0) return;
63671                var slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
63672                var $el = swiper.pagination.$el; // Current/Total
63673
63674                var current;
63675                var total = swiper.params.loop ? Math.ceil((slidesLength - swiper.loopedSlides * 2) / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
63676
63677                if (swiper.params.loop) {
63678                    current = Math.ceil((swiper.activeIndex - swiper.loopedSlides) / swiper.params.slidesPerGroup);
63679
63680                    if (current > slidesLength - 1 - swiper.loopedSlides * 2) {
63681                        current -= slidesLength - swiper.loopedSlides * 2;
63682                    }
63683
63684                    if (current > total - 1) current -= total;
63685                    if (current < 0 && swiper.params.paginationType !== 'bullets') current = total + current;
63686                } else if (typeof swiper.snapIndex !== 'undefined') {
63687                    current = swiper.snapIndex;
63688                } else {
63689                    current = swiper.activeIndex || 0;
63690                } // Types
63691
63692
63693                if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) {
63694                    var bullets = swiper.pagination.bullets;
63695                    var firstIndex;
63696                    var lastIndex;
63697                    var midIndex;
63698
63699                    if (params.dynamicBullets) {
63700                        swiper.pagination.bulletSize = bullets.eq(0)[swiper.isHorizontal() ? 'outerWidth' : 'outerHeight'](true);
63701                        $el.css(swiper.isHorizontal() ? 'width' : 'height', swiper.pagination.bulletSize * (params.dynamicMainBullets + 4) + "px");
63702
63703                        if (params.dynamicMainBullets > 1 && swiper.previousIndex !== undefined) {
63704                            swiper.pagination.dynamicBulletIndex += current - swiper.previousIndex;
63705
63706                            if (swiper.pagination.dynamicBulletIndex > params.dynamicMainBullets - 1) {
63707                                swiper.pagination.dynamicBulletIndex = params.dynamicMainBullets - 1;
63708                            } else if (swiper.pagination.dynamicBulletIndex < 0) {
63709                                swiper.pagination.dynamicBulletIndex = 0;
63710                            }
63711                        }
63712
63713                        firstIndex = current - swiper.pagination.dynamicBulletIndex;
63714                        lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1);
63715                        midIndex = (lastIndex + firstIndex) / 2;
63716                    }
63717
63718                    bullets.removeClass(params.bulletActiveClass + " " + params.bulletActiveClass + "-next " + params.bulletActiveClass + "-next-next " + params.bulletActiveClass + "-prev " + params.bulletActiveClass + "-prev-prev " + params.bulletActiveClass + "-main");
63719
63720                    if ($el.length > 1) {
63721                        bullets.each(function (bullet) {
63722                            var $bullet = (0, _dom.default)(bullet);
63723                            var bulletIndex = $bullet.index();
63724
63725                            if (bulletIndex === current) {
63726                                $bullet.addClass(params.bulletActiveClass);
63727                            }
63728
63729                            if (params.dynamicBullets) {
63730                                if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) {
63731                                    $bullet.addClass(params.bulletActiveClass + "-main");
63732                                }
63733
63734                                if (bulletIndex === firstIndex) {
63735                                    $bullet.prev().addClass(params.bulletActiveClass + "-prev").prev().addClass(params.bulletActiveClass + "-prev-prev");
63736                                }
63737
63738                                if (bulletIndex === lastIndex) {
63739                                    $bullet.next().addClass(params.bulletActiveClass + "-next").next().addClass(params.bulletActiveClass + "-next-next");
63740                                }
63741                            }
63742                        });
63743                    } else {
63744                        var $bullet = bullets.eq(current);
63745                        var bulletIndex = $bullet.index();
63746                        $bullet.addClass(params.bulletActiveClass);
63747
63748                        if (params.dynamicBullets) {
63749                            var $firstDisplayedBullet = bullets.eq(firstIndex);
63750                            var $lastDisplayedBullet = bullets.eq(lastIndex);
63751
63752                            for (var i = firstIndex; i <= lastIndex; i += 1) {
63753                                bullets.eq(i).addClass(params.bulletActiveClass + "-main");
63754                            }
63755
63756                            if (swiper.params.loop) {
63757                                if (bulletIndex >= bullets.length - params.dynamicMainBullets) {
63758                                    for (var _i = params.dynamicMainBullets; _i >= 0; _i -= 1) {
63759                                        bullets.eq(bullets.length - _i).addClass(params.bulletActiveClass + "-main");
63760                                    }
63761
63762                                    bullets.eq(bullets.length - params.dynamicMainBullets - 1).addClass(params.bulletActiveClass + "-prev");
63763                                } else {
63764                                    $firstDisplayedBullet.prev().addClass(params.bulletActiveClass + "-prev").prev().addClass(params.bulletActiveClass + "-prev-prev");
63765                                    $lastDisplayedBullet.next().addClass(params.bulletActiveClass + "-next").next().addClass(params.bulletActiveClass + "-next-next");
63766                                }
63767                            } else {
63768                                $firstDisplayedBullet.prev().addClass(params.bulletActiveClass + "-prev").prev().addClass(params.bulletActiveClass + "-prev-prev");
63769                                $lastDisplayedBullet.next().addClass(params.bulletActiveClass + "-next").next().addClass(params.bulletActiveClass + "-next-next");
63770                            }
63771                        }
63772                    }
63773
63774                    if (params.dynamicBullets) {
63775                        var dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4);
63776                        var bulletsOffset = (swiper.pagination.bulletSize * dynamicBulletsLength - swiper.pagination.bulletSize) / 2 - midIndex * swiper.pagination.bulletSize;
63777                        var offsetProp = rtl ? 'right' : 'left';
63778                        bullets.css(swiper.isHorizontal() ? offsetProp : 'top', bulletsOffset + "px");
63779                    }
63780                }
63781
63782                if (params.type === 'fraction') {
63783                    $el.find("." + params.currentClass).text(params.formatFractionCurrent(current + 1));
63784                    $el.find("." + params.totalClass).text(params.formatFractionTotal(total));
63785                }
63786
63787                if (params.type === 'progressbar') {
63788                    var progressbarDirection;
63789
63790                    if (params.progressbarOpposite) {
63791                        progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal';
63792                    } else {
63793                        progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical';
63794                    }
63795
63796                    var scale = (current + 1) / total;
63797                    var scaleX = 1;
63798                    var scaleY = 1;
63799
63800                    if (progressbarDirection === 'horizontal') {
63801                        scaleX = scale;
63802                    } else {
63803                        scaleY = scale;
63804                    }
63805
63806                    $el.find("." + params.progressbarFillClass).transform("translate3d(0,
638060,0) scaleX(" + scaleX + ") scaleY(" + scaleY + ")").transition(swiper.params.speed);
63807                }
63808
63809                if (params.type === 'custom' && params.renderCustom) {
63810                    $el.html(params.renderCustom(swiper, current + 1, total));
63811                    swiper.emit('paginationRender', $el[0]);
63812                } else {
63813                    swiper.emit('paginationUpdate', $el[0]);
63814                }
63815
63816                $el[swiper.params.watchOverflow && swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass);
63817            },
63818            render: function render() {
63819                // Render Container
63820                var swiper = this;
63821                var params = swiper.params.pagination;
63822                if (!params.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0) return;
63823                var slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
63824                var $el = swiper.pagination.$el;
63825                var paginationHTML = '';
63826
63827                if (params.type === 'bullets') {
63828                    var numberOfBullets = swiper.params.loop ? Math.ceil((slidesLength - swiper.loopedSlides * 2) / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
63829
63830                    for (var i = 0; i < numberOfBullets; i += 1) {
63831                        if (params.renderBullet) {
63832                            paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass);
63833                        } else {
63834                            paginationHTML += "<" + params.bulletElement + " class=\"" + params.bulletClass + "\"></" + params.bulletElement + ">";
63835                        }
63836                    }
63837
63838                    $el.html(paginationHTML);
63839                    swiper.pagination.bullets = $el.find("." + params.bulletClass);
63840                }
63841
63842                if (params.type === 'fraction') {
63843                    if (params.renderFraction) {
63844                        paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass);
63845                    } else {
63846                        paginationHTML = "<span class=\"" + params.currentClass + "\"></span>" + ' / ' + ("<span class=\"" + params.totalClass + "\"></span>");
63847                    }
63848
63849                    $el.html(paginationHTML);
63850                }
63851
63852                if (params.type === 'progressbar') {
63853                    if (params.renderProgressbar) {
63854                        paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass);
63855                    } else {
63856                        paginationHTML = "<span class=\"" + params.progressbarFillClass + "\"></span>";
63857                    }
63858
63859                    $el.html(paginationHTML);
63860                }
63861
63862                if (params.type !== 'custom') {
63863                    swiper.emit('paginationRender', swiper.pagination.$el[0]);
63864                }
63865            },
63866            init: function init() {
63867                var swiper = this;
63868                var params = swiper.params.pagination;
63869                if (!params.el) return;
63870                var $el = (0, _dom.default)(params.el);
63871                if ($el.length === 0) return;
63872
63873                if (swiper.params.uniqueNavElements && typeof params.el === 'string' && $el.length > 1) {
63874                    $el = swiper.$el.find(params.el);
63875                }
63876
63877                if (params.type === 'bullets' && params.clickable) {
63878                    $el.addClass(params.clickableClass);
63879                }
63880
63881                $el.addClass(params.modifierClass + params.type);
63882
63883                if (params.type === 'bullets' && params.dynamicBullets) {
63884                    $el.addClass("" + params.modifierClass + params.type + "-dynamic");
63885                    swiper.pagination.dynamicBulletIndex = 0;
63886
63887                    if (params.dynamicMainBullets < 1) {
63888                        params.dynamicMainBullets = 1;
63889                    }
63890                }
63891
63892                if (params.type === 'progressbar' && params.progressbarOpposite) {
63893                    $el.addClass(params.progressbarOppositeClass);
63894                }
63895
63896                if (params.clickable) {
63897                    $el.on('click', "." + params.bulletClass, function onClick(e) {
63898                        e.preventDefault();
63899                        var index = (0, _dom.default)(this).index() * swiper.params.slidesPerGroup;
63900                        if (swiper.params.loop) index += swiper.loopedSlides;
63901                        swiper.slideTo(index);
63902                    });
63903                }
63904
63905                (0, _utils.extend)(swiper.pagination, {
63906                    $el: $el,
63907                    el: $el[0]
63908                });
63909            },
63910            destroy: function destroy() {
63911                var swiper = this;
63912                var params = swiper.params.pagination;
63913                if (!params.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0) return;
63914                var $el = swiper.pagination.$el;
63915                $el.removeClass(params.hiddenClass);
63916                $el.removeClass(params.modifierClass + params.type);
63917                if (swiper.pagination.bullets) swiper.pagination.bullets.removeClass(params.bulletActiveClass);
63918
63919                if (params.clickable) {
63920                    $el.off('click', "." + params.bulletClass);
63921                }
63922            }
63923        };
63924        var _default = {
63925            name: 'pagination',
63926            params: {
63927                pagination: {
63928                    el: null,
63929                    bulletElement: 'span',
63930                    clickable: false,
63931                    hideOnClick: false,
63932                    renderBullet: null,
63933                    renderProgressbar: null,
63934                    renderFraction: null,
63935                    renderCustom: null,
63936                    progressbarOpposite: false,
63937                    type: 'bullets',
63938                    // 'bullets' or 'progressbar' or 'fraction' or 'custom'
63939                    dynamicBullets: false,
63940                    dynamicMainBullets: 1,
63941                    formatFractionCurrent: function formatFractionCurrent(number) {
63942                        return number;
63943                    },
63944                    formatFractionTotal: function formatFractionTotal(number) {
63945                        return number;
63946                    },
63947                    bulletClass: 'swiper-pagination-bullet',
63948                    bulletActiveClass: 'swiper-pagination-bullet-active',
63949                    modifierClass: 'swiper-pagination-',
63950                    // NEW
63951                    currentClass: 'swiper-pagination-current',
63952                    totalClass: 'swiper-pagination-total',
63953                    hiddenClass: 'swiper-pagination-hidden',
63954                    progressbarFillClass: 'swiper-pagination-progressbar-fill',
63955                    progressbarOppositeClass: 'swiper-pagination-progressbar-opposite',
63956                    clickableClass: 'swiper-pagination-clickable',
63957                    // NEW
63958                    lockClass: 'swiper-pagination-lock'
63959                }
63960            },
63961            create: function create() {
63962                var swiper = this;
63963                (0, _utils.bindModuleMethods)(swiper, {
63964                    pagination: _extends({
63965                        dynamicBulletIndex: 0
63966                    }, Pagination)
63967                });
63968            },
63969            on: {
63970                init: function init(swiper) {
63971                    swiper.pagination.init();
63972                    swiper.pagination.render();
63973                    swiper.pagination.update();
63974                },
63975                activeIndexChange: function activeIndexChange(swiper) {
63976                    if (swiper.params.loop) {
63977                        swiper.pagination.update();
63978                    } else if (typeof swiper.snapIndex === 'undefined') {
63979                        swiper.pagination.update();
63980                    }
63981                },
63982                snapIndexChange: function snapIndexChange(swiper) {
63983                    if (!swiper.params.loop) {
63984                        swiper.pagination.update();
63985                    }
63986                },
63987                slidesLengthChange: function slidesLengthChange(swiper) {
63988                    if (swiper.params.loop) {
63989                        swiper.pagination.render();
63990                        swiper.pagination.update();
63991                    }
63992                },
63993                snapGridLengthChange: function snapGridLengthChange(swiper) {
63994                    if (!swiper.params.loop) {
63995                        swiper.pagination.render();
63996                        swiper.pagination.update();
63997                    }
63998                },
63999                destroy: function destroy(swiper) {
64000                    swiper.pagination.destroy();
64001                },
64002                click: function click(swiper, e) {
64003                    if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && swiper.pagination.$el.length > 0 && !(0, _dom.default)(e.target).hasClass(swiper.params.pagination.bulletClass)) {
64004                        var isHidden = swiper.pagination.$el.hasClass(swiper.params.pagination.hiddenClass);
64005
64006                        if (isHidden === true) {
64007                            swiper.emit('paginationShow');
64008                        } else {
64009                            swiper.emit('paginationHide');
64010                        }
64011
64012                        swiper.pagination.$el.toggleClass(swiper.params.pagination.hiddenClass);
64013                    }
64014                }
64015            }
64016        };
64017        exports.default = _default;
64018    }, {"../../utils/dom": 94, "../../utils/utils": 98}],
64019    87: [function (require, module, exports) {
64020        "use strict";
64021
64022        exports.__esModule = true;
64023        exports.default = void 0;
64024
64025        var _dom = _interopRequireDefault(require("../../utils/dom"));
64026
64027        var _utils = require("../../utils/utils");
64028
64029        function _interopRequireDefault(obj) {
64030            return obj && obj.__esModule ? obj : {default: obj};
64031        }
64032
64033        function _extends() {
64034            _extends = Object.assign || function (target) {
64035                for (var i = 1; i < arguments.length; i++) {
64036                    var source = arguments[i];
64037                    for (var key in source) {
64038                        if (Object.prototype.hasOwnProperty.call(source, key)) {
64039                            target[key] = source[key];
64040                        }
64041                    }
64042                }
64043                return target;
64044            };
64045            return _extends.apply(this, arguments);
64046        }
64047
64048        var Parallax = {
64049            setTransform: function setTransform(el, progress) {
64050                var swiper = this;
64051                var rtl = swiper.rtl;
64052                var $el = (0, _dom.default)(el);
64053                var rtlFactor = rtl ? -1 : 1;
64054                var p = $el.attr('data-swiper-parallax') || '0';
64055                var x = $el.attr('data-swiper-parallax-x');
64056                var y = $el.attr('data-swiper-parallax-y');
64057                var scale = $el.attr('data-swiper-parallax-scale');
64058                var opacity = $el.attr('data-swiper-parallax-opacity');
64059
64060                if (x || y) {
64061                    x = x || '0';
64062                    y = y || '0';
64063                } else if (swiper.isHorizontal()) {
64064                    x = p;
64065                    y = '0';
64066                } else {
64067                    y = p;
64068                    x = '0';
64069                }
64070
64071                if (x.indexOf('%') >= 0) {
64072                    x = parseInt(x, 10) * progress * rtlFactor + "%";
64073                } else {
64074                    x = x * progress * rtlFactor + "px";
64075                }
64076
64077                if (y.indexOf('%') >= 0) {
64078                    y = parseInt(y, 10) * progress + "%";
64079                } else {
64080                    y = y * progress + "px";
64081                }
64082
64083                if (typeof opacity !== 'undefined' && opacity !== null) {
64084                    var currentOpacity = opacity - (opacity - 1) * (1 - Math.abs(progress));
64085                    $el[0].style.opacity = currentOpacity;
64086                }
64087
64088                if (typeof scale === 'undefined' || scale === null) {
64089                    $el.transform("translate3d(" + x + ", " + y + ", 0px)");
64090                } else {
64091                    var currentScale = scale - (scale - 1) * (1 - Math.abs(progress));
64092                    $el.transform("translate3d(" + x + ", " + y + ", 0px) scale(" + currentScale + ")");
64093                }
64094            },
64095            setTranslate: function setTranslate() {
64096                var swiper = this;
64097                var $el = swiper.$el,
64098                    slides = swiper.slides,
64099                    progress = swiper.progress,
64100                    snapGrid = swiper.snapGrid;
64101                $el.children('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').each(function (el) {
64102                    swiper.parallax.setTransform(el, progress);
64103                });
64104                slides.each(function (slideEl, slideIndex) {
64105                    var slideProgress = slideEl.progress;
64106
64107                    if (swiper.params.slidesPerGroup > 1 && swiper.params.slidesPerView !== 'auto') {
64108                        slideProgress += Math.ceil(slideIndex / 2) - progress * (snapGrid.length - 1);
64109                    }
64110
64111                    slideProgress = Math.min(Math.max(slideProgress, -1), 1);
64112                    (0, _dom.default)(slideEl).find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').each(function (el) {
64113                        swiper.parallax.setTransform(el, slideProgress);
64114                    });
64115                });
64116            },
64117            setTransition: function setTransition(duration) {
64118                if (duration === void 0) {
64119                    duration = this.params.speed;
64120                }
64121
64122                var swiper = this;
64123                var $el = swiper.$el;
64124                $el.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').each(function (parallaxEl) {
64125                    var $parallaxEl = (0, _dom.default)(parallaxEl);
64126                    var parallaxDuration = parseInt($parallaxEl.attr('data-swiper-parallax-duration'), 10) || duration;
64127                    if (duration === 0) parallaxDuration = 0;
64128                    $parallaxEl.transition(parallaxDuration);
64129                });
64130            }
64131        };
64132        var _default = {
64133            name: 'parallax',
64134            params: {
64135                parallax: {
64136                    enabled: false
64137                }
64138            },
64139            create: function create() {
64140                var swiper = this;
64141                (0, _utils.bindModuleMethods)(swiper, {
64142                    parallax: _extends({}, Parallax)
64143                });
64144            },
64145            on: {
64146                beforeInit: function beforeInit(swiper) {
64147                    if (!swiper.params.parallax.enabled) return;
64148                    swiper.params.watchSlidesProgress = true;
64149                    swiper.originalParams.watchSlidesProgress = true;
64150                },
64151                init: function init(swiper) {
64152                    if (!swiper.params.parallax.enabled) return;
64153                    swiper.parallax.setTranslate();
64154                },
64155                setTranslate: function setTranslate(swiper) {
64156                    if (!swiper.params.parallax.enabled) return;
64157                    swiper.parallax.setTranslate();
64158                },
64159                setTransition: function setTransition(swiper, duration) {
64160                    if (!swiper.params.parallax.enabled) return;
64161                    swiper.parallax.setTransition(duration);
64162                }
64163            }
64164        };
64165        exports.default = _default;
64166    }, {"../../utils/dom": 94, "../../utils/utils": 98}],
64167    88: [function (require, module, exports) {
64168        "use strict";
64169
64170        exports.__esModule = true;
64171        exports.default = void 0;
64172
64173        var _ssrWindow = require("ssr-window");
64174
64175        var _dom = _interopRequireDefault(require("../../utils/dom"));
64176
64177        var _utils = require("../../utils/utils");
64178
64179        function _interopRequireDefault(obj) {
64180            return obj && obj.__esModule ? obj : {default: obj};
64181        }
64182
64183        function _extends() {
64184            _extends = Object.assign || function (target) {
64185                for (var i = 1; i < arguments.length; i++) {
64186                    var source = arguments[i];
64187                    for (var key in source) {
64188                        if (Object.prototype.hasOwnProperty.call(source, key)) {
64189                            target[key] = source[key];
64190                        }
64191                    }
64192                }
64193                return target;
64194            };
64195            return _extends.apply(this, arguments);
64196        }
64197
64198        var Scrollbar = {
64199            setTranslate: function setTranslate() {
64200                var swiper = this;
64201                if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return;
64202                var scrollbar = swiper.scrollbar,
64203                    rtl = swiper.rtlTranslate,
64204                    progress = swiper.progress;
64205                var dragSize = scrollbar.dragSize,
64206                    trackSize = scrollbar.trackSize,
64207                    $dragEl = scrollbar.$dragEl,
64208                    $el = scrollbar.$el;
64209                var params = swiper.params.scrollbar;
64210                var newSize = dragSize;
64211                var newPos = (trackSize - dragSize) * progress;
64212
64213                if (rtl) {
64214                    newPos = -newPos;
64215
64216                    if (newPos > 0) {
64217                        newSize = dragSize - newPos;
64218                        newPos = 0;
64219                    } else if (-newPos + dragSize > trackSize) {
64220                        newSize = trackSize + newPos;
64221                    }
64222                } else if (newPos < 0) {
64223                    newSize = dragSize + newPos;
64224                    newPos = 0;
64225                } else if (newPos + dragSize > trackSize) {
64226                    newSize = trackSize - newPos;
64227                }
64228
64229                if (swiper.isHorizontal()) {
64230                    $dragEl.transform("translate3d(" + newPos + "px, 0, 0)");
64231                    $dragEl[0].style.width = newSize + "px";
64232                } else {
64233                    $dragEl.transform("translate3d(0px, " + newPos + "px, 0)");
64234                    $dragEl[0].style.height = newSize + "px";
64235                }
64236
64237                if (params.hide) {
64238                    clearTimeout(swiper.scrollbar.timeout);
64239                    $el[0].style.opacity = 1;
64240                    swiper.scrollbar.timeout = setTimeout(function () {
64241                        $el[0].style.opacity = 0;
64242                        $el.transition(400);
64243                    }, 1000);
64244                }
64245            },
64246            setTransition: function setTransition(duration) {
64247                var swiper = this;
64248                if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return;
64249                swiper.scrollbar.$dragEl.transition(duration);
64250            },
64251            updateSize: function updateSize() {
64252                var swiper = this;
64253                if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return;
64254                var scrollbar = swiper.scrollbar;
64255                var $dragEl = scrollbar.$dragEl,
64256                    $el = scrollbar.$el;
64257                $dragEl[0].style.width = '';
64258                $dragEl[0].style.height = '';
64259                var trackSize = swiper.isHorizontal() ? $el[0].offsetWidth : $el[0].offsetHeight;
64260                var divider = swiper.size / swiper.virtualSize;
64261                var moveDivider = divider * (trackSize / swiper.size);
64262                var dragSize;
64263
64264                if (swiper.params.scrollbar.dragSize === 'auto') {
64265                    dragSize = trackSize * divider;
64266                } else {
64267                    dragSize = parseInt(swiper.params.scrollbar.dragSize, 10);
64268                }
64269
64270                if (swiper.isHorizontal()) {
64271                    $dragEl[0].style.width = dragSize + "px";
64272                } else {
64273                    $dragEl[0].style.height = dragSize + "px";
64274                }
64275
64276                if (divider >= 1) {
64277                    $el[0].style.display = 'none';
64278                } else {
64279                    $el[0].style.display = '';
64280                }
64281
64282                if (swiper.params.scrollbar.hide) {
64283                    $el[0].style.opacity = 0;
64284                }
64285
64286                (0, _utils.extend)(scrollbar, {
64287                    trackSize: trackSize,
64288                    divider: divider,
64289                    moveDivider: moveDivider,
64290                    dragSize: dragSize
64291                });
64292                scrollbar.$el[swiper.params.watchOverflow && swiper.isLocked ? 'addClass' : 'removeClass'](swiper.params.scrollbar.lockClass);
64293            },
64294            getPointerPosition: function getPointerPosition(e) {
64295                var swiper = this;
64296
64297                if (swiper.isHorizontal()) {
64298                    return e.type === 'touchstart' || e.type === 'touchmove' ? e.targetTouches[0].clientX : e.clientX;
64299                }
64300
64301                return e.type === 'touchstart' || e.type === 'touchmove' ? e.targetTouches[0].clientY : e.clientY;
64302            },
64303            setDragPosition: function setDragPosition(e) {
64304                var swiper = this;
64305                var scrollbar = swiper.scrollbar,
64306                    rtl = swiper.rtlTranslate;
64307                var $el = scrollbar.$el,
64308                    dragSize = scrollbar.dragSize,
64309                    trackSize = scrollbar.trackSize,
64310                    dragStartPos = scrollbar.dragStartPos;
64311                var positionRatio;
64312                positionRatio = (scrollbar.getPointerPosition(e) - $el.offset()[swiper.isHorizontal() ? 'left' : 'top'] - (dragStartPos !== null ? dragStartPos : dragSize / 2)) / (trackSize - dragSize);
64313                positionRatio = Math.max(Math.min(positionRatio, 1), 0);
64314
64315                if (rtl) {
64316                    positionRatio = 1 - positionRatio;
64317                }
64318
64319                var position = swiper.minTranslate() + (swiper.maxTranslate() - swiper.minTranslate()) * positionRatio;
64320                swiper.updateProgress(position);
64321                swiper.setTranslate(position);
64322                swiper.updateActiveIndex();
64323                swiper.updateSlidesClasses();
64324            },
64325            onDragStart: function onDragStart(e) {
64326                var swiper = this;
64327                var params = swiper.params.scrollbar;
64328                var scrollbar = swiper.scrollbar,
64329                    $wrapperEl = swiper.$wrapperEl;
64330                var $el = scrollbar.$el,
64331                    $dragEl = scrollbar.$dragEl;
64332                swiper.scrollbar.isTouched = true;
64333                swiper.scrollbar.dragStartPos = e.target === $dragEl[0] || e.target === $dragEl ? scrollbar.getPointerPosition(e) - e.target.getBoundingClientRect()[swiper.isHorizontal() ? 'left' : 'top'] : null;
64334                e.preventDefault();
64335                e.stopPropagation();
64336                $wrapperEl.transition(100);
64337                $dragEl.transition(100);
64338                scrollbar.setDragPosition(e);
64339                clearTimeout(swiper.scrollbar.dragTimeout);
64340                $el.transition(0);
64341
64342                if (params.hide) {
64343                    $el.css('opacity', 1);
64344                }
64345
64346                if (swiper.params.cssMode) {
64347                    swiper.$wrapperEl.css('scroll-snap-type', 'none');
64348                }
64349
64350                swiper.emit('scrollbarDragStart', e);
64351            },
64352            onDragMove: function onDragMove(e) {
64353                var swiper = this;
64354                var scrollbar = swiper.scrollbar,
64355                    $wrapperEl = swiper.$wrapperEl;
64356                var $el = scrollbar.$el,
64357                    $dragEl = scrollbar.$dragEl;
64358                if (!swiper.scrollbar.isTouched) return;
64359                if (e.preventDefault) e.preventDefault(); else e.returnValue = false;
64360                scrollbar.setDragPosition(e);
64361                $wrapperEl.transition(0);
64362                $el.transition(0);
64363                $dragEl.transition(0);
64364                swiper.emit('scrollbarDragMove', e);
64365            },
64366            onDragEnd: function onDragEnd(e) {
64367                var swiper = this;
64368                var params = swiper.params.scrollbar;
64369                var scrollbar = swiper.scrollbar,
64370                    $wrapperEl = swiper.$wrapperEl;
64371                var $el = scrollbar.$el;
64372                if (!swiper.scrollbar.isTouched) return;
64373                swiper.scrollbar.isTouched = false;
64374
64375                if (swiper.params.cssMode) {
64376                    swiper.$wrapperEl.css('scroll-snap-type', '');
64377                    $wrapperEl.transition('');
64378                }
64379
64380                if (params.hide) {
64381                    clearTimeout(swiper.scrollbar.dragTimeout);
64382                    swiper.scrollbar.dragTimeout = (0, _utils.nextTick)(function () {
64383                        $el.css('opacity', 0);
64384                        $el.transition(400);
64385                    }, 1000);
64386                }
64387
64388                swiper.emit('scrollbarDragEnd', e);
64389
64390                if (params.snapOnRelease) {
64391                    swiper.slideToClosest();
64392                }
64393            },
64394            enableDraggable: function enableDraggable() {
64395                var swiper = this;
64396                if (!swiper.params.scrollbar.el) return;
64397                var document = (0, _ssrWindow.getDocument)();
64398                var scrollbar = swiper.scrollbar,
64399                    touchEventsTouch = swiper.touchEventsTouch,
64400                    touchEventsDesktop = swiper.touchEventsDesktop,
64401                    params = swiper.params,
64402                    support = swiper.support;
64403                var $el = scrollbar.$el;
64404                var target = $el[0];
64405                var activeListener = support.passiveListener && params.passiveListeners ? {
64406                    passive: false,
64407                    capture: false
64408                } : false;
64409                var passiveListener = support.passiveListener && params.passiveListeners ? {
64410                    passive: true,
64411                    capture: false
64412                } : false;
64413
64414                if (!support.touch) {
64415                    target.addEventListener(touchEventsDesktop.start, swiper.scrollbar.onDragStart, activeListener);
64416                    document.addEventListener(touchEventsDesktop.move, swiper.scrollbar.onDragMove, activeListener);
64417                    document.addEventListener(touchEventsDesktop.end, swiper.scrollbar.onDragEnd, passiveListener);
64418                } else {
64419                    target.addEventListener(touchEventsTouch.start, swiper.scrollbar.onDragStart, activeListener);
64420                    target.addEventListener(touchEventsTouch.move, swiper.scrollbar.onDragMove, activeListener);
64421                    target.addEventListener(touchEventsTouch.end, swiper.scrollbar.onDragEnd, passiveListener);
64422                }
64423            },
64424            disableDraggable: function disableDraggable() {
64425                var swiper = this;
64426                if (!swiper.params.scrollbar.el) return;
64427                var document = (0, _ssrWindow.getDocument)();
64428                var scrollbar = swiper.scrollbar,
64429                    touchEventsTouch = swiper.touchEventsTouch,
64430                    touchEventsDesktop = swiper.touchEventsDesktop,
64431                    params = swiper.params,
64432                    support = swiper.support;
64433                var $el = scrollbar.$el;
64434                var target = $el[0];
64435                var activeListener = support.passiveListener && params.passiveListeners ? {
64436                    passive: false,
64437                    capture: false
64438                } : false;
64439                var passiveListener = support.passiveListener && params.passiveListeners ? {
64440                    passive: true,
64441                    capture: false
64442                } : false;
64443
64444                if (!support.touch) {
64445                    target.removeEventListener(touchEventsDesktop.start, swiper.scrollbar.onDragStart, activeListener);
64446                    document.removeEventListener(touchEventsDesktop.move, swiper.scrollbar.onDragMove, activeListener);
64447                    document.removeEventListener(touchEventsDesktop.end, swiper.scrollbar.onDragEnd, passiveListener);
64448                } else {
64449                    target.removeEventListener(touchEventsTouch.start, swiper.scrollbar.onDragStart, activeListener);
64450                    target.removeEventListener(touchEventsTouch.move, swiper.scrollbar.onDragMove, activeListener);
64451                    target.removeEventListener(touchEventsTouch.end, swiper.scrollbar.onDragEnd, passiveListener);
64452                }
64453            },
64454            init: function init() {
64455                var swiper = this;
64456                if (!swiper.params.scrollbar.el) return;
64457                var scrollbar = swiper.scrollbar,
64458                    $swiperEl = swiper.$el;
64459                var params = swiper.params.scrollbar;
64460                var $el = (0, _dom.default)(params.el);
64461
64462                if (swiper.params.uniqueNavElements && typeof params.el === 'string' && $el.length > 1 && $swiperEl.find(params.el).length === 1) {
64463                    $el = $swiperEl.find(params.el);
64464                }
64465
64466                var $dragEl = $el.find("." + swiper.params.scrollbar.dragClass);
64467
64468                if ($dragEl.length === 0) {
64469                    $dragEl = (0, _dom.default)("<div class=\"" + swiper.params.scrollbar.dragClass + "\"></div>");
64470                    $el.append($dragEl);
64471                }
64472
64473                (0, _utils.extend)(scrollbar, {
64474                    $el: $el,
64475                    el: $el[0],
64476                    $dragEl: $dragEl,
64477                    dragEl: $dragEl[0]
64478                });
64479
64480                if (params.draggable) {
64481                    scrollbar.enableDraggable();
64482                }
64483            },
64484            destroy: function destroy() {
64485                var swiper = this;
64486                swiper.scrollbar.disableDraggable();
64487            }
64488        };
64489        var _default = {
64490            name: 'scrollbar',
64491            params: {
64492                scrollbar: {
64493                    el: null,
64494                    dragSize: 'auto',
64495                    hide: false,
64496                    draggable: false,
64497                    snapOnRelease: true,
64498                    lockClass: 'swiper-scrollbar-lock',
64499                    dragClass: 'swiper-scrollbar-drag'
64500                }
64501            },
64502            create: function create() {
64503                var swiper = this;
64504                (0, _utils.bindModuleMethods)(swiper, {
64505                    scrollbar: _extends({
64506                        isTouched: false,
64507                        timeout: null,
64508                        dragTimeout: null
64509                    }, Scrollbar)
64510                });
64511            },
64512            on: {
64513                init: function init(swiper) {
64514                    swiper.scrollbar.init();
64515                    swiper.scrollbar.updateSize();
64516                    swiper.scrollbar.setTranslate();
64517                },
64518                update: function update(swiper) {
64519                    swiper.scrollbar.updateSize();
64520                },
64521                resize: function resize(swiper) {
64522                    swiper.scrollbar.updateSize();
64523                },
64524                observerUpdate: function observerUpdate(swiper) {
64525                    swiper.scrollbar.updateSize();
64526                },
64527                setTranslate: function setTranslate(swiper) {
64528                    swiper.scrollbar.setTranslate();
64529                },
64530                setTransition: function setTransition(swiper, duration) {
64531                    swiper.scrollbar.setTransition(duration);
64532                },
64533                destroy: function destroy(swiper) {
64534                    swiper.scrollbar.destroy();
64535                }
64536            }
64537        };
64538        exports.default = _default;
64539    }, {"../../utils/dom": 94, "../../utils/utils": 98, "ssr-window": 10}],
64540    89: [function (require, module, exports) {
64541        "use strict";
64542
64543        exports.__esModule = true;
64544        exports.default = void 0;
64545
64546        var _utils = require("../../utils/utils");
64547
64548        var _dom = _interopRequireDefault(require("../../utils/dom"));
64549
64550        function _interopRequireDefault(obj) {
64551            return obj && obj.__esModule ? obj : {default: obj};
64552        }
64553
64554        function _extends() {
64555            _extends = Object.assign || function (target) {
64556                for (var i = 1; i < arguments.length; i++) {
64557                    var source = arguments[i];
64558                    for (var key in source) {
64559                        if (Object.prototype.hasOwnProperty.call(source, key)) {
64560                            target[key] = source[key];
64561                        }
64562                    }
64563                }
64564                return target;
64565            };
64566            return _extends.apply(this, arguments);
64567        }
64568
64569        var Thumbs = {
64570            init: function init() {
64571                var swiper = this;
64572                var thumbsParams = swiper.params.thumbs;
64573                if (swiper.thumbs.initialized) return false;
64574                swiper.thumbs.initialized = true;
64575                var SwiperClass = swiper.constructor;
64576
64577                if (thumbsParams.swiper instanceof SwiperClass) {
64578                    swiper.thumbs.swiper = thumbsParams.swiper;
64579                    (0, _utils.extend)(swiper.thumbs.swiper.originalParams, {
64580                        watchSlidesProgress: true,
64581                        slideToClickedSlide: false
64582                    });
64583                    (0, _utils.extend)(swiper.thumbs.swiper.params, {
64584                        watchSlidesProgress: true,
64585                        slideToClickedSlide: false
64586                    });
64587                } else if ((0, _utils.isObject)(thumbsParams.swiper)) {
64588                    swiper.thumbs.swiper = new SwiperClass((0, _utils.extend)({}, thumbsParams.swiper, {
64589                        watchSlidesVisibility: true,
64590                        watchSlidesProgress: true,
64591                        slideToClickedSlide: false
64592                    }));
64593                    swiper.thumbs.swiperCreated = true;
64594                }
64595
64596                swiper.thumbs.swiper.$el.addClass(swiper.params.thumbs.thumbsContainerClass);
64597                swiper.thumbs.swiper.on('tap', swiper.thumbs.onThumbClick);
64598                return true;
64599            },
64600            onThumbClick: function onThumbClick() {
64601                var swiper = this;
64602                var thumbsSwiper = swiper.thumbs.swiper;
64603                if (!thumbsSwiper) return;
64604                var clickedIndex = thumbsSwiper.clickedIndex;
64605                var clickedSlide = thumbsSwiper.clickedSlide;
64606                if (clickedSlide && (0, _dom.default)(clickedSlide).hasClass(swiper.params.thumbs.slideThumbActiveClass)) return;
64607                if (typeof clickedIndex === 'undefined' || clickedIndex === null) return;
64608                var slideToIndex;
64609
64610                if (thumbsSwiper.params.loop) {
64611                    slideToIndex = parseInt((0, _dom.default)(thumbsSwiper.clickedSlide).attr('data-swiper-slide-index'), 10);
64612                } else {
64613                    slideToIndex = clickedIndex;
64614                }
64615
64616                if (swiper.params.loop) {
64617                    var currentIndex = swiper.activeIndex;
64618
64619                    if (swiper.slides.eq(currentIndex).hasClass(swiper.params.slideDuplicateClass)) {
64620                        swiper.loopFix(); // eslint-disable-next-line
64621
64622                        swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
64623                        currentIndex = swiper.activeIndex;
64624                    }
64625
64626                    var prevIndex = swiper.slides.eq(currentIndex).prevAll("[data-swiper-slide-index=\"" + slideToIndex + "\"]").eq(0).index();
64627                    var nextIndex = swiper.slides.eq(currentIndex).nextAll("[data-swiper-slide-index=\"" + slideToIndex + "\"]").eq(0).index();
64628                    if (typeof prevIndex === 'undefined') slideToIndex = nextIndex; else if (typeof nextIndex === 'undefined') slideToIndex = prevIndex; else if (nextIndex - currentIndex < currentIndex - prevIndex) slideToIndex = nextIndex; else slideToIndex = prevIndex;
64629                }
64630
64631                swiper.slideTo(slideToIndex);
64632            },
64633            update: function update(initial) {
64634                var swiper = this;
64635                var thumbsSwiper = swiper.thumbs.swiper;
64636                if (!thumbsSwiper) return;
64637                var slidesPerView = thumbsSwiper.params.slidesPerView === 'auto' ? thumbsSwiper.slidesPerViewDynamic() : thumbsSwiper.params.slidesPerView;
64638                var autoScrollOffset = swiper.params.thumbs.autoScrollOffset;
64639                var useOffset = autoScrollOffset && !thumbsSwiper.params.loop;
64640
64641                if (swiper.realIndex !== thumbsSwiper.realIndex || useOffset) {
64642                    var currentThumbsIndex = thumbsSwiper.activeIndex;
64643                    var newThumbsIndex;
64644                    var direction;
64645
64646                    if (thumbsSwiper.params.loop) {
64647                        if (thumbsSwiper.slides.eq(currentThumbsIndex).hasClass(thumbsSwiper.params.slideDuplicateClass)) {
64648                            thumbsSwiper.loopFix(); // eslint-disable-next-line
64649
64650                            thumbsSwiper._clientLeft = thumbsSwiper.$wrapperEl[0].clientLeft;
64651                            currentThumbsIndex = thumbsSwiper.activeIndex;
64652                        } // Find actual thumbs index to slide to
64653
64654
64655                        var prevThumbsIndex = thumbsSwiper.slides.eq(currentThumbsIndex).prevAll("[data-swiper-slide-index=\"" + swiper.realIndex + "\"]").eq(0).index();
64656                        var nextThumbsIndex = thumbsSwiper.slides.eq(currentThumbsIndex).nextAll("[data-swiper-slide-index=\"" + swiper.realIndex + "\"]").eq(0).index();
64657                        if (typeof prevThumbsIndex === 'undefined') newThumbsIndex = nextThumbsIndex; else if (typeof nextThumbsIndex === 'undefined') newThumbsIndex = prevThumbsIndex; else if (nextThumbsIndex - currentThumbsIndex === currentThumbsIndex - prevThumbsIndex) newThumbsIndex = currentThumbsIndex; else if (nextThumbsIndex - currentThumbsIndex < currentThumbsIndex - prevThumbsIndex) newThumbsIndex = nextThumbsIndex; else newThumbsIndex = prevThumbsIndex;
64658                        direction = swiper.activeIndex > swiper.previousIndex ? 'next' : 'prev';
64659                    } else {
64660                        newThumbsIndex = swiper.realIndex;
64661                        direction = newThumbsIndex > swiper.previousIndex ? 'next' : 'prev';
64662                    }
64663
64664                    if (useOffset) {
64665                        newThumbsIndex += direction === 'next' ? autoScrollOffset : -1 * autoScrollOffset;
64666                    }
64667
64668                    if (thumbsSwiper.visibleSlidesIndexes && thumbsSwiper.visibleSlidesIndexes.indexOf(newThumbsIndex) < 0) {
64669                        if (thumbsSwiper.params.centeredSlides) {
64670                            if (newThumbsIndex > currentThumbsIndex) {
64671                                newThumbsIndex = newThumbsIndex - Math.floor(slidesPerView / 2) + 1;
64672                            } else {
64673                                newThumbsIndex = newThumbsIndex + Math.floor(slidesPerView / 2) - 1;
64674                            }
64675                        } else if (newThumbsIndex > currentThumbsIndex) {
64676                            newThumbsIndex = newThumbsIndex - slidesPerView + 1;
64677                        }
64678
64679                        thumbsSwiper.slideTo(newThumbsIndex, initial ? 0 : undefined);
64680                    }
64681                } // Activate thumbs
64682
64683
64684                var thumbsToActivate = 1;
64685                var thumbActiveClass = swiper.params.thumbs.slideThumbActiveClass;
64686
64687                if (swiper.params.slidesPerView > 1 && !swiper.params.centeredSlides) {
64688                    thumbsToActivate = swiper.params.slidesPerView;
64689                }
64690
64691                if (!swiper.params.thumbs.multipleActiveThumbs) {
64692                    thumbsToActivate = 1;
64693                }
64694
64695                thumbsToActivate = Math.floor(thumbsToActivate);
64696                thumbsSwiper.slides.removeClass(thumbActiveClass);
64697
64698                if (thumbsSwiper.params.loop || thumbsSwiper.params.virtual && thumbsSwiper.params.virtual.enabled) {
64699                    for (var i = 0; i < thumbsToActivate; i += 1) {
64700                        thumbsSwiper.$wrapperEl.children("[data-swiper-slide-index=\"" + (swiper.realIndex + i) + "\"]").addClass(thumbActiveClass);
64701                    }
64702                } else {
64703                    for (var _i = 0; _i < thumbsToActivate; _i += 1) {
64704                        thumbsSwiper.slides.eq(swiper.realIndex + _i).addClass(thumbActiveClass);
64705                    }
64706                }
64707            }
64708        };
64709        var _default = {
64710            name: 'thumbs',
64711            params: {
64712                thumbs: {
64713                    swiper: null,
64714                    multipleActiveThumbs: true,
64715                    autoScrollOffset: 0,
64716                    slideThumbActiveClass: 'swiper-slide-thumb-active',
64717                    thumbsContainerClass: 'swiper-container-thumbs'
64718                }
64719            },
64720            create: function create() {
64721                var swiper = this;
64722                (0, _utils.bindModuleMethods)(swiper, {
64723                    thumbs: _extends({
64724                        swiper: null,
64725                        initialized: false
64726                    }, Thumbs)
64727                });
64728            },
64729            on: {
64730                beforeInit: function beforeInit(swiper) {
64731                    var thumbs = swiper.params.thumbs;
64732                    if (!thumbs || !thumbs.swiper) return;
64733                    swiper.thumbs.init();
64734                    swiper.thumbs.update(true);
64735                },
64736                slideChange: function slideChange(swiper) {
64737                    if (!swiper.thumbs.swiper) return;
64738                    swiper.thumbs.update();
64739                },
64740                update: function update(swiper) {
64741                    if (!swiper.thumbs.swiper) return;
64742                    swiper.thumbs.update();
64743                },
64744                resize: function resize(swiper) {
64745                    if (!swiper.thumbs.swiper) return;
64746                    swiper.thumbs.update();
64747                },
64748                observerUpdate: function observerUpdate(swiper) {
64749                    if (!swiper.thumbs.swiper) return;
64750                    swiper.thumbs.update();
64751                },
64752                setTransition: function setTransition(swiper, duration) {
64753                    var thumbsSwiper = swiper.thumbs.swiper;
64754                    if (!thumbsSwiper) return;
64755                    thumbsSwiper.setTransition(duration);
64756                },
64757                beforeDestroy: function beforeDestroy(swiper) {
64758                    var thumbsSwiper = swiper.thumbs.swiper;
64759                    if (!thumbsSwiper) return;
64760
64761                    if (swiper.thumbs.swiperCreated && thumbsSwiper) {
64762                        thumbsSwiper.destroy();
64763                    }
64764                }
64765            }
64766        };
64767        exports.default = _default;
64768    }, {"../../utils/dom": 94, "../../utils/utils": 98}],
64769    90: [function (require, module, exports) {
64770        "use strict";
64771
64772        exports.__esModule = true;
64773        exports.default = void 0;
64774
64775        var _dom = _interopRequireDefault(require("../../utils/dom"));
64776
64777        var _utils = require("../../utils/utils");
64778
64779        function _interopRequireDefault(obj) {
64780            return obj && obj.__esModule ? obj : {default: obj};
64781        }
64782
64783        function _extends() {
64784            _extends = Object.assign || function (target) {
64785                for (var i = 1; i < arguments.length; i++) {
64786                    var source = arguments[i];
64787                    for (var key in source) {
64788                        if (Object.prototype.hasOwnProperty.call(source, key)) {
64789                            target[key] = source[key];
64790                        }
64791                    }
64792                }
64793                return target;
64794            };
64795            return _extends.apply(this, arguments);
64796        }
64797
64798        var Virtual = {
64799            update: function update(force) {
64800                var swiper = this;
64801                var _swiper$params = swiper.params,
64802                    slidesPerView = _swiper$params.slidesPerView,
64803                    slidesPerGroup = _swiper$params.slidesPerGroup,
64804                    centeredSlides = _swiper$params.centeredSlides;
64805                var _swiper$params$virtua = swiper.params.virtual,
64806                    addSlidesBefore = _swiper$params$virtua.addSlidesBefore,
64807                    addSlidesAfter = _swiper$params$virtua.addSlidesAfter;
64808                var _swiper$virtual = swiper.virtual,
64809                    previousFrom = _swiper$virtual.from,
64810                    previousTo = _swiper$virtual.to,
64811                    slides = _swiper$virtual.slides,
64812                    previousSlidesGrid = _swiper$virtual.slidesGrid,
64813                    renderSlide = _swiper$virtual.renderSlide,
64814                    previousOffset = _swiper$virtual.offset;
64815                swiper.updateActiveIndex();
64816                var activeIndex = swiper.activeIndex || 0;
64817                var offsetProp;
64818                if (swiper.rtlTranslate) offsetProp = 'right'; else offsetProp = swiper.isHorizontal() ? 'left' : 'top';
64819                var slidesAfter;
64820                var slidesBefore;
64821
64822                if (centeredSlides) {
64823                    slidesAfter = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesAfter;
64824                    slidesBefore = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesBefore;
64825                } else {
64826                    slidesAfter = slidesPerView + (slidesPerGroup - 1) + addSlidesAfter;
64827                    slidesBefore = slidesPerGroup + addSlidesBefore;
64828                }
64829
64830                var from = Math.max((activeIndex || 0) - slidesBefore, 0);
64831                var to = Math.min((activeIndex || 0) + slidesAfter, slides.length - 1);
64832                var offset = (swiper.slidesGrid[from] || 0) - (swiper.slidesGrid[0] || 0);
64833                (0, _utils.extend)(swiper.virtual, {
64834                    from: from,
64835                    to: to,
64836                    offset: offset,
64837                    slidesGrid: swiper.slidesGrid
64838                });
64839
64840                function onRendered() {
64841                    swiper.updateSlides();
64842                    swiper.updateProgress();
64843                    swiper.updateSlidesClasses();
64844
64845                    if (swiper.lazy && swiper.params.lazy.enabled) {
64846                        swiper.lazy.load();
64847                    }
64848                }
64849
64850                if (previousFrom === from && previousTo === to && !force) {
64851                    if (swiper.slidesGrid !== previousSlidesGrid && offset !== previousOffset) {
64852                        swiper.slides.css(offsetProp, offset + "px");
64853                    }
64854
64855                    swiper.updateProgress();
64856                    return;
64857                }
64858
64859                if (swiper.params.virtual.renderExternal) {
64860                    swiper.params.virtual.renderExternal.call(swi
64860per, {
64861                        offset: offset,
64862                        from: from,
64863                        to: to,
64864                        slides: function getSlides() {
64865                            var slidesToRender = [];
64866
64867                            for (var i = from; i <= to; i += 1) {
64868                                slidesToRender.push(slides[i]);
64869                            }
64870
64871                            return slidesToRender;
64872                        }()
64873                    });
64874
64875                    if (swiper.params.virtual.renderExternalUpdate) {
64876                        onRendered();
64877                    }
64878
64879                    return;
64880                }
64881
64882                var prependIndexes = [];
64883                var appendIndexes = [];
64884
64885                if (force) {
64886                    swiper.$wrapperEl.find("." + swiper.params.slideClass).remove();
64887                } else {
64888                    for (var i = previousFrom; i <= previousTo; i += 1) {
64889                        if (i < from || i > to) {
64890                            swiper.$wrapperEl.find("." + swiper.params.slideClass + "[data-swiper-slide-index=\"" + i + "\"]").remove();
64891                        }
64892                    }
64893                }
64894
64895                for (var _i = 0; _i < slides.length; _i += 1) {
64896                    if (_i >= from && _i <= to) {
64897                        if (typeof previousTo === 'undefined' || force) {
64898                            appendIndexes.push(_i);
64899                        } else {
64900                            if (_i > previousTo) appendIndexes.push(_i);
64901                            if (_i < previousFrom) prependIndexes.push(_i);
64902                        }
64903                    }
64904                }
64905
64906                appendIndexes.forEach(function (index) {
64907                    swiper.$wrapperEl.append(renderSlide(slides[index], index));
64908                });
64909                prependIndexes.sort(function (a, b) {
64910                    return b - a;
64911                }
64911).forEach(function (index) {
64912                    swiper.$wrapperEl.prepend(renderSlide(slides[index], index));
64913                });
64914                swiper.$wrapperEl.children('.swiper-slide').css(offsetProp, offset + "px");
64915                onRendered();
64916            },
64917            renderSlide: function renderSlide(slide, index) {
64918                var swiper = this;
64919                var params = swiper.params.virtual;
64920
64921                if (params.cache && swiper.virtual.cache[index]) {
64922                    return swiper.virtual.cache[index];
64923                }
64924
64925                var $slideEl = params.renderSlide ? (0, _dom.default)(params.renderSlide.call(swiper, slide, index)) : (0, _dom.default)("<div class=\"" + swiper.params.slideClass + "\" data-swiper-slide-index=\"" + index + "\">" + slide + "</div>");
64926                if (!$slideEl.attr('data-swiper-slide-index')) $slideEl.attr('data-swiper-slide-index', index);
64927                if (params.cache) swiper.virtual.cache[index] = $slideEl;
64928                return $slideEl;
64929            },
64930            appendSlide: function appendSlide(slides) {
64931                var swiper = this;
64932
64933                if (typeof slides === 'object' && 'length' in slides) {
64934                    for (var i = 0; i < slides.length; i += 1) {
64935                        if (slides[i]) swiper.virtual.slides.push(slides[i]);
64936                    }
64937                } else {
64938                    swiper.virtual.slides.push(slides);
64939                }
64940
64941                swiper.virtual.update(true);
64942            },
64943            prependSlide: function prependSlide(slides) {
64944                var swiper = this;
64945                var activeIndex = swiper.activeIndex;
64946                var newActiveIndex = activeIndex + 1;
64947                var numberOfNewSlides = 1;
64948
64949                if (Array.isArray(slides)) {
64950                    for (var i = 0; i < slides.length; i += 1) {
64951                        if (slides[i]) swiper.virtual.slides.unshift(slides[i]);
64952                    }
64953
64954                    newActiveIndex = activeIndex + slides.length;
64955                    numberOfNewSlides = slides.length;
64956                } else {
64957                    swiper.virtual.slides.unshift(slides);
64958                }
64959
64960                if (swiper.params.virtual.cache) {
64961                    var cache = swiper.virtual.cache;
64962                    var newCache = {};
64963                    Object.keys(cache).forEach(function (cachedIndex) {
64964                        var $cachedEl = cache[cachedIndex];
64965                        var cachedElIndex = $cachedEl.attr('data-swiper-slide-index');
64966
64967                        if (cachedElIndex) {
64968                            $cachedEl.attr('data-swiper-slide-index', parseInt(cachedElIndex, 10) + 1);
64969                        }
64970
64971                        newCache[parseInt(cachedIndex, 10) + numberOfNewSlides] = $cachedEl;
64972                    });
64973                    swiper.virtual.cache = newCache;
64974                }
64975
64976                swiper.virtual.update(true);
64977                swiper.slideTo(newActiveIndex, 0);
64978            },
64979            removeSlide: function removeSlide(slidesIndexes) {
64980                var swiper = this;
64981                if (typeof slidesIndexes === 'undefined' || slidesIndexes === null) return;
64982                var activeIndex = swiper.activeIndex;
64983
64984                if (Array.isArray(slidesIndexes)) {
64985                    for (var i = slidesIndexes.length - 1; i >= 0; i -= 1) {
64986                        swiper.virtual.slides.splice(slidesIndexes[i], 1);
64987
64988                        if (swiper.params.virtual.cache) {
64989                            delete swiper.virtual.cache[slidesIndexes[i]];
64990                        }
64991
64992                        if (slidesIndexes[i] < activeIndex) activeIndex -= 1;
64993                        activeIndex = Math.max(activeIndex, 0);
64994                    }
64995                } else {
64996                    swiper.virtual.slides.splice(slidesIndexes, 1);
64997
64998                    if (swiper.params.virtual.cache) {
64999                        delete swiper.virtual.cache[slidesIndexes];
65000                    }
65001
65002                    if (slidesIndexes < activeIndex) activeIndex -= 1;
65003                    activeIndex = Math.max(activeIndex, 0);
65004                }
65005
65006                swiper.virtual.update(true);
65007                swiper.slideTo(activeIndex, 0);
65008            },
65009            removeAllSlides: function removeAllSlides() {
65010                var swiper = this;
65011                swiper.virtual.slides = [];
65012
65013                if (swiper.params.virtual.cache) {
65014                    swiper.virtual.cache = {};
65015                }
65016
65017                swiper.virtual.update(true);
65018                swiper.slideTo(0, 0);
65019            }
65020        };
65021        var _default = {
65022            name: 'virtual',
65023            params: {
65024                virtual: {
65025                    enabled: false,
65026                    slides: [],
65027                    cache: true,
65028                    renderSlide: null,
65029                    renderExternal: null,
65030                    renderExternalUpdate: true,
65031                    addSlidesBefore: 0,
65032                    addSlidesAfter: 0
65033                }
65034            },
65035            create: function create() {
65036                var swiper = this;
65037                (0, _utils.bindModuleMethods)(swiper, {
65038                    virtual: _extends(_extends({}, Virtual), {}, {
65039                        slides: swiper.params.virtual.slides,
65040                        cache: {}
65041                    })
65042                });
65043            },
65044            on: {
65045                beforeInit: function beforeInit(swiper) {
65046                    if (!swiper.params.virtual.enabled) return;
65047                    swiper.classNames.push(swiper.params.containerModifierClass + "virtual");
65048                    var overwriteParams = {
65049                        watchSlidesProgress: true
65050                    };
65051                    (0, _utils.extend)(swiper.params, overwriteParams);
65052                    (0, _utils.extend)(swiper.originalParams, overwriteParams);
65053
65054                    if (!swiper.params.initialSlide) {
65055                        swiper.virtual.update();
65056                    }
65057                },
65058                setTranslate: function setTranslate(swiper) {
65059                    if (!swiper.params.virtual.enabled) return;
65060                    swiper.virtual.update();
65061                }
65062            }
65063        };
65064        exports.default = _default;
65065    }, {"../../utils/dom": 94, "../../utils/utils": 98}],
65066    91: [function (require, module, exports) {
65067        "use strict";
65068
65069        exports.__esModule = true;
65070        exports.default = void 0;
65071
65072        var _dom = _interopRequireDefault(require("../../utils/dom"));
65073
65074        var _utils = require("../../utils/utils");
65075
65076        function _interopRequireDefault(obj) {
65077            return obj && obj.__esModule ? obj : {default: obj};
65078        }
65079
65080        function _extends() {
65081            _extends = Object.assign || function (target) {
65082                for (var i = 1; i < arguments.length; i++) {
65083                    var source = arguments[i];
65084                    for (var key in source) {
65085                        if (Object.prototype.hasOwnProperty.call(source, key)) {
65086                            target[key] = source[key];
65087                        }
65088                    }
65089                }
65090                return target;
65091            };
65092            return _extends.apply(this, arguments);
65093        }
65094
65095        var Zoom = {
65096            // Calc Scale From Multi-touches
65097            getDistanceBetweenTouches: function getDistanceBetweenTouches(e) {
65098                if (e.targetTouches.length < 2) return 1;
65099                var x1 = e.targetTouches[0].pageX;
65100                var y1 = e.targetTouches[0].pageY;
65101                var x2 = e.targetTouches[1].pageX;
65102                var y2 = e.targetTouches[1].pageY;
65103                var distance = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
65104                return distance;
65105            },
65106            // Events
65107            onGestureStart: function onGestureStart(e) {
65108                var swiper = this;
65109                var support = swiper.support;
65110                var params = swiper.params.zoom;
65111                var zoom = swiper.zoom;
65112                var gesture = zoom.gesture;
65113                zoom.fakeGestureTouched = false;
65114                zoom.fakeGestureMoved = false;
65115
65116                if (!support.gestures) {
65117                    if (e.type !== 'touchstart' || e.type === 'touchstart' && e.targetTouches.length < 2) {
65118                        return;
65119                    }
65120
65121                    zoom.fakeGestureTouched = true;
65122                    gesture.scaleStart = Zoom.getDistanceBetweenTouches(e);
65123                }
65124
65125                if (!gesture.$slideEl || !gesture.$slideEl.length) {
65126                    gesture.$slideEl = (0, _dom.default)(e.target).closest("." + swiper.params.slideClass);
65127                    if (gesture.$slideEl.length === 0) gesture.$slideEl = swiper.slides.eq(swiper.activeIndex);
65128                    gesture.$imageEl = gesture.$slideEl.find('img, svg, canvas, picture, .swiper-zoom-target');
65129                    gesture.$imageWrapEl = gesture.$imageEl.parent("." + params.containerClass);
65130                    gesture.maxRatio = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio;
65131
65132                    if (gesture.$imageWrapEl.length === 0) {
65133                        gesture.$imageEl = undefined;
65134                        return;
65135                    }
65136                }
65137
65138                if (gesture.$imageEl) {
65139                    gesture.$imageEl.transition(0);
65140                }
65141
65142                swiper.zoom.isScaling = true;
65143            },
65144            onGestureChange: function onGestureChange(e) {
65145                var swiper = this;
65146                var support = swiper.support;
65147                var params = swiper.params.zoom;
65148                var zoom = swiper.zoom;
65149                var gesture = zoom.gesture;
65150
65151                if (!support.gestures) {
65152                    if (e.type !== 'touchmove' || e.type === 'touchmove' && e.targetTouches.length < 2) {
65153                        return;
65154                    }
65155
65156                    zoom.fakeGestureMoved = true;
65157                    gesture.scaleMove = Zoom.getDistanceBetweenTouches(e);
65158                }
65159
65160                if (!gesture.$imageEl || gesture.$imageEl.length === 0) {
65161                    if (e.type === 'gesturechange') zoom.onGestureStart(e);
65162                    return;
65163                }
65164
65165                if (support.gestures) {
65166                    zoom.scale = e.scale * zoom.currentScale;
65167                } else {
65168                    zoom.scale = gesture.scaleMove / gesture.scaleStart * zoom.currentScale;
65169                }
65170
65171                if (zoom.scale > gesture.maxRatio) {
65172                    zoom.scale = gesture.maxRatio - 1 + Math.pow(zoom.scale - gesture.maxRatio + 1, 0.5);
65173                }
65174
65175                if (zoom.scale < params.minRatio) {
65176                    zoom.scale = params.minRatio + 1 - Math.pow(params.minRatio - zoom.scale + 1, 0.5);
65177                }
65178
65179                gesture.$imageEl.transform("translate3d(0,0,0) scale(" + zoom.scale + ")");
65180            },
65181            onGestureEnd: function onGestureEnd(e) {
65182                var swiper = this;
65183                var device = swiper.device;
65184                var support = swiper.support;
65185                var params = swiper.params.zoom;
65186                var zoom = swiper.zoom;
65187                var gesture = zoom.gesture;
65188
65189                if (!support.gestures) {
65190                    if (!zoom.fakeGestureTouched || !zoom.fakeGestureMoved) {
65191                        return;
65192                    }
65193
65194                    if (e.type !== 'touchend' || e.type === 'touchend' && e.changedTouches.length < 2 && !device.android) {
65195                        return;
65196                    }
65197
65198                    zoom.fakeGestureTouched = false;
65199                    zoom.fakeGestureMoved = false;
65200                }
65201
65202                if (!gesture.$imageEl || gesture.$imageEl.length === 0) return;
65203                zoom.scale = Math.max(Math.min(zoom.scale, gesture.maxRatio), params.minRatio);
65204                gesture.$imageEl.transition(swiper.params.speed).transform("translate3d(0,0,0) scale(" + zoom.scale + ")");
65205                zoom.currentScale = zoom.scale;
65206                zoom.isScaling = false;
65207                if (zoom.scale === 1) gesture.$slideEl = undefined;
65208            },
65209            onTouchStart: function onTouchStart(e) {
65210                var swiper = this;
65211                var device = swiper.device;
65212                var zoom = swiper.zoom;
65213                var gesture = zoom.gesture,
65214                    image = zoom.image;
65215                if (!gesture.$imageEl || gesture.$imageEl.length === 0) return;
65216                if (image.isTouched) return;
65217                if (device.android && e.cancelable) e.preventDefault();
65218                image.isTouched = true;
65219                image.touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
65220                image.touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
65221            },
65222            onTouchMove: function onTouchMove(e) {
65223                var swiper = this;
65224                var zoom = swiper.zoom;
65225                var gesture = zoom.gesture,
65226                    image = zoom.image,
65227                    velocity = zoom.velocity;
65228                if (!gesture.$imageEl || gesture.$imageEl.length === 0) return;
65229                swiper.allowClick = false;
65230                if (!image.isTouched || !gesture.$slideEl) return;
65231
65232                if (!image.isMoved) {
65233                    image.width = gesture.$imageEl[0].offsetWidth;
65234                    image.height = gesture.$imageEl[0].offsetHeight;
65235                    image.startX = (0, _utils.getTranslate)(gesture.$imageWrapEl[0], 'x') || 0;
65236                    image.startY = (0, _utils.getTranslate)(gesture.$imageWrapEl[0], 'y') || 0;
65237                    gesture.slideWidth = gesture.$slideEl[0].offsetWidth;
65238                    gesture.slideHeight = gesture.$slideEl[0].offsetHeight;
65239                    gesture.$imageWrapEl.transition(0);
65240
65241                    if (swiper.rtl) {
65242                        image.startX = -image.startX;
65243                        image.startY = -image.startY;
65244                    }
65245                } // Define if we need image drag
65246
65247
65248                var scaledWidth = image.width * zoom.scale;
65249                var scaledHeight = image.height * zoom.scale;
65250                if (scaledWidth < gesture.slideWidth && scaledHeight < gesture.slideHeight) return;
65251                image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0);
65252                image.maxX = -image.minX;
65253                image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0);
65254                image.maxY = -image.minY;
65255                image.touchesCurrent.x = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
65256                image.touchesCurrent.y = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
65257
65258                if (!image.isMoved && !zoom.isScaling) {
65259                    if (swiper.isHorizontal() && (Math.floor(image.minX) === Math.floor(image.startX) && image.touchesCurrent.x < image.touchesStart.x || Math.floor(image.maxX) === Math.floor(image.startX) && image.touchesCurrent.x > image.touchesStart.x)) {
65260                        image.isTouched = false;
65261                        return;
65262                    }
65263
65264                    if (!swiper.isHorizontal() && (Math.floor(image.minY) === Math.floor(image.startY) && image.touchesCurrent.y < image.touchesStart.y || Math.floor(image.maxY) === Math.floor(image.startY) && image.touchesCurrent.y > image.touchesStart.y)) {
65265                        image.isTouched = false;
65266                        return;
65267                    }
65268                }
65269
65270                if (e.cancelable) {
65271                    e.preventDefault();
65272                }
65273
65274                e.stopPropagation();
65275                image.isMoved = true;
65276                image.currentX = image.touchesCurrent.x - image.touchesStart.x + image.startX;
65277                image.currentY = image.touchesCurrent.y - image.touchesStart.y + image.startY;
65278
65279                if (image.currentX < image.minX) {
65280                    image.currentX = image.minX + 1 - Math.pow(image.minX - image.currentX + 1, 0.8);
65281                }
65282
65283                if (image.currentX > image.maxX) {
65284                    image.currentX = image.maxX - 1 + Math.pow(image.currentX - image.maxX + 1, 0.8);
65285                }
65286
65287                if (image.currentY < image.minY) {
65288                    image.currentY = image.minY + 1 - Math.pow(image.minY - image.currentY + 1, 0.8);
65289                }
65290
65291                if (image.currentY > image.maxY) {
65292                    image.currentY = image.maxY - 1 + Math.pow(image.currentY - image.maxY + 1, 0.8);
65293                } // Velocity
65294
65295
65296                if (!velocity.prevPositionX) velocity.prevPositionX = image.touchesCurrent.x;
65297                if (!velocity.prevPositionY) velocity.prevPositionY = image.touchesCurrent.y;
65298                if (!velocity.prevTime) velocity.prevTime = Date.now();
65299                velocity.x = (image.touchesCurrent.x - velocity.prevPositionX) / (Date.now() - velocity.prevTime) / 2;
65300                velocity.y = (image.touchesCurrent.y - velocity.prevPositionY) / (Date.now() - velocity.prevTime) / 2;
65301                if (Math.abs(image.touchesCurrent.x - velocity.prevPositionX) < 2) velocity.x = 0;
65302                if (Math.abs(image.touchesCurrent.y - velocity.prevPositionY) < 2) velocity.y = 0;
65303                velocity.prevPositionX = image.touchesCurrent.x;
65304                velocity.prevPositionY = image.touchesCurrent.y;
65305                velocity.prevTime = Date.now();
65306                gesture.$imageWrapEl.transform("translate3d(" + image.currentX + "px, " + image.currentY + "px,0)");
65307            },
65308            onTouchEnd: function onTouchEnd() {
65309                var swiper = this;
65310                var zoom = swiper.zoom;
65311                var gesture = zoom.gesture,
65312                    image = zoom.image,
65313                    velocity = zoom.velocity;
65314                if (!gesture.$imageEl || gesture.$imageEl.length === 0) return;
65315
65316                if (!image.isTouched || !image.isMoved) {
65317                    image.isTouched = false;
65318                    image.isMoved = false;
65319                    return;
65320                }
65321
65322                image.isTouched = false;
65323                image.isMoved = false;
65324                var momentumDurationX = 300;
65325                var momentumDurationY = 300;
65326                var momentumDistanceX = velocity.x * momentumDurationX;
65327                var newPositionX = image.currentX + momentumDistanceX;
65328                var momentumDistanceY = velocity.y * momentumDurationY;
65329                var newPositionY = image.currentY + momentumDistanceY; // Fix duration
65330
65331                if (velocity.x !== 0) momentumDurationX = Math.abs((newPositionX - image.currentX) / velocity.x);
65332                if (velocity.y !== 0) momentumDurationY = Math.abs((newPositionY - image.currentY) / velocity.y);
65333                var momentumDuration = Math.max(momentumDurationX, momentumDurationY);
65334                image.currentX = newPositionX;
65335                image.currentY = newPositionY; // Define if we need image drag
65336
65337                var scaledWidth = image.width * zoom.scale;
65338                var scaledHeight = image.height * zoom.scale;
65339                image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0);
65340                image.maxX = -image.minX;
65341                image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0);
65342                image.maxY = -image.minY;
65343                image.currentX = Math.max(Math.min(image.currentX, image.maxX), image.minX);
65344                image.currentY = Math.max(Math.min(image.currentY, image.maxY), image.minY);
65345                gesture.$imageWrapEl.transition(momentumDuration).transform("translate3d(" + image.currentX + "px, " + image.currentY + "px,0
65345)");
65346            },
65347            onTransitionEnd: function onTransitionEnd() {
65348                var swiper = this;
65349                var zoom = swiper.zoom;
65350                var gesture = zoom.gesture;
65351
65352                if (gesture.$slideEl && swiper.previousIndex !== swiper.activeIndex) {
65353                    if (gesture.$imageEl) {
65354                        gesture.$imageEl.transform('translate3d(0,0,0) scale(1)');
65355                    }
65356
65357                    if (gesture.$imageWrapEl) {
65358                        gesture.$imageWrapEl.transform('translate3d(0,0,0)');
65359                    }
65360
65361                    zoom.scale = 1;
65362                    zoom.currentScale = 1;
65363                    gesture.$slideEl = undefined;
65364                    gesture.$imageEl = undefined;
65365                    gesture.$imageWrapEl = undefined;
65366                }
65367            },
65368            // Toggle Zoom
65369            toggle: function toggle(e) {
65370                var swiper = this;
65371                var zoom = swiper.zoom;
65372
65373                if (zoom.scale && zoom.scale !== 1) {
65374                    // Zoom Out
65375                    zoom.out();
65376                } else {
65377                    // Zoom In
65378                    zoom.in(e);
65379                }
65380            },
65381            in: function _in(e) {
65382                var swiper = this;
65383                var zoom = swiper.zoom;
65384                var params = swiper.params.zoom;
65385                var gesture = zoom.gesture,
65386                    image = zoom.image;
65387
65388                if (!gesture.$slideEl) {
65389                    if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) {
65390                        gesture.$slideEl = swiper.$wrapperEl.children("." + swiper.params.slideActiveClass);
65391                    } else {
65392                        gesture.$slideEl = swiper.slides.eq(swiper.activeIndex);
65393                    }
65394
65395                    gesture.$imageEl = gesture.$slideEl.find('img, svg, canvas, picture, .swiper-zoom-target');
65396                    gesture.$imageWrapEl = gesture.$imageEl.parent("." + params.containerClass);
65397                }
65398
65399                if (!gesture.$imageEl || gesture.$imageEl.length === 0) return;
65400                gesture.$slideEl.addClass("" + params.zoomedSlideClass);
65401                var touchX;
65402                var touchY;
65403                var offsetX;
65404                var offsetY;
65405                var diffX;
65406                var diffY;
65407                var translateX;
65408                var translateY;
65409                var imageWidth;
65410                var imageHeight;
65411                var scaledWidth;
65412                var scaledHeight;
65413                var translateMinX;
65414                var translateMinY;
65415                var translateMaxX;
65416                var translateMaxY;
65417                var slideWidth;
65418                var slideHeight;
65419
65420                if (typeof image.touchesStart.x === 'undefined' && e) {
65421                    touchX = e.type === 'touchend' ? e.changedTouches[0].pageX : e.pageX;
65422                    touchY = e.type === 'touchend' ? e.changedTouches[0].pageY : e.pageY;
65423                } else {
65424                    touchX = image.touchesStart.x;
65425                    touchY = image.touchesStart.y;
65426                }
65427
65428                zoom.scale = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio;
65429                zoom.currentScale = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio;
65430
65431                if (e) {
65432                    slideWidth = gesture.$slideEl[0].offsetWidth;
65433                    slideHeight = gesture.$slideEl[0].offsetHeight;
65434                    offsetX = gesture.$slideEl.offset().left;
65435                    offsetY = gesture.$slideEl.offset().top;
65436                    diffX = offsetX + slideWidth / 2 - touchX;
65437                    diffY = offsetY + slideHeight / 2 - touchY;
65438                    imageWidth = gesture.$imageEl[0].offsetWidth;
65439                    imageHeight = gesture.$imageEl[0].offsetHeight;
65440                    scaledWidth = imageWidth * zoom.scale;
65441                    scaledHeight = imageHeight * zoom.scale;
65442                    translateMinX = Math.min(slideWidth / 2 - scaledWidth / 2, 0);
65443                    translateMinY = Math.min(slideHeight / 2 - scaledHeight / 2, 0);
65444                    translateMaxX = -translateMinX;
65445                    translateMaxY = -translateMinY;
65446                    translateX = diffX * zoom.scale;
65447                    translateY = diffY * zoom.scale;
65448
65449                    if (translateX < translateMinX) {
65450                        translateX = translateMinX;
65451                    }
65452
65453                    if (translateX > translateMaxX) {
65454                        translateX = translateMaxX;
65455                    }
65456
65457                    if (translateY < translateMinY) {
65458                        translateY = translateMinY;
65459                    }
65460
65461                    if (translateY > translateMaxY) {
65462                        translateY = translateMaxY;
65463                    }
65464                } else {
65465                    translateX = 0;
65466                    translateY = 0;
65467                }
65468
65469                gesture.$imageWrapEl.transition(300).transform("translate3d(" + translateX + "px, " + translateY + "px,0
65469)");
65470                gesture.$imageEl.transition(300).transform("translate3d(0,0,0) scale(" + zoom.scale + ")");
65471            },
65472            out: function out() {
65473                var swiper = this;
65474                var zoom = swiper.zoom;
65475                var params = swiper.params.zoom;
65476                var gesture = zoom.gesture;
65477
65478                if (!gesture.$slideEl) {
65479                    if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) {
65480                        gesture.$slideEl = swiper.$wrapperEl.children("." + swiper.params.slideActiveClass);
65481                    } else {
65482                        gesture.$slideEl = swiper.slides.eq(swiper.activeIndex);
65483                    }
65484
65485                    gesture.$imageEl = gesture.$slideEl.find('img, svg, canvas, picture, .swiper-zoom-target');
65486                    gesture.$imageWrapEl = gesture.$imageEl.parent("." + params.containerClass);
65487                }
65488
65489                if (!gesture.$imageEl || gesture.$imageEl.length === 0) return;
65490                zoom.scale = 1;
65491                zoom.currentScale = 1;
65492                gesture.$imageWrapEl.transition(300).transform('translate3d(0,0,0)');
65493                gesture.$imageEl.transition(300).transform('translate3d(0,0,0) scale(1)');
65494                gesture.$slideEl.removeClass("" + params.zoomedSlideClass);
65495                gesture.$slideEl = undefined;
65496            },
65497            toggleGestures: function toggleGestures(method) {
65498                var swiper = this;
65499                var zoom = swiper.zoom;
65500                var selector = zoom.slideSelector,
65501                    passive = zoom.passiveListener;
65502                swiper.$wrapperEl[method]('gesturestart', selector, zoom.onGestureStart, passive);
65503                swiper.$wrapperEl[method]('gesturechange', selector, zoom.onGestureChange, passive);
65504                swiper.$wrapperEl[method]('gestureend', selector, zoom.onGestureEnd, passive);
65505            },
65506            enableGestures: function enableGestures() {
65507                if (this.zoom.gesturesEnabled) return;
65508                this.zoom.gesturesEnabled = true;
65509                this.zoom.toggleGestures('on');
65510            },
65511            disableGestures: function disableGestures() {
65512                if (!this.zoom.gesturesEnabled) return;
65513                this.zoom.gesturesEnabled = false;
65514                this.zoom.toggleGestures('off');
65515            },
65516            // Attach/Detach Events
65517            enable: function enable() {
65518                var swiper = this;
65519                var support = swiper.support;
65520                var zoom = swiper.zoom;
65521                if (zoom.enabled) return;
65522                zoom.enabled = true;
65523                var passiveListener = swiper.touchEvents.start === 'touchstart' && support.passiveListener && swiper.params.passiveListeners ? {
65524                    passive: true,
65525                    capture: false
65526                } : false;
65527                var activeListenerWithCapture = support.passiveListener ? {
65528                    passive: false,
65529                    capture: true
65530                } : true;
65531                var slideSelector = "." + swiper.params.slideClass;
65532                swiper.zoom.passiveListener = passiveListener;
65533                swiper.zoom.slideSelector = slideSelector; // Scale image
65534
65535                if (support.gestures) {
65536                    swiper.$wrapperEl.on(swiper.touchEvents.start, swiper.zoom.enableGestures, passiveListener);
65537                    swiper.$wrapperEl.on(swiper.touchEvents.end, swiper.zoom.disableGestures, passiveListener);
65538                } else if (swiper.touchEvents.start === 'touchstart') {
65539                    swiper.$wrapperEl.on(swiper.touchEvents.start, slideSelector, zoom.onGestureStart, passiveListener);
65540                    swiper.$wrapperEl.on(swiper.touchEvents.move, slideSelector, zoom.onGestureChange, activeListenerWithCapture);
65541                    swiper.$wrapperEl.on(swiper.touchEvents.end, slideSelector, zoom.onGestureEnd, passiveListener);
65542
65543                    if (swiper.touchEvents.cancel) {
65544                        swiper.$wrapperEl.on(swiper.touchEvents.cancel, slideSelector, zoom.onGestureEnd, passiveListener);
65545                    }
65546                } // Move image
65547
65548
65549                swiper.$wrapperEl.on(swiper.touchEvents.move, "." + swiper.params.zoom.containerClass, zoom.onTouchMove, activeListenerWithCapture);
65550            },
65551            disable: function disable() {
65552                var swiper = this;
65553                var zoom = swiper.zoom;
65554                if (!zoom.enabled) return;
65555                var support = swiper.support;
65556                swiper.zoom.enabled = false;
65557                var passiveListener = swiper.touchEvents.start === 'touchstart' && support.passiveListener && swiper.params.passiveListeners ? {
65558                    passive: true,
65559                    capture: false
65560                } : false;
65561                var activeListenerWithCapture = support.passiveListener ? {
65562                    passive: false,
65563                    capture: true
65564                } : true;
65565                var slideSelector = "." + swiper.params.slideClass; // Scale image
65566
65567                if (support.gestures) {
65568                    swiper.$wrapperEl.off(swiper.touchEvents.start, swiper.zoom.enableGestures, passiveListener);
65569                    swiper.$wrapperEl.off(swiper.touchEvents.end, swiper.zoom.disableGestures, passiveListener);
65570                } else if (swiper.touchEvents.start === 'touchstart') {
65571                    swiper.$wrapperEl.off(swiper.touchEvents.start, slideSelector, zoom.onGestureStart, passiveListener);
65572                    swiper.$wrapperEl.off(swiper.touchEvents.move, slideSelector, zoom.onGestureChange, activeListenerWithCapture);
65573                    swiper.$wrapperEl.off(swiper.touchEvents.end, slideSelector, zoom.onGestureEnd, passiveListener);
65574
65575                    if (swiper.touchEvents.cancel) {
65576                        swiper.$wrapperEl.off(swiper.touchEvents.cancel, slideSelector, zoom.onGestureEnd, passiveListener);
65577                    }
65578                } // Move image
65579
65580
65581                swiper.$wrapperEl.off(swiper.touchEvents.move, "." + swiper.params.zoom.containerClass, zoom.onTouchMove, activeListenerWithCapture);
65582            }
65583        };
65584        var _default = {
65585            name: 'zoom',
65586            params: {
65587                zoom: {
65588                    enabled: false,
65589                    maxRatio: 3,
65590                    minRatio: 1,
65591                    toggle: true,
65592                    containerClass: 'swiper-zoom-container',
65593                    zoomedSlideClass: 'swiper-slide-zoomed'
65594                }
65595            },
65596            create: function create() {
65597                var swiper = this;
65598                (0, _utils.bindModuleMethods)(swiper, {
65599                    zoom: _extends({
65600                        enabled: false,
65601                        scale: 1,
65602                        currentScale: 1,
65603                        isScaling: false,
65604                        gesture: {
65605                            $slideEl: undefined,
65606                            slideWidth: undefined,
65607                            slideHeight: undefined,
65608                            $imageEl: undefined,
65609                            $imageWrapEl: undefined,
65610                            maxRatio: 3
65611                        },
65612                        image: {
65613                            isTouched: undefined,
65614                            isMoved: undefined,
65615                            currentX: undefined,
65616                            currentY: undefined,
65617                            minX: undefined,
65618                            minY: undefined,
65619                            maxX: undefined,
65620                            maxY: undefined,
65621                            width: undefined,
65622                            height: undefined,
65623                            startX: undefined,
65624                            startY: undefined,
65625                            touchesStart: {},
65626                            touchesCurrent: {}
65627                        },
65628                        velocity: {
65629                            x: undefined,
65630                            y: undefined,
65631                            prevPositionX: undefined,
65632                            prevPositionY: undefined,
65633                            prevTime: undefined
65634                        }
65635                    }, Zoom)
65636                });
65637                var scale = 1;
65638                Object.defineProperty(swiper.zoom, 'scale', {
65639                    get: function get() {
65640                        return scale;
65641                    },
65642                    set: function set(value) {
65643                        if (scale !== value) {
65644                            var imageEl = swiper.zoom.gesture.$imageEl ? swiper.zoom.gesture.$imageEl[0] : undefined;
65645                            var slideEl = swiper.zoom.gesture.$slideEl ? swiper.zoom.gesture.$slideEl[0] : undefined;
65646                            swiper.emit('zoomChange', value, imageEl, slideEl);
65647                        }
65648
65649                        scale = value;
65650                    }
65651                });
65652            },
65653            on: {
65654                init: function init(swiper) {
65655                    if (swiper.params.zoom.enabled) {
65656                        swiper.zoom.enable();
65657                    }
65658                },
65659                destroy: function destroy(swiper) {
65660                    swiper.zoom.disable();
65661                },
65662                touchStart: function touchStart(swiper, e) {
65663                    if (!swiper.zoom.enabled) return;
65664                    swiper.zoom.onTouchStart(e);
65665                },
65666                touchEnd: function touchEnd(swiper, e) {
65667                    if (!swiper.zoom.enabled) return;
65668                    swiper.zoom.onTouchEnd(e);
65669                },
65670                doubleTap: function doubleTap(swiper, e) {
65671                    if (swiper.params.zoom.enabled && swiper.zoom.enabled && swiper.params.zoom.toggle) {
65672                        swiper.zoom.toggle(e);
65673                    }
65674                },
65675                transitionEnd: function transitionEnd(swiper) {
65676                    if (swiper.zoom.enabled && swiper.params.zoom.enabled) {
65677                        swiper.zoom.onTransitionEnd();
65678                    }
65679                },
65680                slideChange: function slideChange(swiper) {
65681                    if (swiper.zoom.enabled && swiper.params.zoom.enabled && swiper.params.cssMode) {
65682                        swiper.zoom.onTransitionEnd();
65683                    }
65684                }
65685            }
65686        };
65687        exports.default = _default;
65688    }, {"../../utils/dom": 94, "../../utils/utils": 98}],
65689    92: [function (require, module, exports) {
65690        "use strict";
65691
65692        exports.__esModule = true;
65693        exports.default = void 0;
65694
65695        var _ssrWindow = require("ssr-window");
65696
65697        var _utils = require("../../utils/utils");
65698
65699        function _extends() {
65700            _extends = Object.assign || function (target) {
65701                for (var i = 1; i < arguments.length; i++) {
65702                    var source = arguments[i];
65703                    for (var key in source) {
65704                        if (Object.prototype.hasOwnProperty.call(source, key)) {
65705                            target[key] = source[key];
65706                        }
65707                    }
65708                }
65709                return target;
65710            };
65711            return _extends.apply(this, arguments);
65712        }
65713
65714        var Observer = {
65715            attach: function attach(target, options) {
65716                if (options === void 0) {
65717                    options = {};
65718                }
65719
65720                var window = (0, _ssrWindow.getWindow)();
65721                var swiper = this;
65722                var ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;
65723                var observer = new ObserverFunc(function (mutations) {
65724                    // The observerUpdate event should only be triggered
65725                    // once despite the number of mutations.  Additional
65726                    // triggers are redundant and are very costly
65727                    if (mutations.length === 1) {
65728                        swiper.emit('observerUpdate', mutations[0]);
65729                        return;
65730                    }
65731
65732                    var observerUpdate = function observerUpdate() {
65733                        swiper.emit('observerUpdate', mutations[0]);
65734                    };
65735
65736                    if (window.requestAnimationFrame) {
65737                        window.requestAnimationFrame(observerUpdate);
65738                    } else {
65739                        window.setTimeout(observerUpdate, 0);
65740                    }
65741                });
65742                observer.observe(target, {
65743                    attributes: typeof options.attributes === 'undefined' ? true : options.attributes,
65744                    childList: typeof options.childList === 'undefined' ? true : options.childList,
65745                    characterData: typeof options.characterData === 'undefined' ? true : options.characterData
65746                });
65747                swiper.observer.observers.push(observer);
65748            },
65749            init: function init() {
65750                var swiper = this;
65751                if (!swiper.support.observer || !swiper.params.observer) return;
65752
65753                if (swiper.params.observeParents) {
65754                    var containerParents = swiper.$el.parents();
65755
65756                    for (var i = 0; i < containerParents.length; i += 1) {
65757                        swiper.observer.attach(containerParents[i]);
65758                    }
65759                } // Observe container
65760
65761
65762                swiper.observer.attach(swiper.$el[0], {
65763                    childList: swiper.params.observeSlideChildren
65764                }); // Observe wrapper
65765
65766                swiper.observer.attach(swiper.$wrapperEl[0], {
65767                    attributes: false
65768                });
65769            },
65770            destroy: function destroy() {
65771                var swiper = this;
65772                swiper.observer.observers.forEach(function (observer) {
65773                    observer.disconnect();
65774                });
65775                swiper.observer.observers = [];
65776            }
65777        };
65778        var _default = {
65779            name: 'observer',
65780            params: {
65781                observer: false,
65782                observeParents: false,
65783                observeSlideChildren: false
65784            },
65785            create: function create() {
65786                var swiper = this;
65787                (0, _utils.bindModuleMethods)(swiper, {
65788                    observer: _extends(_extends({}, Observer), {}, {
65789                        observers: []
65790                    })
65791                });
65792            },
65793            on: {
65794                init: function init(swiper) {
65795                    swiper.observer.init();
65796                },
65797                destroy: function destroy(swiper) {
65798                    swiper.observer.destroy();
65799                }
65800            }
65801        };
65802        exports.default = _default;
65803    }, {"../../utils/utils": 98, "ssr-window": 10}],
65804    93: [function (require, module, exports) {
65805        "use strict";
65806
65807        exports.__esModule = true;
65808        exports.default = void 0;
65809
65810        var _ssrWindow = require("ssr-window");
65811
65812        var _utils = require("../../utils/utils");
65813
65814        var _default = {
65815            name: 'resize',
65816            create: function create() {
65817                var swiper = this;
65818                (0, _utils.extend)(swiper, {
65819                    resize: {
65820                        resizeHandler: function resizeHandler() {
65821                            if (!swiper || swiper.destroyed || !swiper.initialized) return;
65822                            swiper.emit('beforeResize');
65823                            swiper.emit('resize');
65824                        },
65825                        orientationChangeHandler: function orientationChangeHandler() {
65826                            if (!swiper || swiper.destroyed || !swiper.initialized) return;
65827                            swiper.emit('orientationchange');
65828                        }
65829                    }
65830                });
65831            },
65832            on: {
65833                init: function init(swiper) {
65834                    var window = (0, _ssrWindow.getWindow)(); // Emit resize
65835
65836                    window.addEventListener('resize', swiper.resize.resizeHandler); // Emit orientationchange
65837
65838                    window.addEventListener('orientationchange', swiper.resize.orientationChangeHandler);
65839                },
65840                destroy: function destroy(swiper) {
65841                    var window = (0, _ssrWindow.getWindow)();
65842                    window.removeEventListener('resize', swiper.resize.resizeHandler);
65843                    window.removeEventListener('orientationchange', swiper.resize.orientationChangeHandler);
65844                }
65845            }
65846        };
65847        exports.default = _default;
65848    }, {"../../utils/utils": 98, "ssr-window": 10}],
65849    94: [function (require, module, exports) {
65850        "use strict";
65851
65852        exports.__esModule = true;
65853        exports.default = void 0;
65854
65855        var _dom = require("dom7");
65856
65857        var Methods = {
65858            addClass: _dom.addClass,
65859            removeClass: _dom.removeClass,
65860            hasClass: _dom.hasClass,
65861            toggleClass: _dom.toggleClass,
65862            attr: _dom.attr,
65863            removeAttr: _dom.removeAttr,
65864            transform: _dom.transform,
65865            transition: _dom.transition,
65866            on: _dom.on,
65867            off: _dom.off,
65868            trigger: _dom.trigger,
65869            transitionEnd: _dom.transitionEnd,
65870            outerWidth: _dom.outerWidth,
65871            outerHeight: _dom.outerHeight,
65872            styles: _dom.styles,
65873            offset: _dom.offset,
65874            css: _dom.css,
65875            each: _dom.each,
65876            html: _dom.html,
65877            text: _dom.text,
65878            is: _dom.is,
65879            index: _dom.index,
65880            eq: _dom.eq,
65881            append: _dom.append,
65882            prepend: _dom.prepend,
65883            next: _dom.next,
65884            nextAll: _dom.nextAll,
65885            prev: _dom.prev,
65886            prevAll: _dom.prevAll,
65887            parent: _dom.parent,
65888            parents: _dom.parents,
65889            closest: _dom.closest,
65890            find: _dom.find,
65891            children: _dom.children,
65892            filter: _dom.filter,
65893            remove: _dom.remove
65894        };
65895        Object.keys(Methods).forEach(function (methodName) {
65896            _dom.$.fn[methodName] = Methods[methodName];
65897        });
65898        var _default = _dom.$;
65899        exports.default = _default;
65900    }, {"dom7": 4}],
65901    95: [function (require, module, exports) {
65902        "use strict";
65903
65904        exports.__esModule = true;
65905        exports.getBrowser = getBrowser;
65906
65907        var _ssrWindow = require("ssr-window");
65908
65909        var browser;
65910
65911        function calcBrowser() {
65912            var window = (0, _ssrWindow.getWindow)();
65913
65914            function isSafari() {
65915                var ua = window.navigator.userAgent.toLowerCase();
65916                return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0;
65917            }
65918
65919            return {
65920                isEdge: !!window.navigator.userAgent.match(/Edge/g),
65921                isSafari: isSafari(),
65922                isWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent)
65923            };
65924        }
65925
65926        function getBrowser() {
65927            if (!browser) {
65928                browser = calcBrowser();
65929            }
65930
65931            return browser;
65932        }
65933    }, {"ssr-window": 10}],
65934    96: [function (require, module, exports) {
65935        "use strict";
65936
65937        exports.__esModule = true;
65938        exports.getDevice = getDevice;
65939
65940        var _ssrWindow = require("ssr-window");
65941
65942        var _getSupport = require("./get-support");
65943
65944        var device;
65945
65946        function calcDevice(_temp) {
65947            var _ref = _temp === void 0 ? {} : _temp,
65948                userAgent = _ref.userAgent;
65949
65950            var support = (0, _getSupport.getSupport)();
65951            var window = (0, _ssrWindow.getWindow)();
65952            var platform = window.navigator.platform;
65953            var ua = userAgent || window.navigator.userAgent;
65954            var device = {
65955                ios: false,
65956                android: false
65957            };
65958            var screenWidth = window.screen.width;
65959            var screenHeight = window.screen.height;
65960            var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
65961
65962            var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
65963            var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
65964            var iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
65965            var windows = platform === 'Win32';
65966            var macos = platform === 'MacIntel'; // iPadOs 13 fix
65967
65968            var iPadScreens = ['1024x1366', '1366x1024', '834x1194', '1194x834', '834x1112', '1112x834', '768x1024', '1024x768', '820x1180', '1180x820', '810x1080', '1080x810'];
65969
65970            if (!ipad && macos && support.touch && iPadScreens.indexOf(screenWidth + "x" + screenHeight) >= 0) {
65971                ipad = ua.match(/(Version)\/([\d.]+)/);
65972                if (!ipad) ipad = [0, 1, '13_0_0'];
65973                macos = false;
65974            } // Android
65975
65976
65977            if (android && !windows) {
65978                device.os = 'android';
65979                device.android = true;
65980            }
65981
65982            if (ipad || iphone || ipod) {
65983                device.os = 'ios';
65984                device.ios = true;
65985            } // Export object
65986
65987
65988            return device;
65989        }
65990
65991        function getDevice(overrides) {
65992            if (overrides === void 0) {
65993                overrides = {};
65994            }
65995
65996            if (!device) {
65997                device = calcDevice(overrides);
65998            }
65999
66000            return device;
66001        }
66002    }, {"./get-support": 97, "ssr-window": 10}],
66003    97: [function (require, module, exports) {
66004        "use strict";
66005
66006        exports.__esModule = true;
66007        exports.getSupport = getSupport;
66008
66009        var _ssrWindow = require("ssr-window");
66010
66011        var support;
66012
66013        function calcSupport() {
66014            var window = (0, _ssrWindow.getWindow)();
66015            var document = (0, _ssrWindow.getDocument)();
66016            return {
66017                touch: !!('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch),
66018                pointerEvents: !!window.PointerEvent && 'maxTouchPoints' in window.navigator && window.navigator.maxTouchPoints >= 0,
66019                observer: function checkObserver() {
66020                    return 'MutationObserver' in window || 'WebkitMutationObserver' in window;
66021                }(),
66022                passiveListener: function checkPassiveListener() {
66023                    var supportsPassive = false;
66024
66025                    try {
66026                        var opts = Object.defineProperty({}, 'passive', {
66027                            // eslint-disable-next-line
66028                            get: function get() {
66029                                supportsPassive = true;
66030                            }
66031                        });
66032                        window.addEventListener('testPassiveListener', null, opts);
66033                    } catch (e) {// No support
66034                    }
66035
66036                    return supportsPassive;
66037                }(),
66038                gestures: function checkGestures() {
66039                    return 'ongesturestart' in window;
66040                }()
66041            };
66042        }
66043
66044        function getSupport() {
66045            if (!support) {
66046                support = calcSupport();
66047            }
66048
66049            return support;
66050        }
66051    }, {"ssr-window": 10}],
66052    98: [function (require, module, exports) {
66053        "use strict";
66054
66055        exports.__esModule = true;
66056        exports.deleteProps = deleteProps;
66057        exports.nextTick = nextTick;
66058        exports.now = now;
66059        exports.getTranslate = getTranslate;
66060        exports.isObject = isObject;
66061        exports.extend = extend;
66062        exports.bindModuleMethods = bindModuleMethods;
66063
66064        var _ssrWindow = require("ssr-window");
66065
66066        function deleteProps(obj) {
66067            var object = obj;
66068            Object.keys(object).forEach(function (key) {
66069                try {
66070                    object[key] = null;
66071                } catch (e) {// no getter for object
66072                }
66073
66074                try {
66075                    delete object[key];
66076                } catch (e) {// something got wrong
66077                }
66078            });
66079        }
66080
66081        function nextTick(callback, delay) {
66082            if (delay === void 0) {
66083                delay = 0;
66084            }
66085
66086            return setTimeout(callback, delay);
66087        }
66088
66089        function now() {
66090            return Date.now();
66091        }
66092
66093        function getTranslate(el, axis) {
66094            if (axis === void 0) {
66095                axis = 'x';
66096            }
66097
66098            var window = (0, _ssrWindow.getWindow)();
66099            var matrix;
66100            var curTransform;
66101            var transformMatrix;
66102            var curStyle = window.getComputedStyle(el, null);
66103
66104            if (window.WebKitCSSMatrix) {
66105                curTransform = curStyle.transform || curStyle.webkitTransform;
66106
66107                if (curTransform.split(',').length > 6) {
66108                    curTransform = curTransform.split(', ').map(function (a) {
66109                        return a.replace(',', '.');
66110                    }).join(', ');
66111                } // Some old versions of Webkit choke when 'none' is passed; pass
66112                // empty string instead in this case
66113
66114
66115                transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);
66116            } else {
66117                transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
66118                matrix = transformMatrix.toString().split(',');
66119            }
66120
66121            if (axis === 'x') {
66122                // Latest Chrome and webkits Fix
66123                if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41; // Crazy IE10 Matrix
66124                else if (matrix.length === 16) curTransform = parseFloat(matrix[12]); // Normal Browsers
66125                else curTransform = parseFloat(matrix[4]);
66126            }
66127
66128            if (axis === 'y') {
66129                // Latest Chrome and webkits Fix
66130                if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42; // Crazy IE10 Matrix
66131                else if (matrix.length === 16) curTransform = parseFloat(matrix[13]); // Normal Browsers
66132                else curTransform = parseFloat(matrix[5]);
66133            }
66134
66135            return curTransform || 0;
66136        }
66137
66138        function isObject(o) {
66139            return typeof o === 'object' && o !== null && o.constructor && o.constructor === Object;
66140        }
66141
66142        function extend() {
66143            var to = Object(arguments.length <= 0 ? undefined : arguments[0]);
66144
66145            for (var i = 1; i < arguments.length; i += 1) {
66146                var nextSource = i < 0 || arguments.length <= i ? undefined : arguments[i];
66147
66148                if (nextSource !== undefined && nextSource !== null) {
66149                    var keysArray = Object.keys(Object(nextSource));
66150
66151                    for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) {
66152                        var nextKey = keysArray[nextIndex];
66153                        var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
66154
66155                        if (desc !== undefined && desc.enumerable) {
66156                            if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) {
66157                                extend(to[nextKey], nextSource[nextKey]);
66158                            } else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) {
66159                                to[nextKey] = {};
66160                                extend(to[nextKey], nextSource[nextKey]);
66161                            } else {
66162                                to[nextKey] = nextSource[nextKey];
66163                            }
66164                        }
66165                    }
66166                }
66167            }
66168
66169            return to;
66170        }
66171
66172        function bindModuleMethods(instance, obj) {
66173            Object.keys(obj).forEach(function (key) {
66174                if (isObject(obj[key])) {
66175                    Object.keys(obj[key]).forEach(function (subKey) {
66176                        if (typeof obj[key][subKey] === 'function') {
66177                            obj[key][subKey] = obj[key][subKey].bind(instance);
66178                        }
66179                    });
66180                }
66181
66182                instance[key] = obj[key];
66183            });
66184        }
66185    }, {"ssr-window": 10}],
66186    99: [function (require, module, exports) {
66187        /**
66188         * Swiper 6.3.3
66189         * Most modern mobile touch slider and framework with hardware accelerated transitions
66190         * http://swiperjs.com
66191         *
66192         * Copyright 2014-2020 Vladimir Kharlampidi
66193         *
66194         * Released under the MIT License
66195         *
66196         * Released on: October 9, 2020
66197         */
66198
66199        'use strict';
66200
66201        Object.defineProperty(exports, '__esModule', {value: true});
66202
66203        function _interopDefault(ex) {
66204            return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex;
66205        }
66206
66207        var Swiper = _interopDefault(require('./cjs/components/core/core-class'));
66208        var Virtual = _interopDefault(require('./cjs/components/virtual/virtual'));
66209        var Keyboard = _interopDefault(require('./cjs/components/keyboard/keyboard'));
66210        var Mousewheel = _interopDefault(require('./cjs/components/mousewheel/mousewheel'));
66211        var Navigation = _interopDefault(require('./cjs/components/navigation/navigation'));
66212        var Pagination = _interopDefault(require('./cjs/components/pagination/pagination'));
66213        var Scrollbar = _interopDefault(require('./cjs/components/scrollbar/scrollbar'));
66214        var Parallax = _interopDefault(require('./cjs/components/parallax/parallax'));
66215        var Zoom = _interopDefault(require('./cjs/components/zoom/zoom'));
66216        var Lazy = _interopDefault(require('./cjs/components/lazy/lazy'));
66217        var Controller = _interopDefault(require('./cjs/components/controller/controller'));
66218        var A11y = _interopDefault(require('./cjs/components/a11y/a11y'));
66219        var History = _interopDefault(require('./cjs/components/history/history'));
66220        var HashNavigation = _interopDefault(require('./cjs/components/hash-navigation/hash-navigation'));
66221        var Autoplay = _interopDefault(require('./cjs/components/autoplay/autoplay'));
66222        var EffectFade = _interopDefault(require('./cjs/components/effect-fade/effect-fade'));
66223        var EffectCube = _interopDefault(require('./cjs/components/effect-cube/effect-cube'));
66224        var EffectFlip = _interopDefault(require('./cjs/components/effect-flip/effect-flip'));
66225        var EffectCoverflow = _interopDefault(require('./cjs/components/effect-coverflow/effect-coverflow'));
66226        var Thumbs = _interopDefault(require('./cjs/components/thumbs/thumbs'));
66227
66228// Swiper Class
66229        var components = [Virtual, Keyboard, Mousewheel, Navigation, Pagination, Scrollbar, Parallax, Zoom, Lazy, Controller, A11y, History, HashNavigation, Autoplay, EffectFade, EffectCube, EffectFlip, EffectCoverflow, Thumbs];
66230        Swiper.use(components);
66231
66232        exports.Swiper = Swiper;
66233        exports.default = Swiper;
66234
66235    }, {
66236        "./cjs/components/a11y/a11y": 11,
66237        "./cjs/components/autoplay/autoplay": 12,
66238        "./cjs/components/controller/controller": 13,
66239        "./cjs/components/core/core-class": 21,
66240        "./cjs/components/effect-coverflow/effect-coverflow": 76,
66241        "./cjs/components/effect-cube/effect-cube": 77,
66242        "./cjs/components/effect-fade/effect-fade": 78,
66243        "./cjs/components/effect-flip/effect-flip": 79,
66244        "./cjs/components/hash-navigation/hash-navigation": 80,
66245        "./cjs/components/history/history": 81,
66246        "./cjs/components/keyboard/keyboard": 82,
66247        "./cjs/components/lazy/lazy": 83,
66248        "./cjs/components/mousewheel/mousewheel": 84,
66249        "./cjs/components/navigation/navigation": 85,
66250        "./cjs/components/pagination/pagination": 86,
66251        "./cjs/components/parallax/parallax": 87,
66252        "./cjs/components/scrollbar/scrollbar": 88,
66253        "./cjs/components/thumbs/thumbs": 89,
66254        "./cjs/components/virtual/virtual": 90,
66255        "./cjs/components/zoom/zoom": 91
66256    }],
66257    100: [function (require, module, exports) {
66258        "use strict";
66259
66260        Object.defineProperty(exports, "__esModule", {
66261            value: true
66262        });
66263        exports["default"] = void 0;
66264
66265        var _Utils = _interopRequireDefault(require("./vendors/Utils"));
66266
66267        function _interopRequireDefault(obj) {
66268            return obj && obj.__esModule ? obj : {"default": obj};
66269        }
66270
66271        function ownKeys(object, enumerableOnly) {
66272            var keys = Object.keys(object);
66273            if (Object.getOwnPropertySymbols) {
66274                var symbols = Object.getOwnPropertySymbols(object);
66275                if (enumerableOnly) symbols = symbols.filter(function (sym) {
66276                    return Object.getOwnPropertyDescriptor(object, sym).enumerable;
66277                });
66278                keys.push.apply(keys, symbols);
66279            }
66280            return keys;
66281        }
66282
66283        function _objectSpread(target) {
66284            for (var i = 1; i < arguments.length; i++) {
66285                var source = arguments[i] != null ? arguments[i] : {};
66286                if (i % 2) {
66287                    ownKeys(Object(source), true).forEach(function (key) {
66288                        _defineProperty(target, key, source[key]);
66289                    });
66290                } else if (Object.getOwnPropertyDescriptors) {
66291                    Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
66292                } else {
66293                    ownKeys(Object(source)).forEach(function (key) {
66294                        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
66295                    });
66296                }
66297            }
66298            return target;
66299        }
66300
66301        function _defineProperty(obj, key, value) {
66302            if (key in obj) {
66303                Object.defineProperty(obj, key, {value: value, enumerable: true, configurable: true, writable: true});
66304            } else {
66305                obj[key] = value;
66306            }
66307            return obj;
66308        }
66309
66310        function _classCallCheck(instance, Constructor) {
66311            if (!(instance instanceof Constructor)) {
66312                throw new TypeError("Cannot call a class as a function");
66313            }
66314        }
66315
66316        function _defineProperties(target, props) {
66317            for (var i = 0; i < props.length; i++) {
66318                var descriptor = props[i];
66319                descriptor.enumerable = descriptor.enumerable || false;
66320                descriptor.configurable = true;
66321                if ("value" in descriptor) descriptor.writable = true;
66322                Object.defineProperty(target, descriptor.key, descriptor);
66323            }
66324        }
66325
66326        function _createClass(Constructor, protoProps, staticProps) {
66327            if (protoProps) _defineProperties(Constructor.prototype, protoProps);
66328            if (staticProps) _defineProperties(Constructor, staticProps);
66329            return Constructor;
66330        }
66331
66332        var ImagesGallery = /*#__PURE__*/function () {
66333            function ImagesGallery(itemSelector) {
66334                var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
66335
66336                _classCallCheck(this, ImagesGallery);
66337
66338                this.itemSelector = itemSelector;
66339                var defaultOptions = {};
66340                this.options = _objectSpread(_objectSpread({}, defaultOptions), options);
66341                this.galleries = [];
66342                this.items = document.querySelectorAll(this.itemSelector);
66343                this.currentGalleryId = null;
66344                this.DOM = {
66345                    gallery: document.querySelector('.ig'),
66346                    scroller: document.querySelector('.ig_scroller'),
66347                    caption: document.querySelector('.ig_caption'),
66348                    background: document.querySelector('.ig_background'),
66349                    close: document.querySelector('.ig_close'),
66350                    navPrev: document.querySelector('.ig_nav--prev'),
66351                    navNext: document.querySelector('.ig_nav--next')
66352                };
66353                this.createGalleries();
66354                this.initEvent();
66355            }
66356
66357            _createClass(ImagesGallery, [{
66358                key: "createGalleries",
66359                value: function createGalleries() {
66360                    var _this = this;
66361
66362                    this.items.forEach(function (item) {
66363                        var galleryId = item.getAttribute('data-ig');
66364
66365                        if (!galleryId) {
66366                            galleryId = _Utils["default"].guid();
66367                            item.setAttribute('data-ig', galleryId);
66368                        }
66369
66370                        _this.addItemToGallery(galleryId, item);
66371                    });
66372                }
66373            }, {
66374                key: "initEvent",
66375                value: function initEvent() {
66376                    var _this2 = this;
66377
66378                    this.items.forEach(function (item) {
66379                        item.addEventListener('click', function (event) {
66380                            _this2.onClick(event, item);
66381                        });
66382                    });
66383                    this.DOM.close.addEventListener('click', function (event) {
66384                        return _this2.closeGallery(event);
66385                    });
66386                    document.addEventListener("keyup", function (event) {
66387                        return _this2.onKeyUp(event);
66388                    });
66389                }
66390            }, {
66391                key: "onKeyUp",
66392                value: function onKeyUp(event) {
66393                    if (!this.currentGalleryId) return;
66394
66395                    if (event.keyCode == 37) {
66396                        this.goToPrev();
66397                    } else if (event.keyCode == 39) {
66398                        this.goToNext();
66399                    } else if (event.keyCode == 27) {
66400                        this.closeGallery();
66401                    }
66402                }
66403            }, {
66404                key: "addItemToGallery",
66405                value: function addItemToGallery(galleryId, item) {
66406                    if (!this.galleries[galleryId]) {
66407                        this.galleries[galleryId] = [];
66408                    }
66409
66410                    item.setAttribute('data-ig-index', this.galleries[galleryId].length);
66411                    this.galleries[galleryId].push({
66412                        src: item.getAttribute('href') || item.getAttribute('data-url'),
66413                        caption: item.getAttribute('data-ig-caption') || null
66414                    });
66415                }
66416            }, {
66417                key: "onClick",
66418                value: function onClick(event, item) {
66419                    event.preventDefault();
66420                    this.openGallery();
66421                    this.initGallery(item.getAttribute('data-ig'), item.getAttribute('data-ig-index'));
66422                }
66423            }, {
66424                key: "openGallery",
66425                value: function openGallery() {
66426                    this.DOM.gallery.classList.add('ig--opened');
66427                }
66428            }, {
66429                key: "initGallery",
66430                value: function initGallery(galleryId, index) {
66431                    var _this3 = this;
66432
66433                    this.DOM.scroller.innerHTML = '';
66434                    this.currentGalleryId = galleryId;
66435                    this.galleries[this.currentGalleryId].forEach(function (item) {
66436                        _this3.createSlide(item);
66437                    });
66438                    var nbSlides = this.galleries[this.currentGalleryId].length;
66439
66440                    if (nbSlides > 1) {
66441                        this.scrollToSlide(index, nbSlides);
66442
66443                        if (index == 0) {
66444                            this.DOM.navPrev.setAttribute('disabled', 'disabled');
66445                        }
66446
66447                        if (index == nbSlides - 1) {
66448                            this.DOM.navNext.setAttribute('disabled', 'disabled');
66449                        }
66450
66451                        this.DOM.navPrev.addEventListener('click', function (event) {
66452                            return _this3.goToPrev();
66453                        });
66454                        this.DOM.navNext.addEventListener('click', function (event) {
66455                            return _this3.goToNext();
66456                        });
66457                        this.DOM.gallery.classList.add('ig--multiple');
66458                        this.DOM.gallery.classList.remove('ig--single');
66459                    } else {
66460                        this.DOM.gallery.classList.add('ig--single');
66461                        this.DOM.gallery.classList.remove('ig--multiple');
66462                    }
66463                }
66464            }, {
66465                key: "createSlide",
66466                value: function createSlide(item) {
66467                    var _this4 = this;
66468
66469                    var slide = document.createElement('div');
66470                    slide.className = 'ig_item ig_item--loading';
66471                    slide.addEventListener('click', function (event) {
66472                        return _this4.closeGallery(event);
66473                    });
66474                    var loading = document.createElement('div');
66475                    loading.className = 'ig_loading';
66476                    slide.appendChild(loading);
66477                    var image = new Image();
66478                    slide.appendChild(image);
66479                    this.DOM.scroller.appendChild(slide);
66480
66481                    _Utils["default"].loadImage(item.src).then(function () {
66482                        image.src = item.src;
66483                        setTimeout(function () {
66484                            slide.classList.remove('ig_item--loading');
66485                        }, 100);
66486                    });
66487                }
66488            }, {
66489                key: "scrollToSlide",
66490                value: function scrollToSlide(index, totalItems, smooth) {
66491                    var scrollOptions = {};
66492                    scrollOptions.left = Math.floor(this.DOM.scroller.scrollWidth * (index / totalItems));
66493
66494                    if (smooth) {
66495                        scrollOptions.behavior = 'smooth';
66496                    }
66497
66498                    this.DOM.scroller.scrollTo(scrollOptions);
66499                }
66500            }, {
66501                key: "closeGallery",
66502                value: function closeGallery() {
66503                    this.DOM.gallery.classList.remove('ig--opened', 'ig--single', 'ig--multiple');
66504                    this.DOM.navPrev.removeAttribute('disabled');
66505                    this.DOM.navNext.removeAttribute('disabled');
66506                    this.currentGalleryId = null;
66507                }
66508            }, {
66509                key: "goToPrev",
66510                value: function goToPrev() {
66511                    var galleryItems = this.galleries[this.currentGalleryId].length;
66512                    var slideWidth = this.DOM.scroller.scrollWidth / galleryItems;
66513                    var currentSlide = Math.round(this.DOM.scroller.scrollLeft / slideWidth);
66514
66515                    if (currentSlide > 1) {
66516                        this.DOM.navPrev.removeAttribute('disabled');
66517                    } else {
66518                        this.DOM.navPrev.setAttribute('disabled', 'disabled');
66519                    }
66520
66521                    if (currentSlide > 0) {
66522                        this.scrollToSlide(currentSlide - 1, galleryItems, true);
66523                    }
66524
66525                    this.DOM.navNext.removeAttribute('disabled');
66526                }
66527            }, {
66528                key: "goToNext",
66529                value: function goToNext() {
66530                    var galleryItems = this.galleries[this.currentGalleryId].length;
66531                    var slideWidth = this.DOM.scroller.scrollWidth / galleryItems;
66532                    var currentSlide = Math.round(this.DOM.scroller.scrollLeft / slideWidth);
66533
66534                    if (currentSlide < galleryItems - 2) {
66535                        this.DOM.navNext.removeAttribute('disabled');
66536                    } else {
66537                        this.DOM.navNext.setAttribute('disabled', 'disabled');
66538                    }
66539
66540                    if (currentSlide < galleryItems - 1) {
66541                        this.scrollToSlide(currentSlide + 1, galleryItems, true);
66542                    }
66543
66544                    this.DOM.navPrev.removeAttribute('disabled');
66545                }
66546            }]);
66547
66548            return ImagesGallery;
66549        }();
66550
66551        var _default = ImagesGallery;
66552        exports["default"] = _default;
66553
66554    }, {"./vendors/Utils": 102}],
66555    101: [function (require, module, exports) {
66556        "use strict";
66557
66558        var _gsap = require("gsap");
66559
66560        var _bundle = _interopRequireDefault(require("swiper/bundle"));
66561
66562        var _lottieWeb = _interopRequireDefault(require("lottie-web"));
66563
66564        var _moment = _interopRequireDefault(require("moment"));
66565
66566        var _fr = _interopRequireDefault(require("moment/locale/fr"));
66567
66568        require("daterangepicker/daterangepicker.js");
66569
66570        var _chart = _interopRequireDefault(require("chart.js"));
66571
66572        var _ImagesGallery = _interopRequireDefault(require("./ImagesGallery"));
66573
66574        var _Utils = _interopRequireDefault(require("./vendors/Utils"));
66575
66576        var _WindowUtils = _interopRequireDefault(require("./vendors/WindowUtils"));
66577
66578        var _jquery = require("jquery");
66579
66580        function _interopRequireDefault(obj) {
66581            return obj && obj.__esModule ? obj : {"default": obj};
66582        }
66583
66584// import $ from "jquery";
66585        _moment["default"].updateLocale('fr', _fr["default"]);
66586
66587        _chart["default"].defaults.global.defaultFontFamily = 'Roboto';
66588// import GridDebug from './vendors/GridDebug';
66589// new GridDebug(12,0);
66590        var WU = new _WindowUtils["default"]();
66591
66592        if (WU.isTouch()) {
66593            $('html').addClass('isTouch');
66594        }
66595
66596        _gsap.gsap.defaults({
66597            ease: "expo.inOut"
66598        }); // ----------------------------------------------
66599// Load images & render its ---------------------
66600// ----------------------------------------------
66601
66602
66603        var loadImages = function loadImages() {
66604            $('.imageRender:not(.imageRender--loaded)').each(function () {
66605                var img = $(this);
66606                var url = img.attr('data-url');
66607                var cover = img.find('.imageRender_cover');
66608
66609                _Utils["default"].loadImage(url).then(function () {
66610                    cover.css('background-image', 'url(' + url + ')');
66611                    img.addClass('imageRender--loaded');
66612                });
66613            });
66614        };
66615
66616        (function () {
66617            if ($('[data-ig]').length > 0) {
66618                new _ImagesGallery["default"]('[data-ig]');
66619            } // ----------------------------------------------
66620            // Center Main Nav ------------------------------
66621            // ----------------------------------------------
66622
66623
66624            var activeLink = $('.mainNav').find('.active');
66625
66626            if (activeLink.length > 0) {
66627                var bounding = activeLink.get(0).getBoundingClientRect();
66628                $('.mainNav').get(0).scrollLeft = bounding.left - 20;
66629            } // ----------------------------------------------
66630            // Collapse menu --------------------------------
66631            // ----------------------------------------------
66632
66633
66634            var prevScrollpos = WU.w.st;
66635
66636            var toggleTopbar = function toggleTopbar() {
66637                if (prevScrollpos < WU.w.st && WU.w.st > WU.w.h / 5) {
66638                    $('html').attr('data-hide-topbar', '');
66639                } else {
66640                    $('html').removeAttr('data-hide-topbar');
66641                }
66642
66643                prevScrollpos = WU.w.st;
66644            }; // ----------------------------------------------
66645            // Preload images -------------------------------
66646            // ----------------------------------------------
66647
66648
66649            loadImages(); // ----------------------------------------------
66650            // Property list --------------------------------
66651            // ----------------------------------------------
66652
66653            if ($('.propertyCard_carousel').length) {
66654                $('.propertyCard_carousel').each(function () {
66655                    var carousel = $(this);
66656
66657                    var guid = _Utils["default"].guid();
66658
66659                    carousel.attr('data-carousel', guid);
66660                    new _bundle["default"]('.propertyCard_carousel[data-carousel="' + guid + '"] .swiper-container', {
66661                        slidesPerView: 1,
66662                        spaceBetween: 0,
66663                        navigation: {
66664                            prevEl: '.propertyCard_carousel[data-carousel="' + guid + '"] .customCarousel_nav--prev',
66665                            nextEl: '.propertyCard_carousel[data-carousel="' + guid + '"] .customCarousel_nav--next'
66666                        }
66667                    });
66668                });
66669            } // ----------------------------------------------
66670            // Property details carousels -------------------
66671            // ----------------------------------------------
66672
66673
66674            if ($('.property_pictures .swiper-container').length) {
66675                new _bundle["default"]('.property_pictures .swiper-container', {
66676                    slidesPerView: 4,
66677                    spaceBetween: 16,
66678                    navigation: {
66679                        prevEl: '.property_pictures .customCarousel_nav--prev',
66680                        nextEl: '.property_pictures .customCarousel_nav--next'
66681                    },
66682                    breakpoints: {
66683                        0: {
66684                            slidesPerView: 1
66685                        },
66686                        480: {
66687                            slidesPerView: 2
66688                        },
66689                        768: {
66690                            slidesPerView: 3
66691                        },
66692                        990: {
66693                            slidesPerView: 4
66694                        }
66695                    }
66696                });
66697            }
66698
66699            if ($('.property_actions .swiper-container').length) {
66700                new _bundle["default"]('.property_actions .swiper-container', {
66701                    slidesPerView: 3,
66702                    spaceBetween: 16,
66703                    navigation: {
66704                        prevEl: '.property_actions .customCarousel_nav--prev',
66705                        nextEl: '.property_actions .customCarousel_nav--next'
66706                    },
66707                    breakpoints: {
66708                        0: {
66709                            slidesPerView: 1
66710                        },
66711                        768: {
66712                            slidesPerView: 2
66713                        },
66714                        990: {
66715                            slidesPerView: 3
66716                        }
66717                    }
66718                });
66719            }
66720
66721            if ($('.property_calendar .swiper-container').length) {
66722                new _bundle["default"]('.property_calendar .swiper-container', {
66723                    slidesPerView: 6,
66724                    spaceBetween: 16,
66725                    navigation: {
66726                        prevEl: '.property_calendar_nav.customCarousel_nav--prev',
66727                        nextEl: '.property_calendar_nav.customCarousel_nav--next'
66728                    },
66729                    breakpoints: {
66730                        0: {
66731                            slidesPerView: 2
66732                        },
66733                        440: {
66734                            slidesPerView: 3
66735                        },
66736                        768: {
66737                            slidesPerView: 4
66738                        },
66739                        1100: {
66740                            slidesPerView: 6
66741                        }
66742                    }
66743                });
66744            } // ----------------------------------------------
66745            // Collapse component ---------------------------
66746            // ----------------------------------------------
66747
66748
66749            var collapse = function collapse(selector, parentSelector, contectSelector, openedClass) {
66750                $(selector).on('click', function (e) {
66751                    e.preventDefault();
66752                    var parent = $(this).closest(parentSelector);
66753                    var content = parent.find(contectSelector);
66754                    if (parent.attr('data-animating') == 'true') return;
66755
66756                    if (parent.hasClass(openedClass)) {
66757                        _gsap.TweenMax.to(content, {
66758                            height: 0,
66759                            duration: 0.4,
66760                            ease: "power4.out",
66761                            clearProps: 'all',
66762                            onStart: function onStart() {
66763                                parent.attr('data-animating', 'true');
66764                            },
66765                            onComplete: function onComplete() {
66766                                parent.removeAttr('data-animating');
66767                            }
66768                        });
66769
66770                        parent.removeClass(openedClass);
66771                    } else {
66772                        _gsap.gsap.set(content, {
66773                            height: 'auto'
66774                        });
66775
66776                        _gsap.TweenMax.from(content, {
66777                            height: 0,
66778                            duration: 0.4,
66779                            ease: "power4.out",
66780                            onStart: function onStart() {
66781                                parent.attr('data-animating', 'true');
66782                            },
66783                            onComplete: function onComplete() {
66784                                parent.removeAttr('data-animating');
66785                                content.height('auto');
66786                            }
66787                        });
66788
66789                        parent.addClass(openedClass);
66790                    }
66791                });
66792            };
66793
66794            collapse('.collapse_header', '.collapse', '.collapse_content', 'collapse--opened');
66795            collapse('.property_section--collapse .property_section_header_collapseMask', '.property_section--collapse', '.property_section_content', 'property_section--opened');
66796            collapse('.actionsMonth_collapseMask', '.actionsMonth', '.actionsMonth_content', 'actionsMonth--opened');
66797            collapse('.rental_section--collapse .rental_section_header_collapseMask', '.rental_section--collapse', '.rental_section_content', 'rental_section--opened');
66798            collapse('.propertyStats_section--collapse .propertyStats_section_header_collapseMask', '.propertyStats_section--collapse', '.propertyStats_section_content', 'propertyStats_section--opened');
66799            collapse('.panel_section--collapse .panel_section_header_collapseMask', '.panel_section--collapse', '.panel_section_content', 'panel_section--opened'); // ----------------------------------------------
66800            // Popins ---------------------------------------
66801            // ----------------------------------------------
66802
66803            var popinsBackground = $('.popinBackground');
66804            var popinsBackgroundOpened = false;
66805            var popins = [];
66806
66807            var hidePopin = function hidePopin(popinElt) {
66808                var TL = new _gsap.TimelineMax();
66809                TL.to(popinElt.find('.popin_box'), {
66810                    duration: 0.3,
66811                    opacity: 0,
66812                    y: 100,
66813                    ease: "expo.Out"
66814                });
66815                TL.set(popinElt, {
66816                    autoAlpha: 0
66817                });
66818            };
66819
66820            var showPopin = function showPopin(popinElt) {
66821                var TL = new _gsap.TimelineMax();
66822                TL.set(popinElt, {
66823                    autoAlpha: 1
66824                });
66825
66826                if (!popinsBackgroundOpened) {
66827                    TL.to(popinsBackground, {
66828                        duration: 0.2,
66829                        autoAlpha: 1,
66830                        ease: "none"
66831                    }, 0);
66832                }
66833
66834                TL.to(popinElt.find('.popin_box'), {
66835                    duration: 0.5,
66836                    opacity: 1,
66837                    y: 0,
66838                    ease: "expo.Out"
66839                }, popinsBackgroundOpened ? 0 : 0.1);
66840            };
66841
66842
66843            var openPopin = function openPopin(popinElt) {
66844                popins.push(popinElt);
66845                popinElt.get(0).scrollTop = 0;
66846                showPopin(popinElt);
66847                WU.clearScrollLocks();
66848                WU.disableScroll(popinElt.get(0));
66849            };
66850
66851            var closePopin = function closePopin(popinElt) {
66852                hidePopin(popinElt);
66853                popins.pop();
66854
66855                if (popins.length > 0) {
66856                    showPopin(popins[popins.length - 1]);
66857                } else {
66858                    hideBackground();
66859
66860                    if ($('.panel.panel--visible').length) {
66861                        WU.clearScrollLocks();
66862                        WU.disableScroll($('.panel.panel--visible .panel_scroller').get(0));
66863                    } else {
66864                        WU.clearScrollLocks();
66865                    }
66866                }
66867            };
66868
66869            var hideBackground = function hideBackground() {
66870                _gsap.gsap.to(popinsBackground, {
66871                    duration: 0.2,
66872                    autoAlpha: 0,
66873                    ease: "none"
66874                });
66875            };
66876
66877            var closePopins = function closePopins() {
66878                popins.forEach(function (popin) {
66879                    hidePopin(popin);
66880                });
66881                popins = [];
66882                hideBackground();
66883
66884                if ($('.panel.panel--visible').length) {
66885                    WU.clearScrollLocks();
66886                    WU.disableScroll($('.panel.panel--visible .panel_scroller').get(0));
66887                } else {
66888                    WU.clearScrollLocks();
66889                }
66890            };
66891
66892            var initPopins = function initPopins() {
66893                $('body').on('click', '[data-popin]', function (e) {
66894                    //$('[data-popin]').on('click', function (e) {
66895                    e.preventDefault();
66896                    var popinElt = $($(this).attr('data-popin'));
66897
66898                    if (popinElt.length > 0) {
66899                        if (popins.length > 0) {
66900                            hidePopin(popins[popins.length - 1]);
66901                        }
66902
66903                        openPopin(popinElt);
66904                    }
66905                }); // Close one popin
66906
66907                // $('#apartments-section').ready(function (e) {
66908                //     console.log('test');
66909                //     //$('[data-popin]').on('click', function (e) {
66910                //     // e.preventDefault();
66911                //     const popinElt = $($(this).attr('data-popin'));
66912                //     if (popinElt.length > 0)  {
66913                //         if (popins.length > 0) {
66914                //             hidePopin(popins[popins.length - 1]);
66915                //         }
66916                //         showPopin(popinElt);
66917                //     }
66918                // });
66919
66920
66921                $('.popin_close, [data-popin-close="true"]').on('click', function (e) {
66922                    e.preventDefault();
66923                    closePopin(popins[popins.length - 1]);
66924                }); // Close all popins
66925
66926                popinsBackground.on('click', function () {
66927                    hideBackground();
66928                    closePopins();
66929                });
66930                $('[data-popin-closeall="true"], .popin_bg').on('click', function () {
66931                    hideBackground();
66932                    closePopins();
66933                });
66934                $('#close_ok').on('click', function (e) {
66935                    e.preventDefault();
66936                    closePopin(popins[popins.length - 1]);
66937                });
66938            };
66939
66940            initPopins(); // ----------------------------------------------
66941            // Panels ---------------------------------------
66942            // ----------------------------------------------
66943
66944            var openPanel = function openPanel(panelElt) {
66945                panelElt.addClass('panel--visible');
66946                panelElt.find('.panel_scroller').get(0).scrollTop = 0;
66947                WU.disableScroll(panelElt.find('.panel_scroller').get(0));
66948
66949                if (WU.isXS()) {
66950                    _gsap.TweenMax.set(panelElt.find('.panel_wrap'), {
66951                        yPercent: 101
66952                    });
66953
66954                    _gsap.TweenMax.to(panelElt, {
66955                        duration: 0.2,
66956                        autoAlpha: 1,
66957                        ease: "none"
66958                    });
66959
66960                    _gsap.TweenMax.to(panelElt.find('.panel_wrap'), {
66961                        duration: 0.8,
66962                        yPercent: 0,
66963                        delay: 0.1,
66964                        ease: "expo.Out"
66965                    });
66966                } else {
66967                    _gsap.TweenMax.set(panelElt.find('.panel_wrap'), {
66968                        xPercent: 101
66969                    });
66970
66971                    _gsap.TweenMax.to(panelElt, {
66972                        duration: 0.2,
66973                        autoAlpha: 1,
66974                        ease: "none"
66975                    });
66976
66977                    _gsap.TweenMax.to(panelElt.find('.panel_wrap'), {
66978                        duration: 0.8,
66979                        xPercent: 0,
66980                        delay: 0.1,
66981                        ease: "expo.Out"
66982                    });
66983                }
66984            };
66985
66986            var closePanel = function closePanel(panelElt) {
66987                panelElt.removeClass('panel--visible');
66988                WU.enableScroll(panelElt.find('.panel_scroller').get(0));
66989
66990                if (WU.isXS()) {
66991                    _gsap.TweenMax.to(panelElt.find('.panel_wrap'), {
66992                        duration: 0.3,
66993                        yPercent: 101,
66994                        ease: "expo.Out"
66995                    });
66996
66997                    _gsap.TweenMax.to(panelElt, {
66998                        duration: 0.1,
66999                        autoAlpha: 0,
67000                        delay: 0.2,
67001                        ease: "none"
67002                    });
67003                } else {
67004                    _gsap.TweenMax.to(panelElt.find('.panel_wrap'), {
67005                        duration: 0.3,
67006                        xPercent: 101,
67007                        ease: "expo.Out"
67008                    });
67009
67010                    _gsap.TweenMax.to(panelElt, {
67011                        duration: 0.1,
67012                        autoAlpha: 0,
67013                        delay: 0.2,
67014                        ease: "none"
67015                    });
67016                }
67017            };
67018
67019            var initPanels = function initPanels() {
67020                $('[data-panel]').on('click', function (e) {
67021                    if ($(this).attr('data-panel') != "#panel-rental-rent") {
67022                        e.preventDefault();
67023                        var panelElt = $($(this).attr('data-panel'));
67024
67025                        if (panelElt.length > 0) {
67026                            openPanel(panelElt);
67027                        }
67028                        // Scroll vers l'ancre après l'ouverture du modal
67029                        var anchor = this.getAttribute("data-anchor");
67030                        if (anchor) {
67031                            var anchorElement = document.querySelector(anchor);
67032                            if (anchorElement) {
67033                                anchorElement.scrollIntoView({ behavior: "smooth" });
67034                            }
67035                        }
67036                    }
67037                });
67038                $('.panel_close, .panel_background, #update_photos').on('click', function (e) {
67039                    e.preventDefault();
67040                    closePanel($(this).closest('.panel'));
67041                });
67042            };
67043
67044            initPanels(); // ----------------------------------------------
67045            // Select2 --------------------------------------
67046            // ----------------------------------------------
67047
67048
67049            var initPanelsRents = function initPanelsRents() {
67050                var rents = true;
67051                $('body').on('click', '#rent [data-panel]', function (e) {
67052                    var _this = this;
67053                    e.preventDefault();
67054                    var Params = new URLSearchParams();
67055                    var Url = new URL(window.location.href); // On lance la requête ajax
67056                    // console.log(e.target.getAttribute('href'))
67057                    $("#loader").addClass("is-active");
67058                    fetch(e.target.getAttribute('href') + "&ajax=1", {
67059                        headers: {
67060                            "X-Requested-With": "XMLHttpRequest",
67061                            'Content-Type': 'application/json'
67062                        }
67063                    }).then(function (response) {
67064                        return response.json();
67065                    }).then(function (data) {
67066                        // On va chercher la zone de contenu
67067                        var content = document.querySelector(".panel");
67068                        var list_popins = document.querySelector(".list_popins");
67069                        content.innerHTML = data.content;
67070                        list_popins.innerHTML = data.list_popins;
67071                    }).then(function (cc) {
67072                        if ($('.rentalCarousel').length) {
67073                            $('.rentalCarousel').each(function () {
67074                                var carousel = $(this);
67075                                var guid = _Utils["default"].guid();
67076                                carousel.attr('data-carousel', guid);
67077                                new _bundle["default"]('.rentalCarousel[data-carousel="' + guid + '"] .swiper-container', {
67078                                    slidesPerView: 3,
67079                                    spaceBetween: 16,
67080                                    breakpoints: {
67081                                        0: {
67082                                            slidesPerView: 1
67083                                        },
67084                                        480: {
67085                                            slidesPerView: 2
67086                                        },
67087                                        // 768: { slidesPerView: 3, allowTouchMove: false, spaceBetween: 20 },
67088                                        1025: {
67089                                            slidesPerView: 3,
67090                                            allowTouchMove: false,
67091                                            spaceBetween: 20
67092                                        }
67093                                    },
67094                                    navigation: {
67095                                        prevEl: '.rentalCarousel[data-carousel="' + guid + '"] .customCarousel_nav--prev',
67096                                        nextEl: '.rentalCarousel[data-carousel="' + guid + '"] .customCarousel_nav--next'
67097                                    }
67098                                });
67099                                carousel.find('.rentalItem').on('click', function () {
67100                                    carousel.find('.rentalItem.active').removeClass('active');
67101                                    $(this).addClass('active');
67102                                    var rentalId = $(this).attr('data-rental');
67103                                    var panel = $(this.closest('.panel'));
67104                                    panel.find('.rental.visible').removeClass('visible');
67105                                    panel.find('.rental[data-rental="' + rentalId + '"]').addClass('visible');
67106                                    panel.find('.panel_scroller').get(0).scrollTop = 0;
67107                                });
67108                                collapse('.rental_section--collapse .rental_section_header_collapseMask', '.rental_section--collapse', '.rental_section_content', 'rental_section--opened');
67109                            });
67110                        } // ----------------------------------------------
67111                        // DataTables -----------------------------------
67112                        // ----------------------------------------------
67113                        $('table[data-table]').DataTable({
67114                            "searching": false,
67115                            "info": false,
67116                            "lengthChange": false,
67117                            "paging": false,
67118                            "oLanguage": {
67119                                "sEmptyTable": "Pas de donnée"
67120                            }
67121                        });
67122                        $('.tabWrap .tabButton[data-tab]').on('click', function (e) {
67123                            e.preventDefault();
67124                            var parent = $(this).closest('.tabWrap');
67125                            var tabValue = $(this).attr('data-tab');
67126                            var tab = parent.find('.tabSection[data-tab="' + tabValue + '"]');
67127                            parent.find('.tabSection').removeClass('visible');
67128                            parent.find('.tabButton').removeClass('active');
67129                            tab.addClass('visible');
67130                            $(this).addClass('active');
67131                        });
67132                    }).then(function (aa) {
67133                        var panelElt = $($(_this).attr('data-panel'));
67134
67135                        if (panelElt.length > 0) {
67136                            $("#loader").removeClass("is-active");
67137                            openPanel(panelElt);
67138                        }
67139                    })["catch"](function (e) {
67140                        return alert(e);
67141                    });
67142                });
67143                $('body').on('click', '.panel_close, .panel_background', function (e) {
67144                    e.preventDefault();
67145                    closePanel($(this).closest('.panel'));
67146                });
67147            };
67148
67149            initPanelsRents();
67150            var initPopinsRents = function initPopinsRents() {
67151                $('#rent_popin [data-popin]').on('click', function (e) {
67152                    e.preventDefault();
67153                    var popinElt = $($(this).attr('data-popin'));
67154
67155                    if (popinElt.length > 0) {
67156                        if (popins.length > 0) {
67157                            hidePopin(popins[popins.length - 1]);
67158                        } // hideBackground();
67159
67160
67161                        openPopin(popinElt);
67162                    }
67163                }); // Close one popin
67164
67165                $('body').on('click', '.list_popins .popin_close', function (e) {
67166                    e.preventDefault();
67167                    closePopin(popins[popins.length - 1]);
67168                }); // Close all popins
67169
67170                popinsBackground.on('click', function () {
67171                    hideBackground();
67172                    closePopins();
67173                });
67174                $('body').on('click', '[data-popin-closeall="true"], .popin_bg', function () {
67175                    hideBackground();
67176                    closePopins();
67177                });
67178            };
67179
67180            initPopinsRents();
67181
67182
67183            $('.customSelect').each(function () {
67184                var elt = $(this);
67185                var options = {};
67186                options.minimumResultsForSearch = -1;
67187                elt.select2(options);
67188            }); // ----------------------------------------------
67189            // Dropdown menu --------------------------------
67190            // ----------------------------------------------
67191
67192            var toggleDropdown = function toggleDropdown(elt) {
67193                elt.toggleClass('dropdown--visible');
67194            };
67195
67196            var closeDropdowns = function closeDropdowns() {
67197                $('.dropdown--visible').removeClass('dropdown--visible');
67198            };
67199
67200            $('[data-dropdown]').on('click', function (e) {
67201                e.preventDefault();
67202                var btn = $(this);
67203                var dropdown = btn.attr('data-dropdown') != '' ? $(btn.attr('data-dropdown')) : btn.siblings('.dropdown');
67204
67205                if (dropdown) {
67206                    toggleDropdown(dropdown);
67207                }
67208            });
67209
67210            if ($('[data-dropdown]').length > 0) {
67211                window.onclick = function (event) {
67212                    if (!event.target.hasAttribute('data-dropdown')) {
67213                        closeDropdowns();
67214                    }
67215                };
67216            } // ----------------------------------------------
67217            // DataTables -----------------------------------
67218            // ----------------------------------------------
67219
67220
67221            $('table[data-table]').DataTable({
67222                "searching": false,
67223                "info": false,
67224                "lengthChange": false,
67225                "paging": false,
67226                "oLanguage": {
67227                    "sEmptyTable": "Pas de donnée"
67228                }
67229            }); // ----------------------------------------------
67230            // Datepicker -----------------------------------
67231            // ----------------------------------------------
67232
67233            $('[data-datepicker]').each(function () {
67234                var elt = $(this);
67235                var drops = elt.attr('data-datepicker-drops') || 'bottom';
67236                var opens = elt.attr('data-datepicker-opens') || 'right';
67237                elt.daterangepicker({
67238                    singleDatePicker: true,
67239                    showDropdowns: true,
67240                    autoApply: true,
67241                    drops: drops,
67242                    opens: opens,
67243                    minDate: new Date(),
67244                    locale: {
67245                        "format": "DD-MM-YYYY",
67246                        "separator": " - ",
67247                        "applyLabel": "Valider",
67248                        "cancelLabel": "Annuler",
67249                        "fromLabel": "De",
67250                        "toLabel": "À",
67251                        "customRangeLabel": "Personnalisée",
67252                        "weekLabel": "S",
67253                        "daysOfWeek": ["Di", "Lu", "Ma", "Me", "Je", "Ve", "Sa"],
67254                        "monthNames": ["Janvier", "Févrirer", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"],
67255                        "firstDay": 1
67256                    }
67257                });
67258            });
67259
67260            $('[data-daterangepicker-availability]').each(function () {
67261                var elt = $(this);
67262                // var drpStart = (0, _moment["default"])().subtract(29, 'days');
67263                var drpEnd = (0, _moment["default"])();
67264                var drops = elt.attr('data-daterangepicker-drops') || 'bottom';
67265                var opens = elt.attr('data-daterangepicker-opens') || 'center';
67266                elt.daterangepicker({
67267                    //minDate: new Date(),
67268                    startDate: new Date(),
67269                    minDate: new Date(),
67270                    endDate: drpEnd,
67271                    alwaysShowCalendars: true,
67272                    drops: drops,
67273                    opens: opens,
67274                    showCustomRangeLabel: false,
67275                    locale: {
67276                        "format": "DD-MM-YYYY",
67277                        "separator": " - ",
67278                        "applyLabel": "Valider",
67279                        "cancelLabel": "Annuler",
67280                        "fromLabel": "De",
67281                        "toLabel": "À",
67282                        "customRangeLabel": "Personnalisée",
67283                        "weekLabel": "S",
67284                        "daysOfWeek": ["Di", "Lu", "Ma", "Me", "Je", "Ve", "Sa"],
67285                        "monthNames": ["Janvier", "Févrirer", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"],
67286                        "firstDay": 1
67287                    }
67288                });
67289            });
67290            // ----------------------------------------------
67291            // DateRangePicker ------------------------------
67292            // ----------------------------------------------
67293
67294            $('[data-daterangepicker]').each(function () {
67295                var elt = $(this);
67296                var drpStart = (0, _moment["default"])().subtract(29, 'days');
67297                var drpEnd = (0, _moment["default"])();
67298                var drops = elt.attr('data-daterangepicker-drops') || 'bottom';
67299                var opens = elt.attr('data-daterangepicker-opens') || 'center';
67300                elt.daterangepicker({
67301                    startDate: drpStart,
67302                    endDate: drpEnd,
67303                    alwaysShowCalendars: true,
67304                    drops: drops,
67305                    opens: opens,
67306                    showCustomRangeLabel: false,
67307                    locale: {
67308                        "format": "DD/MM/YYYY",
67309                        "separator": " - ",
67310                        "applyLabel": "Valider",
67311                        "cancelLabel": "Annuler",
67312                        "fromLabel": "De",
67313                        "toLabel": "À",
67314                        "customRangeLabel": "Personnalisée",
67315                        "weekLabel": "S",
67316                        "daysOfWeek": ["Di", "Lu", "Ma", "Me", "Je", "Ve", "Sa"],
67317                        "monthNames": ["Janvier", "Févrirer", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"],
67318                        "firstDay": 1
67319                    },
67320                    ranges: {
67321                        "Aujourd'hui": [(0, _moment["default"])(), (0, _moment["default"])()],
67322                        'Hier': [(0, _moment["default"])().subtract(1, 'days'), (0, _moment["default"])().subtract(1, 'days')],
67323                        '7 derniers jours': [(0, _moment["default"])().subtract(6, 'days'), (0, _moment["default"])()],
67324                        '30 derniers jours': [(0, _moment["default"])().subtract(29, 'days'), (0, _moment["default"])()],
67325                        'Ce mois-ci': [(0, _moment["default"])().startOf('month'), (0, _moment["default"])().endOf('month')],
67326                        'Mois précédent': [(0, _moment["default"])().subtract(1, 'month').startOf('month'), (0, _moment["default"])().subtract(1, 'month').endOf('month')]
67327                    }
67328                });
67329            });
67330
67331
67332            $('#dateRents [data-daterangepicker]').each(function () {
67333                var elt = $(this);
67334                var drpStart = (0, _moment["default"])().subtract(20, 'year');
67335                var drpEnd = (0, _moment["default"])();
67336                var drops = elt.attr('data-daterangepicker-drops') || 'bottom';
67337                var opens = elt.attr('data-daterangepicker-opens') || 'center';
67338                elt.daterangepicker({
67339                    startDate: drpStart,
67340                    endDate: drpEnd,
67341                    alwaysShowCalendars: true,
67342                    drops: drops,
67343                    opens: opens,
67344                    showCustomRangeLabel: false,
67345                    locale: {
67346                        "format": "DD/MM/YYYY",
67347                        "separator": " - ",
67348                        "applyLabel": "Valider",
67349                        "cancelLabel": "Annuler",
67350                        "fromLabel": "De",
67351                        "toLabel": "À",
67352                        "customRangeLabel": "Personnalisée",
67353                        "weekLabel": "S",
67354                        "daysOfWeek": ["Di", "Lu", "Ma", "Me", "Je", "Ve", "Sa"],
67355                        "monthNames": ["Janvier", "Févrirer", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"],
67356                        "firstDay": 1
67357                    },
67358                    ranges: {
67359                        'Mois précédent': [(0, _moment["default"])().subtract(1, 'month').startOf('month'), (0, _moment["default"])().subtract(1, 'month').endOf('month')],
67360                        'Année précédente': [(0, _moment["default"])().subtract(1, 'year').startOf('year'), (0, _moment["default"])().subtract(1, 'year').endOf('year')],
67361                    }
67362                });
67363            });
67364
67365
67366            // ----------------------------------------------
67367            // SortButton -----------------------------------
67368            // ----------------------------------------------
67369
67370            $('.formSort').on('click', function (e) {
67371                e.preventDefault();
67372                var stateAttr = $(this).attr('data-state') ? parseInt($(this).attr('data-state')) : 0;
67373                var newState = stateAttr === 2 ? 0 : stateAttr + 1;
67374                $(this).attr('data-state', newState);
67375            }); // ----------------------------------------------
67376            // Lottie ---------------------------------------
67377            // ----------------------------------------------
67378
67379            $('.lottie').each(function () {
67380                var elt = $(this);
67381
67382                _lottieWeb["default"].loadAnimation({
67383                    container: elt.get(0),
67384                    // the dom element that will contain the animation
67385                    renderer: 'svg',
67386                    loop: true,
67387                    autoplay: true,
67388                    path: '/assets/json/lodgis.json' // the path to the animation json
67389                });
67390            });
67391            $('.lottie_error').each(function () {
67392                var elt = $(this);
67393
67394                _lottieWeb["default"].loadAnimation({
67395                    container: elt.get(0),
67396                    // the dom element that will contain the animation
67397                    renderer: 'svg',
67398                    loop: true,
67399                    autoplay: true,
67400                    path: '/assets/json/lodgis_error.json' // the path to the animation json
67401                });
67402            });
67403            $('.lottieForm').each(function () {
67404                var elt = $(this);
67405
67406                _lottieWeb["default"].loadAnimation({
67407                    container: elt.get(0),
67408                    // the dom element that will contain the animation
67409                    renderer: 'svg',
67410                    loop: true,
67411                    autoplay: true,
67412                    path: '/assets/json/formComplete.json' // the path to the animation json
67413
67414                });
67415            }); // ----------------------------------------------
67416            // Agent mobile button --------------------------
67417            // ----------------------------------------------
67418
67419            $('.agentButtonMobile').on('click', function () {
67420                $('.agentButtonMobile_mask').toggleClass('agentButtonMobile_mask--visible');
67421                $('.agentBloc').toggleClass('agentBloc--visible');
67422            });
67423            $('.agentButtonMobile_mask').on('click', function () {
67424                $('.agentButtonMobile_mask').removeClass('agentButtonMobile_mask--visible');
67425                $('.agentBloc').removeClass('agentBloc--visible');
67426            }); // ----------------------------------------------
67427            // Actions year panel toggle --------------------
67428            // ----------------------------------------------
67429
67430            $('.actions_nav > a[data-year]').on('click', function (e) {
67431                e.preventDefault();
67432                var year = $(this).attr('data-year');
67433                $('.actions_nav a.active').removeClass('active');
67434                $(this).addClass('active');
67435                $('.actionsYear--visible').removeClass('actionsYear--visible');
67436                $('.actionsYear[data-year="' + year + '"]').addClass('actionsYear--visible');
67437            }); // ----------------------------------------------
67438            // Actions year panel toggle --------------------
67439            // ----------------------------------------------
67440
67441            if ($('.rentalCarousel').length) {
67442                $('.rentalCarousel').each(function () {
67443                    var carousel = $(this);
67444
67445                    var guid = _Utils["default"].guid();
67446
67447                    carousel.attr('data-carousel', guid);
67448                    new _bundle["default"]('.rentalCarousel[data-carousel="' + guid + '"] .swiper-container', {
67449                        slidesPerView: 3,
67450                        spaceBetween: 16,
67451                        breakpoints: {
67452                            0: {
67453                                slidesPerView: 1
67454                            },
67455                            480: {
67456                                slidesPerView: 2
67457                            },
67458                            // 768: { slidesPerView: 3, allowTouchMove: false, spaceBetween: 20 },
67459                            1025: {
67460                                slidesPerView: 3,
67461                                allowTouchMove: false,
67462                                spaceBetween: 20
67463                            }
67464                        },
67465                        navigation: {
67466                            prevEl: '.rentalCarousel[data-carousel="' + guid + '"] .customCarousel_nav--prev',
67467                            nextEl: '.rentalCarousel[data-carousel="' + guid + '"] .customCarousel_nav--next'
67468                        }
67469                    });
67470                    carousel.find('.rentalItem').on('click', function () {
67471                        carousel.find('.rentalItem.active').removeClass('active');
67472                        $(this).addClass('active');
67473                        var rentalId = $(this).attr('data-rental');
67474                        var panel = $(this.closest('.panel'));
67475                        panel.find('.rental.visible').removeClass('visible');
67476                        panel.find('.rental[data-rental="' + rentalId + '"]').addClass('visible');
67477                        panel.find('.panel_scroller').get(0).scrollTop = 0;
67478                    });
67479                });
67480            } // ----------------------------------------------
67481            // Actions year panel toggle --------------------
67482            // ----------------------------------------------
67483
67484
67485            $('.actions_nav > a[data-year]').on('click', function (e) {
67486                e.preventDefault();
67487                var year = $(this).attr('data-year');
67488                $('.actions_nav a.active').removeClass('active');
67489                $(this).addClass('active');
67490                $('.actionsYear--visible').removeClass('actionsYear--visible');
67491                $('.actionsYear[data-year="' + year + '"]').addClass('actionsYear--visible');
67492            }); // ----------------------------------------------
67493            // Tab toggle -----------------------------------
67494            // ----------------------------------------------
67495
67496            $('.tabWrap .tabButton[data-tab]').on('click', function (e) {
67497                e.preventDefault();
67498                var parent = $(this).closest('.tabWrap');
67499                var tabValue = $(this).attr('data-tab');
67500                var tab = parent.find('.tabSection[data-tab="' + tabValue + '"]');
67501                parent.find('.tabSection').removeClass('visible');
67502                parent.find('.tabButton').removeClass('active');
67503                tab.addClass('visible');
67504                $(this).addClass('active');
67505            });
67506            $('.formCheckGrouped--date .formCheck input[type="checkbox"]').on('click', function () {
67507                var parent = $(this).closest('.formCheckGrouped');
67508
67509                if ($(this).is(':checked')) {
67510                    parent.find('.formCheckGrouped_date').addClass('visible');
67511                } else {
67512                    parent.find('.formCheckGrouped_date').removeClass('visible');
67513                }
67514            });
67515            $('.formCheckGrouped--dateMobile .formCheck--base input[type="checkbox"]').on('click', function () {
67516                var parent = $(this).closest('.formCheckGrouped');
67517
67518                if ($(this).is(':checked')) {
67519                    parent.find('.formCheckGrouped_dates').addClass('visible');
67520                } else {
67521                    parent.find('.formCheckGrouped_dates').removeClass('visible');
67522                }
67523            });
67524            $('input[name="rentalsMobileDates"]').on('click', function () {
67525                var parent = $(this).closest('.formCheckGrouped');
67526
67527                if ($(this).val() == 'custom') {
67528                    parent.find('.customDates').addClass('visible');
67529                } else {
67530                    parent.find('.customDates').removeClass('visible');
67531                }
67532            });
67533            var start = (0, _moment["default"])().subtract(29, 'days');
67534            var end = (0, _moment["default"])();
67535
67536            function cb(start, end) {
67537                $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
67538            }
67539
67540            $('#reportrange').daterangepicker({
67541                startDate: start,
67542                endDate: end,
67543                ranges: {
67544                    'Today': [(0, _moment["default"])(), (0, _moment["default"])()],
67545                    'Yesterday': [(0, _moment["default"])().subtract(1, 'days'), (0, _moment["default"])().subtract(1, 'days')],
67546                    'Last 7 Days': [(0, _moment["default"])().subtract(6, 'days'), (0, _moment["default"])()],
67547                    'Last 30 Days': [(0, _moment["default"])().subtract(29, 'days'), (0, _moment["default"])()],
67548                    'This Month': [(0, _moment["default"])().startOf('month'), (0, _moment["default"])().endOf('month')],
67549                    'Last Month': [(0, _moment["default"])().subtract(1, 'month').startOf('month'), (0, _moment["default"])().subtract(1, 'month').endOf('month')]
67550                }
67551            }, cb);
67552            cb(start, end); // ----------------------------------------------
67553            // Stats ----------------------------------------
67554            // ----------------------------------------------
67555            // List charts
67556
67557            $('.propertyRow_chart').each(function () {
67558                var ctx = this.getContext("2d");
67559                var values = JSON.parse($(this).attr('data-values'));
67560                new _chart["default"](ctx, {
67561                    type: 'line',
67562                    data: {
67563                        labels: values,
67564                        datasets: [{
67565                            data: values,
67566                            fill: false,
67567                            strokeColor: "#ff6c23",
67568                            pointRadius: 0,
67569                            borderWidth: 1,
67570                            borderColor: "#5B757B"
67571                        }]
67572                    },
67573                    options: {
67574                        animation: {
67575                            duration: 0
67576                        },
67577                        scales: {
67578                            xAxes: [{
67579                                display: false
67580                            }],
67581                            yAxes: [{
67582                                display: false
67583                            }]
67584                        },
67585                        legend: {
67586                            display: false
67587                        }
67588                    }
67589                });
67590            });
67591
67592            var generateData = function generateData(nbMonth) {
67593                var suffix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
67594                var data = [];
67595                var date = (0, _moment["default"])().subtract(nbMonth, 'month');
67596                var nbDays = (0, _moment["default"])().diff(date, 'days');
67597
67598                for (var i = 0; i < nbDays; i++) {
67599                    date = date.clone().add(1, 'day').startOf('day');
67600                    data.push({
67601                        x: date.valueOf(),
67602                        y: _Utils["default"].randomInt(0, 20),
67603                        suffix: suffix
67604                    });
67605                }
67606
67607                return data;
67608            };
67609
67610            var generateDataBis = function generateDataBis(nbMonth) {
67611                var data = [];
67612                var date = (0, _moment["default"])().subtract(nbMonth, 'month');
67613                var nbDays = (0, _moment["default"])().diff(date, 'days');
67614                var visible;
67615
67616                var startVisible = _Utils["default"].randomInt(7, nbDays / 3);
67617
67618                var endVisible = _Utils["default"].randomInt(startVisible, startVisible + nbDays / 3);
67619
67620                for (var i = 0; i < nbDays; i++) {
67621                    date = date.clone().add(1, 'day').startOf('day');
67622                    data.push({
67623                        x: date.valueOf(),
67624                        y: i >= startVisible && i <= endVisible ? 20 : NaN,
67625                        visibleLabel: i >= startVisible && i <= endVisible ? "Indisponible pour travaux" : null
67626                    });
67627                }
67628
67629                return data;
67630            }; // Panel charts
67631
67632
67633            $('.propertyStats_section_canvas').each(function () {
67634                var ctx = this.getContext("2d"); // if (!$(this).attr('data-values')) return;
67635
67636                var values = generateData(3, $(this).attr('data-suffix')); //JSON.parse($(this).attr('data-values'));
67637
67638                var valuesBis = generateDataBis(3); //JSON.parse($(this).attr('data-values'));
67639
67640                new _chart["default"](ctx, {
67641                    type: 'line',
67642                    data: {
67643                        datasets: [{
67644                            fill: false,
67645                            type: 'line',
67646                            data: values,
67647                            pointRadius: 0,
67648                            borderWidth: 1,
67649                            borderColor: "#5B757B"
67650                        }, {
67651                            backgroundColor: 'rgba(91,117,123,0.1)',
67652                            type: 'line',
67653                            data: valuesBis,
67654                            pointRadius: 0,
67655                            borderWidth: 0,
67656                            borderColor: "rgba(0,0,0,0)",
67657                            lineTension: 0,
67658                            steppedLine: true
67659                        }]
67660                    },
67661                    options: {
67662                        animation: {
67663                            duration: 0
67664                        },
67665                        scales: {
67666                            xAxes: [{
67667                                type: 'time',
67668                                tooltipFormat: 'DD/MM/YYYY',
67669                                distribution: 'series',
67670                                offset: true,
67671                                ticks: {
67672                                    major: {
67673                                        enabled: true,
67674                                        fontStyle: 'bold',
67675                                        fontSize: 11
67676                                    },
67677                                    source: 'data',
67678                                    autoSkip: true,
67679                                    autoSkipPadding: 100,
67680                                    maxRotation: 0,
67681                                    sampleSize: 100
67682                                }
67683                            }],
67684                            yAxes: [{
67685                                display: false
67686                            }]
67687                        },
67688                        tooltips: {
67689                            intersect: false,
67690                            mode: 'index',
67691                            backgroundColor: 'rgba(91,117,123,1)',
67692                            xPadding: 8,
67693                            yPadding: 8,
67694                            displayColors: false,
67695                            bodyAlign: 'center',
67696                            titleAlign: 'center',
67697                            titleMarginBottom: 4,
67698                            callbacks: {
67699                                title: function title(tooltipItem, myData) {
67700                                    var dataCell = myData.datasets[tooltipItem[0].datasetIndex].data[tooltipItem[0].index];
67701                                    var date = dataCell.x;
67702                                    return (0, _moment["default"])(date).format('DD MMMM');
67703                                },
67704                                label: function label(tooltipItem, myData) {
67705                                    var dataCell = myData.datasets[tooltipItem.datasetIndex].data[tooltipItem.index];
67706                                    if (dataCell && dataCell.hasOwnProperty('visibleLabel')) return;
67707                                    var visibleLabel = null;
67708
67709                                    if (myData.datasets[1]) {
67710                                        visibleLabel = myData.datasets[1].data[tooltipItem.index].visibleLabel;
67711                                    }
67712
67713                                    var suffix = dataCell.suffix || '';
67714                                    var label = tooltipItem.value + ' ' + suffix;
67715
67716                                    if (visibleLabel) {
67717                                        return [label, visibleLabel];
67718                                    } else {
67719                                        return label;
67720                                    }
67721                                }
67722                            }
67723                        },
67724                        legend: {
67725                            display: false
67726                        }
67727                    }
67728                });
67729            });
67730
67731            if ($('.relatedProperties_carousel').length) {
67732                $('.relatedProperties_carousel').each(function () {
67733                    var carousel = $(this);
67734
67735                    var guid = _Utils["default"].guid();
67736
67737                    carousel.attr('data-carousel', guid);
67738                    new _bundle["default"]('.relatedProperties_carousel[data-carousel="' + guid + '"] .swiper-container', {
67739                        slidesPerView: 3,
67740                        spaceBetween: 16,
67741                        breakpoints: {
67742                            0: {
67743                                slidesPerView: 1
67744                            },
67745                            480: {
67746                                slidesPerView: 1,
67747                                spaceBetween: 20
67748                            },
67749                            // 768: { slidesPerView: 3, allowTouchMove: false, spaceBetween: 20 },
67750                            1025: {
67751                                slidesPerView: 2,
67752                                allowTouchMove: false,
67753                                spaceBetween: 32
67754                            }
67755                        },
67756                        navigation: {
67757                            prevEl: '.relatedProperties_carousel[data-carousel="' + guid + '"] .customCarousel_nav--prev',
67758                            nextEl: '.relatedProperties_carousel[data-carousel="' + guid + '"] .customCarousel_nav--next'
67759                        }
67760                    });
67761                });
67762            } // ----------------------------------------------
67763            // Finances -------------------------------------
67764            // ----------------------------------------------
67765            /*var nbMonth = $('#financesSelect').val();
67766            $("#financesSelect").on('change',function() {
67767                nbMonth = this.value;
67768            });*/
67769
67770            var generateIncomeData = function generateIncomeData(nbMonth, total) {
67771                var data = [];
67772                var date = (0, _moment["default"])().subtract(13, 'month');
67773                for (var i = 0; i < nbMonth; i++) {
67774                    date = date.clone().add(1, 'month').startOf('month');
67775                    data.push({
67776                        x: date.valueOf(),
67777                        y: total[11 - i]['somme'],
67778                        isFuture: false
67779                    });
67780                }
67781
67782                // date = (0, _moment["default"])();
67783
67784                // console.log( $('#financesSelect').val());
67785                /****  Recette à venir estimée ******/
67786                /* for (var j = 1; j <= 6; j++) {
67787                      date = date.clone().add(1, 'month').startOf('day');
67788                      data.push({
67789                          x: date.valueOf(),
67790                          y: _Utils["default"].randomInt(min, max),
67791                          isFuture: true
67792                      });
67793                  }*/
67794                return data;
67795            };
67796
67797            var incomesBarsColors = {
67798                beforeUpdate: function beforeUpdate(chart) {
67799                    var bgPositive = [];
67800                    var bgNegative = [];
67801
67802                    for (var i = 0; i < chart.config.data.datasets[0].data.length; i++) {
67803                        var positive = chart.config.data.datasets[0].data[i];
67804                        var negative = chart.config.data.datasets[1].data[i];
67805
67806                        if (positive.isFuture == true) {
67807                            bgPositive.push('#ECF0EE');
67808                        } else {
67809                            bgPositive.push('#BFD8DD');
67810                        }
67811
67812                        if (negative.isFuture == true) {
67813                            bgNegative.push('#CAC6C4');
67814                        } else {
67815                            bgNegative.push('#DE5507');
67816                        }
67817                    }
67818
67819                    chart.config.data.datasets[0].backgroundColor = bgPositive;
67820                    chart.config.data.datasets[1].backgroundColor = bgNegative;
67821                }
67822            };
67823            // Incomes charts
67824            $('.incomesChart').each(function () {
67825                var ctx = this.getContext("2d");
67826                var bgGradient = ctx.createLinearGradient(0, 0, 0, 120);
67827                bgGradient.addColorStop(0, '#E7EEEC');
67828                bgGradient.addColorStop(1, '#BFD8DD'); // if (!$(this).attr('data-values')) return;
67829                //var numberMonth = $('#financesSelect').val();
67830                var numberMonth = 12;
67831                var positive = generateIncomeData(numberMonth, incomes);
67832                var negative = generateIncomeData(numberMonth, expenses);
67833                new _chart["default"](ctx, {
67834                    type: 'bar',
67835                    data: {
67836                        datasets: [{
67837                            type: 'bar',
67838                            data: positive,
67839                            barPercentage: 1,
67840                            categoryPercentage: 0.97,
67841                            backgroundColor: bgGradient
67842                        }, {
67843                            type: 'bar',
67844                            data: negative,
67845                            barPercentage: 1,
67846                            categoryPercentage: 0.97,
67847                            backgroundColor: "#DE5507" //red color
67848                        }]
67849                    },
67850                    options: {
67851                        maintainAspectRatio: false,
67852                        animation: {
67853                            duration: 0
67854                        },
67855                        scales: {
67856                            xAxes: [{
67857                                type: 'time',
67858                                tooltipFormat: 'MM/YYYY',
67859                                distribution: 'series',
67860                                offset: true,
67861                                stacked: true,
67862                                gridLines: {
67863                                    display: false,
67864                                    offsetGridLines: false
67865                                },
67866                                ticks: {
67867                                    major: {
67868                                        enabled: true,
67869                                        fontStyle: 'bold',
67870                                        fontSize: 11
67871                                    },
67872                                    source: 'data',
67873                                    autoSkip: true,
67874                                    autoSkipPadding: 100,
67875                                    maxRotation: 0,
67876                                    sampleSize: 100
67877                                }
67878                            }],
67879                            yAxes: [{
67880                                display: false
67881                            }]
67882                        },
67883                        legend: {
67884                            display: false
67885                        },
67886                        tooltips: {
67887                            enabled: false,
67888                            custom: function custom(tooltipModel) {
67889                                if (tooltipModel.dataPoints) {
67890                                    $('.incomesChart_tooltip').css('left', tooltipModel.caretX);
67891                                    $('.incomesChart_tooltip').addClass('visible');
67892                                    $('.incomesChart_tooltip_content.visible').removeClass('visible');
67893                                    $('.incomesChart_tooltip_content--' + tooltipModel.dataPoints[0].index).addClass('visible');
67894                                } else {
67895                                    $('.incomesChart_tooltip.visible').removeClass('visible');
67896                                }
67897                            }
67898                        }
67899                    },
67900                    plugins: incomesBarsColors
67901                });
67902            });
67903
67904
67905            /* $("#financesSelect").on('change',function() {
67906                 $('.incomesChart').html('');
67907                 var numberMonth = this.value;
67908                 $('.incomesChart').each(function () {
67909                     var ctx = this.getContext("2d");
67910                     var bgGradient = ctx.createLinearGradient(0, 0, 0, 120);
67911                     bgGradient.addColorStop(0, '#E7EEEC');
67912                     bgGradient.addColorStop(1, '#BFD8DD'); // if (!$(this).attr('data-values')) return;
67913                     //var numberMonth = $('#financesSelect').val();
67914                     var positive = generateIncomeData(numberMonth, 500);
67915                     var negative = generateIncomeData(numberMonth, -90);
67916
67917                     new _chart["default"](ctx, {
67918                         type: 'bar',
67919                         data: {
67920                             datasets: [{
67921                                 type: 'bar',
67922                                 data: positive,
67923                                 barPercentage: 1,
67924                                 categoryPercentage: 0.97,
67925                                 backgroundColor: bgGradient
67926                             }, {
67927                                 type: 'bar',
67928                                 data: negative,
67929                                 barPercentage: 1,
67930                                 categoryPercentage: 0.97,
67931                                 backgroundColor: "#DE5507" //red color
67932                             }]
67933                         },
67934                         options: {
67935                             maintainAspectRatio: false,
67936                             animation: {
67937                                 duration: 0
67938                             },
67939                             scales: {
67940                                 xAxes: [{
67941                                     type: 'time',
67942                                     tooltipFormat: 'MM/YYYY',
67943                                     distribution: 'series',
67944                                     offset: true,
67945                                     stacked: true,
67946                                     gridLines: {
67947                                         display: false,
67948                                         offsetGridLines: false
67949                                     },
67950                                     ticks: {
67951                                         major: {
67952                                             enabled: true,
67953                                             fontStyle: 'bold',
67954                                             fontSize: 11
67955                                         },
67956                                         source: 'data',
67957                                         autoSkip: true,
67958                                         autoSkipPadding: 100,
67959                                         maxRotation: 0,
67960                                         sampleSize: 100
67961                                     }
67962                                 }],
67963                                 yAxes: [{
67964                                     display: false
67965                                 }]
67966                             },
67967                             legend: {
67968                                 display: false
67969                             },
67970                             tooltips: {
67971                                 enabled: false,
67972                                 custom: function custom(tooltipModel) {
67973                                     if (tooltipModel.dataPoints) {
67974                                         $('.incomesChart_tooltip').css('left', tooltipModel.caretX);
67975                                         $('.incomesChart_tooltip').addClass('visible');
67976                                         $('.incomesChart_tooltip_content.visible').removeClass('visible');
67977                                         $('.incomesChart_tooltip_content--' + tooltipModel.dataPoints[0].index).addClass('visible');
67978                                     } else {
67979                                         $('.incomesChart_tooltip.visible').removeClass('visible');
67980                                     }
67981                                 }
67982                             }
67983                         },
67984                         plugins: incomesBarsColors
67985                     });
67986                 });
67987             });*/
67988
67989
67990            // Taxation chart
67991            $('.taxationChart').each(function () {
67992                var ctx = this.getContext("2d");
67993                var bgGradient = ctx.createLinearGradient(0, 0, 0, 120);
67994                bgGradient.addColorStop(0, '#E7EEEC');
67995                bgGradient.addColorStop(1, '#BFD8DD');
67996                var labels = JSON.parse($(this).attr('data-labels'));
67997                var values = JSON.parse($(this).attr('data-values'));
67998                new _chart["default"](ctx, {
67999                    type: 'bar',
68000                    data: {
68001                        labels: labels,
68002                        datasets: [{
68003                            type: 'bar',
68004                            data: values,
68005                            barPercentage: 1,
68006                            categoryPercentage: 0.97,
68007                            backgroundColor: bgGradient
68008                        }]
68009                    },
68010                    options: {
68011                        maintainAspectRatio: false,
68012                        animation: {
68013                            duration: 0
68014                        },
68015                        scales: {
68016                            xAxes: [{
68017                                offset: true,
68018                                gridLines: {
68019                                    display: false
68020                                }
68021                            }],
68022                            yAxes: [{
68023                                display: false,
68024                                ticks: {
68025                                    beginAtZero: true
68026                                }
68027                            }]
68028                        },
68029                        legend: {
68030                            display: false
68031                        },
68032                        tooltips: {
68033                            intersect: false,
68034                            mode: 'index',
68035                            backgroundColor: 'rgba(91,117,123,1)',
68036                            xPadding: 8,
68037                            yPadding: 8,
68038                            displayColors: false,
68039                            bodyAlign: 'center',
68040                            titleAlign: 'center',
68041                            titleMarginBottom: 8,
68042                            callbacks: {
68043                                label: function label(tooltipItem, myData) {
68044                                    return tooltipItem.value + ' €';
68045                                }
68046                            }
68047                        }
68048                    }
68049                });
68050            }); // Properties popin checkboxes - Financial
68051
68052            $('.folderChoice_toggle').on('click', function (e) {
68053                var details = $('.folderChoiceDetails[data-folder="' + $(this).attr('data-folder') + '"]');
68054                $(this).toggleClass('active');
68055                details.toggleClass('visible');
68056            });
68057            $('.folderChoice_radio[type="checkbox"]').on('click', function (e) {
68058                var checkbox = $(this); // If toggle parent folder checkbox
68059
68060                if (checkbox.hasClass('folderChoice_radio--parent')) {
68061                    var children = $('.folderChoice_radio--child[data-folder="' + checkbox.attr('data-folder') + '"]');
68062                    children.prop("checked", checkbox.is(":checked"));
68063                } // If toggle child folder checkbox
68064
68065
68066                if (checkbox.hasClass('folderChoice_radio--child')) {
68067                    var folderId = checkbox.attr('data-folder');
68068                    var allChecked = true;
68069                    $('.folderChoice_radio--child[data-folder="' + folderId + '"]').each(function () {
68070                        if (!$(this).is(':checked')) {
68071                            allChecked = false;
68072                        }
68073                    });
68074                    $('.folderChoice_radio--parent[data-folder="' + folderId + '"]').prop("checked", allChecked);
68075                }
68076            }); // ----------------------------------------------
68077            // Profile offers -------------------------------
68078            // ----------------------------------------------
68079
68080            $('.userOffres_carouselOpener').on('click', function (e) {
68081                $('.userOffres_carouselWrap').addClass('userOffres_carouselWrap--visible');
68082            });
68083            $('.userOffres_carouselBackground, .userOffres_carousel_close').on('click', function (e) {
68084                $('.userOffres_carouselWrap').removeClass('userOffres_carouselWrap--visible');
68085            });
68086
68087            if ($('.userOffres_carousel').length) {
68088                $('.userOffres_carousel').each(function () {
68089                    var carousel = $(this);
68090
68091                    var guid = _Utils["default"].guid();
68092
68093                    carousel.attr('data-carousel', guid);
68094                    new _bundle["default"]('.userOffres_carousel[data-carousel="' + guid + '"] .swiper-container', {
68095                        slidesPerView: 1,
68096                        spaceBetween: 20,
68097                        navigation: {
68098                            prevEl: '.userOffres_carousel[data-carousel="' + guid + '"] .userOffres_carousel_nav--prev',
68099                            nextEl: '.userOffres_carousel[data-carousel="' + guid + '"] .userOffres_carousel_nav--next'
68100                        },
68101                        breakpoints: {
68102                            700: {
68103                                spaceBetween: 100
68104                            }
68105                        }
68106                    });
68107                });
68108            }
68109
68110
68111            $('.offresStates button').on('click', function () {
68112                var state = $(this).attr('data-state');
68113                $('div[data-state]').hide();
68114                $('div[data-state="' + state + '"]').show();
68115            }); // ----------------------------------------------
68116            // Formulaire de création -----------------------
68117            // ----------------------------------------------
68118
68119            var scaleStep = 0.05;
68120            var translateStep = WU.isXS() || WU.isSM() ? -10 : -20;
68121            var currentStep = 1;
68122            var currentStepElt = $('.formSection[data-section="' + currentStep + '"]');
68123            var nbSteps = $('.formSection').length;
68124
68125            var initStyle = function initStyle() {
68126                $('.formSection').each(function (index) {
68127                    var elt = $(this);
68128
68129                    _gsap.gsap.set(elt, {
68130                        scale: 1 - index * scaleStep,
68131                        zIndex: nbSteps - index
68132                    });
68133                });
68134
68135                _gsap.gsap.to('.sidebar', {
68136                    opacity: 1,
68137                    duration: 0.6
68138                });
68139
68140                $('.formSection').each(function (index) {
68141                    var elt = $(this);
68142
68143                    _gsap.gsap.to(elt, {
68144                        y: index * translateStep,
68145                        opacity: 1,
68146                        delay: (index + 1) * 0.1,
68147                        duration: 1
68148                    });
68149                });
68150
68151                _gsap.gsap.to('.formActions', {
68152                    y: 0,
68153                    opacity: 1,
68154                    delay: 1,
68155                    duration: 0.6
68156                });
68157
68158                _gsap.gsap.to('.formSection_logo', {
68159                    opacity: 0.05,
68160                    delay: 1,
68161                    duration: 0.6
68162                });
68163            };
68164
68165            var updateNav = function updateNav() {
68166                $('.sidebar_progress_item--validated').removeClass('sidebar_progress_item--validated');
68167                $('.sidebar_progress_item--active').removeClass('sidebar_progress_item--active');
68168                $('.sidebar_progress_item[data-section="' + currentStep + '"]').addClass('sidebar_progress_item--active').prevAll('.sidebar_progress_item').each(function (index) {
68169                    var elt = $(this);
68170                    elt.addClass('sidebar_progress_item--validated');
68171                });
68172            };
68173
68174            var updateActions = function updateActions() {
68175                $('.formAction--active').removeClass('formAction--active');
68176                $('.formAction[data-section="' + currentStep + '"]').addClass('formAction--active');
68177            };
68178
68179            var updateHelps = function updateHelps() {
68180                $('.formHelp_step--active').removeClass('formHelp_step--active');
68181                $('.formHelp_step[data-section="' + currentStep + '"]').addClass('formHelp_step--active');
68182            };
68183
68184            var prevSection = function prevSection() {
68185                if (currentStep == 1) return;
68186                var prev = currentStepElt.prev('.formSection');
68187                $("html, body").stop().animate({
68188                    scrollTop: 0
68189                });
68190
68191                _gsap.gsap.to(prev, {
68192                    y: 0,
68193                    scale: 1,
68194                    autoAlpha: 1,
68195                    duration: 1
68196                });
68197
68198                prev.nextAll('.formSection').each(function (index) {
68199                    var elt = $(this);
68200
68201                    _gsap.gsap.to(elt, {
68202                        scale: 1 - (index + 1) * scaleStep,
68203                        y: (index + 1) * translateStep,
68204                        duration: 1
68205                    });
68206                });
68207                currentStep = parseInt(prev.attr('data-section'));
68208                currentStepElt = prev;
68209                $('.formSection--active').removeClass('formSection--active');
68210                currentStepElt.addClass('formSection--active');
68211                updateNav();
68212                updateActions();
68213                updateHelps();
68214            };
68215
68216            var nextSection = function nextSection() {
68217                if (currentStep == nbSteps) return;
68218                var next = currentStepElt.next('.formSection');
68219                $("html, body").stop().animate({
68220                    scrollTop: 0
68221                });
68222
68223                _gsap.gsap.to(currentStepElt, {
68224                    y: "100vh",
68225                    autoAlpha: 0,
68226                    duration: 1
68227                });
68228
68229                currentStepElt.nextAll('.formSection').each(function (index) {
68230                    var elt = $(this);
68231
68232
68233                    _gsap.gsap.to(elt, {
68234                        scale: 1 - index * scaleStep,
68235                        y: index * translateStep,
68236                        duration: 1
68237                    });
68238                });
68239                currentStep = parseInt(next.attr('data-section'));
68240                currentStepElt = next;
68241                $('.formSection--active').removeClass('formSection--active');
68242                currentStepElt.addClass('formSection--active');
68243                updateNav();
68244                updateActions();
68245                updateHelps();
68246            };
68247
68248
68249
68250            var showEnd = function showEnd() {
68251                $("html, body").stop().animate({
68252                    scrollTop: 0
68253                });
68254
68255                _gsap.gsap.to('.formSteps', {
68256                    autoAlpha: 0
68257                });
68258
68259                _gsap.gsap.to('.formEnd', {
68260                    autoAlpha: 1
68261                });
68262
68263                _gsap.gsap.to(['.formEnd_animation', '.formEnd h2', '.formEnd h3', '.formEnd_steps', '.formEnd_cta'], {
68264                    opacity: 1,
68265                    y: 0,
68266                    delay: 0.5,
68267                    stagger: 0.15
68268                });
68269            };
68270
68271            if ($('body').hasClass('p-creation')) {
68272                initStyle();
68273                $('.prevStep').on('click', function () {
68274                    prevSection();
68275                });
68276
68277                $('.nextStep').on('click', function () {
68278                    if (currentStep == nbSteps) {
68279                        showEnd();
68280                    } else if ((currentStep == 1 )&& ($('#form_email').val())){
68281                        if (isExistEmail($('#form_email').val())== true) {
68282                            $('#existing_email').show();
68283                            $('#form_email').css("border-color", "#CC0000");
68284                        }else{
68285                            let civilite = "";
68286                            if ($('#check-g1').is(':checked')) {
68287                                civilite = 0;
68288                            } else if ($('#check-g2').is(':checked')) {
68289                                civilite = 1;
68290                            } else {
68291                                civilite = "";
68292                            }
68293                            let nom = $("#form-nom").val();
68294                            let prenom = $("#form-prenom").val();
68295                            let email = $("#form_email").val();
68296                            let telephone = $("#form_tel").val();
68297                            let portable = $("#form_portable").val();
68298                            if ($(this).hasClass( "step0" )) {
68299
68300                                /************ New owner ****************/
68301
68302                                let result_api = addNewOwner(civilite, email, nom, prenom, telephone, portable);
68303                                if (!result_api || !result_api.res || !result_api.res.length) {
68304                                    // Creation refusee par l'API (email deja utilise, email ou portable invalide) :
68305                                    // le message d'erreur est deja affiche
68306                                    return;
68307                                }
68308                                let token = result_api.token;
68309                                let oid_owner = result_api.res[0].oid;
68310                                let content = {oid: oid_owner};
68311                                let principal_email = result_api.res[0].id;
68312                                $('#datas_email').attr('token', token);
68313                                $('#datas_email').attr('oid_owner', oid_owner);
68314                                $('#datas_email').attr('principal_email', principal_email);
68315                                $('#datas_email').attr('civilite', civilite);
68316
68317                                $.ajax({
68318                                    type: 'POST',
68319                                    url: "/email_owner",
68320                                    data: {
68321                                        civilite : civilite,
68322                                        nom: nom,
68323                                        principal_email: principal_email,
68324                                        token: token,
68325                                        oid_owner: oid_owner,
68326                                    },
68327                                    success: function () {
68328
68329                                    },
68330                                    error : function (){
68331                                        console.log('error');
68332                                    }
68333                                });
68334
68335                            } else if ($(this).hasClass( "step0_foncia" )){
68336                                /************ Devco Foncia ****************/
68337
68338                                let email_foncia = $("#form_email_foncia").val();
68339                                let langue = "";
68340                                if ($('#check-l1').is(':checked')) {
68341                                    langue = "FR";
68342                                } else if ($('#check-l2').is(':checked')) {
68343                                    langue = "EN";
68344                                } else if ($('#check-l3').is(':checked')) {
68345                                    langue = "IT";
68346                                }
68347                                let result_api = addNewOwnerFoncia(email_foncia,civilite, email, nom, prenom, portable,langue);
68348                                if (!result_api || !result_api.res || !result_api.res.length) {
68349                                    // Creation refusee par l'API (email deja utilise, email ou portable invalide) :
68350                                    // le message d'erreur est deja affiche.
68351                                    return;
68352                                }
68353                                let token = result_api.token;
68354                                let oid_owner = result_api.res[0].oid;
68355                                let content = {oid: oid_owner};
68356                                let principal_email = result_api.res[0].id;
68357                                $('#email_foncia').attr('token', token);
68358                                $('#email_foncia').attr('oid_owner', oid_owner);
68359                                $('#email_foncia').attr('principal_email', principal_email);
68360                                $('#email_foncia').attr('civilite', civilite);
68361                                $('#email_foncia').attr('langue', langue);
68362                                $('#datas_email').attr('oid_owner', oid_owner);
68363                            }
68364                            nextSection();
68365                            $('#link_2').removeClass("disabled");
68366                        }}
68367                    else if (currentStep == 2 && isNewOwner == 1) {
68368                        let cp = newAdress.CodePostal;
68369                        let zone = getZone(cp);
68370                        let oid_prop = $('#datas_email').attr('oid_owner');
68371                        let api_zone = addZoneOwner(oid_prop, zone);
68372                        nextSection();
68373                    } else if (currentStep == 4) {
68374                        $( ".formHelpMobile" ).hide();
68375                        nextSection();
68376                    } else{
68377                        nextSection();
68378                    }
68379
68380                });
68381
68382
68383                $('#link_1, #link_2, #link_3, #link_4, #link_5').on('click', function () {
68384                    let destination = $(this).attr("data-section");
68385                    let destinationElt = $("#" + destination);
68386                    let prevDestination = destinationElt.prev('.formSection');
68387                    $("html, body").stop().animate({
68388                        scrollTop: 0
68389                    });
68390
68391                    if (destination < currentStep) {
68392                        let i = currentStep;
68393                        do {
68394                            i--;
68395                            _gsap.gsap.to($("#" + i), {
68396                                y: 0,
68397                                scale: 1,
68398                                autoAlpha: 1,
68399                                duration: 1
68400                            });
68401                        } while (i > destination);
68402
68403
68404                        destinationElt.nextAll('.formSection').each(function (index) {
68405                            var elt = $(this);
68406
68407                            _gsap.gsap.to(elt, {
68408                                scale: 1 - (index + 1) * scaleStep,
68409                                y: (index + 1) * translateStep,
68410                                duration: 1
68411                            });
68412                        });
68413
68414                        currentStep = parseInt($(this).attr('data-section'));
68415                        currentStepElt = $("#" + destination);
68416                        $('.formSection--active').removeClass('formSection--active');
68417                        currentStepElt.addClass('formSection--active');
68418                    } else if (destination > currentStep) {
68419                        let repeat = destination - currentStep;
68420                        let j = currentStep;
68421                        do {
68422                            var next = currentStepElt.next('.formSection');
68423                            _gsap.gsap.to(currentStepElt, {
68424                                y: "100vh",
68425                                autoAlpha: 0,
68426                                duration: 1
68427                            });
68428                            currentStepElt.nextAll('.formSection').each(function (index) {
68429                                var elt = $(this);
68430
68431                                _gsap.gsap.to(elt, {
68432                                    scale: 1 - index * scaleStep,
68433                                    y: index * translateStep,
68434                                    duration: 1
68435                                });
68436                            });
68437                            currentStep = parseInt(next.attr('data-section'));
68438                            currentStepElt = next;
68439                            $('.formSection--active').removeClass('formSection--active');
68440                            currentStepElt.addClass('formSection--active');
68441                            j++;
68442                        } while (j < destination);
68443                    }
68444                    updateNav();
68445                    updateActions();
68446                    updateHelps();
68447
68448                });
68449
68450                // ----------------------------------------------
68451                // HELP mobile button ---------------------------
68452                // ----------------------------------------------
68453
68454                $('.formHelpMobile').on('click', function () {
68455                    $('.formHelpMobile_mask').toggleClass('formHelpMobile_mask--visible');
68456                    $('.formHelpContainer').toggleClass('formHelpContainer--visible');
68457                });
68458                $('.formHelpMobile_mask').on('click', function () {
68459                    $('.formHelpMobile_mask').removeClass('formHelpMobile_mask--visible');
68460                    $('.formHelpContainer').removeClass('formHelpContainer--visible');
68461                });
68462            }
68463
68464            $('.favPicture').on('click', function (e) {
68465                e.preventDefault();
68466                $('.roomPicture--fav').removeClass('roomPicture--fav');
68467                $(this).closest('.roomPicture').addClass('roomPicture--fav');
68468            });
68469            var editorOriginalValue = undefined;
68470            $('.propertyEditor_button--edit').on('click', function (e) {
68471                var editor = $(this).closest('.propertyEditor');
68472                editor.addClass('propertyEditor--editing');
68473                editorOriginalValue = editor.find('.propertyEditor_editor').html();
68474                editor.find('.propertyEditor_editor').attr('contenteditable', 'true');
68475            });
68476            $('.propertyEditor_button--cancel').on('click', function (e) {
68477                var editor = $(this).closest('.propertyEditor');
68478                editor.removeClass('propertyEditor--editing');
68479                editor.find('.propertyEditor_editor').html(editorOriginalValue);
68480                editor.find('.propertyEditor_editor').removeAttr('contenteditable');
68481                editorOriginalValue = undefined;
68482            });
68483            $('.propertyEditor_button--save').on('click', function (e) {
68484                var editor = $(this).closest('.propertyEditor');
68485                editor.removeClass('propertyEditor--editing');
68486                editor.find('.propertyEditor_editor').removeAttr('contenteditable');
68487                editorOriginalValue = undefined;
68488            });
68489            $('button[data-gotostep]').on('click', function (e) {
68490                e.preventDefault();
68491                var stepNum = $(this).attr('data-gotostep');
68492                $('.propertyRooms_step--active').removeClass('propertyRooms_step--active');
68493                $('.propertyRooms_step[data-step="' + stepNum + '"]').addClass('propertyRooms_step--active');
68494                $('.panel_breadcrumbs li.active').removeClass('active');
68495                $('.panel_breadcrumbs li[data-step="' + stepNum + '"]').addClass('active');
68496            }); // ----------------------------------------------
68497            // Observe scroll -------------------------------
68498            // ----------------------------------------------
68499
68500            window.addEventListener('scroll', _Utils["default"].debounce(function () {
68501                toggleTopbar();
68502            }), {
68503                passive: true
68504            });
68505        })();
68506
68507    }, {
68508        "./ImagesGallery": 100,
68509        "./vendors/Utils": 102,
68510        "./vendors/WindowUtils": 103,
68511        "chart.js": 2,
68512        "daterangepicker/daterangepicker.js": 3,
68513        "gsap": 5,
68514        "jquery": 6,
68515        "lottie-web": 7,
68516        "moment": 9,
68517        "moment/locale/fr": 8,
68518        "swiper/bundle": 99
68519    }],
68520    102: [function (require, module, exports) {
68521        "use strict";
68522
68523        module.exports = {
68524            lineEq: function lineEq(y2, y1, x2, x1, currentVal) {
68525                var m = (y2 - y1) / (x2 - x1),
68526                    b = y1 - m * x1;
68527                return m * currentVal + b;
68528            },
68529            lerp: function lerp(v0, v1, amt) {
68530                var maxMove = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
68531                var minDiff = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0.0001;
68532                var diff = v1 - v0;
68533
68534                if (maxMove > 0) {
68535                    diff = Math.min(diff, maxMove);
68536                    diff = Math.max(diff, -maxMove);
68537                }
68538
68539                if (Math.abs(diff) < minDiff) {
68540                    return v1;
68541                }
68542
68543                return v0 + diff * amt;
68544            },
68545            debounce: function debounce(func, wait, immediate) {
68546                var timeout;
68547                wait = wait ? wait : 1000 / 60;
68548                return function () {
68549                    var context = this,
68550                        args = arguments;
68551
68552                    var later = function later() {
68553                        timeout = null;
68554                        if (!immediate) func.apply(context, args);
68555                    };
68556
68557                    var callNow = immediate && !timeout;
68558                    clearTimeout(timeout);
68559                    timeout = setTimeout(later, wait);
68560                    if (callNow) func.apply(context, args);
68561                };
68562            },
68563            loadImage: function loadImage(src) {
68564                return new Promise(function (resolve, reject) {
68565                    var img = new Image();
68566
68567                    img.onload = function () {
68568                        resolve(img);
68569                    };
68570
68571                    img.onerror = function () {
68572                        resolve(img);
68573                    };
68574
68575                    img.src = src;
68576                });
68577            },
68578            randomInt: function randomInt(min, max) {
68579                return Math.round(Math.random() * (max - min) + min);
68580            },
68581            randomFloat: function randomFloat(min, max) {
68582                return Math.random() * (max - min) + min;
68583            },
68584            randomModifier: function randomModifier(magnitude) {
68585                var base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
68586                return base + (Math.random() * magnitude - magnitude / 2);
68587            },
68588            randomSign: function randomSign() {
68589                return Math.random(1) > 0.5 ? 1 : -1;
68590            },
68591            randomElement: function randomElement(array) {
68592                return array[Math.floor(Math.random() * array.length)];
68593            },
68594            radialRandom: function radialRandom() {
68595                return (Math.random() * 2 - 1 + (Math.random() * 2 - 1) + (Math.random() * 2 - 1)) / 2;
68596            },
68597            S4: function S4() {
68598                return ((1 + Math.random()) * 0x10000 | 0).toString(16).substring(1);
68599            },
68600            guid: function guid() {
68601                return (this.S4() + this.S4() + "-" + this.S4() + "-4" + this.S4().substr(0, 3) + "-" + this.S4() + "-" + this.S4() + this.S4() + this.S4()).toLowerCase();
68602            }
68603        };
68604
68605    }, {}],
68606    103: [function (require, module, exports) {
68607        "use strict";
68608
68609        var _bodyScrollLock = require("body-scroll-lock");
68610
68611        function _classCallCheck(instance, Constructor) {
68612            if (!(instance instanceof Constructor)) {
68613                throw new TypeError("Cannot call a class as a function");
68614            }
68615        }
68616
68617        function _defineProperties(target, props) {
68618            for (var i = 0; i < props.length; i++) {
68619                var descriptor = props[i];
68620                descriptor.enumerable = descriptor.enumerable || false;
68621                descriptor.configurable = true;
68622                if ("value" in descriptor) descriptor.writable = true;
68623                Object.defineProperty(target, descriptor.key, descriptor);
68624            }
68625        }
68626
68627        function _createClass(Constructor, protoProps, staticProps) {
68628            if (protoProps) _defineProperties(Constructor.prototype, protoProps);
68629            if (staticProps) _defineProperties(Constructor, staticProps);
68630            return Constructor;
68631        }
68632
68633        var Utils = require("./Utils");
68634
68635        var WindowUtils = /*#__PURE__*/function () {
68636            function WindowUtils() {
68637                var _this = this;
68638
68639                _classCallCheck(this, WindowUtils);
68640
68641                this.w = {
68642                    h: window.innerHeight,
68643                    w: window.innerWidth,
68644                    st: window.pageYOffset
68645                };
68646                this.BREAKPOINTS = {
68647                    XS: {
68648                        NAME: "xs",
68649                        MIN: 0,
68650                        MAX: 767
68651                    },
68652                    SM: {
68653                        NAME: "sm",
68654                        MIN: 768,
68655                        MAX: 989
68656                    },
68657                    MD: {
68658                        NAME: "md",
68659                        MIN: 990,
68660                        MAX: 1249
68661                    },
68662                    LG: {
68663                        NAME: "lg",
68664                        MIN: 1250,
68665                        MAX: 1399
68666                    },
68667                    XL: {
68668                        NAME: "xl",
68669                        MIN: 1400,
68670                        MAX: null
68671                    }
68672                };
68673                this.updateWindowH();
68674                this.updateWindowW();
68675                this.updateWindowScroll();
68676                this.updateVh();
68677                window.addEventListener('resize', Utils.debounce(function () {
68678                    _this.onResize();
68679                }), {
68680                    passive: true
68681                });
68682                window.addEventListener('scroll', Utils.debounce(function () {
68683                    _this.onScroll();
68684                }), {
68685                    passive: true
68686                });
68687            }
68688
68689            _createClass(WindowUtils, [{
68690                key: "isTouch",
68691                value: function isTouch() {
68692                    return 'ontouchstart' in document.documentElement;
68693                }
68694            }, {
68695                key: "isXS",
68696                value: function isXS() {
68697                    return window.innerWidth <= this.BREAKPOINTS.XS.MAX;
68698                }
68699            }, {
68700                key: "isSM",
68701                value: function isSM() {
68702                    return window.innerWidth >= this.BREAKPOINTS.SM.MIN && window.innerWidth <= this.BREAKPOINTS.SM.MAX;
68703                }
68704            }, {
68705                key: "isMD",
68706                value: function isMD() {
68707                    return window.innerWidth >= this.BREAKPOINTS.MD.MIN && window.innerWidth <= this.BREAKPOINTS.MD.MAX;
68708                }
68709            }, {
68710                key: "isLG",
68711                value: function isLG() {
68712                    return window.innerWidth >= this.BREAKPOINTS.LG.MIN && window.innerWidth <= this.BREAKPOINTS.LG.MAX;
68713                }
68714            }, {
68715                key: "isXL",
68716                value: function isXL() {
68717                    return window.innerWidth >= this.BREAKPOINTS.XL.MIN;
68718                }
68719            }, {
68720                key: "isTablet",
68721                value: function isTablet() {
68722                    return isSM() || isMD();
68723                }
68724            }, {
68725                key: "isDesktop",
68726                value: function isDesktop() {
68727                    return isLG() || isXL();
68728                }
68729            }, {
68730                key: "updateWindowH",
68731                value: function updateWindowH() {
68732                    this.w.h = window.innerHeight;
68733                }
68734            }, {
68735                key: "updateWindowW",
68736                value: function updateWindowW() {
68737                    this.w.w = window.innerWidth;
68738                }
68739            }, {
68740                key: "updateWindowScroll",
68741                value: function updateWindowScroll() {
68742                    this.w.st = window.pageYOffset;
68743                }
68744            }, {
68745                key: "updateVh",
68746                value: function updateVh() {
68747                    var vh = this.w.h * 0.01 + "px";
68748                    document.documentElement.style.setProperty('--vh', vh);
68749                }
68750            }, {
68751                key: "onResize",
68752                value: function onResize() {
68753                    this.updateWindowH();
68754                    this.updateWindowW();
68755                    this.updateWindowScroll();
68756                    this.updateVh();
68757                }
68758            }, {
68759                key: "onScroll",
68760                value: function onScroll() {
68761                    this.updateWindowScroll();
68762                }
68763            }, {
68764                key: "disableScroll",
68765                value: function disableScroll(elt) {
68766                    (0, _bodyScrollLock.disableBodyScroll)(elt, {
68767                        reserveScrollBarGap: true
68768                    });
68769                }
68770            }, {
68771                key: "enableScroll",
68772                value: function enableScroll(elt) {
68773                    (0, _bodyScrollLock.enableBodyScroll)(elt);
68774                }
68775            }, {
68776                key: "clearScrollLocks",
68777                value: function clearScrollLocks() {
68778                    (0, _bodyScrollLock.clearAllBodyScrollLocks)();
68779                }
68780            }]);
68781
68782            return WindowUtils;
68783        }();
68784
68785        module.exports = WindowUtils;
68786
68787    }, {"./Utils": 102, "body-scroll-lock": 1}]
68788}, {}, [101]);

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.