UNPKG

1.7 MBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, '__esModule', { value: true });
4
5function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
7var React = require('react');
8var React__default = _interopDefault(React);
9var PropTypes = _interopDefault(require('prop-types'));
10var styled = require('styled-components');
11var styled__default = _interopDefault(styled);
12var semanticUiReact = require('semantic-ui-react');
13var reactDom = require('react-dom');
14var reactDom__default = _interopDefault(reactDom);
15var reactSpring = require('react-spring');
16var reactDates = require('react-dates');
17require('react-dates/initialize');
18require('react-dates/lib/css/_datepicker.css');
19var reactColor = require('react-color');
20var common = require('react-color/lib/components/common');
21var domain = _interopDefault(require('domain'));
22
23function _taggedTemplateLiteralLoose(strings, raw) {
24 if (!raw) {
25 raw = strings.slice(0);
26 }
27
28 strings.raw = raw;
29 return strings;
30}
31
32var taggedTemplateLiteralLoose = _taggedTemplateLiteralLoose;
33
34var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
35
36function commonjsRequire () {
37 throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');
38}
39
40function unwrapExports (x) {
41 return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
42}
43
44function createCommonjsModule(fn, module) {
45 return module = { exports: {} }, fn(module, module.exports), module.exports;
46}
47
48var _extends_1 = createCommonjsModule(function (module) {
49function _extends() {
50 module.exports = _extends = Object.assign || function (target) {
51 for (var i = 1; i < arguments.length; i++) {
52 var source = arguments[i];
53
54 for (var key in source) {
55 if (Object.prototype.hasOwnProperty.call(source, key)) {
56 target[key] = source[key];
57 }
58 }
59 }
60
61 return target;
62 };
63
64 return _extends.apply(this, arguments);
65}
66
67module.exports = _extends;
68});
69
70function _objectWithoutPropertiesLoose(source, excluded) {
71 if (source == null) return {};
72 var target = {};
73 var sourceKeys = Object.keys(source);
74 var key, i;
75
76 for (i = 0; i < sourceKeys.length; i++) {
77 key = sourceKeys[i];
78 if (excluded.indexOf(key) >= 0) continue;
79 target[key] = source[key];
80 }
81
82 return target;
83}
84
85var objectWithoutPropertiesLoose = _objectWithoutPropertiesLoose;
86
87var IconName = ['assets', 'dash', 'date-time', 'expand', 'help', 'image-big', 'image', 'left-navigation', 'logout', 'multimedia1', 'playlist', 'right-navigation', 'weather', 'video-big .path1', 'video-big .path2', 'virtual-ticket', 'tv', 'timer', 'ticket-bold', 'priority', 'more-options', 'move', 'list', 'grid', 'settings-qmpad', 'eye-closed', 'refresh', 'info', 'duplicate', 'checkbox-off', 'checkbox-on', 'radio-button-off', 'radio-button-on', 'management', 'login', 'data', 'dashboard', 'add', 'arrow-down', 'arrow-left', 'arrow-right', 'arrow-up', 'calendar', 'clock', 'color', 'download', 'edit', 'email', 'error', 'gear', 'key', 'language', 'left-to-right', 'link', 'lock', 'multimedia', 'no-notications', 'notifications', 'on-off', 'preview', 'priority-ticket', 'restore', 'right-to-left', 'rss', 'save', 'search', 'select-down', 'select-left', 'select-right', 'select-up', 'sms', 'stopwatch', 'success', 'text', 'ticket', 'transfer', 'unlock', 'update', 'upload', 'user', 'warning', 'zoom-in', 'zoom-out', 'cancel', 'pause', 'transfer-bold', 'call', 'end'];
88
89function _templateObject() {
90 var data = taggedTemplateLiteralLoose(["\n\tmargin: 0 !important;\n\tcolor: ", " !important;\n\n\t&&&& {\n\t\theight: 1em;\n\t}\n\n\t&&&.disabled {\n\t\tcursor: not-allowed !important;\n\t\tpointer-events: none !important;\n\t}\n\n\t&&&.clickable {\n\t\tcursor: pointer;\n\t}\n"]);
91
92 _templateObject = function _templateObject() {
93 return data;
94 };
95
96 return data;
97}
98/**
99 * extends react semantic ui default icon
100 * https://react.semantic-ui.com/elements/icon/
101 * icon component
102 */
103
104var IconStyled = styled__default(function (_ref) {
105 var color = _ref.color,
106 props = objectWithoutPropertiesLoose(_ref, ["color"]);
107
108 return React__default.createElement(semanticUiReact.Icon, props);
109})(_templateObject(), function (_ref2) {
110 var color = _ref2.color;
111 return color;
112});
113IconStyled.propTypes = _extends_1({}, semanticUiReact.Icon.propTypes, {
114 /** color of the icon */
115 color: PropTypes.string
116});
117IconStyled.displayName = 'IconStyled';
118
119var Icon = function Icon(_ref3) {
120 var icon = _ref3.icon,
121 className = _ref3.className,
122 onClick = _ref3.onClick,
123 props = objectWithoutPropertiesLoose(_ref3, ["icon", "className", "onClick"]);
124
125 var combinedClassName = "icoqube" + icon + (className ? ' '.concat(className) : '') + (onClick ? ' clickable' : '');
126 return React__default.createElement(IconStyled, _extends_1({}, props, {
127 onClick: onClick,
128 className: combinedClassName
129 }));
130};
131
132Icon.defaultProps = {
133 className: '',
134 color: 'black',
135 onClick: undefined
136};
137Icon.propTypes = {
138 /** icon of type iconName to be displayed (examples: success, add) */
139 icon: PropTypes.oneOf(IconName).isRequired,
140
141 /** css class name to be applied on the icon */
142 className: PropTypes.string,
143
144 /** string color value for the icon (examples: black, blue, #FFF) */
145 color: PropTypes.string,
146
147 /** onClick function handler */
148 onClick: PropTypes.func
149};
150Icon.displayName = 'Icon';
151
152function _templateObject2() {
153 var data = taggedTemplateLiteralLoose(["\n\t", "\n"]);
154
155 _templateObject2 = function _templateObject2() {
156 return data;
157 };
158
159 return data;
160}
161
162function _templateObject$1() {
163 var data = taggedTemplateLiteralLoose(["\n\tfont-size: ", "px!important;\n\tfont-style: ", "!important;\n\tfont-weight: ", "!important;\n\tline-height: ", "px!important;\n\tcolor: ", "!important;\n\ttext-transform: ", "!important;\n\tborder-bottom: ", "!important;\n"]);
164
165 _templateObject$1 = function _templateObject() {
166 return data;
167 };
168
169 return data;
170}
171var typographyStyles = styled.css(_templateObject$1(), function (_ref) {
172 var size = _ref.size,
173 theme = _ref.theme;
174 return theme.text[size].font;
175}, function (_ref2) {
176 var italic = _ref2.italic;
177 return italic ? 'italic' : 'normal';
178}, function (_ref3) {
179 var bold = _ref3.bold;
180 return bold ? 'bold' : 'normal';
181}, function (_ref4) {
182 var size = _ref4.size,
183 theme = _ref4.theme;
184 return theme.text[size].line;
185}, function (_ref5) {
186 var color = _ref5.color,
187 theme = _ref5.theme;
188 return theme.colors[color];
189}, function (_ref6) {
190 var uppercase = _ref6.uppercase;
191 return uppercase ? 'uppercase' : 'none';
192}, function (_ref7) {
193 var color = _ref7.color,
194 underlined = _ref7.underlined,
195 theme = _ref7.theme;
196 return underlined ? "1px solid " + theme.colors[color] : '0';
197});
198var Text = styled__default.div(_templateObject2(), typographyStyles);
199Text.displayName = 'Text';
200Text.defaultProps = {
201 color: 'darkGray',
202 italic: false,
203 uppercase: false,
204 size: 'md',
205 bold: false,
206 underlined: false
207};
208Text.propTypes = {
209 color: PropTypes.string,
210 italic: PropTypes.bool,
211 uppercase: PropTypes.bool,
212 size: PropTypes.oneOf(['sm', 'md', 'lg', 'xl', 'xxl']),
213 bold: PropTypes.bool,
214 underlined: PropTypes.bool
215};
216
217var ButtonText = function ButtonText(props) {
218 return React__default.createElement(Text, _extends_1({
219 uppercase: true
220 }, props));
221};
222
223ButtonText.displayName = 'ButtonText';
224
225function _templateObject$2() {
226 var data = taggedTemplateLiteralLoose(["\n\tpadding-right: 16px !important;\n\tpadding-left: 16px !important;\n\n\tbackground-color: ", " !important;\n\tborder-radius: ", " !important;\n\tpointer-events: ", " !important;\n\tcursor: ", ";\n\n\t&:active {\n\t\tbackground-color: ", " !important;\n\t}\n\n\ti.icon {\n\t\tmargin-right: 0 !important;\n\t\tmargin-left: 6px !important;\n\t}\n"]);
227
228 _templateObject$2 = function _templateObject() {
229 return data;
230 };
231
232 return data;
233}
234
235var Button = function Button(_ref) {
236 var icon = _ref.icon,
237 content = _ref.content,
238 labelPosition = _ref.labelPosition,
239 iconColor = _ref.iconColor,
240 loading = _ref.loading,
241 children = _ref.children,
242 size = _ref.size,
243 props = objectWithoutPropertiesLoose(_ref, ["icon", "content", "labelPosition", "iconColor", "loading", "children", "size"]);
244
245 return React__default.createElement(ButtonStyled, _extends_1({
246 loading: loading
247 }, props), React__default.createElement(ButtonText, {
248 size: size,
249 color: loading ? 'transparent' : 'white'
250 }, children || content, icon && React__default.createElement(Icon, {
251 color: iconColor,
252 icon: icon
253 })));
254};
255/**
256 * extends react semantic ui default button
257 * https://react.semantic-ui.com/elements/button/#types-button
258 * button component
259 */
260
261
262var ButtonStyled = styled__default(semanticUiReact.Button)(_templateObject$2(), function (_ref2) {
263 var theme = _ref2.theme;
264 return theme.buttons.bg;
265}, function (_ref3) {
266 var theme = _ref3.theme;
267 return theme.buttons.borderRadius;
268}, function (_ref4) {
269 var loading = _ref4.loading;
270 return loading ? 'none' : 'auto';
271}, function (_ref5) {
272 var disabled = _ref5.disabled;
273 return disabled ? 'not-allowed' : 'pointer';
274}, function (_ref6) {
275 var theme = _ref6.theme;
276 return theme.buttons.activeBg;
277});
278ButtonStyled.displayName = 'ButtonStyled';
279Button.defaultProps = {
280 size: 'lg',
281 iconColor: 'white',
282 icon: null,
283 labelPosition: 'left',
284 content: null,
285 loading: false,
286 children: null
287};
288Button.propTypes = {
289 /** children */
290 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
291
292 /** Size of the text */
293 size: PropTypes.string,
294
295 /** icon to be displayed */
296 icon: PropTypes.oneOf(IconName),
297
298 /** label position on element */
299 labelPosition: PropTypes.oneOf(['left', 'right']),
300
301 /** text visible on the button */
302 content: PropTypes.string,
303
304 /** color of the icon */
305 iconColor: PropTypes.string,
306
307 /** loading state of the button */
308 loading: PropTypes.bool
309};
310Button.displayName = 'Button';
311
312function _templateObject$3() {
313 var data = taggedTemplateLiteralLoose(["\n\twidth: ", " !important;\n\theight: ", " !important;\n\tpadding: 0 !important;\n\tbackground-color: ", " !important;\n\tborder-radius: 50% !important;\n\tcursor: ", ";\n\ttext-transform: uppercase !important;\n\n\t&:active,\n\t&:focus {\n\t\tbackground-color: ", " !important;\n\t}\n"]);
314
315 _templateObject$3 = function _templateObject() {
316 return data;
317 };
318
319 return data;
320}
321
322var IconButton = function IconButton(_ref) {
323 var icon = _ref.icon,
324 btnSize = _ref.btnSize,
325 iconSize = _ref.iconSize,
326 iconColor = _ref.iconColor,
327 props = objectWithoutPropertiesLoose(_ref, ["icon", "btnSize", "iconSize", "iconColor"]);
328
329 return React__default.createElement(IconButtonStyled, _extends_1({}, props, {
330 btnSize: btnSize
331 }), React__default.createElement(Icon, {
332 color: iconColor,
333 size: iconSize,
334 icon: icon
335 }));
336};
337/**
338 * extends react semantic ui default button
339 * https://react.semantic-ui.com/elements/button/#types-button
340 * button component
341 */
342
343
344var IconButtonStyled = styled__default(function (_ref2) {
345 var btnSize = _ref2.btnSize,
346 props = objectWithoutPropertiesLoose(_ref2, ["btnSize"]);
347
348 return React__default.createElement(semanticUiReact.Button, props);
349})(_templateObject$3(), function (_ref3) {
350 var btnSize = _ref3.btnSize;
351 return btnSize;
352}, function (_ref4) {
353 var btnSize = _ref4.btnSize;
354 return btnSize;
355}, function (_ref5) {
356 var theme = _ref5.theme;
357 return theme.buttons.bg;
358}, function (_ref6) {
359 var disabled = _ref6.disabled;
360 return disabled ? 'not-allowed' : 'pointer';
361}, function (_ref7) {
362 var theme = _ref7.theme;
363 return theme.buttons.activeBg;
364});
365IconButtonStyled.displayName = 'IconButtonStyled';
366IconButton.defaultProps = {
367 iconSize: 'small',
368 btnSize: '24px',
369 iconColor: 'white'
370};
371IconButton.propTypes = {
372 /** icon to be displayed */
373 icon: PropTypes.oneOf(IconName).isRequired,
374
375 /** color of the icon */
376 iconColor: PropTypes.string,
377
378 /** size of the icon */
379 iconSize: PropTypes.string,
380
381 /** size of the button */
382 btnSize: PropTypes.string
383};
384IconButton.displayName = 'IconButton';
385
386function _templateObject$4() {
387 var data = taggedTemplateLiteralLoose(["\n\tpadding: 0 !important;\n\tborder-radius: 0 !important;\n\tborder-bottom: 1px solid ", " !important;\n\tappearance: none !important;\n\tbackground: transparent !important;\n\t&:hover,\n\t&:focus {\n\t\tcolor: ", " !important;\n\t\toutline: 0 !important;\n\t}\n"]);
388
389 _templateObject$4 = function _templateObject() {
390 return data;
391 };
392
393 return data;
394}
395var Link = styled__default(function (_ref) {
396 var disabled = _ref.disabled,
397 props = objectWithoutPropertiesLoose(_ref, ["disabled"]);
398
399 return React__default.createElement(ButtonText, _extends_1({
400 color: disabled ? 'strokeGray' : 'activeBlue'
401 }, props));
402})(_templateObject$4(), function (_ref2) {
403 var theme = _ref2.theme,
404 disabled = _ref2.disabled;
405 return disabled ? theme.colors.strokeGray : theme.colors.deepBlue;
406}, function (_ref3) {
407 var theme = _ref3.theme,
408 disabled = _ref3.disabled;
409 return disabled ? theme.colors.strokeGray : theme.colors.deepBlue;
410});
411Link.defaultProps = {
412 disabled: false
413};
414Link.propTypes = {
415 /** boolean indicating whether disabled element should render */
416 disabled: PropTypes.bool
417};
418Link.displayName = 'Link';
419
420var ButtonLink = function ButtonLink(_ref) {
421 var size = _ref.size,
422 props = objectWithoutPropertiesLoose(_ref, ["size"]);
423
424 return React__default.createElement(semanticUiReact.Button, _extends_1({
425 as: function as(linkProps) {
426 return React__default.createElement(Link, _extends_1({
427 size: size
428 }, linkProps));
429 }
430 }, props));
431};
432
433ButtonLink.defaultProps = {
434 size: 'lg'
435};
436ButtonLink.propTypes = {
437 /** string indicating size ['sm','md','lg','xl','xxl'] */
438 size: PropTypes.string
439};
440ButtonLink.displayName = 'ButtonLink';
441
442function _templateObject$5() {
443 var data = taggedTemplateLiteralLoose(["\n\tpadding: 8px 16px;\n\tbackground: ", ";\n\tborder-width: 0;\n\tborder-bottom-left-radius: 16px;\n\tborder-bottom-right-radius: 16px;\n\tbox-shadow: ", ";\n\tcolor: ", ";\n\tcursor: ", ";\n\tfont-size: 14px;\n\ttext-transform: uppercase;\n\tuser-select: none;\n\n\t:active {\n\t\tbox-shadow: ", ";\n\t\toutline: none;\n\t}\n"]);
444
445 _templateObject$5 = function _templateObject() {
446 return data;
447 };
448
449 return data;
450}
451var TopButtonStyled = styled__default.button(_templateObject$5(), function (_ref) {
452 var theme = _ref.theme,
453 disabled = _ref.disabled;
454 return disabled ? theme.colors.strokeGray : theme.colors.jellyfish;
455}, function (_ref2) {
456 var disabled = _ref2.disabled;
457 return disabled ? 'none' : '0px 2px 6px rgba(0, 0, 0, 0.25)';
458}, function (_ref3) {
459 var disabled = _ref3.disabled,
460 theme = _ref3.theme;
461 return disabled ? theme.colors.gray : 'white';
462}, function (_ref4) {
463 var disabled = _ref4.disabled;
464 return disabled ? 'not-allowed' : 'pointer';
465}, function (_ref5) {
466 var disabled = _ref5.disabled;
467 return disabled ? 'none' : '0px 2px 4px rgba(0, 0, 0, 0.25)';
468});
469
470var TopButton = function TopButton(props) {
471 return React__default.createElement(TopButtonStyled, props);
472};
473
474TopButton.defaultProps = {
475 children: 'Apply'
476};
477TopButton.propTypes = {
478 /** Name of the button to be displayed */
479 children: PropTypes.string
480};
481TopButton.displayName = 'TopButton';
482
483function _templateObject$6() {
484 var data = taggedTemplateLiteralLoose(["\n\tpadding: 8px;\n\tfont-size: 16px;\n\tline-height: 19px;\n\tborder: ", ";\n\tborder-radius: 4px;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\tcursor: pointer;\n\toutline: none;\n"]);
485
486 _templateObject$6 = function _templateObject() {
487 return data;
488 };
489
490 return data;
491}
492
493var SelectButton = function SelectButton(props) {
494 return React__default.createElement(SelectButtonStyled, _extends_1({
495 type: "button"
496 }, props));
497};
498
499var SelectButtonStyled = styled__default.button(_templateObject$6(), function (_ref) {
500 var theme = _ref.theme,
501 selected = _ref.selected,
502 backgroundColor = _ref.backgroundColor;
503 return "1px solid " + (selected ? backgroundColor || theme.colors.deepBlue : theme.colors.strokeGray);
504}, function (_ref2) {
505 var theme = _ref2.theme,
506 selected = _ref2.selected,
507 backgroundColor = _ref2.backgroundColor;
508 return selected ? backgroundColor || theme.colors.deepBlue : theme.colors.white;
509}, function (_ref3) {
510 var theme = _ref3.theme,
511 selected = _ref3.selected,
512 colorText = _ref3.colorText;
513 return selected ? theme.colors.white : colorText || theme.colors.gray;
514});
515SelectButton.defaultProps = {
516 selected: false
517};
518SelectButton.displayName = 'SelectButton';
519SelectButton.propTypes = {
520 selected: PropTypes.bool
521};
522
523function _templateObject$7() {
524 var data = taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\n\tbutton {\n\t\tborder-radius: 0;\n\t\twidth: ", ";\n\t}\n\n\tbutton:first-child {\n\t\tborder-radius: 4px 0px 0px 4px;\n\t}\n\n\tbutton:last-child {\n\t\tborder-radius: 0px 4px 4px 0px;\n\t}\n"]);
525
526 _templateObject$7 = function _templateObject() {
527 return data;
528 };
529
530 return data;
531}
532
533var SelectGroupButton = function SelectGroupButton(_ref) {
534 var children = _ref.children,
535 childWidth = _ref.childWidth,
536 props = objectWithoutPropertiesLoose(_ref, ["children", "childWidth"]);
537
538 return React__default.createElement(SelectGroupButtonWrapper, _extends_1({
539 childWidth: childWidth
540 }, props), children);
541};
542
543var SelectGroupButtonWrapper = styled__default.div(_templateObject$7(), function (_ref2) {
544 var childWidth = _ref2.childWidth;
545 return childWidth;
546});
547SelectGroupButton.defaultProps = {
548 childWidth: '178px'
549};
550SelectGroupButton.propTypes = {
551 /** Node with the childrens */
552 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
553
554 /** Child width to apply for each child element */
555 childWidth: PropTypes.string
556};
557SelectGroupButton.displayName = 'SelectGroupButton';
558SelectGroupButtonWrapper.displayName = 'SelectGroupButtonWrapper';
559
560var colors = {
561 white: '#FFFFFF',
562 black: '#424242',
563 // primary
564 deepBlue: '#0D0CB5',
565 activeBlue: '#005BEA',
566 purple: '#4E2F60',
567 // secondary
568 yellow: '#FBB03B',
569 orange: '#EC8222',
570 red: '#CF0A2C',
571 darkRed: '#A21D21',
572 lightBlue: '#DAEDFF',
573 malibu: '#63BDE9',
574 pacificBlue: '#1692CE',
575 green: '#3EC28F',
576 lightGreen: '#95C623',
577 purpleHeart: '#6A11CB',
578 ultraMarine: '#0D0CB5',
579 oliveDrab: '#679009',
580 mariner: '#4265AA',
581 summerSky: '#36A8DF',
582 whisper: '#ECECEC',
583 // grayscale
584 darkGray: '#424242',
585 mediumGray: '#6A6A6A',
586 gray: '#B8B8B8',
587 strokeGray: '#DDDDDD',
588 lightGray: '#F3F3F3',
589 // gradient
590 blueOcean: 'linear-gradient(90deg,#0D0CB5 0%,rgba(255, 255, 255, 0) 100%),#2681E0',
591 wine: 'linear-gradient(90deg,#4E2F60 0%,rgba(255, 255, 255, 0) 100%),#852D91',
592 jellyfish: 'linear-gradient(90deg,#6A11CB 0%,rgba(255,255,255,0) 100%),#2575FC'
593};
594
595var SPACE_UNIT = 1;
596var theme = {
597 name: 'DEFAULT',
598 colors: colors,
599 borderRadius: '0',
600 navbar: {
601 backgroundColor: colors.darkRed
602 },
603 buttons: {
604 borderRadius: '16px',
605 bg: colors.activeBlue,
606 activeBg: colors.deepBlue,
607 text: colors.white,
608 dropdown: {
609 separatorColor: colors.gray,
610 activeBackgroundColor: colors.gray
611 }
612 },
613 list: {
614 pairCell: colors.lightGray,
615 unPairCell: colors.white,
616 title: colors.black,
617 additionalInfo: colors.gray,
618 activeCell: colors.lightBlue,
619 boxShadow: '0 3px 3px rgba(0, 0, 0, 0.25)'
620 },
621 span: {
622 defaultColor: colors.activeBlue,
623 negative: colors.red,
624 positive: colors.green,
625 primary: colors.activeBlue
626 },
627 block: {
628 borderRadius: '0',
629 backgroundColor: colors.darkRed,
630 labelColor: colors.darkGray,
631 color: colors.darkGray
632 },
633 input: {
634 borderRadius: '0'
635 },
636 select: {
637 borderRadius: '4px',
638 placeholderColor: colors.darkGray,
639 focusedBackgroundColor: colors.whisper,
640 selectedBackgroundColor: colors.activeBlue,
641 menuPadding: '5px 10px 5px 10px'
642 },
643 toggle: {
644 color: colors.green
645 },
646 timePicker: {
647 errorColor: colors.red,
648 disabledColor: colors.lightGray,
649 primaryColor: colors.activeBlue,
650 activeColor: colors.deepBlue,
651 hoverColor: colors.lightGray,
652 textColor: colors.darkGray
653 },
654 numberSpinner: {
655 errorColor: colors.red,
656 disabledColor: colors.lightGray,
657 disabledColorText: colors.gray,
658 primaryColor: colors.activeBlue,
659 activeColor: colors.deepBlue,
660 hoverColor: colors.lightGray,
661 textColor: colors.darkGray,
662 borderColor: colors.white
663 },
664 toast: {
665 titleColor: colors.darkGray,
666 messageColor: colors.mediumGray,
667 errorColor: colors.red,
668 successColor: colors.green,
669 warningColor: colors.yellow
670 },
671 passwordStrengthMeter: {
672 none: colors.strokeGray,
673 bad: colors.red,
674 medium: colors.yellow,
675 good: colors.lightGreen,
676 excellent: colors.green
677 },
678 status: {
679 bg: {
680 success: colors.green,
681 error: colors.red,
682 info: colors.lightBlue,
683 blocked: colors.jellyfish
684 },
685 color: {
686 success: colors.white,
687 error: colors.white,
688 info: colors.darkGray,
689 blocked: colors.white
690 }
691 },
692 bulletState: {
693 colors: {
694 on: colors.green,
695 away: colors.yellow,
696 off: colors.red
697 }
698 },
699 inputRange: {
700 borderColor: colors.strokeGray,
701 backgroundThumbColor: colors.white,
702 gradient: function gradient(value) {
703 return "linear-gradient(90deg, " + colors.purpleHeart + " 0%, " + colors.ultraMarine + " " + value + "%, " + colors.strokeGray + " " + value + "%, " + colors.strokeGray + " 100%)";
704 }
705 },
706 gradeDropdown: {
707 veryHigh: colors.darkRed,
708 high: colors.orange,
709 normal: colors.yellow,
710 low: colors.green,
711 veryLow: colors.activeBlue
712 },
713 label: {
714 defaultColor: colors.activeBlue
715 },
716 listCard: {
717 defaultBorder: colors.strokeGray,
718 errorBorder: colors.red
719 },
720 dndList: {
721 active: colors.activeBlue,
722 dragOver: colors.lightBlue
723 },
724 space: {
725 xxs: SPACE_UNIT * 0.25 + "em",
726 xs: SPACE_UNIT * 0.5 + "em",
727 sm: SPACE_UNIT * 0.75 + "em",
728 md: SPACE_UNIT * 1.25 + "em",
729 lg: SPACE_UNIT * 2 + "em",
730 xl: SPACE_UNIT * 3.25 + "em",
731 xxl: SPACE_UNIT * 5.25 + "em"
732 },
733 text: {
734 sm: {
735 font: 12,
736 line: 14
737 },
738 md: {
739 font: 13,
740 line: 15
741 },
742 lg: {
743 font: 15,
744 line: 18
745 },
746 xl: {
747 font: 18,
748 line: 21
749 },
750 xxl: {
751 font: 22,
752 line: 26
753 }
754 }
755};
756
757var colorLuminance = (function (hex, lum) {
758 if (lum === void 0) {
759 lum = 0;
760 }
761
762 var rgb = '#';
763 var c;
764 hex.slice(1).match(/.{1,2}/g).forEach(function (element) {
765 c = parseInt(element, 16);
766 c = Math.round(Math.min(Math.max(0, c + c * lum), 255)).toString(16);
767 rgb += ("00" + c).substr(c.length);
768 });
769 return rgb;
770});
771
772function _templateObject$8() {
773 var data = taggedTemplateLiteralLoose(["\n\tbackground-position: center;\n\ttransition: background 0.8s;\n\tuser-select: none;\n\tcursor: pointer;\n\n\t:hover {\n\t\tbackground: ", "\n\t\t\tradial-gradient(circle, transparent 1%, ", " 1%) center/15000%;\n\t}\n\n\t:active {\n\t\tbackground-color: ", ";\n\t\tbackground-size: 100%;\n\t\ttransition: background 0s;\n\t}\n"]);
774
775 _templateObject$8 = function _templateObject() {
776 return data;
777 };
778
779 return data;
780}
781var Ripple = styled__default.div(_templateObject$8(), function (_ref) {
782 var color = _ref.color;
783 return colorLuminance(color, 0.1);
784}, function (_ref2) {
785 var color = _ref2.color;
786 return colorLuminance(color, 0.1);
787}, function (_ref3) {
788 var color = _ref3.color;
789 return colorLuminance(color, 0.3);
790});
791Ripple.propTypes = {
792 /** color to be displayed in the ripple effect */
793 color: PropTypes.string.isRequired
794};
795Ripple.displayName = 'Ripple';
796
797function _templateObject3() {
798 var data = taggedTemplateLiteralLoose(["\n\tpadding-left: 18px;\n"]);
799
800 _templateObject3 = function _templateObject3() {
801 return data;
802 };
803
804 return data;
805}
806
807function _templateObject2$1() {
808 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 68px;\n\theight: 100%;\n\talign-items: center;\n\tjustify-content: center;\n\n\tbackground: ", ";\n\tborder-radius: 3px 0 0 3px;\n\tcolor: ", ";\n"]);
809
810 _templateObject2$1 = function _templateObject2() {
811 return data;
812 };
813
814 return data;
815}
816
817function _templateObject$9() {
818 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tmin-width: 200px;\n\tmax-width: ", ";\n\theight: 68px;\n\n\talign-items: center;\n\n\tbackground-color: ", ";\n\tborder-radius: 3px;\n\tbox-shadow: 0 0 8px rgba(0, 0, 0, 0.15);\n\n\tcolor: ", ";\n\tfont-size: 35px;\n\toutline: none;\n"]);
819
820 _templateObject$9 = function _templateObject() {
821 return data;
822 };
823
824 return data;
825}
826
827var GenerateButton = function GenerateButton(_ref) {
828 var children = _ref.children,
829 onClick = _ref.onClick,
830 boldContent = _ref.boldContent,
831 bgColor = _ref.bgColor,
832 fullWidth = _ref.fullWidth,
833 props = objectWithoutPropertiesLoose(_ref, ["children", "onClick", "boldContent", "bgColor", "fullWidth"]);
834
835 return React__default.createElement(GenerateButtonStyled, _extends_1({
836 fullWidth: fullWidth,
837 color: theme.colors.strokeGray,
838 onClick: onClick
839 }, props), boldContent && React__default.createElement(BoldContentWrapper, {
840 bgColor: bgColor
841 }, boldContent), React__default.createElement(Content, null, children));
842};
843
844var GenerateButtonStyled = styled__default(Ripple)(_templateObject$9(), function (_ref2) {
845 var fullWidth = _ref2.fullWidth;
846 return fullWidth ? '100%' : '340px';
847}, function (_ref3) {
848 var theme$$1 = _ref3.theme;
849 return theme$$1.colors.white;
850}, function (_ref4) {
851 var theme$$1 = _ref4.theme;
852 return theme$$1.colors.darkGray;
853});
854var BoldContentWrapper = styled__default.div(_templateObject2$1(), function (_ref5) {
855 var bgColor = _ref5.bgColor;
856 return bgColor;
857}, function (_ref6) {
858 var theme$$1 = _ref6.theme;
859 return theme$$1.colors.white;
860});
861var Content = styled__default.div(_templateObject3());
862GenerateButton.defaultProps = {
863 boldContent: '',
864 bgColor: theme.colors.red,
865 fullWidth: false
866};
867GenerateButton.propTypes = {
868 /** onClick handler */
869 onClick: PropTypes.func.isRequired,
870
871 /** text visible on bold side of button */
872 boldContent: PropTypes.string,
873
874 /** bold side color */
875 bgColor: PropTypes.string,
876
877 /** if the button is full width */
878 fullWidth: PropTypes.bool,
879
880 /** main content of the button */
881 children: PropTypes.string.isRequired
882};
883GenerateButton.displayName = 'GenerateButton';
884
885function _templateObject2$2() {
886 var data = taggedTemplateLiteralLoose(["\n\tcolor: ", ";\n"]);
887
888 _templateObject2$2 = function _templateObject2() {
889 return data;
890 };
891
892 return data;
893}
894
895function _templateObject$a() {
896 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tmin-width: 200px;\n\twidth: ", ";\n\theight: ", ";\n\n\talign-items: center;\n\tjustify-content: center;\n\n\tbackground-color: ", ";\n\n\tfont-size: 28px;\n\tbox-shadow: 0px 0px 8px rgba(0, 0, 0, 0.15);\n\tborder-radius: 4px;\n"]);
897
898 _templateObject$a = function _templateObject() {
899 return data;
900 };
901
902 return data;
903}
904
905var SquareButton = function SquareButton(_ref) {
906 var children = _ref.children,
907 onClick = _ref.onClick,
908 width = _ref.width,
909 height = _ref.height,
910 bgColor = _ref.bgColor,
911 textColor = _ref.textColor,
912 props = objectWithoutPropertiesLoose(_ref, ["children", "onClick", "width", "height", "bgColor", "textColor"]);
913
914 return React__default.createElement(SquareButtonStyled, _extends_1({
915 onClick: onClick,
916 width: width,
917 height: height,
918 bgColor: bgColor,
919 color: bgColor || theme.colors.strokeGray
920 }, props), React__default.createElement(Content$1, {
921 textColor: textColor
922 }, children));
923};
924
925var SquareButtonStyled = styled__default(Ripple)(_templateObject$a(), function (_ref2) {
926 var width = _ref2.width;
927 return width;
928}, function (_ref3) {
929 var height = _ref3.height;
930 return height;
931}, function (_ref4) {
932 var bgColor = _ref4.bgColor,
933 theme$$1 = _ref4.theme;
934 return bgColor || theme$$1.colors.white;
935});
936var Content$1 = styled__default.div(_templateObject2$2(), function (_ref5) {
937 var textColor = _ref5.textColor;
938 return textColor;
939});
940SquareButton.defaultProps = {
941 width: '427px',
942 height: '68px',
943 bgColor: undefined,
944 textColor: theme.colors.darkGray
945};
946SquareButton.propTypes = {
947 /** onClick handler */
948 onClick: PropTypes.func.isRequired,
949
950 /** button width */
951 width: PropTypes.string,
952
953 /** button height */
954 height: PropTypes.string,
955
956 /** button background color */
957 bgColor: PropTypes.string,
958
959 /** button text color */
960 textColor: PropTypes.string,
961
962 /** main content of the button */
963 children: PropTypes.string.isRequired
964};
965SquareButton.displayName = 'SquareButton';
966
967function _inheritsLoose(subClass, superClass) {
968 subClass.prototype = Object.create(superClass.prototype);
969 subClass.prototype.constructor = subClass;
970 subClass.__proto__ = superClass;
971}
972
973var inheritsLoose = _inheritsLoose;
974
975function _templateObject$b() {
976 var data = taggedTemplateLiteralLoose(["\n\tbackground-color: ", " !important;\n\tbox-shadow: 0 2px 3px rgba(0, 0, 0, 0.4) !important;\n\n\t& .item {\n\t\tcolor: #fff !important;\n\t}\n\n\t&&& a.active.item {\n\t\tborder-color: #fff !important;\n\t\tfont-weight: 700;\n\t}\n\n\t&&& a.item:hover {\n\t\tborder-color: #fff !important;\n\t\tfont-weight: 700;\n\t}\n"]);
977
978 _templateObject$b = function _templateObject() {
979 return data;
980 };
981
982 return data;
983}
984
985var MenuExtended =
986/*#__PURE__*/
987function (_SemanticUIMenu) {
988 inheritsLoose(MenuExtended, _SemanticUIMenu);
989
990 function MenuExtended() {
991 return _SemanticUIMenu.apply(this, arguments) || this;
992 }
993
994 return MenuExtended;
995}(semanticUiReact.Menu);
996
997MenuExtended.propTypes = _extends_1({}, semanticUiReact.Menu.propTypes, {
998 color: PropTypes.string.isRequired
999 /**
1000 * semantic UI Menu extended. Can be used as navbar
1001 * https://react.semantic-ui.com/collections/menu/
1002 */
1003
1004});
1005var Navbar = styled__default(MenuExtended)(_templateObject$b(), function (_ref) {
1006 var color = _ref.color;
1007 return color;
1008});
1009Navbar.propTypes = {
1010 /** Navbar Color can be specified. Hexadecimal color ex: #a21d21 * */
1011 color: PropTypes.string.isRequired
1012};
1013Navbar.displayName = 'Navbar';
1014
1015function _templateObject$c() {
1016 var data = taggedTemplateLiteralLoose(["\n\tborder-color: #cccccc !important;\n\n\t.active.item {\n\t\tborder-color: ", " !important;\n\t\tcolor: ", " !important;\n\t}\n\n\t.item {\n\t\tpadding: 8px 12px !important;\n\t\tcolor: #cccccc !important;\n\t\tfont-size: 15px !important;\n\t}\n"]);
1017
1018 _templateObject$c = function _templateObject() {
1019 return data;
1020 };
1021
1022 return data;
1023}
1024
1025var Tabs = function Tabs(_ref) {
1026 var panes = _ref.panes,
1027 props = objectWithoutPropertiesLoose(_ref, ["panes"]);
1028
1029 return React__default.createElement(TabStyled, _extends_1({
1030 menu: {
1031 secondary: true,
1032 pointing: true
1033 },
1034 panes: panes
1035 }, props));
1036};
1037
1038var TabStyled = styled__default(semanticUiReact.Tab)(_templateObject$c(), function (_ref2) {
1039 var theme = _ref2.theme;
1040 return theme.colors.activeBlue;
1041}, function (_ref3) {
1042 var theme = _ref3.theme;
1043 return theme.colors.activeBlue;
1044});
1045
1046function _assertThisInitialized(self) {
1047 if (self === void 0) {
1048 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1049 }
1050
1051 return self;
1052}
1053
1054var assertThisInitialized = _assertThisInitialized;
1055
1056function _defineProperty(obj, key, value) {
1057 if (key in obj) {
1058 Object.defineProperty(obj, key, {
1059 value: value,
1060 enumerable: true,
1061 configurable: true,
1062 writable: true
1063 });
1064 } else {
1065 obj[key] = value;
1066 }
1067
1068 return obj;
1069}
1070
1071var defineProperty = _defineProperty;
1072
1073var _ref =
1074/*#__PURE__*/
1075React__default.createElement("path", {
1076 d: "M93.262 36.578c-.14.14-.376.235-.663.235-.308 0-.56-.067-.802-.381v.347h-.286v-3.99h.286v1.637c.241-.314.494-.381.802-.381.287 0 .522.095.663.235.275.274.347.723.347 1.149 0 .425-.072.874-.347 1.149zm-.702-2.281c-.662 0-.763.571-.763 1.132 0 .56.101 1.132.763 1.132s.763-.572.763-1.132c0-.56-.1-1.132-.763-1.132zM94.888 37.826c-.135.129-.331.174-.51.174h-.135v-.252h.106c.309 0 .399-.101.494-.37l.219-.6-.988-2.701h.315l.813 2.365.814-2.365h.314l-1.257 3.435a.713.713 0 0 1-.185.314zM100.886 36.958l-.399-.398c-.23.162-.522.252-.836.252a1.43 1.43 0 0 1-1.049-.426c-.393-.392-.387-.835-.387-1.603 0-.767-.006-1.21.387-1.602a1.43 1.43 0 0 1 1.05-.426c.426 0 .779.151 1.054.426.393.392.382.835.382 1.602 0 .679.005 1.093-.258 1.452l.392.386-.336.337zm-.64-3.413a.815.815 0 0 0-.595-.247.815.815 0 0 0-.594.247c-.197.213-.236.437-.236 1.238 0 .802.039 1.026.236 1.239.14.151.359.247.594.247a.699.699 0 0 0 .41-.13l-.42-.42.336-.336.387.387c.101-.202.118-.47.118-.986 0-.802-.04-1.026-.236-1.239zM101.839 35.49v-.533h1.638v.533h-1.638zM105.99 36.779h-1.616v-3.99h1.555c.74 0 1.206.42 1.206 1.092 0 .432-.269.74-.539.847.309.123.601.42.601.924 0 .734-.5 1.127-1.207 1.127zm-.112-3.447h-.898v1.143h.898c.387 0 .651-.202.651-.571 0-.37-.264-.572-.651-.572zm.056 1.687h-.954v1.216h.954c.421 0 .657-.258.657-.61 0-.354-.236-.606-.657-.606zM108.448 35.523c0 .488.258.796.724.796.319 0 .488-.09.69-.292l.364.342c-.291.292-.566.443-1.066.443-.712 0-1.279-.375-1.279-1.457 0-.92.477-1.451 1.206-1.451.764 0 1.207.56 1.207 1.367v.252h-1.846zm1.2-.785a.585.585 0 0 0-.561-.358.593.593 0 0 0-.566.358.89.89 0 0 0-.073.387h1.279a.888.888 0 0 0-.079-.386zM111.898 36.778c-.533 0-.78-.38-.78-.79v-1.563h-.325v-.438h.325v-.863h.572v.863h.55v.438h-.55v1.535c0 .207.101.33.315.33h.235v.488h-.342zM113.817 36.778c-.533 0-.78-.38-.78-.79v-1.563h-.326v-.438h.326v-.863h.572v.863h.55v.438h-.55v1.535c0 .207.101.33.314.33h.236v.488h-.342zM115.292 35.523c0 .488.258.796.724.796.319 0 .488-.09.69-.292l.365.342c-.292.292-.567.443-1.066.443-.713 0-1.28-.375-1.28-1.457 0-.92.477-1.451 1.207-1.451.763 0 1.206.56 1.206 1.367v.252h-1.846zm1.201-.785a.587.587 0 0 0-.562-.358.594.594 0 0 0-.566.358.89.89 0 0 0-.073.387h1.279a.888.888 0 0 0-.078-.386zM119.46 34.604c-.129-.129-.23-.19-.427-.19-.308 0-.566.246-.566.638v1.726h-.572v-2.84h.561v.307c.145-.201.437-.341.757-.341.275 0 .483.072.679.268l-.432.432z",
1077 fill: "#fff"
1078});
1079
1080var _ref2 =
1081/*#__PURE__*/
1082React__default.createElement("path", {
1083 d: "M.986 22.506l12.426 7.018v-3.13l-9.288-5.31v-9.265l-3.138-1.77v12.457z",
1084 fill: "url(#paint0_linear)"
1085});
1086
1087var _ref3 =
1088/*#__PURE__*/
1089React__default.createElement("path", {
1090 d: "M22.823 11.793l3.134-1.769L13.5 2.964 1.076 10.047 4.21 11.82l9.291-5.294 9.322 5.268z",
1091 fill: "url(#paint1_linear)"
1092});
1093
1094var _ref4 =
1095/*#__PURE__*/
1096React__default.createElement("path", {
1097 d: "M16.487 24.653l-3.075 1.742v3.125l3.075-1.764 3.076-1.767v-3.102l-3.076 1.766z",
1098 fill: "url(#paint2_linear)"
1099});
1100
1101var _ref5 =
1102/*#__PURE__*/
1103React__default.createElement("path", {
1104 d: "M25.838 26.015v3.07l3.013-1.794v-3.078l-3.013-1.802V10.024l-3.138 1.77v12.42l3.138 1.801z",
1105 fill: "url(#paint3_linear)"
1106});
1107
1108var _ref6 =
1109/*#__PURE__*/
1110React__default.createElement("path", {
1111 d: "M88.524 8.693c-.101 0-.2.005-.301.009v-.009c-2.732 0-5.063.993-6.719 2.67V1.332a1.333 1.333 0 0 0-2.667 0v17.002l.002.003c.035 5.465 3.915 9.46 9.404 9.46v-.008c.094.002.186.008.281.008 5.265 0 9.126-4.03 9.126-9.534 0-5.539-3.826-9.57-9.126-9.57zm-.316 16.51a7.042 7.042 0 0 1-2.837-.579c-2.302-1.049-3.867-3.439-3.867-6.361 0-1.704.467-3.214 1.329-4.39.012-.015.021-.031.032-.046.066-.087.139-.169.21-.252.084-.1.167-.201.257-.295l.061-.06c.136-.137.276-.271.425-.395.003-.004.008-.007.012-.01.155-.13.317-.252.485-.367l.116-.073c.127-.084.258-.165.393-.24.126-.068.256-.131.39-.193.047-.022.092-.046.14-.068.765-.329 1.632-.525 2.589-.575.088-.003.175-.012.265-.012 3.93 0 6.775 2.944 6.775 6.976 0 4.065-2.879 6.94-6.775 6.94zM44.603 27.172c.102 0 .201-.005.302-.009v.009c2.732 0 5.062-.993 6.718-2.67v10.032a1.333 1.333 0 0 0 2.668 0V17.532l-.003-.004c-.034-5.465-3.914-9.46-9.404-9.46v.008c-.093-.002-.185-.008-.28-.008-5.266 0-9.127 4.031-9.127 9.535 0 5.538 3.827 9.57 9.126 9.57zm.316-16.51a7.04 7.04 0 0 1 2.837.58c2.302 1.048 3.867 3.438 3.867 6.36 0 1.704-.467 3.214-1.328 4.39-.012.015-.022.031-.033.046-.066.087-.139.17-.209.253-.085.1-.167.2-.258.295l-.06.06a6.088 6.088 0 0 1-.425.395l-.012.009c-.156.13-.317.252-.485.367-.038.026-.078.049-.116.074a6.08 6.08 0 0 1-.394.239 6.842 6.842 0 0 1-.389.193c-.047.023-.093.046-.141.068-.764.329-1.632.526-2.588.575-.089.003-.176.012-.266.012-3.93 0-6.774-2.944-6.774-6.975 0-4.066 2.878-6.94 6.774-6.94zM72.728 8.062c-.736 0-1.334.597-1.334 1.332V19.98c0 3.12-1.79 5.398-4.949 5.398s-4.948-2.278-4.948-5.398V9.394a1.334 1.334 0 0 0-2.668 0V19.98c0 4.522 3.088 7.817 7.616 7.817s7.617-3.295 7.617-7.817V9.394c0-.735-.598-1.332-1.334-1.332zM120 18.024c0-5.46-3.916-9.442-9.348-9.442-5.503 0-9.454 3.981-9.454 9.407 0 5.672 4.021 9.794 9.595 9.794 3.628 0 7.081-2.064 8.282-4.928a1.51 1.51 0 0 0 .065-.15l.014-.03-.004-.002c.043-.128.071-.263.071-.406 0-.717-.582-1.298-1.299-1.298-.528 0-.969.354-1.165.826l-.002-.001c-.882 2.008-3.458 3.558-6.139 3.558-3.527 0-6.243-2.572-6.667-6.306l16.016.035c.035-.387.035-.74.035-1.057zm-15.98-1.303c.494-3.347 3.069-5.673 6.526-5.673 3.527 0 6.138 2.326 6.632 5.708l-13.158-.035z",
1112 fill: "#fff"
1113});
1114
1115var _ref7 =
1116/*#__PURE__*/
1117React__default.createElement("defs", null, React__default.createElement("linearGradient", {
1118 id: "paint0_linear",
1119 x1: 1.258,
1120 y1: 16.424,
1121 x2: 13.449,
1122 y2: 23.384,
1123 gradientUnits: "userSpaceOnUse"
1124}, React__default.createElement("stop", {
1125 stopColor: "#BCBEC0"
1126}), React__default.createElement("stop", {
1127 offset: 1,
1128 stopColor: "#fff"
1129})), React__default.createElement("linearGradient", {
1130 id: "paint1_linear",
1131 x1: 1.076,
1132 y1: 7.391,
1133 x2: 22.256,
1134 y2: 7.391,
1135 gradientUnits: "userSpaceOnUse"
1136}, React__default.createElement("stop", {
1137 stopColor: "#BCBEC0"
1138}), React__default.createElement("stop", {
1139 offset: 1,
1140 stopColor: "#fff"
1141})), React__default.createElement("linearGradient", {
1142 id: "paint2_linear",
1143 x1: 18.858,
1144 y1: 24.874,
1145 x2: 14.624,
1146 y2: 27.254,
1147 gradientUnits: "userSpaceOnUse"
1148}, React__default.createElement("stop", {
1149 stopColor: "#BCBEC0"
1150}), React__default.createElement("stop", {
1151 offset: 1,
1152 stopColor: "#fff"
1153})), React__default.createElement("linearGradient", {
1154 id: "paint3_linear",
1155 x1: 25.776,
1156 y1: 10.998,
1157 x2: 25.776,
1158 y2: 27.864,
1159 gradientUnits: "userSpaceOnUse"
1160}, React__default.createElement("stop", {
1161 stopColor: "#BCBEC0"
1162}), React__default.createElement("stop", {
1163 offset: 1,
1164 stopColor: "#fff"
1165})));
1166
1167var QubeLogo = 'data:image/svg+xml,%3Csvg%20width%3D%22120%22%20height%3D%2238%22%20viewBox%3D%220%200%20120%2038%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M93.2616%2036.5776C93.1213%2036.7178%2092.8857%2036.8129%2092.5994%2036.8129C92.2909%2036.8129%2092.0382%2036.7456%2091.7971%2036.4319V36.7792H91.511V32.7894H91.7971V34.4256C92.0382%2034.1117%2092.2909%2034.0446%2092.5994%2034.0446C92.8857%2034.0446%2093.1213%2034.1399%2093.2616%2034.2799C93.5365%2034.5544%2093.6094%2035.0027%2093.6094%2035.4287C93.6094%2035.8545%2093.5365%2036.3028%2093.2616%2036.5776ZM92.5604%2034.2968C91.8982%2034.2968%2091.7972%2034.8682%2091.7972%2035.4287C91.7972%2035.9891%2091.8983%2036.5607%2092.5604%2036.5607C93.2224%2036.5607%2093.3233%2035.9891%2093.3233%2035.4287C93.3233%2034.8682%2093.2222%2034.2968%2092.5604%2034.2968Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M94.8881%2037.8259C94.7533%2037.9549%2094.5569%2037.9997%2094.3774%2037.9997H94.2427V37.7475H94.3494C94.6579%2037.7475%2094.7478%2037.6466%2094.843%2037.3776L95.062%2036.778L94.0743%2034.0769H94.3886L95.2022%2036.4418L96.0158%2034.0769H96.3301L95.0733%2037.5121C95.0228%2037.6578%2094.9611%2037.7643%2094.8881%2037.8259Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M100.886%2036.9578L100.487%2036.5599C100.257%2036.7223%2099.9654%2036.8121%2099.6512%2036.8121C99.2248%2036.8121%2098.877%2036.6607%2098.602%2036.3862C98.2092%2035.994%2098.2148%2035.5513%2098.2148%2034.7835C98.2148%2034.0156%2098.2092%2033.573%2098.602%2033.1806C98.877%2032.9061%2099.2248%2032.7549%2099.6512%2032.7549C100.078%2032.7549%20100.431%2032.9061%20100.706%2033.1806C101.099%2033.5728%20101.088%2034.0156%20101.088%2034.7835C101.088%2035.4616%20101.093%2035.8762%20100.83%2036.235L101.222%2036.6215L100.886%2036.9578ZM100.246%2033.545C100.106%2033.3936%2099.8869%2033.2983%2099.6512%2033.2983C99.4157%2033.2983%2099.1967%2033.3936%2099.0566%2033.545C98.86%2033.758%2098.8208%2033.9821%2098.8208%2034.7835C98.8208%2035.5847%2098.86%2035.8089%2099.0566%2036.0219C99.1967%2036.1732%2099.4157%2036.2686%2099.6512%2036.2686C99.8028%2036.2686%2099.943%2036.2237%20100.061%2036.1397L99.6401%2035.7195L99.9767%2035.3832L100.364%2035.7699C100.465%2035.5681%20100.482%2035.2991%20100.482%2034.7836C100.482%2033.9821%20100.442%2033.758%20100.246%2033.545Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M101.839%2035.4897V34.9573H103.477V35.4897H101.839Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M105.99%2036.7786H104.374V32.7887H105.929C106.669%2032.7887%20107.135%2033.2089%20107.135%2033.8813C107.135%2034.3127%20106.866%2034.6212%20106.596%2034.7276C106.905%2034.8507%20107.197%2035.1478%20107.197%2035.6522C107.197%2036.3864%20106.697%2036.7786%20105.99%2036.7786ZM105.878%2033.3322H104.98V34.4754H105.878C106.265%2034.4754%20106.529%2034.2735%20106.529%2033.9038C106.529%2033.534%20106.265%2033.3322%20105.878%2033.3322ZM105.934%2035.019H104.98V36.235H105.934C106.355%2036.235%20106.591%2035.9771%20106.591%2035.6242C106.591%2035.2712%20106.355%2035.019%20105.934%2035.019Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M108.448%2035.5231C108.448%2036.0106%20108.706%2036.3188%20109.172%2036.3188C109.491%2036.3188%20109.66%2036.2292%20109.862%2036.0274L110.226%2036.3692C109.935%2036.6606%20109.66%2036.812%20109.16%2036.812C108.448%2036.812%20107.881%2036.4365%20107.881%2035.355C107.881%2034.4359%20108.358%2033.9035%20109.087%2033.9035C109.851%2033.9035%20110.294%2034.4638%20110.294%2035.2707V35.5229H108.448V35.5231ZM109.648%2034.7385C109.559%2034.5255%20109.357%2034.3798%20109.087%2034.3798C108.818%2034.3798%20108.61%2034.5255%20108.521%2034.7385C108.465%2034.8673%20108.453%2034.9515%20108.448%2035.1252H109.727C109.721%2034.9514%20109.705%2034.8673%20109.648%2034.7385Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M111.898%2036.7781C111.365%2036.7781%20111.118%2036.3971%20111.118%2035.988V34.4245H110.793V33.9872H111.118V33.1242H111.69V33.9872H112.24V34.4245H111.69V35.9599C111.69%2036.1672%20111.791%2036.2906%20112.005%2036.2906H112.24V36.7781H111.898Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M113.817%2036.7781C113.284%2036.7781%20113.037%2036.3971%20113.037%2035.988V34.4245H112.711V33.9872H113.037V33.1242H113.609V33.9872H114.159V34.4245H113.609V35.9599C113.609%2036.1672%20113.71%2036.2906%20113.923%2036.2906H114.159V36.7781H113.817Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M115.292%2035.5231C115.292%2036.0106%20115.55%2036.3188%20116.016%2036.3188C116.335%2036.3188%20116.504%2036.2292%20116.706%2036.0274L117.071%2036.3692C116.779%2036.6606%20116.504%2036.812%20116.005%2036.812C115.292%2036.812%20114.725%2036.4365%20114.725%2035.355C114.725%2034.4359%20115.202%2033.9035%20115.932%2033.9035C116.695%2033.9035%20117.138%2034.4638%20117.138%2035.2707V35.5229H115.292V35.5231ZM116.493%2034.7385C116.403%2034.5255%20116.201%2034.3798%20115.931%2034.3798C115.662%2034.3798%20115.455%2034.5255%20115.365%2034.7385C115.309%2034.8673%20115.297%2034.9515%20115.292%2035.1252H116.571C116.566%2034.9514%20116.549%2034.8673%20116.493%2034.7385Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M119.46%2034.604C119.331%2034.4752%20119.23%2034.4134%20119.033%2034.4134C118.725%2034.4134%20118.467%2034.6601%20118.467%2035.0523V36.7783H117.895V33.9371H118.456V34.2453C118.601%2034.0436%20118.893%2033.9035%20119.213%2033.9035C119.488%2033.9035%20119.696%2033.9763%20119.892%2034.1724L119.46%2034.604Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M0.98584%2022.506L13.4121%2029.5243V26.3946L4.12378%2021.0833V11.819L0.98584%2010.0499V22.506Z%22%20fill%3D%22url%28%23paint0_linear%29%22%2F%3E%3Cpath%20d%3D%22M22.8229%2011.7933L25.9567%2010.0241L13.5008%202.96313L1.07617%2010.0483L4.21022%2011.8191L13.501%206.52529L22.8229%2011.7933Z%22%20fill%3D%22url%28%23paint1_linear%29%22%2F%3E%3Cpath%20d%3D%22M16.4874%2024.6532L13.4122%2026.3947V29.5201L16.4874%2027.7556L19.5625%2025.9892V22.8869L16.4874%2024.6532Z%22%20fill%3D%22url%28%23paint2_linear%29%22%2F%3E%3Cpath%20d%3D%22M25.8382%2026.0152V29.0841L28.8506%2027.2913V24.2132L25.8382%2022.4112V10.0241L22.7003%2011.7933V24.2132L25.8382%2026.0152Z%22%20fill%3D%22url%28%23paint3_linear%29%22%2F%3E%3Cpath%20d%3D%22M88.5242%208.69291C88.4226%208.69291%2088.3233%208.69843%2088.223%208.70194L88.2236%208.69341C85.4909%208.69341%2083.1604%209.68624%2081.5045%2011.3625V1.33155C81.5045%200.5962%2080.907%200%2080.1709%200C79.4339%200%2078.837%200.5962%2078.837%201.33155V18.3337L78.8392%2018.3372C78.8738%2023.8025%2082.7537%2027.797%2088.243%2027.797L88.2425%2027.7892C88.3366%2027.7915%2088.429%2027.797%2088.5244%2027.797C93.7892%2027.797%2097.6502%2023.7663%2097.6502%2018.2626C97.6499%2012.7245%2093.8238%208.69291%2088.5242%208.69291ZM88.2081%2025.2029C87.1759%2025.2029%2086.2219%2024.9959%2085.3715%2024.624C83.0691%2023.5751%2081.5041%2021.1854%2081.5041%2018.2627C81.5041%2016.559%2081.9709%2015.0494%2082.8328%2013.8731C82.8446%2013.8581%2082.8542%2013.8418%2082.8655%2013.8272C82.9314%2013.7399%2083.0039%2013.6582%2083.0743%2013.5747C83.159%2013.4753%2083.2418%2013.3736%2083.3321%2013.2795C83.3521%2013.2591%2083.3729%2013.2406%2083.393%2013.2202C83.5288%2013.0826%2083.669%2012.9489%2083.8178%2012.8246C83.8213%2012.8214%2083.8259%2012.8184%2083.8296%2012.8153C83.9848%2012.6848%2084.1466%2012.5634%2084.3147%2012.4481C84.3525%2012.4227%2084.3923%2012.3996%2084.4307%2012.3748C84.5584%2012.2907%2084.6895%2012.2104%2084.8244%2012.1356C84.9504%2012.0673%2085.0801%2012.0035%2085.2135%2011.9418C85.2606%2011.9199%2085.3064%2011.8964%2085.3545%2011.8745C86.1189%2011.5455%2086.986%2011.3487%2087.9428%2011.2992C88.0315%2011.2962%2088.1182%2011.2869%2088.2082%2011.2869C92.1389%2011.2869%2094.9825%2014.2315%2094.9825%2018.2626C94.9824%2022.3285%2092.1041%2025.2029%2088.2081%2025.2029Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M44.6034%2027.1723C44.705%2027.1723%2044.804%2027.1668%2044.9047%2027.1634L44.9042%2027.1718C47.6368%2027.1718%2049.9673%2026.179%2051.6232%2024.5027V34.5338C51.6232%2035.269%2052.2207%2035.8652%2052.9569%2035.8652C53.6937%2035.8652%2054.2905%2035.269%2054.2905%2034.5338V17.5316L54.2884%2017.5281C54.2537%2012.0628%2050.374%208.06824%2044.8843%208.06824L44.8848%208.07601C44.7909%208.07388%2044.6986%208.06824%2044.6032%208.06824C39.3383%208.06824%2035.4774%2012.099%2035.4774%2017.6027C35.4777%2023.1407%2039.3037%2027.1723%2044.6034%2027.1723ZM44.9194%2010.6624C45.9515%2010.6624%2046.9055%2010.8693%2047.7558%2011.2413C50.0583%2012.2902%2051.6232%2014.6798%2051.6232%2017.6025C51.6232%2019.3063%2051.1563%2020.8158%2050.2945%2021.9922C50.2827%2022.0071%2050.2732%2022.0235%2050.2619%2022.0381C50.196%2022.1253%2050.1233%2022.2072%2050.053%2022.2907C49.9682%2022.3901%2049.8856%2022.4917%2049.7951%2022.5858C49.7753%2022.6062%2049.7544%2022.6246%2049.7343%2022.6452C49.5985%2022.7828%2049.4581%2022.9164%2049.3095%2023.0407C49.3061%2023.0438%2049.3014%2023.0469%2049.2979%2023.05C49.1425%2023.1805%2048.9807%2023.3018%2048.8128%2023.4171C48.775%2023.4426%2048.7351%2023.4656%2048.6968%2023.4906C48.569%2023.5746%2048.438%2023.6549%2048.3031%2023.7296C48.177%2023.798%2048.0471%2023.8618%2047.914%2023.9234C47.8669%2023.9455%2047.8211%2023.9688%2047.773%2023.9908C47.0086%2024.3197%2046.1415%2024.5165%2045.1847%2024.566C45.096%2024.569%2045.0092%2024.5784%2044.9192%2024.5784C40.9885%2024.5784%2038.1449%2021.6339%2038.1449%2017.6028C38.1452%2013.5366%2041.0234%2010.6624%2044.9194%2010.6624Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M72.7282%208.06204C71.9915%208.06204%2071.3941%208.65874%2071.3941%209.39409V19.9804C71.3941%2023.0997%2069.6037%2025.3784%2066.4452%2025.3784C63.2864%2025.3784%2061.4966%2023.0997%2061.4966%2019.9804V9.39409C61.4966%208.65874%2060.8987%208.06204%2060.1622%208.06204C59.4256%208.06204%2058.8286%208.65874%2058.8286%209.39409V19.9804C58.8286%2024.5022%2061.9172%2027.7971%2066.4452%2027.7971C70.9731%2027.7971%2074.0616%2024.5022%2074.0616%2019.9804V9.39409C74.0616%208.65862%2073.4639%208.06204%2072.7282%208.06204Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M120%2018.024C120%2012.5631%20116.084%208.58167%20110.652%208.58167C105.149%208.58167%20101.198%2012.5633%20101.198%2017.9892C101.198%2023.661%20105.219%2027.7832%20110.793%2027.7832C114.421%2027.7832%20117.874%2025.7195%20119.075%2022.8545C119.099%2022.8061%20119.121%2022.7572%20119.14%2022.7057C119.144%2022.6954%20119.149%2022.6853%20119.154%2022.675L119.15%2022.6733C119.193%2022.5447%20119.221%2022.41%20119.221%2022.2674C119.221%2021.5504%20118.639%2020.9692%20117.922%2020.9692C117.394%2020.9692%20116.953%2021.323%20116.757%2021.7952L116.755%2021.7936C115.873%2023.8019%20113.297%2025.3522%20110.616%2025.3522C107.089%2025.3522%20104.373%2022.7805%20103.949%2019.0463L119.965%2019.081C120%2018.6935%20120%2018.3412%20120%2018.024ZM104.02%2016.7206C104.514%2013.3737%20107.089%2011.0482%20110.546%2011.0482C114.073%2011.0482%20116.684%2013.3737%20117.178%2016.756L104.02%2016.7206Z%22%20fill%3D%22white%22%2F%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22paint0_linear%22%20x1%3D%221.2581%22%20y1%3D%2216.424%22%20x2%3D%2213.4488%22%20y2%3D%2223.3842%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23BCBEC0%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22white%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint1_linear%22%20x1%3D%221.07617%22%20y1%3D%227.39112%22%20x2%3D%2222.2555%22%20y2%3D%227.39112%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23BCBEC0%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22white%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint2_linear%22%20x1%3D%2218.8581%22%20y1%3D%2224.8741%22%20x2%3D%2214.6244%22%20y2%3D%2227.2544%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23BCBEC0%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22white%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint3_linear%22%20x1%3D%2225.7755%22%20y1%3D%2210.9983%22%20x2%3D%2225.7755%22%20y2%3D%2227.8636%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23BCBEC0%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22white%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3C%2Fsvg%3E';
1168
1169var _ref$1 =
1170/*#__PURE__*/
1171React__default.createElement("path", {
1172 d: "M.986 19.543l12.426 7.018v-3.13l-9.288-5.31V8.855L.986 7.086v12.457z",
1173 fill: "url(#paint0_linear)"
1174});
1175
1176var _ref2$1 =
1177/*#__PURE__*/
1178React__default.createElement("path", {
1179 d: "M22.823 8.83l3.134-1.769L13.5 0 1.076 7.085 4.21 8.856l9.291-5.294 9.322 5.268z",
1180 fill: "url(#paint1_linear)"
1181});
1182
1183var _ref3$1 =
1184/*#__PURE__*/
1185React__default.createElement("path", {
1186 d: "M16.487 21.69l-3.075 1.741v3.126l3.075-1.765 3.076-1.766v-3.102l-3.076 1.766z",
1187 fill: "url(#paint2_linear)"
1188});
1189
1190var _ref4$1 =
1191/*#__PURE__*/
1192React__default.createElement("path", {
1193 d: "M25.838 23.052v3.069l3.013-1.793V21.25l-3.013-1.802V7.061L22.7 8.831v12.42l3.138 1.801z",
1194 fill: "url(#paint3_linear)"
1195});
1196
1197var _ref5$1 =
1198/*#__PURE__*/
1199React__default.createElement("defs", null, React__default.createElement("linearGradient", {
1200 id: "paint0_linear",
1201 x1: 1.258,
1202 y1: 13.461,
1203 x2: 13.449,
1204 y2: 20.421,
1205 gradientUnits: "userSpaceOnUse"
1206}, React__default.createElement("stop", {
1207 stopColor: "#BCBEC0"
1208}), React__default.createElement("stop", {
1209 offset: 1,
1210 stopColor: "#fff"
1211})), React__default.createElement("linearGradient", {
1212 id: "paint1_linear",
1213 x1: 1.076,
1214 y1: 4.428,
1215 x2: 22.256,
1216 y2: 4.428,
1217 gradientUnits: "userSpaceOnUse"
1218}, React__default.createElement("stop", {
1219 stopColor: "#BCBEC0"
1220}), React__default.createElement("stop", {
1221 offset: 1,
1222 stopColor: "#fff"
1223})), React__default.createElement("linearGradient", {
1224 id: "paint2_linear",
1225 x1: 18.858,
1226 y1: 21.911,
1227 x2: 14.624,
1228 y2: 24.291,
1229 gradientUnits: "userSpaceOnUse"
1230}, React__default.createElement("stop", {
1231 stopColor: "#BCBEC0"
1232}), React__default.createElement("stop", {
1233 offset: 1,
1234 stopColor: "#fff"
1235})), React__default.createElement("linearGradient", {
1236 id: "paint3_linear",
1237 x1: 25.775,
1238 y1: 8.035,
1239 x2: 25.775,
1240 y2: 24.901,
1241 gradientUnits: "userSpaceOnUse"
1242}, React__default.createElement("stop", {
1243 stopColor: "#BCBEC0"
1244}), React__default.createElement("stop", {
1245 offset: 1,
1246 stopColor: "#fff"
1247})));
1248
1249var QubeSymbol = 'data:image/svg+xml,%3Csvg%20width%3D%2229%22%20height%3D%2227%22%20viewBox%3D%220%200%2029%2027%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M0.98584%2019.5429L13.4121%2026.5611V23.4315L4.12378%2018.1202V8.8559L0.98584%207.08673V19.5429Z%22%20fill%3D%22url%28%23paint0_linear%29%22%2F%3E%3Cpath%20d%3D%22M22.8229%208.83018L25.9567%207.06101L13.5008%200L1.07617%207.0852L4.21022%208.856L13.501%203.56216L22.8229%208.83018Z%22%20fill%3D%22url%28%23paint1_linear%29%22%2F%3E%3Cpath%20d%3D%22M16.4873%2021.6901L13.4121%2023.4315V26.557L16.4873%2024.7924L19.5625%2023.026V19.9238L16.4873%2021.6901Z%22%20fill%3D%22url%28%23paint2_linear%29%22%2F%3E%3Cpath%20d%3D%22M25.8381%2023.0521V26.1209L28.8506%2024.3282V21.2501L25.8381%2019.448V7.06097L22.7002%208.83014V21.2501L25.8381%2023.0521Z%22%20fill%3D%22url%28%23paint3_linear%29%22%2F%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22paint0_linear%22%20x1%3D%221.2581%22%20y1%3D%2213.4608%22%20x2%3D%2213.4488%22%20y2%3D%2220.421%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23BCBEC0%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22white%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint1_linear%22%20x1%3D%221.07617%22%20y1%3D%224.42799%22%20x2%3D%2222.2555%22%20y2%3D%224.42799%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23BCBEC0%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22white%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint2_linear%22%20x1%3D%2218.858%22%20y1%3D%2221.9109%22%20x2%3D%2214.6244%22%20y2%3D%2224.2912%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23BCBEC0%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22white%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint3_linear%22%20x1%3D%2225.7754%22%20y1%3D%228.03516%22%20x2%3D%2225.7754%22%20y2%3D%2224.9005%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23BCBEC0%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22white%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3C%2Fsvg%3E';
1250
1251function _templateObject7() {
1252 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\n\theight: 40px;\n\talign-items: center;\n\tpadding-left: 16px;\n\n\tbackground: ", ";\n\tborder-radius: 4px;\n\tcolor: ", ";\n\tcursor: pointer;\n\ttext-decoration: none;\n\n\t&:hover {\n\t\tbackground: ", ";\n\t\tcolor: ", ";\n\t}\n\n\t&:active,\n\t&:focus {\n\t\tcolor: ", ";\n\t}\n"]);
1253
1254 _templateObject7 = function _templateObject7() {
1255 return data;
1256 };
1257
1258 return data;
1259}
1260
1261function _templateObject6() {
1262 var data = taggedTemplateLiteralLoose(["\n\tz-index: 2;\n\n\tmargin-top: 32px;\n"]);
1263
1264 _templateObject6 = function _templateObject6() {
1265 return data;
1266 };
1267
1268 return data;
1269}
1270
1271function _templateObject5() {
1272 var data = taggedTemplateLiteralLoose(["\n\tz-index: 2;\n\tmargin-top: 6px;\n\tcolor: ", ";\n\tfont-size: 16px;\n"]);
1273
1274 _templateObject5 = function _templateObject5() {
1275 return data;
1276 };
1277
1278 return data;
1279}
1280
1281function _templateObject4() {
1282 var data = taggedTemplateLiteralLoose(["\n\t&&&.small.icon {\n\t\tcolor: ", " !important;\n\t\tfont-size: 18px !important;\n\t}\n"]);
1283
1284 _templateObject4 = function _templateObject4() {
1285 return data;
1286 };
1287
1288 return data;
1289}
1290
1291function _templateObject3$1() {
1292 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\n\tpadding-top: 28px;\n\tpadding-left: 16px;\n"]);
1293
1294 _templateObject3$1 = function _templateObject3() {
1295 return data;
1296 };
1297
1298 return data;
1299}
1300
1301function _templateObject2$3() {
1302 var data = taggedTemplateLiteralLoose(["\n\twidth: 100%;\n"]);
1303
1304 _templateObject2$3 = function _templateObject2() {
1305 return data;
1306 };
1307
1308 return data;
1309}
1310
1311function _templateObject$d() {
1312 var data = taggedTemplateLiteralLoose(["\n\tz-index: 2;\n\tdisplay: ", ";\n\n\twidth: 100%;\n\theight: 100%;\n\tmin-height: 664px;\n\tpadding: 12px;\n\n\tbackground: ", ";\n\tbox-shadow: 2px 0px 2px rgba(0, 0, 0, 0.08);\n\tuser-select: none;\n"]);
1313
1314 _templateObject$d = function _templateObject() {
1315 return data;
1316 };
1317
1318 return data;
1319}
1320
1321var SubNav = function SubNav(_ref) {
1322 var collapse = _ref.collapse,
1323 _ref$activeItem = _ref.activeItem,
1324 items = _ref$activeItem.items,
1325 icon = _ref$activeItem.icon,
1326 title = _ref$activeItem.title,
1327 isActive = _ref.isActive,
1328 setRoute = _ref.setRoute,
1329 subNavBgColor = _ref.subNavBgColor,
1330 subNavColor = _ref.subNavColor,
1331 subNavColorTitle = _ref.subNavColorTitle,
1332 subNavHoverBgColor = _ref.subNavHoverBgColor,
1333 subNavHoverColor = _ref.subNavHoverColor,
1334 subNavHighlightBgColor = _ref.subNavHighlightBgColor,
1335 subNavHighlightColor = _ref.subNavHighlightColor;
1336
1337 var _onClick = function onClick(_ref2) {
1338 var onClickItem = _ref2.onClickItem,
1339 path = _ref2.path;
1340 return onClickItem ? onClickItem(path) : setRoute(path);
1341 };
1342
1343 return React__default.createElement(SubNavStyled, {
1344 collapse: collapse,
1345 bgColor: subNavBgColor,
1346 "data-test-id": "submenu"
1347 }, React__default.createElement(Header, null, React__default.createElement(FullWidth, null, icon && React__default.createElement(HeaderIcon, {
1348 icon: icon,
1349 size: "small",
1350 collapse: collapse,
1351 color: subNavColorTitle,
1352 "data-test-id": "submenu-icon"
1353 })), React__default.createElement(Title, {
1354 color: subNavColorTitle,
1355 "data-test-id": "submenu-title"
1356 }, title)), React__default.createElement(SubNavList, null, items.map(function (item) {
1357 return React__default.createElement(SubNavLink, {
1358 key: item.id,
1359 active: isActive(item),
1360 onClick: function onClick() {
1361 return _onClick(item);
1362 },
1363 bgColor: subNavBgColor,
1364 color: subNavColor,
1365 hoverBgColor: subNavHoverBgColor,
1366 hoverColor: subNavHoverColor,
1367 subNavHighlightBgColor: subNavHighlightBgColor,
1368 highlightColor: subNavHighlightColor
1369 }, item.title);
1370 })));
1371};
1372
1373var SubNavStyled = styled__default.div(_templateObject$d(), function (_ref3) {
1374 var collapse = _ref3.collapse;
1375 return collapse ? 'block' : 'none';
1376}, function (_ref4) {
1377 var bgColor = _ref4.bgColor;
1378 return bgColor;
1379});
1380var FullWidth = styled__default.div(_templateObject2$3());
1381var Header = styled__default.div(_templateObject3$1());
1382var HeaderIcon = styled__default(function (_ref5) {
1383 var collapse = _ref5.collapse,
1384 props = objectWithoutPropertiesLoose(_ref5, ["collapse"]);
1385
1386 return React__default.createElement(Icon, props);
1387})(_templateObject4(), function (_ref6) {
1388 var color = _ref6.color;
1389 return color;
1390});
1391HeaderIcon.displayName = 'HeaderIcon';
1392var Title = styled__default.div(_templateObject5(), function (_ref7) {
1393 var color = _ref7.color;
1394 return color;
1395});
1396var SubNavList = styled__default.div(_templateObject6());
1397var SubNavLink = styled__default.a(_templateObject7(), function (_ref8) {
1398 var active = _ref8.active,
1399 hoverBgColor = _ref8.hoverBgColor,
1400 bgColor = _ref8.bgColor;
1401 return active ? hoverBgColor : bgColor;
1402}, function (_ref9) {
1403 var active = _ref9.active,
1404 highlightColor = _ref9.highlightColor,
1405 color = _ref9.color;
1406 return active ? highlightColor : color;
1407}, function (_ref10) {
1408 var hoverBgColor = _ref10.hoverBgColor;
1409 return hoverBgColor;
1410}, function (_ref11) {
1411 var hoverColor = _ref11.hoverColor;
1412 return hoverColor;
1413}, function (_ref12) {
1414 var highlightColor = _ref12.highlightColor;
1415 return highlightColor;
1416});
1417SubNavLink.displayName = 'SubNavLink';
1418SubNav.propTypes = {
1419 setRoute: PropTypes.func.isRequired,
1420 collapse: PropTypes.bool.isRequired,
1421 isActive: PropTypes.func.isRequired,
1422 activeItem: PropTypes.shape({
1423 title: PropTypes.string,
1424 items: PropTypes.arrayOf(PropTypes.shape({
1425 icon: PropTypes.string,
1426 title: PropTypes.string,
1427 path: PropTypes.string,
1428 items: PropTypes.arrayOf(PropTypes.shape({
1429 title: PropTypes.string,
1430 path: PropTypes.string
1431 }))
1432 }))
1433 }).isRequired,
1434 subNavBgColor: PropTypes.string.isRequired,
1435 subNavColor: PropTypes.string.isRequired,
1436 subNavColorTitle: PropTypes.string.isRequired,
1437 subNavHoverBgColor: PropTypes.string.isRequired,
1438 subNavHoverColor: PropTypes.string.isRequired,
1439 subNavHighlightBgColor: PropTypes.string.isRequired,
1440 subNavHighlightColor: PropTypes.string.isRequired
1441};
1442SubNav.displayName = 'SubNav';
1443
1444function _templateObject6$1() {
1445 var data = taggedTemplateLiteralLoose(["\n\tdisplay: none !important;\n\tmargin-left: 8px !important;\n\n\t&&&.icon.arrow {\n\t\tcolor: ", " !important;\n\t}\n"]);
1446
1447 _templateObject6$1 = function _templateObject6() {
1448 return data;
1449 };
1450
1451 return data;
1452}
1453
1454function _templateObject5$1() {
1455 var data = taggedTemplateLiteralLoose(["\n\tdisplay: ", ";\n"]);
1456
1457 _templateObject5$1 = function _templateObject5() {
1458 return data;
1459 };
1460
1461 return data;
1462}
1463
1464function _templateObject4$1() {
1465 var data = taggedTemplateLiteralLoose(["\n\tmargin: ", " !important;\n\n\t&&&.small.icon {\n\t\twidth: ", " !important;\n\t\tfont-size: 15px;\n\t}\n"]);
1466
1467 _templateObject4$1 = function _templateObject4() {
1468 return data;
1469 };
1470
1471 return data;
1472}
1473
1474function _templateObject3$2() {
1475 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\talign-items: center;\n\tjustify-content: ", ";\n\n\tcolor: white;\n\tfont-size: 15px;\n"]);
1476
1477 _templateObject3$2 = function _templateObject3() {
1478 return data;
1479 };
1480
1481 return data;
1482}
1483
1484function _templateObject2$4() {
1485 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: baseline;\n\tjustify-content: center;\n"]);
1486
1487 _templateObject2$4 = function _templateObject2() {
1488 return data;
1489 };
1490
1491 return data;
1492}
1493
1494function _templateObject$e() {
1495 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\theight: 46px;\n\tjustify-content: ", ";\n\tpadding: ", ";\n\n\tbackground: ", ";\n\tcursor: pointer;\n\ttext-decoration: none;\n\tuser-select: none;\n\n\tp {\n\t\tcolor: ", " !important;\n\t}\n\n\t.small.icon {\n\t\tcolor: ", " !important;\n\t}\n\n\t:hover {\n\t\tbackground: ", ";\n\n\t\tp {\n\t\t\tcolor: ", " !important;\n\t\t}\n\n\t\t.small.icon {\n\t\t\tcolor: ", " !important;\n\t\t}\n\n\t\t.arrow {\n\t\t\tdisplay: ", " !important;\n\t\t}\n\t}\n"]);
1496
1497 _templateObject$e = function _templateObject() {
1498 return data;
1499 };
1500
1501 return data;
1502}
1503
1504var SideNavLink = function SideNavLink(_ref) {
1505 var collapse = _ref.collapse,
1506 item = _ref.item,
1507 isActive = _ref.isActive,
1508 _onClick = _ref.onClick,
1509 color = _ref.color,
1510 highlightColor = _ref.highlightColor,
1511 highlightBgColor = _ref.highlightBgColor,
1512 hoverBgColor = _ref.hoverBgColor,
1513 hoverColor = _ref.hoverColor;
1514 return React__default.createElement(SideNavLinkStyled, {
1515 collapse: collapse,
1516 active: isActive(item),
1517 onClick: function onClick() {
1518 return _onClick(item);
1519 },
1520 color: color,
1521 highlightBgColor: highlightBgColor,
1522 highlightColor: highlightColor,
1523 hoverBgColor: hoverBgColor,
1524 hoverColor: hoverColor
1525 }, React__default.createElement(SideNavLinkWrapper, {
1526 collapse: collapse
1527 }, React__default.createElement(Flex, null, item.icon && React__default.createElement(SideNavLinkIcon, {
1528 icon: item.icon,
1529 color: color,
1530 size: "small",
1531 collapse: collapse
1532 }), item.title && React__default.createElement(SideNavLinkText, {
1533 collapse: collapse
1534 }, item.title)), React__default.createElement(SideNavLinkArrow, {
1535 className: "arrow",
1536 icon: "arrow-right",
1537 color: hoverColor
1538 })));
1539};
1540
1541var SideNavLinkStyled = styled__default.div(_templateObject$e(), function (_ref2) {
1542 var collapse = _ref2.collapse;
1543 return collapse ? 'center' : 'start';
1544}, function (_ref3) {
1545 var collapse = _ref3.collapse;
1546 return collapse ? '0 4px' : '0 32px';
1547}, function (_ref4) {
1548 var active = _ref4.active,
1549 highlightBgColor = _ref4.highlightBgColor;
1550 return active ? highlightBgColor : undefined;
1551}, function (_ref5) {
1552 var active = _ref5.active,
1553 highlightColor = _ref5.highlightColor,
1554 color = _ref5.color;
1555 return active ? highlightColor : color;
1556}, function (_ref6) {
1557 var highlightColor = _ref6.highlightColor,
1558 active = _ref6.active;
1559 return active ? highlightColor : undefined;
1560}, function (_ref7) {
1561 var hoverBgColor = _ref7.hoverBgColor,
1562 highlightBgColor = _ref7.highlightBgColor,
1563 collapse = _ref7.collapse;
1564 return collapse ? highlightBgColor : hoverBgColor;
1565}, function (_ref8) {
1566 var hoverColor = _ref8.hoverColor;
1567 return hoverColor;
1568}, function (_ref9) {
1569 var highlightColor = _ref9.highlightColor,
1570 hoverColor = _ref9.hoverColor,
1571 collapse = _ref9.collapse;
1572 return collapse ? highlightColor : hoverColor;
1573}, function (_ref10) {
1574 var collapse = _ref10.collapse;
1575 return collapse ? 'none' : 'block';
1576});
1577SideNavLinkStyled.displayName = 'SideNavLinkStyled';
1578var Flex = styled__default.div(_templateObject2$4());
1579var SideNavLinkWrapper = styled__default.div(_templateObject3$2(), function (_ref11) {
1580 var collapse = _ref11.collapse;
1581 return collapse ? 'center' : 'space-between';
1582});
1583var SideNavLinkIcon = styled__default(function (_ref12) {
1584 var collapse = _ref12.collapse,
1585 props = objectWithoutPropertiesLoose(_ref12, ["collapse"]);
1586
1587 return React__default.createElement(Icon, props);
1588})(_templateObject4$1(), function (_ref13) {
1589 var collapse = _ref13.collapse;
1590 return collapse ? ' auto' : '0 20px 0 0';
1591}, function (_ref14) {
1592 var collapse = _ref14.collapse;
1593 return collapse ? ' 100%' : null;
1594});
1595var SideNavLinkText = styled__default.p(_templateObject5$1(), function (_ref15) {
1596 var collapse = _ref15.collapse;
1597 return collapse ? 'none' : 'inline-block';
1598});
1599var SideNavLinkArrow = styled__default(Icon)(_templateObject6$1(), function (_ref16) {
1600 var color = _ref16.color;
1601 return color;
1602});
1603SideNavLink.propTypes = {
1604 item: PropTypes.shape({
1605 id: PropTypes.string,
1606 icon: PropTypes.string,
1607 title: PropTypes.string,
1608 path: PropTypes.string,
1609 items: PropTypes.arrayOf(PropTypes.shape({
1610 title: PropTypes.string,
1611 path: PropTypes.string
1612 }))
1613 }).isRequired,
1614 isActive: PropTypes.func.isRequired,
1615 onClick: PropTypes.func.isRequired,
1616 collapse: PropTypes.bool.isRequired,
1617 color: PropTypes.string.isRequired,
1618 hoverBgColor: PropTypes.string.isRequired,
1619 hoverColor: PropTypes.string.isRequired,
1620 highlightBgColor: PropTypes.string.isRequired,
1621 highlightColor: PropTypes.string.isRequired
1622};
1623SideNavLink.displayName = 'SideNavLink';
1624
1625function _templateObject2$5() {
1626 var data = taggedTemplateLiteralLoose(["\n\tdisplay: ", ";\n\theight: 36px;\n\tpadding: ", ";\n\n\tcolor: ", ";\n\tfont-size: ", ";\n\ttext-align: ", ";\n\ttext-transform: uppercase;\n\n\ttransition: ", ";\n"]);
1627
1628 _templateObject2$5 = function _templateObject2() {
1629 return data;
1630 };
1631
1632 return data;
1633}
1634
1635function _templateObject$f() {
1636 var data = taggedTemplateLiteralLoose(["\n\tpadding-left: 0px;\n"]);
1637
1638 _templateObject$f = function _templateObject() {
1639 return data;
1640 };
1641
1642 return data;
1643}
1644
1645var SideNavSection = function SideNavSection(_ref) {
1646 var collapse = _ref.collapse,
1647 _ref$section = _ref.section,
1648 items = _ref$section.items,
1649 title = _ref$section.title,
1650 isActive = _ref.isActive,
1651 setRoute = _ref.setRoute,
1652 colorTitle = _ref.colorTitle,
1653 color = _ref.color,
1654 hoverBgColor = _ref.hoverBgColor,
1655 hoverColor = _ref.hoverColor,
1656 highlightBgColor = _ref.highlightBgColor,
1657 highlightColor = _ref.highlightColor;
1658
1659 var _onClick = function onClick(_ref2) {
1660 var onClickItem = _ref2.onClickItem,
1661 path = _ref2.path;
1662 return onClickItem ? onClickItem(path) : setRoute(path);
1663 };
1664
1665 return React__default.createElement("section", null, React__default.createElement(SideNavSectionStyled, null, React__default.createElement(SideNavSectionTitle, {
1666 show: !!title,
1667 collapse: collapse,
1668 color: colorTitle
1669 }, title), items.map(function (item) {
1670 return item.render ? collapse ? item.render.collapsed : item.render.expanded : React__default.createElement(SideNavLink, {
1671 key: item.id,
1672 item: item,
1673 collapse: collapse,
1674 onClick: function onClick() {
1675 return _onClick(item);
1676 },
1677 isActive: isActive,
1678 color: color,
1679 highlightColor: highlightColor,
1680 highlightBgColor: highlightBgColor,
1681 hoverBgColor: hoverBgColor,
1682 hoverColor: hoverColor
1683 });
1684 })));
1685};
1686
1687var SideNavSectionStyled = styled__default.div(_templateObject$f());
1688var SideNavSectionTitle = styled__default.div(_templateObject2$5(), function (_ref3) {
1689 var show = _ref3.show;
1690 return show ? 'block' : 'none';
1691}, function (_ref4) {
1692 var collapse = _ref4.collapse;
1693 return collapse ? '0' : '0 32px;';
1694}, function (_ref5) {
1695 var color = _ref5.color;
1696 return color;
1697}, function (_ref6) {
1698 var collapse = _ref6.collapse;
1699 return collapse ? '11px' : '15px';
1700}, function (_ref7) {
1701 var collapse = _ref7.collapse;
1702 return collapse ? 'center' : 'left';
1703}, function (_ref8) {
1704 var collapse = _ref8.collapse;
1705 return collapse ? '0' : '0.3s';
1706});
1707SideNavSection.propTypes = {
1708 setRoute: PropTypes.func.isRequired,
1709 isActive: PropTypes.func.isRequired,
1710 collapse: PropTypes.bool.isRequired,
1711 section: PropTypes.shape({
1712 title: PropTypes.string,
1713 items: PropTypes.arrayOf(PropTypes.shape({
1714 render: PropTypes.shape({
1715 collapsed: PropTypes.element.isRequired,
1716 expanded: PropTypes.element.isRequired
1717 }),
1718 icon: PropTypes.string,
1719 title: PropTypes.string,
1720 path: PropTypes.string,
1721 items: PropTypes.arrayOf(PropTypes.shape({
1722 title: PropTypes.string,
1723 path: PropTypes.string
1724 }))
1725 }))
1726 }).isRequired,
1727 color: PropTypes.string.isRequired,
1728 colorTitle: PropTypes.string.isRequired,
1729 hoverBgColor: PropTypes.string.isRequired,
1730 hoverColor: PropTypes.string.isRequired,
1731 highlightBgColor: PropTypes.string.isRequired,
1732 highlightColor: PropTypes.string.isRequired
1733};
1734SideNavSection.displayName = 'SideNavSection';
1735
1736function _templateObject12() {
1737 var data = taggedTemplateLiteralLoose(["\n\tcursor: pointer;\n\tfont-size: 17px !important;\n"]);
1738
1739 _templateObject12 = function _templateObject12() {
1740 return data;
1741 };
1742
1743 return data;
1744}
1745
1746function _templateObject11() {
1747 var data = taggedTemplateLiteralLoose(["\n\tpadding: 10px 0;\n"]);
1748
1749 _templateObject11 = function _templateObject11() {
1750 return data;
1751 };
1752
1753 return data;
1754}
1755
1756function _templateObject10() {
1757 var data = taggedTemplateLiteralLoose(["\n\tposition: absolute;\n\tbottom: 10px;\n\tleft: ", " !important;\n"]);
1758
1759 _templateObject10 = function _templateObject10() {
1760 return data;
1761 };
1762
1763 return data;
1764}
1765
1766function _templateObject9() {
1767 var data = taggedTemplateLiteralLoose(["\n\tdisplay: ", ";\n\twidth: 100%;\n\tjustify-content: center;\n\tmargin: auto;\n\tcursor: pointer;\n\n\timg {\n\t\tmax-width: 154px;\n\t}\n"]);
1768
1769 _templateObject9 = function _templateObject9() {
1770 return data;
1771 };
1772
1773 return data;
1774}
1775
1776function _templateObject8() {
1777 var data = taggedTemplateLiteralLoose(["\n\tdisplay: ", ";\n\tmargin: auto;\n\tcursor: pointer;\n\n\timg {\n\t\tmin-width: 24px;\n\t\tmax-width: 32px;\n\t}\n"]);
1778
1779 _templateObject8 = function _templateObject8() {
1780 return data;
1781 };
1782
1783 return data;
1784}
1785
1786function _templateObject7$1() {
1787 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\theight: 38px;\n\n\tjustify-content: center;\n\n\tmargin-top: 12px;\n\tmargin-bottom: 32px;\n"]);
1788
1789 _templateObject7$1 = function _templateObject7() {
1790 return data;
1791 };
1792
1793 return data;
1794}
1795
1796function _templateObject6$2() {
1797 var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tz-index: 3;\n\n\twidth: ", ";\n\theight: 100%;\n\tmin-height: 664px;\n\tflex-direction: column;\n\talign-items: center;\n\tjustify-content: center;\n\tpadding: 32px 0;\n\n\tbackground: ", ";\n\tbox-shadow: ", ";\n\ttransition: width 260ms cubic-bezier(0.2, 0, 0, 1) 0s;\n"]);
1798
1799 _templateObject6$2 = function _templateObject6() {
1800 return data;
1801 };
1802
1803 return data;
1804}
1805
1806function _templateObject5$2() {
1807 var data = taggedTemplateLiteralLoose(["\n\tz-index: 2;\n\tdisplay: flex;\n\theight: 100%;\n"]);
1808
1809 _templateObject5$2 = function _templateObject5() {
1810 return data;
1811 };
1812
1813 return data;
1814}
1815
1816function _templateObject4$2() {
1817 var data = taggedTemplateLiteralLoose(["\n\tdisplay: ", ";\n\n\twidth: ", ";\n\tmargin: auto;\n\tborder: 1px solid ", ";\n"]);
1818
1819 _templateObject4$2 = function _templateObject4() {
1820 return data;
1821 };
1822
1823 return data;
1824}
1825
1826function _templateObject3$3() {
1827 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\theight: 60px;\n\tflex-direction: column;\n"]);
1828
1829 _templateObject3$3 = function _templateObject3() {
1830 return data;
1831 };
1832
1833 return data;
1834}
1835
1836function _templateObject2$6() {
1837 var data = taggedTemplateLiteralLoose(["\n\tcolor: black;\n"]);
1838
1839 _templateObject2$6 = function _templateObject2() {
1840 return data;
1841 };
1842
1843 return data;
1844}
1845
1846function _templateObject$g() {
1847 var data = taggedTemplateLiteralLoose(["\n\tposition: absolute;\n\tright: -12px;\n\tdisplay: flex;\n\twidth: 30px;\n\theight: 30px;\n\n\talign-items: center;\n\tjustify-content: center;\n\tborder: 1px solid #dddddd;\n\n\tbackground: #ffffff;\n\tborder-radius: 50%;\n\tbox-shadow: 0px 1px 4px rgba(0, 0, 0, 0.25);\n\n\tcursor: pointer;\n"]);
1848
1849 _templateObject$g = function _templateObject() {
1850 return data;
1851 };
1852
1853 return data;
1854}
1855
1856var SideNav =
1857/*#__PURE__*/
1858function (_Component) {
1859 inheritsLoose(SideNav, _Component);
1860
1861 function SideNav(props) {
1862 var _this;
1863
1864 _this = _Component.call(this, props) || this;
1865
1866 defineProperty(assertThisInitialized(_this), "onMouseEnter", function () {
1867 _this.timeout = setTimeout(function () {
1868 return _this.setState({
1869 onHover: true
1870 });
1871 }, 350);
1872 });
1873
1874 defineProperty(assertThisInitialized(_this), "onMouseLeave", function () {
1875 clearTimeout(_this.timeout);
1876
1877 _this.setState({
1878 onHover: false
1879 });
1880 });
1881
1882 defineProperty(assertThisInitialized(_this), "getActiveItem", function (_ref) {
1883 var items = _ref.items;
1884 return items.find(function (item) {
1885 return _this.isActive(item) || item.items && _this.getActiveItem(item);
1886 });
1887 });
1888
1889 defineProperty(assertThisInitialized(_this), "isActive", function (item) {
1890 var _this$props = _this.props,
1891 matchPath = _this$props.matchPath,
1892 location = _this$props.location;
1893 var params = item.matchPath ? {
1894 path: item.matchPath,
1895 exact: false
1896 } : item.path;
1897 var match = matchPath(location, params);
1898 return match && (match.isExact || item.matchPath);
1899 });
1900
1901 defineProperty(assertThisInitialized(_this), "activeSection", function () {
1902 var nav = _this.props.nav;
1903 return nav.find(function (section) {
1904 return _this.getActiveItem(section);
1905 });
1906 });
1907
1908 defineProperty(assertThisInitialized(_this), "activeItem", function () {
1909 var activeSection = _this.activeSection();
1910
1911 return activeSection && _this.getActiveItem(activeSection);
1912 });
1913
1914 defineProperty(assertThisInitialized(_this), "activeItemHasSubNav", function () {
1915 return _this.activeItem() && _this.activeItem().items;
1916 });
1917
1918 defineProperty(assertThisInitialized(_this), "isCollapsed", function () {
1919 var onHover = _this.state.onHover;
1920 return _this.activeSection() !== undefined && _this.activeItemHasSubNav() !== undefined && !onHover;
1921 });
1922
1923 defineProperty(assertThisInitialized(_this), "notLastElement", function (index) {
1924 var nav = _this.props.nav;
1925 return index !== nav.length - 1;
1926 });
1927
1928 defineProperty(assertThisInitialized(_this), "renderCollapseToggle", function (isToggleCollapsed, setToggleCollapsed) {
1929 return React__default.createElement(CollapseToggle, {
1930 onClick: function onClick() {
1931 return setToggleCollapsed(!isToggleCollapsed);
1932 }
1933 }, React__default.createElement(ToggleIcon, {
1934 icon: !isToggleCollapsed ? 'select-left' : 'select-right',
1935 color: theme.colors.darkGray
1936 }));
1937 });
1938
1939 _this.state = {
1940 onHover: false
1941 };
1942 return _this;
1943 }
1944
1945 var _proto = SideNav.prototype;
1946
1947 _proto.render = function render() {
1948 var _this2 = this;
1949
1950 var _this$props2 = this.props,
1951 nav = _this$props2.nav,
1952 _setRoute = _this$props2.setRoute,
1953 customActions = _this$props2.customActions,
1954 logo = _this$props2.logo,
1955 symbol = _this$props2.symbol,
1956 bgColor = _this$props2.bgColor,
1957 dividerColor = _this$props2.dividerColor,
1958 color = _this$props2.color,
1959 hoverBgColor = _this$props2.hoverBgColor,
1960 hoverColor = _this$props2.hoverColor,
1961 highlightColor = _this$props2.highlightColor,
1962 highlightBgColor = _this$props2.highlightBgColor,
1963 colorTitle = _this$props2.colorTitle,
1964 subNavBgColor = _this$props2.subNavBgColor,
1965 subNavColor = _this$props2.subNavColor,
1966 subNavColorTitle = _this$props2.subNavColorTitle,
1967 subNavHoverBgColor = _this$props2.subNavHoverBgColor,
1968 subNavHoverColor = _this$props2.subNavHoverColor,
1969 subNavHighlightBgColor = _this$props2.subNavHighlightBgColor,
1970 subNavHighlightColor = _this$props2.subNavHighlightColor,
1971 customIconColor = _this$props2.customIconColor,
1972 setToggleCollapsed = _this$props2.setToggleCollapsed,
1973 isToggleCollapsed = _this$props2.isToggleCollapsed;
1974 var collapse = this.isCollapsed();
1975 return React__default.createElement(SideNavStyled, {
1976 id: "menu"
1977 }, React__default.createElement(Nav, {
1978 isToggleCollapsed: isToggleCollapsed,
1979 collapse: collapse,
1980 onMouseEnter: this.onMouseEnter,
1981 onMouseLeave: this.onMouseLeave,
1982 bgColor: bgColor
1983 }, setToggleCollapsed && this.renderCollapseToggle(isToggleCollapsed, setToggleCollapsed), !isToggleCollapsed && React__default.createElement("div", null, React__default.createElement(LogoContainer, null, React__default.createElement(Logo, {
1984 collapse: collapse,
1985 onClick: function onClick() {
1986 return _setRoute('/');
1987 }
1988 }, React__default.createElement("img", {
1989 src: logo,
1990 "data-test-id": "menu-logo",
1991 draggable: "false",
1992 alt: "logo"
1993 })), React__default.createElement(LogoIcon, {
1994 collapse: collapse,
1995 onClick: function onClick() {
1996 return _setRoute('/');
1997 }
1998 }, React__default.createElement("img", {
1999 src: symbol,
2000 "data-test-id": "menu-small-logo",
2001 draggable: "false",
2002 alt: "small logo"
2003 }))), nav.map(function (section, index) {
2004 return React__default.createElement("div", {
2005 key: section.id
2006 }, React__default.createElement(SideNavSection, {
2007 section: section,
2008 collapse: collapse,
2009 isActive: _this2.isActive,
2010 setRoute: function setRoute(route) {
2011 _this2.onMouseLeave();
2012
2013 _setRoute(route);
2014 },
2015 hoverBgColor: hoverBgColor,
2016 hoverColor: hoverColor,
2017 color: color,
2018 colorTitle: colorTitle,
2019 highlightBgColor: highlightBgColor,
2020 highlightColor: highlightColor
2021 }), React__default.createElement(DividerContainer, null, React__default.createElement(Divider, {
2022 color: dividerColor,
2023 collapse: collapse,
2024 show: _this2.notLastElement(index)
2025 })));
2026 }), React__default.createElement(CustomIconList, {
2027 collapse: collapse
2028 }, customActions.map(function (_ref2) {
2029 var icon = _ref2.icon,
2030 onClick = _ref2.onClick;
2031 return React__default.createElement(CustomIconRow, {
2032 key: icon
2033 }, React__default.createElement(CustomIcon, {
2034 icon: icon,
2035 color: customIconColor,
2036 size: "small",
2037 onClick: onClick
2038 }));
2039 })))), this.activeItem() && this.activeItem().items && React__default.createElement(SubNav, {
2040 collapse: collapse,
2041 activeItem: this.activeItem(),
2042 isActive: function isActive(item) {
2043 return _this2.isActive(item);
2044 },
2045 setRoute: _setRoute,
2046 subNavBgColor: subNavBgColor,
2047 subNavColor: subNavColor,
2048 subNavColorTitle: subNavColorTitle,
2049 subNavHoverBgColor: subNavHoverBgColor,
2050 subNavHoverColor: subNavHoverColor,
2051 subNavHighlightBgColor: subNavHighlightBgColor,
2052 subNavHighlightColor: subNavHighlightColor
2053 }));
2054 };
2055
2056 return SideNav;
2057}(React.Component);
2058
2059var CollapseToggle = styled__default.div(_templateObject$g());
2060CollapseToggle.displayName = 'CollapseToggle';
2061var ToggleIcon = styled__default(Icon)(_templateObject2$6());
2062var DividerContainer = styled__default.div(_templateObject3$3());
2063var Divider = styled__default.div(_templateObject4$2(), function (_ref3) {
2064 var show = _ref3.show;
2065 return show ? 'block' : 'none';
2066}, function (_ref4) {
2067 var collapse = _ref4.collapse;
2068 return collapse ? '56px' : '75%';
2069}, function (_ref5) {
2070 var color = _ref5.color;
2071 return color;
2072});
2073var SideNavStyled = styled__default.div(_templateObject5$2());
2074var Nav = styled__default.div(_templateObject6$2(), function (_ref6) {
2075 var collapse = _ref6.collapse,
2076 isToggleCollapsed = _ref6.isToggleCollapsed;
2077 return collapse ? '56px' : isToggleCollapsed ? '20px' : '100%';
2078}, function (_ref7) {
2079 var bgColor = _ref7.bgColor;
2080 return bgColor;
2081}, function (_ref8) {
2082 var collapse = _ref8.collapse;
2083 return collapse ? 'none' : ' 2px 0px 2px rgba(0, 0, 0, 0.08)';
2084});
2085Nav.displayName = 'Nav';
2086var LogoContainer = styled__default.div(_templateObject7$1());
2087var LogoIcon = styled__default.div(_templateObject8(), function (_ref9) {
2088 var collapse = _ref9.collapse;
2089 return collapse ? 'block' : 'none';
2090});
2091LogoIcon.displayName = 'LogoIcon';
2092var Logo = styled__default.div(_templateObject9(), function (_ref10) {
2093 var collapse = _ref10.collapse;
2094 return collapse ? 'none' : 'flex';
2095});
2096Logo.displayName = 'Logo';
2097var CustomIconList = styled__default.div(_templateObject10(), function (_ref11) {
2098 var collapse = _ref11.collapse;
2099 return collapse ? '18px' : '32px';
2100});
2101var CustomIconRow = styled__default.div(_templateObject11());
2102var CustomIcon = styled__default(function (_ref12) {
2103 var collapse = _ref12.collapse,
2104 props = objectWithoutPropertiesLoose(_ref12, ["collapse"]);
2105
2106 return React__default.createElement(Icon, props);
2107})(_templateObject12());
2108CustomIcon.displayName = 'CustomIcon';
2109SideNav.defaultProps = {
2110 logo: QubeLogo,
2111 symbol: QubeSymbol,
2112 bgColor: theme.colors.deepBlue,
2113 colorTitle: theme.colors.white,
2114 color: theme.colors.white,
2115 hoverBgColor: theme.colors.activeBlue,
2116 hoverColor: theme.colors.white,
2117 highlightBgColor: theme.colors.white,
2118 highlightColor: theme.colors.deepBlue,
2119 dividerColor: theme.colors.white,
2120 subNavBgColor: theme.colors.white,
2121 subNavColor: theme.colors.black,
2122 subNavColorTitle: theme.colors.deepBlue,
2123 subNavHoverBgColor: theme.colors.lightGray,
2124 subNavHoverColor: theme.colors.activeBlue,
2125 subNavHighlightBgColor: theme.colors.lightGray,
2126 subNavHighlightColor: theme.colors.deepBlue,
2127 customIconColor: theme.colors.white,
2128 customActions: [],
2129 isToggleCollapsed: false,
2130 setToggleCollapsed: undefined
2131};
2132SideNav.propTypes = {
2133 setRoute: PropTypes.func.isRequired,
2134 location: PropTypes.string.isRequired,
2135 matchPath: PropTypes.func.isRequired,
2136 customActions: PropTypes.arrayOf(PropTypes.shape({
2137 icon: PropTypes.string.isRequired,
2138 onClick: PropTypes.func.isRequired
2139 })),
2140 nav: PropTypes.arrayOf(PropTypes.shape({
2141 title: PropTypes.string,
2142 items: PropTypes.arrayOf(PropTypes.shape({
2143 icon: PropTypes.string,
2144 title: PropTypes.string,
2145 path: PropTypes.string,
2146 items: PropTypes.arrayOf(PropTypes.shape({
2147 title: PropTypes.string,
2148 path: PropTypes.string
2149 }))
2150 }))
2151 })).isRequired,
2152
2153 /* Custom logo image */
2154 logo: PropTypes.string,
2155
2156 /* Custom symbol image */
2157 symbol: PropTypes.string,
2158
2159 /* Background color of SideNav */
2160 bgColor: PropTypes.string,
2161
2162 /* Font color of SideNav */
2163 color: PropTypes.string,
2164
2165 /* Section title color of SideNav */
2166 colorTitle: PropTypes.string,
2167
2168 /* When Hover background color of SideNav */
2169 hoverBgColor: PropTypes.string,
2170
2171 /* When Hover font color of SideNav */
2172 hoverColor: PropTypes.string,
2173
2174 /* when active background color of SideNav */
2175 highlightBgColor: PropTypes.string,
2176
2177 /* when active font color of SideNav */
2178 highlightColor: PropTypes.string,
2179
2180 /* Divider color of SideNav */
2181 dividerColor: PropTypes.string,
2182
2183 /* Background color of SubNav */
2184 subNavBgColor: PropTypes.string,
2185
2186 /* font color of SubNav */
2187 subNavColor: PropTypes.string,
2188
2189 /* title color of SubNav */
2190 subNavColorTitle: PropTypes.string,
2191
2192 /* When Hover background color of SubNav */
2193 subNavHoverBgColor: PropTypes.string,
2194
2195 /* When Hover font color of SubNav */
2196 subNavHoverColor: PropTypes.string,
2197
2198 /* When active background color of SubNav */
2199 subNavHighlightBgColor: PropTypes.string,
2200
2201 /* When active font color of SubNav */
2202 subNavHighlightColor: PropTypes.string,
2203
2204 /* Custom Icon color */
2205 customIconColor: PropTypes.string,
2206
2207 /* if was collapse with toggle */
2208 isToggleCollapsed: PropTypes.bool,
2209
2210 /* function to run when toggle */
2211 setToggleCollapsed: PropTypes.func
2212};
2213SideNav.displayName = 'SideNav';
2214
2215function _templateObject3$4() {
2216 var data = taggedTemplateLiteralLoose(["\n\tcolor: ", ";\n\tfont-weight: ", ";\n"]);
2217
2218 _templateObject3$4 = function _templateObject3() {
2219 return data;
2220 };
2221
2222 return data;
2223}
2224
2225function _templateObject2$7() {
2226 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\theight: 34px;\n\tflex-direction: column;\n\tjustify-content: center;\n\tpadding-left: 12px;\n\n\tborder: 0.5px solid ", ";\n\tcursor: pointer;\n\n\t&:focus span,\n\t&:hover span {\n\t\tcolor: ", ";\n\t}\n"]);
2227
2228 _templateObject2$7 = function _templateObject2() {
2229 return data;
2230 };
2231
2232 return data;
2233}
2234
2235function _templateObject$h() {
2236 var data = taggedTemplateLiteralLoose(["\n\tposition: absolute;\n\tleft: 6px;\n\twidth: 2px;\n\theight: 20px;\n\tbackground-color: ", ";\n"]);
2237
2238 _templateObject$h = function _templateObject() {
2239 return data;
2240 };
2241
2242 return data;
2243}
2244
2245var AnchorMenuItem = function AnchorMenuItem(_ref) {
2246 var title = _ref.title,
2247 active = _ref.active,
2248 props = objectWithoutPropertiesLoose(_ref, ["title", "active"]);
2249
2250 return React__default.createElement(MenuItemStyled, props, active && React__default.createElement(Marker, null), React__default.createElement(NormalTextStyled, {
2251 active: active
2252 }, title));
2253};
2254
2255AnchorMenuItem.defaultProps = {
2256 active: false
2257};
2258AnchorMenuItem.displayName = 'AnchorMenuItem';
2259AnchorMenuItem.propTypes = {
2260 title: PropTypes.string.isRequired,
2261 active: PropTypes.bool,
2262 onClick: PropTypes.func.isRequired
2263};
2264var Marker = styled__default.div(_templateObject$h(), function (_ref2) {
2265 var theme = _ref2.theme;
2266 return theme.colors.deepBlue;
2267});
2268Marker.displayName = 'Marker';
2269var MenuItemStyled = styled__default.div(_templateObject2$7(), function (_ref3) {
2270 var theme = _ref3.theme;
2271 return theme.colors.lightGray;
2272}, function (_ref4) {
2273 var theme = _ref4.theme;
2274 return theme.colors.activeBlue;
2275});
2276MenuItemStyled.displayName = 'MenuItemStyled';
2277var NormalTextStyled = styled__default.span(_templateObject3$4(), function (_ref5) {
2278 var theme = _ref5.theme,
2279 active = _ref5.active;
2280 return active ? theme.colors.deepBlue + " !important" : theme.colors.black;
2281}, function (_ref6) {
2282 var active = _ref6.active;
2283 return active ? 'bold' : 'normal';
2284});
2285NormalTextStyled.displayName = 'NormalTextStyled';
2286
2287function _templateObject$i() {
2288 var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tborder: 0.5px solid ", ";\n\tborder-radius: 4px;\n"]);
2289
2290 _templateObject$i = function _templateObject() {
2291 return data;
2292 };
2293
2294 return data;
2295}
2296
2297var AnchorMenuMapper = function AnchorMenuMapper(_ref) {
2298 var items = _ref.items,
2299 props = objectWithoutPropertiesLoose(_ref, ["items"]);
2300
2301 return React__default.createElement(AnchorMenuStyled, props, items.map(function (_ref2) {
2302 var title = _ref2.title,
2303 rest = objectWithoutPropertiesLoose(_ref2, ["title"]);
2304
2305 return React__default.createElement(AnchorMenuItem, _extends_1({
2306 key: title,
2307 title: title
2308 }, rest));
2309 }));
2310};
2311
2312var AnchorMenuStyled = styled__default.div(_templateObject$i(), function (_ref3) {
2313 var theme = _ref3.theme;
2314 return theme.colors.lightGray;
2315});
2316AnchorMenuMapper.propTypes = {
2317 items: PropTypes.arrayOf(PropTypes.shape({
2318 title: PropTypes.string.isRequired,
2319 anchor: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
2320 current: PropTypes.instanceOf(Element)
2321 })]),
2322 path: PropTypes.string,
2323 active: PropTypes.bool
2324 })).isRequired
2325};
2326
2327var ScrollableAnchorMenu =
2328/*#__PURE__*/
2329function (_Component) {
2330 inheritsLoose(ScrollableAnchorMenu, _Component);
2331
2332 function ScrollableAnchorMenu(props) {
2333 var _this;
2334
2335 _this = _Component.call(this, props) || this;
2336
2337 defineProperty(assertThisInitialized(_this), "setSelectedItem", function (selectedItem, lockSelectedItem, scrollingTo) {
2338 _this.setState({
2339 selectedItem: selectedItem,
2340 lockSelectedItem: lockSelectedItem,
2341 scrollingTo: scrollingTo
2342 });
2343 });
2344
2345 defineProperty(assertThisInitialized(_this), "limitValue", function (val, min, max) {
2346 return val < min ? min : val > max ? max : val;
2347 });
2348
2349 defineProperty(assertThisInitialized(_this), "getCoords", function (elem) {
2350 var _elem$getBoundingClie = elem.getBoundingClientRect(),
2351 top = _elem$getBoundingClie.top;
2352
2353 var _document = document,
2354 body = _document.body;
2355 var docEl = document.documentElement;
2356 var scrollTop = window.scrollY || docEl.scrollTop || body.scrollTop;
2357 var clientTop = docEl.clientTop || body.clientTop || 0;
2358 return top + scrollTop - clientTop;
2359 });
2360
2361 defineProperty(assertThisInitialized(_this), "findCurrentSection", function (items) {
2362 var sectionIndex = items.findIndex(function (_ref) {
2363 var anchor = _ref.anchor;
2364 return _this.getCoords(anchor.current) - document.documentElement.scrollTop > 0;
2365 });
2366 return sectionIndex >= 0 ? sectionIndex - 1 : items.length - 1;
2367 });
2368
2369 defineProperty(assertThisInitialized(_this), "searchItemsForCurrentSection", function () {
2370 var items = _this.props.items;
2371
2372 var currentSection = _this.limitValue(_this.findCurrentSection(items), 0, items.length - 1);
2373
2374 return currentSection >= 0 ? currentSection : items.length - 1;
2375 });
2376
2377 defineProperty(assertThisInitialized(_this), "clearLockTimeOut", function () {
2378 clearTimeout(_this.lockClear);
2379 _this.lockClear = setTimeout(function () {
2380 _this.setSelectedItem(_this.searchItemsForCurrentSection(), false, -1);
2381 }, 200);
2382 });
2383
2384 defineProperty(assertThisInitialized(_this), "handleScroll", function () {
2385 var _this$state = _this.state,
2386 selectedItem = _this$state.selectedItem,
2387 lockSelectedItem = _this$state.lockSelectedItem,
2388 scrollingTo = _this$state.scrollingTo;
2389
2390 if (!lockSelectedItem) {
2391 _this.setSelectedItem(_this.searchItemsForCurrentSection(), false, -1);
2392 } else if (scrollingTo === document.documentElement.scrollTop) {
2393 clearTimeout(_this.lockClear);
2394
2395 _this.setSelectedItem(selectedItem, false, scrollingTo);
2396 } else {
2397 _this.clearLockTimeOut();
2398 }
2399 });
2400
2401 defineProperty(assertThisInitialized(_this), "onItemClick", function (anchor, index) {
2402 var y = _this.getCoords(anchor.current);
2403
2404 _this.setSelectedItem(index, true, y);
2405
2406 window.scrollTo({
2407 top: y,
2408 behavior: 'smooth'
2409 });
2410 });
2411
2412 _this.lockClear = '';
2413 _this.state = {
2414 selectedItem: 0,
2415 lockSelectedItem: false,
2416 scrollingTo: -1
2417 };
2418 return _this;
2419 }
2420
2421 var _proto = ScrollableAnchorMenu.prototype;
2422
2423 _proto.componentDidMount = function componentDidMount() {
2424 window.addEventListener('scroll', this.handleScroll);
2425 };
2426
2427 _proto.UNSAFE_componentWillUnmount = function UNSAFE_componentWillUnmount() {
2428 window.removeEventListener('scroll', this.handleScroll);
2429 };
2430
2431 _proto.render = function render() {
2432 var _this2 = this;
2433
2434 var selectedItem = this.state.selectedItem;
2435
2436 var _this$props = this.props,
2437 items = _this$props.items,
2438 props = objectWithoutPropertiesLoose(_this$props, ["items"]);
2439
2440 var computedItems = items.map(function (item, index) {
2441 return _extends_1({
2442 onClick: function onClick() {
2443 return _this2.onItemClick(item.anchor, index);
2444 },
2445 active: selectedItem === index
2446 }, item);
2447 });
2448 return React__default.createElement(AnchorMenuMapper, _extends_1({
2449 items: computedItems
2450 }, props));
2451 };
2452
2453 return ScrollableAnchorMenu;
2454}(React.Component);
2455
2456ScrollableAnchorMenu.displayName = 'ScrollableAnchorMenu';
2457ScrollableAnchorMenu.propTypes = {
2458 items: PropTypes.arrayOf(PropTypes.shape({
2459 anchor: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
2460 current: PropTypes.instanceOf(Element)
2461 })]),
2462 title: PropTypes.string.isRequired
2463 })).isRequired
2464};
2465
2466var NavigationAnchorMenu = function NavigationAnchorMenu(_ref) {
2467 var items = _ref.items,
2468 onItemClick = _ref.onItemClick;
2469 var newItems = items.map(function (item) {
2470 return _extends_1({
2471 onClick: function onClick() {
2472 return onItemClick(item.path);
2473 }
2474 }, item);
2475 });
2476 return React__default.createElement(AnchorMenuMapper, {
2477 items: newItems
2478 });
2479};
2480
2481NavigationAnchorMenu.displayName = 'NavigationAnchorMenu';
2482NavigationAnchorMenu.propTypes = {
2483 onItemClick: PropTypes.func.isRequired,
2484 items: PropTypes.arrayOf(PropTypes.shape({
2485 path: PropTypes.string.isRequired,
2486 title: PropTypes.string.isRequired,
2487 active: PropTypes.bool
2488 })).isRequired
2489};
2490
2491var AnchorMenu = function AnchorMenu(_ref) {
2492 var type = _ref.type,
2493 items = _ref.items,
2494 onItemClick = _ref.onItemClick,
2495 props = objectWithoutPropertiesLoose(_ref, ["type", "items", "onItemClick"]);
2496
2497 return type === 'scrollable' ? React__default.createElement(ScrollableAnchorMenu, _extends_1({
2498 items: items
2499 }, props)) : React__default.createElement(NavigationAnchorMenu, _extends_1({
2500 items: items,
2501 onItemClick: onItemClick
2502 }, props));
2503};
2504
2505AnchorMenu.defaultProps = {
2506 onItemClick: undefined
2507};
2508AnchorMenu.propTypes = {
2509 type: PropTypes.oneOf(['scrollable', 'navigation']).isRequired,
2510 items: PropTypes.arrayOf(PropTypes.shape({
2511 title: PropTypes.string.isRequired,
2512 anchor: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
2513 current: PropTypes.instanceOf(Element)
2514 })]),
2515 path: PropTypes.string,
2516 active: PropTypes.bool
2517 })).isRequired,
2518 onItemClick: PropTypes.func
2519};
2520
2521function _templateObject$j() {
2522 var data = taggedTemplateLiteralLoose(["\n\tpadding: 24px 15px;\n\n\tbackground-color: ", " !important;\n\tborder-radius: ", " !important;\n\tcolor: ", " !important;\n\tvertical-align: middle;\n\n\tp {\n\t\tpadding: 0 !important;\n\t\tmargin: 0 !important;\n\t\ttext-align: center;\n\t}\n"]);
2523
2524 _templateObject$j = function _templateObject() {
2525 return data;
2526 };
2527
2528 return data;
2529}
2530var BlockWrapper = styled__default.div(_templateObject$j(), function (_ref) {
2531 var theme = _ref.theme,
2532 background = _ref.background;
2533 return background || theme.block.backgroundColor;
2534}, function (_ref2) {
2535 var theme = _ref2.theme;
2536 return theme.block.borderRadius;
2537}, function (_ref3) {
2538 var theme = _ref3.theme,
2539 color = _ref3.color;
2540 return color || theme.block.color;
2541});
2542BlockWrapper.displayName = 'BlockWrapper';
2543BlockWrapper.propTypes = {
2544 color: PropTypes.string,
2545 background: PropTypes.string
2546};
2547
2548/**
2549 * block component
2550 */
2551
2552var Block = function Block(_ref) {
2553 var value = _ref.value,
2554 label = _ref.label,
2555 props = objectWithoutPropertiesLoose(_ref, ["value", "label"]);
2556
2557 return React__default.createElement(BlockWrapper, props, React__default.createElement("div", null, React__default.createElement("p", {
2558 style: {
2559 fontSize: 40
2560 }
2561 }, " " + value), React__default.createElement("p", {
2562 style: {
2563 fontSize: 14,
2564 textTransform: 'uppercase'
2565 }
2566 }, label)));
2567};
2568
2569Block.defaultProps = {
2570 color: '#fff',
2571 background: '#a21d21'
2572};
2573Block.propTypes = {
2574 /** value present on the middle of the component */
2575 value: PropTypes.number.isRequired,
2576
2577 /** text present below the value */
2578 label: PropTypes.string.isRequired,
2579
2580 /** text color */
2581 color: PropTypes.string,
2582
2583 /** background color [hex] */
2584 background: PropTypes.string
2585};
2586Block.displayName = 'Block';
2587
2588function _templateObject$k() {
2589 var data = taggedTemplateLiteralLoose(["\n\tvertical-align: middle;\n\n\t&&& p {\n\t\tpadding: 0 !important;\n\t\tmargin: 0 !important;\n\t\ttext-align: left;\n\t}\n\n\t&&& div {\n\t\tpadding-left: 8px !important;\n\n\t\tborder-color: ", ";\n\t\tborder-left-width: 5px;\n\t\tborder-left-style: solid;\n\t}\n"]);
2590
2591 _templateObject$k = function _templateObject() {
2592 return data;
2593 };
2594
2595 return data;
2596}
2597var BlockBarWrapper = styled__default(BlockWrapper)(_templateObject$k(), function (_ref) {
2598 var theme = _ref.theme,
2599 labelColor = _ref.labelColor;
2600 return labelColor || theme.block.labelColor;
2601});
2602BlockBarWrapper.propTypes = {
2603 labelColor: PropTypes.string
2604};
2605BlockBarWrapper.displayName = 'BlockBarWrapper';
2606
2607/**
2608 * block component
2609 */
2610
2611var BlockBar = function BlockBar(_ref) {
2612 var value = _ref.value,
2613 label = _ref.label,
2614 labelColor = _ref.labelColor,
2615 props = objectWithoutPropertiesLoose(_ref, ["value", "label", "labelColor"]);
2616
2617 return React__default.createElement(BlockBarWrapper, _extends_1({
2618 labelColor: labelColor
2619 }, props), React__default.createElement("div", null, React__default.createElement("p", {
2620 style: {
2621 fontSize: 40
2622 }
2623 }, " " + value), React__default.createElement("p", {
2624 style: {
2625 fontSize: 14,
2626 textTransform: 'uppercase'
2627 }
2628 }, label)));
2629};
2630
2631BlockBar.defaultProps = {
2632 labelColor: '#ffffff'
2633};
2634BlockBar.propTypes = {
2635 value: PropTypes.number.isRequired,
2636 label: PropTypes.string.isRequired,
2637 labelColor: PropTypes.string
2638};
2639BlockBar.displayName = 'BlockBar';
2640
2641function _templateObject$l() {
2642 var data = taggedTemplateLiteralLoose(["\n\tcolor: ", " !important;\n\tfont-weight: ", " !important;\n"]);
2643
2644 _templateObject$l = function _templateObject() {
2645 return data;
2646 };
2647
2648 return data;
2649}
2650var Span = styled__default.span(_templateObject$l(), function (_ref) {
2651 var theme = _ref.theme,
2652 type = _ref.type,
2653 color = _ref.color;
2654 return type ? theme.span[type] : color || theme.span.defaultColor;
2655}, function (_ref2) {
2656 var bold = _ref2.bold;
2657 return bold ? 700 : undefined;
2658});
2659Span.propTypes = {
2660 bold: PropTypes.bool,
2661 color: PropTypes.string,
2662 type: PropTypes.oneOf(['positive', 'negative', 'primary'])
2663};
2664Span.displayName = 'Span';
2665
2666function _templateObject$m() {
2667 var data = taggedTemplateLiteralLoose(["\n\tbox-shadow: 0 0 3px rgba(0, 0, 0, 0.25);\n\n\t&&.ui.modal > .close {\n\t\ttop: 8px;\n\t\tright: 8px;\n\t\tcolor: ", ";\n\t\tpadding: 0;\n\t\twidth: 10px;\n\t\tfont-size: 18px;\n\n\t\t:hover {\n\t\t\tcolor: ", ";\n\t\t}\n\t}\n"]);
2668
2669 _templateObject$m = function _templateObject() {
2670 return data;
2671 };
2672
2673 return data;
2674}
2675
2676var ModalStyled = function ModalStyled(_ref) {
2677 var children = _ref.children,
2678 props = objectWithoutPropertiesLoose(_ref, ["children"]);
2679
2680 return React__default.createElement(ModalStyledWrapper, props, children);
2681};
2682
2683var ModalStyledWrapper = styled__default(semanticUiReact.Modal)(_templateObject$m(), function (_ref2) {
2684 var theme = _ref2.theme;
2685 return theme.colors.gray;
2686}, function (_ref3) {
2687 var theme = _ref3.theme;
2688 return theme.colors.mediumGray;
2689});
2690ModalStyled.displayName = 'ModalStyled';
2691ModalStyled.propTypes = {
2692 children: PropTypes.node
2693};
2694ModalStyled.defaultProps = {
2695 children: null
2696};
2697
2698var secondary = {
2699 name: 'SECONDARY',
2700 colors: colors,
2701 borderRadius: '0',
2702 navbar: {
2703 backgroundColor: colors.darkRed
2704 },
2705 buttons: {
2706 borderRadius: '0',
2707 primary: colors.activeBlue,
2708 danger: colors.red,
2709 success: colors.green,
2710 white: colors.white,
2711 activeBg: {
2712 primary: colors.darkBlue,
2713 danger: colors.darkRed,
2714 success: colors.green,
2715 white: colors.white
2716 },
2717 dropdown: {
2718 separatorColor: colors.gray,
2719 activeBackgroundColor: colors.gray
2720 }
2721 },
2722 list: {
2723 pairCell: colors.lightGray,
2724 unPairCell: colors.white,
2725 title: colors.black,
2726 additionalInfo: colors.gray,
2727 activeCell: colors.lightBlue
2728 },
2729 span: {
2730 defaultColor: colors.activeBlue,
2731 negative: colors.red,
2732 positive: colors.green,
2733 primary: colors.activeBlue
2734 },
2735 block: {
2736 borderRadius: '0',
2737 backgroundColor: colors.darkRed,
2738 labelColor: colors.darkGray,
2739 color: colors.darkGray
2740 },
2741 input: {
2742 borderRadius: '0'
2743 },
2744 select: {
2745 borderRadius: '4px',
2746 placeholderColor: '#424242',
2747 focusedBackgroundColor: '#ECECEC',
2748 selectedBackgroundColor: '#005BEA',
2749 menuPadding: '5px 10px 5px 10px'
2750 },
2751 toggle: {
2752 color: colors.green
2753 },
2754 timePicker: {
2755 errorColor: colors.red,
2756 disabledColor: colors.lightGray,
2757 primaryColor: colors.activeBlue,
2758 activeColor: colors.deepBlue,
2759 hoverColor: colors.lightGray,
2760 textColor: colors.darkGray
2761 },
2762 toast: {
2763 titleColor: colors.darkGray,
2764 messageColor: colors.mediumGray,
2765 errorColor: colors.red,
2766 successColor: colors.green,
2767 warningColor: colors.yellow
2768 },
2769 status: {
2770 bg: {
2771 success: colors.green,
2772 error: colors.red,
2773 info: colors.lightBlue
2774 },
2775 color: {
2776 success: colors.white,
2777 error: colors.white,
2778 info: colors.darkGray
2779 }
2780 }
2781};
2782
2783function _templateObject$n() {
2784 var data = taggedTemplateLiteralLoose(["\n\t&&.header {\n\t\tborder-bottom: none;\n\t}\n"]);
2785
2786 _templateObject$n = function _templateObject() {
2787 return data;
2788 };
2789
2790 return data;
2791}
2792var NoBorderModalHeader = styled__default(semanticUiReact.Header)(_templateObject$n());
2793
2794var ModalHeader = function ModalHeader(_ref) {
2795 var children = _ref.children;
2796 return React__default.createElement(NoBorderModalHeader, null, children);
2797};
2798
2799var ModalTitleHeader = function ModalTitleHeader(_ref2) {
2800 var title = _ref2.title;
2801 return React__default.createElement(NoBorderModalHeader, {
2802 content: title
2803 });
2804};
2805var ModalIconTitleHeader = function ModalIconTitleHeader(_ref3) {
2806 var title = _ref3.title,
2807 icon = _ref3.icon,
2808 iconColor = _ref3.iconColor;
2809 return React__default.createElement(NoBorderModalHeader, {
2810 icon: React__default.createElement(Icon, {
2811 color: iconColor,
2812 size: "big",
2813 icon: icon
2814 }),
2815 content: title
2816 });
2817};
2818ModalHeader.defaultProps = {
2819 children: ''
2820};
2821ModalHeader.propTypes = {
2822 children: PropTypes.node
2823};
2824ModalHeader.displayName = 'ModalHeader';
2825ModalTitleHeader.propTypes = {
2826 title: PropTypes.string.isRequired
2827};
2828ModalTitleHeader.displayName = 'ModalTitleHeader';
2829ModalIconTitleHeader.defaultProps = {
2830 title: '',
2831 iconColor: theme.colors.red
2832};
2833ModalIconTitleHeader.propTypes = {
2834 title: PropTypes.string,
2835 icon: PropTypes.string.isRequired,
2836 iconColor: PropTypes.string
2837};
2838ModalIconTitleHeader.displayName = 'ModalIconTitleHeader';
2839
2840var ModalContent = function ModalContent(_ref) {
2841 var children = _ref.children;
2842 return React__default.createElement(semanticUiReact.Modal.Content, null, children);
2843};
2844
2845ModalContent.defaultProps = {
2846 children: null
2847};
2848ModalContent.propTypes = {
2849 children: PropTypes.node
2850};
2851ModalContent.displayName = 'ModalContent';
2852
2853function _templateObject$o() {
2854 var data = taggedTemplateLiteralLoose(["\n\tpadding: 1.25rem 1.5rem;\n"]);
2855
2856 _templateObject$o = function _templateObject() {
2857 return data;
2858 };
2859
2860 return data;
2861}
2862var SemanticModalFooter = styled__default.div(_templateObject$o());
2863
2864var ModalFooter = function ModalFooter(_ref) {
2865 var children = _ref.children;
2866 return React__default.createElement(SemanticModalFooter, null, children);
2867};
2868
2869var ModalSingleButtonFooter = function ModalSingleButtonFooter(_ref2) {
2870 var buttonText = _ref2.buttonText,
2871 buttonOnClickHandler = _ref2.buttonOnClickHandler,
2872 buttonId = _ref2.buttonId,
2873 loading = _ref2.loading,
2874 props = objectWithoutPropertiesLoose(_ref2, ["buttonText", "buttonOnClickHandler", "buttonId", "loading"]);
2875
2876 return React__default.createElement(SemanticModalFooter, null, React__default.createElement(semanticUiReact.Grid, null, React__default.createElement(semanticUiReact.Grid.Column, {
2877 align: "right"
2878 }, React__default.createElement(Button, _extends_1({
2879 id: buttonId,
2880 onClick: buttonOnClickHandler,
2881 content: buttonText,
2882 loading: loading
2883 }, props)))));
2884};
2885var ModalDoubleButtonFooter = function ModalDoubleButtonFooter(_ref3) {
2886 var leftButtonText = _ref3.leftButtonText,
2887 leftButtonOnClickHandler = _ref3.leftButtonOnClickHandler,
2888 leftButtonId = _ref3.leftButtonId,
2889 rightButtonText = _ref3.rightButtonText,
2890 rightButtonOnClickHandler = _ref3.rightButtonOnClickHandler,
2891 rightButtonId = _ref3.rightButtonId,
2892 loading = _ref3.loading,
2893 disabled = _ref3.disabled,
2894 props = objectWithoutPropertiesLoose(_ref3, ["leftButtonText", "leftButtonOnClickHandler", "leftButtonId", "rightButtonText", "rightButtonOnClickHandler", "rightButtonId", "loading", "disabled"]);
2895
2896 return React__default.createElement(SemanticModalFooter, null, React__default.createElement(semanticUiReact.Grid, null, React__default.createElement(semanticUiReact.Grid.Column, {
2897 verticalAlign: "middle",
2898 width: 8,
2899 align: "left"
2900 }, React__default.createElement(ButtonLink, {
2901 id: leftButtonId,
2902 onClick: leftButtonOnClickHandler
2903 }, leftButtonText)), React__default.createElement(semanticUiReact.Grid.Column, {
2904 width: 8,
2905 align: "right"
2906 }, React__default.createElement(Button, _extends_1({
2907 id: rightButtonId,
2908 onClick: rightButtonOnClickHandler,
2909 content: rightButtonText,
2910 loading: loading,
2911 disabled: disabled
2912 }, props)))));
2913};
2914var ModalDoubleButtonContentFooter = function ModalDoubleButtonContentFooter(_ref4) {
2915 var leftButtonText = _ref4.leftButtonText,
2916 leftButtonOnClickHandler = _ref4.leftButtonOnClickHandler,
2917 leftButtonId = _ref4.leftButtonId,
2918 rightButtonText = _ref4.rightButtonText,
2919 rightButtonOnClickHandler = _ref4.rightButtonOnClickHandler,
2920 rightButtonId = _ref4.rightButtonId,
2921 loading = _ref4.loading,
2922 disabled = _ref4.disabled,
2923 props = objectWithoutPropertiesLoose(_ref4, ["leftButtonText", "leftButtonOnClickHandler", "leftButtonId", "rightButtonText", "rightButtonOnClickHandler", "rightButtonId", "loading", "disabled"]);
2924
2925 return React__default.createElement(semanticUiReact.Grid, null, React__default.createElement(semanticUiReact.Grid.Column, {
2926 verticalAlign: "middle",
2927 width: 8,
2928 align: "left"
2929 }, React__default.createElement(ButtonLink, {
2930 id: leftButtonId,
2931 onClick: leftButtonOnClickHandler
2932 }, leftButtonText)), React__default.createElement(semanticUiReact.Grid.Column, {
2933 width: 8,
2934 align: "right"
2935 }, React__default.createElement(Button, _extends_1({
2936 id: rightButtonId,
2937 onClick: rightButtonOnClickHandler,
2938 content: rightButtonText,
2939 loading: loading,
2940 disabled: disabled
2941 }, props))));
2942};
2943ModalFooter.defaultProps = {
2944 children: null
2945};
2946ModalFooter.propTypes = {
2947 children: PropTypes.node
2948};
2949ModalFooter.displayName = 'ModalFooter';
2950ModalSingleButtonFooter.defaultProps = {
2951 buttonId: '',
2952 loading: false
2953};
2954ModalSingleButtonFooter.propTypes = {
2955 buttonId: PropTypes.string,
2956 buttonText: PropTypes.string.isRequired,
2957 buttonOnClickHandler: PropTypes.func.isRequired,
2958 loading: PropTypes.bool
2959};
2960ModalSingleButtonFooter.displayName = 'ModalSingleButtonFooter';
2961ModalDoubleButtonFooter.defaultProps = {
2962 leftButtonId: '',
2963 rightButtonId: '',
2964 loading: false,
2965 disabled: false
2966};
2967ModalDoubleButtonFooter.propTypes = {
2968 leftButtonId: PropTypes.string,
2969 leftButtonText: PropTypes.string.isRequired,
2970 leftButtonOnClickHandler: PropTypes.func.isRequired,
2971 rightButtonId: PropTypes.string,
2972 rightButtonText: PropTypes.string.isRequired,
2973 rightButtonOnClickHandler: PropTypes.func.isRequired,
2974 loading: PropTypes.bool,
2975 disabled: PropTypes.bool
2976};
2977ModalDoubleButtonFooter.displayName = 'ModalDoubleButtonFooter';
2978ModalDoubleButtonContentFooter.defaultProps = {
2979 leftButtonId: '',
2980 rightButtonId: '',
2981 loading: false,
2982 disabled: false
2983};
2984ModalDoubleButtonContentFooter.propTypes = {
2985 leftButtonId: PropTypes.string,
2986 leftButtonText: PropTypes.string.isRequired,
2987 leftButtonOnClickHandler: PropTypes.func.isRequired,
2988 rightButtonId: PropTypes.string,
2989 rightButtonText: PropTypes.string.isRequired,
2990 rightButtonOnClickHandler: PropTypes.func.isRequired,
2991 loading: PropTypes.bool,
2992 disabled: PropTypes.bool
2993};
2994ModalDoubleButtonContentFooter.displayName = 'ModalDoubleButtonContentFooter';
2995
2996var Modal = function Modal(_ref) {
2997 var children = _ref.children,
2998 dimmer = _ref.dimmer,
2999 size = _ref.size,
3000 closeOnDimmerClick = _ref.closeOnDimmerClick,
3001 props = objectWithoutPropertiesLoose(_ref, ["children", "dimmer", "size", "closeOnDimmerClick"]);
3002
3003 return React__default.createElement(ModalStyled, _extends_1({
3004 dimmer: dimmer,
3005 size: size,
3006 closeOnDimmerClick: closeOnDimmerClick,
3007 closeIcon: true
3008 }, props), children);
3009};
3010
3011Modal.Header = function (_ref2) {
3012 var props = _extends_1({}, _ref2);
3013
3014 return React__default.createElement(ModalHeader, props);
3015};
3016
3017Modal.Header.displayName = 'Modal.Header';
3018
3019Modal.TitleHeader = function (_ref3) {
3020 var props = _extends_1({}, _ref3);
3021
3022 return React__default.createElement(ModalTitleHeader, props);
3023};
3024
3025Modal.TitleHeader.displayName = 'Modal.ModalTitleHeader';
3026
3027Modal.IconTitleHeader = function (_ref4) {
3028 var props = _extends_1({}, _ref4);
3029
3030 return React__default.createElement(ModalIconTitleHeader, props);
3031};
3032
3033Modal.IconTitleHeader.displayName = 'Modal.ModalIconTitleHeader';
3034
3035Modal.Content = function (_ref5) {
3036 var props = _extends_1({}, _ref5);
3037
3038 return React__default.createElement(ModalContent, props);
3039};
3040
3041Modal.Content.displayName = 'Modal.Content';
3042
3043Modal.Footer = function (_ref6) {
3044 var props = _extends_1({}, _ref6);
3045
3046 return React__default.createElement(ModalFooter, props);
3047};
3048
3049Modal.Footer.displayName = 'Modal.Footer';
3050
3051Modal.SingleButtonFooter = function (_ref7) {
3052 var props = _extends_1({}, _ref7);
3053
3054 return React__default.createElement(ModalSingleButtonFooter, props);
3055};
3056
3057Modal.SingleButtonFooter.displayName = 'Modal.SingleButtonFooter';
3058
3059Modal.DoubleButtonFooter = function (_ref8) {
3060 var props = _extends_1({}, _ref8);
3061
3062 return React__default.createElement(ModalDoubleButtonFooter, props);
3063};
3064
3065Modal.DoubleButtonFooter.displayName = 'Modal.DoubleButtonFooter';
3066
3067Modal.ModalDoubleButtonContentFooter = function (_ref9) {
3068 var props = _extends_1({}, _ref9);
3069
3070 return React__default.createElement(ModalDoubleButtonContentFooter, props);
3071};
3072
3073Modal.ModalDoubleButtonContentFooter.displayName = 'Modal.ModalDoubleButtonContentFooter';
3074Modal.defaultProps = {
3075 dimmer: 'inverted',
3076 size: 'tiny',
3077 children: null,
3078 closeOnDimmerClick: false,
3079 closeIcon: true
3080};
3081Modal.propTypes = {
3082 /** Custom content that is added to modal content */
3083 children: PropTypes.node,
3084
3085 /** Color of the icon */
3086 dimmer: PropTypes.string,
3087
3088 /** Simple text content for the Modal. */
3089 size: PropTypes.string,
3090
3091 /** Close modal clicking outside */
3092 closeOnDimmerClick: PropTypes.bool,
3093
3094 /** Has icon to close modal */
3095 closeIcon: PropTypes.bool
3096};
3097Modal.displayName = 'Modal';
3098
3099function _templateObject5$3() {
3100 var data = taggedTemplateLiteralLoose(["\n\t&&&& {\n\t\tright: 0;\n\t\tbottom: 0;\n\t\ttop: 0;\n\t\twidth: 100% !important;\n\t\theight: 100%;\n\t\tmargin: 0 !important;\n\t\tposition: relative;\n\t}\n"]);
3101
3102 _templateObject5$3 = function _templateObject5() {
3103 return data;
3104 };
3105
3106 return data;
3107}
3108
3109function _templateObject4$3() {
3110 var data = taggedTemplateLiteralLoose(["\n\t.ui.dimmer {\n\t\tpadding: 0;\n\t}\n"]);
3111
3112 _templateObject4$3 = function _templateObject4() {
3113 return data;
3114 };
3115
3116 return data;
3117}
3118
3119function _templateObject3$5() {
3120 var data = taggedTemplateLiteralLoose(["\n\tposition: absolute;\n\ttop: 24px;\n\tleft: 24px;\n"]);
3121
3122 _templateObject3$5 = function _templateObject3() {
3123 return data;
3124 };
3125
3126 return data;
3127}
3128
3129function _templateObject2$8() {
3130 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tmargin-top: 136px;\n"]);
3131
3132 _templateObject2$8 = function _templateObject2() {
3133 return data;
3134 };
3135
3136 return data;
3137}
3138
3139function _templateObject$p() {
3140 var data = taggedTemplateLiteralLoose(["\n\tmargin-right: 4px !important;\n"]);
3141
3142 _templateObject$p = function _templateObject() {
3143 return data;
3144 };
3145
3146 return data;
3147}
3148
3149var FullScreenModal = function FullScreenModal(_ref) {
3150 var negativeLabel = _ref.negativeLabel,
3151 negativeActionHandler = _ref.negativeActionHandler,
3152 children = _ref.children,
3153 props = objectWithoutPropertiesLoose(_ref, ["negativeLabel", "negativeActionHandler", "children"]);
3154
3155 return React__default.createElement(React__default.Fragment, null, React__default.createElement(ModalGlobalStyle, null), React__default.createElement(FullModalStyled, _extends_1({
3156 size: "fullscreen",
3157 dimmer: "inverted",
3158 closeIcon: true
3159 }, props), React__default.createElement(Modal.Content, null, React__default.createElement(Top, null, React__default.createElement(ButtonLink, {
3160 onClick: negativeActionHandler
3161 }, React__default.createElement(IconSpaced, {
3162 icon: "arrow-left",
3163 color: theme.colors.activeBlue
3164 }), negativeLabel)), children && React__default.createElement(CenteredContent, null, children))));
3165};
3166
3167var IconSpaced = styled__default(Icon)(_templateObject$p());
3168var CenteredContent = styled__default.div(_templateObject2$8());
3169CenteredContent.displayName = 'CenteredContent';
3170var Top = styled__default.div(_templateObject3$5()); // add global style to affect modal wrapper at the body
3171
3172var ModalGlobalStyle = styled.createGlobalStyle(_templateObject4$3());
3173var FullModalStyled = styled__default(ModalStyled)(_templateObject5$3());
3174FullScreenModal.defaultProps = {
3175 children: null,
3176 negativeLabel: '',
3177 negativeActionHandler: null
3178};
3179FullScreenModal.propTypes = {
3180 /** Custom content that is added to modal content */
3181 children: PropTypes.node,
3182
3183 /** Left button label */
3184 negativeLabel: PropTypes.string,
3185
3186 /** Left button click handler */
3187 negativeActionHandler: PropTypes.func
3188};
3189
3190var ErrorModal = function ErrorModal(_ref) {
3191 var title = _ref.title,
3192 errors = _ref.errors,
3193 buttonText = _ref.buttonText,
3194 buttonOnClickHandler = _ref.buttonOnClickHandler,
3195 buttonId = _ref.buttonId,
3196 props = objectWithoutPropertiesLoose(_ref, ["title", "errors", "buttonText", "buttonOnClickHandler", "buttonId"]);
3197
3198 return React__default.createElement(Modal, _extends_1({
3199 closeIcon: false
3200 }, props), React__default.createElement(Modal.IconTitleHeader, {
3201 title: title,
3202 icon: "warning"
3203 }), React__default.createElement(Modal.Content, null, React__default.createElement("ul", null, errors.map(function (error, index) {
3204 return React__default.createElement("li", {
3205 key: error + "-" + index
3206 }, error);
3207 }))), React__default.createElement(Modal.SingleButtonFooter, {
3208 buttonText: buttonText,
3209 buttonOnClickHandler: buttonOnClickHandler,
3210 buttonId: buttonId
3211 }));
3212};
3213
3214ErrorModal.defaultProps = {
3215 buttonId: ''
3216};
3217ErrorModal.propTypes = {
3218 /** Modal title */
3219 title: PropTypes.string.isRequired,
3220
3221 /** Array of errors to be displayed */
3222 errors: PropTypes.arrayOf(PropTypes.string).isRequired,
3223
3224 /** Button text on Modal Footer */
3225 buttonText: PropTypes.string.isRequired,
3226
3227 /** OnClick function for Modal Footer button */
3228 buttonOnClickHandler: PropTypes.func.isRequired,
3229
3230 /** Id for Modal Footer button */
3231 buttonId: PropTypes.string
3232};
3233ErrorModal.displayName = 'ErrorModal';
3234
3235var ConfirmationModal = function ConfirmationModal(_ref) {
3236 var title = _ref.title,
3237 contentText = _ref.contentText,
3238 leftButtonText = _ref.leftButtonText,
3239 leftButtonOnClickHandler = _ref.leftButtonOnClickHandler,
3240 leftButtonId = _ref.leftButtonId,
3241 rightButtonText = _ref.rightButtonText,
3242 rightButtonOnClickHandler = _ref.rightButtonOnClickHandler,
3243 rightButtonId = _ref.rightButtonId,
3244 loading = _ref.loading,
3245 props = objectWithoutPropertiesLoose(_ref, ["title", "contentText", "leftButtonText", "leftButtonOnClickHandler", "leftButtonId", "rightButtonText", "rightButtonOnClickHandler", "rightButtonId", "loading"]);
3246
3247 return React__default.createElement(Modal, props, React__default.createElement(Modal.IconTitleHeader, {
3248 title: title,
3249 icon: "warning"
3250 }), React__default.createElement(Modal.Content, null, contentText), React__default.createElement(Modal.DoubleButtonFooter, {
3251 leftButtonText: leftButtonText,
3252 leftButtonOnClickHandler: leftButtonOnClickHandler,
3253 leftButtonId: leftButtonId,
3254 rightButtonText: rightButtonText,
3255 rightButtonOnClickHandler: rightButtonOnClickHandler,
3256 rightButtonId: rightButtonId,
3257 loading: loading
3258 }));
3259};
3260
3261ConfirmationModal.defaultProps = {
3262 leftButtonId: '',
3263 rightButtonId: '',
3264 loading: false
3265};
3266ConfirmationModal.propTypes = {
3267 /** Modal title */
3268 title: PropTypes.string.isRequired,
3269
3270 /** Modal content text */
3271 contentText: PropTypes.string.isRequired,
3272
3273 /** Left button text on Modal Footer */
3274 leftButtonText: PropTypes.string.isRequired,
3275
3276 /** OnClick function for Modal Footer left button */
3277 leftButtonOnClickHandler: PropTypes.func.isRequired,
3278
3279 /** Id for Modal Footer left button */
3280 leftButtonId: PropTypes.string,
3281
3282 /** Right button text on Modal Footer */
3283 rightButtonText: PropTypes.string.isRequired,
3284
3285 /** OnClick function for Modal Footer right button */
3286 rightButtonOnClickHandler: PropTypes.func.isRequired,
3287
3288 /** Id for Modal Footer right button */
3289 rightButtonId: PropTypes.string,
3290
3291 /** Loading for Modal Footer right button */
3292 loading: PropTypes.bool
3293};
3294ConfirmationModal.displayName = 'ConfirmationModal';
3295
3296var classnames = createCommonjsModule(function (module) {
3297/*!
3298 Copyright (c) 2017 Jed Watson.
3299 Licensed under the MIT License (MIT), see
3300 http://jedwatson.github.io/classnames
3301*/
3302/* global define */
3303
3304(function () {
3305
3306 var hasOwn = {}.hasOwnProperty;
3307
3308 function classNames () {
3309 var classes = [];
3310
3311 for (var i = 0; i < arguments.length; i++) {
3312 var arg = arguments[i];
3313 if (!arg) continue;
3314
3315 var argType = typeof arg;
3316
3317 if (argType === 'string' || argType === 'number') {
3318 classes.push(arg);
3319 } else if (Array.isArray(arg) && arg.length) {
3320 var inner = classNames.apply(null, arg);
3321 if (inner) {
3322 classes.push(inner);
3323 }
3324 } else if (argType === 'object') {
3325 for (var key in arg) {
3326 if (hasOwn.call(arg, key) && arg[key]) {
3327 classes.push(key);
3328 }
3329 }
3330 }
3331 }
3332
3333 return classes.join(' ');
3334 }
3335
3336 if (module.exports) {
3337 classNames.default = classNames;
3338 module.exports = classNames;
3339 } else {
3340 window.classNames = classNames;
3341 }
3342}());
3343});
3344
3345var constant = createCommonjsModule(function (module, exports) {
3346
3347Object.defineProperty(exports, "__esModule", {
3348 value: true
3349});
3350exports.default = {
3351
3352 GLOBAL: {
3353 HIDE: '__react_tooltip_hide_event',
3354 REBUILD: '__react_tooltip_rebuild_event',
3355 SHOW: '__react_tooltip_show_event'
3356 }
3357};
3358});
3359
3360unwrapExports(constant);
3361
3362var staticMethods = createCommonjsModule(function (module, exports) {
3363
3364Object.defineProperty(exports, "__esModule", {
3365 value: true
3366});
3367
3368exports.default = function (target) {
3369 /**
3370 * Hide all tooltip
3371 * @trigger ReactTooltip.hide()
3372 */
3373 target.hide = function (target) {
3374 dispatchGlobalEvent(_constant2.default.GLOBAL.HIDE, { target: target });
3375 };
3376
3377 /**
3378 * Rebuild all tooltip
3379 * @trigger ReactTooltip.rebuild()
3380 */
3381 target.rebuild = function () {
3382 dispatchGlobalEvent(_constant2.default.GLOBAL.REBUILD);
3383 };
3384
3385 /**
3386 * Show specific tooltip
3387 * @trigger ReactTooltip.show()
3388 */
3389 target.show = function (target) {
3390 dispatchGlobalEvent(_constant2.default.GLOBAL.SHOW, { target: target });
3391 };
3392
3393 target.prototype.globalRebuild = function () {
3394 if (this.mount) {
3395 this.unbindListener();
3396 this.bindListener();
3397 }
3398 };
3399
3400 target.prototype.globalShow = function (event) {
3401 if (this.mount) {
3402 // Create a fake event, specific show will limit the type to `solid`
3403 // only `float` type cares e.clientX e.clientY
3404 var e = { currentTarget: event.detail.target };
3405 this.showTooltip(e, true);
3406 }
3407 };
3408
3409 target.prototype.globalHide = function (event) {
3410 if (this.mount) {
3411 var hasTarget = event && event.detail && event.detail.target && true || false;
3412 this.hideTooltip({ currentTarget: hasTarget && event.detail.target }, hasTarget);
3413 }
3414 };
3415};
3416
3417
3418
3419var _constant2 = _interopRequireDefault(constant);
3420
3421function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3422
3423var dispatchGlobalEvent = function dispatchGlobalEvent(eventName, opts) {
3424 // Compatible with IE
3425 // @see http://stackoverflow.com/questions/26596123/internet-explorer-9-10-11-event-constructor-doesnt-work
3426 var event = void 0;
3427
3428 if (typeof window.CustomEvent === 'function') {
3429 event = new window.CustomEvent(eventName, { detail: opts });
3430 } else {
3431 event = document.createEvent('Event');
3432 event.initEvent(eventName, false, true);
3433 event.detail = opts;
3434 }
3435
3436 window.dispatchEvent(event);
3437}; /**
3438 * Static methods for react-tooltip
3439 */
3440});
3441
3442unwrapExports(staticMethods);
3443
3444var windowListener = createCommonjsModule(function (module, exports) {
3445
3446Object.defineProperty(exports, "__esModule", {
3447 value: true
3448});
3449
3450exports.default = function (target) {
3451 target.prototype.bindWindowEvents = function (resizeHide) {
3452 // ReactTooltip.hide
3453 window.removeEventListener(_constant2.default.GLOBAL.HIDE, this.globalHide);
3454 window.addEventListener(_constant2.default.GLOBAL.HIDE, this.globalHide, false);
3455
3456 // ReactTooltip.rebuild
3457 window.removeEventListener(_constant2.default.GLOBAL.REBUILD, this.globalRebuild);
3458 window.addEventListener(_constant2.default.GLOBAL.REBUILD, this.globalRebuild, false);
3459
3460 // ReactTooltip.show
3461 window.removeEventListener(_constant2.default.GLOBAL.SHOW, this.globalShow);
3462 window.addEventListener(_constant2.default.GLOBAL.SHOW, this.globalShow, false);
3463
3464 // Resize
3465 if (resizeHide) {
3466 window.removeEventListener('resize', this.onWindowResize);
3467 window.addEventListener('resize', this.onWindowResize, false);
3468 }
3469 };
3470
3471 target.prototype.unbindWindowEvents = function () {
3472 window.removeEventListener(_constant2.default.GLOBAL.HIDE, this.globalHide);
3473 window.removeEventListener(_constant2.default.GLOBAL.REBUILD, this.globalRebuild);
3474 window.removeEventListener(_constant2.default.GLOBAL.SHOW, this.globalShow);
3475 window.removeEventListener('resize', this.onWindowResize);
3476 };
3477
3478 /**
3479 * invoked by resize event of window
3480 */
3481 target.prototype.onWindowResize = function () {
3482 if (!this.mount) return;
3483 this.hideTooltip();
3484 };
3485};
3486
3487
3488
3489var _constant2 = _interopRequireDefault(constant);
3490
3491function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3492});
3493
3494unwrapExports(windowListener);
3495
3496var customEvent = createCommonjsModule(function (module, exports) {
3497
3498Object.defineProperty(exports, "__esModule", {
3499 value: true
3500});
3501
3502exports.default = function (target) {
3503 target.prototype.isCustomEvent = function (ele) {
3504 var event = this.state.event;
3505
3506 return event || !!ele.getAttribute('data-event');
3507 };
3508
3509 /* Bind listener for custom event */
3510 target.prototype.customBindListener = function (ele) {
3511 var _this = this;
3512
3513 var _state = this.state,
3514 event = _state.event,
3515 eventOff = _state.eventOff;
3516
3517 var dataEvent = ele.getAttribute('data-event') || event;
3518 var dataEventOff = ele.getAttribute('data-event-off') || eventOff;
3519
3520 dataEvent.split(' ').forEach(function (event) {
3521 ele.removeEventListener(event, customListeners.get(ele, event));
3522 var customListener = checkStatus.bind(_this, dataEventOff);
3523 customListeners.set(ele, event, customListener);
3524 ele.addEventListener(event, customListener, false);
3525 });
3526 if (dataEventOff) {
3527 dataEventOff.split(' ').forEach(function (event) {
3528 ele.removeEventListener(event, _this.hideTooltip);
3529 ele.addEventListener(event, _this.hideTooltip, false);
3530 });
3531 }
3532 };
3533
3534 /* Unbind listener for custom event */
3535 target.prototype.customUnbindListener = function (ele) {
3536 var _state2 = this.state,
3537 event = _state2.event,
3538 eventOff = _state2.eventOff;
3539
3540 var dataEvent = event || ele.getAttribute('data-event');
3541 var dataEventOff = eventOff || ele.getAttribute('data-event-off');
3542
3543 ele.removeEventListener(dataEvent, customListeners.get(ele, event));
3544 if (dataEventOff) ele.removeEventListener(dataEventOff, this.hideTooltip);
3545 };
3546};
3547
3548function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3549
3550/**
3551 * Custom events to control showing and hiding of tooltip
3552 *
3553 * @attributes
3554 * - `event` {String}
3555 * - `eventOff` {String}
3556 */
3557
3558var checkStatus = function checkStatus(dataEventOff, e) {
3559 var show = this.state.show;
3560 var id = this.props.id;
3561
3562 var dataIsCapture = e.currentTarget.getAttribute('data-iscapture');
3563 var isCapture = dataIsCapture && dataIsCapture === 'true' || this.props.isCapture;
3564 var currentItem = e.currentTarget.getAttribute('currentItem');
3565
3566 if (!isCapture) e.stopPropagation();
3567 if (show && currentItem === 'true') {
3568 if (!dataEventOff) this.hideTooltip(e);
3569 } else {
3570 e.currentTarget.setAttribute('currentItem', 'true');
3571 setUntargetItems(e.currentTarget, this.getTargetArray(id));
3572 this.showTooltip(e);
3573 }
3574};
3575
3576var setUntargetItems = function setUntargetItems(currentTarget, targetArray) {
3577 for (var i = 0; i < targetArray.length; i++) {
3578 if (currentTarget !== targetArray[i]) {
3579 targetArray[i].setAttribute('currentItem', 'false');
3580 } else {
3581 targetArray[i].setAttribute('currentItem', 'true');
3582 }
3583 }
3584};
3585
3586var customListeners = {
3587 id: '9b69f92e-d3fe-498b-b1b4-c5e63a51b0cf',
3588 set: function set(target, event, listener) {
3589 if (this.id in target) {
3590 var map = target[this.id];
3591 map[event] = listener;
3592 } else {
3593 // this is workaround for WeakMap, which is not supported in older browsers, such as IE
3594 Object.defineProperty(target, this.id, {
3595 configurable: true,
3596 value: _defineProperty({}, event, listener)
3597 });
3598 }
3599 },
3600 get: function get(target, event) {
3601 var map = target[this.id];
3602 if (map !== undefined) {
3603 return map[event];
3604 }
3605 }
3606};
3607});
3608
3609unwrapExports(customEvent);
3610
3611var isCapture = createCommonjsModule(function (module, exports) {
3612
3613Object.defineProperty(exports, "__esModule", {
3614 value: true
3615});
3616
3617exports.default = function (target) {
3618 target.prototype.isCapture = function (currentTarget) {
3619 return currentTarget && currentTarget.getAttribute('data-iscapture') === 'true' || this.props.isCapture || false;
3620 };
3621};
3622});
3623
3624unwrapExports(isCapture);
3625
3626var getEffect = createCommonjsModule(function (module, exports) {
3627
3628Object.defineProperty(exports, "__esModule", {
3629 value: true
3630});
3631
3632exports.default = function (target) {
3633 target.prototype.getEffect = function (currentTarget) {
3634 var dataEffect = currentTarget.getAttribute('data-effect');
3635 return dataEffect || this.props.effect || 'float';
3636 };
3637};
3638});
3639
3640unwrapExports(getEffect);
3641
3642var trackRemoval = createCommonjsModule(function (module, exports) {
3643
3644Object.defineProperty(exports, "__esModule", {
3645 value: true
3646});
3647
3648exports.default = function (target) {
3649 target.prototype.bindRemovalTracker = function () {
3650 var _this = this;
3651
3652 var MutationObserver = getMutationObserverClass();
3653 if (MutationObserver == null) return;
3654
3655 var observer = new MutationObserver(function (mutations) {
3656 for (var m1 = 0; m1 < mutations.length; m1++) {
3657 var mutation = mutations[m1];
3658 for (var m2 = 0; m2 < mutation.removedNodes.length; m2++) {
3659 var element = mutation.removedNodes[m2];
3660 if (element === _this.state.currentTarget) {
3661 _this.hideTooltip();
3662 return;
3663 }
3664 }
3665 }
3666 });
3667
3668 observer.observe(window.document, { childList: true, subtree: true });
3669
3670 this.removalTracker = observer;
3671 };
3672
3673 target.prototype.unbindRemovalTracker = function () {
3674 if (this.removalTracker) {
3675 this.removalTracker.disconnect();
3676 this.removalTracker = null;
3677 }
3678 };
3679};
3680
3681/**
3682 * Tracking target removing from DOM.
3683 * It's necessary to hide tooltip when it's target disappears.
3684 * Otherwise, the tooltip would be shown forever until another target
3685 * is triggered.
3686 *
3687 * If MutationObserver is not available, this feature just doesn't work.
3688 */
3689
3690// https://hacks.mozilla.org/2012/05/dom-mutationobserver-reacting-to-dom-changes-without-killing-browser-performance/
3691var getMutationObserverClass = function getMutationObserverClass() {
3692 return window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
3693};
3694});
3695
3696unwrapExports(trackRemoval);
3697
3698var getPosition = createCommonjsModule(function (module, exports) {
3699
3700Object.defineProperty(exports, "__esModule", {
3701 value: true
3702});
3703
3704exports.default = function (e, target, node, place, desiredPlace, effect, offset) {
3705 var _getDimensions = getDimensions(node),
3706 tipWidth = _getDimensions.width,
3707 tipHeight = _getDimensions.height;
3708
3709 var _getDimensions2 = getDimensions(target),
3710 targetWidth = _getDimensions2.width,
3711 targetHeight = _getDimensions2.height;
3712
3713 var _getCurrentOffset = getCurrentOffset(e, target, effect),
3714 mouseX = _getCurrentOffset.mouseX,
3715 mouseY = _getCurrentOffset.mouseY;
3716
3717 var defaultOffset = getDefaultPosition(effect, targetWidth, targetHeight, tipWidth, tipHeight);
3718
3719 var _calculateOffset = calculateOffset(offset),
3720 extraOffset_X = _calculateOffset.extraOffset_X,
3721 extraOffset_Y = _calculateOffset.extraOffset_Y;
3722
3723 var windowWidth = window.innerWidth;
3724 var windowHeight = window.innerHeight;
3725
3726 var _getParent = getParent(node),
3727 parentTop = _getParent.parentTop,
3728 parentLeft = _getParent.parentLeft;
3729
3730 // Get the edge offset of the tooltip
3731
3732
3733 var getTipOffsetLeft = function getTipOffsetLeft(place) {
3734 var offset_X = defaultOffset[place].l;
3735 return mouseX + offset_X + extraOffset_X;
3736 };
3737 var getTipOffsetRight = function getTipOffsetRight(place) {
3738 var offset_X = defaultOffset[place].r;
3739 return mouseX + offset_X + extraOffset_X;
3740 };
3741 var getTipOffsetTop = function getTipOffsetTop(place) {
3742 var offset_Y = defaultOffset[place].t;
3743 return mouseY + offset_Y + extraOffset_Y;
3744 };
3745 var getTipOffsetBottom = function getTipOffsetBottom(place) {
3746 var offset_Y = defaultOffset[place].b;
3747 return mouseY + offset_Y + extraOffset_Y;
3748 };
3749
3750 //
3751 // Functions to test whether the tooltip's sides are inside
3752 // the client window for a given orientation p
3753 //
3754 // _____________
3755 // | | <-- Right side
3756 // | p = 'left' |\
3757 // | |/ |\
3758 // |_____________| |_\ <-- Mouse
3759 // / \ |
3760 // |
3761 // |
3762 // Bottom side
3763 //
3764 var outsideLeft = function outsideLeft(p) {
3765 return getTipOffsetLeft(p) < 0;
3766 };
3767 var outsideRight = function outsideRight(p) {
3768 return getTipOffsetRight(p) > windowWidth;
3769 };
3770 var outsideTop = function outsideTop(p) {
3771 return getTipOffsetTop(p) < 0;
3772 };
3773 var outsideBottom = function outsideBottom(p) {
3774 return getTipOffsetBottom(p) > windowHeight;
3775 };
3776
3777 // Check whether the tooltip with orientation p is completely inside the client window
3778 var outside = function outside(p) {
3779 return outsideLeft(p) || outsideRight(p) || outsideTop(p) || outsideBottom(p);
3780 };
3781 var inside = function inside(p) {
3782 return !outside(p);
3783 };
3784
3785 var placesList = ['top', 'bottom', 'left', 'right'];
3786 var insideList = [];
3787 for (var i = 0; i < 4; i++) {
3788 var p = placesList[i];
3789 if (inside(p)) {
3790 insideList.push(p);
3791 }
3792 }
3793
3794 var isNewState = false;
3795 var newPlace = void 0;
3796 if (inside(desiredPlace) && desiredPlace !== place) {
3797 isNewState = true;
3798 newPlace = desiredPlace;
3799 } else if (insideList.length > 0 && outside(desiredPlace) && outside(place)) {
3800 isNewState = true;
3801 newPlace = insideList[0];
3802 }
3803
3804 if (isNewState) {
3805 return {
3806 isNewState: true,
3807 newState: { place: newPlace }
3808 };
3809 }
3810
3811 return {
3812 isNewState: false,
3813 position: {
3814 left: parseInt(getTipOffsetLeft(place) - parentLeft, 10),
3815 top: parseInt(getTipOffsetTop(place) - parentTop, 10)
3816 }
3817 };
3818};
3819
3820var getDimensions = function getDimensions(node) {
3821 var _node$getBoundingClie = node.getBoundingClientRect(),
3822 height = _node$getBoundingClie.height,
3823 width = _node$getBoundingClie.width;
3824
3825 return {
3826 height: parseInt(height, 10),
3827 width: parseInt(width, 10)
3828 };
3829};
3830
3831// Get current mouse offset
3832/**
3833 * Calculate the position of tooltip
3834 *
3835 * @params
3836 * - `e` {Event} the event of current mouse
3837 * - `target` {Element} the currentTarget of the event
3838 * - `node` {DOM} the react-tooltip object
3839 * - `place` {String} top / right / bottom / left
3840 * - `effect` {String} float / solid
3841 * - `offset` {Object} the offset to default position
3842 *
3843 * @return {Object}
3844 * - `isNewState` {Bool} required
3845 * - `newState` {Object}
3846 * - `position` {Object} {left: {Number}, top: {Number}}
3847 */
3848var getCurrentOffset = function getCurrentOffset(e, currentTarget, effect) {
3849 var boundingClientRect = currentTarget.getBoundingClientRect();
3850 var targetTop = boundingClientRect.top;
3851 var targetLeft = boundingClientRect.left;
3852
3853 var _getDimensions3 = getDimensions(currentTarget),
3854 targetWidth = _getDimensions3.width,
3855 targetHeight = _getDimensions3.height;
3856
3857 if (effect === 'float') {
3858 return {
3859 mouseX: e.clientX,
3860 mouseY: e.clientY
3861 };
3862 }
3863 return {
3864 mouseX: targetLeft + targetWidth / 2,
3865 mouseY: targetTop + targetHeight / 2
3866 };
3867};
3868
3869// List all possibility of tooltip final offset
3870// This is useful in judging if it is necessary for tooltip to switch position when out of window
3871var getDefaultPosition = function getDefaultPosition(effect, targetWidth, targetHeight, tipWidth, tipHeight) {
3872 var top = void 0;
3873 var right = void 0;
3874 var bottom = void 0;
3875 var left = void 0;
3876 var disToMouse = 3;
3877 var triangleHeight = 2;
3878 var cursorHeight = 12; // Optimize for float bottom only, cause the cursor will hide the tooltip
3879
3880 if (effect === 'float') {
3881 top = {
3882 l: -(tipWidth / 2),
3883 r: tipWidth / 2,
3884 t: -(tipHeight + disToMouse + triangleHeight),
3885 b: -disToMouse
3886 };
3887 bottom = {
3888 l: -(tipWidth / 2),
3889 r: tipWidth / 2,
3890 t: disToMouse + cursorHeight,
3891 b: tipHeight + disToMouse + triangleHeight + cursorHeight
3892 };
3893 left = {
3894 l: -(tipWidth + disToMouse + triangleHeight),
3895 r: -disToMouse,
3896 t: -(tipHeight / 2),
3897 b: tipHeight / 2
3898 };
3899 right = {
3900 l: disToMouse,
3901 r: tipWidth + disToMouse + triangleHeight,
3902 t: -(tipHeight / 2),
3903 b: tipHeight / 2
3904 };
3905 } else if (effect === 'solid') {
3906 top = {
3907 l: -(tipWidth / 2),
3908 r: tipWidth / 2,
3909 t: -(targetHeight / 2 + tipHeight + triangleHeight),
3910 b: -(targetHeight / 2)
3911 };
3912 bottom = {
3913 l: -(tipWidth / 2),
3914 r: tipWidth / 2,
3915 t: targetHeight / 2,
3916 b: targetHeight / 2 + tipHeight + triangleHeight
3917 };
3918 left = {
3919 l: -(tipWidth + targetWidth / 2 + triangleHeight),
3920 r: -(targetWidth / 2),
3921 t: -(tipHeight / 2),
3922 b: tipHeight / 2
3923 };
3924 right = {
3925 l: targetWidth / 2,
3926 r: tipWidth + targetWidth / 2 + triangleHeight,
3927 t: -(tipHeight / 2),
3928 b: tipHeight / 2
3929 };
3930 }
3931
3932 return { top: top, bottom: bottom, left: left, right: right };
3933};
3934
3935// Consider additional offset into position calculation
3936var calculateOffset = function calculateOffset(offset) {
3937 var extraOffset_X = 0;
3938 var extraOffset_Y = 0;
3939
3940 if (Object.prototype.toString.apply(offset) === '[object String]') {
3941 offset = JSON.parse(offset.toString().replace(/\'/g, '\"'));
3942 }
3943 for (var key in offset) {
3944 if (key === 'top') {
3945 extraOffset_Y -= parseInt(offset[key], 10);
3946 } else if (key === 'bottom') {
3947 extraOffset_Y += parseInt(offset[key], 10);
3948 } else if (key === 'left') {
3949 extraOffset_X -= parseInt(offset[key], 10);
3950 } else if (key === 'right') {
3951 extraOffset_X += parseInt(offset[key], 10);
3952 }
3953 }
3954
3955 return { extraOffset_X: extraOffset_X, extraOffset_Y: extraOffset_Y };
3956};
3957
3958// Get the offset of the parent elements
3959var getParent = function getParent(currentTarget) {
3960 var currentParent = currentTarget;
3961 while (currentParent) {
3962 if (window.getComputedStyle(currentParent).getPropertyValue('transform') !== 'none') break;
3963 currentParent = currentParent.parentElement;
3964 }
3965
3966 var parentTop = currentParent && currentParent.getBoundingClientRect().top || 0;
3967 var parentLeft = currentParent && currentParent.getBoundingClientRect().left || 0;
3968
3969 return { parentTop: parentTop, parentLeft: parentLeft };
3970};
3971});
3972
3973unwrapExports(getPosition);
3974
3975var getTipContent = createCommonjsModule(function (module, exports) {
3976
3977Object.defineProperty(exports, "__esModule", {
3978 value: true
3979});
3980
3981exports.default = function (tip, children, getContent, multiline) {
3982 if (children) return children;
3983 if (getContent !== undefined && getContent !== null) return getContent; // getContent can be 0, '', etc.
3984 if (getContent === null) return null; // Tip not exist and children is null or undefined
3985
3986 var regexp = /<br\s*\/?>/;
3987 if (!multiline || multiline === 'false' || !regexp.test(tip)) {
3988 // No trim(), so that user can keep their input
3989 return tip;
3990 }
3991
3992 // Multiline tooltip content
3993 return tip.split(regexp).map(function (d, i) {
3994 return _react2.default.createElement(
3995 'span',
3996 { key: i, className: 'multi-line' },
3997 d
3998 );
3999 });
4000};
4001
4002
4003
4004var _react2 = _interopRequireDefault(React__default);
4005
4006function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4007});
4008
4009unwrapExports(getTipContent);
4010
4011var aria = createCommonjsModule(function (module, exports) {
4012
4013Object.defineProperty(exports, "__esModule", {
4014 value: true
4015});
4016exports.parseAria = parseAria;
4017/**
4018 * Support aria- and role in ReactTooltip
4019 *
4020 * @params props {Object}
4021 * @return {Object}
4022 */
4023function parseAria(props) {
4024 var ariaObj = {};
4025 Object.keys(props).filter(function (prop) {
4026 // aria-xxx and role is acceptable
4027 return (/(^aria-\w+$|^role$)/.test(prop)
4028 );
4029 }).forEach(function (prop) {
4030 ariaObj[prop] = props[prop];
4031 });
4032
4033 return ariaObj;
4034}
4035});
4036
4037unwrapExports(aria);
4038var aria_1 = aria.parseAria;
4039
4040var nodeListToArray = createCommonjsModule(function (module, exports) {
4041
4042Object.defineProperty(exports, "__esModule", {
4043 value: true
4044});
4045
4046exports.default = function (nodeList) {
4047 var length = nodeList.length;
4048 if (nodeList.hasOwnProperty) {
4049 return Array.prototype.slice.call(nodeList);
4050 }
4051 return new Array(length).fill().map(function (index) {
4052 return nodeList[index];
4053 });
4054};
4055});
4056
4057unwrapExports(nodeListToArray);
4058
4059var style = createCommonjsModule(function (module, exports) {
4060
4061Object.defineProperty(exports, "__esModule", {
4062 value: true
4063});
4064exports.default = '.__react_component_tooltip{border-radius:3px;display:inline-block;font-size:13px;left:-999em;opacity:0;padding:8px 21px;position:fixed;pointer-events:none;transition:opacity 0.3s ease-out;top:-999em;visibility:hidden;z-index:999}.__react_component_tooltip.allow_hover,.__react_component_tooltip.allow_click{pointer-events:auto}.__react_component_tooltip:before,.__react_component_tooltip:after{content:"";width:0;height:0;position:absolute}.__react_component_tooltip.show{opacity:0.9;margin-top:0px;margin-left:0px;visibility:visible}.__react_component_tooltip.type-dark{color:#fff;background-color:#222}.__react_component_tooltip.type-dark.place-top:after{border-top-color:#222;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-dark.place-bottom:after{border-bottom-color:#222;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-dark.place-left:after{border-left-color:#222;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-dark.place-right:after{border-right-color:#222;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-dark.border{border:1px solid #fff}.__react_component_tooltip.type-dark.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-dark.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-dark.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-dark.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-success{color:#fff;background-color:#8DC572}.__react_component_tooltip.type-success.place-top:after{border-top-color:#8DC572;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-success.place-bottom:after{border-bottom-color:#8DC572;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-success.place-left:after{border-left-color:#8DC572;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-success.place-right:after{border-right-color:#8DC572;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-success.border{border:1px solid #fff}.__react_component_tooltip.type-success.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-success.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-success.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-success.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-warning{color:#fff;background-color:#F0AD4E}.__react_component_tooltip.type-warning.place-top:after{border-top-color:#F0AD4E;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-warning.place-bottom:after{border-bottom-color:#F0AD4E;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-warning.place-left:after{border-left-color:#F0AD4E;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-warning.place-right:after{border-right-color:#F0AD4E;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-warning.border{border:1px solid #fff}.__react_component_tooltip.type-warning.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-warning.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-warning.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-warning.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-error{color:#fff;background-color:#BE6464}.__react_component_tooltip.type-error.place-top:after{border-top-color:#BE6464;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-error.place-bottom:after{border-bottom-color:#BE6464;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-error.place-left:after{border-left-color:#BE6464;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-error.place-right:after{border-right-color:#BE6464;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-error.border{border:1px solid #fff}.__react_component_tooltip.type-error.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-error.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-error.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-error.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-info{color:#fff;background-color:#337AB7}.__react_component_tooltip.type-info.place-top:after{border-top-color:#337AB7;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-info.place-bottom:after{border-bottom-color:#337AB7;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-info.place-left:after{border-left-color:#337AB7;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-info.place-right:after{border-right-color:#337AB7;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-info.border{border:1px solid #fff}.__react_component_tooltip.type-info.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-info.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-info.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-info.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-light{color:#222;background-color:#fff}.__react_component_tooltip.type-light.place-top:after{border-top-color:#fff;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-light.place-bottom:after{border-bottom-color:#fff;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-light.place-left:after{border-left-color:#fff;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-light.place-right:after{border-right-color:#fff;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-light.border{border:1px solid #222}.__react_component_tooltip.type-light.border.place-top:before{border-top:8px solid #222}.__react_component_tooltip.type-light.border.place-bottom:before{border-bottom:8px solid #222}.__react_component_tooltip.type-light.border.place-left:before{border-left:8px solid #222}.__react_component_tooltip.type-light.border.place-right:before{border-right:8px solid #222}.__react_component_tooltip.place-top{margin-top:-10px}.__react_component_tooltip.place-top:before{border-left:10px solid transparent;border-right:10px solid transparent;bottom:-8px;left:50%;margin-left:-10px}.__react_component_tooltip.place-top:after{border-left:8px solid transparent;border-right:8px solid transparent;bottom:-6px;left:50%;margin-left:-8px}.__react_component_tooltip.place-bottom{margin-top:10px}.__react_component_tooltip.place-bottom:before{border-left:10px solid transparent;border-right:10px solid transparent;top:-8px;left:50%;margin-left:-10px}.__react_component_tooltip.place-bottom:after{border-left:8px solid transparent;border-right:8px solid transparent;top:-6px;left:50%;margin-left:-8px}.__react_component_tooltip.place-left{margin-left:-10px}.__react_component_tooltip.place-left:before{border-top:6px solid transparent;border-bottom:6px solid transparent;right:-8px;top:50%;margin-top:-5px}.__react_component_tooltip.place-left:after{border-top:5px solid transparent;border-bottom:5px solid transparent;right:-6px;top:50%;margin-top:-4px}.__react_component_tooltip.place-right{margin-left:10px}.__react_component_tooltip.place-right:before{border-top:6px solid transparent;border-bottom:6px solid transparent;left:-8px;top:50%;margin-top:-5px}.__react_component_tooltip.place-right:after{border-top:5px solid transparent;border-bottom:5px solid transparent;left:-6px;top:50%;margin-top:-4px}.__react_component_tooltip .multi-line{display:block;padding:2px 0px;text-align:center}';
4065});
4066
4067unwrapExports(style);
4068
4069var dist = createCommonjsModule(function (module) {
4070
4071var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
4072
4073var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4074
4075var _class, _class2, _temp;
4076
4077/* Decorators */
4078
4079
4080/* Utils */
4081
4082
4083/* CSS */
4084
4085
4086
4087
4088var _react2 = _interopRequireDefault(React__default);
4089
4090
4091
4092var _propTypes2 = _interopRequireDefault(PropTypes);
4093
4094
4095
4096var _classnames2 = _interopRequireDefault(classnames);
4097
4098
4099
4100var _staticMethods2 = _interopRequireDefault(staticMethods);
4101
4102
4103
4104var _windowListener2 = _interopRequireDefault(windowListener);
4105
4106
4107
4108var _customEvent2 = _interopRequireDefault(customEvent);
4109
4110
4111
4112var _isCapture2 = _interopRequireDefault(isCapture);
4113
4114
4115
4116var _getEffect2 = _interopRequireDefault(getEffect);
4117
4118
4119
4120var _trackRemoval2 = _interopRequireDefault(trackRemoval);
4121
4122
4123
4124var _getPosition2 = _interopRequireDefault(getPosition);
4125
4126
4127
4128var _getTipContent2 = _interopRequireDefault(getTipContent);
4129
4130
4131
4132
4133
4134var _nodeListToArray2 = _interopRequireDefault(nodeListToArray);
4135
4136
4137
4138var _style2 = _interopRequireDefault(style);
4139
4140function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4141
4142function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4143
4144function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
4145
4146function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
4147
4148var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.default)(_class = (0, _customEvent2.default)(_class = (0, _isCapture2.default)(_class = (0, _getEffect2.default)(_class = (0, _trackRemoval2.default)(_class = (_temp = _class2 = function (_React$Component) {
4149 _inherits(ReactTooltip, _React$Component);
4150
4151 function ReactTooltip(props) {
4152 _classCallCheck(this, ReactTooltip);
4153
4154 var _this = _possibleConstructorReturn(this, (ReactTooltip.__proto__ || Object.getPrototypeOf(ReactTooltip)).call(this, props));
4155
4156 _this.state = {
4157 place: props.place || 'top', // Direction of tooltip
4158 desiredPlace: props.place || 'top',
4159 type: 'dark', // Color theme of tooltip
4160 effect: 'float', // float or fixed
4161 show: false,
4162 border: false,
4163 offset: {},
4164 extraClass: '',
4165 html: false,
4166 delayHide: 0,
4167 delayShow: 0,
4168 event: props.event || null,
4169 eventOff: props.eventOff || null,
4170 currentEvent: null, // Current mouse event
4171 currentTarget: null, // Current target of mouse event
4172 ariaProps: (0, aria.parseAria)(props), // aria- and role attributes
4173 isEmptyTip: false,
4174 disable: false,
4175 originTooltip: null,
4176 isMultiline: false
4177 };
4178
4179 _this.bind(['showTooltip', 'updateTooltip', 'hideTooltip', 'hideTooltipOnScroll', 'getTooltipContent', 'globalRebuild', 'globalShow', 'globalHide', 'onWindowResize', 'mouseOnToolTip']);
4180
4181 _this.mount = true;
4182 _this.delayShowLoop = null;
4183 _this.delayHideLoop = null;
4184 _this.delayReshow = null;
4185 _this.intervalUpdateContent = null;
4186 return _this;
4187 }
4188
4189 /**
4190 * For unify the bind and unbind listener
4191 */
4192
4193
4194 _createClass(ReactTooltip, [{
4195 key: 'bind',
4196 value: function bind(methodArray) {
4197 var _this2 = this;
4198
4199 methodArray.forEach(function (method) {
4200 _this2[method] = _this2[method].bind(_this2);
4201 });
4202 }
4203 }, {
4204 key: 'componentDidMount',
4205 value: function componentDidMount() {
4206 var _props = this.props,
4207 insecure = _props.insecure,
4208 resizeHide = _props.resizeHide;
4209
4210 if (insecure) {
4211 this.setStyleHeader(); // Set the style to the <link>
4212 }
4213 this.bindListener(); // Bind listener for tooltip
4214 this.bindWindowEvents(resizeHide); // Bind global event for static method
4215 }
4216 }, {
4217 key: 'componentWillUnmount',
4218 value: function componentWillUnmount() {
4219 this.mount = false;
4220
4221 this.clearTimer();
4222
4223 this.unbindListener();
4224 this.removeScrollListener();
4225 this.unbindWindowEvents();
4226 }
4227
4228 /**
4229 * Return if the mouse is on the tooltip.
4230 * @returns {boolean} true - mouse is on the tooltip
4231 */
4232
4233 }, {
4234 key: 'mouseOnToolTip',
4235 value: function mouseOnToolTip() {
4236 var show = this.state.show;
4237
4238
4239 if (show && this.tooltipRef) {
4240 /* old IE or Firefox work around */
4241 if (!this.tooltipRef.matches) {
4242 /* old IE work around */
4243 if (this.tooltipRef.msMatchesSelector) {
4244 this.tooltipRef.matches = this.tooltipRef.msMatchesSelector;
4245 } else {
4246 /* old Firefox work around */
4247 this.tooltipRef.matches = this.tooltipRef.mozMatchesSelector;
4248 }
4249 }
4250 return this.tooltipRef.matches(':hover');
4251 }
4252 return false;
4253 }
4254 /**
4255 * Pick out corresponded target elements
4256 */
4257
4258 }, {
4259 key: 'getTargetArray',
4260 value: function getTargetArray(id) {
4261 var targetArray = void 0;
4262 if (!id) {
4263 targetArray = document.querySelectorAll('[data-tip]:not([data-for])');
4264 } else {
4265 var escaped = id.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
4266 targetArray = document.querySelectorAll('[data-tip][data-for="' + escaped + '"]');
4267 }
4268 // targetArray is a NodeList, convert it to a real array
4269 return (0, _nodeListToArray2.default)(targetArray);
4270 }
4271
4272 /**
4273 * Bind listener to the target elements
4274 * These listeners used to trigger showing or hiding the tooltip
4275 */
4276
4277 }, {
4278 key: 'bindListener',
4279 value: function bindListener() {
4280 var _this3 = this;
4281
4282 var _props2 = this.props,
4283 id = _props2.id,
4284 globalEventOff = _props2.globalEventOff,
4285 isCapture$$1 = _props2.isCapture;
4286
4287 var targetArray = this.getTargetArray(id);
4288
4289 targetArray.forEach(function (target) {
4290 var isCaptureMode = _this3.isCapture(target);
4291 var effect = _this3.getEffect(target);
4292 if (target.getAttribute('currentItem') === null) {
4293 target.setAttribute('currentItem', 'false');
4294 }
4295 _this3.unbindBasicListener(target);
4296
4297 if (_this3.isCustomEvent(target)) {
4298 _this3.customBindListener(target);
4299 return;
4300 }
4301
4302 target.addEventListener('mouseenter', _this3.showTooltip, isCaptureMode);
4303 if (effect === 'float') {
4304 target.addEventListener('mousemove', _this3.updateTooltip, isCaptureMode);
4305 }
4306 target.addEventListener('mouseleave', _this3.hideTooltip, isCaptureMode);
4307 });
4308
4309 // Global event to hide tooltip
4310 if (globalEventOff) {
4311 window.removeEventListener(globalEventOff, this.hideTooltip);
4312 window.addEventListener(globalEventOff, this.hideTooltip, isCapture$$1);
4313 }
4314
4315 // Track removal of targetArray elements from DOM
4316 this.bindRemovalTracker();
4317 }
4318
4319 /**
4320 * Unbind listeners on target elements
4321 */
4322
4323 }, {
4324 key: 'unbindListener',
4325 value: function unbindListener() {
4326 var _this4 = this;
4327
4328 var _props3 = this.props,
4329 id = _props3.id,
4330 globalEventOff = _props3.globalEventOff;
4331
4332 var targetArray = this.getTargetArray(id);
4333 targetArray.forEach(function (target) {
4334 _this4.unbindBasicListener(target);
4335 if (_this4.isCustomEvent(target)) _this4.customUnbindListener(target);
4336 });
4337
4338 if (globalEventOff) window.removeEventListener(globalEventOff, this.hideTooltip);
4339 this.unbindRemovalTracker();
4340 }
4341
4342 /**
4343 * Invoke this before bind listener and unmount the component
4344 * it is necessary to invoke this even when binding custom event
4345 * so that the tooltip can switch between custom and default listener
4346 */
4347
4348 }, {
4349 key: 'unbindBasicListener',
4350 value: function unbindBasicListener(target) {
4351 var isCaptureMode = this.isCapture(target);
4352 target.removeEventListener('mouseenter', this.showTooltip, isCaptureMode);
4353 target.removeEventListener('mousemove', this.updateTooltip, isCaptureMode);
4354 target.removeEventListener('mouseleave', this.hideTooltip, isCaptureMode);
4355 }
4356 }, {
4357 key: 'getTooltipContent',
4358 value: function getTooltipContent() {
4359 var _props4 = this.props,
4360 getContent = _props4.getContent,
4361 children = _props4.children;
4362
4363 // Generate tooltip content
4364
4365 var content = void 0;
4366 if (getContent) {
4367 if (Array.isArray(getContent)) {
4368 content = getContent[0] && getContent[0](this.state.originTooltip);
4369 } else {
4370 content = getContent(this.state.originTooltip);
4371 }
4372 }
4373
4374 return (0, _getTipContent2.default)(this.state.originTooltip, children, content, this.state.isMultiline);
4375 }
4376 }, {
4377 key: 'isEmptyTip',
4378 value: function isEmptyTip(placeholder) {
4379 return typeof placeholder === 'string' && placeholder === '' || placeholder === null;
4380 }
4381
4382 /**
4383 * When mouse enter, show the tooltip
4384 */
4385
4386 }, {
4387 key: 'showTooltip',
4388 value: function showTooltip(e, isGlobalCall) {
4389 if (isGlobalCall) {
4390 // Don't trigger other elements belongs to other ReactTooltip
4391 var targetArray = this.getTargetArray(this.props.id);
4392 var isMyElement = targetArray.some(function (ele) {
4393 return ele === e.currentTarget;
4394 });
4395 if (!isMyElement) return;
4396 }
4397 // Get the tooltip content
4398 // calculate in this phrase so that tip width height can be detected
4399 var _props5 = this.props,
4400 multiline = _props5.multiline,
4401 getContent = _props5.getContent;
4402
4403 var originTooltip = e.currentTarget.getAttribute('data-tip');
4404 var isMultiline = e.currentTarget.getAttribute('data-multiline') || multiline || false;
4405
4406 // If it is focus event or called by ReactTooltip.show, switch to `solid` effect
4407 var switchToSolid = e instanceof window.FocusEvent || isGlobalCall;
4408
4409 // if it needs to skip adding hide listener to scroll
4410 var scrollHide = true;
4411 if (e.currentTarget.getAttribute('data-scroll-hide')) {
4412 scrollHide = e.currentTarget.getAttribute('data-scroll-hide') === 'true';
4413 } else if (this.props.scrollHide != null) {
4414 scrollHide = this.props.scrollHide;
4415 }
4416
4417 // Make sure the correct place is set
4418 var desiredPlace = e.currentTarget.getAttribute('data-place') || this.props.place || 'top';
4419 var effect = switchToSolid && 'solid' || this.getEffect(e.currentTarget);
4420 var offset = e.currentTarget.getAttribute('data-offset') || this.props.offset || {};
4421 var result = (0, _getPosition2.default)(e, e.currentTarget, this.tooltipRef, desiredPlace, desiredPlace, effect, offset);
4422 if (result.position && this.props.overridePosition) {
4423 result.position = this.props.overridePosition(result.position, e.currentTarget, this.tooltipRef, desiredPlace, desiredPlace, effect, offset);
4424 }
4425
4426 var place = result.isNewState ? result.newState.place : desiredPlace;
4427
4428 // To prevent previously created timers from triggering
4429 this.clearTimer();
4430
4431 var target = e.currentTarget;
4432
4433 var reshowDelay = this.state.show ? target.getAttribute('data-delay-update') || this.props.delayUpdate : 0;
4434
4435 var self = this;
4436
4437 var updateState = function updateState() {
4438 self.setState({
4439 originTooltip: originTooltip,
4440 isMultiline: isMultiline,
4441 desiredPlace: desiredPlace,
4442 place: place,
4443 type: target.getAttribute('data-type') || self.props.type || 'dark',
4444 effect: effect,
4445 offset: offset,
4446 html: target.getAttribute('data-html') ? target.getAttribute('data-html') === 'true' : self.props.html || false,
4447 delayShow: target.getAttribute('data-delay-show') || self.props.delayShow || 0,
4448 delayHide: target.getAttribute('data-delay-hide') || self.props.delayHide || 0,
4449 delayUpdate: target.getAttribute('data-delay-update') || self.props.delayUpdate || 0,
4450 border: target.getAttribute('data-border') ? target.getAttribute('data-border') === 'true' : self.props.border || false,
4451 extraClass: target.getAttribute('data-class') || self.props.class || self.props.className || '',
4452 disable: target.getAttribute('data-tip-disable') ? target.getAttribute('data-tip-disable') === 'true' : self.props.disable || false,
4453 currentTarget: target
4454 }, function () {
4455 if (scrollHide) self.addScrollListener(self.state.currentTarget);
4456 self.updateTooltip(e);
4457
4458 if (getContent && Array.isArray(getContent)) {
4459 self.intervalUpdateContent = setInterval(function () {
4460 if (self.mount) {
4461 var _getContent = self.props.getContent;
4462
4463 var placeholder = (0, _getTipContent2.default)(originTooltip, '', _getContent[0](), isMultiline);
4464 var isEmptyTip = self.isEmptyTip(placeholder);
4465 self.setState({
4466 isEmptyTip: isEmptyTip
4467 });
4468 self.updatePosition();
4469 }
4470 }, getContent[1]);
4471 }
4472 });
4473 };
4474
4475 // If there is no delay call immediately, don't allow events to get in first.
4476 if (reshowDelay) {
4477 this.delayReshow = setTimeout(updateState, reshowDelay);
4478 } else {
4479 updateState();
4480 }
4481 }
4482
4483 /**
4484 * When mouse hover, update tool tip
4485 */
4486
4487 }, {
4488 key: 'updateTooltip',
4489 value: function updateTooltip(e) {
4490 var _this5 = this;
4491
4492 var _state = this.state,
4493 delayShow = _state.delayShow,
4494 disable = _state.disable;
4495 var afterShow = this.props.afterShow;
4496
4497 var placeholder = this.getTooltipContent();
4498 var delayTime = parseInt(delayShow, 10);
4499 var eventTarget = e.currentTarget || e.target;
4500
4501 // Check if the mouse is actually over the tooltip, if so don't hide the tooltip
4502 if (this.mouseOnToolTip()) {
4503 return;
4504 }
4505
4506 if (this.isEmptyTip(placeholder) || disable) return; // if the tooltip is empty, disable the tooltip
4507 var updateState = function updateState() {
4508 if (Array.isArray(placeholder) && placeholder.length > 0 || placeholder) {
4509 var isInvisible = !_this5.state.show;
4510 _this5.setState({
4511 currentEvent: e,
4512 currentTarget: eventTarget,
4513 show: true
4514 }, function () {
4515 _this5.updatePosition();
4516 if (isInvisible && afterShow) afterShow(e);
4517 });
4518 }
4519 };
4520
4521 clearTimeout(this.delayShowLoop);
4522 if (delayShow) {
4523 this.delayShowLoop = setTimeout(updateState, delayTime);
4524 } else {
4525 updateState();
4526 }
4527 }
4528
4529 /*
4530 * If we're mousing over the tooltip remove it when we leave.
4531 */
4532
4533 }, {
4534 key: 'listenForTooltipExit',
4535 value: function listenForTooltipExit() {
4536 var show = this.state.show;
4537
4538
4539 if (show && this.tooltipRef) {
4540 this.tooltipRef.addEventListener('mouseleave', this.hideTooltip);
4541 }
4542 }
4543 }, {
4544 key: 'removeListenerForTooltipExit',
4545 value: function removeListenerForTooltipExit() {
4546 var show = this.state.show;
4547
4548
4549 if (show && this.tooltipRef) {
4550 this.tooltipRef.removeEventListener('mouseleave', this.hideTooltip);
4551 }
4552 }
4553
4554 /**
4555 * When mouse leave, hide tooltip
4556 */
4557
4558 }, {
4559 key: 'hideTooltip',
4560 value: function hideTooltip(e, hasTarget) {
4561 var _this6 = this;
4562
4563 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { isScroll: false };
4564 var disable = this.state.disable;
4565 var isScroll = options.isScroll;
4566
4567 var delayHide = isScroll ? 0 : this.state.delayHide;
4568 var afterHide = this.props.afterHide;
4569
4570 var placeholder = this.getTooltipContent();
4571 if (!this.mount) return;
4572 if (this.isEmptyTip(placeholder) || disable) return; // if the tooltip is empty, disable the tooltip
4573 if (hasTarget) {
4574 // Don't trigger other elements belongs to other ReactTooltip
4575 var targetArray = this.getTargetArray(this.props.id);
4576 var isMyElement = targetArray.some(function (ele) {
4577 return ele === e.currentTarget;
4578 });
4579 if (!isMyElement || !this.state.show) return;
4580 }
4581
4582 var resetState = function resetState() {
4583 var isVisible = _this6.state.show;
4584 // Check if the mouse is actually over the tooltip, if so don't hide the tooltip
4585 if (_this6.mouseOnToolTip()) {
4586 _this6.listenForTooltipExit();
4587 return;
4588 }
4589 _this6.removeListenerForTooltipExit();
4590
4591 _this6.setState({
4592 show: false
4593 }, function () {
4594 _this6.removeScrollListener();
4595 if (isVisible && afterHide) afterHide(e);
4596 });
4597 };
4598
4599 this.clearTimer();
4600 if (delayHide) {
4601 this.delayHideLoop = setTimeout(resetState, parseInt(delayHide, 10));
4602 } else {
4603 resetState();
4604 }
4605 }
4606
4607 /**
4608 * When scroll, hide tooltip
4609 */
4610
4611 }, {
4612 key: 'hideTooltipOnScroll',
4613 value: function hideTooltipOnScroll(event, hasTarget) {
4614 this.hideTooltip(event, hasTarget, { isScroll: true });
4615 }
4616
4617 /**
4618 * Add scroll event listener when tooltip show
4619 * automatically hide the tooltip when scrolling
4620 */
4621
4622 }, {
4623 key: 'addScrollListener',
4624 value: function addScrollListener(currentTarget) {
4625 var isCaptureMode = this.isCapture(currentTarget);
4626 window.addEventListener('scroll', this.hideTooltipOnScroll, isCaptureMode);
4627 }
4628 }, {
4629 key: 'removeScrollListener',
4630 value: function removeScrollListener() {
4631 window.removeEventListener('scroll', this.hideTooltipOnScroll);
4632 }
4633
4634 // Calculation the position
4635
4636 }, {
4637 key: 'updatePosition',
4638 value: function updatePosition() {
4639 var _this7 = this;
4640
4641 var _state2 = this.state,
4642 currentEvent = _state2.currentEvent,
4643 currentTarget = _state2.currentTarget,
4644 place = _state2.place,
4645 desiredPlace = _state2.desiredPlace,
4646 effect = _state2.effect,
4647 offset = _state2.offset;
4648
4649 var node = this.tooltipRef;
4650 var result = (0, _getPosition2.default)(currentEvent, currentTarget, node, place, desiredPlace, effect, offset);
4651 if (result.position && this.props.overridePosition) {
4652 result.position = this.props.overridePosition(result.position, currentEvent, currentTarget, node, place, desiredPlace, effect, offset);
4653 }
4654
4655 if (result.isNewState) {
4656 // Switch to reverse placement
4657 return this.setState(result.newState, function () {
4658 _this7.updatePosition();
4659 });
4660 }
4661 // Set tooltip position
4662 node.style.left = result.position.left + 'px';
4663 node.style.top = result.position.top + 'px';
4664 }
4665
4666 /**
4667 * Set style tag in header
4668 * in this way we can insert default css
4669 */
4670
4671 }, {
4672 key: 'setStyleHeader',
4673 value: function setStyleHeader() {
4674 var head = document.getElementsByTagName('head')[0];
4675 if (!head.querySelector('style[id="react-tooltip"]')) {
4676 var tag = document.createElement('style');
4677 tag.id = 'react-tooltip';
4678 tag.innerHTML = _style2.default;
4679 /* eslint-disable */
4680 if (typeof __webpack_nonce__ !== 'undefined' && __webpack_nonce__) {
4681 tag.setAttribute('nonce', __webpack_nonce__);
4682 }
4683 /* eslint-enable */
4684 head.insertBefore(tag, head.firstChild);
4685 }
4686 }
4687
4688 /**
4689 * CLear all kinds of timeout of interval
4690 */
4691
4692 }, {
4693 key: 'clearTimer',
4694 value: function clearTimer() {
4695 clearTimeout(this.delayShowLoop);
4696 clearTimeout(this.delayHideLoop);
4697 clearTimeout(this.delayReshow);
4698 clearInterval(this.intervalUpdateContent);
4699 }
4700 }, {
4701 key: 'render',
4702 value: function render() {
4703 var _this8 = this;
4704
4705 var _state3 = this.state,
4706 extraClass = _state3.extraClass,
4707 html = _state3.html,
4708 ariaProps = _state3.ariaProps,
4709 disable = _state3.disable;
4710
4711 var placeholder = this.getTooltipContent();
4712 var isEmptyTip = this.isEmptyTip(placeholder);
4713 var tooltipClass = (0, _classnames2.default)('__react_component_tooltip', { 'show': this.state.show && !disable && !isEmptyTip }, { 'border': this.state.border }, { 'place-top': this.state.place === 'top' }, { 'place-bottom': this.state.place === 'bottom' }, { 'place-left': this.state.place === 'left' }, { 'place-right': this.state.place === 'right' }, { 'type-dark': this.state.type === 'dark' }, { 'type-success': this.state.type === 'success' }, { 'type-warning': this.state.type === 'warning' }, { 'type-error': this.state.type === 'error' }, { 'type-info': this.state.type === 'info' }, { 'type-light': this.state.type === 'light' }, { 'allow_hover': this.props.delayUpdate }, { 'allow_click': this.props.clickable });
4714
4715 var Wrapper = this.props.wrapper;
4716 if (ReactTooltip.supportedWrappers.indexOf(Wrapper) < 0) {
4717 Wrapper = ReactTooltip.defaultProps.wrapper;
4718 }
4719
4720 if (html) {
4721 return _react2.default.createElement(Wrapper, _extends({ className: tooltipClass + ' ' + extraClass,
4722 id: this.props.id,
4723 ref: function ref(_ref) {
4724 return _this8.tooltipRef = _ref;
4725 }
4726 }, ariaProps, {
4727 'data-id': 'tooltip',
4728 dangerouslySetInnerHTML: { __html: placeholder } }));
4729 } else {
4730 return _react2.default.createElement(
4731 Wrapper,
4732 _extends({ className: tooltipClass + ' ' + extraClass,
4733 id: this.props.id
4734 }, ariaProps, {
4735 ref: function ref(_ref2) {
4736 return _this8.tooltipRef = _ref2;
4737 },
4738 'data-id': 'tooltip' }),
4739 placeholder
4740 );
4741 }
4742 }
4743 }], [{
4744 key: 'getDerivedStateFromProps',
4745 value: function getDerivedStateFromProps(nextProps, prevState) {
4746 var ariaProps = prevState.ariaProps;
4747
4748 var newAriaProps = (0, aria.parseAria)(nextProps);
4749 var isChanged = Object.keys(newAriaProps).some(function (props) {
4750 return newAriaProps[props] !== ariaProps[props];
4751 });
4752 if (!isChanged) {
4753 return null;
4754 }
4755 return _extends({}, prevState, {
4756 ariaProps: newAriaProps
4757 });
4758 }
4759 }]);
4760
4761 return ReactTooltip;
4762}(_react2.default.Component), _class2.propTypes = {
4763 children: _propTypes2.default.any,
4764 place: _propTypes2.default.string,
4765 type: _propTypes2.default.string,
4766 effect: _propTypes2.default.string,
4767 offset: _propTypes2.default.object,
4768 multiline: _propTypes2.default.bool,
4769 border: _propTypes2.default.bool,
4770 insecure: _propTypes2.default.bool,
4771 class: _propTypes2.default.string,
4772 className: _propTypes2.default.string,
4773 id: _propTypes2.default.string,
4774 html: _propTypes2.default.bool,
4775 delayHide: _propTypes2.default.number,
4776 delayUpdate: _propTypes2.default.number,
4777 delayShow: _propTypes2.default.number,
4778 event: _propTypes2.default.string,
4779 eventOff: _propTypes2.default.string,
4780 watchWindow: _propTypes2.default.bool,
4781 isCapture: _propTypes2.default.bool,
4782 globalEventOff: _propTypes2.default.string,
4783 getContent: _propTypes2.default.any,
4784 afterShow: _propTypes2.default.func,
4785 afterHide: _propTypes2.default.func,
4786 overridePosition: _propTypes2.default.func,
4787 disable: _propTypes2.default.bool,
4788 scrollHide: _propTypes2.default.bool,
4789 resizeHide: _propTypes2.default.bool,
4790 wrapper: _propTypes2.default.string,
4791 clickable: _propTypes2.default.bool
4792}, _class2.defaultProps = {
4793 insecure: true,
4794 resizeHide: true,
4795 wrapper: 'div',
4796 clickable: false
4797}, _class2.supportedWrappers = ['div', 'span'], _class2.displayName = 'ReactTooltip', _temp)) || _class) || _class) || _class) || _class) || _class) || _class;
4798
4799/* export default not fit for standalone, it will exports {default:...} */
4800
4801
4802module.exports = ReactTooltip;
4803});
4804
4805var ReactTooltip = unwrapExports(dist);
4806
4807function _templateObject$q() {
4808 var data = taggedTemplateLiteralLoose(["\n\tbackground-color: ", ";\n\n\t&&&&.qube-tooltip:after {\n\t\tborder-top-color: ", ";\n\t\tborder-right-color: ", ";\n\t\tborder-bottom-color: ", ";\n\t\tborder-left-color: ", ";\n\t}\n\n\t&&&&.qube-tooltip {\n\t\tpadding: 12px;\n\n\t\tanimation: fadein 0.5s;\n\t\tbackground-color: ", ";\n\t\tborder-radius: none;\n\t\tbox-shadow: 1px 1px 4px rgba(0, 0, 0, 0.25);\n\t\tcolor: #fff;\n\t\tline-height: 18px;\n\t\topacity: 1;\n\t}\n"]);
4809
4810 _templateObject$q = function _templateObject() {
4811 return data;
4812 };
4813
4814 return data;
4815}
4816var StyledTooltip = styled__default(ReactTooltip)(_templateObject$q(), function (_ref) {
4817 var theme = _ref.theme;
4818 return theme.colors.darkGray;
4819}, function (_ref2) {
4820 var theme = _ref2.theme,
4821 place = _ref2.place;
4822 return place === 'top' ? theme.colors.darkGray : '';
4823}, function (_ref3) {
4824 var theme = _ref3.theme,
4825 place = _ref3.place;
4826 return place === 'right' ? theme.colors.darkGray : '';
4827}, function (_ref4) {
4828 var theme = _ref4.theme,
4829 place = _ref4.place;
4830 return place === 'bottom' ? theme.colors.darkGray : '';
4831}, function (_ref5) {
4832 var theme = _ref5.theme,
4833 place = _ref5.place;
4834 return place === 'left' ? theme.colors.darkGray : '';
4835}, function (_ref6) {
4836 var theme = _ref6.theme;
4837 return theme.colors.darkGray;
4838});
4839StyledTooltip.defaultProps = {
4840 effect: 'solid',
4841 className: 'qube-tooltip',
4842 suppressClassNameWarning: true
4843};
4844StyledTooltip.propTypes = {
4845 id: PropTypes.string.isRequired,
4846 text: PropTypes.string,
4847 place: PropTypes.oneOf(['top', 'bottom', 'left', 'right']),
4848 multiline: PropTypes.bool,
4849
4850 /** Supress styled component class name warning */
4851 suppressClassNameWarning: PropTypes.bool
4852};
4853StyledTooltip.displayName = 'StyledTooltip';
4854
4855function _templateObject$r() {
4856 var data = taggedTemplateLiteralLoose(["\n\tcursor: help;\n"]);
4857
4858 _templateObject$r = function _templateObject() {
4859 return data;
4860 };
4861
4862 return data;
4863}
4864
4865var HelpTooltip = function HelpTooltip(_ref) {
4866 var id = _ref.id,
4867 text = _ref.text,
4868 place = _ref.place,
4869 multiline = _ref.multiline,
4870 icon = _ref.icon,
4871 color = _ref.color,
4872 disabled = _ref.disabled;
4873 return React__default.createElement(React.Fragment, null, React__default.createElement(IconStyled$1, {
4874 icon: icon,
4875 color: color,
4876 "data-tip": text,
4877 "data-for": id,
4878 disabled: disabled
4879 }), React__default.createElement(StyledTooltip, {
4880 id: id,
4881 place: place,
4882 multiline: multiline
4883 }));
4884};
4885
4886var IconStyled$1 = styled__default(Icon)(_templateObject$r());
4887IconStyled$1.displayName = 'IconStyled';
4888HelpTooltip.defaultProps = {
4889 icon: 'management',
4890 color: '#EC8222',
4891 place: 'top',
4892 multiline: false,
4893 disabled: false
4894};
4895HelpTooltip.propTypes = {
4896 id: PropTypes.string.isRequired,
4897 text: PropTypes.string.isRequired,
4898 place: PropTypes.oneOf(['top', 'bottom', 'left', 'right']),
4899 icon: PropTypes.oneOf(IconName),
4900 color: PropTypes.string,
4901 multiline: PropTypes.bool,
4902 disabled: PropTypes.bool
4903};
4904HelpTooltip.displayName = 'HelpTooltip';
4905
4906var Tooltip = function Tooltip(_ref) {
4907 var id = _ref.id,
4908 place = _ref.place,
4909 trigger = _ref.trigger,
4910 multiline = _ref.multiline,
4911 props = objectWithoutPropertiesLoose(_ref, ["id", "place", "trigger", "multiline"]);
4912
4913 return React__default.createElement(React.Fragment, null, trigger, React__default.createElement(StyledTooltip, _extends_1({}, props, {
4914 id: id,
4915 place: place,
4916 multiline: multiline,
4917 effect: "solid"
4918 })));
4919};
4920
4921Tooltip.defaultProps = {
4922 multiline: false,
4923 place: 'bottom'
4924};
4925Tooltip.propTypes = {
4926 id: PropTypes.string.isRequired,
4927 trigger: PropTypes.object.isRequired,
4928 place: PropTypes.oneOf(['top', 'bottom', 'left', 'right']),
4929 multiline: PropTypes.bool
4930};
4931Tooltip.displayName = 'Tooltip';
4932
4933var spanTrigger = React__default.createElement("span", {
4934 "data-tip": "Tooltip Example",
4935 "data-for": "spanTrigger"
4936}, "Default tooltip");
4937var iconTrigger = React__default.createElement(Icon, {
4938 icon: "management",
4939 "data-tip": "Tooltip <br/> Example",
4940 "data-for": "iconTrigger"
4941});
4942var buttonTrigger = React__default.createElement(Button, {
4943 icon: "add",
4944 content: "Example on a button",
4945 "data-tip": "Tooltip place top",
4946 "data-for": "buttonTrigger"
4947});
4948
4949var TooltipExample = function TooltipExample() {
4950 return React__default.createElement("div", null, React__default.createElement(semanticUiReact.Header, {
4951 as: "h1"
4952 }, "Tooltip"), React__default.createElement(semanticUiReact.Divider, null), React__default.createElement(semanticUiReact.Grid, {
4953 columns: 4,
4954 padded: true
4955 }, React__default.createElement(semanticUiReact.Grid.Row, null), React__default.createElement(semanticUiReact.Grid.Row, null, React__default.createElement(semanticUiReact.Grid.Column, null, React__default.createElement(Tooltip, {
4956 trigger: spanTrigger,
4957 id: "spanTrigger"
4958 })), React__default.createElement(semanticUiReact.Grid.Column, null, "Multiline text", React__default.createElement(Tooltip, {
4959 trigger: iconTrigger,
4960 id: "iconTrigger",
4961 multiline: true
4962 })), React__default.createElement(semanticUiReact.Grid.Column, null, React__default.createElement(Tooltip, {
4963 trigger: buttonTrigger,
4964 id: "buttonTrigger",
4965 place: "top"
4966 }))), React__default.createElement(semanticUiReact.Grid.Row, null), React__default.createElement(semanticUiReact.Grid.Row, null)));
4967};
4968
4969function _templateObject$s() {
4970 var data = taggedTemplateLiteralLoose(["\n\t&&&& > .active.item,\n\t&&&& > .active.item:hover {\n\t\tborder-color: ", " !important;\n\t\tcolor: ", " !important;\n\t}\n\n\t&&&& > .item:focus {\n\t\toutline: none !important;\n\t}\n\n\t&&&& > .item:hover {\n\t\tcolor: ", " !important;\n\t}\n\n\t&&&& > a[type='ellipsisItem'] {\n\t\tpointer-events: none;\n\t}\n"]);
4971
4972 _templateObject$s = function _templateObject() {
4973 return data;
4974 };
4975
4976 return data;
4977}
4978var PaginationStyled = styled__default(function (_ref) {
4979 var activeColor = _ref.activeColor,
4980 props = objectWithoutPropertiesLoose(_ref, ["activeColor"]);
4981
4982 return React__default.createElement(semanticUiReact.Pagination, props);
4983})(_templateObject$s(), function (_ref2) {
4984 var activeColor = _ref2.activeColor;
4985 return activeColor;
4986}, function (_ref3) {
4987 var activeColor = _ref3.activeColor;
4988 return activeColor;
4989}, function (_ref4) {
4990 var activeColor = _ref4.activeColor;
4991 return activeColor;
4992});
4993
4994var Pagination = function Pagination(_ref5) {
4995 var activePage = _ref5.activePage,
4996 totalPages = _ref5.totalPages,
4997 onPageChange = _ref5.onPageChange,
4998 activeColor = _ref5.activeColor,
4999 props = objectWithoutPropertiesLoose(_ref5, ["activePage", "totalPages", "onPageChange", "activeColor"]);
5000
5001 return React__default.createElement(PaginationStyled, _extends_1({
5002 activePage: activePage,
5003 firstItem: null,
5004 onPageChange: onPageChange,
5005 lastItem: null,
5006 pointing: true,
5007 secondary: true,
5008 activeColor: activeColor,
5009 nextItem: {
5010 content: React__default.createElement(Icon, {
5011 icon: "select-right",
5012 color: theme.colors.activeBlue
5013 }),
5014 icon: true
5015 },
5016 prevItem: {
5017 content: React__default.createElement(Icon, {
5018 icon: "select-left",
5019 color: theme.colors.activeBlue
5020 }),
5021 icon: true
5022 },
5023 ellipsisItem: {
5024 content: React__default.createElement(semanticUiReact.Icon, {
5025 name: "ellipsis horizontal"
5026 }),
5027 icon: true
5028 },
5029 totalPages: totalPages
5030 }, props));
5031};
5032
5033Pagination.defaultProps = {
5034 activeColor: theme.colors.activeBlue
5035};
5036Pagination.displayName = 'Pagination';
5037Pagination.propTypes = {
5038 /** Current page */
5039 activePage: PropTypes.number.isRequired,
5040
5041 /** Total number of pages */
5042 totalPages: PropTypes.number.isRequired,
5043
5044 /** Page change handler, return page number */
5045 onPageChange: PropTypes.func.isRequired,
5046
5047 /** color for the icons and active text */
5048 activeColor: PropTypes.string
5049};
5050
5051// export Foo and Bar as named exports
5052
5053function _templateObject$t() {
5054 var data = taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tcursor: ", " !important;\n\topacity: 1 !important;\n\n\ti.icon {\n\t\tcolor: ", " !important;\n\t\topacity: 1 !important;\n\t\ttransition: none !important;\n\t}\n\n\t&&& input {\n\t\tpadding: 8px;\n\t\tborder-color: ", ";\n\t\tborder-radius: 4px;\n\t\tcolor: ", ";\n\n\t\t:focus {\n\t\t\tborder-color: ", ";\n\t\t}\n\n\t\t::placeholder {\n\t\t\tcolor: ", ";\n\t\t\tuser-select: none;\n\t\t}\n\t}\n\n\t.label {\n\t\tborder-radius: 0 ", " ", " 0 !important;\n\t}\n\n\t:focus-within ::placeholder {\n\t\tcolor: ", " !important;\n\t}\n\n\t:focus-within i {\n\t\tcolor: ", " !important;\n\t}\n"]);
5055
5056 _templateObject$t = function _templateObject() {
5057 return data;
5058 };
5059
5060 return data;
5061}
5062var Input = styled__default(semanticUiReact.Input)(_templateObject$t(), function (_ref) {
5063 var disabled = _ref.disabled;
5064 return disabled ? 'not-allowed' : 'pointer';
5065}, function (_ref2) {
5066 var theme = _ref2.theme,
5067 disabled = _ref2.disabled;
5068 return disabled ? theme.colors.strokeGray : theme.colors.mediumGray;
5069}, function (_ref3) {
5070 var theme = _ref3.theme,
5071 error = _ref3.error;
5072 return error ? theme.colors.red : theme.colors.strokeGray;
5073}, function (_ref4) {
5074 var theme = _ref4.theme,
5075 disabled = _ref4.disabled;
5076 return disabled ? theme.colors.strokeGray : theme.colors.darkGray;
5077}, function (_ref5) {
5078 var theme = _ref5.theme;
5079 return theme.colors.activeBlue;
5080}, function (_ref6) {
5081 var theme = _ref6.theme,
5082 disabled = _ref6.disabled;
5083 return disabled ? theme.colors.strokeGray : theme.colors.gray;
5084}, function (_ref7) {
5085 var theme = _ref7.theme;
5086 return theme.input.borderRadius;
5087}, function (_ref8) {
5088 var theme = _ref8.theme;
5089 return theme.input.borderRadius;
5090}, function (_ref9) {
5091 var theme = _ref9.theme;
5092 return theme.colors.mediumGray;
5093}, function (_ref10) {
5094 var theme = _ref10.theme;
5095 return theme.colors.activeBlue;
5096});
5097Input.displayName = 'Input';
5098
5099function _templateObject$u() {
5100 var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-block !important;\n\tcolor: ", ";\n\tcursor: pointer;\n\tfloat: right !important;\n\tfont-size: 11px !important;\n\tfont-style: normal !important;\n\tfont-weight: normal !important;\n\tline-height: normal !important;\n\ttext-align: right !important;\n"]);
5101
5102 _templateObject$u = function _templateObject() {
5103 return data;
5104 };
5105
5106 return data;
5107}
5108var LabelLink = styled__default.div(_templateObject$u(), function (_ref) {
5109 var theme = _ref.theme,
5110 disabled = _ref.disabled;
5111 return disabled ? theme.colors.strokeGray : theme.colors.activeBlue;
5112});
5113LabelLink.defaultProps = {
5114 disabled: false
5115};
5116LabelLink.propTypes = {
5117 /** Bool for the disabled state */
5118 disabled: PropTypes.bool
5119};
5120LabelLink.displayName = 'LabelLink';
5121
5122function _templateObject$v() {
5123 var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\ttop: -2px;\n\n\tmargin-right: 9px !important;\n\tmargin-bottom: 3px !important;\n\n\tcolor: ", ";\n\tfloat: left !important;\n\tfont-size: 16px !important;\n"]);
5124
5125 _templateObject$v = function _templateObject() {
5126 return data;
5127 };
5128
5129 return data;
5130}
5131var InputIcon = styled__default(Icon)(_templateObject$v(), function (_ref) {
5132 var theme = _ref.theme,
5133 disabled = _ref.disabled;
5134 return disabled ? theme.colors.strokeGray : theme.colors.mediumGray;
5135});
5136InputIcon.defaultProps = {
5137 disabled: false
5138};
5139InputIcon.propTypes = {
5140 /** Bool for the disabled state */
5141 disabled: PropTypes.bool
5142};
5143InputIcon.displayName = 'IconInput';
5144
5145var ErrorText = function ErrorText(props) {
5146 return React__default.createElement(Text, _extends_1({
5147 size: "sm",
5148 italic: true,
5149 color: "red"
5150 }, props));
5151};
5152
5153ErrorText.displayName = 'ErrorText';
5154
5155var Error$1 = function Error(_ref) {
5156 var children = _ref.children,
5157 props = objectWithoutPropertiesLoose(_ref, ["children"]);
5158
5159 return React__default.createElement(ErrorText, props, React__default.createElement("error-label", null, children));
5160};
5161
5162Error$1.displayName = 'Error';
5163Error$1.propTypes = {
5164 /** child content to the error-label */
5165 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
5166};
5167
5168function _templateObject$w() {
5169 var data = taggedTemplateLiteralLoose(["\n\t&& {\n\t\tfont-size: 12px;\n\t}\n\n\t&&& {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tbackground-color: ", " !important;\n\t\tcolor: ", ";\n\t\tfont-style: normal;\n\t\tfont-weight: normal;\n\t\tline-height: 14px;\n\t\ttext-align: ", ";\n\t}\n"]);
5170
5171 _templateObject$w = function _templateObject() {
5172 return data;
5173 };
5174
5175 return data;
5176}
5177var ColorLabel = styled__default(function (_ref) {
5178 var color = _ref.color,
5179 props = objectWithoutPropertiesLoose(_ref, ["color"]);
5180
5181 return React__default.createElement(semanticUiReact.Label, props);
5182})(_templateObject$w(), function (_ref2) {
5183 var color = _ref2.color,
5184 theme = _ref2.theme;
5185 return theme.colors[color] || theme.label.defaultColor;
5186}, function (_ref3) {
5187 var theme = _ref3.theme;
5188 return theme.colors.white;
5189}, function (_ref4) {
5190 var align = _ref4.align;
5191 return align || 'center';
5192});
5193ColorLabel.displayName = 'Label';
5194ColorLabel.defaultProps = {
5195 color: undefined,
5196 align: undefined
5197};
5198ColorLabel.propTypes = {
5199 color: PropTypes.string,
5200 align: PropTypes.oneOf(['left', 'right'])
5201};
5202
5203var LabelText = function LabelText(_ref) {
5204 var disabled = _ref.disabled,
5205 props = objectWithoutPropertiesLoose(_ref, ["disabled"]);
5206
5207 return React__default.createElement(Text, _extends_1({
5208 color: disabled ? 'strokeGray' : 'mediumGray',
5209 bold: true,
5210 size: "sm"
5211 }, props));
5212};
5213
5214LabelText.defaultProps = {
5215 disabled: false
5216};
5217LabelText.propTypes = {
5218 disabled: PropTypes.bool
5219};
5220LabelText.displayName = 'LabelText';
5221
5222var Label = function Label(_ref) {
5223 var children = _ref.children,
5224 props = objectWithoutPropertiesLoose(_ref, ["children"]);
5225
5226 return React__default.createElement(LabelText, props, React__default.createElement("label", null, children));
5227};
5228
5229Label.defaultProps = {
5230 children: ''
5231};
5232Label.propTypes = {
5233 /** Children of this component must be a string */
5234 children: PropTypes.string
5235};
5236Label.displayName = 'Label';
5237
5238function _templateObject$x() {
5239 var data = taggedTemplateLiteralLoose(["\n\theight: 12px;\n\tmargin: 5px 0 11px 0;\n\tcolor: ", ";\n\tfont-size: 12px;\n\tfont-style: italic;\n\tfont-weight: 400;\n"]);
5240
5241 _templateObject$x = function _templateObject() {
5242 return data;
5243 };
5244
5245 return data;
5246}
5247var BottomLabel = styled__default.div(_templateObject$x(), function (_ref) {
5248 var theme = _ref.theme,
5249 disabled = _ref.disabled;
5250 return disabled ? theme.colors.strokeGray : theme.colors.mediumGray;
5251});
5252BottomLabel.defaultProps = {
5253 disabled: false
5254};
5255BottomLabel.propTypes = {
5256 /** Bool for the disabled state */
5257 disabled: PropTypes.bool
5258};
5259BottomLabel.displayName = 'BottomLabel';
5260
5261function _templateObject3$6() {
5262 var data = taggedTemplateLiteralLoose(["\n\tcolor: ", ";\n"]);
5263
5264 _templateObject3$6 = function _templateObject3() {
5265 return data;
5266 };
5267
5268 return data;
5269}
5270
5271function _templateObject2$9() {
5272 var data = taggedTemplateLiteralLoose(["\n\tcolor: ", ";\n\tfont-weight: bold;\n"]);
5273
5274 _templateObject2$9 = function _templateObject2() {
5275 return data;
5276 };
5277
5278 return data;
5279}
5280
5281function _templateObject$y() {
5282 var data = taggedTemplateLiteralLoose(["\n\tfont-size: 35px;\n\twhite-space: nowrap;\n"]);
5283
5284 _templateObject$y = function _templateObject() {
5285 return data;
5286 };
5287
5288 return data;
5289}
5290
5291var TicketLabel = function TicketLabel(_ref) {
5292 var typeTicketLabel = _ref.typeTicketLabel,
5293 color = _ref.color,
5294 queueTag = _ref.queueTag,
5295 ticketNumber = _ref.ticketNumber,
5296 props = objectWithoutPropertiesLoose(_ref, ["typeTicketLabel", "color", "queueTag", "ticketNumber"]);
5297
5298 var getQueueTagColor = function getQueueTagColor(type, customColor) {
5299 if (type === 'normal') return theme.colors.red;
5300 if (type === 'prioritary') return theme.colors.activeBlue;
5301 if (!type && customColor) return customColor;
5302 return theme.colors.black;
5303 };
5304
5305 return React__default.createElement(TicketLabelWrapper, props, React__default.createElement(TicketQueueTag, {
5306 queueTagColor: getQueueTagColor(typeTicketLabel, color)
5307 }, queueTag + " "), React__default.createElement(TicketNumber, {
5308 typeTicketLabel: typeTicketLabel,
5309 color: color
5310 }, ticketNumber));
5311};
5312
5313var TicketLabelWrapper = styled__default.div(_templateObject$y());
5314TicketLabelWrapper.displayName = 'TicketLabelWrapper';
5315var TicketQueueTag = styled__default.span(_templateObject2$9(), function (_ref2) {
5316 var queueTagColor = _ref2.queueTagColor;
5317 return queueTagColor;
5318});
5319TicketQueueTag.displayName = 'TicketQueueTag';
5320var TicketNumber = styled__default.span(_templateObject3$6(), function (_ref3) {
5321 var typeTicketLabel = _ref3.typeTicketLabel,
5322 color = _ref3.color;
5323 return !typeTicketLabel && color ? color : theme.colors.darkGray;
5324});
5325TicketNumber.displayName = 'TicketNumber';
5326TicketLabel.defaultProps = {
5327 typeTicketLabel: undefined,
5328 color: undefined
5329};
5330TicketLabel.propTypes = {
5331 /** string with the type of ticket label */
5332 typeTicketLabel: PropTypes.oneOf(['normal', 'prioritary']),
5333
5334 /** string to use in the cases of ticket label color customization */
5335 color: PropTypes.string,
5336
5337 /** string with the queue tag content */
5338 queueTag: PropTypes.string.isRequired,
5339
5340 /** string with the queue number content */
5341 ticketNumber: PropTypes.string.isRequired
5342};
5343
5344function _templateObject2$a() {
5345 var data = taggedTemplateLiteralLoose(["\n\tdiv:last-child {\n\t\tmargin-bottom: 0;\n\t}\n"]);
5346
5347 _templateObject2$a = function _templateObject2() {
5348 return data;
5349 };
5350
5351 return data;
5352}
5353
5354function _templateObject$z() {
5355 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\tmargin-bottom: 12px;\n"]);
5356
5357 _templateObject$z = function _templateObject() {
5358 return data;
5359 };
5360
5361 return data;
5362}
5363
5364var InputField = function InputField(_ref) {
5365 var label = _ref.label,
5366 id = _ref.id,
5367 hint = _ref.hint,
5368 error = _ref.error,
5369 disabled = _ref.disabled,
5370 labelIcon = _ref.labelIcon,
5371 rightLabel = _ref.rightLabel,
5372 rightLabelOnClick = _ref.rightLabelOnClick,
5373 element = _ref.element,
5374 props = objectWithoutPropertiesLoose(_ref, ["label", "id", "hint", "error", "disabled", "labelIcon", "rightLabel", "rightLabelOnClick", "element"]);
5375
5376 var Element = element;
5377 return React__default.createElement(InputFieldContainer, null, React__default.createElement("div", null, labelIcon && React__default.createElement(InputIcon, {
5378 disabled: disabled,
5379 icon: labelIcon
5380 }), label && React__default.createElement(Label, {
5381 htmlFor: id,
5382 disabled: disabled
5383 }, label), rightLabel && React__default.createElement(LabelLink, {
5384 id: id,
5385 disabled: disabled,
5386 onClick: !disabled ? rightLabelOnClick : undefined
5387 }, rightLabel)), React__default.createElement(Element, _extends_1({
5388 id: id,
5389 error: !!error,
5390 disabled: disabled
5391 }, props)), hint && React__default.createElement(BottomLabel, {
5392 "data-test-id": "hint",
5393 disabled: disabled
5394 }, hint), error && React__default.createElement(ListErrorWrapper, null, [].concat(error).map(function (child, i) {
5395 return React__default.createElement(Error$1, {
5396 key: i
5397 }, child);
5398 })));
5399};
5400
5401var InputFieldContainer = styled__default.div(_templateObject$z());
5402var ListErrorWrapper = styled__default.div(_templateObject2$a());
5403InputField.defaultProps = {
5404 hint: '',
5405 error: '',
5406 label: '',
5407 id: '',
5408 disabled: false,
5409 labelIcon: undefined,
5410 rightLabelOnClick: undefined,
5411 rightLabel: undefined,
5412 element: Input
5413};
5414InputField.propTypes = {
5415 /** Text message hint */
5416 hint: PropTypes.string,
5417
5418 /** Text message error */
5419 error: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
5420
5421 /** Text for the label */
5422 label: PropTypes.string,
5423
5424 /** String to the ID attribute */
5425 id: PropTypes.string,
5426
5427 /** Bool for the disabled state */
5428 disabled: PropTypes.bool,
5429
5430 /** Icon name for the Icon placed on the left of the label */
5431 labelIcon: PropTypes.oneOf(IconName),
5432
5433 /** Func to be called when LabelLink is clicked */
5434 rightLabelOnClick: PropTypes.func,
5435
5436 /** LabelLink's text */
5437 rightLabel: PropTypes.string,
5438
5439 /** Element to be rendered inside the component */
5440 element: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
5441};
5442InputField.displayName = 'InputField';
5443
5444function _templateObject4$4() {
5445 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\theight: 34px;\n\tbox-sizing: border-box;\n\tborder: 1px solid #dddddd;\n\tborder-radius: 4px;\n\tcursor: pointer !important;\n\tuser-select: none;\n"]);
5446
5447 _templateObject4$4 = function _templateObject4() {
5448 return data;
5449 };
5450
5451 return data;
5452}
5453
5454function _templateObject3$7() {
5455 var data = taggedTemplateLiteralLoose(["\n\tmargin-right: 9px !important;\n\tmargin-left: 9px !important;\n\tcolor: ", ";\n\tfloat: left;\n\tfont-size: 16px !important;\n\tline-height: 34px !important;\n\tuser-select: none;\n"]);
5456
5457 _templateObject3$7 = function _templateObject3() {
5458 return data;
5459 };
5460
5461 return data;
5462}
5463
5464function _templateObject2$b() {
5465 var data = taggedTemplateLiteralLoose(["\n\toverflow: hidden;\n\twidth: calc(100% - 40px);\n\tcolor: ", ";\n\tfloat: left;\n\tfont-size: 14px;\n\tline-height: 34px;\n\ttext-overflow: ellipsis;\n\tuser-select: none;\n\twhite-space: nowrap;\n"]);
5466
5467 _templateObject2$b = function _templateObject2() {
5468 return data;
5469 };
5470
5471 return data;
5472}
5473
5474function _templateObject$A() {
5475 var data = taggedTemplateLiteralLoose(["\n\tdisplay: none;\n"]);
5476
5477 _templateObject$A = function _templateObject() {
5478 return data;
5479 };
5480
5481 return data;
5482}
5483
5484var InputFile =
5485/*#__PURE__*/
5486function (_Component) {
5487 inheritsLoose(InputFile, _Component);
5488
5489 function InputFile(props) {
5490 var _this;
5491
5492 _this = _Component.call(this, props) || this;
5493
5494 defineProperty(assertThisInitialized(_this), "handleClick", function () {
5495 _this.fieldField.current.click();
5496 });
5497
5498 _this.fieldField = React__default.createRef();
5499 _this.handleClick = _this.handleClick.bind(assertThisInitialized(_this));
5500 return _this;
5501 }
5502
5503 var _proto = InputFile.prototype;
5504
5505 _proto.render = function render() {
5506 var _this$props = this.props,
5507 inputFileLabel = _this$props.inputFileLabel,
5508 disabled = _this$props.disabled,
5509 color = _this$props.color,
5510 props = objectWithoutPropertiesLoose(_this$props, ["inputFileLabel", "disabled", "color"]);
5511
5512 return React__default.createElement(InputFileContainer, {
5513 onClick: !disabled ? this.handleClick : undefined
5514 }, React__default.createElement(InputFileHidden, _extends_1({
5515 ref: this.fieldField,
5516 type: "file"
5517 }, props)), React__default.createElement(AddIcon, {
5518 color: color,
5519 disabled: disabled,
5520 icon: "add"
5521 }), React__default.createElement(Label$1, {
5522 disabled: disabled
5523 }, inputFileLabel));
5524 };
5525
5526 return InputFile;
5527}(React.Component);
5528
5529var InputFileHidden = styled__default.input(_templateObject$A());
5530var Label$1 = styled__default.span(_templateObject2$b(), function (_ref) {
5531 var disabled = _ref.disabled;
5532 return disabled ? theme.colors.strokeGray : theme.colors.black;
5533});
5534var AddIcon = styled__default(Icon)(_templateObject3$7(), function (_ref2) {
5535 var disabled = _ref2.disabled,
5536 color = _ref2.color;
5537 return disabled ? theme.colors.strokeGray : color;
5538});
5539var InputFileContainer = styled__default.div(_templateObject4$4());
5540InputFile.defaultProps = {
5541 disabled: false,
5542 color: theme.colors.activeBlue
5543};
5544InputFile.propTypes = {
5545 /** Label to be showed inside the input */
5546 inputFileLabel: PropTypes.string.isRequired,
5547
5548 /** Color of the input icon */
5549 color: PropTypes.string,
5550
5551 /** Bool of the disabled state */
5552 disabled: PropTypes.bool
5553};
5554InputFile.displayName = 'InputFile';
5555InputFileHidden.displayName = 'InputFileHidden';
5556InputFileContainer.displayName = 'InputFileContainer';
5557AddIcon.displayName = 'AddIcon';
5558Label$1.displayName = 'Label';
5559
5560function _templateObject$B() {
5561 var data = taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\n\tpadding: 8px !important;\n\tborder-color: ", " !important;\n\tborder-radius: 4px !important;\n\tcolor: ", ";\n\n\tcursor: ", " !important;\n\n\t&:focus {\n\t\tborder-color: ", " !important;\n\t}\n"]);
5562
5563 _templateObject$B = function _templateObject() {
5564 return data;
5565 };
5566
5567 return data;
5568}
5569var TextArea = styled__default(function (_ref) {
5570 var error = _ref.error,
5571 disabled = _ref.disabled,
5572 props = objectWithoutPropertiesLoose(_ref, ["error", "disabled"]);
5573
5574 return React__default.createElement(semanticUiReact.TextArea, _extends_1({
5575 disabled: disabled
5576 }, props));
5577})(_templateObject$B(), function (_ref2) {
5578 var theme = _ref2.theme,
5579 error = _ref2.error;
5580 return error ? theme.colors.red : theme.colors.strokeGray;
5581}, function (_ref3) {
5582 var theme = _ref3.theme;
5583 return theme.colors.darkGray;
5584}, function (_ref4) {
5585 var disabled = _ref4.disabled;
5586 return disabled && 'not-allowed';
5587}, function (_ref5) {
5588 var theme = _ref5.theme;
5589 return theme.colors.activeBlue;
5590});
5591TextArea.defaultProps = {
5592 disabled: false,
5593 error: false
5594};
5595TextArea.propTypes = {
5596 /** Bool for the disabled state */
5597 disabled: PropTypes.bool,
5598
5599 /** Bool for the error state */
5600 error: PropTypes.bool
5601};
5602TextArea.displayName = 'TextArea';
5603
5604function _templateObject$C() {
5605 var data = taggedTemplateLiteralLoose(["\n\tdisplay: block !important;\n\twidth: 36px !important;\n\theight: 22px !important;\n\n\t&&&& input ~ label {\n\t\twidth: 36px !important;\n\t\theight: 22px !important;\n\t}\n\n\t&&&& input ~ .box:before {\n\t\twidth: 100% !important;\n\t\theight: 100% !important;\n\t}\n\n\t&&&& input ~ label:before {\n\t\twidth: 100% !important;\n\t\theight: 100% !important;\n\t}\n\n\t&&&& input ~ .box:after {\n\t\ttop: 2px !important;\n\t\tleft: 0.05rem !important;\n\t\twidth: 18px !important;\n\t\theight: 18px !important;\n\t}\n\n\t&&&& input ~ label:after {\n\t\ttop: 2px !important;\n\t\tleft: 0.05rem !important;\n\t\twidth: 18px !important;\n\t\theight: 18px !important;\n\t}\n\n\t&&&& input:checked ~ label:before {\n\t\twidth: 100% !important;\n\t\theight: 100% !important;\n\t\tbackground-color: ", " !important;\n\t}\n\n\t&&&& input:checked ~ .box:before {\n\t\twidth: 100% !important;\n\t\theight: 100% !important;\n\t\tbackground-color: ", " !important;\n\t}\n\n\t&&&& input:focus:checked ~ label:before {\n\t\twidth: 100% !important;\n\t\theight: 100% !important;\n\t\tbackground-color: ", " !important;\n\t}\n\n\t&&&& input:focus:checked ~ .box:before {\n\t\twidth: 100% !important;\n\t\theight: 100% !important;\n\t\tbackground-color: ", " !important;\n\t}\n\n\t&&&& input:checked ~ .box:after {\n\t\ttop: 2px !important;\n\t\tleft: 1.15rem !important;\n\t\twidth: 18px !important;\n\t\theight: 18px !important;\n\t}\n\n\t&&&& input:checked ~ label:after {\n\t\ttop: 2px !important;\n\t\tleft: 1.15rem !important;\n\t\twidth: 18px !important;\n\t\theight: 18px !important;\n\t}\n"]);
5606
5607 _templateObject$C = function _templateObject() {
5608 return data;
5609 };
5610
5611 return data;
5612}
5613var Toggle = styled__default(function (props) {
5614 return React__default.createElement(semanticUiReact.Checkbox, _extends_1({
5615 toggle: true
5616 }, props));
5617})(_templateObject$C(), function (_ref) {
5618 var theme = _ref.theme;
5619 return theme.toggle.color;
5620}, function (_ref2) {
5621 var theme = _ref2.theme;
5622 return theme.toggle.color;
5623}, function (_ref3) {
5624 var theme = _ref3.theme;
5625 return theme.toggle.color;
5626}, function (_ref4) {
5627 var theme = _ref4.theme;
5628 return theme.toggle.color;
5629});
5630Toggle.displayName = 'Toggle';
5631
5632function _templateObject4$5() {
5633 var data = taggedTemplateLiteralLoose(["\n\theight: ", ";\n\tline-height: ", ";\n\tmargin-left: ", ";\n\tmargin-right: ", ";\n\topacity: ", ";\n\tcursor: default;\n"]);
5634
5635 _templateObject4$5 = function _templateObject4() {
5636 return data;
5637 };
5638
5639 return data;
5640}
5641
5642function _templateObject3$8() {
5643 var data = taggedTemplateLiteralLoose(["\n\tposition: absolute !important;\n\theight: 0;\n\twidth: 0;\n\tvisibility: hidden;\n"]);
5644
5645 _templateObject3$8 = function _templateObject3() {
5646 return data;
5647 };
5648
5649 return data;
5650}
5651
5652function _templateObject2$c() {
5653 var data = taggedTemplateLiteralLoose(["\n\tdisplay: block;\n\tcursor: ", ";\n\twidth: ", "px;\n\theight: ", "px;\n\tline-height: ", "px;\n\tbackground: ", ";\n\tborder-radius: 3px;\n"]);
5654
5655 _templateObject2$c = function _templateObject2() {
5656 return data;
5657 };
5658
5659 return data;
5660}
5661
5662function _templateObject$D() {
5663 var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-flex;\n\tflex-direction: ", ";\n\talign-items: center;\n\tuser-select: none;\n"]);
5664
5665 _templateObject$D = function _templateObject() {
5666 return data;
5667 };
5668
5669 return data;
5670}
5671
5672var Checkbox =
5673/*#__PURE__*/
5674function (_Component) {
5675 inheritsLoose(Checkbox, _Component);
5676
5677 function Checkbox(props) {
5678 var _this;
5679
5680 _this = _Component.call(this, props) || this;
5681
5682 defineProperty(assertThisInitialized(_this), "handleClick", function () {
5683 _this.hiddenCheckbox.click();
5684 });
5685
5686 _this.hiddenCheckbox = React.createRef();
5687 return _this;
5688 }
5689
5690 var _proto = Checkbox.prototype;
5691
5692 _proto.render = function render() {
5693 var _this2 = this;
5694
5695 var _this$props = this.props,
5696 id = _this$props.id,
5697 checked = _this$props.checked,
5698 color = _this$props.color,
5699 background = _this$props.background,
5700 label = _this$props.label,
5701 labelPosition = _this$props.labelPosition,
5702 height = _this$props.height,
5703 width = _this$props.width,
5704 disabled = _this$props.disabled,
5705 props = objectWithoutPropertiesLoose(_this$props, ["id", "checked", "color", "background", "label", "labelPosition", "height", "width", "disabled"]);
5706
5707 return React__default.createElement(CheckboxWrapper, {
5708 labelPosition: labelPosition,
5709 onClick: function onClick(e) {
5710 return e.stopPropagation();
5711 }
5712 }, React__default.createElement(CheckboxContainer, {
5713 width: width,
5714 height: height,
5715 disabled: disabled,
5716 background: background
5717 }, React__default.createElement(HiddenCheckbox, _extends_1({
5718 defaultChecked: checked,
5719 disabled: disabled,
5720 ref: function ref(checkbox) {
5721 _this2.hiddenCheckbox = checkbox;
5722 }
5723 }, props)), checked ? React__default.createElement("svg", {
5724 fillOpacity: disabled ? 0.5 : 1,
5725 xmlns: "http://www.w3.org/2000/svg",
5726 width: "100%",
5727 height: "100%",
5728 viewBox: "0 0 14 14"
5729 }, React__default.createElement("path", {
5730 d: "M12.4444 0H1.55556C0.7 0 0 0.7 0 1.55556V12.4444C0 13.3 0.7 14 1.55556 14H12.4444C13.3 14 14 13.3 14 12.4444V1.55556C14 0.7 13.3 0 12.4444 0ZM5.44444 10.8889L1.55556 7L2.64444 5.91111L5.44444 8.71111L11.3556 2.8L12.4444 3.88889L5.44444 10.8889Z",
5731 fill: color ? "" + color : theme.colors.activeBlue
5732 })) : React__default.createElement("svg", {
5733 fillOpacity: disabled ? 0.5 : 1,
5734 xmlns: "http://www.w3.org/2000/svg",
5735 width: "100%",
5736 height: "100%",
5737 viewBox: "0 0 14 14"
5738 }, React__default.createElement("path", {
5739 d: "M12.4444 0.915033C12.6138 0.915033 12.7742 0.982135 12.896 1.10396C13.0179 1.22581 13.085 1.38618 13.085 1.55556V12.4444C13.085 12.6138 13.0179 12.7742 12.896 12.896C12.7742 13.0179 12.6138 13.085 12.4444 13.085H1.55556C1.38618 13.085 1.22581 13.0179 1.10396 12.896C0.982134 12.7742 0.915033 12.6138 0.915033 12.4444V1.55556C0.915033 1.38618 0.982134 1.22581 1.10396 1.10396C1.22581 0.982135 1.38618 0.915033 1.55556 0.915033H12.4444ZM12.4444 0H1.55556C0.7 0 0 0.7 0 1.55556V12.4444C0 13.3 0.7 14 1.55556 14H12.4444C13.3 14 14 13.3 14 12.4444V1.55556C14 0.7 13.3 0 12.4444 0Z",
5740 fill: color ? "" + color : theme.colors.darkGray
5741 }))), label && React__default.createElement(LabelWrapper, {
5742 height: height,
5743 labelPosition: labelPosition,
5744 disabled: disabled,
5745 onClick: this.handleClick
5746 }, React__default.createElement(Label, {
5747 htmlFor: id
5748 }, label)));
5749 };
5750
5751 return Checkbox;
5752}(React.Component);
5753
5754var CheckboxWrapper = styled__default.div(_templateObject$D(), function (_ref) {
5755 var labelPosition = _ref.labelPosition;
5756 return labelPosition === 'right' ? 'row' : 'row-reverse';
5757});
5758var CheckboxContainer = styled__default.label(_templateObject2$c(), function (_ref2) {
5759 var disabled = _ref2.disabled;
5760 return disabled ? 'default' : 'pointer';
5761}, function (_ref3) {
5762 var width = _ref3.width;
5763 return width;
5764}, function (_ref4) {
5765 var height = _ref4.height;
5766 return height;
5767}, function (_ref5) {
5768 var height = _ref5.height;
5769 return height;
5770}, function (_ref6) {
5771 var background = _ref6.background;
5772 return background ? "" + background : 'white';
5773});
5774var HiddenCheckbox = styled__default.input.attrs({
5775 type: 'checkbox'
5776})(_templateObject3$8());
5777var LabelWrapper = styled__default.div(_templateObject4$5(), function (_ref7) {
5778 var height = _ref7.height;
5779 return height + "px";
5780}, function (_ref8) {
5781 var height = _ref8.height;
5782 return height + "px";
5783}, function (_ref9) {
5784 var labelPosition = _ref9.labelPosition;
5785 return labelPosition === 'right' ? '8px' : '0';
5786}, function (_ref10) {
5787 var labelPosition = _ref10.labelPosition;
5788 return labelPosition === 'left' ? '8px' : '0';
5789}, function (_ref11) {
5790 var disabled = _ref11.disabled;
5791 return disabled ? '0.5' : '1';
5792});
5793CheckboxWrapper.displayName = 'CheckboxWrapper';
5794CheckboxContainer.displayName = 'CheckboxContainer';
5795HiddenCheckbox.displayName = 'HiddenCheckbox';
5796LabelWrapper.displayName = 'LabelWrapper';
5797Checkbox.displayName = 'Checkbox';
5798Checkbox.defaultProps = {
5799 height: 14,
5800 width: 14,
5801 label: null,
5802 labelPosition: 'right',
5803 id: '',
5804 disabled: false,
5805 color: undefined,
5806 background: undefined
5807};
5808Checkbox.propTypes = {
5809 /* checkbox height in pixels */
5810 height: PropTypes.number,
5811
5812 /* checkbox width in pixels */
5813 width: PropTypes.number,
5814
5815 /* boolean to checkbox status */
5816 checked: PropTypes.bool.isRequired,
5817
5818 /** customize checkbox color */
5819 color: PropTypes.string,
5820
5821 /** css rule string to customize the checkbox background */
5822 background: PropTypes.string,
5823
5824 /** label that will be displayed along with the checkbox */
5825 label: PropTypes.string,
5826
5827 /** label position */
5828 labelPosition: PropTypes.oneOf(['left', 'right']),
5829
5830 /** label position */
5831 id: PropTypes.string,
5832
5833 /** boolean to control the disabled attribute of the input checkbox */
5834 disabled: PropTypes.bool
5835};
5836
5837function _templateObject4$6() {
5838 var data = taggedTemplateLiteralLoose(["\n\theight: ", ";\n\tline-height: ", ";\n\tmargin-left: ", ";\n\tmargin-right: ", ";\n\topacity: ", ";\n\tcursor: default;\n"]);
5839
5840 _templateObject4$6 = function _templateObject4() {
5841 return data;
5842 };
5843
5844 return data;
5845}
5846
5847function _templateObject3$9() {
5848 var data = taggedTemplateLiteralLoose(["\n\theight: 0;\n\twidth: 0;\n\tvisibility: hidden;\n"]);
5849
5850 _templateObject3$9 = function _templateObject3() {
5851 return data;
5852 };
5853
5854 return data;
5855}
5856
5857function _templateObject2$d() {
5858 var data = taggedTemplateLiteralLoose(["\n\tdisplay: block;\n\tcursor: ", ";\n\twidth: ", "px;\n\theight: ", "px;\n\tline-height: ", "px;\n\tbackground: ", ";\n\tborder-radius: 3px;\n"]);
5859
5860 _templateObject2$d = function _templateObject2() {
5861 return data;
5862 };
5863
5864 return data;
5865}
5866
5867function _templateObject$E() {
5868 var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-flex;\n\tflex-direction: ", ";\n\talign-items: center;\n\tuser-select: none;\n"]);
5869
5870 _templateObject$E = function _templateObject() {
5871 return data;
5872 };
5873
5874 return data;
5875}
5876
5877var Radio =
5878/*#__PURE__*/
5879function (_Component) {
5880 inheritsLoose(Radio, _Component);
5881
5882 function Radio(props) {
5883 var _this;
5884
5885 _this = _Component.call(this, props) || this;
5886
5887 defineProperty(assertThisInitialized(_this), "handleClick", function () {
5888 _this.hiddenRadio.click();
5889 });
5890
5891 _this.hiddenRadio = React.createRef();
5892 return _this;
5893 }
5894
5895 var _proto = Radio.prototype;
5896
5897 _proto.render = function render() {
5898 var _this2 = this;
5899
5900 var _this$props = this.props,
5901 id = _this$props.id,
5902 checked = _this$props.checked,
5903 color = _this$props.color,
5904 background = _this$props.background,
5905 label = _this$props.label,
5906 labelPosition = _this$props.labelPosition,
5907 height = _this$props.height,
5908 width = _this$props.width,
5909 disabled = _this$props.disabled,
5910 props = objectWithoutPropertiesLoose(_this$props, ["id", "checked", "color", "background", "label", "labelPosition", "height", "width", "disabled"]);
5911
5912 return React__default.createElement(RadioWrapper, _extends_1({
5913 labelPosition: labelPosition
5914 }, props), React__default.createElement(RadioContainer, {
5915 width: width,
5916 height: height,
5917 disabled: disabled,
5918 background: background
5919 }, React__default.createElement(HiddenRadio, _extends_1({
5920 checked: checked,
5921 disabled: disabled,
5922 ref: function ref(radio) {
5923 _this2.hiddenRadio = radio;
5924 }
5925 }, props)), checked ? React__default.createElement("svg", {
5926 fillOpacity: disabled ? 0.5 : 1,
5927 width: "100%",
5928 height: "100%",
5929 viewBox: "0 0 14 14",
5930 fill: "none",
5931 xmlns: "http://www.w3.org/2000/svg"
5932 }, React__default.createElement("path", {
5933 fillRule: "evenodd",
5934 clipRule: "evenodd",
5935 d: "M7 3.5C5.04 3.5 3.5 5.04 3.5 7C3.5 8.96 5.04 10.5 7 10.5C8.96 10.5 10.5 8.96 10.5 7C10.5 5.04 8.96 3.5 7 3.5ZM7 0C3.15 0 0 3.15 0 7C0 10.85 3.15 14 7 14C10.85 14 14 10.85 14 7C14 3.15 10.85 0 7 0ZM7 12.6C3.92 12.6 1.4 10.08 1.4 7C1.4 3.92 3.92 1.4 7 1.4C10.08 1.4 12.6 3.92 12.6 7C12.6 10.08 10.08 12.6 7 12.6Z",
5936 fill: color ? "" + color : theme.colors.activeBlue
5937 })) : React__default.createElement("svg", {
5938 fillOpacity: disabled ? 0.5 : 1,
5939 xmlns: "http://www.w3.org/2000/svg",
5940 width: "100%",
5941 height: "100%",
5942 viewBox: "0 0 14 14",
5943 fill: "none"
5944 }, React__default.createElement("path", {
5945 fillRule: "evenodd",
5946 clipRule: "evenodd",
5947 d: "M7 0C3.15 0 0 3.15 0 7C0 10.85 3.15 14 7 14C10.85 14 14 10.85 14 7C14 3.15 10.85 0 7 0ZM7 12.6C3.92 12.6 1.4 10.08 1.4 7C1.4 3.92 3.92 1.4 7 1.4C10.08 1.4 12.6 3.92 12.6 7C12.6 10.08 10.08 12.6 7 12.6Z",
5948 fill: color ? "" + color : theme.colors.darkGray
5949 }))), label && React__default.createElement(LabelWrapper$1, {
5950 height: height,
5951 labelPosition: labelPosition,
5952 disabled: disabled,
5953 onClick: this.handleClick
5954 }, React__default.createElement(Label, {
5955 htmlFor: id
5956 }, label)));
5957 };
5958
5959 return Radio;
5960}(React.Component);
5961
5962var RadioWrapper = styled__default.div(_templateObject$E(), function (_ref) {
5963 var labelPosition = _ref.labelPosition;
5964 return labelPosition === 'right' ? 'row' : 'row-reverse';
5965});
5966var RadioContainer = styled__default.label(_templateObject2$d(), function (_ref2) {
5967 var disabled = _ref2.disabled;
5968 return disabled ? 'default' : 'pointer';
5969}, function (_ref3) {
5970 var width = _ref3.width;
5971 return width;
5972}, function (_ref4) {
5973 var height = _ref4.height;
5974 return height;
5975}, function (_ref5) {
5976 var height = _ref5.height;
5977 return height;
5978}, function (_ref6) {
5979 var background = _ref6.background;
5980 return background ? "" + background : 'white';
5981});
5982var HiddenRadio = styled__default.input.attrs({
5983 type: 'checkbox'
5984})(_templateObject3$9());
5985var LabelWrapper$1 = styled__default.div(_templateObject4$6(), function (_ref7) {
5986 var height = _ref7.height;
5987 return height + "px";
5988}, function (_ref8) {
5989 var height = _ref8.height;
5990 return height + "px";
5991}, function (_ref9) {
5992 var labelPosition = _ref9.labelPosition;
5993 return labelPosition === 'right' ? '8px' : '0';
5994}, function (_ref10) {
5995 var labelPosition = _ref10.labelPosition;
5996 return labelPosition === 'left' ? '8px' : '0';
5997}, function (_ref11) {
5998 var disabled = _ref11.disabled;
5999 return disabled ? '0.5' : '1';
6000});
6001RadioWrapper.displayName = 'RadioWrapper';
6002RadioContainer.displayName = 'RadioContainer';
6003HiddenRadio.displayName = 'HiddenRadio';
6004LabelWrapper$1.displayName = 'LabelWrapper';
6005Radio.defaultProps = {
6006 id: '',
6007 height: 14,
6008 width: 14,
6009 label: null,
6010 labelPosition: 'left',
6011 disabled: false,
6012 color: undefined,
6013 background: undefined
6014};
6015Radio.propTypes = {
6016 /** String to the Id attribute */
6017 id: PropTypes.string,
6018
6019 /* radio height in pixels */
6020 height: PropTypes.number,
6021
6022 /* radio width in pixels */
6023 width: PropTypes.number,
6024
6025 /* boolean to radio status */
6026 checked: PropTypes.bool.isRequired,
6027
6028 /** customize radio color */
6029 color: PropTypes.string,
6030
6031 /** css rule string to customize the radio background */
6032 background: PropTypes.string,
6033
6034 /** label that will be displayed along with the radio */
6035 label: PropTypes.string,
6036
6037 /** label position */
6038 labelPosition: PropTypes.oneOf(['left', 'right']),
6039
6040 /** onChange function handler */
6041 onChange: PropTypes.func.isRequired,
6042
6043 /** boolean to control the disabled attribute of the input checkbox */
6044 disabled: PropTypes.bool
6045};
6046
6047function _templateObject$F() {
6048 var data = taggedTemplateLiteralLoose(["\n\topacity: 1 !important;\n\n\t& input {\n\t\twidth: 40px !important;\n\t\tpadding: 1px 0 !important;\n\t\tborder: ", " !important;\n\t\tborder-color: ", " !important;\n\t\tbackground: transparent !important;\n\t\tcolor: ", " !important;\n\n\t\tfont-size: 18px;\n\t\ttext-align: center !important;\n\t\ttext-transform: uppercase;\n\n\t\t&:hover {\n\t\t\tborder-color: ", " !important;\n\t\t\tbackground: white !important;\n\t\t}\n\t\t&:focus {\n\t\t\tborder-color: ", " !important;\n\t\t\tbackground: white !important;\n\t\t}\n\t}\n"]);
6049
6050 _templateObject$F = function _templateObject() {
6051 return data;
6052 };
6053
6054 return data;
6055}
6056var TagContainer = styled__default(function (_ref) {
6057 var noBorder = _ref.noBorder,
6058 props = objectWithoutPropertiesLoose(_ref, ["noBorder"]);
6059
6060 return React__default.createElement(semanticUiReact.Input, props);
6061})(_templateObject$F(), function (_ref2) {
6062 var noBorder = _ref2.noBorder;
6063 return noBorder ? 0 : 'auto';
6064}, function (_ref3) {
6065 var theme = _ref3.theme,
6066 error = _ref3.error;
6067 return error ? theme.colors.red : 'transparent';
6068}, function (_ref4) {
6069 var color = _ref4.color;
6070 return color;
6071}, function (_ref5) {
6072 var theme = _ref5.theme,
6073 error = _ref5.error;
6074 return error ? theme.colors.red : theme.colors.activeBlue;
6075}, function (_ref6) {
6076 var theme = _ref6.theme;
6077 return theme.colors.activeBlue;
6078});
6079
6080var Tag = function Tag(_ref7) {
6081 var _onChange = _ref7.onChange,
6082 props = objectWithoutPropertiesLoose(_ref7, ["onChange"]);
6083
6084 return React__default.createElement(TagContainer, _extends_1({
6085 onChange: function onChange(event) {
6086 var regex = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`´{|}~]/;
6087 event.target.value = event.target.value.replace(regex, '').toUpperCase();
6088
6089 if (_onChange !== undefined) {
6090 _onChange(event);
6091 }
6092 }
6093 }, props));
6094};
6095
6096Tag.defaultProps = {
6097 noBorder: false,
6098 maxLength: 2,
6099 onChange: undefined
6100};
6101Tag.propTypes = {
6102 /** hex value of text color */
6103 color: PropTypes.string.isRequired,
6104
6105 /** maximum character text length */
6106 maxLength: PropTypes.number,
6107
6108 /** onChange Value Handler */
6109 onChange: PropTypes.func,
6110
6111 /** defines if input has border */
6112 noBorder: PropTypes.bool
6113};
6114Tag.displayName = 'Tag';
6115TagContainer.displayName = 'TagContainer';
6116
6117function _templateObject2$e() {
6118 var data = taggedTemplateLiteralLoose(["\n\twidth: 100% !important;\n\tborder-spacing: 0;\n\ttable-layout: fixed;\n\tmargin: 0;\n\tpadding: 0;\n\n\t.first-column {\n\t\twidth: 40px;\n\t\theight: 34px;\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t\tvertical-align: middle;\n\t\tborder: ", ";\n\t\tborder-top-left-radius: 4px !important;\n\t\tborder-bottom-left-radius: 4px !important;\n\t\tborder-right: 0;\n\t\tbox-sizing: border-box;\n\t}\n\n\t.first-column:focus-within {\n\t\tborder-width: 1px 0 1px 1px;\n\t\tborder-style: solid;\n\t\tborder-color: ", ";\n\t}\n\n\t.first-column:focus-within + .second-column {\n\t\tborder-left: ", ";\n\t}\n\n\t.first-column:focus-within + .second-column.errorBlock {\n\t\tborder-left: ", ";\n\t}\n\n\t.first-column.errorBlock:focus-within + .second-column.errorBlock {\n\t\tborder-left: 0 !important;\n\t}\n\n\t.second-column {\n\t\twidth: 40px;\n\t\tmax-width: 34px;\n\t\tmax-height: 34px;\n\t\tvertical-align: middle;\n\t\tborder: ", ";\n\t\tborder-right: 0;\n\t\tbox-sizing: border-box;\n\t}\n\n\t.second-column:focus-within {\n\t\tborder-top: ", ";\n\t\tborder-bottom: ", ";\n\t\tborder-left: ", ";\n\t}\n\n\t.second-column:focus-within + .third-column {\n\t\tborder-left: ", ";\n\t}\n\n\t.second-column:focus-within + .third-column.errorBlock {\n\t\tborder-left: ", ";\n\t}\n\n\t.second-column.errorBlock:focus-within + .third-column.errorBlock {\n\t\tborder-left: 0 !important;\n\t}\n\n\t.third-column {\n\t\tmax-height: 34px;\n\t\tvertical-align: middle;\n\t\tborder: ", ";\n\t\tbox-sizing: border-box;\n\t\tborder-top-right-radius: 4px !important;\n\t\tborder-bottom-right-radius: 4px !important;\n\t}\n\n\t.third-column:focus-within {\n\t\tborder: ", ";\n\t}\n\n\t.first-column.errorBlock {\n\t\tborder: ", ";\n\t}\n\n\t.first-column.errorBlock + .second-column {\n\t\tborder-left: 0;\n\t}\n\n\t.second-column.errorBlock {\n\t\tborder: ", ";\n\t}\n\n\t.second-column.errorBlock + .first-column {\n\t\tborder-right: 0;\n\t}\n\n\t.second-column.errorBlock + .third-column {\n\t\tborder-left: 0;\n\t}\n\n\t.third-column.errorBlock {\n\t\tborder: ", ";\n\t}\n"]);
6119
6120 _templateObject2$e = function _templateObject2() {
6121 return data;
6122 };
6123
6124 return data;
6125}
6126
6127function _templateObject$G() {
6128 var data = taggedTemplateLiteralLoose(["\n\tmargin-top: 11px;\n\tmargin-bottom: 28px;\n"]);
6129
6130 _templateObject$G = function _templateObject() {
6131 return data;
6132 };
6133
6134 return data;
6135}
6136
6137var InputGroup = function InputGroup(_ref) {
6138 var id = _ref.id,
6139 children = _ref.children,
6140 disabled = _ref.disabled,
6141 label = _ref.label,
6142 hint = _ref.hint,
6143 errors = _ref.errors,
6144 props = objectWithoutPropertiesLoose(_ref, ["id", "children", "disabled", "label", "hint", "errors"]);
6145
6146 var getClassName = function getClassName(currentIndex) {
6147 return ['first-column', 'second-column', 'third-column'][currentIndex];
6148 };
6149
6150 var getInputName = function getInputName(currentIndex) {
6151 return ['colour', 'tag', 'name'][currentIndex];
6152 };
6153
6154 var errorsToArray = errors ? Object.keys(errors).reduce(function (acc, element) {
6155 if (element && Array.isArray(errors[element])) {
6156 errors[element].map(function (errorItem) {
6157 return acc.indexOf(errorItem) === -1 && acc.push(errorItem);
6158 });
6159 } else if (element && errors[element] && acc.indexOf(errors[element]) === -1) {
6160 acc.push(errors[element]);
6161 }
6162
6163 return acc;
6164 }, []) : undefined;
6165 return React__default.createElement(React__default.Fragment, null, label && React__default.createElement(Label, {
6166 htmlFor: id,
6167 disabled: disabled
6168 }, label), React__default.createElement(InputGroupContainer, null, React__default.createElement(InputGroupTable, props, React__default.createElement("tbody", null, React__default.createElement("tr", null, children.map(function (element, index) {
6169 return React__default.createElement("td", {
6170 key: element.props.id,
6171 className: getClassName(index) + " " + (errors && (Array.isArray(errors[getInputName(index)]) && errors[getInputName(index)].length > 0 || errors[getInputName(index)]) && 'errorBlock')
6172 }, element);
6173 })))), !errorsToArray && hint && React__default.createElement(BottomLabel, {
6174 "data-test-id": "hint",
6175 disabled: disabled
6176 }, hint), errorsToArray && errorsToArray.map(function (element) {
6177 return React__default.createElement(Error$1, {
6178 key: element
6179 }, element);
6180 })));
6181};
6182
6183var InputGroupContainer = styled__default.div(_templateObject$G());
6184var InputGroupTable = styled__default.table(_templateObject2$e(), function (_ref2) {
6185 var theme = _ref2.theme;
6186 return "1px solid " + theme.colors.strokeGray;
6187}, function (_ref3) {
6188 var theme = _ref3.theme;
6189 return theme.colors.activeBlue;
6190}, function (_ref4) {
6191 var theme = _ref4.theme;
6192 return "1px solid " + theme.colors.activeBlue;
6193}, function (_ref5) {
6194 var theme = _ref5.theme;
6195 return "1px solid " + theme.colors.red + " !important";
6196}, function (_ref6) {
6197 var theme = _ref6.theme;
6198 return "1px solid " + theme.colors.strokeGray;
6199}, function (_ref7) {
6200 var theme = _ref7.theme;
6201 return "1px solid " + theme.colors.activeBlue;
6202}, function (_ref8) {
6203 var theme = _ref8.theme;
6204 return "1px solid " + theme.colors.activeBlue;
6205}, function (_ref9) {
6206 var theme = _ref9.theme;
6207 return "1px solid " + theme.colors.activeBlue;
6208}, function (_ref10) {
6209 var theme = _ref10.theme;
6210 return "1px solid " + theme.colors.activeBlue;
6211}, function (_ref11) {
6212 var theme = _ref11.theme;
6213 return "1px solid " + theme.colors.red;
6214}, function (_ref12) {
6215 var theme = _ref12.theme;
6216 return "1px solid " + theme.colors.strokeGray;
6217}, function (_ref13) {
6218 var theme = _ref13.theme;
6219 return "1px solid " + theme.colors.activeBlue;
6220}, function (_ref14) {
6221 var theme = _ref14.theme;
6222 return "1px solid " + theme.colors.red;
6223}, function (_ref15) {
6224 var theme = _ref15.theme;
6225 return "1px solid " + theme.colors.red;
6226}, function (_ref16) {
6227 var theme = _ref16.theme;
6228 return "1px solid " + theme.colors.red;
6229});
6230InputGroup.defaultProps = {
6231 id: '',
6232 disabled: false,
6233 hint: '',
6234 label: undefined,
6235 errors: undefined
6236};
6237InputGroup.displayName = 'InputGroup';
6238InputGroup.propTypes = {
6239 /** String to the Id attribute */
6240 id: PropTypes.string,
6241
6242 /** Node it always have 3 children */
6243 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
6244
6245 /** Bool to disable */
6246 disabled: PropTypes.bool,
6247
6248 /** String for the hint */
6249 hint: PropTypes.string,
6250
6251 /** String with the label content */
6252 label: PropTypes.string,
6253
6254 /** Shape with the errors content */
6255 errors: PropTypes.shape({
6256 tag: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
6257 name: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
6258 colour: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)])
6259 })
6260};
6261
6262function _templateObject4$7() {
6263 var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\twidth: 100%;\n\tmargin-top: 8px;\n\tbackground-color: ", ";\n"]);
6264
6265 _templateObject4$7 = function _templateObject4() {
6266 return data;
6267 };
6268
6269 return data;
6270}
6271
6272function _templateObject3$a() {
6273 var data = taggedTemplateLiteralLoose(["\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\twidth: ", ";\n\tmax-width: 100%;\n\theight: 3px;\n\tbackground-color: ", ";\n\ttransition: 0.75s;\n"]);
6274
6275 _templateObject3$a = function _templateObject3() {
6276 return data;
6277 };
6278
6279 return data;
6280}
6281
6282function _templateObject2$f() {
6283 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: row;\n\talign-items: start;\n\tjustify-content: space-between;\n\tbackground-color: white;\n\tmix-blend-mode: hard-light;\n"]);
6284
6285 _templateObject2$f = function _templateObject2() {
6286 return data;
6287 };
6288
6289 return data;
6290}
6291
6292function _templateObject$H() {
6293 var data = taggedTemplateLiteralLoose(["\n\twidth: 23.7%;\n\theight: 3px;\n\tbackground-color: gray;\n"]);
6294
6295 _templateObject$H = function _templateObject() {
6296 return data;
6297 };
6298
6299 return data;
6300}
6301
6302var PasswordStrengthMeter =
6303/*#__PURE__*/
6304function (_Component) {
6305 inheritsLoose(PasswordStrengthMeter, _Component);
6306
6307 function PasswordStrengthMeter() {
6308 var _this;
6309
6310 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
6311 args[_key] = arguments[_key];
6312 }
6313
6314 _this = _Component.call.apply(_Component, [this].concat(args)) || this;
6315
6316 defineProperty(assertThisInitialized(_this), "getColor", function () {
6317 var passwordStrengthMeter = theme.passwordStrengthMeter;
6318 var score = _this.props.score;
6319 var colorArray = [passwordStrengthMeter.none, passwordStrengthMeter.bad, passwordStrengthMeter.medium, passwordStrengthMeter.good, passwordStrengthMeter.excellent];
6320 return colorArray[score];
6321 });
6322
6323 return _this;
6324 }
6325
6326 var _proto = PasswordStrengthMeter.prototype;
6327
6328 _proto.render = function render() {
6329 var _this$props = this.props,
6330 score = _this$props.score,
6331 props = objectWithoutPropertiesLoose(_this$props, ["score"]);
6332
6333 return React__default.createElement(PasswordStrengthStyled, props, React__default.createElement(ProgressBar, {
6334 backgroundColor: this.getColor,
6335 score: score
6336 }), React__default.createElement(BoxContainer, null, React__default.createElement(Box, null), React__default.createElement(Box, null), React__default.createElement(Box, null), React__default.createElement(Box, null)));
6337 };
6338
6339 return PasswordStrengthMeter;
6340}(React.Component);
6341
6342var Box = styled__default.div(_templateObject$H());
6343var BoxContainer = styled__default.div(_templateObject2$f());
6344var ProgressBar = styled__default.div(_templateObject3$a(), function (_ref) {
6345 var score = _ref.score;
6346 return score * 25 + "%";
6347}, function (_ref2) {
6348 var backgroundColor = _ref2.backgroundColor;
6349 return backgroundColor;
6350});
6351var PasswordStrengthStyled = styled__default.div(_templateObject4$7(), function (_ref3) {
6352 var theme$$1 = _ref3.theme;
6353 return theme$$1.passwordStrengthMeter.none;
6354});
6355PasswordStrengthMeter.propTypes = {
6356 /** Score of the password's strength */
6357 score: PropTypes.number.isRequired
6358};
6359PasswordStrengthMeter.displayName = 'PasswordStrength';
6360Box.displayName = 'Box';
6361BoxContainer.displayName = 'BoxContainer';
6362ProgressBar.displayName = 'ProgressBar';
6363PasswordStrengthStyled.displayName = 'PasswordStrengthStyled';
6364
6365function _templateObject$I() {
6366 var data = taggedTemplateLiteralLoose(["\n\tcursor: pointer !important;\n\tpointer-events: all !important;\n\t&&& {\n\t\tcolor: ", " !important;\n\t}\n"]);
6367
6368 _templateObject$I = function _templateObject() {
6369 return data;
6370 };
6371
6372 return data;
6373}
6374
6375var InputPassword =
6376/*#__PURE__*/
6377function (_Component) {
6378 inheritsLoose(InputPassword, _Component);
6379
6380 function InputPassword(props) {
6381 var _this;
6382
6383 _this = _Component.call(this, props) || this;
6384
6385 defineProperty(assertThisInitialized(_this), "setType", function (type) {
6386 _this.setState({
6387 type: type
6388 });
6389 });
6390
6391 defineProperty(assertThisInitialized(_this), "iconInputElement", function () {
6392 var type = _this.state.type;
6393 return React__default.createElement(IconInput, {
6394 icon: type === 'password' ? 'preview' : 'eye-closed',
6395 onClick: function onClick() {
6396 return _this.setType(type === 'password' ? 'text' : 'password');
6397 }
6398 });
6399 });
6400
6401 _this.state = {
6402 type: 'password'
6403 };
6404 return _this;
6405 }
6406
6407 var _proto = InputPassword.prototype;
6408
6409 _proto.render = function render() {
6410 var type = this.state.type;
6411
6412 var _this$props = this.props,
6413 score = _this$props.score,
6414 meter = _this$props.meter,
6415 props = objectWithoutPropertiesLoose(_this$props, ["score", "meter"]);
6416
6417 return React__default.createElement(React__default.Fragment, null, React__default.createElement(Input, _extends_1({
6418 type: type,
6419 icon: this.iconInputElement
6420 }, props)), meter && React__default.createElement(PasswordStrengthMeter, {
6421 score: score
6422 }));
6423 };
6424
6425 return InputPassword;
6426}(React.Component);
6427
6428var IconInput = styled__default(Icon)(_templateObject$I(), function (_ref) {
6429 var theme = _ref.theme;
6430 return theme.colors.activeBlue;
6431});
6432
6433var scoreValidation = function scoreValidation(props, propName, componentName) {
6434 if (props.meter && (props[propName] === null || props[propName] === undefined)) {
6435 return new Error("Failed prop type: '" + propName + "' is set to required when 'meter' is true, in " + componentName + ".");
6436 }
6437};
6438
6439InputPassword.propTypes = {
6440 /** boolean indicating whether password strength validation should render */
6441 meter: PropTypes.bool,
6442
6443 /** custom prop validation function to check the score of the password if meter is true and score defined */
6444 score: scoreValidation
6445};
6446InputPassword.defaultProps = {
6447 meter: false
6448};
6449IconInput.displayName = 'IconInput';
6450InputPassword.displayName = 'InputPassword';
6451
6452function _templateObject$J() {
6453 var data = taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\theight: 8px;\n\tpadding: 0;\n\tmargin: 14px 0;\n\tappearance: none;\n\tbackground: ", ";\n\tborder-radius: 8px;\n\tcursor: pointer;\n\toutline: none;\n\tbox-shadow: none;\n\ttransition: background 450ms ease-in;\n\t::-webkit-slider-thumb {\n\t\twidth: 30px;\n\t\theight: 30px;\n\t\tborder: 1px solid ", ";\n\t\tappearance: none;\n\t\tbackground: ", ";\n\t\tborder-radius: 50%;\n\t}\n\t::-moz-range-thumb {\n\t\twidth: 30px;\n\t\theight: 30px;\n\t\tborder: 1px solid ", ";\n\t\tappearance: none;\n\t\tbackground: ", ";\n\t\tborder-radius: 50%;\n\t\toutline: 0;\n\t}\n\t::-moz-focus-outer {\n\t\tborder: 0;\n\t}\n"]);
6454
6455 _templateObject$J = function _templateObject() {
6456 return data;
6457 };
6458
6459 return data;
6460}
6461
6462var InputRange = function InputRange(_ref) {
6463 var min = _ref.min,
6464 step = _ref.step,
6465 max = _ref.max,
6466 value = _ref.value,
6467 _onChange = _ref.onChange,
6468 onUpdate = _ref.onUpdate,
6469 props = objectWithoutPropertiesLoose(_ref, ["min", "step", "max", "value", "onChange", "onUpdate"]);
6470
6471 return React__default.createElement(InputRangeStyled, _extends_1({
6472 type: "range",
6473 min: 0,
6474 step: step / (max - min) * 100,
6475 max: 100,
6476 value: (value - min) * 100 / (max - min),
6477 onChange: function onChange(e) {
6478 return _onChange(e.target.value / 100 * (max - min) + min);
6479 },
6480 onMouseUp: function onMouseUp(e) {
6481 return onUpdate(e.target.value / 100 * (max - min) + min);
6482 }
6483 }, props));
6484};
6485
6486var InputRangeStyled = styled__default.input(_templateObject$J(), function (_ref2) {
6487 var value = _ref2.value,
6488 theme = _ref2.theme;
6489 return theme.inputRange.gradient(value);
6490}, function (_ref3) {
6491 var theme = _ref3.theme;
6492 return theme.inputRange.borderColor;
6493}, function (_ref4) {
6494 var theme = _ref4.theme;
6495 return theme.inputRange.backgroundThumbColor;
6496}, function (_ref5) {
6497 var theme = _ref5.theme;
6498 return theme.inputRange.borderColor;
6499}, function (_ref6) {
6500 var theme = _ref6.theme;
6501 return theme.inputRange.backgroundThumbColor;
6502});
6503InputRange.defaultProps = {
6504 min: 0,
6505 step: 1,
6506 max: 100
6507};
6508InputRange.propTypes = {
6509 /** minimum value of the input */
6510 // eslint-disable-next-line consistent-return
6511 min: function min(props, propName, componentName) {
6512 var min = props.min,
6513 max = props.max;
6514
6515 if (typeof min === 'number' && min > max) {
6516 return new Error("Invalid prop " + propName + " supplied to " + componentName + ". Validation failed. Please provide a minimum number lower than " + max + ".");
6517 }
6518
6519 if (typeof min !== 'number' && typeof min !== 'undefined') {
6520 return new Error("Invalid prop " + propName + " supplied to " + componentName + ". Validation failed. Please provide a number.");
6521 }
6522 },
6523
6524 /** step value of the input means that the value of the input will increase by the step */
6525 // eslint-disable-next-line consistent-return
6526 step: function step(props, propName, componentName) {
6527 var step = props.step,
6528 min = props.min,
6529 max = props.max;
6530
6531 if (typeof step === 'number' && (step > max || step < min)) {
6532 return new Error("Invalid prop " + propName + " supplied to " + componentName + ". Validation failed. Please provide a step number between " + min + " and " + max);
6533 }
6534
6535 if (typeof step !== 'number' && typeof step !== 'undefined') {
6536 return new Error("Invalid prop " + propName + " supplied to " + componentName + ". Validation failed. Please provide a number.");
6537 }
6538 },
6539
6540 /** maximum value of the input */
6541 max: PropTypes.number,
6542
6543 /** value of the input */
6544 // eslint-disable-next-line consistent-return,react/require-default-props
6545 value: function value(props, propName, componentName) {
6546 var min = props.min,
6547 max = props.max,
6548 value = props.value;
6549
6550 if (typeof value === 'number' && (value < min || value > max)) {
6551 return new Error("Invalid prop " + propName + " supplied to " + componentName + ". Validation failed. Please provide a value number between " + min + " and " + max + ".");
6552 }
6553
6554 if (typeof value !== 'number') {
6555 return new Error("Invalid prop " + propName + " supplied to " + componentName + ". Validation failed. Please provide a number.");
6556 }
6557 },
6558
6559 /** onChange function handler */
6560 onChange: PropTypes.func.isRequired,
6561
6562 /** onUpdate function handler */
6563 onUpdate: PropTypes.func.isRequired
6564};
6565InputRange.displayName = 'InputRange';
6566
6567function _templateObject4$8() {
6568 var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-flex;\n\talign-items: center;\n"]);
6569
6570 _templateObject4$8 = function _templateObject4() {
6571 return data;
6572 };
6573
6574 return data;
6575}
6576
6577function _templateObject3$b() {
6578 var data = taggedTemplateLiteralLoose(["\n\tmargin-top: 4px !important;\n\tmargin-bottom: 0px !important;\n\ttransform: rotate(180deg);\n"]);
6579
6580 _templateObject3$b = function _templateObject3() {
6581 return data;
6582 };
6583
6584 return data;
6585}
6586
6587function _templateObject2$g() {
6588 var data = taggedTemplateLiteralLoose(["\n\tdisplay: block !important;\n\tmargin: 0 auto !important;\n\tmargin-bottom: 4px !important;\n\topacity: 1;\n\tcolor: ", " !important;\n\tpointer-events: ", ";\n\t:active {\n\t\tcolor: ", " !important;\n\t}\n"]);
6589
6590 _templateObject2$g = function _templateObject2() {
6591 return data;
6592 };
6593
6594 return data;
6595}
6596
6597function _templateObject$K() {
6598 var data = taggedTemplateLiteralLoose(["\n\tinput {\n\t\tdisplay: block;\n\t\theight: 20px;\n\t\ttext-align: center !important;\n\t\tpadding: 0 !important;\n\t\tborder: 1px solid\n\t\t\t", " !important;\n\t\tbackground-color: transparent !important;\n\t\tbox-shadow: none !important;\n\t\tcolor: ", " !important;\n\t\tpointer-events: ", ";\n\t\ttransition: none !important;\n\t}\n\n\tinput:hover {\n\t\tbox-sizing: border-box !important;\n\t\tpadding: 0 !important;\n\t\tborder: ", " !important;\n\t\tborder-color: ", " !important;\n\t\tborder-radius: 4px !important;\n\t}\n\n\tinput:focus {\n\t\tbox-sizing: border-box !important;\n\t\tpadding: 0 !important;\n\t\tborder: ", " !important;\n\t\tborder-color: ", " !important;\n\t\tborder-radius: 4px !important;\n\t}\n"]);
6599
6600 _templateObject$K = function _templateObject() {
6601 return data;
6602 };
6603
6604 return data;
6605}
6606
6607var NumberSpinner =
6608/*#__PURE__*/
6609function (_Component) {
6610 inheritsLoose(NumberSpinner, _Component);
6611
6612 function NumberSpinner() {
6613 var _this;
6614
6615 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
6616 args[_key] = arguments[_key];
6617 }
6618
6619 _this = _Component.call.apply(_Component, [this].concat(args)) || this;
6620
6621 defineProperty(assertThisInitialized(_this), "getValue", function (event) {
6622 var _this$props = _this.props,
6623 max = _this$props.max,
6624 min = _this$props.min;
6625 var numValue = Number(event.target.value.replace(/\D/, ''));
6626 return numValue > max ? max : numValue < min ? min : numValue;
6627 });
6628
6629 defineProperty(assertThisInitialized(_this), "stepLimiter", function (newValue) {
6630 var _this$props2 = _this.props,
6631 max = _this$props2.max,
6632 min = _this$props2.min;
6633 var numValue = Number(newValue);
6634 return numValue > max ? min : numValue < min ? max : numValue;
6635 });
6636
6637 defineProperty(assertThisInitialized(_this), "setValueByStep", function (event, newValue) {
6638 var _this$props3 = _this.props,
6639 disabled = _this$props3.disabled,
6640 onChange = _this$props3.onChange;
6641 !disabled && onChange(event, _this.stepLimiter(newValue));
6642 });
6643
6644 defineProperty(assertThisInitialized(_this), "setValueWheel", function (e) {
6645 var _this$props4 = _this.props,
6646 scrollInput = _this$props4.scrollInput,
6647 value = _this$props4.value;
6648
6649 if (scrollInput) {
6650 e.stopPropagation();
6651
6652 _this.setValueByStep(e, Number(value) + (e.deltaY > 0 ? -1 : 1));
6653 }
6654 });
6655
6656 return _this;
6657 }
6658
6659 var _proto = NumberSpinner.prototype;
6660
6661 _proto.render = function render() {
6662 var _this2 = this;
6663
6664 var _this$props5 = this.props,
6665 _onChange = _this$props5.onChange,
6666 name = _this$props5.name,
6667 min = _this$props5.min,
6668 max = _this$props5.max,
6669 value = _this$props5.value,
6670 disabled = _this$props5.disabled,
6671 readOnly = _this$props5.readOnly,
6672 error = _this$props5.error,
6673 scrollInput = _this$props5.scrollInput,
6674 props = objectWithoutPropertiesLoose(_this$props5, ["onChange", "name", "min", "max", "value", "disabled", "readOnly", "error", "scrollInput"]);
6675
6676 var size = String(max).length;
6677 return React__default.createElement(Container, null, React__default.createElement("div", null, React__default.createElement(IconUp, {
6678 disabled: disabled,
6679 icon: "select-up",
6680 onClick: function onClick(e) {
6681 return _this2.setValueByStep(e, Number(value) + 1);
6682 }
6683 }), React__default.createElement(Input$1, _extends_1({
6684 readOnly: readOnly,
6685 name: name,
6686 error: error,
6687 disabled: disabled,
6688 min: min,
6689 value: value,
6690 max: max,
6691 input: React__default.createElement("input", {
6692 size: size,
6693 maxLength: size + 1
6694 }),
6695 onWheel: this.setValueWheel,
6696 onChange: function onChange(e) {
6697 return _onChange(e, _this2.getValue(e));
6698 }
6699 }, props)), React__default.createElement(IconDown, {
6700 disabled: disabled,
6701 icon: "select-up",
6702 onClick: function onClick(e) {
6703 return _this2.setValueByStep(e, Number(value) - 1);
6704 }
6705 })));
6706 };
6707
6708 return NumberSpinner;
6709}(React.Component);
6710
6711NumberSpinner.defaultProps = {
6712 min: 0,
6713 max: 10,
6714 value: 0,
6715 disabled: false,
6716 readOnly: false,
6717 error: false,
6718 scrollInput: false
6719};
6720
6721var minPropValidation = function minPropValidation(props, propName, componentName) {
6722 var min = props.min,
6723 max = props.max;
6724
6725 if (typeof min === 'number' && min > max) {
6726 return new Error("Invalid prop " + propName + " supplied to " + componentName + ". Validation failed. Please provide a minimum number lower than " + max + ".");
6727 }
6728
6729 if (typeof min !== 'number' && typeof min !== 'undefined') {
6730 return new Error("Invalid prop " + propName + " supplied to " + componentName + ". Validation failed. Please provide a number.");
6731 }
6732};
6733
6734var valuePropValidation = function valuePropValidation(props, propName, componentName) {
6735 var min = props.min,
6736 max = props.max,
6737 value = props.value;
6738
6739 if (typeof value === 'number' && (value < min || value > max)) {
6740 return new Error("Invalid prop " + propName + " supplied to " + componentName + ". Validation failed. Please provide a value number between " + min + " and " + max + ".");
6741 }
6742
6743 if (typeof value === 'string' && (Number(value) < min || Number(value) > max)) {
6744 return new Error("Invalid prop " + propName + " supplied to " + componentName + ". Validation failed. Please provide a value number inside the string between " + min + " and " + max + ".");
6745 }
6746
6747 if (typeof value !== 'number' && typeof value !== 'string') {
6748 return new Error("Invalid prop " + propName + " supplied to " + componentName + ". Validation failed. Please provide a number.");
6749 }
6750};
6751
6752NumberSpinner.propTypes = {
6753 /** onChange function handler */
6754 onChange: PropTypes.func.isRequired,
6755
6756 /** name string to the input */
6757 name: PropTypes.string.isRequired,
6758
6759 /** boolean to activate or deactivate the scroll input feature */
6760 scrollInput: PropTypes.bool,
6761
6762 /** minimum value of the input */
6763 min: minPropValidation,
6764
6765 /** maximum value of the input */
6766 max: PropTypes.number,
6767
6768 /** value of the input */
6769 value: valuePropValidation,
6770
6771 /** boolean to control the disabled attribute of the input */
6772 disabled: PropTypes.bool,
6773
6774 /** boolean to control the readOnly attribute of the input */
6775 readOnly: PropTypes.bool,
6776
6777 /** boolean to control the error status of the input */
6778 error: PropTypes.bool
6779};
6780var Input$1 = styled__default(function (_ref) {
6781 var size = _ref.size,
6782 maxLength = _ref.maxLength,
6783 props = objectWithoutPropertiesLoose(_ref, ["size", "maxLength"]);
6784
6785 return React__default.createElement(semanticUiReact.Input, props);
6786})(_templateObject$K(), function (_ref2) {
6787 var error = _ref2.error,
6788 disabled = _ref2.disabled,
6789 theme = _ref2.theme;
6790 return error && !disabled ? theme.numberSpinner.errorColor : theme.numberSpinner.borderColor;
6791}, function (_ref3) {
6792 var disabled = _ref3.disabled,
6793 theme = _ref3.theme;
6794 return disabled ? theme.numberSpinner.disabledColorText : theme.numberSpinner.textColor;
6795}, function (_ref4) {
6796 var disabled = _ref4.disabled,
6797 readOnly = _ref4.readOnly;
6798 return disabled || readOnly ? 'none' : 'initial';
6799}, function (_ref5) {
6800 var disabled = _ref5.disabled,
6801 readOnly = _ref5.readOnly;
6802 return disabled || readOnly ? 'none' : '1px solid';
6803}, function (_ref6) {
6804 var disabled = _ref6.disabled,
6805 error = _ref6.error,
6806 theme = _ref6.theme;
6807 return disabled && 'none' || error && theme.numberSpinner.errorColor || theme.numberSpinner.hoverColor;
6808}, function (_ref7) {
6809 var disabled = _ref7.disabled,
6810 readOnly = _ref7.readOnly;
6811 return disabled || readOnly ? 'none' : '1px solid';
6812}, function (_ref8) {
6813 var disabled = _ref8.disabled,
6814 error = _ref8.error,
6815 theme = _ref8.theme;
6816 return disabled && 'none' || error && theme.numberSpinner.errorColor || theme.numberSpinner.primaryColor;
6817});
6818Input$1.displayName = 'Input';
6819var IconUp = styled__default(Icon)(_templateObject2$g(), function (_ref9) {
6820 var disabled = _ref9.disabled,
6821 theme = _ref9.theme;
6822 return disabled ? theme.numberSpinner.disabledColor : theme.numberSpinner.primaryColor;
6823}, function (_ref10) {
6824 var disabled = _ref10.disabled;
6825 return disabled ? 'none' : 'initial';
6826}, function (_ref11) {
6827 var disabled = _ref11.disabled,
6828 theme = _ref11.theme;
6829 return disabled ? theme.numberSpinner.disabledColor : theme.numberSpinner.activeColor;
6830});
6831IconUp.displayName = 'IconUp';
6832var IconDown = styled__default(IconUp)(_templateObject3$b());
6833IconDown.displayName = 'IconDown';
6834var Container = styled__default.div(_templateObject4$8());
6835Container.displayName = 'Container';
6836
6837function areInputsEqual(newInputs, lastInputs) {
6838 if (newInputs.length !== lastInputs.length) {
6839 return false;
6840 }
6841
6842 for (var i = 0; i < newInputs.length; i++) {
6843 if (newInputs[i] !== lastInputs[i]) {
6844 return false;
6845 }
6846 }
6847
6848 return true;
6849}
6850
6851function index$2 (resultFn, isEqual) {
6852 if (isEqual === void 0) {
6853 isEqual = areInputsEqual;
6854 }
6855
6856 var lastThis;
6857 var lastArgs = [];
6858 var lastResult;
6859 var calledOnce = false;
6860
6861 var result = function result() {
6862 for (var _len = arguments.length, newArgs = new Array(_len), _key = 0; _key < _len; _key++) {
6863 newArgs[_key] = arguments[_key];
6864 }
6865
6866 if (calledOnce && lastThis === this && isEqual(newArgs, lastArgs)) {
6867 return lastResult;
6868 }
6869
6870 lastResult = resultFn.apply(this, newArgs);
6871 calledOnce = true;
6872 lastThis = this;
6873 lastArgs = newArgs;
6874 return lastResult;
6875 };
6876
6877 return result;
6878}
6879
6880function memoize(fn) {
6881 var cache = {};
6882 return function (arg) {
6883 if (cache[arg] === undefined) cache[arg] = fn(arg);
6884 return cache[arg];
6885 };
6886}
6887
6888var unitlessKeys = {
6889 animationIterationCount: 1,
6890 borderImageOutset: 1,
6891 borderImageSlice: 1,
6892 borderImageWidth: 1,
6893 boxFlex: 1,
6894 boxFlexGroup: 1,
6895 boxOrdinalGroup: 1,
6896 columnCount: 1,
6897 columns: 1,
6898 flex: 1,
6899 flexGrow: 1,
6900 flexPositive: 1,
6901 flexShrink: 1,
6902 flexNegative: 1,
6903 flexOrder: 1,
6904 gridRow: 1,
6905 gridRowEnd: 1,
6906 gridRowSpan: 1,
6907 gridRowStart: 1,
6908 gridColumn: 1,
6909 gridColumnEnd: 1,
6910 gridColumnSpan: 1,
6911 gridColumnStart: 1,
6912 fontWeight: 1,
6913 lineHeight: 1,
6914 opacity: 1,
6915 order: 1,
6916 orphans: 1,
6917 tabSize: 1,
6918 widows: 1,
6919 zIndex: 1,
6920 zoom: 1,
6921 WebkitLineClamp: 1,
6922 // SVG-related properties
6923 fillOpacity: 1,
6924 floodOpacity: 1,
6925 stopOpacity: 1,
6926 strokeDasharray: 1,
6927 strokeDashoffset: 1,
6928 strokeMiterlimit: 1,
6929 strokeOpacity: 1,
6930 strokeWidth: 1
6931};
6932
6933/* eslint-disable */
6934// murmurhash2 via https://github.com/garycourt/murmurhash-js/blob/master/murmurhash2_gc.js
6935function murmurhash2_32_gc(str) {
6936 var l = str.length,
6937 h = l ^ l,
6938 i = 0,
6939 k;
6940
6941 while (l >= 4) {
6942 k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
6943 k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16);
6944 k ^= k >>> 24;
6945 k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16);
6946 h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16) ^ k;
6947 l -= 4;
6948 ++i;
6949 }
6950
6951 switch (l) {
6952 case 3:
6953 h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
6954
6955 case 2:
6956 h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
6957
6958 case 1:
6959 h ^= str.charCodeAt(i) & 0xff;
6960 h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16);
6961 }
6962
6963 h ^= h >>> 13;
6964 h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16);
6965 h ^= h >>> 15;
6966 return (h >>> 0).toString(36);
6967}
6968
6969function stylis_min (W) {
6970 function M(d, c, e, h, a) {
6971 for (var m = 0, b = 0, v = 0, n = 0, q, g, x = 0, K = 0, k, u = k = q = 0, l = 0, r = 0, I = 0, t = 0, B = e.length, J = B - 1, y, f = '', p = '', F = '', G = '', C; l < B;) {
6972 g = e.charCodeAt(l);
6973 l === J && 0 !== b + n + v + m && (0 !== b && (g = 47 === b ? 10 : 47), n = v = m = 0, B++, J++);
6974
6975 if (0 === b + n + v + m) {
6976 if (l === J && (0 < r && (f = f.replace(N, '')), 0 < f.trim().length)) {
6977 switch (g) {
6978 case 32:
6979 case 9:
6980 case 59:
6981 case 13:
6982 case 10:
6983 break;
6984
6985 default:
6986 f += e.charAt(l);
6987 }
6988
6989 g = 59;
6990 }
6991
6992 switch (g) {
6993 case 123:
6994 f = f.trim();
6995 q = f.charCodeAt(0);
6996 k = 1;
6997
6998 for (t = ++l; l < B;) {
6999 switch (g = e.charCodeAt(l)) {
7000 case 123:
7001 k++;
7002 break;
7003
7004 case 125:
7005 k--;
7006 break;
7007
7008 case 47:
7009 switch (g = e.charCodeAt(l + 1)) {
7010 case 42:
7011 case 47:
7012 a: {
7013 for (u = l + 1; u < J; ++u) {
7014 switch (e.charCodeAt(u)) {
7015 case 47:
7016 if (42 === g && 42 === e.charCodeAt(u - 1) && l + 2 !== u) {
7017 l = u + 1;
7018 break a;
7019 }
7020
7021 break;
7022
7023 case 10:
7024 if (47 === g) {
7025 l = u + 1;
7026 break a;
7027 }
7028
7029 }
7030 }
7031
7032 l = u;
7033 }
7034
7035 }
7036
7037 break;
7038
7039 case 91:
7040 g++;
7041
7042 case 40:
7043 g++;
7044
7045 case 34:
7046 case 39:
7047 for (; l++ < J && e.charCodeAt(l) !== g;) {
7048 }
7049
7050 }
7051
7052 if (0 === k) break;
7053 l++;
7054 }
7055
7056 k = e.substring(t, l);
7057 0 === q && (q = (f = f.replace(ca, '').trim()).charCodeAt(0));
7058
7059 switch (q) {
7060 case 64:
7061 0 < r && (f = f.replace(N, ''));
7062 g = f.charCodeAt(1);
7063
7064 switch (g) {
7065 case 100:
7066 case 109:
7067 case 115:
7068 case 45:
7069 r = c;
7070 break;
7071
7072 default:
7073 r = O;
7074 }
7075
7076 k = M(c, r, k, g, a + 1);
7077 t = k.length;
7078 0 < A && (r = X(O, f, I), C = H(3, k, r, c, D, z, t, g, a, h), f = r.join(''), void 0 !== C && 0 === (t = (k = C.trim()).length) && (g = 0, k = ''));
7079 if (0 < t) switch (g) {
7080 case 115:
7081 f = f.replace(da, ea);
7082
7083 case 100:
7084 case 109:
7085 case 45:
7086 k = f + '{' + k + '}';
7087 break;
7088
7089 case 107:
7090 f = f.replace(fa, '$1 $2');
7091 k = f + '{' + k + '}';
7092 k = 1 === w || 2 === w && L('@' + k, 3) ? '@-webkit-' + k + '@' + k : '@' + k;
7093 break;
7094
7095 default:
7096 k = f + k, 112 === h && (k = (p += k, ''));
7097 } else k = '';
7098 break;
7099
7100 default:
7101 k = M(c, X(c, f, I), k, h, a + 1);
7102 }
7103
7104 F += k;
7105 k = I = r = u = q = 0;
7106 f = '';
7107 g = e.charCodeAt(++l);
7108 break;
7109
7110 case 125:
7111 case 59:
7112 f = (0 < r ? f.replace(N, '') : f).trim();
7113 if (1 < (t = f.length)) switch (0 === u && (q = f.charCodeAt(0), 45 === q || 96 < q && 123 > q) && (t = (f = f.replace(' ', ':')).length), 0 < A && void 0 !== (C = H(1, f, c, d, D, z, p.length, h, a, h)) && 0 === (t = (f = C.trim()).length) && (f = '\x00\x00'), q = f.charCodeAt(0), g = f.charCodeAt(1), q) {
7114 case 0:
7115 break;
7116
7117 case 64:
7118 if (105 === g || 99 === g) {
7119 G += f + e.charAt(l);
7120 break;
7121 }
7122
7123 default:
7124 58 !== f.charCodeAt(t - 1) && (p += P(f, q, g, f.charCodeAt(2)));
7125 }
7126 I = r = u = q = 0;
7127 f = '';
7128 g = e.charCodeAt(++l);
7129 }
7130 }
7131
7132 switch (g) {
7133 case 13:
7134 case 10:
7135 47 === b ? b = 0 : 0 === 1 + q && 107 !== h && 0 < f.length && (r = 1, f += '\x00');
7136 0 < A * Y && H(0, f, c, d, D, z, p.length, h, a, h);
7137 z = 1;
7138 D++;
7139 break;
7140
7141 case 59:
7142 case 125:
7143 if (0 === b + n + v + m) {
7144 z++;
7145 break;
7146 }
7147
7148 default:
7149 z++;
7150 y = e.charAt(l);
7151
7152 switch (g) {
7153 case 9:
7154 case 32:
7155 if (0 === n + m + b) switch (x) {
7156 case 44:
7157 case 58:
7158 case 9:
7159 case 32:
7160 y = '';
7161 break;
7162
7163 default:
7164 32 !== g && (y = ' ');
7165 }
7166 break;
7167
7168 case 0:
7169 y = '\\0';
7170 break;
7171
7172 case 12:
7173 y = '\\f';
7174 break;
7175
7176 case 11:
7177 y = '\\v';
7178 break;
7179
7180 case 38:
7181 0 === n + b + m && (r = I = 1, y = '\f' + y);
7182 break;
7183
7184 case 108:
7185 if (0 === n + b + m + E && 0 < u) switch (l - u) {
7186 case 2:
7187 112 === x && 58 === e.charCodeAt(l - 3) && (E = x);
7188
7189 case 8:
7190 111 === K && (E = K);
7191 }
7192 break;
7193
7194 case 58:
7195 0 === n + b + m && (u = l);
7196 break;
7197
7198 case 44:
7199 0 === b + v + n + m && (r = 1, y += '\r');
7200 break;
7201
7202 case 34:
7203 case 39:
7204 0 === b && (n = n === g ? 0 : 0 === n ? g : n);
7205 break;
7206
7207 case 91:
7208 0 === n + b + v && m++;
7209 break;
7210
7211 case 93:
7212 0 === n + b + v && m--;
7213 break;
7214
7215 case 41:
7216 0 === n + b + m && v--;
7217 break;
7218
7219 case 40:
7220 if (0 === n + b + m) {
7221 if (0 === q) switch (2 * x + 3 * K) {
7222 case 533:
7223 break;
7224
7225 default:
7226 q = 1;
7227 }
7228 v++;
7229 }
7230
7231 break;
7232
7233 case 64:
7234 0 === b + v + n + m + u + k && (k = 1);
7235 break;
7236
7237 case 42:
7238 case 47:
7239 if (!(0 < n + m + v)) switch (b) {
7240 case 0:
7241 switch (2 * g + 3 * e.charCodeAt(l + 1)) {
7242 case 235:
7243 b = 47;
7244 break;
7245
7246 case 220:
7247 t = l, b = 42;
7248 }
7249
7250 break;
7251
7252 case 42:
7253 47 === g && 42 === x && t + 2 !== l && (33 === e.charCodeAt(t + 2) && (p += e.substring(t, l + 1)), y = '', b = 0);
7254 }
7255 }
7256
7257 0 === b && (f += y);
7258 }
7259
7260 K = x;
7261 x = g;
7262 l++;
7263 }
7264
7265 t = p.length;
7266
7267 if (0 < t) {
7268 r = c;
7269 if (0 < A && (C = H(2, p, r, d, D, z, t, h, a, h), void 0 !== C && 0 === (p = C).length)) return G + p + F;
7270 p = r.join(',') + '{' + p + '}';
7271
7272 if (0 !== w * E) {
7273 2 !== w || L(p, 2) || (E = 0);
7274
7275 switch (E) {
7276 case 111:
7277 p = p.replace(ha, ':-moz-$1') + p;
7278 break;
7279
7280 case 112:
7281 p = p.replace(Q, '::-webkit-input-$1') + p.replace(Q, '::-moz-$1') + p.replace(Q, ':-ms-input-$1') + p;
7282 }
7283
7284 E = 0;
7285 }
7286 }
7287
7288 return G + p + F;
7289 }
7290
7291 function X(d, c, e) {
7292 var h = c.trim().split(ia);
7293 c = h;
7294 var a = h.length,
7295 m = d.length;
7296
7297 switch (m) {
7298 case 0:
7299 case 1:
7300 var b = 0;
7301
7302 for (d = 0 === m ? '' : d[0] + ' '; b < a; ++b) {
7303 c[b] = Z(d, c[b], e, m).trim();
7304 }
7305
7306 break;
7307
7308 default:
7309 var v = b = 0;
7310
7311 for (c = []; b < a; ++b) {
7312 for (var n = 0; n < m; ++n) {
7313 c[v++] = Z(d[n] + ' ', h[b], e, m).trim();
7314 }
7315 }
7316
7317 }
7318
7319 return c;
7320 }
7321
7322 function Z(d, c, e) {
7323 var h = c.charCodeAt(0);
7324 33 > h && (h = (c = c.trim()).charCodeAt(0));
7325
7326 switch (h) {
7327 case 38:
7328 return c.replace(F, '$1' + d.trim());
7329
7330 case 58:
7331 return d.trim() + c.replace(F, '$1' + d.trim());
7332
7333 default:
7334 if (0 < 1 * e && 0 < c.indexOf('\f')) return c.replace(F, (58 === d.charCodeAt(0) ? '' : '$1') + d.trim());
7335 }
7336
7337 return d + c;
7338 }
7339
7340 function P(d, c, e, h) {
7341 var a = d + ';',
7342 m = 2 * c + 3 * e + 4 * h;
7343
7344 if (944 === m) {
7345 d = a.indexOf(':', 9) + 1;
7346 var b = a.substring(d, a.length - 1).trim();
7347 b = a.substring(0, d).trim() + b + ';';
7348 return 1 === w || 2 === w && L(b, 1) ? '-webkit-' + b + b : b;
7349 }
7350
7351 if (0 === w || 2 === w && !L(a, 1)) return a;
7352
7353 switch (m) {
7354 case 1015:
7355 return 97 === a.charCodeAt(10) ? '-webkit-' + a + a : a;
7356
7357 case 951:
7358 return 116 === a.charCodeAt(3) ? '-webkit-' + a + a : a;
7359
7360 case 963:
7361 return 110 === a.charCodeAt(5) ? '-webkit-' + a + a : a;
7362
7363 case 1009:
7364 if (100 !== a.charCodeAt(4)) break;
7365
7366 case 969:
7367 case 942:
7368 return '-webkit-' + a + a;
7369
7370 case 978:
7371 return '-webkit-' + a + '-moz-' + a + a;
7372
7373 case 1019:
7374 case 983:
7375 return '-webkit-' + a + '-moz-' + a + '-ms-' + a + a;
7376
7377 case 883:
7378 if (45 === a.charCodeAt(8)) return '-webkit-' + a + a;
7379 if (0 < a.indexOf('image-set(', 11)) return a.replace(ja, '$1-webkit-$2') + a;
7380 break;
7381
7382 case 932:
7383 if (45 === a.charCodeAt(4)) switch (a.charCodeAt(5)) {
7384 case 103:
7385 return '-webkit-box-' + a.replace('-grow', '') + '-webkit-' + a + '-ms-' + a.replace('grow', 'positive') + a;
7386
7387 case 115:
7388 return '-webkit-' + a + '-ms-' + a.replace('shrink', 'negative') + a;
7389
7390 case 98:
7391 return '-webkit-' + a + '-ms-' + a.replace('basis', 'preferred-size') + a;
7392 }
7393 return '-webkit-' + a + '-ms-' + a + a;
7394
7395 case 964:
7396 return '-webkit-' + a + '-ms-flex-' + a + a;
7397
7398 case 1023:
7399 if (99 !== a.charCodeAt(8)) break;
7400 b = a.substring(a.indexOf(':', 15)).replace('flex-', '').replace('space-between', 'justify');
7401 return '-webkit-box-pack' + b + '-webkit-' + a + '-ms-flex-pack' + b + a;
7402
7403 case 1005:
7404 return ka.test(a) ? a.replace(aa, ':-webkit-') + a.replace(aa, ':-moz-') + a : a;
7405
7406 case 1e3:
7407 b = a.substring(13).trim();
7408 c = b.indexOf('-') + 1;
7409
7410 switch (b.charCodeAt(0) + b.charCodeAt(c)) {
7411 case 226:
7412 b = a.replace(G, 'tb');
7413 break;
7414
7415 case 232:
7416 b = a.replace(G, 'tb-rl');
7417 break;
7418
7419 case 220:
7420 b = a.replace(G, 'lr');
7421 break;
7422
7423 default:
7424 return a;
7425 }
7426
7427 return '-webkit-' + a + '-ms-' + b + a;
7428
7429 case 1017:
7430 if (-1 === a.indexOf('sticky', 9)) break;
7431
7432 case 975:
7433 c = (a = d).length - 10;
7434 b = (33 === a.charCodeAt(c) ? a.substring(0, c) : a).substring(d.indexOf(':', 7) + 1).trim();
7435
7436 switch (m = b.charCodeAt(0) + (b.charCodeAt(7) | 0)) {
7437 case 203:
7438 if (111 > b.charCodeAt(8)) break;
7439
7440 case 115:
7441 a = a.replace(b, '-webkit-' + b) + ';' + a;
7442 break;
7443
7444 case 207:
7445 case 102:
7446 a = a.replace(b, '-webkit-' + (102 < m ? 'inline-' : '') + 'box') + ';' + a.replace(b, '-webkit-' + b) + ';' + a.replace(b, '-ms-' + b + 'box') + ';' + a;
7447 }
7448
7449 return a + ';';
7450
7451 case 938:
7452 if (45 === a.charCodeAt(5)) switch (a.charCodeAt(6)) {
7453 case 105:
7454 return b = a.replace('-items', ''), '-webkit-' + a + '-webkit-box-' + b + '-ms-flex-' + b + a;
7455
7456 case 115:
7457 return '-webkit-' + a + '-ms-flex-item-' + a.replace(ba, '') + a;
7458
7459 default:
7460 return '-webkit-' + a + '-ms-flex-line-pack' + a.replace('align-content', '').replace(ba, '') + a;
7461 }
7462 break;
7463
7464 case 973:
7465 case 989:
7466 if (45 !== a.charCodeAt(3) || 122 === a.charCodeAt(4)) break;
7467
7468 case 931:
7469 case 953:
7470 if (!0 === la.test(d)) return 115 === (b = d.substring(d.indexOf(':') + 1)).charCodeAt(0) ? P(d.replace('stretch', 'fill-available'), c, e, h).replace(':fill-available', ':stretch') : a.replace(b, '-webkit-' + b) + a.replace(b, '-moz-' + b.replace('fill-', '')) + a;
7471 break;
7472
7473 case 962:
7474 if (a = '-webkit-' + a + (102 === a.charCodeAt(5) ? '-ms-' + a : '') + a, 211 === e + h && 105 === a.charCodeAt(13) && 0 < a.indexOf('transform', 10)) return a.substring(0, a.indexOf(';', 27) + 1).replace(ma, '$1-webkit-$2') + a;
7475 }
7476
7477 return a;
7478 }
7479
7480 function L(d, c) {
7481 var e = d.indexOf(1 === c ? ':' : '{'),
7482 h = d.substring(0, 3 !== c ? e : 10);
7483 e = d.substring(e + 1, d.length - 1);
7484 return R(2 !== c ? h : h.replace(na, '$1'), e, c);
7485 }
7486
7487 function ea(d, c) {
7488 var e = P(c, c.charCodeAt(0), c.charCodeAt(1), c.charCodeAt(2));
7489 return e !== c + ';' ? e.replace(oa, ' or ($1)').substring(4) : '(' + c + ')';
7490 }
7491
7492 function H(d, c, e, h, a, m, b, v, n, q) {
7493 for (var g = 0, x = c, w; g < A; ++g) {
7494 switch (w = S[g].call(B, d, x, e, h, a, m, b, v, n, q)) {
7495 case void 0:
7496 case !1:
7497 case !0:
7498 case null:
7499 break;
7500
7501 default:
7502 x = w;
7503 }
7504 }
7505
7506 if (x !== c) return x;
7507 }
7508
7509 function T(d) {
7510 switch (d) {
7511 case void 0:
7512 case null:
7513 A = S.length = 0;
7514 break;
7515
7516 default:
7517 switch (d.constructor) {
7518 case Array:
7519 for (var c = 0, e = d.length; c < e; ++c) {
7520 T(d[c]);
7521 }
7522
7523 break;
7524
7525 case Function:
7526 S[A++] = d;
7527 break;
7528
7529 case Boolean:
7530 Y = !!d | 0;
7531 }
7532
7533 }
7534
7535 return T;
7536 }
7537
7538 function U(d) {
7539 d = d.prefix;
7540 void 0 !== d && (R = null, d ? 'function' !== typeof d ? w = 1 : (w = 2, R = d) : w = 0);
7541 return U;
7542 }
7543
7544 function B(d, c) {
7545 var e = d;
7546 33 > e.charCodeAt(0) && (e = e.trim());
7547 V = e;
7548 e = [V];
7549
7550 if (0 < A) {
7551 var h = H(-1, c, e, e, D, z, 0, 0, 0, 0);
7552 void 0 !== h && 'string' === typeof h && (c = h);
7553 }
7554
7555 var a = M(O, e, c, 0, 0);
7556 0 < A && (h = H(-2, a, e, e, D, z, a.length, 0, 0, 0), void 0 !== h && (a = h));
7557 V = '';
7558 E = 0;
7559 z = D = 1;
7560 return a;
7561 }
7562
7563 var ca = /^\0+/g,
7564 N = /[\0\r\f]/g,
7565 aa = /: */g,
7566 ka = /zoo|gra/,
7567 ma = /([,: ])(transform)/g,
7568 ia = /,\r+?/g,
7569 F = /([\t\r\n ])*\f?&/g,
7570 fa = /@(k\w+)\s*(\S*)\s*/,
7571 Q = /::(place)/g,
7572 ha = /:(read-only)/g,
7573 G = /[svh]\w+-[tblr]{2}/,
7574 da = /\(\s*(.*)\s*\)/g,
7575 oa = /([\s\S]*?);/g,
7576 ba = /-self|flex-/g,
7577 na = /[^]*?(:[rp][el]a[\w-]+)[^]*/,
7578 la = /stretch|:\s*\w+\-(?:conte|avail)/,
7579 ja = /([^-])(image-set\()/,
7580 z = 1,
7581 D = 1,
7582 E = 0,
7583 w = 1,
7584 O = [],
7585 S = [],
7586 A = 0,
7587 R = null,
7588 Y = 0,
7589 V = '';
7590 B.use = T;
7591 B.set = U;
7592 void 0 !== W && U(W);
7593 return B;
7594}
7595
7596var stylisRuleSheet = createCommonjsModule(function (module, exports) {
7597(function (factory) {
7598 module['exports'] = factory();
7599}(function () {
7600
7601 return function (insertRule) {
7602 var delimiter = '/*|*/';
7603 var needle = delimiter+'}';
7604
7605 function toSheet (block) {
7606 if (block)
7607 try {
7608 insertRule(block + '}');
7609 } catch (e) {}
7610 }
7611
7612 return function ruleSheet (context, content, selectors, parents, line, column, length, ns, depth, at) {
7613 switch (context) {
7614 // property
7615 case 1:
7616 // @import
7617 if (depth === 0 && content.charCodeAt(0) === 64)
7618 return insertRule(content+';'), ''
7619 break
7620 // selector
7621 case 2:
7622 if (ns === 0)
7623 return content + delimiter
7624 break
7625 // at-rule
7626 case 3:
7627 switch (ns) {
7628 // @font-face, @page
7629 case 102:
7630 case 112:
7631 return insertRule(selectors[0]+content), ''
7632 default:
7633 return content + (at === 0 ? delimiter : '')
7634 }
7635 case -2:
7636 content.split(needle).forEach(toSheet);
7637 }
7638 }
7639 }
7640}));
7641});
7642
7643var hyphenateRegex = /[A-Z]|^ms/g;
7644var processStyleName = memoize(function (styleName) {
7645 return styleName.replace(hyphenateRegex, '-$&').toLowerCase();
7646});
7647var processStyleValue = function processStyleValue(key, value) {
7648 if (value == null || typeof value === 'boolean') {
7649 return '';
7650 }
7651
7652 if (unitlessKeys[key] !== 1 && key.charCodeAt(1) !== 45 && // custom properties
7653 !isNaN(value) && value !== 0) {
7654 return value + 'px';
7655 }
7656
7657 return value;
7658};
7659
7660if (process.env.NODE_ENV !== 'production') {
7661 var contentValuePattern = /(attr|calc|counters?|url)\(/;
7662 var contentValues = ['normal', 'none', 'counter', 'open-quote', 'close-quote', 'no-open-quote', 'no-close-quote', 'initial', 'inherit', 'unset'];
7663 var oldProcessStyleValue = processStyleValue;
7664
7665 processStyleValue = function processStyleValue(key, value) {
7666 if (key === 'content') {
7667 if (typeof value !== 'string' || contentValues.indexOf(value) === -1 && !contentValuePattern.test(value) && (value.charAt(0) !== value.charAt(value.length - 1) || value.charAt(0) !== '"' && value.charAt(0) !== "'")) {
7668 console.error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`");
7669 }
7670 }
7671
7672 return oldProcessStyleValue(key, value);
7673 };
7674}
7675
7676var classnames$1 = function classnames(args) {
7677 var len = args.length;
7678 var i = 0;
7679 var cls = '';
7680
7681 for (; i < len; i++) {
7682 var arg = args[i];
7683 if (arg == null) continue;
7684 var toAdd = void 0;
7685
7686 switch (typeof arg) {
7687 case 'boolean':
7688 break;
7689
7690 case 'function':
7691 if (process.env.NODE_ENV !== 'production') {
7692 console.error('Passing functions to cx is deprecated and will be removed in the next major version of Emotion.\n' + 'Please call the function before passing it to cx.');
7693 }
7694
7695 toAdd = classnames([arg()]);
7696 break;
7697
7698 case 'object':
7699 {
7700 if (Array.isArray(arg)) {
7701 toAdd = classnames(arg);
7702 } else {
7703 toAdd = '';
7704
7705 for (var k in arg) {
7706 if (arg[k] && k) {
7707 toAdd && (toAdd += ' ');
7708 toAdd += k;
7709 }
7710 }
7711 }
7712
7713 break;
7714 }
7715
7716 default:
7717 {
7718 toAdd = arg;
7719 }
7720 }
7721
7722 if (toAdd) {
7723 cls && (cls += ' ');
7724 cls += toAdd;
7725 }
7726 }
7727
7728 return cls;
7729};
7730var isBrowser = typeof document !== 'undefined';
7731
7732/*
7733
7734high performance StyleSheet for css-in-js systems
7735
7736- uses multiple style tags behind the scenes for millions of rules
7737- uses `insertRule` for appending in production for *much* faster performance
7738- 'polyfills' on server side
7739
7740// usage
7741
7742import StyleSheet from 'glamor/lib/sheet'
7743let styleSheet = new StyleSheet()
7744
7745styleSheet.inject()
7746- 'injects' the stylesheet into the page (or into memory if on server)
7747
7748styleSheet.insert('#box { border: 1px solid red; }')
7749- appends a css rule into the stylesheet
7750
7751styleSheet.flush()
7752- empties the stylesheet of all its contents
7753
7754*/
7755// $FlowFixMe
7756function sheetForTag(tag) {
7757 if (tag.sheet) {
7758 // $FlowFixMe
7759 return tag.sheet;
7760 } // this weirdness brought to you by firefox
7761
7762
7763 for (var i = 0; i < document.styleSheets.length; i++) {
7764 if (document.styleSheets[i].ownerNode === tag) {
7765 // $FlowFixMe
7766 return document.styleSheets[i];
7767 }
7768 }
7769}
7770
7771function makeStyleTag(opts) {
7772 var tag = document.createElement('style');
7773 tag.setAttribute('data-emotion', opts.key || '');
7774
7775 if (opts.nonce !== undefined) {
7776 tag.setAttribute('nonce', opts.nonce);
7777 }
7778
7779 tag.appendChild(document.createTextNode('')) // $FlowFixMe
7780 ;
7781 (opts.container !== undefined ? opts.container : document.head).appendChild(tag);
7782 return tag;
7783}
7784
7785var StyleSheet =
7786/*#__PURE__*/
7787function () {
7788 function StyleSheet(options) {
7789 this.isSpeedy = process.env.NODE_ENV === 'production'; // the big drawback here is that the css won't be editable in devtools
7790
7791 this.tags = [];
7792 this.ctr = 0;
7793 this.opts = options;
7794 }
7795
7796 var _proto = StyleSheet.prototype;
7797
7798 _proto.inject = function inject() {
7799 if (this.injected) {
7800 throw new Error('already injected!');
7801 }
7802
7803 this.tags[0] = makeStyleTag(this.opts);
7804 this.injected = true;
7805 };
7806
7807 _proto.speedy = function speedy(bool) {
7808 if (this.ctr !== 0) {
7809 // cannot change speedy mode after inserting any rule to sheet. Either call speedy(${bool}) earlier in your app, or call flush() before speedy(${bool})
7810 throw new Error("cannot change speedy now");
7811 }
7812
7813 this.isSpeedy = !!bool;
7814 };
7815
7816 _proto.insert = function insert(rule, sourceMap) {
7817 // this is the ultrafast version, works across browsers
7818 if (this.isSpeedy) {
7819 var tag = this.tags[this.tags.length - 1];
7820 var sheet = sheetForTag(tag);
7821
7822 try {
7823 sheet.insertRule(rule, sheet.cssRules.length);
7824 } catch (e) {
7825 if (process.env.NODE_ENV !== 'production') {
7826 console.warn('illegal rule', rule); // eslint-disable-line no-console
7827 }
7828 }
7829 } else {
7830 var _tag = makeStyleTag(this.opts);
7831
7832 this.tags.push(_tag);
7833
7834 _tag.appendChild(document.createTextNode(rule + (sourceMap || '')));
7835 }
7836
7837 this.ctr++;
7838
7839 if (this.ctr % 65000 === 0) {
7840 this.tags.push(makeStyleTag(this.opts));
7841 }
7842 };
7843
7844 _proto.flush = function flush() {
7845 // $FlowFixMe
7846 this.tags.forEach(function (tag) {
7847 return tag.parentNode.removeChild(tag);
7848 });
7849 this.tags = [];
7850 this.ctr = 0; // todo - look for remnants in document.styleSheets
7851
7852 this.injected = false;
7853 };
7854
7855 return StyleSheet;
7856}();
7857
7858function createEmotion(context, options) {
7859 if (context.__SECRET_EMOTION__ !== undefined) {
7860 return context.__SECRET_EMOTION__;
7861 }
7862
7863 if (options === undefined) options = {};
7864 var key = options.key || 'css';
7865
7866 if (process.env.NODE_ENV !== 'production') {
7867 if (/[^a-z-]/.test(key)) {
7868 throw new Error("Emotion key must only contain lower case alphabetical characters and - but \"" + key + "\" was passed");
7869 }
7870 }
7871
7872 var current;
7873
7874 function insertRule(rule) {
7875 current += rule;
7876
7877 if (isBrowser) {
7878 sheet.insert(rule, currentSourceMap);
7879 }
7880 }
7881
7882 var insertionPlugin = stylisRuleSheet(insertRule);
7883 var stylisOptions;
7884
7885 if (options.prefix !== undefined) {
7886 stylisOptions = {
7887 prefix: options.prefix
7888 };
7889 }
7890
7891 var caches = {
7892 registered: {},
7893 inserted: {},
7894 nonce: options.nonce,
7895 key: key
7896 };
7897 var sheet = new StyleSheet(options);
7898
7899 if (isBrowser) {
7900 // 🚀
7901 sheet.inject();
7902 }
7903
7904 var stylis = new stylis_min(stylisOptions);
7905 stylis.use(options.stylisPlugins)(insertionPlugin);
7906 var currentSourceMap = '';
7907
7908 function handleInterpolation(interpolation, couldBeSelectorInterpolation) {
7909 if (interpolation == null) {
7910 return '';
7911 }
7912
7913 switch (typeof interpolation) {
7914 case 'boolean':
7915 return '';
7916
7917 case 'function':
7918 if (interpolation.__emotion_styles !== undefined) {
7919 var selector = interpolation.toString();
7920
7921 if (selector === 'NO_COMPONENT_SELECTOR' && process.env.NODE_ENV !== 'production') {
7922 throw new Error('Component selectors can only be used in conjunction with babel-plugin-emotion.');
7923 }
7924
7925 return selector;
7926 }
7927
7928 if (this === undefined && process.env.NODE_ENV !== 'production') {
7929 console.error('Interpolating functions in css calls is deprecated and will be removed in the next major version of Emotion.\n' + 'If you want to have a css call based on props, create a function that returns a css call like this\n' + 'let dynamicStyle = (props) => css`color: ${props.color}`\n' + 'It can be called directly with props or interpolated in a styled call like this\n' + "let SomeComponent = styled('div')`${dynamicStyle}`");
7930 }
7931
7932 return handleInterpolation.call(this, this === undefined ? interpolation() : // $FlowFixMe
7933 interpolation(this.mergedProps, this.context), couldBeSelectorInterpolation);
7934
7935 case 'object':
7936 return createStringFromObject.call(this, interpolation);
7937
7938 default:
7939 var cached = caches.registered[interpolation];
7940 return couldBeSelectorInterpolation === false && cached !== undefined ? cached : interpolation;
7941 }
7942 }
7943
7944 var objectToStringCache = new WeakMap();
7945
7946 function createStringFromObject(obj) {
7947 if (objectToStringCache.has(obj)) {
7948 // $FlowFixMe
7949 return objectToStringCache.get(obj);
7950 }
7951
7952 var string = '';
7953
7954 if (Array.isArray(obj)) {
7955 obj.forEach(function (interpolation) {
7956 string += handleInterpolation.call(this, interpolation, false);
7957 }, this);
7958 } else {
7959 Object.keys(obj).forEach(function (key) {
7960 if (typeof obj[key] !== 'object') {
7961 if (caches.registered[obj[key]] !== undefined) {
7962 string += key + "{" + caches.registered[obj[key]] + "}";
7963 } else {
7964 string += processStyleName(key) + ":" + processStyleValue(key, obj[key]) + ";";
7965 }
7966 } else {
7967 if (key === 'NO_COMPONENT_SELECTOR' && process.env.NODE_ENV !== 'production') {
7968 throw new Error('Component selectors can only be used in conjunction with babel-plugin-emotion.');
7969 }
7970
7971 if (Array.isArray(obj[key]) && typeof obj[key][0] === 'string' && caches.registered[obj[key][0]] === undefined) {
7972 obj[key].forEach(function (value) {
7973 string += processStyleName(key) + ":" + processStyleValue(key, value) + ";";
7974 });
7975 } else {
7976 string += key + "{" + handleInterpolation.call(this, obj[key], false) + "}";
7977 }
7978 }
7979 }, this);
7980 }
7981
7982 objectToStringCache.set(obj, string);
7983 return string;
7984 }
7985
7986 var name;
7987 var stylesWithLabel;
7988 var labelPattern = /label:\s*([^\s;\n{]+)\s*;/g;
7989
7990 var createClassName = function createClassName(styles, identifierName) {
7991 return murmurhash2_32_gc(styles + identifierName) + identifierName;
7992 };
7993
7994 if (process.env.NODE_ENV !== 'production') {
7995 var oldCreateClassName = createClassName;
7996 var sourceMappingUrlPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g;
7997
7998 createClassName = function createClassName(styles, identifierName) {
7999 return oldCreateClassName(styles.replace(sourceMappingUrlPattern, function (sourceMap) {
8000 currentSourceMap = sourceMap;
8001 return '';
8002 }), identifierName);
8003 };
8004 }
8005
8006 var createStyles = function createStyles(strings) {
8007 var stringMode = true;
8008 var styles = '';
8009 var identifierName = '';
8010
8011 if (strings == null || strings.raw === undefined) {
8012 stringMode = false;
8013 styles += handleInterpolation.call(this, strings, false);
8014 } else {
8015 styles += strings[0];
8016 }
8017
8018 for (var _len = arguments.length, interpolations = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
8019 interpolations[_key - 1] = arguments[_key];
8020 }
8021
8022 interpolations.forEach(function (interpolation, i) {
8023 styles += handleInterpolation.call(this, interpolation, styles.charCodeAt(styles.length - 1) === 46 // .
8024 );
8025
8026 if (stringMode === true && strings[i + 1] !== undefined) {
8027 styles += strings[i + 1];
8028 }
8029 }, this);
8030 stylesWithLabel = styles;
8031 styles = styles.replace(labelPattern, function (match, p1) {
8032 identifierName += "-" + p1;
8033 return '';
8034 });
8035 name = createClassName(styles, identifierName);
8036 return styles;
8037 };
8038
8039 if (process.env.NODE_ENV !== 'production') {
8040 var oldStylis = stylis;
8041
8042 stylis = function stylis(selector, styles) {
8043 oldStylis(selector, styles);
8044 currentSourceMap = '';
8045 };
8046 }
8047
8048 function insert(scope, styles) {
8049 if (caches.inserted[name] === undefined) {
8050 current = '';
8051 stylis(scope, styles);
8052 caches.inserted[name] = current;
8053 }
8054 }
8055
8056 var css = function css() {
8057 var styles = createStyles.apply(this, arguments);
8058 var selector = key + "-" + name;
8059
8060 if (caches.registered[selector] === undefined) {
8061 caches.registered[selector] = stylesWithLabel;
8062 }
8063
8064 insert("." + selector, styles);
8065 return selector;
8066 };
8067
8068 var keyframes = function keyframes() {
8069 var styles = createStyles.apply(this, arguments);
8070 var animation = "animation-" + name;
8071 insert('', "@keyframes " + animation + "{" + styles + "}");
8072 return animation;
8073 };
8074
8075 var injectGlobal = function injectGlobal() {
8076 var styles = createStyles.apply(this, arguments);
8077 insert('', styles);
8078 };
8079
8080 function getRegisteredStyles(registeredStyles, classNames) {
8081 var rawClassName = '';
8082 classNames.split(' ').forEach(function (className) {
8083 if (caches.registered[className] !== undefined) {
8084 registeredStyles.push(className);
8085 } else {
8086 rawClassName += className + " ";
8087 }
8088 });
8089 return rawClassName;
8090 }
8091
8092 function merge(className, sourceMap) {
8093 var registeredStyles = [];
8094 var rawClassName = getRegisteredStyles(registeredStyles, className);
8095
8096 if (registeredStyles.length < 2) {
8097 return className;
8098 }
8099
8100 return rawClassName + css(registeredStyles, sourceMap);
8101 }
8102
8103 function cx() {
8104 for (var _len2 = arguments.length, classNames = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
8105 classNames[_key2] = arguments[_key2];
8106 }
8107
8108 return merge(classnames$1(classNames));
8109 }
8110
8111 function hydrateSingleId(id) {
8112 caches.inserted[id] = true;
8113 }
8114
8115 function hydrate(ids) {
8116 ids.forEach(hydrateSingleId);
8117 }
8118
8119 function flush() {
8120 if (isBrowser) {
8121 sheet.flush();
8122 sheet.inject();
8123 }
8124
8125 caches.inserted = {};
8126 caches.registered = {};
8127 }
8128
8129 if (isBrowser) {
8130 var chunks = document.querySelectorAll("[data-emotion-" + key + "]");
8131 Array.prototype.forEach.call(chunks, function (node) {
8132 // $FlowFixMe
8133 sheet.tags[0].parentNode.insertBefore(node, sheet.tags[0]); // $FlowFixMe
8134
8135 node.getAttribute("data-emotion-" + key).split(' ').forEach(hydrateSingleId);
8136 });
8137 }
8138
8139 var emotion = {
8140 flush: flush,
8141 hydrate: hydrate,
8142 cx: cx,
8143 merge: merge,
8144 getRegisteredStyles: getRegisteredStyles,
8145 injectGlobal: injectGlobal,
8146 keyframes: keyframes,
8147 css: css,
8148 sheet: sheet,
8149 caches: caches
8150 };
8151 context.__SECRET_EMOTION__ = emotion;
8152 return emotion;
8153}
8154
8155var context = typeof global !== 'undefined' ? global : {};
8156
8157var _createEmotion = createEmotion(context),
8158 flush = _createEmotion.flush,
8159 hydrate = _createEmotion.hydrate,
8160 cx = _createEmotion.cx,
8161 merge = _createEmotion.merge,
8162 getRegisteredStyles = _createEmotion.getRegisteredStyles,
8163 injectGlobal = _createEmotion.injectGlobal,
8164 keyframes = _createEmotion.keyframes,
8165 css = _createEmotion.css,
8166 sheet = _createEmotion.sheet,
8167 caches = _createEmotion.caches;
8168
8169var performanceNow = createCommonjsModule(function (module) {
8170// Generated by CoffeeScript 1.12.2
8171(function() {
8172 var getNanoSeconds, hrtime, loadTime, moduleLoadTime, nodeLoadTime, upTime;
8173
8174 if ((typeof performance !== "undefined" && performance !== null) && performance.now) {
8175 module.exports = function() {
8176 return performance.now();
8177 };
8178 } else if ((typeof process !== "undefined" && process !== null) && process.hrtime) {
8179 module.exports = function() {
8180 return (getNanoSeconds() - nodeLoadTime) / 1e6;
8181 };
8182 hrtime = process.hrtime;
8183 getNanoSeconds = function() {
8184 var hr;
8185 hr = hrtime();
8186 return hr[0] * 1e9 + hr[1];
8187 };
8188 moduleLoadTime = getNanoSeconds();
8189 upTime = process.uptime() * 1e9;
8190 nodeLoadTime = moduleLoadTime - upTime;
8191 } else if (Date.now) {
8192 module.exports = function() {
8193 return Date.now() - loadTime;
8194 };
8195 loadTime = Date.now();
8196 } else {
8197 module.exports = function() {
8198 return new Date().getTime() - loadTime;
8199 };
8200 loadTime = new Date().getTime();
8201 }
8202
8203}).call(commonjsGlobal);
8204
8205
8206});
8207
8208var root = typeof window === 'undefined' ? commonjsGlobal : window
8209 , vendors = ['moz', 'webkit']
8210 , suffix = 'AnimationFrame'
8211 , raf = root['request' + suffix]
8212 , caf = root['cancel' + suffix] || root['cancelRequest' + suffix];
8213
8214for(var i = 0; !raf && i < vendors.length; i++) {
8215 raf = root[vendors[i] + 'Request' + suffix];
8216 caf = root[vendors[i] + 'Cancel' + suffix]
8217 || root[vendors[i] + 'CancelRequest' + suffix];
8218}
8219
8220// Some versions of FF have rAF but not cAF
8221if(!raf || !caf) {
8222 var last = 0
8223 , id = 0
8224 , queue = []
8225 , frameDuration = 1000 / 60;
8226
8227 raf = function(callback) {
8228 if(queue.length === 0) {
8229 var _now = performanceNow()
8230 , next = Math.max(0, frameDuration - (_now - last));
8231 last = next + _now;
8232 setTimeout(function() {
8233 var cp = queue.slice(0);
8234 // Clear queue here to prevent
8235 // callbacks from appending listeners
8236 // to the current frame's queue
8237 queue.length = 0;
8238 for(var i = 0; i < cp.length; i++) {
8239 if(!cp[i].cancelled) {
8240 try{
8241 cp[i].callback(last);
8242 } catch(e) {
8243 setTimeout(function() { throw e }, 0);
8244 }
8245 }
8246 }
8247 }, Math.round(next));
8248 }
8249 queue.push({
8250 handle: ++id,
8251 callback: callback,
8252 cancelled: false
8253 });
8254 return id
8255 };
8256
8257 caf = function(handle) {
8258 for(var i = 0; i < queue.length; i++) {
8259 if(queue[i].handle === handle) {
8260 queue[i].cancelled = true;
8261 }
8262 }
8263 };
8264}
8265
8266var raf_1 = function(fn) {
8267 // Wrap in a new function to prevent
8268 // `cancel` potentially being assigned
8269 // to the native rAF function
8270 return raf.call(root, fn)
8271};
8272var cancel = function() {
8273 caf.apply(root, arguments);
8274};
8275var polyfill = function(object) {
8276 if (!object) {
8277 object = root;
8278 }
8279 object.requestAnimationFrame = raf;
8280 object.cancelAnimationFrame = caf;
8281};
8282raf_1.cancel = cancel;
8283raf_1.polyfill = polyfill;
8284
8285var AutosizeInput_1 = createCommonjsModule(function (module, exports) {
8286
8287Object.defineProperty(exports, "__esModule", {
8288 value: true
8289});
8290
8291var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
8292
8293var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
8294
8295
8296
8297var _react2 = _interopRequireDefault(React__default);
8298
8299
8300
8301var _propTypes2 = _interopRequireDefault(PropTypes);
8302
8303function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8304
8305function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
8306
8307function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8308
8309function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
8310
8311function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
8312
8313var sizerStyle = {
8314 position: 'absolute',
8315 top: 0,
8316 left: 0,
8317 visibility: 'hidden',
8318 height: 0,
8319 overflow: 'scroll',
8320 whiteSpace: 'pre'
8321};
8322
8323var INPUT_PROPS_BLACKLIST = ['extraWidth', 'injectStyles', 'inputClassName', 'inputRef', 'inputStyle', 'minWidth', 'onAutosize', 'placeholderIsMinWidth'];
8324
8325var cleanInputProps = function cleanInputProps(inputProps) {
8326 INPUT_PROPS_BLACKLIST.forEach(function (field) {
8327 return delete inputProps[field];
8328 });
8329 return inputProps;
8330};
8331
8332var copyStyles = function copyStyles(styles, node) {
8333 node.style.fontSize = styles.fontSize;
8334 node.style.fontFamily = styles.fontFamily;
8335 node.style.fontWeight = styles.fontWeight;
8336 node.style.fontStyle = styles.fontStyle;
8337 node.style.letterSpacing = styles.letterSpacing;
8338 node.style.textTransform = styles.textTransform;
8339};
8340
8341var isIE = typeof window !== 'undefined' && window.navigator ? /MSIE |Trident\/|Edge\//.test(window.navigator.userAgent) : false;
8342
8343var generateId = function generateId() {
8344 // we only need an auto-generated ID for stylesheet injection, which is only
8345 // used for IE. so if the browser is not IE, this should return undefined.
8346 return isIE ? '_' + Math.random().toString(36).substr(2, 12) : undefined;
8347};
8348
8349var AutosizeInput = function (_Component) {
8350 _inherits(AutosizeInput, _Component);
8351
8352 function AutosizeInput(props) {
8353 _classCallCheck(this, AutosizeInput);
8354
8355 var _this = _possibleConstructorReturn(this, (AutosizeInput.__proto__ || Object.getPrototypeOf(AutosizeInput)).call(this, props));
8356
8357 _this.inputRef = function (el) {
8358 _this.input = el;
8359 if (typeof _this.props.inputRef === 'function') {
8360 _this.props.inputRef(el);
8361 }
8362 };
8363
8364 _this.placeHolderSizerRef = function (el) {
8365 _this.placeHolderSizer = el;
8366 };
8367
8368 _this.sizerRef = function (el) {
8369 _this.sizer = el;
8370 };
8371
8372 _this.state = {
8373 inputWidth: props.minWidth,
8374 inputId: props.id || generateId()
8375 };
8376 return _this;
8377 }
8378
8379 _createClass(AutosizeInput, [{
8380 key: 'componentDidMount',
8381 value: function componentDidMount() {
8382 this.mounted = true;
8383 this.copyInputStyles();
8384 this.updateInputWidth();
8385 }
8386 }, {
8387 key: 'componentWillReceiveProps',
8388 value: function componentWillReceiveProps(nextProps) {
8389 var id = nextProps.id;
8390
8391 if (id !== this.props.id) {
8392 this.setState({ inputId: id || generateId() });
8393 }
8394 }
8395 }, {
8396 key: 'componentDidUpdate',
8397 value: function componentDidUpdate(prevProps, prevState) {
8398 if (prevState.inputWidth !== this.state.inputWidth) {
8399 if (typeof this.props.onAutosize === 'function') {
8400 this.props.onAutosize(this.state.inputWidth);
8401 }
8402 }
8403 this.updateInputWidth();
8404 }
8405 }, {
8406 key: 'componentWillUnmount',
8407 value: function componentWillUnmount() {
8408 this.mounted = false;
8409 }
8410 }, {
8411 key: 'copyInputStyles',
8412 value: function copyInputStyles() {
8413 if (!this.mounted || !window.getComputedStyle) {
8414 return;
8415 }
8416 var inputStyles = this.input && window.getComputedStyle(this.input);
8417 if (!inputStyles) {
8418 return;
8419 }
8420 copyStyles(inputStyles, this.sizer);
8421 if (this.placeHolderSizer) {
8422 copyStyles(inputStyles, this.placeHolderSizer);
8423 }
8424 }
8425 }, {
8426 key: 'updateInputWidth',
8427 value: function updateInputWidth() {
8428 if (!this.mounted || !this.sizer || typeof this.sizer.scrollWidth === 'undefined') {
8429 return;
8430 }
8431 var newInputWidth = void 0;
8432 if (this.props.placeholder && (!this.props.value || this.props.value && this.props.placeholderIsMinWidth)) {
8433 newInputWidth = Math.max(this.sizer.scrollWidth, this.placeHolderSizer.scrollWidth) + 2;
8434 } else {
8435 newInputWidth = this.sizer.scrollWidth + 2;
8436 }
8437 // add extraWidth to the detected width. for number types, this defaults to 16 to allow for the stepper UI
8438 var extraWidth = this.props.type === 'number' && this.props.extraWidth === undefined ? 16 : parseInt(this.props.extraWidth) || 0;
8439 newInputWidth += extraWidth;
8440 if (newInputWidth < this.props.minWidth) {
8441 newInputWidth = this.props.minWidth;
8442 }
8443 if (newInputWidth !== this.state.inputWidth) {
8444 this.setState({
8445 inputWidth: newInputWidth
8446 });
8447 }
8448 }
8449 }, {
8450 key: 'getInput',
8451 value: function getInput() {
8452 return this.input;
8453 }
8454 }, {
8455 key: 'focus',
8456 value: function focus() {
8457 this.input.focus();
8458 }
8459 }, {
8460 key: 'blur',
8461 value: function blur() {
8462 this.input.blur();
8463 }
8464 }, {
8465 key: 'select',
8466 value: function select() {
8467 this.input.select();
8468 }
8469 }, {
8470 key: 'renderStyles',
8471 value: function renderStyles() {
8472 // this method injects styles to hide IE's clear indicator, which messes
8473 // with input size detection. the stylesheet is only injected when the
8474 // browser is IE, and can also be disabled by the `injectStyles` prop.
8475 var injectStyles = this.props.injectStyles;
8476
8477 return isIE && injectStyles ? _react2.default.createElement('style', { dangerouslySetInnerHTML: {
8478 __html: 'input#' + this.state.inputId + '::-ms-clear {display: none;}'
8479 } }) : null;
8480 }
8481 }, {
8482 key: 'render',
8483 value: function render() {
8484 var sizerValue = [this.props.defaultValue, this.props.value, ''].reduce(function (previousValue, currentValue) {
8485 if (previousValue !== null && previousValue !== undefined) {
8486 return previousValue;
8487 }
8488 return currentValue;
8489 });
8490
8491 var wrapperStyle = _extends({}, this.props.style);
8492 if (!wrapperStyle.display) wrapperStyle.display = 'inline-block';
8493
8494 var inputStyle = _extends({
8495 boxSizing: 'content-box',
8496 width: this.state.inputWidth + 'px'
8497 }, this.props.inputStyle);
8498
8499 var inputProps = _objectWithoutProperties(this.props, []);
8500
8501 cleanInputProps(inputProps);
8502 inputProps.className = this.props.inputClassName;
8503 inputProps.id = this.state.inputId;
8504 inputProps.style = inputStyle;
8505
8506 return _react2.default.createElement(
8507 'div',
8508 { className: this.props.className, style: wrapperStyle },
8509 this.renderStyles(),
8510 _react2.default.createElement('input', _extends({}, inputProps, { ref: this.inputRef })),
8511 _react2.default.createElement(
8512 'div',
8513 { ref: this.sizerRef, style: sizerStyle },
8514 sizerValue
8515 ),
8516 this.props.placeholder ? _react2.default.createElement(
8517 'div',
8518 { ref: this.placeHolderSizerRef, style: sizerStyle },
8519 this.props.placeholder
8520 ) : null
8521 );
8522 }
8523 }]);
8524
8525 return AutosizeInput;
8526}(React__default.Component);
8527
8528AutosizeInput.propTypes = {
8529 className: _propTypes2.default.string, // className for the outer element
8530 defaultValue: _propTypes2.default.any, // default field value
8531 extraWidth: _propTypes2.default.oneOfType([// additional width for input element
8532 _propTypes2.default.number, _propTypes2.default.string]),
8533 id: _propTypes2.default.string, // id to use for the input, can be set for consistent snapshots
8534 injectStyles: _propTypes2.default.bool, // inject the custom stylesheet to hide clear UI, defaults to true
8535 inputClassName: _propTypes2.default.string, // className for the input element
8536 inputRef: _propTypes2.default.func, // ref callback for the input element
8537 inputStyle: _propTypes2.default.object, // css styles for the input element
8538 minWidth: _propTypes2.default.oneOfType([// minimum width for input element
8539 _propTypes2.default.number, _propTypes2.default.string]),
8540 onAutosize: _propTypes2.default.func, // onAutosize handler: function(newWidth) {}
8541 onChange: _propTypes2.default.func, // onChange handler: function(event) {}
8542 placeholder: _propTypes2.default.string, // placeholder text
8543 placeholderIsMinWidth: _propTypes2.default.bool, // don't collapse size to less than the placeholder
8544 style: _propTypes2.default.object, // css styles for the outer element
8545 value: _propTypes2.default.any // field value
8546};
8547AutosizeInput.defaultProps = {
8548 minWidth: 1,
8549 injectStyles: true
8550};
8551
8552exports.default = AutosizeInput;
8553});
8554
8555var AutosizeInput = unwrapExports(AutosizeInput_1);
8556
8557var interopRequireDefault = createCommonjsModule(function (module) {
8558function _interopRequireDefault(obj) {
8559 return obj && obj.__esModule ? obj : {
8560 "default": obj
8561 };
8562}
8563
8564module.exports = _interopRequireDefault;
8565});
8566
8567unwrapExports(interopRequireDefault);
8568
8569var hasClass_1 = createCommonjsModule(function (module, exports) {
8570
8571exports.__esModule = true;
8572exports.default = hasClass;
8573
8574function hasClass(element, className) {
8575 if (element.classList) return !!className && element.classList.contains(className);else return (" " + (element.className.baseVal || element.className) + " ").indexOf(" " + className + " ") !== -1;
8576}
8577
8578module.exports = exports["default"];
8579});
8580
8581unwrapExports(hasClass_1);
8582
8583var addClass_1 = createCommonjsModule(function (module, exports) {
8584
8585
8586
8587exports.__esModule = true;
8588exports.default = addClass;
8589
8590var _hasClass = interopRequireDefault(hasClass_1);
8591
8592function addClass(element, className) {
8593 if (element.classList) element.classList.add(className);else if (!(0, _hasClass.default)(element, className)) if (typeof element.className === 'string') element.className = element.className + ' ' + className;else element.setAttribute('class', (element.className && element.className.baseVal || '') + ' ' + className);
8594}
8595
8596module.exports = exports["default"];
8597});
8598
8599unwrapExports(addClass_1);
8600
8601function replaceClassName(origClass, classToRemove) {
8602 return origClass.replace(new RegExp('(^|\\s)' + classToRemove + '(?:\\s|$)', 'g'), '$1').replace(/\s+/g, ' ').replace(/^\s*|\s*$/g, '');
8603}
8604
8605var removeClass = function removeClass(element, className) {
8606 if (element.classList) element.classList.remove(className);else if (typeof element.className === 'string') element.className = replaceClassName(element.className, className);else element.setAttribute('class', replaceClassName(element.className && element.className.baseVal || '', className));
8607};
8608
8609/**
8610 * Copyright (c) 2013-present, Facebook, Inc.
8611 *
8612 * This source code is licensed under the MIT license found in the
8613 * LICENSE file in the root directory of this source tree.
8614 */
8615
8616function componentWillMount() {
8617 // Call this.constructor.gDSFP to support sub-classes.
8618 var state = this.constructor.getDerivedStateFromProps(this.props, this.state);
8619 if (state !== null && state !== undefined) {
8620 this.setState(state);
8621 }
8622}
8623
8624function componentWillReceiveProps(nextProps) {
8625 // Call this.constructor.gDSFP to support sub-classes.
8626 // Use the setState() updater to ensure state isn't stale in certain edge cases.
8627 function updater(prevState) {
8628 var state = this.constructor.getDerivedStateFromProps(nextProps, prevState);
8629 return state !== null && state !== undefined ? state : null;
8630 }
8631 // Binding "this" is important for shallow renderer support.
8632 this.setState(updater.bind(this));
8633}
8634
8635function componentWillUpdate(nextProps, nextState) {
8636 try {
8637 var prevProps = this.props;
8638 var prevState = this.state;
8639 this.props = nextProps;
8640 this.state = nextState;
8641 this.__reactInternalSnapshotFlag = true;
8642 this.__reactInternalSnapshot = this.getSnapshotBeforeUpdate(
8643 prevProps,
8644 prevState
8645 );
8646 } finally {
8647 this.props = prevProps;
8648 this.state = prevState;
8649 }
8650}
8651
8652// React may warn about cWM/cWRP/cWU methods being deprecated.
8653// Add a flag to suppress these warnings for this special case.
8654componentWillMount.__suppressDeprecationWarning = true;
8655componentWillReceiveProps.__suppressDeprecationWarning = true;
8656componentWillUpdate.__suppressDeprecationWarning = true;
8657
8658function polyfill$1(Component) {
8659 var prototype = Component.prototype;
8660
8661 if (!prototype || !prototype.isReactComponent) {
8662 throw new Error('Can only polyfill class components');
8663 }
8664
8665 if (
8666 typeof Component.getDerivedStateFromProps !== 'function' &&
8667 typeof prototype.getSnapshotBeforeUpdate !== 'function'
8668 ) {
8669 return Component;
8670 }
8671
8672 // If new component APIs are defined, "unsafe" lifecycles won't be called.
8673 // Error if any of these lifecycles are present,
8674 // Because they would work differently between older and newer (16.3+) versions of React.
8675 var foundWillMountName = null;
8676 var foundWillReceivePropsName = null;
8677 var foundWillUpdateName = null;
8678 if (typeof prototype.componentWillMount === 'function') {
8679 foundWillMountName = 'componentWillMount';
8680 } else if (typeof prototype.UNSAFE_componentWillMount === 'function') {
8681 foundWillMountName = 'UNSAFE_componentWillMount';
8682 }
8683 if (typeof prototype.componentWillReceiveProps === 'function') {
8684 foundWillReceivePropsName = 'componentWillReceiveProps';
8685 } else if (typeof prototype.UNSAFE_componentWillReceiveProps === 'function') {
8686 foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
8687 }
8688 if (typeof prototype.componentWillUpdate === 'function') {
8689 foundWillUpdateName = 'componentWillUpdate';
8690 } else if (typeof prototype.UNSAFE_componentWillUpdate === 'function') {
8691 foundWillUpdateName = 'UNSAFE_componentWillUpdate';
8692 }
8693 if (
8694 foundWillMountName !== null ||
8695 foundWillReceivePropsName !== null ||
8696 foundWillUpdateName !== null
8697 ) {
8698 var componentName = Component.displayName || Component.name;
8699 var newApiName =
8700 typeof Component.getDerivedStateFromProps === 'function'
8701 ? 'getDerivedStateFromProps()'
8702 : 'getSnapshotBeforeUpdate()';
8703
8704 throw Error(
8705 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' +
8706 componentName +
8707 ' uses ' +
8708 newApiName +
8709 ' but also contains the following legacy lifecycles:' +
8710 (foundWillMountName !== null ? '\n ' + foundWillMountName : '') +
8711 (foundWillReceivePropsName !== null
8712 ? '\n ' + foundWillReceivePropsName
8713 : '') +
8714 (foundWillUpdateName !== null ? '\n ' + foundWillUpdateName : '') +
8715 '\n\nThe above lifecycles should be removed. Learn more about this warning here:\n' +
8716 'https://fb.me/react-async-component-lifecycle-hooks'
8717 );
8718 }
8719
8720 // React <= 16.2 does not support static getDerivedStateFromProps.
8721 // As a workaround, use cWM and cWRP to invoke the new static lifecycle.
8722 // Newer versions of React will ignore these lifecycles if gDSFP exists.
8723 if (typeof Component.getDerivedStateFromProps === 'function') {
8724 prototype.componentWillMount = componentWillMount;
8725 prototype.componentWillReceiveProps = componentWillReceiveProps;
8726 }
8727
8728 // React <= 16.2 does not support getSnapshotBeforeUpdate.
8729 // As a workaround, use cWU to invoke the new lifecycle.
8730 // Newer versions of React will ignore that lifecycle if gSBU exists.
8731 if (typeof prototype.getSnapshotBeforeUpdate === 'function') {
8732 if (typeof prototype.componentDidUpdate !== 'function') {
8733 throw new Error(
8734 'Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype'
8735 );
8736 }
8737
8738 prototype.componentWillUpdate = componentWillUpdate;
8739
8740 var componentDidUpdate = prototype.componentDidUpdate;
8741
8742 prototype.componentDidUpdate = function componentDidUpdatePolyfill(
8743 prevProps,
8744 prevState,
8745 maybeSnapshot
8746 ) {
8747 // 16.3+ will not execute our will-update method;
8748 // It will pass a snapshot value to did-update though.
8749 // Older versions will require our polyfilled will-update value.
8750 // We need to handle both cases, but can't just check for the presence of "maybeSnapshot",
8751 // Because for <= 15.x versions this might be a "prevContext" object.
8752 // We also can't just check "__reactInternalSnapshot",
8753 // Because get-snapshot might return a falsy value.
8754 // So check for the explicit __reactInternalSnapshotFlag flag to determine behavior.
8755 var snapshot = this.__reactInternalSnapshotFlag
8756 ? this.__reactInternalSnapshot
8757 : maybeSnapshot;
8758
8759 componentDidUpdate.call(this, prevProps, prevState, snapshot);
8760 };
8761 }
8762
8763 return Component;
8764}
8765
8766var reactLifecyclesCompat_es = /*#__PURE__*/Object.freeze({
8767 polyfill: polyfill$1
8768});
8769
8770var PropTypes$1 = createCommonjsModule(function (module, exports) {
8771
8772exports.__esModule = true;
8773exports.classNamesShape = exports.timeoutsShape = void 0;
8774
8775var _propTypes = _interopRequireDefault(PropTypes);
8776
8777function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8778
8779var timeoutsShape = process.env.NODE_ENV !== 'production' ? _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
8780 enter: _propTypes.default.number,
8781 exit: _propTypes.default.number,
8782 appear: _propTypes.default.number
8783}).isRequired]) : null;
8784exports.timeoutsShape = timeoutsShape;
8785var classNamesShape = process.env.NODE_ENV !== 'production' ? _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.shape({
8786 enter: _propTypes.default.string,
8787 exit: _propTypes.default.string,
8788 active: _propTypes.default.string
8789}), _propTypes.default.shape({
8790 enter: _propTypes.default.string,
8791 enterDone: _propTypes.default.string,
8792 enterActive: _propTypes.default.string,
8793 exit: _propTypes.default.string,
8794 exitDone: _propTypes.default.string,
8795 exitActive: _propTypes.default.string
8796})]) : null;
8797exports.classNamesShape = classNamesShape;
8798});
8799
8800unwrapExports(PropTypes$1);
8801var PropTypes_1 = PropTypes$1.classNamesShape;
8802var PropTypes_2 = PropTypes$1.timeoutsShape;
8803
8804var Transition_1 = createCommonjsModule(function (module, exports) {
8805
8806exports.__esModule = true;
8807exports.default = exports.EXITING = exports.ENTERED = exports.ENTERING = exports.EXITED = exports.UNMOUNTED = void 0;
8808
8809var PropTypes$$1 = _interopRequireWildcard(PropTypes);
8810
8811var _react = _interopRequireDefault(React__default);
8812
8813var _reactDom = _interopRequireDefault(reactDom__default);
8814
8815
8816
8817
8818
8819function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8820
8821function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
8822
8823function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
8824
8825function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
8826
8827var UNMOUNTED = 'unmounted';
8828exports.UNMOUNTED = UNMOUNTED;
8829var EXITED = 'exited';
8830exports.EXITED = EXITED;
8831var ENTERING = 'entering';
8832exports.ENTERING = ENTERING;
8833var ENTERED = 'entered';
8834exports.ENTERED = ENTERED;
8835var EXITING = 'exiting';
8836/**
8837 * The Transition component lets you describe a transition from one component
8838 * state to another _over time_ with a simple declarative API. Most commonly
8839 * it's used to animate the mounting and unmounting of a component, but can also
8840 * be used to describe in-place transition states as well.
8841 *
8842 * ---
8843 *
8844 * **Note**: `Transition` is a platform-agnostic base component. If you're using
8845 * transitions in CSS, you'll probably want to use
8846 * [`CSSTransition`](https://reactcommunity.org/react-transition-group/css-transition)
8847 * instead. It inherits all the features of `Transition`, but contains
8848 * additional features necessary to play nice with CSS transitions (hence the
8849 * name of the component).
8850 *
8851 * ---
8852 *
8853 * By default the `Transition` component does not alter the behavior of the
8854 * component it renders, it only tracks "enter" and "exit" states for the
8855 * components. It's up to you to give meaning and effect to those states. For
8856 * example we can add styles to a component when it enters or exits:
8857 *
8858 * ```jsx
8859 * import { Transition } from 'react-transition-group';
8860 *
8861 * const duration = 300;
8862 *
8863 * const defaultStyle = {
8864 * transition: `opacity ${duration}ms ease-in-out`,
8865 * opacity: 0,
8866 * }
8867 *
8868 * const transitionStyles = {
8869 * entering: { opacity: 0 },
8870 * entered: { opacity: 1 },
8871 * };
8872 *
8873 * const Fade = ({ in: inProp }) => (
8874 * <Transition in={inProp} timeout={duration}>
8875 * {state => (
8876 * <div style={{
8877 * ...defaultStyle,
8878 * ...transitionStyles[state]
8879 * }}>
8880 * I'm a fade Transition!
8881 * </div>
8882 * )}
8883 * </Transition>
8884 * );
8885 * ```
8886 *
8887 * There are 4 main states a Transition can be in:
8888 * - `'entering'`
8889 * - `'entered'`
8890 * - `'exiting'`
8891 * - `'exited'`
8892 *
8893 * Transition state is toggled via the `in` prop. When `true` the component
8894 * begins the "Enter" stage. During this stage, the component will shift from
8895 * its current transition state, to `'entering'` for the duration of the
8896 * transition and then to the `'entered'` stage once it's complete. Let's take
8897 * the following example (we'll use the
8898 * [useState](https://reactjs.org/docs/hooks-reference.html#usestate) hook):
8899 *
8900 * ```jsx
8901 * function App() {
8902 * const [inProp, setInProp] = useState(false);
8903 * return (
8904 * <div>
8905 * <Transition in={inProp} timeout={500}>
8906 * {state => (
8907 * // ...
8908 * )}
8909 * </Transition>
8910 * <button onClick={() => setInProp(true)}>
8911 * Click to Enter
8912 * </button>
8913 * </div>
8914 * );
8915 * }
8916 * ```
8917 *
8918 * When the button is clicked the component will shift to the `'entering'` state
8919 * and stay there for 500ms (the value of `timeout`) before it finally switches
8920 * to `'entered'`.
8921 *
8922 * When `in` is `false` the same thing happens except the state moves from
8923 * `'exiting'` to `'exited'`.
8924 */
8925
8926exports.EXITING = EXITING;
8927
8928var Transition =
8929/*#__PURE__*/
8930function (_React$Component) {
8931 _inheritsLoose(Transition, _React$Component);
8932
8933 function Transition(props, context) {
8934 var _this;
8935
8936 _this = _React$Component.call(this, props, context) || this;
8937 var parentGroup = context.transitionGroup; // In the context of a TransitionGroup all enters are really appears
8938
8939 var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;
8940 var initialStatus;
8941 _this.appearStatus = null;
8942
8943 if (props.in) {
8944 if (appear) {
8945 initialStatus = EXITED;
8946 _this.appearStatus = ENTERING;
8947 } else {
8948 initialStatus = ENTERED;
8949 }
8950 } else {
8951 if (props.unmountOnExit || props.mountOnEnter) {
8952 initialStatus = UNMOUNTED;
8953 } else {
8954 initialStatus = EXITED;
8955 }
8956 }
8957
8958 _this.state = {
8959 status: initialStatus
8960 };
8961 _this.nextCallback = null;
8962 return _this;
8963 }
8964
8965 var _proto = Transition.prototype;
8966
8967 _proto.getChildContext = function getChildContext() {
8968 return {
8969 transitionGroup: null // allows for nested Transitions
8970
8971 };
8972 };
8973
8974 Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {
8975 var nextIn = _ref.in;
8976
8977 if (nextIn && prevState.status === UNMOUNTED) {
8978 return {
8979 status: EXITED
8980 };
8981 }
8982
8983 return null;
8984 }; // getSnapshotBeforeUpdate(prevProps) {
8985 // let nextStatus = null
8986 // if (prevProps !== this.props) {
8987 // const { status } = this.state
8988 // if (this.props.in) {
8989 // if (status !== ENTERING && status !== ENTERED) {
8990 // nextStatus = ENTERING
8991 // }
8992 // } else {
8993 // if (status === ENTERING || status === ENTERED) {
8994 // nextStatus = EXITING
8995 // }
8996 // }
8997 // }
8998 // return { nextStatus }
8999 // }
9000
9001
9002 _proto.componentDidMount = function componentDidMount() {
9003 this.updateStatus(true, this.appearStatus);
9004 };
9005
9006 _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
9007 var nextStatus = null;
9008
9009 if (prevProps !== this.props) {
9010 var status = this.state.status;
9011
9012 if (this.props.in) {
9013 if (status !== ENTERING && status !== ENTERED) {
9014 nextStatus = ENTERING;
9015 }
9016 } else {
9017 if (status === ENTERING || status === ENTERED) {
9018 nextStatus = EXITING;
9019 }
9020 }
9021 }
9022
9023 this.updateStatus(false, nextStatus);
9024 };
9025
9026 _proto.componentWillUnmount = function componentWillUnmount() {
9027 this.cancelNextCallback();
9028 };
9029
9030 _proto.getTimeouts = function getTimeouts() {
9031 var timeout = this.props.timeout;
9032 var exit, enter, appear;
9033 exit = enter = appear = timeout;
9034
9035 if (timeout != null && typeof timeout !== 'number') {
9036 exit = timeout.exit;
9037 enter = timeout.enter; // TODO: remove fallback for next major
9038
9039 appear = timeout.appear !== undefined ? timeout.appear : enter;
9040 }
9041
9042 return {
9043 exit: exit,
9044 enter: enter,
9045 appear: appear
9046 };
9047 };
9048
9049 _proto.updateStatus = function updateStatus(mounting, nextStatus) {
9050 if (mounting === void 0) {
9051 mounting = false;
9052 }
9053
9054 if (nextStatus !== null) {
9055 // nextStatus will always be ENTERING or EXITING.
9056 this.cancelNextCallback();
9057
9058 var node = _reactDom.default.findDOMNode(this);
9059
9060 if (nextStatus === ENTERING) {
9061 this.performEnter(node, mounting);
9062 } else {
9063 this.performExit(node);
9064 }
9065 } else if (this.props.unmountOnExit && this.state.status === EXITED) {
9066 this.setState({
9067 status: UNMOUNTED
9068 });
9069 }
9070 };
9071
9072 _proto.performEnter = function performEnter(node, mounting) {
9073 var _this2 = this;
9074
9075 var enter = this.props.enter;
9076 var appearing = this.context.transitionGroup ? this.context.transitionGroup.isMounting : mounting;
9077 var timeouts = this.getTimeouts();
9078 var enterTimeout = appearing ? timeouts.appear : timeouts.enter; // no enter animation skip right to ENTERED
9079 // if we are mounting and running this it means appear _must_ be set
9080
9081 if (!mounting && !enter) {
9082 this.safeSetState({
9083 status: ENTERED
9084 }, function () {
9085 _this2.props.onEntered(node);
9086 });
9087 return;
9088 }
9089
9090 this.props.onEnter(node, appearing);
9091 this.safeSetState({
9092 status: ENTERING
9093 }, function () {
9094 _this2.props.onEntering(node, appearing);
9095
9096 _this2.onTransitionEnd(node, enterTimeout, function () {
9097 _this2.safeSetState({
9098 status: ENTERED
9099 }, function () {
9100 _this2.props.onEntered(node, appearing);
9101 });
9102 });
9103 });
9104 };
9105
9106 _proto.performExit = function performExit(node) {
9107 var _this3 = this;
9108
9109 var exit = this.props.exit;
9110 var timeouts = this.getTimeouts(); // no exit animation skip right to EXITED
9111
9112 if (!exit) {
9113 this.safeSetState({
9114 status: EXITED
9115 }, function () {
9116 _this3.props.onExited(node);
9117 });
9118 return;
9119 }
9120
9121 this.props.onExit(node);
9122 this.safeSetState({
9123 status: EXITING
9124 }, function () {
9125 _this3.props.onExiting(node);
9126
9127 _this3.onTransitionEnd(node, timeouts.exit, function () {
9128 _this3.safeSetState({
9129 status: EXITED
9130 }, function () {
9131 _this3.props.onExited(node);
9132 });
9133 });
9134 });
9135 };
9136
9137 _proto.cancelNextCallback = function cancelNextCallback() {
9138 if (this.nextCallback !== null) {
9139 this.nextCallback.cancel();
9140 this.nextCallback = null;
9141 }
9142 };
9143
9144 _proto.safeSetState = function safeSetState(nextState, callback) {
9145 // This shouldn't be necessary, but there are weird race conditions with
9146 // setState callbacks and unmounting in testing, so always make sure that
9147 // we can cancel any pending setState callbacks after we unmount.
9148 callback = this.setNextCallback(callback);
9149 this.setState(nextState, callback);
9150 };
9151
9152 _proto.setNextCallback = function setNextCallback(callback) {
9153 var _this4 = this;
9154
9155 var active = true;
9156
9157 this.nextCallback = function (event) {
9158 if (active) {
9159 active = false;
9160 _this4.nextCallback = null;
9161 callback(event);
9162 }
9163 };
9164
9165 this.nextCallback.cancel = function () {
9166 active = false;
9167 };
9168
9169 return this.nextCallback;
9170 };
9171
9172 _proto.onTransitionEnd = function onTransitionEnd(node, timeout, handler) {
9173 this.setNextCallback(handler);
9174 var doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener;
9175
9176 if (!node || doesNotHaveTimeoutOrListener) {
9177 setTimeout(this.nextCallback, 0);
9178 return;
9179 }
9180
9181 if (this.props.addEndListener) {
9182 this.props.addEndListener(node, this.nextCallback);
9183 }
9184
9185 if (timeout != null) {
9186 setTimeout(this.nextCallback, timeout);
9187 }
9188 };
9189
9190 _proto.render = function render() {
9191 var status = this.state.status;
9192
9193 if (status === UNMOUNTED) {
9194 return null;
9195 }
9196
9197 var _this$props = this.props,
9198 children = _this$props.children,
9199 childProps = _objectWithoutPropertiesLoose(_this$props, ["children"]); // filter props for Transtition
9200
9201
9202 delete childProps.in;
9203 delete childProps.mountOnEnter;
9204 delete childProps.unmountOnExit;
9205 delete childProps.appear;
9206 delete childProps.enter;
9207 delete childProps.exit;
9208 delete childProps.timeout;
9209 delete childProps.addEndListener;
9210 delete childProps.onEnter;
9211 delete childProps.onEntering;
9212 delete childProps.onEntered;
9213 delete childProps.onExit;
9214 delete childProps.onExiting;
9215 delete childProps.onExited;
9216
9217 if (typeof children === 'function') {
9218 return children(status, childProps);
9219 }
9220
9221 var child = _react.default.Children.only(children);
9222
9223 return _react.default.cloneElement(child, childProps);
9224 };
9225
9226 return Transition;
9227}(_react.default.Component);
9228
9229Transition.contextTypes = {
9230 transitionGroup: PropTypes$$1.object
9231};
9232Transition.childContextTypes = {
9233 transitionGroup: function transitionGroup() {}
9234};
9235Transition.propTypes = process.env.NODE_ENV !== "production" ? {
9236 /**
9237 * A `function` child can be used instead of a React element. This function is
9238 * called with the current transition status (`'entering'`, `'entered'`,
9239 * `'exiting'`, `'exited'`, `'unmounted'`), which can be used to apply context
9240 * specific props to a component.
9241 *
9242 * ```jsx
9243 * <Transition in={this.state.in} timeout={150}>
9244 * {state => (
9245 * <MyComponent className={`fade fade-${state}`} />
9246 * )}
9247 * </Transition>
9248 * ```
9249 */
9250 children: PropTypes$$1.oneOfType([PropTypes$$1.func.isRequired, PropTypes$$1.element.isRequired]).isRequired,
9251
9252 /**
9253 * Show the component; triggers the enter or exit states
9254 */
9255 in: PropTypes$$1.bool,
9256
9257 /**
9258 * By default the child component is mounted immediately along with
9259 * the parent `Transition` component. If you want to "lazy mount" the component on the
9260 * first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay
9261 * mounted, even on "exited", unless you also specify `unmountOnExit`.
9262 */
9263 mountOnEnter: PropTypes$$1.bool,
9264
9265 /**
9266 * By default the child component stays mounted after it reaches the `'exited'` state.
9267 * Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting.
9268 */
9269 unmountOnExit: PropTypes$$1.bool,
9270
9271 /**
9272 * Normally a component is not transitioned if it is shown when the `<Transition>` component mounts.
9273 * If you want to transition on the first mount set `appear` to `true`, and the
9274 * component will transition in as soon as the `<Transition>` mounts.
9275 *
9276 * > Note: there are no specific "appear" states. `appear` only adds an additional `enter` transition.
9277 */
9278 appear: PropTypes$$1.bool,
9279
9280 /**
9281 * Enable or disable enter transitions.
9282 */
9283 enter: PropTypes$$1.bool,
9284
9285 /**
9286 * Enable or disable exit transitions.
9287 */
9288 exit: PropTypes$$1.bool,
9289
9290 /**
9291 * The duration of the transition, in milliseconds.
9292 * Required unless `addEndListener` is provided.
9293 *
9294 * You may specify a single timeout for all transitions:
9295 *
9296 * ```jsx
9297 * timeout={500}
9298 * ```
9299 *
9300 * or individually:
9301 *
9302 * ```jsx
9303 * timeout={{
9304 * appear: 500,
9305 * enter: 300,
9306 * exit: 500,
9307 * }}
9308 * ```
9309 *
9310 * - `appear` defaults to the value of `enter`
9311 * - `enter` defaults to `0`
9312 * - `exit` defaults to `0`
9313 *
9314 * @type {number | { enter?: number, exit?: number, appear?: number }}
9315 */
9316 timeout: function timeout(props) {
9317 var pt = PropTypes$1.timeoutsShape;
9318 if (!props.addEndListener) pt = pt.isRequired;
9319
9320 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
9321 args[_key - 1] = arguments[_key];
9322 }
9323
9324 return pt.apply(void 0, [props].concat(args));
9325 },
9326
9327 /**
9328 * Add a custom transition end trigger. Called with the transitioning
9329 * DOM node and a `done` callback. Allows for more fine grained transition end
9330 * logic. **Note:** Timeouts are still used as a fallback if provided.
9331 *
9332 * ```jsx
9333 * addEndListener={(node, done) => {
9334 * // use the css transitionend event to mark the finish of a transition
9335 * node.addEventListener('transitionend', done, false);
9336 * }}
9337 * ```
9338 */
9339 addEndListener: PropTypes$$1.func,
9340
9341 /**
9342 * Callback fired before the "entering" status is applied. An extra parameter
9343 * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
9344 *
9345 * @type Function(node: HtmlElement, isAppearing: bool) -> void
9346 */
9347 onEnter: PropTypes$$1.func,
9348
9349 /**
9350 * Callback fired after the "entering" status is applied. An extra parameter
9351 * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
9352 *
9353 * @type Function(node: HtmlElement, isAppearing: bool)
9354 */
9355 onEntering: PropTypes$$1.func,
9356
9357 /**
9358 * Callback fired after the "entered" status is applied. An extra parameter
9359 * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
9360 *
9361 * @type Function(node: HtmlElement, isAppearing: bool) -> void
9362 */
9363 onEntered: PropTypes$$1.func,
9364
9365 /**
9366 * Callback fired before the "exiting" status is applied.
9367 *
9368 * @type Function(node: HtmlElement) -> void
9369 */
9370 onExit: PropTypes$$1.func,
9371
9372 /**
9373 * Callback fired after the "exiting" status is applied.
9374 *
9375 * @type Function(node: HtmlElement) -> void
9376 */
9377 onExiting: PropTypes$$1.func,
9378
9379 /**
9380 * Callback fired after the "exited" status is applied.
9381 *
9382 * @type Function(node: HtmlElement) -> void
9383 */
9384 onExited: PropTypes$$1.func // Name the function so it is clearer in the documentation
9385
9386} : {};
9387
9388function noop() {}
9389
9390Transition.defaultProps = {
9391 in: false,
9392 mountOnEnter: false,
9393 unmountOnExit: false,
9394 appear: false,
9395 enter: true,
9396 exit: true,
9397 onEnter: noop,
9398 onEntering: noop,
9399 onEntered: noop,
9400 onExit: noop,
9401 onExiting: noop,
9402 onExited: noop
9403};
9404Transition.UNMOUNTED = 0;
9405Transition.EXITED = 1;
9406Transition.ENTERING = 2;
9407Transition.ENTERED = 3;
9408Transition.EXITING = 4;
9409
9410var _default = (0, reactLifecyclesCompat_es.polyfill)(Transition);
9411
9412exports.default = _default;
9413});
9414
9415unwrapExports(Transition_1);
9416var Transition_2 = Transition_1.EXITING;
9417var Transition_3 = Transition_1.ENTERED;
9418var Transition_4 = Transition_1.ENTERING;
9419var Transition_5 = Transition_1.EXITED;
9420var Transition_6 = Transition_1.UNMOUNTED;
9421
9422var CSSTransition_1 = createCommonjsModule(function (module, exports) {
9423
9424exports.__esModule = true;
9425exports.default = void 0;
9426
9427var PropTypes$$1 = _interopRequireWildcard(PropTypes);
9428
9429var _addClass = _interopRequireDefault(addClass_1);
9430
9431var _removeClass = _interopRequireDefault(removeClass);
9432
9433var _react = _interopRequireDefault(React__default);
9434
9435var _Transition = _interopRequireDefault(Transition_1);
9436
9437
9438
9439function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9440
9441function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
9442
9443function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
9444
9445function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
9446
9447var addClass = function addClass(node, classes) {
9448 return node && classes && classes.split(' ').forEach(function (c) {
9449 return (0, _addClass.default)(node, c);
9450 });
9451};
9452
9453var removeClass$$1 = function removeClass$$1(node, classes) {
9454 return node && classes && classes.split(' ').forEach(function (c) {
9455 return (0, _removeClass.default)(node, c);
9456 });
9457};
9458/**
9459 * A transition component inspired by the excellent
9460 * [ng-animate](http://www.nganimate.org/) library, you should use it if you're
9461 * using CSS transitions or animations. It's built upon the
9462 * [`Transition`](https://reactcommunity.org/react-transition-group/transition)
9463 * component, so it inherits all of its props.
9464 *
9465 * `CSSTransition` applies a pair of class names during the `appear`, `enter`,
9466 * and `exit` states of the transition. The first class is applied and then a
9467 * second `*-active` class in order to activate the CSSS transition. After the
9468 * transition, matching `*-done` class names are applied to persist the
9469 * transition state.
9470 *
9471 * ```jsx
9472 * function App() {
9473 * const [inProp, setInProp] = useState(false);
9474 * return (
9475 * <div>
9476 * <CSSTransition in={inProp} timeout={200} classNames="my-node">
9477 * <div>
9478 * {"I'll receive my-node-* classes"}
9479 * </div>
9480 * </CSSTransition>
9481 * <button type="button" onClick={() => setInProp(true)}>
9482 * Click to Enter
9483 * </button>
9484 * </div>
9485 * );
9486 * }
9487 * ```
9488 *
9489 * When the `in` prop is set to `true`, the child component will first receive
9490 * the class `example-enter`, then the `example-enter-active` will be added in
9491 * the next tick. `CSSTransition` [forces a
9492 * reflow](https://github.com/reactjs/react-transition-group/blob/5007303e729a74be66a21c3e2205e4916821524b/src/CSSTransition.js#L208-L215)
9493 * between before adding the `example-enter-active`. This is an important trick
9494 * because it allows us to transition between `example-enter` and
9495 * `example-enter-active` even though they were added immediately one after
9496 * another. Most notably, this is what makes it possible for us to animate
9497 * _appearance_.
9498 *
9499 * ```css
9500 * .my-node-enter {
9501 * opacity: 0;
9502 * }
9503 * .my-node-enter-active {
9504 * opacity: 1;
9505 * transition: opacity 200ms;
9506 * }
9507 * .my-node-exit {
9508 * opacity: 1;
9509 * }
9510 * .my-node-exit-active {
9511 * opacity: 0;
9512 * transition: opacity: 200ms;
9513 * }
9514 * ```
9515 *
9516 * `*-active` classes represent which styles you want to animate **to**.
9517 */
9518
9519
9520var CSSTransition =
9521/*#__PURE__*/
9522function (_React$Component) {
9523 _inheritsLoose(CSSTransition, _React$Component);
9524
9525 function CSSTransition() {
9526 var _this;
9527
9528 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
9529 args[_key] = arguments[_key];
9530 }
9531
9532 _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
9533
9534 _this.onEnter = function (node, appearing) {
9535 var _this$getClassNames = _this.getClassNames(appearing ? 'appear' : 'enter'),
9536 className = _this$getClassNames.className;
9537
9538 _this.removeClasses(node, 'exit');
9539
9540 addClass(node, className);
9541
9542 if (_this.props.onEnter) {
9543 _this.props.onEnter(node, appearing);
9544 }
9545 };
9546
9547 _this.onEntering = function (node, appearing) {
9548 var _this$getClassNames2 = _this.getClassNames(appearing ? 'appear' : 'enter'),
9549 activeClassName = _this$getClassNames2.activeClassName;
9550
9551 _this.reflowAndAddClass(node, activeClassName);
9552
9553 if (_this.props.onEntering) {
9554 _this.props.onEntering(node, appearing);
9555 }
9556 };
9557
9558 _this.onEntered = function (node, appearing) {
9559 var appearClassName = _this.getClassNames('appear').doneClassName;
9560
9561 var enterClassName = _this.getClassNames('enter').doneClassName;
9562
9563 var doneClassName = appearing ? appearClassName + " " + enterClassName : enterClassName;
9564
9565 _this.removeClasses(node, appearing ? 'appear' : 'enter');
9566
9567 addClass(node, doneClassName);
9568
9569 if (_this.props.onEntered) {
9570 _this.props.onEntered(node, appearing);
9571 }
9572 };
9573
9574 _this.onExit = function (node) {
9575 var _this$getClassNames3 = _this.getClassNames('exit'),
9576 className = _this$getClassNames3.className;
9577
9578 _this.removeClasses(node, 'appear');
9579
9580 _this.removeClasses(node, 'enter');
9581
9582 addClass(node, className);
9583
9584 if (_this.props.onExit) {
9585 _this.props.onExit(node);
9586 }
9587 };
9588
9589 _this.onExiting = function (node) {
9590 var _this$getClassNames4 = _this.getClassNames('exit'),
9591 activeClassName = _this$getClassNames4.activeClassName;
9592
9593 _this.reflowAndAddClass(node, activeClassName);
9594
9595 if (_this.props.onExiting) {
9596 _this.props.onExiting(node);
9597 }
9598 };
9599
9600 _this.onExited = function (node) {
9601 var _this$getClassNames5 = _this.getClassNames('exit'),
9602 doneClassName = _this$getClassNames5.doneClassName;
9603
9604 _this.removeClasses(node, 'exit');
9605
9606 addClass(node, doneClassName);
9607
9608 if (_this.props.onExited) {
9609 _this.props.onExited(node);
9610 }
9611 };
9612
9613 _this.getClassNames = function (type) {
9614 var classNames = _this.props.classNames;
9615 var isStringClassNames = typeof classNames === 'string';
9616 var prefix = isStringClassNames && classNames ? classNames + '-' : '';
9617 var className = isStringClassNames ? prefix + type : classNames[type];
9618 var activeClassName = isStringClassNames ? className + '-active' : classNames[type + 'Active'];
9619 var doneClassName = isStringClassNames ? className + '-done' : classNames[type + 'Done'];
9620 return {
9621 className: className,
9622 activeClassName: activeClassName,
9623 doneClassName: doneClassName
9624 };
9625 };
9626
9627 return _this;
9628 }
9629
9630 var _proto = CSSTransition.prototype;
9631
9632 _proto.removeClasses = function removeClasses(node, type) {
9633 var _this$getClassNames6 = this.getClassNames(type),
9634 className = _this$getClassNames6.className,
9635 activeClassName = _this$getClassNames6.activeClassName,
9636 doneClassName = _this$getClassNames6.doneClassName;
9637
9638 className && removeClass$$1(node, className);
9639 activeClassName && removeClass$$1(node, activeClassName);
9640 doneClassName && removeClass$$1(node, doneClassName);
9641 };
9642
9643 _proto.reflowAndAddClass = function reflowAndAddClass(node, className) {
9644 // This is for to force a repaint,
9645 // which is necessary in order to transition styles when adding a class name.
9646 if (className) {
9647 /* eslint-disable no-unused-expressions */
9648 node && node.scrollTop;
9649 /* eslint-enable no-unused-expressions */
9650
9651 addClass(node, className);
9652 }
9653 };
9654
9655 _proto.render = function render() {
9656 var props = _extends({}, this.props);
9657
9658 delete props.classNames;
9659 return _react.default.createElement(_Transition.default, _extends({}, props, {
9660 onEnter: this.onEnter,
9661 onEntered: this.onEntered,
9662 onEntering: this.onEntering,
9663 onExit: this.onExit,
9664 onExiting: this.onExiting,
9665 onExited: this.onExited
9666 }));
9667 };
9668
9669 return CSSTransition;
9670}(_react.default.Component);
9671
9672CSSTransition.defaultProps = {
9673 classNames: ''
9674};
9675CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends({}, _Transition.default.propTypes, {
9676 /**
9677 * The animation classNames applied to the component as it enters, exits or
9678 * has finished the transition. A single name can be provided and it will be
9679 * suffixed for each stage: e.g.
9680 *
9681 * `classNames="fade"` applies `fade-enter`, `fade-enter-active`,
9682 * `fade-enter-done`, `fade-exit`, `fade-exit-active`, `fade-exit-done`,
9683 * `fade-appear`, `fade-appear-active`, and `fade-appear-done`.
9684 *
9685 * **Note**: `fade-appear-done` and `fade-enter-done` will _both_ be applied.
9686 * This allows you to define different behavior for when appearing is done and
9687 * when regular entering is done, using selectors like
9688 * `.fade-enter-done:not(.fade-appear-done)`. For example, you could apply an
9689 * epic entrance animation when element first appears in the DOM using
9690 * [Animate.css](https://daneden.github.io/animate.css/). Otherwise you can
9691 * simply use `fade-enter-done` for defining both cases.
9692 *
9693 * Each individual classNames can also be specified independently like:
9694 *
9695 * ```js
9696 * classNames={{
9697 * appear: 'my-appear',
9698 * appearActive: 'my-active-appear',
9699 * appearDone: 'my-done-appear',
9700 * enter: 'my-enter',
9701 * enterActive: 'my-active-enter',
9702 * enterDone: 'my-done-enter',
9703 * exit: 'my-exit',
9704 * exitActive: 'my-active-exit',
9705 * exitDone: 'my-done-exit',
9706 * }}
9707 * ```
9708 *
9709 * If you want to set these classes using CSS Modules:
9710 *
9711 * ```js
9712 * import styles from './styles.css';
9713 * ```
9714 *
9715 * you might want to use camelCase in your CSS file, that way could simply
9716 * spread them instead of listing them one by one:
9717 *
9718 * ```js
9719 * classNames={{ ...styles }}
9720 * ```
9721 *
9722 * @type {string | {
9723 * appear?: string,
9724 * appearActive?: string,
9725 * appearDone?: string,
9726 * enter?: string,
9727 * enterActive?: string,
9728 * enterDone?: string,
9729 * exit?: string,
9730 * exitActive?: string,
9731 * exitDone?: string,
9732 * }}
9733 */
9734 classNames: PropTypes$1.classNamesShape,
9735
9736 /**
9737 * A `<Transition>` callback fired immediately after the 'enter' or 'appear' class is
9738 * applied.
9739 *
9740 * @type Function(node: HtmlElement, isAppearing: bool)
9741 */
9742 onEnter: PropTypes$$1.func,
9743
9744 /**
9745 * A `<Transition>` callback fired immediately after the 'enter-active' or
9746 * 'appear-active' class is applied.
9747 *
9748 * @type Function(node: HtmlElement, isAppearing: bool)
9749 */
9750 onEntering: PropTypes$$1.func,
9751
9752 /**
9753 * A `<Transition>` callback fired immediately after the 'enter' or
9754 * 'appear' classes are **removed** and the `done` class is added to the DOM node.
9755 *
9756 * @type Function(node: HtmlElement, isAppearing: bool)
9757 */
9758 onEntered: PropTypes$$1.func,
9759
9760 /**
9761 * A `<Transition>` callback fired immediately after the 'exit' class is
9762 * applied.
9763 *
9764 * @type Function(node: HtmlElement)
9765 */
9766 onExit: PropTypes$$1.func,
9767
9768 /**
9769 * A `<Transition>` callback fired immediately after the 'exit-active' is applied.
9770 *
9771 * @type Function(node: HtmlElement)
9772 */
9773 onExiting: PropTypes$$1.func,
9774
9775 /**
9776 * A `<Transition>` callback fired immediately after the 'exit' classes
9777 * are **removed** and the `exit-done` class is added to the DOM node.
9778 *
9779 * @type Function(node: HtmlElement)
9780 */
9781 onExited: PropTypes$$1.func
9782}) : {};
9783var _default = CSSTransition;
9784exports.default = _default;
9785module.exports = exports["default"];
9786});
9787
9788unwrapExports(CSSTransition_1);
9789
9790var ChildMapping = createCommonjsModule(function (module, exports) {
9791
9792exports.__esModule = true;
9793exports.getChildMapping = getChildMapping;
9794exports.mergeChildMappings = mergeChildMappings;
9795exports.getInitialChildMapping = getInitialChildMapping;
9796exports.getNextChildMapping = getNextChildMapping;
9797
9798
9799
9800/**
9801 * Given `this.props.children`, return an object mapping key to child.
9802 *
9803 * @param {*} children `this.props.children`
9804 * @return {object} Mapping of key to child
9805 */
9806function getChildMapping(children, mapFn) {
9807 var mapper = function mapper(child) {
9808 return mapFn && (0, React__default.isValidElement)(child) ? mapFn(child) : child;
9809 };
9810
9811 var result = Object.create(null);
9812 if (children) React__default.Children.map(children, function (c) {
9813 return c;
9814 }).forEach(function (child) {
9815 // run the map function here instead so that the key is the computed one
9816 result[child.key] = mapper(child);
9817 });
9818 return result;
9819}
9820/**
9821 * When you're adding or removing children some may be added or removed in the
9822 * same render pass. We want to show *both* since we want to simultaneously
9823 * animate elements in and out. This function takes a previous set of keys
9824 * and a new set of keys and merges them with its best guess of the correct
9825 * ordering. In the future we may expose some of the utilities in
9826 * ReactMultiChild to make this easy, but for now React itself does not
9827 * directly have this concept of the union of prevChildren and nextChildren
9828 * so we implement it here.
9829 *
9830 * @param {object} prev prev children as returned from
9831 * `ReactTransitionChildMapping.getChildMapping()`.
9832 * @param {object} next next children as returned from
9833 * `ReactTransitionChildMapping.getChildMapping()`.
9834 * @return {object} a key set that contains all keys in `prev` and all keys
9835 * in `next` in a reasonable order.
9836 */
9837
9838
9839function mergeChildMappings(prev, next) {
9840 prev = prev || {};
9841 next = next || {};
9842
9843 function getValueForKey(key) {
9844 return key in next ? next[key] : prev[key];
9845 } // For each key of `next`, the list of keys to insert before that key in
9846 // the combined list
9847
9848
9849 var nextKeysPending = Object.create(null);
9850 var pendingKeys = [];
9851
9852 for (var prevKey in prev) {
9853 if (prevKey in next) {
9854 if (pendingKeys.length) {
9855 nextKeysPending[prevKey] = pendingKeys;
9856 pendingKeys = [];
9857 }
9858 } else {
9859 pendingKeys.push(prevKey);
9860 }
9861 }
9862
9863 var i;
9864 var childMapping = {};
9865
9866 for (var nextKey in next) {
9867 if (nextKeysPending[nextKey]) {
9868 for (i = 0; i < nextKeysPending[nextKey].length; i++) {
9869 var pendingNextKey = nextKeysPending[nextKey][i];
9870 childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
9871 }
9872 }
9873
9874 childMapping[nextKey] = getValueForKey(nextKey);
9875 } // Finally, add the keys which didn't appear before any key in `next`
9876
9877
9878 for (i = 0; i < pendingKeys.length; i++) {
9879 childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
9880 }
9881
9882 return childMapping;
9883}
9884
9885function getProp(child, prop, props) {
9886 return props[prop] != null ? props[prop] : child.props[prop];
9887}
9888
9889function getInitialChildMapping(props, onExited) {
9890 return getChildMapping(props.children, function (child) {
9891 return (0, React__default.cloneElement)(child, {
9892 onExited: onExited.bind(null, child),
9893 in: true,
9894 appear: getProp(child, 'appear', props),
9895 enter: getProp(child, 'enter', props),
9896 exit: getProp(child, 'exit', props)
9897 });
9898 });
9899}
9900
9901function getNextChildMapping(nextProps, prevChildMapping, onExited) {
9902 var nextChildMapping = getChildMapping(nextProps.children);
9903 var children = mergeChildMappings(prevChildMapping, nextChildMapping);
9904 Object.keys(children).forEach(function (key) {
9905 var child = children[key];
9906 if (!(0, React__default.isValidElement)(child)) return;
9907 var hasPrev = key in prevChildMapping;
9908 var hasNext = key in nextChildMapping;
9909 var prevChild = prevChildMapping[key];
9910 var isLeaving = (0, React__default.isValidElement)(prevChild) && !prevChild.props.in; // item is new (entering)
9911
9912 if (hasNext && (!hasPrev || isLeaving)) {
9913 // console.log('entering', key)
9914 children[key] = (0, React__default.cloneElement)(child, {
9915 onExited: onExited.bind(null, child),
9916 in: true,
9917 exit: getProp(child, 'exit', nextProps),
9918 enter: getProp(child, 'enter', nextProps)
9919 });
9920 } else if (!hasNext && hasPrev && !isLeaving) {
9921 // item is old (exiting)
9922 // console.log('leaving', key)
9923 children[key] = (0, React__default.cloneElement)(child, {
9924 in: false
9925 });
9926 } else if (hasNext && hasPrev && (0, React__default.isValidElement)(prevChild)) {
9927 // item hasn't changed transition states
9928 // copy over the last transition props;
9929 // console.log('unchanged', key)
9930 children[key] = (0, React__default.cloneElement)(child, {
9931 onExited: onExited.bind(null, child),
9932 in: prevChild.props.in,
9933 exit: getProp(child, 'exit', nextProps),
9934 enter: getProp(child, 'enter', nextProps)
9935 });
9936 }
9937 });
9938 return children;
9939}
9940});
9941
9942unwrapExports(ChildMapping);
9943var ChildMapping_1 = ChildMapping.getChildMapping;
9944var ChildMapping_2 = ChildMapping.mergeChildMappings;
9945var ChildMapping_3 = ChildMapping.getInitialChildMapping;
9946var ChildMapping_4 = ChildMapping.getNextChildMapping;
9947
9948var TransitionGroup_1 = createCommonjsModule(function (module, exports) {
9949
9950exports.__esModule = true;
9951exports.default = void 0;
9952
9953var _propTypes = _interopRequireDefault(PropTypes);
9954
9955var _react = _interopRequireDefault(React__default);
9956
9957
9958
9959
9960
9961function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9962
9963function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
9964
9965function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
9966
9967function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
9968
9969function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
9970
9971var values = Object.values || function (obj) {
9972 return Object.keys(obj).map(function (k) {
9973 return obj[k];
9974 });
9975};
9976
9977var defaultProps = {
9978 component: 'div',
9979 childFactory: function childFactory(child) {
9980 return child;
9981 }
9982 /**
9983 * The `<TransitionGroup>` component manages a set of transition components
9984 * (`<Transition>` and `<CSSTransition>`) in a list. Like with the transition
9985 * components, `<TransitionGroup>` is a state machine for managing the mounting
9986 * and unmounting of components over time.
9987 *
9988 * Consider the example below. As items are removed or added to the TodoList the
9989 * `in` prop is toggled automatically by the `<TransitionGroup>`.
9990 *
9991 * Note that `<TransitionGroup>` does not define any animation behavior!
9992 * Exactly _how_ a list item animates is up to the individual transition
9993 * component. This means you can mix and match animations across different list
9994 * items.
9995 */
9996
9997};
9998
9999var TransitionGroup =
10000/*#__PURE__*/
10001function (_React$Component) {
10002 _inheritsLoose(TransitionGroup, _React$Component);
10003
10004 function TransitionGroup(props, context) {
10005 var _this;
10006
10007 _this = _React$Component.call(this, props, context) || this;
10008
10009 var handleExited = _this.handleExited.bind(_assertThisInitialized(_assertThisInitialized(_this))); // Initial children should all be entering, dependent on appear
10010
10011
10012 _this.state = {
10013 handleExited: handleExited,
10014 firstRender: true
10015 };
10016 return _this;
10017 }
10018
10019 var _proto = TransitionGroup.prototype;
10020
10021 _proto.getChildContext = function getChildContext() {
10022 return {
10023 transitionGroup: {
10024 isMounting: !this.appeared
10025 }
10026 };
10027 };
10028
10029 _proto.componentDidMount = function componentDidMount() {
10030 this.appeared = true;
10031 this.mounted = true;
10032 };
10033
10034 _proto.componentWillUnmount = function componentWillUnmount() {
10035 this.mounted = false;
10036 };
10037
10038 TransitionGroup.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) {
10039 var prevChildMapping = _ref.children,
10040 handleExited = _ref.handleExited,
10041 firstRender = _ref.firstRender;
10042 return {
10043 children: firstRender ? (0, ChildMapping.getInitialChildMapping)(nextProps, handleExited) : (0, ChildMapping.getNextChildMapping)(nextProps, prevChildMapping, handleExited),
10044 firstRender: false
10045 };
10046 };
10047
10048 _proto.handleExited = function handleExited(child, node) {
10049 var currentChildMapping = (0, ChildMapping.getChildMapping)(this.props.children);
10050 if (child.key in currentChildMapping) return;
10051
10052 if (child.props.onExited) {
10053 child.props.onExited(node);
10054 }
10055
10056 if (this.mounted) {
10057 this.setState(function (state) {
10058 var children = _extends({}, state.children);
10059
10060 delete children[child.key];
10061 return {
10062 children: children
10063 };
10064 });
10065 }
10066 };
10067
10068 _proto.render = function render() {
10069 var _this$props = this.props,
10070 Component = _this$props.component,
10071 childFactory = _this$props.childFactory,
10072 props = _objectWithoutPropertiesLoose(_this$props, ["component", "childFactory"]);
10073
10074 var children = values(this.state.children).map(childFactory);
10075 delete props.appear;
10076 delete props.enter;
10077 delete props.exit;
10078
10079 if (Component === null) {
10080 return children;
10081 }
10082
10083 return _react.default.createElement(Component, props, children);
10084 };
10085
10086 return TransitionGroup;
10087}(_react.default.Component);
10088
10089TransitionGroup.childContextTypes = {
10090 transitionGroup: _propTypes.default.object.isRequired
10091};
10092TransitionGroup.propTypes = process.env.NODE_ENV !== "production" ? {
10093 /**
10094 * `<TransitionGroup>` renders a `<div>` by default. You can change this
10095 * behavior by providing a `component` prop.
10096 * If you use React v16+ and would like to avoid a wrapping `<div>` element
10097 * you can pass in `component={null}`. This is useful if the wrapping div
10098 * borks your css styles.
10099 */
10100 component: _propTypes.default.any,
10101
10102 /**
10103 * A set of `<Transition>` components, that are toggled `in` and out as they
10104 * leave. the `<TransitionGroup>` will inject specific transition props, so
10105 * remember to spread them through if you are wrapping the `<Transition>` as
10106 * with our `<Fade>` example.
10107 *
10108 * While this component is meant for multiple `Transition` or `CSSTransition`
10109 * children, sometimes you may want to have a single transition child with
10110 * content that you want to be transitioned out and in when you change it
10111 * (e.g. routes, images etc.) In that case you can change the `key` prop of
10112 * the transition child as you change its content, this will cause
10113 * `TransitionGroup` to transition the child out and back in.
10114 */
10115 children: _propTypes.default.node,
10116
10117 /**
10118 * A convenience prop that enables or disables appear animations
10119 * for all children. Note that specifying this will override any defaults set
10120 * on individual children Transitions.
10121 */
10122 appear: _propTypes.default.bool,
10123
10124 /**
10125 * A convenience prop that enables or disables enter animations
10126 * for all children. Note that specifying this will override any defaults set
10127 * on individual children Transitions.
10128 */
10129 enter: _propTypes.default.bool,
10130
10131 /**
10132 * A convenience prop that enables or disables exit animations
10133 * for all children. Note that specifying this will override any defaults set
10134 * on individual children Transitions.
10135 */
10136 exit: _propTypes.default.bool,
10137
10138 /**
10139 * You may need to apply reactive updates to a child as it is exiting.
10140 * This is generally done by using `cloneElement` however in the case of an exiting
10141 * child the element has already been removed and not accessible to the consumer.
10142 *
10143 * If you do need to update a child as it leaves you can provide a `childFactory`
10144 * to wrap every child, even the ones that are leaving.
10145 *
10146 * @type Function(child: ReactElement) -> ReactElement
10147 */
10148 childFactory: _propTypes.default.func
10149} : {};
10150TransitionGroup.defaultProps = defaultProps;
10151
10152var _default = (0, reactLifecyclesCompat_es.polyfill)(TransitionGroup);
10153
10154exports.default = _default;
10155module.exports = exports["default"];
10156});
10157
10158unwrapExports(TransitionGroup_1);
10159
10160var ReplaceTransition_1 = createCommonjsModule(function (module, exports) {
10161
10162exports.__esModule = true;
10163exports.default = void 0;
10164
10165var _propTypes = _interopRequireDefault(PropTypes);
10166
10167var _react = _interopRequireDefault(React__default);
10168
10169
10170
10171var _TransitionGroup = _interopRequireDefault(TransitionGroup_1);
10172
10173function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10174
10175function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10176
10177function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
10178
10179/**
10180 * The `<ReplaceTransition>` component is a specialized `Transition` component
10181 * that animates between two children.
10182 *
10183 * ```jsx
10184 * <ReplaceTransition in>
10185 * <Fade><div>I appear first</div></Fade>
10186 * <Fade><div>I replace the above</div></Fade>
10187 * </ReplaceTransition>
10188 * ```
10189 */
10190var ReplaceTransition =
10191/*#__PURE__*/
10192function (_React$Component) {
10193 _inheritsLoose(ReplaceTransition, _React$Component);
10194
10195 function ReplaceTransition() {
10196 var _this;
10197
10198 for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
10199 _args[_key] = arguments[_key];
10200 }
10201
10202 _this = _React$Component.call.apply(_React$Component, [this].concat(_args)) || this;
10203
10204 _this.handleEnter = function () {
10205 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
10206 args[_key2] = arguments[_key2];
10207 }
10208
10209 return _this.handleLifecycle('onEnter', 0, args);
10210 };
10211
10212 _this.handleEntering = function () {
10213 for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
10214 args[_key3] = arguments[_key3];
10215 }
10216
10217 return _this.handleLifecycle('onEntering', 0, args);
10218 };
10219
10220 _this.handleEntered = function () {
10221 for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
10222 args[_key4] = arguments[_key4];
10223 }
10224
10225 return _this.handleLifecycle('onEntered', 0, args);
10226 };
10227
10228 _this.handleExit = function () {
10229 for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
10230 args[_key5] = arguments[_key5];
10231 }
10232
10233 return _this.handleLifecycle('onExit', 1, args);
10234 };
10235
10236 _this.handleExiting = function () {
10237 for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
10238 args[_key6] = arguments[_key6];
10239 }
10240
10241 return _this.handleLifecycle('onExiting', 1, args);
10242 };
10243
10244 _this.handleExited = function () {
10245 for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
10246 args[_key7] = arguments[_key7];
10247 }
10248
10249 return _this.handleLifecycle('onExited', 1, args);
10250 };
10251
10252 return _this;
10253 }
10254
10255 var _proto = ReplaceTransition.prototype;
10256
10257 _proto.handleLifecycle = function handleLifecycle(handler, idx, originalArgs) {
10258 var _child$props;
10259
10260 var children = this.props.children;
10261
10262 var child = _react.default.Children.toArray(children)[idx];
10263
10264 if (child.props[handler]) (_child$props = child.props)[handler].apply(_child$props, originalArgs);
10265 if (this.props[handler]) this.props[handler]((0, reactDom__default.findDOMNode)(this));
10266 };
10267
10268 _proto.render = function render() {
10269 var _this$props = this.props,
10270 children = _this$props.children,
10271 inProp = _this$props.in,
10272 props = _objectWithoutPropertiesLoose(_this$props, ["children", "in"]);
10273
10274 var _React$Children$toArr = _react.default.Children.toArray(children),
10275 first = _React$Children$toArr[0],
10276 second = _React$Children$toArr[1];
10277
10278 delete props.onEnter;
10279 delete props.onEntering;
10280 delete props.onEntered;
10281 delete props.onExit;
10282 delete props.onExiting;
10283 delete props.onExited;
10284 return _react.default.createElement(_TransitionGroup.default, props, inProp ? _react.default.cloneElement(first, {
10285 key: 'first',
10286 onEnter: this.handleEnter,
10287 onEntering: this.handleEntering,
10288 onEntered: this.handleEntered
10289 }) : _react.default.cloneElement(second, {
10290 key: 'second',
10291 onEnter: this.handleExit,
10292 onEntering: this.handleExiting,
10293 onEntered: this.handleExited
10294 }));
10295 };
10296
10297 return ReplaceTransition;
10298}(_react.default.Component);
10299
10300ReplaceTransition.propTypes = process.env.NODE_ENV !== "production" ? {
10301 in: _propTypes.default.bool.isRequired,
10302 children: function children(props, propName) {
10303 if (_react.default.Children.count(props[propName]) !== 2) return new Error("\"" + propName + "\" must be exactly two transition components.");
10304 return null;
10305 }
10306} : {};
10307var _default = ReplaceTransition;
10308exports.default = _default;
10309module.exports = exports["default"];
10310});
10311
10312unwrapExports(ReplaceTransition_1);
10313
10314var reactTransitionGroup = createCommonjsModule(function (module) {
10315
10316var _CSSTransition = _interopRequireDefault(CSSTransition_1);
10317
10318var _ReplaceTransition = _interopRequireDefault(ReplaceTransition_1);
10319
10320var _TransitionGroup = _interopRequireDefault(TransitionGroup_1);
10321
10322var _Transition = _interopRequireDefault(Transition_1);
10323
10324function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10325
10326module.exports = {
10327 Transition: _Transition.default,
10328 TransitionGroup: _TransitionGroup.default,
10329 ReplaceTransition: _ReplaceTransition.default,
10330 CSSTransition: _CSSTransition.default
10331};
10332});
10333
10334unwrapExports(reactTransitionGroup);
10335var reactTransitionGroup_1 = reactTransitionGroup.Transition;
10336var reactTransitionGroup_2 = reactTransitionGroup.TransitionGroup;
10337var reactTransitionGroup_3 = reactTransitionGroup.ReplaceTransition;
10338var reactTransitionGroup_4 = reactTransitionGroup.CSSTransition;
10339
10340function _typeof(obj) {
10341 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
10342 _typeof = function (obj) {
10343 return typeof obj;
10344 };
10345 } else {
10346 _typeof = function (obj) {
10347 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
10348 };
10349 }
10350
10351 return _typeof(obj);
10352}
10353
10354function _classCallCheck(instance, Constructor) {
10355 if (!(instance instanceof Constructor)) {
10356 throw new TypeError("Cannot call a class as a function");
10357 }
10358}
10359
10360function _defineProperties(target, props) {
10361 for (var i = 0; i < props.length; i++) {
10362 var descriptor = props[i];
10363 descriptor.enumerable = descriptor.enumerable || false;
10364 descriptor.configurable = true;
10365 if ("value" in descriptor) descriptor.writable = true;
10366 Object.defineProperty(target, descriptor.key, descriptor);
10367 }
10368}
10369
10370function _createClass(Constructor, protoProps, staticProps) {
10371 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
10372 if (staticProps) _defineProperties(Constructor, staticProps);
10373 return Constructor;
10374}
10375
10376function _defineProperty$1(obj, key, value) {
10377 if (key in obj) {
10378 Object.defineProperty(obj, key, {
10379 value: value,
10380 enumerable: true,
10381 configurable: true,
10382 writable: true
10383 });
10384 } else {
10385 obj[key] = value;
10386 }
10387
10388 return obj;
10389}
10390
10391function _extends$2() {
10392 _extends$2 = Object.assign || function (target) {
10393 for (var i = 1; i < arguments.length; i++) {
10394 var source = arguments[i];
10395
10396 for (var key in source) {
10397 if (Object.prototype.hasOwnProperty.call(source, key)) {
10398 target[key] = source[key];
10399 }
10400 }
10401 }
10402
10403 return target;
10404 };
10405
10406 return _extends$2.apply(this, arguments);
10407}
10408
10409function _objectSpread(target) {
10410 for (var i = 1; i < arguments.length; i++) {
10411 var source = arguments[i] != null ? arguments[i] : {};
10412 var ownKeys = Object.keys(source);
10413
10414 if (typeof Object.getOwnPropertySymbols === 'function') {
10415 ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
10416 return Object.getOwnPropertyDescriptor(source, sym).enumerable;
10417 }));
10418 }
10419
10420 ownKeys.forEach(function (key) {
10421 _defineProperty$1(target, key, source[key]);
10422 });
10423 }
10424
10425 return target;
10426}
10427
10428function _inherits(subClass, superClass) {
10429 if (typeof superClass !== "function" && superClass !== null) {
10430 throw new TypeError("Super expression must either be null or a function");
10431 }
10432
10433 subClass.prototype = Object.create(superClass && superClass.prototype, {
10434 constructor: {
10435 value: subClass,
10436 writable: true,
10437 configurable: true
10438 }
10439 });
10440 if (superClass) _setPrototypeOf(subClass, superClass);
10441}
10442
10443function _getPrototypeOf(o) {
10444 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
10445 return o.__proto__ || Object.getPrototypeOf(o);
10446 };
10447 return _getPrototypeOf(o);
10448}
10449
10450function _setPrototypeOf(o, p) {
10451 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
10452 o.__proto__ = p;
10453 return o;
10454 };
10455
10456 return _setPrototypeOf(o, p);
10457}
10458
10459function _objectWithoutPropertiesLoose$1(source, excluded) {
10460 if (source == null) return {};
10461 var target = {};
10462 var sourceKeys = Object.keys(source);
10463 var key, i;
10464
10465 for (i = 0; i < sourceKeys.length; i++) {
10466 key = sourceKeys[i];
10467 if (excluded.indexOf(key) >= 0) continue;
10468 target[key] = source[key];
10469 }
10470
10471 return target;
10472}
10473
10474function _objectWithoutProperties(source, excluded) {
10475 if (source == null) return {};
10476
10477 var target = _objectWithoutPropertiesLoose$1(source, excluded);
10478
10479 var key, i;
10480
10481 if (Object.getOwnPropertySymbols) {
10482 var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
10483
10484 for (i = 0; i < sourceSymbolKeys.length; i++) {
10485 key = sourceSymbolKeys[i];
10486 if (excluded.indexOf(key) >= 0) continue;
10487 if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
10488 target[key] = source[key];
10489 }
10490 }
10491
10492 return target;
10493}
10494
10495function _assertThisInitialized$1(self) {
10496 if (self === void 0) {
10497 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
10498 }
10499
10500 return self;
10501}
10502
10503function _possibleConstructorReturn(self, call) {
10504 if (call && (typeof call === "object" || typeof call === "function")) {
10505 return call;
10506 }
10507
10508 return _assertThisInitialized$1(self);
10509}
10510
10511function _toConsumableArray(arr) {
10512 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
10513}
10514
10515function _arrayWithoutHoles(arr) {
10516 if (Array.isArray(arr)) {
10517 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
10518
10519 return arr2;
10520 }
10521}
10522
10523function _iterableToArray(iter) {
10524 if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
10525}
10526
10527function _nonIterableSpread() {
10528 throw new TypeError("Invalid attempt to spread non-iterable instance");
10529}
10530
10531// ==============================
10532// NO OP
10533// ==============================
10534var noop = function noop() {};
10535// Class Name Prefixer
10536// ==============================
10537
10538/**
10539 String representation of component state for styling with class names.
10540
10541 Expects an array of strings OR a string/object pair:
10542 - className(['comp', 'comp-arg', 'comp-arg-2'])
10543 @returns 'react-select__comp react-select__comp-arg react-select__comp-arg-2'
10544 - className('comp', { some: true, state: false })
10545 @returns 'react-select__comp react-select__comp--some'
10546*/
10547
10548function applyPrefixToName(prefix, name) {
10549 if (!name) {
10550 return prefix;
10551 } else if (name[0] === '-') {
10552 return prefix + name;
10553 } else {
10554 return prefix + '__' + name;
10555 }
10556}
10557
10558function classNames(prefix, cssKey, state, className) {
10559 var arr = [cssKey, className];
10560
10561 if (state && prefix) {
10562 for (var key in state) {
10563 if (state.hasOwnProperty(key) && state[key]) {
10564 arr.push("".concat(applyPrefixToName(prefix, key)));
10565 }
10566 }
10567 }
10568
10569 return arr.filter(function (i) {
10570 return i;
10571 }).map(function (i) {
10572 return String(i).trim();
10573 }).join(' ');
10574} // ==============================
10575// Clean Value
10576// ==============================
10577
10578var cleanValue = function cleanValue(value) {
10579 if (Array.isArray(value)) return value.filter(Boolean);
10580 if (_typeof(value) === 'object' && value !== null) return [value];
10581 return [];
10582}; // ==============================
10583// Handle Input Change
10584// ==============================
10585
10586function handleInputChange(inputValue, actionMeta, onInputChange) {
10587 if (onInputChange) {
10588 var newValue = onInputChange(inputValue, actionMeta);
10589 if (typeof newValue === 'string') return newValue;
10590 }
10591
10592 return inputValue;
10593} // ==============================
10594// Scroll Helpers
10595// ==============================
10596
10597function isDocumentElement(el) {
10598 return [document.documentElement, document.body, window].indexOf(el) > -1;
10599} // Normalized Scroll Top
10600// ------------------------------
10601
10602function getScrollTop(el) {
10603 if (isDocumentElement(el)) {
10604 return window.pageYOffset;
10605 }
10606
10607 return el.scrollTop;
10608}
10609function scrollTo(el, top) {
10610 // with a scroll distance, we perform scroll on the element
10611 if (isDocumentElement(el)) {
10612 window.scrollTo(0, top);
10613 return;
10614 }
10615
10616 el.scrollTop = top;
10617} // Get Scroll Parent
10618// ------------------------------
10619
10620function getScrollParent(element) {
10621 var style = getComputedStyle(element);
10622 var excludeStaticParent = style.position === 'absolute';
10623 var overflowRx = /(auto|scroll)/;
10624 var docEl = document.documentElement; // suck it, flow...
10625
10626 if (style.position === 'fixed') return docEl;
10627
10628 for (var parent = element; parent = parent.parentElement;) {
10629 style = getComputedStyle(parent);
10630
10631 if (excludeStaticParent && style.position === 'static') {
10632 continue;
10633 }
10634
10635 if (overflowRx.test(style.overflow + style.overflowY + style.overflowX)) {
10636 return parent;
10637 }
10638 }
10639
10640 return docEl;
10641} // Animated Scroll To
10642// ------------------------------
10643
10644/**
10645 @param t: time (elapsed)
10646 @param b: initial value
10647 @param c: amount of change
10648 @param d: duration
10649*/
10650
10651function easeOutCubic(t, b, c, d) {
10652 return c * ((t = t / d - 1) * t * t + 1) + b;
10653}
10654
10655function animatedScrollTo(element, to) {
10656 var duration = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 200;
10657 var callback = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : noop;
10658 var start = getScrollTop(element);
10659 var change = to - start;
10660 var increment = 10;
10661 var currentTime = 0;
10662
10663 function animateScroll() {
10664 currentTime += increment;
10665 var val = easeOutCubic(currentTime, start, change, duration);
10666 scrollTo(element, val);
10667
10668 if (currentTime < duration) {
10669 raf_1(animateScroll);
10670 } else {
10671 callback(element);
10672 }
10673 }
10674
10675 animateScroll();
10676} // Scroll Into View
10677// ------------------------------
10678
10679function scrollIntoView(menuEl, focusedEl) {
10680 var menuRect = menuEl.getBoundingClientRect();
10681 var focusedRect = focusedEl.getBoundingClientRect();
10682 var overScroll = focusedEl.offsetHeight / 3;
10683
10684 if (focusedRect.bottom + overScroll > menuRect.bottom) {
10685 scrollTo(menuEl, Math.min(focusedEl.offsetTop + focusedEl.clientHeight - menuEl.offsetHeight + overScroll, menuEl.scrollHeight));
10686 } else if (focusedRect.top - overScroll < menuRect.top) {
10687 scrollTo(menuEl, Math.max(focusedEl.offsetTop - overScroll, 0));
10688 }
10689} // ==============================
10690// Get bounding client object
10691// ==============================
10692// cannot get keys using array notation with DOMRect
10693
10694function getBoundingClientObj(element) {
10695 var rect = element.getBoundingClientRect();
10696 return {
10697 bottom: rect.bottom,
10698 height: rect.height,
10699 left: rect.left,
10700 right: rect.right,
10701 top: rect.top,
10702 width: rect.width
10703 };
10704}
10705// Touch Capability Detector
10706// ==============================
10707
10708function isTouchCapable() {
10709 try {
10710 document.createEvent('TouchEvent');
10711 return true;
10712 } catch (e) {
10713 return false;
10714 }
10715} // ==============================
10716// Mobile Device Detector
10717// ==============================
10718
10719function isMobileDevice() {
10720 try {
10721 return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
10722 } catch (e) {
10723 return false;
10724 }
10725}
10726
10727function getMenuPlacement(_ref) {
10728 var maxHeight = _ref.maxHeight,
10729 menuEl = _ref.menuEl,
10730 minHeight = _ref.minHeight,
10731 placement = _ref.placement,
10732 shouldScroll = _ref.shouldScroll,
10733 isFixedPosition = _ref.isFixedPosition,
10734 theme = _ref.theme;
10735 var spacing = theme.spacing;
10736 var scrollParent = getScrollParent(menuEl);
10737 var defaultState = {
10738 placement: 'bottom',
10739 maxHeight: maxHeight
10740 }; // something went wrong, return default state
10741
10742 if (!menuEl || !menuEl.offsetParent) return defaultState; // we can't trust `scrollParent.scrollHeight` --> it may increase when
10743 // the menu is rendered
10744
10745 var _scrollParent$getBoun = scrollParent.getBoundingClientRect(),
10746 scrollHeight = _scrollParent$getBoun.height;
10747
10748 var _menuEl$getBoundingCl = menuEl.getBoundingClientRect(),
10749 menuBottom = _menuEl$getBoundingCl.bottom,
10750 menuHeight = _menuEl$getBoundingCl.height,
10751 menuTop = _menuEl$getBoundingCl.top;
10752
10753 var _menuEl$offsetParent$ = menuEl.offsetParent.getBoundingClientRect(),
10754 containerTop = _menuEl$offsetParent$.top;
10755
10756 var viewHeight = window.innerHeight;
10757 var scrollTop = getScrollTop(scrollParent);
10758 var marginBottom = parseInt(getComputedStyle(menuEl).marginBottom, 10);
10759 var marginTop = parseInt(getComputedStyle(menuEl).marginTop, 10);
10760 var viewSpaceAbove = containerTop - marginTop;
10761 var viewSpaceBelow = viewHeight - menuTop;
10762 var scrollSpaceAbove = viewSpaceAbove + scrollTop;
10763 var scrollSpaceBelow = scrollHeight - scrollTop - menuTop;
10764 var scrollDown = menuBottom - viewHeight + scrollTop + marginBottom;
10765 var scrollUp = scrollTop + menuTop - marginTop;
10766 var scrollDuration = 160;
10767
10768 switch (placement) {
10769 case 'auto':
10770 case 'bottom':
10771 // 1: the menu will fit, do nothing
10772 if (viewSpaceBelow >= menuHeight) {
10773 return {
10774 placement: 'bottom',
10775 maxHeight: maxHeight
10776 };
10777 } // 2: the menu will fit, if scrolled
10778
10779
10780 if (scrollSpaceBelow >= menuHeight && !isFixedPosition) {
10781 if (shouldScroll) {
10782 animatedScrollTo(scrollParent, scrollDown, scrollDuration);
10783 }
10784
10785 return {
10786 placement: 'bottom',
10787 maxHeight: maxHeight
10788 };
10789 } // 3: the menu will fit, if constrained
10790
10791
10792 if (!isFixedPosition && scrollSpaceBelow >= minHeight || isFixedPosition && viewSpaceBelow >= minHeight) {
10793 if (shouldScroll) {
10794 animatedScrollTo(scrollParent, scrollDown, scrollDuration);
10795 } // we want to provide as much of the menu as possible to the user,
10796 // so give them whatever is available below rather than the minHeight.
10797
10798
10799 var constrainedHeight = isFixedPosition ? viewSpaceBelow - marginBottom : scrollSpaceBelow - marginBottom;
10800 return {
10801 placement: 'bottom',
10802 maxHeight: constrainedHeight
10803 };
10804 } // 4. Forked beviour when there isn't enough space below
10805 // AUTO: flip the menu, render above
10806
10807
10808 if (placement === 'auto' || isFixedPosition) {
10809 // may need to be constrained after flipping
10810 var _constrainedHeight = maxHeight;
10811 var spaceAbove = isFixedPosition ? viewSpaceAbove : scrollSpaceAbove;
10812
10813 if (spaceAbove >= minHeight) {
10814 _constrainedHeight = Math.min(spaceAbove - marginBottom - spacing.controlHeight, maxHeight);
10815 }
10816
10817 return {
10818 placement: 'top',
10819 maxHeight: _constrainedHeight
10820 };
10821 } // BOTTOM: allow browser to increase scrollable area and immediately set scroll
10822
10823
10824 if (placement === 'bottom') {
10825 scrollTo(scrollParent, scrollDown);
10826 return {
10827 placement: 'bottom',
10828 maxHeight: maxHeight
10829 };
10830 }
10831
10832 break;
10833
10834 case 'top':
10835 // 1: the menu will fit, do nothing
10836 if (viewSpaceAbove >= menuHeight) {
10837 return {
10838 placement: 'top',
10839 maxHeight: maxHeight
10840 };
10841 } // 2: the menu will fit, if scrolled
10842
10843
10844 if (scrollSpaceAbove >= menuHeight && !isFixedPosition) {
10845 if (shouldScroll) {
10846 animatedScrollTo(scrollParent, scrollUp, scrollDuration);
10847 }
10848
10849 return {
10850 placement: 'top',
10851 maxHeight: maxHeight
10852 };
10853 } // 3: the menu will fit, if constrained
10854
10855
10856 if (!isFixedPosition && scrollSpaceAbove >= minHeight || isFixedPosition && viewSpaceAbove >= minHeight) {
10857 var _constrainedHeight2 = maxHeight; // we want to provide as much of the menu as possible to the user,
10858 // so give them whatever is available below rather than the minHeight.
10859
10860 if (!isFixedPosition && scrollSpaceAbove >= minHeight || isFixedPosition && viewSpaceAbove >= minHeight) {
10861 _constrainedHeight2 = isFixedPosition ? viewSpaceAbove - marginTop : scrollSpaceAbove - marginTop;
10862 }
10863
10864 if (shouldScroll) {
10865 animatedScrollTo(scrollParent, scrollUp, scrollDuration);
10866 }
10867
10868 return {
10869 placement: 'top',
10870 maxHeight: _constrainedHeight2
10871 };
10872 } // 4. not enough space, the browser WILL NOT increase scrollable area when
10873 // absolutely positioned element rendered above the viewport (only below).
10874 // Flip the menu, render below
10875
10876
10877 return {
10878 placement: 'bottom',
10879 maxHeight: maxHeight
10880 };
10881
10882 default:
10883 throw new Error("Invalid placement provided \"".concat(placement, "\"."));
10884 } // fulfil contract with flow: implicit return value of undefined
10885
10886
10887 return defaultState;
10888} // Menu Component
10889// ------------------------------
10890
10891function alignToControl(placement) {
10892 var placementToCSSProp = {
10893 bottom: 'top',
10894 top: 'bottom'
10895 };
10896 return placement ? placementToCSSProp[placement] : 'bottom';
10897}
10898
10899var coercePlacement = function coercePlacement(p) {
10900 return p === 'auto' ? 'bottom' : p;
10901};
10902
10903var menuCSS = function menuCSS(_ref2) {
10904 var _ref3;
10905
10906 var placement = _ref2.placement,
10907 _ref2$theme = _ref2.theme,
10908 borderRadius = _ref2$theme.borderRadius,
10909 spacing = _ref2$theme.spacing,
10910 colors = _ref2$theme.colors;
10911 return _ref3 = {
10912 label: 'menu'
10913 }, _defineProperty$1(_ref3, alignToControl(placement), '100%'), _defineProperty$1(_ref3, "backgroundColor", colors.neutral0), _defineProperty$1(_ref3, "borderRadius", borderRadius), _defineProperty$1(_ref3, "boxShadow", '0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)'), _defineProperty$1(_ref3, "marginBottom", spacing.menuGutter), _defineProperty$1(_ref3, "marginTop", spacing.menuGutter), _defineProperty$1(_ref3, "position", 'absolute'), _defineProperty$1(_ref3, "width", '100%'), _defineProperty$1(_ref3, "zIndex", 1), _ref3;
10914}; // NOTE: internal only
10915
10916var MenuPlacer =
10917/*#__PURE__*/
10918function (_Component) {
10919 _inherits(MenuPlacer, _Component);
10920
10921 function MenuPlacer() {
10922 var _getPrototypeOf2;
10923
10924 var _this;
10925
10926 _classCallCheck(this, MenuPlacer);
10927
10928 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
10929 args[_key] = arguments[_key];
10930 }
10931
10932 _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(MenuPlacer)).call.apply(_getPrototypeOf2, [this].concat(args)));
10933
10934 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "state", {
10935 maxHeight: _this.props.maxMenuHeight,
10936 placement: null
10937 });
10938
10939 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getPlacement", function (ref) {
10940 var _this$props = _this.props,
10941 minMenuHeight = _this$props.minMenuHeight,
10942 maxMenuHeight = _this$props.maxMenuHeight,
10943 menuPlacement = _this$props.menuPlacement,
10944 menuPosition = _this$props.menuPosition,
10945 menuShouldScrollIntoView = _this$props.menuShouldScrollIntoView,
10946 theme = _this$props.theme;
10947 var getPortalPlacement = _this.context.getPortalPlacement;
10948 if (!ref) return; // DO NOT scroll if position is fixed
10949
10950 var isFixedPosition = menuPosition === 'fixed';
10951 var shouldScroll = menuShouldScrollIntoView && !isFixedPosition;
10952 var state = getMenuPlacement({
10953 maxHeight: maxMenuHeight,
10954 menuEl: ref,
10955 minHeight: minMenuHeight,
10956 placement: menuPlacement,
10957 shouldScroll: shouldScroll,
10958 isFixedPosition: isFixedPosition,
10959 theme: theme
10960 });
10961 if (getPortalPlacement) getPortalPlacement(state);
10962
10963 _this.setState(state);
10964 });
10965
10966 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getUpdatedProps", function () {
10967 var menuPlacement = _this.props.menuPlacement;
10968 var placement = _this.state.placement || coercePlacement(menuPlacement);
10969 return _objectSpread({}, _this.props, {
10970 placement: placement,
10971 maxHeight: _this.state.maxHeight
10972 });
10973 });
10974
10975 return _this;
10976 }
10977
10978 _createClass(MenuPlacer, [{
10979 key: "render",
10980 value: function render() {
10981 var children = this.props.children;
10982 return children({
10983 ref: this.getPlacement,
10984 placerProps: this.getUpdatedProps()
10985 });
10986 }
10987 }]);
10988
10989 return MenuPlacer;
10990}(React.Component);
10991
10992_defineProperty$1(MenuPlacer, "contextTypes", {
10993 getPortalPlacement: PropTypes.func
10994});
10995
10996var Menu = function Menu(props) {
10997 var children = props.children,
10998 className = props.className,
10999 cx$$1 = props.cx,
11000 getStyles = props.getStyles,
11001 innerRef = props.innerRef,
11002 innerProps = props.innerProps;
11003 var cn = cx$$1(
11004 /*#__PURE__*/
11005 css(getStyles('menu', props)), {
11006 menu: true
11007 }, className);
11008 return React__default.createElement("div", _extends$2({
11009 className: cn
11010 }, innerProps, {
11011 ref: innerRef
11012 }), children);
11013};
11014// Menu List
11015// ==============================
11016
11017var menuListCSS = function menuListCSS(_ref4) {
11018 var maxHeight = _ref4.maxHeight,
11019 baseUnit = _ref4.theme.spacing.baseUnit;
11020 return {
11021 maxHeight: maxHeight,
11022 overflowY: 'auto',
11023 paddingBottom: baseUnit,
11024 paddingTop: baseUnit,
11025 position: 'relative',
11026 // required for offset[Height, Top] > keyboard scroll
11027 WebkitOverflowScrolling: 'touch'
11028 };
11029};
11030var MenuList = function MenuList(props) {
11031 var children = props.children,
11032 className = props.className,
11033 cx$$1 = props.cx,
11034 getStyles = props.getStyles,
11035 isMulti = props.isMulti,
11036 innerRef = props.innerRef;
11037 return React__default.createElement("div", {
11038 className: cx$$1(
11039 /*#__PURE__*/
11040 css(getStyles('menuList', props)), {
11041 'menu-list': true,
11042 'menu-list--is-multi': isMulti
11043 }, className),
11044 ref: innerRef
11045 }, children);
11046}; // ==============================
11047// Menu Notices
11048// ==============================
11049
11050var noticeCSS = function noticeCSS(_ref5) {
11051 var _ref5$theme = _ref5.theme,
11052 baseUnit = _ref5$theme.spacing.baseUnit,
11053 colors = _ref5$theme.colors;
11054 return {
11055 color: colors.neutral40,
11056 padding: "".concat(baseUnit * 2, "px ").concat(baseUnit * 3, "px"),
11057 textAlign: 'center'
11058 };
11059};
11060
11061var noOptionsMessageCSS = noticeCSS;
11062var loadingMessageCSS = noticeCSS;
11063var NoOptionsMessage = function NoOptionsMessage(props) {
11064 var children = props.children,
11065 className = props.className,
11066 cx$$1 = props.cx,
11067 getStyles = props.getStyles,
11068 innerProps = props.innerProps;
11069 return React__default.createElement("div", _extends$2({
11070 className: cx$$1(
11071 /*#__PURE__*/
11072 css(getStyles('noOptionsMessage', props)), {
11073 'menu-notice': true,
11074 'menu-notice--no-options': true
11075 }, className)
11076 }, innerProps), children);
11077};
11078NoOptionsMessage.defaultProps = {
11079 children: 'No options'
11080};
11081var LoadingMessage = function LoadingMessage(props) {
11082 var children = props.children,
11083 className = props.className,
11084 cx$$1 = props.cx,
11085 getStyles = props.getStyles,
11086 innerProps = props.innerProps;
11087 return React__default.createElement("div", _extends$2({
11088 className: cx$$1(
11089 /*#__PURE__*/
11090 css(getStyles('loadingMessage', props)), {
11091 'menu-notice': true,
11092 'menu-notice--loading': true
11093 }, className)
11094 }, innerProps), children);
11095};
11096LoadingMessage.defaultProps = {
11097 children: 'Loading...'
11098}; // ==============================
11099// Menu Portal
11100// ==============================
11101
11102var menuPortalCSS = function menuPortalCSS(_ref6) {
11103 var rect = _ref6.rect,
11104 offset = _ref6.offset,
11105 position = _ref6.position;
11106 return {
11107 left: rect.left,
11108 position: position,
11109 top: offset,
11110 width: rect.width,
11111 zIndex: 1
11112 };
11113};
11114var MenuPortal =
11115/*#__PURE__*/
11116function (_Component2) {
11117 _inherits(MenuPortal, _Component2);
11118
11119 function MenuPortal() {
11120 var _getPrototypeOf3;
11121
11122 var _this2;
11123
11124 _classCallCheck(this, MenuPortal);
11125
11126 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
11127 args[_key2] = arguments[_key2];
11128 }
11129
11130 _this2 = _possibleConstructorReturn(this, (_getPrototypeOf3 = _getPrototypeOf(MenuPortal)).call.apply(_getPrototypeOf3, [this].concat(args)));
11131
11132 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this2)), "state", {
11133 placement: null
11134 });
11135
11136 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this2)), "getPortalPlacement", function (_ref7) {
11137 var placement = _ref7.placement;
11138 var initialPlacement = coercePlacement(_this2.props.menuPlacement); // avoid re-renders if the placement has not changed
11139
11140 if (placement !== initialPlacement) {
11141 _this2.setState({
11142 placement: placement
11143 });
11144 }
11145 });
11146
11147 return _this2;
11148 }
11149
11150 _createClass(MenuPortal, [{
11151 key: "getChildContext",
11152 value: function getChildContext() {
11153 return {
11154 getPortalPlacement: this.getPortalPlacement
11155 };
11156 } // callback for occassions where the menu must "flip"
11157
11158 }, {
11159 key: "render",
11160 value: function render() {
11161 var _this$props2 = this.props,
11162 appendTo = _this$props2.appendTo,
11163 children = _this$props2.children,
11164 controlElement = _this$props2.controlElement,
11165 menuPlacement = _this$props2.menuPlacement,
11166 position = _this$props2.menuPosition,
11167 getStyles = _this$props2.getStyles;
11168 var isFixed = position === 'fixed'; // bail early if required elements aren't present
11169
11170 if (!appendTo && !isFixed || !controlElement) {
11171 return null;
11172 }
11173
11174 var placement = this.state.placement || coercePlacement(menuPlacement);
11175 var rect = getBoundingClientObj(controlElement);
11176 var scrollDistance = isFixed ? 0 : window.pageYOffset;
11177 var offset = rect[placement] + scrollDistance;
11178 var state = {
11179 offset: offset,
11180 position: position,
11181 rect: rect
11182 }; // same wrapper element whether fixed or portalled
11183
11184 var menuWrapper = React__default.createElement("div", {
11185 className:
11186 /*#__PURE__*/
11187
11188 /*#__PURE__*/
11189 css(getStyles('menuPortal', state))
11190 }, children);
11191 return appendTo ? reactDom.createPortal(menuWrapper, appendTo) : menuWrapper;
11192 }
11193 }]);
11194
11195 return MenuPortal;
11196}(React.Component);
11197
11198_defineProperty$1(MenuPortal, "childContextTypes", {
11199 getPortalPlacement: PropTypes.func
11200});
11201
11202var isArray = Array.isArray;
11203var keyList = Object.keys;
11204var hasProp = Object.prototype.hasOwnProperty;
11205
11206function equal(a, b) {
11207 // fast-deep-equal index.js 2.0.1
11208 if (a === b) return true;
11209
11210 if (a && b && _typeof(a) == 'object' && _typeof(b) == 'object') {
11211 var arrA = isArray(a),
11212 arrB = isArray(b),
11213 i,
11214 length,
11215 key;
11216
11217 if (arrA && arrB) {
11218 length = a.length;
11219 if (length != b.length) return false;
11220
11221 for (i = length; i-- !== 0;) {
11222 if (!equal(a[i], b[i])) return false;
11223 }
11224
11225 return true;
11226 }
11227
11228 if (arrA != arrB) return false;
11229 var dateA = a instanceof Date,
11230 dateB = b instanceof Date;
11231 if (dateA != dateB) return false;
11232 if (dateA && dateB) return a.getTime() == b.getTime();
11233 var regexpA = a instanceof RegExp,
11234 regexpB = b instanceof RegExp;
11235 if (regexpA != regexpB) return false;
11236 if (regexpA && regexpB) return a.toString() == b.toString();
11237 var keys = keyList(a);
11238 length = keys.length;
11239
11240 if (length !== keyList(b).length) {
11241 return false;
11242 }
11243
11244 for (i = length; i-- !== 0;) {
11245 if (!hasProp.call(b, keys[i])) return false;
11246 } // end fast-deep-equal
11247 // Custom handling for React
11248
11249
11250 for (i = length; i-- !== 0;) {
11251 key = keys[i];
11252
11253 if (key === '_owner' && a.$$typeof) {
11254 // React-specific: avoid traversing React elements' _owner.
11255 // _owner contains circular references
11256 // and is not needed when comparing the actual elements (and not their owners)
11257 // .$$typeof and ._store on just reasonable markers of a react element
11258 continue;
11259 } else {
11260 // all other properties should be traversed as usual
11261 if (!equal(a[key], b[key])) return false;
11262 }
11263 } // fast-deep-equal index.js 2.0.1
11264
11265
11266 return true;
11267 }
11268
11269 return a !== a && b !== b;
11270} // end fast-deep-equal
11271
11272
11273function exportedEqual(a, b) {
11274 try {
11275 return equal(a, b);
11276 } catch (error) {
11277 if (error.message && error.message.match(/stack|recursion/i)) {
11278 // warn on circular references, don't crash
11279 // browsers give this different errors name and messages:
11280 // chrome/safari: "RangeError", "Maximum call stack size exceeded"
11281 // firefox: "InternalError", too much recursion"
11282 // edge: "Error", "Out of stack space"
11283 console.warn('Warning: react-fast-compare does not handle circular references.', error.name, error.message);
11284 return false;
11285 } // some other error. we should definitely know about these
11286
11287
11288 throw error;
11289 }
11290}
11291
11292var diacritics = [{
11293 base: 'A',
11294 letters: /[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g
11295}, {
11296 base: 'AA',
11297 letters: /[\uA732]/g
11298}, {
11299 base: 'AE',
11300 letters: /[\u00C6\u01FC\u01E2]/g
11301}, {
11302 base: 'AO',
11303 letters: /[\uA734]/g
11304}, {
11305 base: 'AU',
11306 letters: /[\uA736]/g
11307}, {
11308 base: 'AV',
11309 letters: /[\uA738\uA73A]/g
11310}, {
11311 base: 'AY',
11312 letters: /[\uA73C]/g
11313}, {
11314 base: 'B',
11315 letters: /[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g
11316}, {
11317 base: 'C',
11318 letters: /[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g
11319}, {
11320 base: 'D',
11321 letters: /[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g
11322}, {
11323 base: 'DZ',
11324 letters: /[\u01F1\u01C4]/g
11325}, {
11326 base: 'Dz',
11327 letters: /[\u01F2\u01C5]/g
11328}, {
11329 base: 'E',
11330 letters: /[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g
11331}, {
11332 base: 'F',
11333 letters: /[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g
11334}, {
11335 base: 'G',
11336 letters: /[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g
11337}, {
11338 base: 'H',
11339 letters: /[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g
11340}, {
11341 base: 'I',
11342 letters: /[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g
11343}, {
11344 base: 'J',
11345 letters: /[\u004A\u24BF\uFF2A\u0134\u0248]/g
11346}, {
11347 base: 'K',
11348 letters: /[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g
11349}, {
11350 base: 'L',
11351 letters: /[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g
11352}, {
11353 base: 'LJ',
11354 letters: /[\u01C7]/g
11355}, {
11356 base: 'Lj',
11357 letters: /[\u01C8]/g
11358}, {
11359 base: 'M',
11360 letters: /[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g
11361}, {
11362 base: 'N',
11363 letters: /[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g
11364}, {
11365 base: 'NJ',
11366 letters: /[\u01CA]/g
11367}, {
11368 base: 'Nj',
11369 letters: /[\u01CB]/g
11370}, {
11371 base: 'O',
11372 letters: /[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g
11373}, {
11374 base: 'OI',
11375 letters: /[\u01A2]/g
11376}, {
11377 base: 'OO',
11378 letters: /[\uA74E]/g
11379}, {
11380 base: 'OU',
11381 letters: /[\u0222]/g
11382}, {
11383 base: 'P',
11384 letters: /[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g
11385}, {
11386 base: 'Q',
11387 letters: /[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g
11388}, {
11389 base: 'R',
11390 letters: /[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g
11391}, {
11392 base: 'S',
11393 letters: /[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g
11394}, {
11395 base: 'T',
11396 letters: /[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g
11397}, {
11398 base: 'TZ',
11399 letters: /[\uA728]/g
11400}, {
11401 base: 'U',
11402 letters: /[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g
11403}, {
11404 base: 'V',
11405 letters: /[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g
11406}, {
11407 base: 'VY',
11408 letters: /[\uA760]/g
11409}, {
11410 base: 'W',
11411 letters: /[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g
11412}, {
11413 base: 'X',
11414 letters: /[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g
11415}, {
11416 base: 'Y',
11417 letters: /[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g
11418}, {
11419 base: 'Z',
11420 letters: /[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g
11421}, {
11422 base: 'a',
11423 letters: /[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g
11424}, {
11425 base: 'aa',
11426 letters: /[\uA733]/g
11427}, {
11428 base: 'ae',
11429 letters: /[\u00E6\u01FD\u01E3]/g
11430}, {
11431 base: 'ao',
11432 letters: /[\uA735]/g
11433}, {
11434 base: 'au',
11435 letters: /[\uA737]/g
11436}, {
11437 base: 'av',
11438 letters: /[\uA739\uA73B]/g
11439}, {
11440 base: 'ay',
11441 letters: /[\uA73D]/g
11442}, {
11443 base: 'b',
11444 letters: /[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g
11445}, {
11446 base: 'c',
11447 letters: /[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g
11448}, {
11449 base: 'd',
11450 letters: /[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g
11451}, {
11452 base: 'dz',
11453 letters: /[\u01F3\u01C6]/g
11454}, {
11455 base: 'e',
11456 letters: /[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g
11457}, {
11458 base: 'f',
11459 letters: /[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g
11460}, {
11461 base: 'g',
11462 letters: /[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g
11463}, {
11464 base: 'h',
11465 letters: /[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g
11466}, {
11467 base: 'hv',
11468 letters: /[\u0195]/g
11469}, {
11470 base: 'i',
11471 letters: /[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g
11472}, {
11473 base: 'j',
11474 letters: /[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g
11475}, {
11476 base: 'k',
11477 letters: /[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g
11478}, {
11479 base: 'l',
11480 letters: /[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g
11481}, {
11482 base: 'lj',
11483 letters: /[\u01C9]/g
11484}, {
11485 base: 'm',
11486 letters: /[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g
11487}, {
11488 base: 'n',
11489 letters: /[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g
11490}, {
11491 base: 'nj',
11492 letters: /[\u01CC]/g
11493}, {
11494 base: 'o',
11495 letters: /[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g
11496}, {
11497 base: 'oi',
11498 letters: /[\u01A3]/g
11499}, {
11500 base: 'ou',
11501 letters: /[\u0223]/g
11502}, {
11503 base: 'oo',
11504 letters: /[\uA74F]/g
11505}, {
11506 base: 'p',
11507 letters: /[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g
11508}, {
11509 base: 'q',
11510 letters: /[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g
11511}, {
11512 base: 'r',
11513 letters: /[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g
11514}, {
11515 base: 's',
11516 letters: /[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g
11517}, {
11518 base: 't',
11519 letters: /[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g
11520}, {
11521 base: 'tz',
11522 letters: /[\uA729]/g
11523}, {
11524 base: 'u',
11525 letters: /[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g
11526}, {
11527 base: 'v',
11528 letters: /[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g
11529}, {
11530 base: 'vy',
11531 letters: /[\uA761]/g
11532}, {
11533 base: 'w',
11534 letters: /[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g
11535}, {
11536 base: 'x',
11537 letters: /[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g
11538}, {
11539 base: 'y',
11540 letters: /[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g
11541}, {
11542 base: 'z',
11543 letters: /[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g
11544}];
11545var stripDiacritics = function stripDiacritics(str) {
11546 for (var i = 0; i < diacritics.length; i++) {
11547 str = str.replace(diacritics[i].letters, diacritics[i].base);
11548 }
11549
11550 return str;
11551};
11552
11553var trimString = function trimString(str) {
11554 return str.replace(/^\s+|\s+$/g, '');
11555};
11556
11557var defaultStringify = function defaultStringify(option) {
11558 return "".concat(option.label, " ").concat(option.value);
11559};
11560
11561var createFilter = function createFilter(config) {
11562 return function (option, rawInput) {
11563 var _ignoreCase$ignoreAcc = _objectSpread({
11564 ignoreCase: true,
11565 ignoreAccents: true,
11566 stringify: defaultStringify,
11567 trim: true,
11568 matchFrom: 'any'
11569 }, config),
11570 ignoreCase = _ignoreCase$ignoreAcc.ignoreCase,
11571 ignoreAccents = _ignoreCase$ignoreAcc.ignoreAccents,
11572 stringify = _ignoreCase$ignoreAcc.stringify,
11573 trim = _ignoreCase$ignoreAcc.trim,
11574 matchFrom = _ignoreCase$ignoreAcc.matchFrom;
11575
11576 var input = trim ? trimString(rawInput) : rawInput;
11577 var candidate = trim ? trimString(stringify(option)) : stringify(option);
11578
11579 if (ignoreCase) {
11580 input = input.toLowerCase();
11581 candidate = candidate.toLowerCase();
11582 }
11583
11584 if (ignoreAccents) {
11585 input = stripDiacritics(input);
11586 candidate = stripDiacritics(candidate);
11587 }
11588
11589 return matchFrom === 'start' ? candidate.substr(0, input.length) === input : candidate.indexOf(input) > -1;
11590 };
11591};
11592
11593var A11yText = function A11yText(props) {
11594 return React__default.createElement("span", _extends$2({
11595 className:
11596 /*#__PURE__*/
11597
11598 /*#__PURE__*/
11599 css({
11600 label: 'a11yText',
11601 zIndex: 9999,
11602 border: 0,
11603 clip: 'rect(1px, 1px, 1px, 1px)',
11604 height: 1,
11605 width: 1,
11606 position: 'absolute',
11607 overflow: 'hidden',
11608 padding: 0,
11609 whiteSpace: 'nowrap',
11610 backgroundColor: 'red',
11611 color: 'blue'
11612 })
11613 }, props));
11614};
11615
11616var DummyInput =
11617/*#__PURE__*/
11618function (_Component) {
11619 _inherits(DummyInput, _Component);
11620
11621 function DummyInput() {
11622 _classCallCheck(this, DummyInput);
11623
11624 return _possibleConstructorReturn(this, _getPrototypeOf(DummyInput).apply(this, arguments));
11625 }
11626
11627 _createClass(DummyInput, [{
11628 key: "render",
11629 value: function render() {
11630 var _this$props = this.props,
11631 inProp = _this$props.in,
11632 out = _this$props.out,
11633 onExited = _this$props.onExited,
11634 appear = _this$props.appear,
11635 enter = _this$props.enter,
11636 exit = _this$props.exit,
11637 innerRef = _this$props.innerRef,
11638 emotion = _this$props.emotion,
11639 props = _objectWithoutProperties(_this$props, ["in", "out", "onExited", "appear", "enter", "exit", "innerRef", "emotion"]);
11640
11641 return React__default.createElement("input", _extends$2({
11642 ref: innerRef
11643 }, props, {
11644 className:
11645 /*#__PURE__*/
11646
11647 /*#__PURE__*/
11648 css({
11649 label: 'dummyInput',
11650 // get rid of any default styles
11651 background: 0,
11652 border: 0,
11653 fontSize: 'inherit',
11654 outline: 0,
11655 padding: 0,
11656 // important! without `width` browsers won't allow focus
11657 width: 1,
11658 // remove cursor on desktop
11659 color: 'transparent',
11660 // remove cursor on mobile whilst maintaining "scroll into view" behaviour
11661 left: -100,
11662 opacity: 0,
11663 position: 'relative',
11664 transform: 'scale(0)'
11665 })
11666 }));
11667 }
11668 }]);
11669
11670 return DummyInput;
11671}(React.Component);
11672
11673var NodeResolver =
11674/*#__PURE__*/
11675function (_Component) {
11676 _inherits(NodeResolver, _Component);
11677
11678 function NodeResolver() {
11679 _classCallCheck(this, NodeResolver);
11680
11681 return _possibleConstructorReturn(this, _getPrototypeOf(NodeResolver).apply(this, arguments));
11682 }
11683
11684 _createClass(NodeResolver, [{
11685 key: "componentDidMount",
11686 value: function componentDidMount() {
11687 this.props.innerRef(reactDom.findDOMNode(this));
11688 }
11689 }, {
11690 key: "componentWillUnmount",
11691 value: function componentWillUnmount() {
11692 this.props.innerRef(null);
11693 }
11694 }, {
11695 key: "render",
11696 value: function render() {
11697 return this.props.children;
11698 }
11699 }]);
11700
11701 return NodeResolver;
11702}(React.Component);
11703
11704var STYLE_KEYS = ['boxSizing', 'height', 'overflow', 'paddingRight', 'position'];
11705var LOCK_STYLES = {
11706 boxSizing: 'border-box',
11707 // account for possible declaration `width: 100%;` on body
11708 overflow: 'hidden',
11709 position: 'relative',
11710 height: '100%'
11711};
11712
11713function preventTouchMove(e) {
11714 e.preventDefault();
11715}
11716function allowTouchMove(e) {
11717 e.stopPropagation();
11718}
11719function preventInertiaScroll() {
11720 var top = this.scrollTop;
11721 var totalScroll = this.scrollHeight;
11722 var currentScroll = top + this.offsetHeight;
11723
11724 if (top === 0) {
11725 this.scrollTop = 1;
11726 } else if (currentScroll === totalScroll) {
11727 this.scrollTop = top - 1;
11728 }
11729} // `ontouchstart` check works on most browsers
11730// `maxTouchPoints` works on IE10/11 and Surface
11731
11732function isTouchDevice() {
11733 return 'ontouchstart' in window || navigator.maxTouchPoints;
11734}
11735
11736var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
11737var activeScrollLocks = 0;
11738
11739var ScrollLock =
11740/*#__PURE__*/
11741function (_Component) {
11742 _inherits(ScrollLock, _Component);
11743
11744 function ScrollLock() {
11745 var _getPrototypeOf2;
11746
11747 var _this;
11748
11749 _classCallCheck(this, ScrollLock);
11750
11751 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
11752 args[_key] = arguments[_key];
11753 }
11754
11755 _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(ScrollLock)).call.apply(_getPrototypeOf2, [this].concat(args)));
11756
11757 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "originalStyles", {});
11758
11759 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "listenerOptions", {
11760 capture: false,
11761 passive: false
11762 });
11763
11764 return _this;
11765 }
11766
11767 _createClass(ScrollLock, [{
11768 key: "componentDidMount",
11769 value: function componentDidMount() {
11770 var _this2 = this;
11771
11772 if (!canUseDOM) return;
11773 var _this$props = this.props,
11774 accountForScrollbars = _this$props.accountForScrollbars,
11775 touchScrollTarget = _this$props.touchScrollTarget;
11776 var target = document.body;
11777 var targetStyle = target && target.style;
11778
11779 if (accountForScrollbars) {
11780 // store any styles already applied to the body
11781 STYLE_KEYS.forEach(function (key) {
11782 var val = targetStyle && targetStyle[key];
11783 _this2.originalStyles[key] = val;
11784 });
11785 } // apply the lock styles and padding if this is the first scroll lock
11786
11787
11788 if (accountForScrollbars && activeScrollLocks < 1) {
11789 var currentPadding = parseInt(this.originalStyles.paddingRight, 10) || 0;
11790 var clientWidth = document.body ? document.body.clientWidth : 0;
11791 var adjustedPadding = window.innerWidth - clientWidth + currentPadding || 0;
11792 Object.keys(LOCK_STYLES).forEach(function (key) {
11793 var val = LOCK_STYLES[key];
11794
11795 if (targetStyle) {
11796 targetStyle[key] = val;
11797 }
11798 });
11799
11800 if (targetStyle) {
11801 targetStyle.paddingRight = "".concat(adjustedPadding, "px");
11802 }
11803 } // account for touch devices
11804
11805
11806 if (target && isTouchDevice()) {
11807 // Mobile Safari ignores { overflow: hidden } declaration on the body.
11808 target.addEventListener('touchmove', preventTouchMove, this.listenerOptions); // Allow scroll on provided target
11809
11810 if (touchScrollTarget) {
11811 touchScrollTarget.addEventListener('touchstart', preventInertiaScroll, this.listenerOptions);
11812 touchScrollTarget.addEventListener('touchmove', allowTouchMove, this.listenerOptions);
11813 }
11814 } // increment active scroll locks
11815
11816
11817 activeScrollLocks += 1;
11818 }
11819 }, {
11820 key: "componentWillUnmount",
11821 value: function componentWillUnmount() {
11822 var _this3 = this;
11823
11824 if (!canUseDOM) return;
11825 var _this$props2 = this.props,
11826 accountForScrollbars = _this$props2.accountForScrollbars,
11827 touchScrollTarget = _this$props2.touchScrollTarget;
11828 var target = document.body;
11829 var targetStyle = target && target.style; // safely decrement active scroll locks
11830
11831 activeScrollLocks = Math.max(activeScrollLocks - 1, 0); // reapply original body styles, if any
11832
11833 if (accountForScrollbars && activeScrollLocks < 1) {
11834 STYLE_KEYS.forEach(function (key) {
11835 var val = _this3.originalStyles[key];
11836
11837 if (targetStyle) {
11838 targetStyle[key] = val;
11839 }
11840 });
11841 } // remove touch listeners
11842
11843
11844 if (target && isTouchDevice()) {
11845 target.removeEventListener('touchmove', preventTouchMove, this.listenerOptions);
11846
11847 if (touchScrollTarget) {
11848 touchScrollTarget.removeEventListener('touchstart', preventInertiaScroll, this.listenerOptions);
11849 touchScrollTarget.removeEventListener('touchmove', allowTouchMove, this.listenerOptions);
11850 }
11851 }
11852 }
11853 }, {
11854 key: "render",
11855 value: function render() {
11856 return null;
11857 }
11858 }]);
11859
11860 return ScrollLock;
11861}(React.Component);
11862
11863_defineProperty$1(ScrollLock, "defaultProps", {
11864 accountForScrollbars: true
11865});
11866
11867// NOTE:
11868// We shouldn't need this after updating to React v16.3.0, which introduces:
11869// - createRef() https://reactjs.org/docs/react-api.html#reactcreateref
11870// - forwardRef() https://reactjs.org/docs/react-api.html#reactforwardref
11871var ScrollBlock =
11872/*#__PURE__*/
11873function (_PureComponent) {
11874 _inherits(ScrollBlock, _PureComponent);
11875
11876 function ScrollBlock() {
11877 var _getPrototypeOf2;
11878
11879 var _this;
11880
11881 _classCallCheck(this, ScrollBlock);
11882
11883 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
11884 args[_key] = arguments[_key];
11885 }
11886
11887 _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(ScrollBlock)).call.apply(_getPrototypeOf2, [this].concat(args)));
11888
11889 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "state", {
11890 touchScrollTarget: null
11891 });
11892
11893 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getScrollTarget", function (ref) {
11894 if (ref === _this.state.touchScrollTarget) return;
11895
11896 _this.setState({
11897 touchScrollTarget: ref
11898 });
11899 });
11900
11901 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "blurSelectInput", function () {
11902 if (document.activeElement) {
11903 document.activeElement.blur();
11904 }
11905 });
11906
11907 return _this;
11908 }
11909
11910 _createClass(ScrollBlock, [{
11911 key: "render",
11912 value: function render() {
11913 var _this$props = this.props,
11914 children = _this$props.children,
11915 isEnabled = _this$props.isEnabled;
11916 var touchScrollTarget = this.state.touchScrollTarget; // bail early if not enabled
11917
11918 if (!isEnabled) return children;
11919 /*
11920 * Div
11921 * ------------------------------
11922 * blocks scrolling on non-body elements behind the menu
11923 * NodeResolver
11924 * ------------------------------
11925 * we need a reference to the scrollable element to "unlock" scroll on
11926 * mobile devices
11927 * ScrollLock
11928 * ------------------------------
11929 * actually does the scroll locking
11930 */
11931
11932 return React__default.createElement("div", null, React__default.createElement("div", {
11933 onClick: this.blurSelectInput,
11934 className:
11935 /*#__PURE__*/
11936
11937 /*#__PURE__*/
11938 css({
11939 position: 'fixed',
11940 left: 0,
11941 bottom: 0,
11942 right: 0,
11943 top: 0
11944 })
11945 }), React__default.createElement(NodeResolver, {
11946 innerRef: this.getScrollTarget
11947 }, children), touchScrollTarget ? React__default.createElement(ScrollLock, {
11948 touchScrollTarget: touchScrollTarget
11949 }) : null);
11950 }
11951 }]);
11952
11953 return ScrollBlock;
11954}(React.PureComponent);
11955
11956var ScrollCaptor =
11957/*#__PURE__*/
11958function (_Component) {
11959 _inherits(ScrollCaptor, _Component);
11960
11961 function ScrollCaptor() {
11962 var _getPrototypeOf2;
11963
11964 var _this;
11965
11966 _classCallCheck(this, ScrollCaptor);
11967
11968 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
11969 args[_key] = arguments[_key];
11970 }
11971
11972 _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(ScrollCaptor)).call.apply(_getPrototypeOf2, [this].concat(args)));
11973
11974 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "isBottom", false);
11975
11976 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "isTop", false);
11977
11978 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "scrollTarget", void 0);
11979
11980 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "touchStart", void 0);
11981
11982 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "cancelScroll", function (event) {
11983 event.preventDefault();
11984 event.stopPropagation();
11985 });
11986
11987 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "handleEventDelta", function (event, delta) {
11988 var _this$props = _this.props,
11989 onBottomArrive = _this$props.onBottomArrive,
11990 onBottomLeave = _this$props.onBottomLeave,
11991 onTopArrive = _this$props.onTopArrive,
11992 onTopLeave = _this$props.onTopLeave;
11993 var _this$scrollTarget = _this.scrollTarget,
11994 scrollTop = _this$scrollTarget.scrollTop,
11995 scrollHeight = _this$scrollTarget.scrollHeight,
11996 clientHeight = _this$scrollTarget.clientHeight;
11997 var target = _this.scrollTarget;
11998 var isDeltaPositive = delta > 0;
11999 var availableScroll = scrollHeight - clientHeight - scrollTop;
12000 var shouldCancelScroll = false; // reset bottom/top flags
12001
12002 if (availableScroll > delta && _this.isBottom) {
12003 if (onBottomLeave) onBottomLeave(event);
12004 _this.isBottom = false;
12005 }
12006
12007 if (isDeltaPositive && _this.isTop) {
12008 if (onTopLeave) onTopLeave(event);
12009 _this.isTop = false;
12010 } // bottom limit
12011
12012
12013 if (isDeltaPositive && delta > availableScroll) {
12014 if (onBottomArrive && !_this.isBottom) {
12015 onBottomArrive(event);
12016 }
12017
12018 target.scrollTop = scrollHeight;
12019 shouldCancelScroll = true;
12020 _this.isBottom = true; // top limit
12021 } else if (!isDeltaPositive && -delta > scrollTop) {
12022 if (onTopArrive && !_this.isTop) {
12023 onTopArrive(event);
12024 }
12025
12026 target.scrollTop = 0;
12027 shouldCancelScroll = true;
12028 _this.isTop = true;
12029 } // cancel scroll
12030
12031
12032 if (shouldCancelScroll) {
12033 _this.cancelScroll(event);
12034 }
12035 });
12036
12037 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onWheel", function (event) {
12038 _this.handleEventDelta(event, event.deltaY);
12039 });
12040
12041 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onTouchStart", function (event) {
12042 // set touch start so we can calculate touchmove delta
12043 _this.touchStart = event.changedTouches[0].clientY;
12044 });
12045
12046 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onTouchMove", function (event) {
12047 var deltaY = _this.touchStart - event.changedTouches[0].clientY;
12048
12049 _this.handleEventDelta(event, deltaY);
12050 });
12051
12052 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getScrollTarget", function (ref) {
12053 _this.scrollTarget = ref;
12054 });
12055
12056 return _this;
12057 }
12058
12059 _createClass(ScrollCaptor, [{
12060 key: "componentDidMount",
12061 value: function componentDidMount() {
12062 this.startListening(this.scrollTarget);
12063 }
12064 }, {
12065 key: "componentWillUnmount",
12066 value: function componentWillUnmount() {
12067 this.stopListening(this.scrollTarget);
12068 }
12069 }, {
12070 key: "startListening",
12071 value: function startListening(el) {
12072 // bail early if no scroll available
12073 if (!el) return;
12074 if (el.scrollHeight <= el.clientHeight) return; // all the if statements are to appease Flow 😢
12075
12076 if (typeof el.addEventListener === 'function') {
12077 el.addEventListener('wheel', this.onWheel, false);
12078 }
12079
12080 if (typeof el.addEventListener === 'function') {
12081 el.addEventListener('touchstart', this.onTouchStart, false);
12082 }
12083
12084 if (typeof el.addEventListener === 'function') {
12085 el.addEventListener('touchmove', this.onTouchMove, false);
12086 }
12087 }
12088 }, {
12089 key: "stopListening",
12090 value: function stopListening(el) {
12091 // bail early if no scroll available
12092 if (el.scrollHeight <= el.clientHeight) return; // all the if statements are to appease Flow 😢
12093
12094 if (typeof el.removeEventListener === 'function') {
12095 el.removeEventListener('wheel', this.onWheel, false);
12096 }
12097
12098 if (typeof el.removeEventListener === 'function') {
12099 el.removeEventListener('touchstart', this.onTouchStart, false);
12100 }
12101
12102 if (typeof el.removeEventListener === 'function') {
12103 el.removeEventListener('touchmove', this.onTouchMove, false);
12104 }
12105 }
12106 }, {
12107 key: "render",
12108 value: function render() {
12109 return React__default.createElement(NodeResolver, {
12110 innerRef: this.getScrollTarget
12111 }, this.props.children);
12112 }
12113 }]);
12114
12115 return ScrollCaptor;
12116}(React.Component);
12117
12118var ScrollCaptorSwitch =
12119/*#__PURE__*/
12120function (_Component2) {
12121 _inherits(ScrollCaptorSwitch, _Component2);
12122
12123 function ScrollCaptorSwitch() {
12124 _classCallCheck(this, ScrollCaptorSwitch);
12125
12126 return _possibleConstructorReturn(this, _getPrototypeOf(ScrollCaptorSwitch).apply(this, arguments));
12127 }
12128
12129 _createClass(ScrollCaptorSwitch, [{
12130 key: "render",
12131 value: function render() {
12132 var _this$props2 = this.props,
12133 isEnabled = _this$props2.isEnabled,
12134 props = _objectWithoutProperties(_this$props2, ["isEnabled"]);
12135
12136 return isEnabled ? React__default.createElement(ScrollCaptor, props) : this.props.children;
12137 }
12138 }]);
12139
12140 return ScrollCaptorSwitch;
12141}(React.Component);
12142
12143_defineProperty$1(ScrollCaptorSwitch, "defaultProps", {
12144 isEnabled: true
12145});
12146
12147var instructionsAriaMessage = function instructionsAriaMessage(event) {
12148 var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12149 var isSearchable = context.isSearchable,
12150 isMulti = context.isMulti,
12151 label = context.label,
12152 isDisabled = context.isDisabled;
12153
12154 switch (event) {
12155 case 'menu':
12156 return "Use Up and Down to choose options".concat(isDisabled ? '' : ', press Enter to select the currently focused option', ", press Escape to exit the menu, press Tab to select the option and exit the menu.");
12157
12158 case 'input':
12159 return "".concat(label ? label : 'Select', " is focused ").concat(isSearchable ? ',type to refine list' : '', ", press Down to open the menu, ").concat(isMulti ? ' press left to focus selected values' : '');
12160
12161 case 'value':
12162 return 'Use left and right to toggle between focused values, press Backspace to remove the currently focused value';
12163 }
12164};
12165var valueEventAriaMessage = function valueEventAriaMessage(event, context) {
12166 var value = context.value,
12167 isDisabled = context.isDisabled;
12168 if (!value) return;
12169
12170 switch (event) {
12171 case 'deselect-option':
12172 case 'pop-value':
12173 case 'remove-value':
12174 return "option ".concat(value, ", deselected.");
12175
12176 case 'select-option':
12177 return isDisabled ? "option ".concat(value, " is disabled. Select another option.") : "option ".concat(value, ", selected.");
12178 }
12179};
12180var valueFocusAriaMessage = function valueFocusAriaMessage(_ref) {
12181 var focusedValue = _ref.focusedValue,
12182 getOptionLabel = _ref.getOptionLabel,
12183 selectValue = _ref.selectValue;
12184 return "value ".concat(getOptionLabel(focusedValue), " focused, ").concat(selectValue.indexOf(focusedValue) + 1, " of ").concat(selectValue.length, ".");
12185};
12186var optionFocusAriaMessage = function optionFocusAriaMessage(_ref2) {
12187 var focusedOption = _ref2.focusedOption,
12188 getOptionLabel = _ref2.getOptionLabel,
12189 options = _ref2.options;
12190 return "option ".concat(getOptionLabel(focusedOption), " focused").concat(focusedOption.isDisabled ? ' disabled' : '', ", ").concat(options.indexOf(focusedOption) + 1, " of ").concat(options.length, ".");
12191};
12192var resultsAriaMessage = function resultsAriaMessage(_ref3) {
12193 var inputValue = _ref3.inputValue,
12194 screenReaderMessage = _ref3.screenReaderMessage;
12195 return "".concat(screenReaderMessage).concat(inputValue ? ' for search term ' + inputValue : '', ".");
12196};
12197
12198var formatGroupLabel = function formatGroupLabel(group) {
12199 return group.label;
12200};
12201var getOptionLabel = function getOptionLabel(option) {
12202 return option.label;
12203};
12204var getOptionValue = function getOptionValue(option) {
12205 return option.value;
12206};
12207var isOptionDisabled = function isOptionDisabled(option) {
12208 return !!option.isDisabled;
12209};
12210
12211var containerCSS = function containerCSS(_ref) {
12212 var isDisabled = _ref.isDisabled,
12213 isRtl = _ref.isRtl;
12214 return {
12215 label: 'container',
12216 direction: isRtl ? 'rtl' : null,
12217 pointerEvents: isDisabled ? 'none' : null,
12218 // cancel mouse events when disabled
12219 position: 'relative'
12220 };
12221};
12222var SelectContainer = function SelectContainer(props) {
12223 var children = props.children,
12224 className = props.className,
12225 cx$$1 = props.cx,
12226 getStyles = props.getStyles,
12227 innerProps = props.innerProps,
12228 isDisabled = props.isDisabled,
12229 isRtl = props.isRtl;
12230 return React__default.createElement("div", _extends$2({
12231 className: cx$$1(
12232 /*#__PURE__*/
12233 css(getStyles('container', props)), {
12234 '--is-disabled': isDisabled,
12235 '--is-rtl': isRtl
12236 }, className)
12237 }, innerProps), children);
12238}; // ==============================
12239// Value Container
12240// ==============================
12241
12242var valueContainerCSS = function valueContainerCSS(_ref2) {
12243 var spacing = _ref2.theme.spacing;
12244 return {
12245 alignItems: 'center',
12246 display: 'flex',
12247 flex: 1,
12248 flexWrap: 'wrap',
12249 padding: "".concat(spacing.baseUnit / 2, "px ").concat(spacing.baseUnit * 2, "px"),
12250 WebkitOverflowScrolling: 'touch',
12251 position: 'relative',
12252 overflow: 'hidden'
12253 };
12254};
12255var ValueContainer =
12256/*#__PURE__*/
12257function (_Component) {
12258 _inherits(ValueContainer, _Component);
12259
12260 function ValueContainer() {
12261 _classCallCheck(this, ValueContainer);
12262
12263 return _possibleConstructorReturn(this, _getPrototypeOf(ValueContainer).apply(this, arguments));
12264 }
12265
12266 _createClass(ValueContainer, [{
12267 key: "render",
12268 value: function render() {
12269 var _this$props = this.props,
12270 children = _this$props.children,
12271 className = _this$props.className,
12272 cx$$1 = _this$props.cx,
12273 isMulti = _this$props.isMulti,
12274 getStyles = _this$props.getStyles,
12275 hasValue = _this$props.hasValue;
12276 return React__default.createElement("div", {
12277 className: cx$$1(
12278 /*#__PURE__*/
12279 css(getStyles('valueContainer', this.props)), {
12280 'value-container': true,
12281 'value-container--is-multi': isMulti,
12282 'value-container--has-value': hasValue
12283 }, className)
12284 }, children);
12285 }
12286 }]);
12287
12288 return ValueContainer;
12289}(React.Component); // ==============================
12290// Indicator Container
12291// ==============================
12292
12293var indicatorsContainerCSS = function indicatorsContainerCSS() {
12294 return {
12295 alignItems: 'center',
12296 alignSelf: 'stretch',
12297 display: 'flex',
12298 flexShrink: 0
12299 };
12300};
12301var IndicatorsContainer = function IndicatorsContainer(props) {
12302 var children = props.children,
12303 className = props.className,
12304 cx$$1 = props.cx,
12305 getStyles = props.getStyles;
12306 return React__default.createElement("div", {
12307 className: cx$$1(
12308 /*#__PURE__*/
12309 css(getStyles('indicatorsContainer', props)), {
12310 'indicators': true
12311 }, className)
12312 }, children);
12313};
12314
12315// ==============================
12316// Dropdown & Clear Icons
12317// ==============================
12318var Svg = function Svg(_ref) {
12319 var size = _ref.size,
12320 props = _objectWithoutProperties(_ref, ["size"]);
12321
12322 return React__default.createElement("svg", _extends$2({
12323 height: size,
12324 width: size,
12325 viewBox: "0 0 20 20",
12326 "aria-hidden": "true",
12327 focusable: "false",
12328 className:
12329 /*#__PURE__*/
12330
12331 /*#__PURE__*/
12332 css({
12333 display: 'inline-block',
12334 fill: 'currentColor',
12335 lineHeight: 1,
12336 stroke: 'currentColor',
12337 strokeWidth: 0
12338 })
12339 }, props));
12340};
12341
12342var CrossIcon = function CrossIcon(props) {
12343 return React__default.createElement(Svg, _extends$2({
12344 size: 20
12345 }, props), React__default.createElement("path", {
12346 d: "M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"
12347 }));
12348};
12349var DownChevron = function DownChevron(props) {
12350 return React__default.createElement(Svg, _extends$2({
12351 size: 20
12352 }, props), React__default.createElement("path", {
12353 d: "M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"
12354 }));
12355}; // ==============================
12356// Dropdown & Clear Buttons
12357// ==============================
12358
12359var baseCSS = function baseCSS(_ref2) {
12360 var isFocused = _ref2.isFocused,
12361 _ref2$theme = _ref2.theme,
12362 baseUnit = _ref2$theme.spacing.baseUnit,
12363 colors = _ref2$theme.colors;
12364 return {
12365 label: 'indicatorContainer',
12366 color: isFocused ? colors.neutral60 : colors.neutral20,
12367 display: 'flex',
12368 padding: baseUnit * 2,
12369 transition: 'color 150ms',
12370 ':hover': {
12371 color: isFocused ? colors.neutral80 : colors.neutral40
12372 }
12373 };
12374};
12375
12376var dropdownIndicatorCSS = baseCSS;
12377var DropdownIndicator = function DropdownIndicator(props) {
12378 var children = props.children,
12379 className = props.className,
12380 cx$$1 = props.cx,
12381 getStyles = props.getStyles,
12382 innerProps = props.innerProps;
12383 return React__default.createElement("div", _extends$2({}, innerProps, {
12384 className: cx$$1(
12385 /*#__PURE__*/
12386 css(getStyles('dropdownIndicator', props)), {
12387 'indicator': true,
12388 'dropdown-indicator': true
12389 }, className)
12390 }), children || React__default.createElement(DownChevron, null));
12391};
12392var clearIndicatorCSS = baseCSS;
12393var ClearIndicator = function ClearIndicator(props) {
12394 var children = props.children,
12395 className = props.className,
12396 cx$$1 = props.cx,
12397 getStyles = props.getStyles,
12398 innerProps = props.innerProps;
12399 return React__default.createElement("div", _extends$2({}, innerProps, {
12400 className: cx$$1(
12401 /*#__PURE__*/
12402 css(getStyles('clearIndicator', props)), {
12403 'indicator': true,
12404 'clear-indicator': true
12405 }, className)
12406 }), children || React__default.createElement(CrossIcon, null));
12407}; // ==============================
12408// Separator
12409// ==============================
12410
12411var indicatorSeparatorCSS = function indicatorSeparatorCSS(_ref3) {
12412 var isDisabled = _ref3.isDisabled,
12413 _ref3$theme = _ref3.theme,
12414 baseUnit = _ref3$theme.spacing.baseUnit,
12415 colors = _ref3$theme.colors;
12416 return {
12417 label: 'indicatorSeparator',
12418 alignSelf: 'stretch',
12419 backgroundColor: isDisabled ? colors.neutral10 : colors.neutral20,
12420 marginBottom: baseUnit * 2,
12421 marginTop: baseUnit * 2,
12422 width: 1
12423 };
12424};
12425var IndicatorSeparator = function IndicatorSeparator(props) {
12426 var className = props.className,
12427 cx$$1 = props.cx,
12428 getStyles = props.getStyles,
12429 innerProps = props.innerProps;
12430 return React__default.createElement("span", _extends$2({}, innerProps, {
12431 className: cx$$1(
12432 /*#__PURE__*/
12433 css(getStyles('indicatorSeparator', props)), {
12434 'indicator-separator': true
12435 }, className)
12436 }));
12437}; // ==============================
12438// Loading
12439// ==============================
12440
12441var keyframesName = 'react-select-loading-indicator';
12442var keyframesInjected = false;
12443var loadingIndicatorCSS = function loadingIndicatorCSS(_ref4) {
12444 var isFocused = _ref4.isFocused,
12445 size = _ref4.size,
12446 _ref4$theme = _ref4.theme,
12447 colors = _ref4$theme.colors,
12448 baseUnit = _ref4$theme.spacing.baseUnit;
12449 return {
12450 label: 'loadingIndicator',
12451 color: isFocused ? colors.neutral60 : colors.neutral20,
12452 display: 'flex',
12453 padding: baseUnit * 2,
12454 transition: 'color 150ms',
12455 alignSelf: 'center',
12456 fontSize: size,
12457 lineHeight: 1,
12458 marginRight: size,
12459 textAlign: 'center',
12460 verticalAlign: 'middle'
12461 };
12462};
12463
12464var LoadingDot = function LoadingDot(_ref5) {
12465 var color = _ref5.color,
12466 delay = _ref5.delay,
12467 offset = _ref5.offset;
12468 return React__default.createElement("span", {
12469 className:
12470 /*#__PURE__*/
12471
12472 /*#__PURE__*/
12473 css({
12474 animationDuration: '1s',
12475 animationDelay: "".concat(delay, "ms"),
12476 animationIterationCount: 'infinite',
12477 animationName: keyframesName,
12478 animationTimingFunction: 'ease-in-out',
12479 backgroundColor: color,
12480 borderRadius: '1em',
12481 display: 'inline-block',
12482 marginLeft: offset ? '1em' : null,
12483 height: '1em',
12484 verticalAlign: 'top',
12485 width: '1em'
12486 })
12487 });
12488};
12489
12490var LoadingIndicator = function LoadingIndicator(props) {
12491 var className = props.className,
12492 cx$$1 = props.cx,
12493 getStyles = props.getStyles,
12494 innerProps = props.innerProps,
12495 isFocused = props.isFocused,
12496 isRtl = props.isRtl,
12497 colors = props.theme.colors;
12498 var color = isFocused ? colors.neutral80 : colors.neutral20;
12499
12500 if (!keyframesInjected) {
12501 // eslint-disable-next-line no-unused-expressions
12502 injectGlobal("@keyframes ", keyframesName, "{0%,80%,100%{opacity:0;}40%{opacity:1;}};");
12503 keyframesInjected = true;
12504 }
12505
12506 return React__default.createElement("div", _extends$2({}, innerProps, {
12507 className: cx$$1(
12508 /*#__PURE__*/
12509 css(getStyles('loadingIndicator', props)), {
12510 'indicator': true,
12511 'loading-indicator': true
12512 }, className)
12513 }), React__default.createElement(LoadingDot, {
12514 color: color,
12515 delay: 0,
12516 offset: isRtl
12517 }), React__default.createElement(LoadingDot, {
12518 color: color,
12519 delay: 160,
12520 offset: true
12521 }), React__default.createElement(LoadingDot, {
12522 color: color,
12523 delay: 320,
12524 offset: !isRtl
12525 }));
12526};
12527LoadingIndicator.defaultProps = {
12528 size: 4
12529};
12530
12531var css$1 = function css$$1(_ref) {
12532 var isDisabled = _ref.isDisabled,
12533 isFocused = _ref.isFocused,
12534 _ref$theme = _ref.theme,
12535 colors = _ref$theme.colors,
12536 borderRadius = _ref$theme.borderRadius,
12537 spacing = _ref$theme.spacing;
12538 return {
12539 label: 'control',
12540 alignItems: 'center',
12541 backgroundColor: isDisabled ? colors.neutral5 : colors.neutral0,
12542 borderColor: isDisabled ? colors.neutral10 : isFocused ? colors.primary : colors.neutral20,
12543 borderRadius: borderRadius,
12544 borderStyle: 'solid',
12545 borderWidth: 1,
12546 boxShadow: isFocused ? "0 0 0 1px ".concat(colors.primary) : null,
12547 cursor: 'default',
12548 display: 'flex',
12549 flexWrap: 'wrap',
12550 justifyContent: 'space-between',
12551 minHeight: spacing.controlHeight,
12552 outline: '0 !important',
12553 position: 'relative',
12554 transition: 'all 100ms',
12555 '&:hover': {
12556 borderColor: isFocused ? colors.primary : colors.neutral30
12557 }
12558 };
12559};
12560
12561var Control = function Control(props) {
12562 var children = props.children,
12563 cx$$1 = props.cx,
12564 getStyles = props.getStyles,
12565 className = props.className,
12566 isDisabled = props.isDisabled,
12567 isFocused = props.isFocused,
12568 innerRef = props.innerRef,
12569 innerProps = props.innerProps,
12570 menuIsOpen = props.menuIsOpen;
12571 return React__default.createElement("div", _extends$2({
12572 ref: innerRef,
12573 className: cx$$1(
12574 /*#__PURE__*/
12575 css(getStyles('control', props)), {
12576 'control': true,
12577 'control--is-disabled': isDisabled,
12578 'control--is-focused': isFocused,
12579 'control--menu-is-open': menuIsOpen
12580 }, className)
12581 }, innerProps), children);
12582};
12583
12584var groupCSS = function groupCSS(_ref) {
12585 var spacing = _ref.theme.spacing;
12586 return {
12587 paddingBottom: spacing.baseUnit * 2,
12588 paddingTop: spacing.baseUnit * 2
12589 };
12590};
12591
12592var Group = function Group(props) {
12593 var children = props.children,
12594 className = props.className,
12595 cx$$1 = props.cx,
12596 getStyles = props.getStyles,
12597 Heading = props.Heading,
12598 headingProps = props.headingProps,
12599 label = props.label,
12600 theme = props.theme,
12601 selectProps = props.selectProps;
12602 return React__default.createElement("div", {
12603 className: cx$$1(
12604 /*#__PURE__*/
12605 css(getStyles('group', props)), {
12606 'group': true
12607 }, className)
12608 }, React__default.createElement(Heading, _extends$2({}, headingProps, {
12609 selectProps: selectProps,
12610 theme: theme,
12611 getStyles: getStyles,
12612 cx: cx$$1
12613 }), label), React__default.createElement("div", null, children));
12614};
12615
12616var groupHeadingCSS = function groupHeadingCSS(_ref2) {
12617 var spacing = _ref2.theme.spacing;
12618 return {
12619 label: 'group',
12620 color: '#999',
12621 cursor: 'default',
12622 display: 'block',
12623 fontSize: '75%',
12624 fontWeight: '500',
12625 marginBottom: '0.25em',
12626 paddingLeft: spacing.baseUnit * 3,
12627 paddingRight: spacing.baseUnit * 3,
12628 textTransform: 'uppercase'
12629 };
12630};
12631var GroupHeading = function GroupHeading(props) {
12632 var className = props.className,
12633 cx$$1 = props.cx,
12634 getStyles = props.getStyles,
12635 theme = props.theme,
12636 selectProps = props.selectProps,
12637 cleanProps = _objectWithoutProperties(props, ["className", "cx", "getStyles", "theme", "selectProps"]);
12638
12639 return React__default.createElement("div", _extends$2({
12640 className: cx$$1(
12641 /*#__PURE__*/
12642 css(getStyles('groupHeading', _objectSpread({
12643 theme: theme
12644 }, cleanProps))), {
12645 'group-heading': true
12646 }, className)
12647 }, cleanProps));
12648};
12649
12650var inputCSS = function inputCSS(_ref) {
12651 var isDisabled = _ref.isDisabled,
12652 _ref$theme = _ref.theme,
12653 spacing = _ref$theme.spacing,
12654 colors = _ref$theme.colors;
12655 return {
12656 margin: spacing.baseUnit / 2,
12657 paddingBottom: spacing.baseUnit / 2,
12658 paddingTop: spacing.baseUnit / 2,
12659 visibility: isDisabled ? 'hidden' : 'visible',
12660 color: colors.neutral80
12661 };
12662};
12663
12664var inputStyle = function inputStyle(isHidden) {
12665 return {
12666 label: 'input',
12667 background: 0,
12668 border: 0,
12669 fontSize: 'inherit',
12670 opacity: isHidden ? 0 : 1,
12671 outline: 0,
12672 padding: 0,
12673 color: 'inherit'
12674 };
12675};
12676
12677var Input$2 = function Input(_ref2) {
12678 var className = _ref2.className,
12679 cx$$1 = _ref2.cx,
12680 getStyles = _ref2.getStyles,
12681 innerRef = _ref2.innerRef,
12682 isHidden = _ref2.isHidden,
12683 isDisabled = _ref2.isDisabled,
12684 theme = _ref2.theme,
12685 selectProps = _ref2.selectProps,
12686 props = _objectWithoutProperties(_ref2, ["className", "cx", "getStyles", "innerRef", "isHidden", "isDisabled", "theme", "selectProps"]);
12687
12688 return React__default.createElement("div", {
12689 className:
12690 /*#__PURE__*/
12691
12692 /*#__PURE__*/
12693 css(getStyles('input', _objectSpread({
12694 theme: theme
12695 }, props)))
12696 }, React__default.createElement(AutosizeInput, _extends$2({
12697 className: cx$$1(null, {
12698 'input': true
12699 }, className),
12700 inputRef: innerRef,
12701 inputStyle: inputStyle(isHidden),
12702 disabled: isDisabled
12703 }, props)));
12704};
12705
12706var multiValueCSS = function multiValueCSS(_ref) {
12707 var _ref$theme = _ref.theme,
12708 spacing = _ref$theme.spacing,
12709 borderRadius = _ref$theme.borderRadius,
12710 colors = _ref$theme.colors;
12711 return {
12712 label: 'multiValue',
12713 backgroundColor: colors.neutral10,
12714 borderRadius: borderRadius / 2,
12715 display: 'flex',
12716 margin: spacing.baseUnit / 2,
12717 minWidth: 0 // resolves flex/text-overflow bug
12718
12719 };
12720};
12721var multiValueLabelCSS = function multiValueLabelCSS(_ref2) {
12722 var _ref2$theme = _ref2.theme,
12723 borderRadius = _ref2$theme.borderRadius,
12724 colors = _ref2$theme.colors,
12725 cropWithEllipsis = _ref2.cropWithEllipsis;
12726 return {
12727 borderRadius: borderRadius / 2,
12728 color: colors.neutral80,
12729 fontSize: '85%',
12730 overflow: 'hidden',
12731 padding: 3,
12732 paddingLeft: 6,
12733 textOverflow: cropWithEllipsis ? 'ellipsis' : null,
12734 whiteSpace: 'nowrap'
12735 };
12736};
12737var multiValueRemoveCSS = function multiValueRemoveCSS(_ref3) {
12738 var _ref3$theme = _ref3.theme,
12739 spacing = _ref3$theme.spacing,
12740 borderRadius = _ref3$theme.borderRadius,
12741 colors = _ref3$theme.colors,
12742 isFocused = _ref3.isFocused;
12743 return {
12744 alignItems: 'center',
12745 borderRadius: borderRadius / 2,
12746 backgroundColor: isFocused && colors.dangerLight,
12747 display: 'flex',
12748 paddingLeft: spacing.baseUnit,
12749 paddingRight: spacing.baseUnit,
12750 ':hover': {
12751 backgroundColor: colors.dangerLight,
12752 color: colors.danger
12753 }
12754 };
12755};
12756var MultiValueGeneric = function MultiValueGeneric(_ref4) {
12757 var children = _ref4.children,
12758 innerProps = _ref4.innerProps;
12759 return React__default.createElement("div", innerProps, children);
12760};
12761var MultiValueContainer = MultiValueGeneric;
12762var MultiValueLabel = MultiValueGeneric;
12763var MultiValueRemove =
12764/*#__PURE__*/
12765function (_Component) {
12766 _inherits(MultiValueRemove, _Component);
12767
12768 function MultiValueRemove() {
12769 _classCallCheck(this, MultiValueRemove);
12770
12771 return _possibleConstructorReturn(this, _getPrototypeOf(MultiValueRemove).apply(this, arguments));
12772 }
12773
12774 _createClass(MultiValueRemove, [{
12775 key: "render",
12776 value: function render() {
12777 var _this$props = this.props,
12778 children = _this$props.children,
12779 innerProps = _this$props.innerProps;
12780 return React__default.createElement("div", innerProps, children || React__default.createElement(CrossIcon, {
12781 size: 14
12782 }));
12783 }
12784 }]);
12785
12786 return MultiValueRemove;
12787}(React.Component);
12788
12789var MultiValue =
12790/*#__PURE__*/
12791function (_Component2) {
12792 _inherits(MultiValue, _Component2);
12793
12794 function MultiValue() {
12795 _classCallCheck(this, MultiValue);
12796
12797 return _possibleConstructorReturn(this, _getPrototypeOf(MultiValue).apply(this, arguments));
12798 }
12799
12800 _createClass(MultiValue, [{
12801 key: "render",
12802 value: function render() {
12803 var _this$props2 = this.props,
12804 children = _this$props2.children,
12805 className = _this$props2.className,
12806 components = _this$props2.components,
12807 cx$$1 = _this$props2.cx,
12808 data = _this$props2.data,
12809 getStyles = _this$props2.getStyles,
12810 innerProps = _this$props2.innerProps,
12811 isDisabled = _this$props2.isDisabled,
12812 removeProps = _this$props2.removeProps,
12813 selectProps = _this$props2.selectProps;
12814 var Container = components.Container,
12815 Label = components.Label,
12816 Remove = components.Remove;
12817
12818 var containerInnerProps = _objectSpread({
12819 className: cx$$1(
12820 /*#__PURE__*/
12821 css(getStyles('multiValue', this.props)), {
12822 'multi-value': true,
12823 'multi-value--is-disabled': isDisabled
12824 }, className)
12825 }, innerProps);
12826
12827 var labelInnerProps = {
12828 className: cx$$1(
12829 /*#__PURE__*/
12830 css(getStyles('multiValueLabel', this.props)), {
12831 'multi-value__label': true
12832 }, className)
12833 };
12834
12835 var removeInnerProps = _objectSpread({
12836 className: cx$$1(
12837 /*#__PURE__*/
12838 css(getStyles('multiValueRemove', this.props)), {
12839 'multi-value__remove': true
12840 }, className)
12841 }, removeProps);
12842
12843 return React__default.createElement(Container, {
12844 data: data,
12845 innerProps: containerInnerProps,
12846 selectProps: selectProps
12847 }, React__default.createElement(Label, {
12848 data: data,
12849 innerProps: labelInnerProps,
12850 selectProps: selectProps
12851 }, children), React__default.createElement(Remove, {
12852 data: data,
12853 innerProps: removeInnerProps,
12854 selectProps: selectProps
12855 }));
12856 }
12857 }]);
12858
12859 return MultiValue;
12860}(React.Component);
12861
12862_defineProperty$1(MultiValue, "defaultProps", {
12863 cropWithEllipsis: true
12864});
12865
12866var optionCSS = function optionCSS(_ref) {
12867 var isDisabled = _ref.isDisabled,
12868 isFocused = _ref.isFocused,
12869 isSelected = _ref.isSelected,
12870 _ref$theme = _ref.theme,
12871 spacing = _ref$theme.spacing,
12872 colors = _ref$theme.colors;
12873 return {
12874 label: 'option',
12875 backgroundColor: isSelected ? colors.primary : isFocused ? colors.primary25 : 'transparent',
12876 color: isDisabled ? colors.neutral20 : isSelected ? colors.neutral0 : 'inherit',
12877 cursor: 'default',
12878 display: 'block',
12879 fontSize: 'inherit',
12880 padding: "".concat(spacing.baseUnit * 2, "px ").concat(spacing.baseUnit * 3, "px"),
12881 width: '100%',
12882 userSelect: 'none',
12883 WebkitTapHighlightColor: 'rgba(0, 0, 0, 0)',
12884 // provide some affordance on touch devices
12885 ':active': {
12886 backgroundColor: isSelected ? colors.primary : colors.primary50
12887 }
12888 };
12889};
12890
12891var Option = function Option(props) {
12892 var children = props.children,
12893 className = props.className,
12894 cx$$1 = props.cx,
12895 getStyles = props.getStyles,
12896 isDisabled = props.isDisabled,
12897 isFocused = props.isFocused,
12898 isSelected = props.isSelected,
12899 innerRef = props.innerRef,
12900 innerProps = props.innerProps;
12901 return React__default.createElement("div", _extends$2({
12902 ref: innerRef,
12903 className: cx$$1(
12904 /*#__PURE__*/
12905 css(getStyles('option', props)), {
12906 'option': true,
12907 'option--is-disabled': isDisabled,
12908 'option--is-focused': isFocused,
12909 'option--is-selected': isSelected
12910 }, className)
12911 }, innerProps), children);
12912};
12913
12914var placeholderCSS = function placeholderCSS(_ref) {
12915 var _ref$theme = _ref.theme,
12916 spacing = _ref$theme.spacing,
12917 colors = _ref$theme.colors;
12918 return {
12919 label: 'placeholder',
12920 color: colors.neutral50,
12921 marginLeft: spacing.baseUnit / 2,
12922 marginRight: spacing.baseUnit / 2,
12923 position: 'absolute',
12924 top: '50%',
12925 transform: 'translateY(-50%)'
12926 };
12927};
12928
12929var Placeholder = function Placeholder(props) {
12930 var children = props.children,
12931 className = props.className,
12932 cx$$1 = props.cx,
12933 getStyles = props.getStyles,
12934 innerProps = props.innerProps;
12935 return React__default.createElement("div", _extends$2({
12936 className: cx$$1(
12937 /*#__PURE__*/
12938 css(getStyles('placeholder', props)), {
12939 'placeholder': true
12940 }, className)
12941 }, innerProps), children);
12942};
12943
12944var css$2 = function css$$1(_ref) {
12945 var isDisabled = _ref.isDisabled,
12946 _ref$theme = _ref.theme,
12947 spacing = _ref$theme.spacing,
12948 colors = _ref$theme.colors;
12949 return {
12950 label: 'singleValue',
12951 color: isDisabled ? colors.neutral40 : colors.neutral80,
12952 marginLeft: spacing.baseUnit / 2,
12953 marginRight: spacing.baseUnit / 2,
12954 maxWidth: "calc(100% - ".concat(spacing.baseUnit * 2, "px)"),
12955 overflow: 'hidden',
12956 position: 'absolute',
12957 textOverflow: 'ellipsis',
12958 whiteSpace: 'nowrap',
12959 top: '50%',
12960 transform: 'translateY(-50%)'
12961 };
12962};
12963
12964var SingleValue = function SingleValue(props) {
12965 var children = props.children,
12966 className = props.className,
12967 cx$$1 = props.cx,
12968 getStyles = props.getStyles,
12969 isDisabled = props.isDisabled,
12970 innerProps = props.innerProps;
12971 return React__default.createElement("div", _extends$2({
12972 className: cx$$1(
12973 /*#__PURE__*/
12974 css(getStyles('singleValue', props)), {
12975 'single-value': true,
12976 'single-value--is-disabled': isDisabled
12977 }, className)
12978 }, innerProps), children);
12979};
12980
12981var components = {
12982 ClearIndicator: ClearIndicator,
12983 Control: Control,
12984 DropdownIndicator: DropdownIndicator,
12985 DownChevron: DownChevron,
12986 CrossIcon: CrossIcon,
12987 Group: Group,
12988 GroupHeading: GroupHeading,
12989 IndicatorsContainer: IndicatorsContainer,
12990 IndicatorSeparator: IndicatorSeparator,
12991 Input: Input$2,
12992 LoadingIndicator: LoadingIndicator,
12993 Menu: Menu,
12994 MenuList: MenuList,
12995 MenuPortal: MenuPortal,
12996 LoadingMessage: LoadingMessage,
12997 NoOptionsMessage: NoOptionsMessage,
12998 MultiValue: MultiValue,
12999 MultiValueContainer: MultiValueContainer,
13000 MultiValueLabel: MultiValueLabel,
13001 MultiValueRemove: MultiValueRemove,
13002 Option: Option,
13003 Placeholder: Placeholder,
13004 SelectContainer: SelectContainer,
13005 SingleValue: SingleValue,
13006 ValueContainer: ValueContainer
13007};
13008var defaultComponents = function defaultComponents(props) {
13009 return _objectSpread({}, components, props.components);
13010};
13011
13012var defaultStyles = {
13013 clearIndicator: clearIndicatorCSS,
13014 container: containerCSS,
13015 control: css$1,
13016 dropdownIndicator: dropdownIndicatorCSS,
13017 group: groupCSS,
13018 groupHeading: groupHeadingCSS,
13019 indicatorsContainer: indicatorsContainerCSS,
13020 indicatorSeparator: indicatorSeparatorCSS,
13021 input: inputCSS,
13022 loadingIndicator: loadingIndicatorCSS,
13023 loadingMessage: loadingMessageCSS,
13024 menu: menuCSS,
13025 menuList: menuListCSS,
13026 menuPortal: menuPortalCSS,
13027 multiValue: multiValueCSS,
13028 multiValueLabel: multiValueLabelCSS,
13029 multiValueRemove: multiValueRemoveCSS,
13030 noOptionsMessage: noOptionsMessageCSS,
13031 option: optionCSS,
13032 placeholder: placeholderCSS,
13033 singleValue: css$2,
13034 valueContainer: valueContainerCSS
13035}; // Merge Utility
13036
13037var colors$1 = {
13038 primary: '#2684FF',
13039 primary75: '#4C9AFF',
13040 primary50: '#B2D4FF',
13041 primary25: '#DEEBFF',
13042 danger: '#DE350B',
13043 dangerLight: '#FFBDAD',
13044 neutral0: 'hsl(0, 0%, 100%)',
13045 neutral5: 'hsl(0, 0%, 95%)',
13046 neutral10: 'hsl(0, 0%, 90%)',
13047 neutral20: 'hsl(0, 0%, 80%)',
13048 neutral30: 'hsl(0, 0%, 70%)',
13049 neutral40: 'hsl(0, 0%, 60%)',
13050 neutral50: 'hsl(0, 0%, 50%)',
13051 neutral60: 'hsl(0, 0%, 40%)',
13052 neutral70: 'hsl(0, 0%, 30%)',
13053 neutral80: 'hsl(0, 0%, 20%)',
13054 neutral90: 'hsl(0, 0%, 10%)'
13055};
13056var borderRadius = 4;
13057var baseUnit = 4;
13058/* Used to calculate consistent margin/padding on elements */
13059
13060var controlHeight = 38;
13061/* The minimum height of the control */
13062
13063var menuGutter = baseUnit * 2;
13064/* The amount of space between the control and menu */
13065
13066var spacing = {
13067 baseUnit: baseUnit,
13068 controlHeight: controlHeight,
13069 menuGutter: menuGutter
13070};
13071var defaultTheme = {
13072 borderRadius: borderRadius,
13073 colors: colors$1,
13074 spacing: spacing
13075};
13076
13077var defaultProps = {
13078 backspaceRemovesValue: true,
13079 blurInputOnSelect: isTouchCapable(),
13080 captureMenuScroll: !isTouchCapable(),
13081 closeMenuOnSelect: true,
13082 closeMenuOnScroll: false,
13083 components: {},
13084 controlShouldRenderValue: true,
13085 escapeClearsValue: false,
13086 filterOption: createFilter(),
13087 formatGroupLabel: formatGroupLabel,
13088 getOptionLabel: getOptionLabel,
13089 getOptionValue: getOptionValue,
13090 isDisabled: false,
13091 isLoading: false,
13092 isMulti: false,
13093 isRtl: false,
13094 isSearchable: true,
13095 isOptionDisabled: isOptionDisabled,
13096 loadingMessage: function loadingMessage() {
13097 return 'Loading...';
13098 },
13099 maxMenuHeight: 300,
13100 minMenuHeight: 140,
13101 menuIsOpen: false,
13102 menuPlacement: 'bottom',
13103 menuPosition: 'absolute',
13104 menuShouldBlockScroll: false,
13105 menuShouldScrollIntoView: !isMobileDevice(),
13106 noOptionsMessage: function noOptionsMessage() {
13107 return 'No options';
13108 },
13109 openMenuOnFocus: false,
13110 openMenuOnClick: true,
13111 options: [],
13112 pageSize: 5,
13113 placeholder: 'Select...',
13114 screenReaderStatus: function screenReaderStatus(_ref) {
13115 var count = _ref.count;
13116 return "".concat(count, " result").concat(count !== 1 ? 's' : '', " available");
13117 },
13118 styles: {},
13119 tabIndex: '0',
13120 tabSelectsValue: true
13121};
13122var instanceId = 1;
13123
13124var Select =
13125/*#__PURE__*/
13126function (_Component) {
13127 _inherits(Select, _Component);
13128
13129 // Misc. Instance Properties
13130 // ------------------------------
13131 // TODO
13132 // Refs
13133 // ------------------------------
13134 // Lifecycle
13135 // ------------------------------
13136 function Select(_props) {
13137 var _this;
13138
13139 _classCallCheck(this, Select);
13140
13141 _this = _possibleConstructorReturn(this, _getPrototypeOf(Select).call(this, _props));
13142
13143 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "state", {
13144 ariaLiveSelection: '',
13145 ariaLiveContext: '',
13146 focusedOption: null,
13147 focusedValue: null,
13148 inputIsHidden: false,
13149 isFocused: false,
13150 isComposing: false,
13151 menuOptions: {
13152 render: [],
13153 focusable: []
13154 },
13155 selectValue: []
13156 });
13157
13158 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "blockOptionHover", false);
13159
13160 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "clearFocusValueOnUpdate", false);
13161
13162 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "commonProps", void 0);
13163
13164 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "components", void 0);
13165
13166 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "hasGroups", false);
13167
13168 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "initialTouchX", 0);
13169
13170 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "initialTouchY", 0);
13171
13172 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "inputIsHiddenAfterUpdate", void 0);
13173
13174 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "instancePrefix", '');
13175
13176 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "openAfterFocus", false);
13177
13178 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "scrollToFocusedOptionOnUpdate", false);
13179
13180 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "userIsDragging", void 0);
13181
13182 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "controlRef", null);
13183
13184 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getControlRef", function (ref) {
13185 _this.controlRef = ref;
13186 });
13187
13188 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "focusedOptionRef", null);
13189
13190 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getFocusedOptionRef", function (ref) {
13191 _this.focusedOptionRef = ref;
13192 });
13193
13194 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "menuListRef", null);
13195
13196 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getMenuListRef", function (ref) {
13197 _this.menuListRef = ref;
13198 });
13199
13200 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "inputRef", null);
13201
13202 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getInputRef", function (ref) {
13203 _this.inputRef = ref;
13204 });
13205
13206 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "cacheComponents", function (components$$1) {
13207 _this.components = defaultComponents({
13208 components: components$$1
13209 });
13210 });
13211
13212 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "focus", _this.focusInput);
13213
13214 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "blur", _this.blurInput);
13215
13216 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onChange", function (newValue, actionMeta) {
13217 var _this$props = _this.props,
13218 onChange = _this$props.onChange,
13219 name = _this$props.name;
13220 onChange(newValue, _objectSpread({}, actionMeta, {
13221 name: name
13222 }));
13223 });
13224
13225 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "setValue", function (newValue) {
13226 var action = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'set-value';
13227 var option = arguments.length > 2 ? arguments[2] : undefined;
13228 var _this$props2 = _this.props,
13229 closeMenuOnSelect = _this$props2.closeMenuOnSelect,
13230 isMulti = _this$props2.isMulti;
13231
13232 _this.onInputChange('', {
13233 action: 'set-value'
13234 });
13235
13236 if (closeMenuOnSelect) {
13237 _this.inputIsHiddenAfterUpdate = !isMulti;
13238
13239 _this.onMenuClose();
13240 } // when the select value should change, we should reset focusedValue
13241
13242
13243 _this.clearFocusValueOnUpdate = true;
13244
13245 _this.onChange(newValue, {
13246 action: action,
13247 option: option
13248 });
13249 });
13250
13251 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "selectOption", function (newValue) {
13252 var _this$props3 = _this.props,
13253 blurInputOnSelect = _this$props3.blurInputOnSelect,
13254 isMulti = _this$props3.isMulti;
13255 var selectValue = _this.state.selectValue;
13256
13257 if (isMulti) {
13258 if (_this.isOptionSelected(newValue, selectValue)) {
13259 var candidate = _this.getOptionValue(newValue);
13260
13261 _this.setValue(selectValue.filter(function (i) {
13262 return _this.getOptionValue(i) !== candidate;
13263 }), 'deselect-option', newValue);
13264
13265 _this.announceAriaLiveSelection({
13266 event: 'deselect-option',
13267 context: {
13268 value: _this.getOptionLabel(newValue)
13269 }
13270 });
13271 } else {
13272 if (!_this.isOptionDisabled(newValue, selectValue)) {
13273 _this.setValue([].concat(_toConsumableArray(selectValue), [newValue]), 'select-option', newValue);
13274
13275 _this.announceAriaLiveSelection({
13276 event: 'select-option',
13277 context: {
13278 value: _this.getOptionLabel(newValue)
13279 }
13280 });
13281 } else {
13282 // announce that option is disabled
13283 _this.announceAriaLiveSelection({
13284 event: 'select-option',
13285 context: {
13286 value: _this.getOptionLabel(newValue),
13287 isDisabled: true
13288 }
13289 });
13290 }
13291 }
13292 } else {
13293 if (!_this.isOptionDisabled(newValue, selectValue)) {
13294 _this.setValue(newValue, 'select-option');
13295
13296 _this.announceAriaLiveSelection({
13297 event: 'select-option',
13298 context: {
13299 value: _this.getOptionLabel(newValue)
13300 }
13301 });
13302 } else {
13303 // announce that option is disabled
13304 _this.announceAriaLiveSelection({
13305 event: 'select-option',
13306 context: {
13307 value: _this.getOptionLabel(newValue),
13308 isDisabled: true
13309 }
13310 });
13311 }
13312 }
13313
13314 if (blurInputOnSelect) {
13315 _this.blurInput();
13316 }
13317 });
13318
13319 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "removeValue", function (removedValue) {
13320 var selectValue = _this.state.selectValue;
13321
13322 var candidate = _this.getOptionValue(removedValue);
13323
13324 _this.onChange(selectValue.filter(function (i) {
13325 return _this.getOptionValue(i) !== candidate;
13326 }), {
13327 action: 'remove-value',
13328 removedValue: removedValue
13329 });
13330
13331 _this.announceAriaLiveSelection({
13332 event: 'remove-value',
13333 context: {
13334 value: removedValue ? _this.getOptionLabel(removedValue) : ''
13335 }
13336 });
13337
13338 _this.focusInput();
13339 });
13340
13341 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "clearValue", function () {
13342 var isMulti = _this.props.isMulti;
13343
13344 _this.onChange(isMulti ? [] : null, {
13345 action: 'clear'
13346 });
13347 });
13348
13349 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "popValue", function () {
13350 var selectValue = _this.state.selectValue;
13351 var lastSelectedValue = selectValue[selectValue.length - 1];
13352
13353 _this.announceAriaLiveSelection({
13354 event: 'pop-value',
13355 context: {
13356 value: lastSelectedValue ? _this.getOptionLabel(lastSelectedValue) : ''
13357 }
13358 });
13359
13360 _this.onChange(selectValue.slice(0, selectValue.length - 1), {
13361 action: 'pop-value',
13362 removedValue: lastSelectedValue
13363 });
13364 });
13365
13366 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getOptionLabel", function (data) {
13367 return _this.props.getOptionLabel(data);
13368 });
13369
13370 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getOptionValue", function (data) {
13371 return _this.props.getOptionValue(data);
13372 });
13373
13374 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getStyles", function (key, props) {
13375 var base = defaultStyles[key](props);
13376 base.boxSizing = 'border-box';
13377 var custom = _this.props.styles[key];
13378 return custom ? custom(base, props) : base;
13379 });
13380
13381 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getElementId", function (element) {
13382 return "".concat(_this.instancePrefix, "-").concat(element);
13383 });
13384
13385 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getActiveDescendentId", function () {
13386 var menuIsOpen = _this.props.menuIsOpen;
13387 var _this$state = _this.state,
13388 menuOptions = _this$state.menuOptions,
13389 focusedOption = _this$state.focusedOption;
13390 if (!focusedOption || !menuIsOpen) return undefined;
13391 var index = menuOptions.focusable.indexOf(focusedOption);
13392 var option = menuOptions.render[index];
13393 return option && option.key;
13394 });
13395
13396 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "announceAriaLiveSelection", function (_ref2) {
13397 var event = _ref2.event,
13398 context = _ref2.context;
13399
13400 _this.setState({
13401 ariaLiveSelection: valueEventAriaMessage(event, context)
13402 });
13403 });
13404
13405 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "announceAriaLiveContext", function (_ref3) {
13406 var event = _ref3.event,
13407 context = _ref3.context;
13408
13409 _this.setState({
13410 ariaLiveContext: instructionsAriaMessage(event, _objectSpread({}, context, {
13411 label: _this.props['aria-label']
13412 }))
13413 });
13414 });
13415
13416 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onMenuMouseDown", function (event) {
13417 if (event.button !== 0) {
13418 return;
13419 }
13420
13421 event.stopPropagation();
13422 event.preventDefault();
13423
13424 _this.focusInput();
13425 });
13426
13427 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onMenuMouseMove", function (event) {
13428 _this.blockOptionHover = false;
13429 });
13430
13431 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onControlMouseDown", function (event) {
13432 var openMenuOnClick = _this.props.openMenuOnClick;
13433
13434 if (!_this.state.isFocused) {
13435 if (openMenuOnClick) {
13436 _this.openAfterFocus = true;
13437 }
13438
13439 _this.focusInput();
13440 } else if (!_this.props.menuIsOpen) {
13441 if (openMenuOnClick) {
13442 _this.openMenu('first');
13443 }
13444 } else {
13445 //$FlowFixMe
13446 if (event.target.tagName !== 'INPUT') {
13447 _this.onMenuClose();
13448 }
13449 } //$FlowFixMe
13450
13451
13452 if (event.target.tagName !== 'INPUT') {
13453 event.preventDefault();
13454 }
13455 });
13456
13457 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onDropdownIndicatorMouseDown", function (event) {
13458 // ignore mouse events that weren't triggered by the primary button
13459 if (event && event.type === 'mousedown' && event.button !== 0) {
13460 return;
13461 }
13462
13463 if (_this.props.isDisabled) return;
13464 var _this$props4 = _this.props,
13465 isMulti = _this$props4.isMulti,
13466 menuIsOpen = _this$props4.menuIsOpen;
13467
13468 _this.focusInput();
13469
13470 if (menuIsOpen) {
13471 _this.inputIsHiddenAfterUpdate = !isMulti;
13472
13473 _this.onMenuClose();
13474 } else {
13475 _this.openMenu('first');
13476 }
13477
13478 event.preventDefault();
13479 event.stopPropagation();
13480 });
13481
13482 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onClearIndicatorMouseDown", function (event) {
13483 // ignore mouse events that weren't triggered by the primary button
13484 if (event && event.type === 'mousedown' && event.button !== 0) {
13485 return;
13486 }
13487
13488 _this.clearValue();
13489
13490 event.stopPropagation();
13491 _this.openAfterFocus = false;
13492 setTimeout(function () {
13493 return _this.focusInput();
13494 });
13495 });
13496
13497 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onScroll", function (event) {
13498 if (typeof _this.props.closeMenuOnScroll === 'boolean') {
13499 if (event.target instanceof HTMLElement && isDocumentElement(event.target)) {
13500 _this.props.onMenuClose();
13501 }
13502 } else if (typeof _this.props.closeMenuOnScroll === 'function') {
13503 if (_this.props.closeMenuOnScroll(event)) {
13504 _this.props.onMenuClose();
13505 }
13506 }
13507 });
13508
13509 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onCompositionStart", function () {
13510 _this.setState({
13511 isComposing: true
13512 });
13513 });
13514
13515 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onCompositionEnd", function () {
13516 _this.setState({
13517 isComposing: false
13518 });
13519 });
13520
13521 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onTouchStart", function (_ref4) {
13522 var touches = _ref4.touches;
13523 var touch = touches.item(0);
13524
13525 if (!touch) {
13526 return;
13527 }
13528
13529 _this.initialTouchX = touch.clientX;
13530 _this.initialTouchY = touch.clientY;
13531 _this.userIsDragging = false;
13532 });
13533
13534 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onTouchMove", function (_ref5) {
13535 var touches = _ref5.touches;
13536 var touch = touches.item(0);
13537
13538 if (!touch) {
13539 return;
13540 }
13541
13542 var deltaX = Math.abs(touch.clientX - _this.initialTouchX);
13543 var deltaY = Math.abs(touch.clientY - _this.initialTouchY);
13544 var moveThreshold = 5;
13545 _this.userIsDragging = deltaX > moveThreshold || deltaY > moveThreshold;
13546 });
13547
13548 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onTouchEnd", function (event) {
13549 if (_this.userIsDragging) return; // close the menu if the user taps outside
13550 // we're checking on event.target here instead of event.currentTarget, because we want to assert information
13551 // on events on child elements, not the document (which we've attached this handler to).
13552
13553 if (_this.controlRef && !_this.controlRef.contains(event.target) && _this.menuListRef && !_this.menuListRef.contains(event.target)) {
13554 _this.blurInput();
13555 } // reset move vars
13556
13557
13558 _this.initialTouchX = 0;
13559 _this.initialTouchY = 0;
13560 });
13561
13562 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onControlTouchEnd", function (event) {
13563 if (_this.userIsDragging) return;
13564
13565 _this.onControlMouseDown(event);
13566 });
13567
13568 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onClearIndicatorTouchEnd", function (event) {
13569 if (_this.userIsDragging) return;
13570
13571 _this.onClearIndicatorMouseDown(event);
13572 });
13573
13574 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onDropdownIndicatorTouchEnd", function (event) {
13575 if (_this.userIsDragging) return;
13576
13577 _this.onDropdownIndicatorMouseDown(event);
13578 });
13579
13580 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "handleInputChange", function (event) {
13581 var inputValue = event.currentTarget.value;
13582 _this.inputIsHiddenAfterUpdate = false;
13583
13584 _this.onInputChange(inputValue, {
13585 action: 'input-change'
13586 });
13587
13588 _this.onMenuOpen();
13589 });
13590
13591 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onInputFocus", function (event) {
13592 var _this$props5 = _this.props,
13593 isSearchable = _this$props5.isSearchable,
13594 isMulti = _this$props5.isMulti;
13595
13596 if (_this.props.onFocus) {
13597 _this.props.onFocus(event);
13598 }
13599
13600 _this.inputIsHiddenAfterUpdate = false;
13601
13602 _this.announceAriaLiveContext({
13603 event: 'input',
13604 context: {
13605 isSearchable: isSearchable,
13606 isMulti: isMulti
13607 }
13608 });
13609
13610 _this.setState({
13611 isFocused: true
13612 });
13613
13614 if (_this.openAfterFocus || _this.props.openMenuOnFocus) {
13615 _this.openMenu('first');
13616 }
13617
13618 _this.openAfterFocus = false;
13619 });
13620
13621 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onInputBlur", function (event) {
13622 if (_this.menuListRef && _this.menuListRef.contains(document.activeElement)) {
13623 _this.inputRef.focus();
13624
13625 return;
13626 }
13627
13628 if (_this.props.onBlur) {
13629 _this.props.onBlur(event);
13630 }
13631
13632 _this.onInputChange('', {
13633 action: 'input-blur'
13634 });
13635
13636 _this.onMenuClose();
13637
13638 _this.setState({
13639 focusedValue: null,
13640 isFocused: false
13641 });
13642 });
13643
13644 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onOptionHover", function (focusedOption) {
13645 if (_this.blockOptionHover || _this.state.focusedOption === focusedOption) {
13646 return;
13647 }
13648
13649 _this.setState({
13650 focusedOption: focusedOption
13651 });
13652 });
13653
13654 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "shouldHideSelectedOptions", function () {
13655 var _this$props6 = _this.props,
13656 hideSelectedOptions = _this$props6.hideSelectedOptions,
13657 isMulti = _this$props6.isMulti;
13658 if (hideSelectedOptions === undefined) return isMulti;
13659 return hideSelectedOptions;
13660 });
13661
13662 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onKeyDown", function (event) {
13663 var _this$props7 = _this.props,
13664 isMulti = _this$props7.isMulti,
13665 backspaceRemovesValue = _this$props7.backspaceRemovesValue,
13666 escapeClearsValue = _this$props7.escapeClearsValue,
13667 inputValue = _this$props7.inputValue,
13668 isClearable = _this$props7.isClearable,
13669 isDisabled = _this$props7.isDisabled,
13670 menuIsOpen = _this$props7.menuIsOpen,
13671 onKeyDown = _this$props7.onKeyDown,
13672 tabSelectsValue = _this$props7.tabSelectsValue,
13673 openMenuOnFocus = _this$props7.openMenuOnFocus;
13674 var _this$state2 = _this.state,
13675 isComposing = _this$state2.isComposing,
13676 focusedOption = _this$state2.focusedOption,
13677 focusedValue = _this$state2.focusedValue,
13678 selectValue = _this$state2.selectValue;
13679 if (isDisabled) return;
13680
13681 if (typeof onKeyDown === 'function') {
13682 onKeyDown(event);
13683
13684 if (event.defaultPrevented) {
13685 return;
13686 }
13687 } // Block option hover events when the user has just pressed a key
13688
13689
13690 _this.blockOptionHover = true;
13691
13692 switch (event.key) {
13693 case 'ArrowLeft':
13694 if (!isMulti || inputValue) return;
13695
13696 _this.focusValue('previous');
13697
13698 break;
13699
13700 case 'ArrowRight':
13701 if (!isMulti || inputValue) return;
13702
13703 _this.focusValue('next');
13704
13705 break;
13706
13707 case 'Delete':
13708 case 'Backspace':
13709 if (inputValue) return;
13710
13711 if (focusedValue) {
13712 _this.removeValue(focusedValue);
13713 } else {
13714 if (!backspaceRemovesValue) return;
13715
13716 if (isMulti) {
13717 _this.popValue();
13718 } else if (isClearable) {
13719 _this.clearValue();
13720 }
13721 }
13722
13723 break;
13724
13725 case 'Tab':
13726 if (isComposing) return;
13727
13728 if (event.shiftKey || !menuIsOpen || !tabSelectsValue || !focusedOption || // don't capture the event if the menu opens on focus and the focused
13729 // option is already selected; it breaks the flow of navigation
13730 openMenuOnFocus && _this.isOptionSelected(focusedOption, selectValue)) {
13731 return;
13732 }
13733
13734 _this.selectOption(focusedOption);
13735
13736 break;
13737
13738 case 'Enter':
13739 if (event.keyCode === 229) {
13740 // ignore the keydown event from an Input Method Editor(IME)
13741 // ref. https://www.w3.org/TR/uievents/#determine-keydown-keyup-keyCode
13742 break;
13743 }
13744
13745 if (menuIsOpen) {
13746 if (!focusedOption) return;
13747 if (isComposing) return;
13748
13749 _this.selectOption(focusedOption);
13750
13751 break;
13752 }
13753
13754 return;
13755
13756 case 'Escape':
13757 if (menuIsOpen) {
13758 _this.inputIsHiddenAfterUpdate = false;
13759
13760 _this.onInputChange('', {
13761 action: 'menu-close'
13762 });
13763
13764 _this.onMenuClose();
13765 } else if (isClearable && escapeClearsValue) {
13766 _this.clearValue();
13767 }
13768
13769 break;
13770
13771 case ' ':
13772 // space
13773 if (inputValue) {
13774 return;
13775 }
13776
13777 if (!menuIsOpen) {
13778 _this.openMenu('first');
13779
13780 break;
13781 }
13782
13783 if (!focusedOption) return;
13784
13785 _this.selectOption(focusedOption);
13786
13787 break;
13788
13789 case 'ArrowUp':
13790 if (menuIsOpen) {
13791 _this.focusOption('up');
13792 } else {
13793 _this.openMenu('last');
13794 }
13795
13796 break;
13797
13798 case 'ArrowDown':
13799 if (menuIsOpen) {
13800 _this.focusOption('down');
13801 } else {
13802 _this.openMenu('first');
13803 }
13804
13805 break;
13806
13807 case 'PageUp':
13808 if (!menuIsOpen) return;
13809
13810 _this.focusOption('pageup');
13811
13812 break;
13813
13814 case 'PageDown':
13815 if (!menuIsOpen) return;
13816
13817 _this.focusOption('pagedown');
13818
13819 break;
13820
13821 case 'Home':
13822 if (!menuIsOpen) return;
13823
13824 _this.focusOption('first');
13825
13826 break;
13827
13828 case 'End':
13829 if (!menuIsOpen) return;
13830
13831 _this.focusOption('last');
13832
13833 break;
13834
13835 default:
13836 return;
13837 }
13838
13839 event.preventDefault();
13840 });
13841
13842 var value = _props.value;
13843 _this.cacheComponents = index$2(_this.cacheComponents, exportedEqual).bind(_assertThisInitialized$1(_assertThisInitialized$1(_this)));
13844
13845 _this.cacheComponents(_props.components);
13846
13847 _this.instancePrefix = 'react-select-' + (_this.props.instanceId || ++instanceId);
13848
13849 var _selectValue = cleanValue(value);
13850
13851 var _menuOptions = _this.buildMenuOptions(_props, _selectValue);
13852
13853 _this.state.menuOptions = _menuOptions;
13854 _this.state.selectValue = _selectValue;
13855 return _this;
13856 }
13857
13858 _createClass(Select, [{
13859 key: "componentDidMount",
13860 value: function componentDidMount() {
13861 this.startListeningComposition();
13862 this.startListeningToTouch();
13863
13864 if (this.props.closeMenuOnScroll && document && document.addEventListener) {
13865 // Listen to all scroll events, and filter them out inside of 'onScroll'
13866 document.addEventListener('scroll', this.onScroll, true);
13867 }
13868
13869 if (this.props.autoFocus) {
13870 this.focusInput();
13871 }
13872 }
13873 }, {
13874 key: "componentWillReceiveProps",
13875 value: function componentWillReceiveProps(nextProps) {
13876 var _this$props8 = this.props,
13877 options = _this$props8.options,
13878 value = _this$props8.value,
13879 inputValue = _this$props8.inputValue; // re-cache custom components
13880
13881 this.cacheComponents(nextProps.components); // rebuild the menu options
13882
13883 if (nextProps.value !== value || nextProps.options !== options || nextProps.inputValue !== inputValue) {
13884 var selectValue = cleanValue(nextProps.value);
13885 var menuOptions = this.buildMenuOptions(nextProps, selectValue);
13886 var focusedValue = this.getNextFocusedValue(selectValue);
13887 var focusedOption = this.getNextFocusedOption(menuOptions.focusable);
13888 this.setState({
13889 menuOptions: menuOptions,
13890 selectValue: selectValue,
13891 focusedOption: focusedOption,
13892 focusedValue: focusedValue
13893 });
13894 } // some updates should toggle the state of the input visibility
13895
13896
13897 if (this.inputIsHiddenAfterUpdate != null) {
13898 this.setState({
13899 inputIsHidden: this.inputIsHiddenAfterUpdate
13900 });
13901 delete this.inputIsHiddenAfterUpdate;
13902 }
13903 }
13904 }, {
13905 key: "componentDidUpdate",
13906 value: function componentDidUpdate(prevProps) {
13907 var _this$props9 = this.props,
13908 isDisabled = _this$props9.isDisabled,
13909 menuIsOpen = _this$props9.menuIsOpen;
13910 var isFocused = this.state.isFocused;
13911
13912 if ( // ensure focus is restored correctly when the control becomes enabled
13913 isFocused && !isDisabled && prevProps.isDisabled || // ensure focus is on the Input when the menu opens
13914 isFocused && menuIsOpen && !prevProps.menuIsOpen) {
13915 this.focusInput();
13916 } // scroll the focused option into view if necessary
13917
13918
13919 if (this.menuListRef && this.focusedOptionRef && this.scrollToFocusedOptionOnUpdate) {
13920 scrollIntoView(this.menuListRef, this.focusedOptionRef);
13921 }
13922
13923 this.scrollToFocusedOptionOnUpdate = false;
13924 }
13925 }, {
13926 key: "componentWillUnmount",
13927 value: function componentWillUnmount() {
13928 this.stopListeningComposition();
13929 this.stopListeningToTouch();
13930 document.removeEventListener('scroll', this.onScroll, true);
13931 }
13932 }, {
13933 key: "onMenuOpen",
13934 // ==============================
13935 // Consumer Handlers
13936 // ==============================
13937 value: function onMenuOpen() {
13938 this.props.onMenuOpen();
13939 }
13940 }, {
13941 key: "onMenuClose",
13942 value: function onMenuClose() {
13943 var _this$props10 = this.props,
13944 isSearchable = _this$props10.isSearchable,
13945 isMulti = _this$props10.isMulti;
13946 this.announceAriaLiveContext({
13947 event: 'input',
13948 context: {
13949 isSearchable: isSearchable,
13950 isMulti: isMulti
13951 }
13952 });
13953 this.onInputChange('', {
13954 action: 'menu-close'
13955 });
13956 this.props.onMenuClose();
13957 }
13958 }, {
13959 key: "onInputChange",
13960 value: function onInputChange(newValue, actionMeta) {
13961 this.props.onInputChange(newValue, actionMeta);
13962 } // ==============================
13963 // Methods
13964 // ==============================
13965
13966 }, {
13967 key: "focusInput",
13968 value: function focusInput() {
13969 if (!this.inputRef) return;
13970 this.inputRef.focus();
13971 }
13972 }, {
13973 key: "blurInput",
13974 value: function blurInput() {
13975 if (!this.inputRef) return;
13976 this.inputRef.blur();
13977 } // aliased for consumers
13978
13979 }, {
13980 key: "openMenu",
13981 value: function openMenu(focusOption) {
13982 var _this$state3 = this.state,
13983 menuOptions = _this$state3.menuOptions,
13984 selectValue = _this$state3.selectValue,
13985 isFocused = _this$state3.isFocused;
13986 var isMulti = this.props.isMulti;
13987 var openAtIndex = focusOption === 'first' ? 0 : menuOptions.focusable.length - 1;
13988
13989 if (!isMulti) {
13990 var selectedIndex = menuOptions.focusable.indexOf(selectValue[0]);
13991
13992 if (selectedIndex > -1) {
13993 openAtIndex = selectedIndex;
13994 }
13995 } // only scroll if the menu isn't already open
13996
13997
13998 this.scrollToFocusedOptionOnUpdate = !(isFocused && this.menuListRef);
13999 this.inputIsHiddenAfterUpdate = false;
14000 this.onMenuOpen();
14001 this.setState({
14002 focusedValue: null,
14003 focusedOption: menuOptions.focusable[openAtIndex]
14004 });
14005 this.announceAriaLiveContext({
14006 event: 'menu'
14007 });
14008 }
14009 }, {
14010 key: "focusValue",
14011 value: function focusValue(direction) {
14012 var _this$props11 = this.props,
14013 isMulti = _this$props11.isMulti,
14014 isSearchable = _this$props11.isSearchable;
14015 var _this$state4 = this.state,
14016 selectValue = _this$state4.selectValue,
14017 focusedValue = _this$state4.focusedValue; // Only multiselects support value focusing
14018
14019 if (!isMulti) return;
14020 this.setState({
14021 focusedOption: null
14022 });
14023 var focusedIndex = selectValue.indexOf(focusedValue);
14024
14025 if (!focusedValue) {
14026 focusedIndex = -1;
14027 this.announceAriaLiveContext({
14028 event: 'value'
14029 });
14030 }
14031
14032 var lastIndex = selectValue.length - 1;
14033 var nextFocus = -1;
14034 if (!selectValue.length) return;
14035
14036 switch (direction) {
14037 case 'previous':
14038 if (focusedIndex === 0) {
14039 // don't cycle from the start to the end
14040 nextFocus = 0;
14041 } else if (focusedIndex === -1) {
14042 // if nothing is focused, focus the last value first
14043 nextFocus = lastIndex;
14044 } else {
14045 nextFocus = focusedIndex - 1;
14046 }
14047
14048 break;
14049
14050 case 'next':
14051 if (focusedIndex > -1 && focusedIndex < lastIndex) {
14052 nextFocus = focusedIndex + 1;
14053 }
14054
14055 break;
14056 }
14057
14058 if (nextFocus === -1) {
14059 this.announceAriaLiveContext({
14060 event: 'input',
14061 context: {
14062 isSearchable: isSearchable,
14063 isMulti: isMulti
14064 }
14065 });
14066 }
14067
14068 this.setState({
14069 inputIsHidden: nextFocus === -1 ? false : true,
14070 focusedValue: selectValue[nextFocus]
14071 });
14072 }
14073 }, {
14074 key: "focusOption",
14075 value: function focusOption() {
14076 var direction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'first';
14077 var pageSize = this.props.pageSize;
14078 var _this$state5 = this.state,
14079 focusedOption = _this$state5.focusedOption,
14080 menuOptions = _this$state5.menuOptions;
14081 var options = menuOptions.focusable;
14082 if (!options.length) return;
14083 var nextFocus = 0; // handles 'first'
14084
14085 var focusedIndex = options.indexOf(focusedOption);
14086
14087 if (!focusedOption) {
14088 focusedIndex = -1;
14089 this.announceAriaLiveContext({
14090 event: 'menu'
14091 });
14092 }
14093
14094 if (direction === 'up') {
14095 nextFocus = focusedIndex > 0 ? focusedIndex - 1 : options.length - 1;
14096 } else if (direction === 'down') {
14097 nextFocus = (focusedIndex + 1) % options.length;
14098 } else if (direction === 'pageup') {
14099 nextFocus = focusedIndex - pageSize;
14100 if (nextFocus < 0) nextFocus = 0;
14101 } else if (direction === 'pagedown') {
14102 nextFocus = focusedIndex + pageSize;
14103 if (nextFocus > options.length - 1) nextFocus = options.length - 1;
14104 } else if (direction === 'last') {
14105 nextFocus = options.length - 1;
14106 }
14107
14108 this.scrollToFocusedOptionOnUpdate = true;
14109 this.setState({
14110 focusedOption: options[nextFocus],
14111 focusedValue: null
14112 });
14113 this.announceAriaLiveContext({
14114 event: 'menu',
14115 context: {
14116 isDisabled: isOptionDisabled(options[nextFocus])
14117 }
14118 });
14119 }
14120 }, {
14121 key: "getTheme",
14122 // ==============================
14123 // Getters
14124 // ==============================
14125 value: function getTheme() {
14126 // Use the default theme if there are no customizations.
14127 if (!this.props.theme) {
14128 return defaultTheme;
14129 } // If the theme prop is a function, assume the function
14130 // knows how to merge the passed-in default theme with
14131 // its own modifications.
14132
14133
14134 if (typeof this.props.theme === 'function') {
14135 return this.props.theme(defaultTheme);
14136 } // Otherwise, if a plain theme object was passed in,
14137 // overlay it with the default theme.
14138
14139
14140 return _objectSpread({}, defaultTheme, this.props.theme);
14141 }
14142 }, {
14143 key: "getCommonProps",
14144 value: function getCommonProps() {
14145 var clearValue = this.clearValue,
14146 getStyles = this.getStyles,
14147 setValue = this.setValue,
14148 selectOption = this.selectOption,
14149 props = this.props;
14150 var classNamePrefix = props.classNamePrefix,
14151 isMulti = props.isMulti,
14152 isRtl = props.isRtl,
14153 options = props.options;
14154 var selectValue = this.state.selectValue;
14155 var hasValue = this.hasValue();
14156
14157 var getValue = function getValue() {
14158 return selectValue;
14159 };
14160
14161 var cx$$1 = classNames.bind(null, classNamePrefix);
14162 return {
14163 cx: cx$$1,
14164 clearValue: clearValue,
14165 getStyles: getStyles,
14166 getValue: getValue,
14167 hasValue: hasValue,
14168 isMulti: isMulti,
14169 isRtl: isRtl,
14170 options: options,
14171 selectOption: selectOption,
14172 setValue: setValue,
14173 selectProps: props,
14174 theme: this.getTheme()
14175 };
14176 }
14177 }, {
14178 key: "getNextFocusedValue",
14179 value: function getNextFocusedValue(nextSelectValue) {
14180 if (this.clearFocusValueOnUpdate) {
14181 this.clearFocusValueOnUpdate = false;
14182 return null;
14183 }
14184
14185 var _this$state6 = this.state,
14186 focusedValue = _this$state6.focusedValue,
14187 lastSelectValue = _this$state6.selectValue;
14188 var lastFocusedIndex = lastSelectValue.indexOf(focusedValue);
14189
14190 if (lastFocusedIndex > -1) {
14191 var nextFocusedIndex = nextSelectValue.indexOf(focusedValue);
14192
14193 if (nextFocusedIndex > -1) {
14194 // the focused value is still in the selectValue, return it
14195 return focusedValue;
14196 } else if (lastFocusedIndex < nextSelectValue.length) {
14197 // the focusedValue is not present in the next selectValue array by
14198 // reference, so return the new value at the same index
14199 return nextSelectValue[lastFocusedIndex];
14200 }
14201 }
14202
14203 return null;
14204 }
14205 }, {
14206 key: "getNextFocusedOption",
14207 value: function getNextFocusedOption(options) {
14208 var lastFocusedOption = this.state.focusedOption;
14209 return lastFocusedOption && options.indexOf(lastFocusedOption) > -1 ? lastFocusedOption : options[0];
14210 }
14211 }, {
14212 key: "hasValue",
14213 value: function hasValue() {
14214 var selectValue = this.state.selectValue;
14215 return selectValue.length > 0;
14216 }
14217 }, {
14218 key: "hasOptions",
14219 value: function hasOptions() {
14220 return !!this.state.menuOptions.render.length;
14221 }
14222 }, {
14223 key: "countOptions",
14224 value: function countOptions() {
14225 return this.state.menuOptions.focusable.length;
14226 }
14227 }, {
14228 key: "isClearable",
14229 value: function isClearable() {
14230 var _this$props12 = this.props,
14231 isClearable = _this$props12.isClearable,
14232 isMulti = _this$props12.isMulti; // single select, by default, IS NOT clearable
14233 // multi select, by default, IS clearable
14234
14235 if (isClearable === undefined) return isMulti;
14236 return isClearable;
14237 }
14238 }, {
14239 key: "isOptionDisabled",
14240 value: function isOptionDisabled$$1(option, selectValue) {
14241 return typeof this.props.isOptionDisabled === 'function' ? this.props.isOptionDisabled(option, selectValue) : false;
14242 }
14243 }, {
14244 key: "isOptionSelected",
14245 value: function isOptionSelected(option, selectValue) {
14246 var _this2 = this;
14247
14248 if (selectValue.indexOf(option) > -1) return true;
14249
14250 if (typeof this.props.isOptionSelected === 'function') {
14251 return this.props.isOptionSelected(option, selectValue);
14252 }
14253
14254 var candidate = this.getOptionValue(option);
14255 return selectValue.some(function (i) {
14256 return _this2.getOptionValue(i) === candidate;
14257 });
14258 }
14259 }, {
14260 key: "filterOption",
14261 value: function filterOption(option, inputValue) {
14262 return this.props.filterOption ? this.props.filterOption(option, inputValue) : true;
14263 }
14264 }, {
14265 key: "formatOptionLabel",
14266 value: function formatOptionLabel(data, context) {
14267 if (typeof this.props.formatOptionLabel === 'function') {
14268 var inputValue = this.props.inputValue;
14269 var selectValue = this.state.selectValue;
14270 return this.props.formatOptionLabel(data, {
14271 context: context,
14272 inputValue: inputValue,
14273 selectValue: selectValue
14274 });
14275 } else {
14276 return this.getOptionLabel(data);
14277 }
14278 }
14279 }, {
14280 key: "formatGroupLabel",
14281 value: function formatGroupLabel$$1(data) {
14282 return this.props.formatGroupLabel(data);
14283 } // ==============================
14284 // Mouse Handlers
14285 // ==============================
14286
14287 }, {
14288 key: "startListeningComposition",
14289 // ==============================
14290 // Composition Handlers
14291 // ==============================
14292 value: function startListeningComposition() {
14293 if (document && document.addEventListener) {
14294 document.addEventListener('compositionstart', this.onCompositionStart, false);
14295 document.addEventListener('compositionend', this.onCompositionEnd, false);
14296 }
14297 }
14298 }, {
14299 key: "stopListeningComposition",
14300 value: function stopListeningComposition() {
14301 if (document && document.removeEventListener) {
14302 document.removeEventListener('compositionstart', this.onCompositionStart);
14303 document.removeEventListener('compositionend', this.onCompositionEnd);
14304 }
14305 }
14306 }, {
14307 key: "startListeningToTouch",
14308 // ==============================
14309 // Touch Handlers
14310 // ==============================
14311 value: function startListeningToTouch() {
14312 if (document && document.addEventListener) {
14313 document.addEventListener('touchstart', this.onTouchStart, false);
14314 document.addEventListener('touchmove', this.onTouchMove, false);
14315 document.addEventListener('touchend', this.onTouchEnd, false);
14316 }
14317 }
14318 }, {
14319 key: "stopListeningToTouch",
14320 value: function stopListeningToTouch() {
14321 if (document && document.removeEventListener) {
14322 document.removeEventListener('touchstart', this.onTouchStart);
14323 document.removeEventListener('touchmove', this.onTouchMove);
14324 document.removeEventListener('touchend', this.onTouchEnd);
14325 }
14326 }
14327 }, {
14328 key: "buildMenuOptions",
14329 // ==============================
14330 // Menu Options
14331 // ==============================
14332 value: function buildMenuOptions(props, selectValue) {
14333 var _this3 = this;
14334
14335 var _props$inputValue = props.inputValue,
14336 inputValue = _props$inputValue === void 0 ? '' : _props$inputValue,
14337 options = props.options;
14338
14339 var toOption = function toOption(option, id) {
14340 var isDisabled = _this3.isOptionDisabled(option, selectValue);
14341
14342 var isSelected = _this3.isOptionSelected(option, selectValue);
14343
14344 var label = _this3.getOptionLabel(option);
14345
14346 var value = _this3.getOptionValue(option);
14347
14348 if (_this3.shouldHideSelectedOptions() && isSelected || !_this3.filterOption({
14349 label: label,
14350 value: value,
14351 data: option
14352 }, inputValue)) {
14353 return;
14354 }
14355
14356 var onHover = isDisabled ? undefined : function () {
14357 return _this3.onOptionHover(option);
14358 };
14359 var onSelect = isDisabled ? undefined : function () {
14360 return _this3.selectOption(option);
14361 };
14362 var optionId = "".concat(_this3.getElementId('option'), "-").concat(id);
14363 return {
14364 innerProps: {
14365 id: optionId,
14366 onClick: onSelect,
14367 onMouseMove: onHover,
14368 onMouseOver: onHover,
14369 tabIndex: -1
14370 },
14371 data: option,
14372 isDisabled: isDisabled,
14373 isSelected: isSelected,
14374 key: optionId,
14375 label: label,
14376 type: 'option',
14377 value: value
14378 };
14379 };
14380
14381 return options.reduce(function (acc, item, itemIndex) {
14382 if (item.options) {
14383 // TODO needs a tidier implementation
14384 if (!_this3.hasGroups) _this3.hasGroups = true;
14385 var items = item.options;
14386 var children = items.map(function (child, i) {
14387 var option = toOption(child, "".concat(itemIndex, "-").concat(i));
14388 if (option) acc.focusable.push(child);
14389 return option;
14390 }).filter(Boolean);
14391
14392 if (children.length) {
14393 var groupId = "".concat(_this3.getElementId('group'), "-").concat(itemIndex);
14394 acc.render.push({
14395 type: 'group',
14396 key: groupId,
14397 data: item,
14398 options: children
14399 });
14400 }
14401 } else {
14402 var option = toOption(item, "".concat(itemIndex));
14403
14404 if (option) {
14405 acc.render.push(option);
14406 acc.focusable.push(item);
14407 }
14408 }
14409
14410 return acc;
14411 }, {
14412 render: [],
14413 focusable: []
14414 });
14415 } // ==============================
14416 // Renderers
14417 // ==============================
14418
14419 }, {
14420 key: "constructAriaLiveMessage",
14421 value: function constructAriaLiveMessage() {
14422 var _this$state7 = this.state,
14423 ariaLiveContext = _this$state7.ariaLiveContext,
14424 selectValue = _this$state7.selectValue,
14425 focusedValue = _this$state7.focusedValue,
14426 focusedOption = _this$state7.focusedOption;
14427 var _this$props13 = this.props,
14428 options = _this$props13.options,
14429 menuIsOpen = _this$props13.menuIsOpen,
14430 inputValue = _this$props13.inputValue,
14431 screenReaderStatus = _this$props13.screenReaderStatus; // An aria live message representing the currently focused value in the select.
14432
14433 var focusedValueMsg = focusedValue ? valueFocusAriaMessage({
14434 focusedValue: focusedValue,
14435 getOptionLabel: this.getOptionLabel,
14436 selectValue: selectValue
14437 }) : ''; // An aria live message representing the currently focused option in the select.
14438
14439 var focusedOptionMsg = focusedOption && menuIsOpen ? optionFocusAriaMessage({
14440 focusedOption: focusedOption,
14441 getOptionLabel: this.getOptionLabel,
14442 options: options
14443 }) : ''; // An aria live message representing the set of focusable results and current searchterm/inputvalue.
14444
14445 var resultsMsg = resultsAriaMessage({
14446 inputValue: inputValue,
14447 screenReaderMessage: screenReaderStatus({
14448 count: this.countOptions()
14449 })
14450 });
14451 return "".concat(focusedValueMsg, " ").concat(focusedOptionMsg, " ").concat(resultsMsg, " ").concat(ariaLiveContext);
14452 }
14453 }, {
14454 key: "renderInput",
14455 value: function renderInput() {
14456 var _this$props14 = this.props,
14457 isDisabled = _this$props14.isDisabled,
14458 isSearchable = _this$props14.isSearchable,
14459 inputId = _this$props14.inputId,
14460 inputValue = _this$props14.inputValue,
14461 tabIndex = _this$props14.tabIndex;
14462 var Input = this.components.Input;
14463 var inputIsHidden = this.state.inputIsHidden;
14464 var id = inputId || this.getElementId('input');
14465
14466 if (!isSearchable) {
14467 // use a dummy input to maintain focus/blur functionality
14468 return React__default.createElement(DummyInput, {
14469 id: id,
14470 innerRef: this.getInputRef,
14471 onBlur: this.onInputBlur,
14472 onChange: noop,
14473 onFocus: this.onInputFocus,
14474 readOnly: true,
14475 disabled: isDisabled,
14476 tabIndex: tabIndex,
14477 value: ""
14478 });
14479 } // aria attributes makes the JSX "noisy", separated for clarity
14480
14481
14482 var ariaAttributes = {
14483 'aria-autocomplete': 'list',
14484 'aria-label': this.props['aria-label'],
14485 'aria-labelledby': this.props['aria-labelledby']
14486 };
14487 var _this$commonProps = this.commonProps,
14488 cx$$1 = _this$commonProps.cx,
14489 theme = _this$commonProps.theme,
14490 selectProps = _this$commonProps.selectProps;
14491 return React__default.createElement(Input, _extends$2({
14492 autoCapitalize: "none",
14493 autoComplete: "off",
14494 autoCorrect: "off",
14495 cx: cx$$1,
14496 getStyles: this.getStyles,
14497 id: id,
14498 innerRef: this.getInputRef,
14499 isDisabled: isDisabled,
14500 isHidden: inputIsHidden,
14501 onBlur: this.onInputBlur,
14502 onChange: this.handleInputChange,
14503 onFocus: this.onInputFocus,
14504 selectProps: selectProps,
14505 spellCheck: "false",
14506 tabIndex: tabIndex,
14507 theme: theme,
14508 type: "text",
14509 value: inputValue
14510 }, ariaAttributes));
14511 }
14512 }, {
14513 key: "renderPlaceholderOrValue",
14514 value: function renderPlaceholderOrValue() {
14515 var _this4 = this;
14516
14517 var _this$components = this.components,
14518 MultiValue = _this$components.MultiValue,
14519 MultiValueContainer = _this$components.MultiValueContainer,
14520 MultiValueLabel = _this$components.MultiValueLabel,
14521 MultiValueRemove = _this$components.MultiValueRemove,
14522 SingleValue = _this$components.SingleValue,
14523 Placeholder = _this$components.Placeholder;
14524 var commonProps = this.commonProps;
14525 var _this$props15 = this.props,
14526 controlShouldRenderValue = _this$props15.controlShouldRenderValue,
14527 isDisabled = _this$props15.isDisabled,
14528 isMulti = _this$props15.isMulti,
14529 inputValue = _this$props15.inputValue,
14530 placeholder = _this$props15.placeholder;
14531 var _this$state8 = this.state,
14532 selectValue = _this$state8.selectValue,
14533 focusedValue = _this$state8.focusedValue,
14534 isFocused = _this$state8.isFocused;
14535
14536 if (!this.hasValue() || !controlShouldRenderValue) {
14537 return inputValue ? null : React__default.createElement(Placeholder, _extends$2({}, commonProps, {
14538 key: "placeholder",
14539 isDisabled: isDisabled,
14540 isFocused: isFocused
14541 }), placeholder);
14542 }
14543
14544 if (isMulti) {
14545 var selectValues = selectValue.map(function (opt) {
14546 var isOptionFocused = opt === focusedValue;
14547 return React__default.createElement(MultiValue, _extends$2({}, commonProps, {
14548 components: {
14549 Container: MultiValueContainer,
14550 Label: MultiValueLabel,
14551 Remove: MultiValueRemove
14552 },
14553 isFocused: isOptionFocused,
14554 isDisabled: isDisabled,
14555 key: _this4.getOptionValue(opt),
14556 removeProps: {
14557 onClick: function onClick() {
14558 return _this4.removeValue(opt);
14559 },
14560 onTouchEnd: function onTouchEnd() {
14561 return _this4.removeValue(opt);
14562 },
14563 onMouseDown: function onMouseDown(e) {
14564 e.preventDefault();
14565 e.stopPropagation();
14566 }
14567 },
14568 data: opt
14569 }), _this4.formatOptionLabel(opt, 'value'));
14570 });
14571 return selectValues;
14572 }
14573
14574 if (inputValue) {
14575 return null;
14576 }
14577
14578 var singleValue = selectValue[0];
14579 return React__default.createElement(SingleValue, _extends$2({}, commonProps, {
14580 data: singleValue,
14581 isDisabled: isDisabled
14582 }), this.formatOptionLabel(singleValue, 'value'));
14583 }
14584 }, {
14585 key: "renderClearIndicator",
14586 value: function renderClearIndicator() {
14587 var ClearIndicator = this.components.ClearIndicator;
14588 var commonProps = this.commonProps;
14589 var _this$props16 = this.props,
14590 isDisabled = _this$props16.isDisabled,
14591 isLoading = _this$props16.isLoading;
14592 var isFocused = this.state.isFocused;
14593
14594 if (!this.isClearable() || !ClearIndicator || isDisabled || !this.hasValue() || isLoading) {
14595 return null;
14596 }
14597
14598 var innerProps = {
14599 onMouseDown: this.onClearIndicatorMouseDown,
14600 onTouchEnd: this.onClearIndicatorTouchEnd,
14601 'aria-hidden': 'true'
14602 };
14603 return React__default.createElement(ClearIndicator, _extends$2({}, commonProps, {
14604 innerProps: innerProps,
14605 isFocused: isFocused
14606 }));
14607 }
14608 }, {
14609 key: "renderLoadingIndicator",
14610 value: function renderLoadingIndicator() {
14611 var LoadingIndicator = this.components.LoadingIndicator;
14612 var commonProps = this.commonProps;
14613 var _this$props17 = this.props,
14614 isDisabled = _this$props17.isDisabled,
14615 isLoading = _this$props17.isLoading;
14616 var isFocused = this.state.isFocused;
14617 if (!LoadingIndicator || !isLoading) return null;
14618 var innerProps = {
14619 'aria-hidden': 'true'
14620 };
14621 return React__default.createElement(LoadingIndicator, _extends$2({}, commonProps, {
14622 innerProps: innerProps,
14623 isDisabled: isDisabled,
14624 isFocused: isFocused
14625 }));
14626 }
14627 }, {
14628 key: "renderIndicatorSeparator",
14629 value: function renderIndicatorSeparator() {
14630 var _this$components2 = this.components,
14631 DropdownIndicator = _this$components2.DropdownIndicator,
14632 IndicatorSeparator = _this$components2.IndicatorSeparator; // separator doesn't make sense without the dropdown indicator
14633
14634 if (!DropdownIndicator || !IndicatorSeparator) return null;
14635 var commonProps = this.commonProps;
14636 var isDisabled = this.props.isDisabled;
14637 var isFocused = this.state.isFocused;
14638 return React__default.createElement(IndicatorSeparator, _extends$2({}, commonProps, {
14639 isDisabled: isDisabled,
14640 isFocused: isFocused
14641 }));
14642 }
14643 }, {
14644 key: "renderDropdownIndicator",
14645 value: function renderDropdownIndicator() {
14646 var DropdownIndicator = this.components.DropdownIndicator;
14647 if (!DropdownIndicator) return null;
14648 var commonProps = this.commonProps;
14649 var isDisabled = this.props.isDisabled;
14650 var isFocused = this.state.isFocused;
14651 var innerProps = {
14652 onMouseDown: this.onDropdownIndicatorMouseDown,
14653 onTouchEnd: this.onDropdownIndicatorTouchEnd,
14654 'aria-hidden': 'true'
14655 };
14656 return React__default.createElement(DropdownIndicator, _extends$2({}, commonProps, {
14657 innerProps: innerProps,
14658 isDisabled: isDisabled,
14659 isFocused: isFocused
14660 }));
14661 }
14662 }, {
14663 key: "renderMenu",
14664 value: function renderMenu() {
14665 var _this5 = this;
14666
14667 var _this$components3 = this.components,
14668 Group = _this$components3.Group,
14669 GroupHeading = _this$components3.GroupHeading,
14670 Menu$$1 = _this$components3.Menu,
14671 MenuList$$1 = _this$components3.MenuList,
14672 MenuPortal$$1 = _this$components3.MenuPortal,
14673 LoadingMessage$$1 = _this$components3.LoadingMessage,
14674 NoOptionsMessage$$1 = _this$components3.NoOptionsMessage,
14675 Option = _this$components3.Option;
14676 var commonProps = this.commonProps;
14677 var _this$state9 = this.state,
14678 focusedOption = _this$state9.focusedOption,
14679 menuOptions = _this$state9.menuOptions;
14680 var _this$props18 = this.props,
14681 captureMenuScroll = _this$props18.captureMenuScroll,
14682 inputValue = _this$props18.inputValue,
14683 isLoading = _this$props18.isLoading,
14684 loadingMessage = _this$props18.loadingMessage,
14685 minMenuHeight = _this$props18.minMenuHeight,
14686 maxMenuHeight = _this$props18.maxMenuHeight,
14687 menuIsOpen = _this$props18.menuIsOpen,
14688 menuPlacement = _this$props18.menuPlacement,
14689 menuPosition = _this$props18.menuPosition,
14690 menuPortalTarget = _this$props18.menuPortalTarget,
14691 menuShouldBlockScroll = _this$props18.menuShouldBlockScroll,
14692 menuShouldScrollIntoView = _this$props18.menuShouldScrollIntoView,
14693 noOptionsMessage = _this$props18.noOptionsMessage,
14694 onMenuScrollToTop = _this$props18.onMenuScrollToTop,
14695 onMenuScrollToBottom = _this$props18.onMenuScrollToBottom;
14696 if (!menuIsOpen) return null; // TODO: Internal Option Type here
14697
14698 var render = function render(props) {
14699 // for performance, the menu options in state aren't changed when the
14700 // focused option changes so we calculate additional props based on that
14701 var isFocused = focusedOption === props.data;
14702 props.innerRef = isFocused ? _this5.getFocusedOptionRef : undefined;
14703 return React__default.createElement(Option, _extends$2({}, commonProps, props, {
14704 isFocused: isFocused
14705 }), _this5.formatOptionLabel(props.data, 'menu'));
14706 };
14707
14708 var menuUI;
14709
14710 if (this.hasOptions()) {
14711 menuUI = menuOptions.render.map(function (item) {
14712 if (item.type === 'group') {
14713 var type = item.type,
14714 group = _objectWithoutProperties(item, ["type"]);
14715
14716 var headingId = "".concat(item.key, "-heading");
14717 return React__default.createElement(Group, _extends$2({}, commonProps, group, {
14718 Heading: GroupHeading,
14719 headingProps: {
14720 id: headingId
14721 },
14722 label: _this5.formatGroupLabel(item.data)
14723 }), item.options.map(function (option) {
14724 return render(option);
14725 }));
14726 } else if (item.type === 'option') {
14727 return render(item);
14728 }
14729 });
14730 } else if (isLoading) {
14731 var message = loadingMessage({
14732 inputValue: inputValue
14733 });
14734 if (message === null) return null;
14735 menuUI = React__default.createElement(LoadingMessage$$1, commonProps, message);
14736 } else {
14737 var _message = noOptionsMessage({
14738 inputValue: inputValue
14739 });
14740
14741 if (_message === null) return null;
14742 menuUI = React__default.createElement(NoOptionsMessage$$1, commonProps, _message);
14743 }
14744
14745 var menuPlacementProps = {
14746 minMenuHeight: minMenuHeight,
14747 maxMenuHeight: maxMenuHeight,
14748 menuPlacement: menuPlacement,
14749 menuPosition: menuPosition,
14750 menuShouldScrollIntoView: menuShouldScrollIntoView
14751 };
14752 var menuElement = React__default.createElement(MenuPlacer, _extends$2({}, commonProps, menuPlacementProps), function (_ref6) {
14753 var ref = _ref6.ref,
14754 _ref6$placerProps = _ref6.placerProps,
14755 placement = _ref6$placerProps.placement,
14756 maxHeight = _ref6$placerProps.maxHeight;
14757 return React__default.createElement(Menu$$1, _extends$2({}, commonProps, menuPlacementProps, {
14758 innerRef: ref,
14759 innerProps: {
14760 onMouseDown: _this5.onMenuMouseDown,
14761 onMouseMove: _this5.onMenuMouseMove
14762 },
14763 isLoading: isLoading,
14764 placement: placement
14765 }), React__default.createElement(ScrollCaptorSwitch, {
14766 isEnabled: captureMenuScroll,
14767 onTopArrive: onMenuScrollToTop,
14768 onBottomArrive: onMenuScrollToBottom
14769 }, React__default.createElement(ScrollBlock, {
14770 isEnabled: menuShouldBlockScroll
14771 }, React__default.createElement(MenuList$$1, _extends$2({}, commonProps, {
14772 innerRef: _this5.getMenuListRef,
14773 isLoading: isLoading,
14774 maxHeight: maxHeight
14775 }), menuUI))));
14776 }); // positioning behaviour is almost identical for portalled and fixed,
14777 // so we use the same component. the actual portalling logic is forked
14778 // within the component based on `menuPosition`
14779
14780 return menuPortalTarget || menuPosition === 'fixed' ? React__default.createElement(MenuPortal$$1, _extends$2({}, commonProps, {
14781 appendTo: menuPortalTarget,
14782 controlElement: this.controlRef,
14783 menuPlacement: menuPlacement,
14784 menuPosition: menuPosition
14785 }), menuElement) : menuElement;
14786 }
14787 }, {
14788 key: "renderFormField",
14789 value: function renderFormField() {
14790 var _this6 = this;
14791
14792 var _this$props19 = this.props,
14793 delimiter = _this$props19.delimiter,
14794 isDisabled = _this$props19.isDisabled,
14795 isMulti = _this$props19.isMulti,
14796 name = _this$props19.name;
14797 var selectValue = this.state.selectValue;
14798 if (!name || isDisabled) return;
14799
14800 if (isMulti) {
14801 if (delimiter) {
14802 var value = selectValue.map(function (opt) {
14803 return _this6.getOptionValue(opt);
14804 }).join(delimiter);
14805 return React__default.createElement("input", {
14806 name: name,
14807 type: "hidden",
14808 value: value
14809 });
14810 } else {
14811 var input = selectValue.length > 0 ? selectValue.map(function (opt, i) {
14812 return React__default.createElement("input", {
14813 key: "i-".concat(i),
14814 name: name,
14815 type: "hidden",
14816 value: _this6.getOptionValue(opt)
14817 });
14818 }) : React__default.createElement("input", {
14819 name: name,
14820 type: "hidden"
14821 });
14822 return React__default.createElement("div", null, input);
14823 }
14824 } else {
14825 var _value = selectValue[0] ? this.getOptionValue(selectValue[0]) : '';
14826
14827 return React__default.createElement("input", {
14828 name: name,
14829 type: "hidden",
14830 value: _value
14831 });
14832 }
14833 }
14834 }, {
14835 key: "renderLiveRegion",
14836 value: function renderLiveRegion() {
14837 if (!this.state.isFocused) return null;
14838 return React__default.createElement(A11yText, {
14839 "aria-live": "assertive"
14840 }, React__default.createElement("p", {
14841 id: "aria-selection-event"
14842 }, "\xA0", this.state.ariaLiveSelection), React__default.createElement("p", {
14843 id: "aria-context"
14844 }, "\xA0", this.constructAriaLiveMessage()));
14845 }
14846 }, {
14847 key: "render",
14848 value: function render() {
14849 var _this$components4 = this.components,
14850 Control = _this$components4.Control,
14851 IndicatorsContainer = _this$components4.IndicatorsContainer,
14852 SelectContainer = _this$components4.SelectContainer,
14853 ValueContainer = _this$components4.ValueContainer;
14854 var _this$props20 = this.props,
14855 className = _this$props20.className,
14856 id = _this$props20.id,
14857 isDisabled = _this$props20.isDisabled,
14858 menuIsOpen = _this$props20.menuIsOpen;
14859 var isFocused = this.state.isFocused;
14860 var commonProps = this.commonProps = this.getCommonProps();
14861 return React__default.createElement(SelectContainer, _extends$2({}, commonProps, {
14862 className: className,
14863 innerProps: {
14864 id: id,
14865 onKeyDown: this.onKeyDown
14866 },
14867 isDisabled: isDisabled,
14868 isFocused: isFocused
14869 }), this.renderLiveRegion(), React__default.createElement(Control, _extends$2({}, commonProps, {
14870 innerRef: this.getControlRef,
14871 innerProps: {
14872 onMouseDown: this.onControlMouseDown,
14873 onTouchEnd: this.onControlTouchEnd
14874 },
14875 isDisabled: isDisabled,
14876 isFocused: isFocused,
14877 menuIsOpen: menuIsOpen
14878 }), React__default.createElement(ValueContainer, _extends$2({}, commonProps, {
14879 isDisabled: isDisabled
14880 }), this.renderPlaceholderOrValue(), this.renderInput()), React__default.createElement(IndicatorsContainer, _extends$2({}, commonProps, {
14881 isDisabled: isDisabled
14882 }), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderIndicatorSeparator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField());
14883 }
14884 }]);
14885
14886 return Select;
14887}(React.Component);
14888
14889_defineProperty$1(Select, "defaultProps", defaultProps);
14890
14891var defaultProps$1 = {
14892 defaultInputValue: '',
14893 defaultMenuIsOpen: false,
14894 defaultValue: null
14895};
14896
14897var manageState = function manageState(SelectComponent) {
14898 var _class, _temp;
14899
14900 return _temp = _class =
14901 /*#__PURE__*/
14902 function (_Component) {
14903 _inherits(StateManager, _Component);
14904
14905 function StateManager() {
14906 var _getPrototypeOf2;
14907
14908 var _this;
14909
14910 _classCallCheck(this, StateManager);
14911
14912 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
14913 args[_key] = arguments[_key];
14914 }
14915
14916 _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(StateManager)).call.apply(_getPrototypeOf2, [this].concat(args)));
14917
14918 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "select", void 0);
14919
14920 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "state", {
14921 inputValue: _this.props.inputValue !== undefined ? _this.props.inputValue : _this.props.defaultInputValue,
14922 menuIsOpen: _this.props.menuIsOpen !== undefined ? _this.props.menuIsOpen : _this.props.defaultMenuIsOpen,
14923 value: _this.props.value !== undefined ? _this.props.value : _this.props.defaultValue
14924 });
14925
14926 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onChange", function (value, actionMeta) {
14927 _this.callProp('onChange', value, actionMeta);
14928
14929 _this.setState({
14930 value: value
14931 });
14932 });
14933
14934 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onInputChange", function (value, actionMeta) {
14935 // TODO: for backwards compatibility, we allow the prop to return a new
14936 // value, but now inputValue is a controllable prop we probably shouldn't
14937 var newValue = _this.callProp('onInputChange', value, actionMeta);
14938
14939 _this.setState({
14940 inputValue: newValue !== undefined ? newValue : value
14941 });
14942 });
14943
14944 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onMenuOpen", function () {
14945 _this.callProp('onMenuOpen');
14946
14947 _this.setState({
14948 menuIsOpen: true
14949 });
14950 });
14951
14952 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onMenuClose", function () {
14953 _this.callProp('onMenuClose');
14954
14955 _this.setState({
14956 menuIsOpen: false
14957 });
14958 });
14959
14960 return _this;
14961 }
14962
14963 _createClass(StateManager, [{
14964 key: "focus",
14965 value: function focus() {
14966 this.select.focus();
14967 }
14968 }, {
14969 key: "blur",
14970 value: function blur() {
14971 this.select.blur();
14972 } // FIXME: untyped flow code, return any
14973
14974 }, {
14975 key: "getProp",
14976 value: function getProp(key) {
14977 return this.props[key] !== undefined ? this.props[key] : this.state[key];
14978 } // FIXME: untyped flow code, return any
14979
14980 }, {
14981 key: "callProp",
14982 value: function callProp(name) {
14983 if (typeof this.props[name] === 'function') {
14984 var _this$props;
14985
14986 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
14987 args[_key2 - 1] = arguments[_key2];
14988 }
14989
14990 return (_this$props = this.props)[name].apply(_this$props, args);
14991 }
14992 }
14993 }, {
14994 key: "render",
14995 value: function render() {
14996 var _this2 = this;
14997
14998 var _this$props2 = this.props,
14999 defaultInputValue = _this$props2.defaultInputValue,
15000 defaultMenuIsOpen = _this$props2.defaultMenuIsOpen,
15001 defaultValue = _this$props2.defaultValue,
15002 props = _objectWithoutProperties(_this$props2, ["defaultInputValue", "defaultMenuIsOpen", "defaultValue"]);
15003
15004 return React__default.createElement(SelectComponent, _extends$2({}, props, {
15005 ref: function ref(_ref) {
15006 _this2.select = _ref;
15007 },
15008 inputValue: this.getProp('inputValue'),
15009 menuIsOpen: this.getProp('menuIsOpen'),
15010 onChange: this.onChange,
15011 onInputChange: this.onInputChange,
15012 onMenuClose: this.onMenuClose,
15013 onMenuOpen: this.onMenuOpen,
15014 value: this.getProp('value')
15015 }));
15016 }
15017 }]);
15018
15019 return StateManager;
15020 }(React.Component), _defineProperty$1(_class, "defaultProps", defaultProps$1), _temp;
15021};
15022
15023var defaultProps$2 = {
15024 cacheOptions: false,
15025 defaultOptions: false,
15026 filterOption: null
15027};
15028var makeAsyncSelect = function makeAsyncSelect(SelectComponent) {
15029 var _class, _temp;
15030
15031 return _temp = _class =
15032 /*#__PURE__*/
15033 function (_Component) {
15034 _inherits(Async, _Component);
15035
15036 function Async(props) {
15037 var _this;
15038
15039 _classCallCheck(this, Async);
15040
15041 _this = _possibleConstructorReturn(this, _getPrototypeOf(Async).call(this));
15042
15043 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "select", void 0);
15044
15045 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "lastRequest", void 0);
15046
15047 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "mounted", false);
15048
15049 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "optionsCache", {});
15050
15051 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "handleInputChange", function (newValue, actionMeta) {
15052 var _this$props = _this.props,
15053 cacheOptions = _this$props.cacheOptions,
15054 onInputChange = _this$props.onInputChange; // TODO
15055
15056 var inputValue = handleInputChange(newValue, actionMeta, onInputChange);
15057
15058 if (!inputValue) {
15059 delete _this.lastRequest;
15060
15061 _this.setState({
15062 inputValue: '',
15063 loadedInputValue: '',
15064 loadedOptions: [],
15065 isLoading: false,
15066 passEmptyOptions: false
15067 });
15068
15069 return;
15070 }
15071
15072 if (cacheOptions && _this.optionsCache[inputValue]) {
15073 _this.setState({
15074 inputValue: inputValue,
15075 loadedInputValue: inputValue,
15076 loadedOptions: _this.optionsCache[inputValue],
15077 isLoading: false,
15078 passEmptyOptions: false
15079 });
15080 } else {
15081 var request = _this.lastRequest = {};
15082
15083 _this.setState({
15084 inputValue: inputValue,
15085 isLoading: true,
15086 passEmptyOptions: !_this.state.loadedInputValue
15087 }, function () {
15088 _this.loadOptions(inputValue, function (options) {
15089 if (!_this.mounted) return;
15090
15091 if (options) {
15092 _this.optionsCache[inputValue] = options;
15093 }
15094
15095 if (request !== _this.lastRequest) return;
15096 delete _this.lastRequest;
15097
15098 _this.setState({
15099 isLoading: false,
15100 loadedInputValue: inputValue,
15101 loadedOptions: options || [],
15102 passEmptyOptions: false
15103 });
15104 });
15105 });
15106 }
15107
15108 return inputValue;
15109 });
15110
15111 _this.state = {
15112 defaultOptions: Array.isArray(props.defaultOptions) ? props.defaultOptions : undefined,
15113 inputValue: typeof props.inputValue !== 'undefined' ? props.inputValue : '',
15114 isLoading: props.defaultOptions === true ? true : false,
15115 loadedOptions: [],
15116 passEmptyOptions: false
15117 };
15118 return _this;
15119 }
15120
15121 _createClass(Async, [{
15122 key: "componentDidMount",
15123 value: function componentDidMount() {
15124 var _this2 = this;
15125
15126 this.mounted = true;
15127 var defaultOptions = this.props.defaultOptions;
15128 var inputValue = this.state.inputValue;
15129
15130 if (defaultOptions === true) {
15131 this.loadOptions(inputValue, function (options) {
15132 if (!_this2.mounted) return;
15133 var isLoading = !!_this2.lastRequest;
15134
15135 _this2.setState({
15136 defaultOptions: options || [],
15137 isLoading: isLoading
15138 });
15139 });
15140 }
15141 }
15142 }, {
15143 key: "componentWillReceiveProps",
15144 value: function componentWillReceiveProps(nextProps) {
15145 // if the cacheOptions prop changes, clear the cache
15146 if (nextProps.cacheOptions !== this.props.cacheOptions) {
15147 this.optionsCache = {};
15148 }
15149
15150 if (nextProps.defaultOptions !== this.props.defaultOptions) {
15151 this.setState({
15152 defaultOptions: Array.isArray(nextProps.defaultOptions) ? nextProps.defaultOptions : undefined
15153 });
15154 }
15155 }
15156 }, {
15157 key: "componentWillUnmount",
15158 value: function componentWillUnmount() {
15159 this.mounted = false;
15160 }
15161 }, {
15162 key: "focus",
15163 value: function focus() {
15164 this.select.focus();
15165 }
15166 }, {
15167 key: "blur",
15168 value: function blur() {
15169 this.select.blur();
15170 }
15171 }, {
15172 key: "loadOptions",
15173 value: function loadOptions(inputValue, callback) {
15174 var loadOptions = this.props.loadOptions;
15175 if (!loadOptions) return callback();
15176 var loader = loadOptions(inputValue, callback);
15177
15178 if (loader && typeof loader.then === 'function') {
15179 loader.then(callback, function () {
15180 return callback();
15181 });
15182 }
15183 }
15184 }, {
15185 key: "render",
15186 value: function render() {
15187 var _this3 = this;
15188
15189 var _this$props2 = this.props,
15190 loadOptions = _this$props2.loadOptions,
15191 props = _objectWithoutProperties(_this$props2, ["loadOptions"]);
15192
15193 var _this$state = this.state,
15194 defaultOptions = _this$state.defaultOptions,
15195 inputValue = _this$state.inputValue,
15196 isLoading = _this$state.isLoading,
15197 loadedInputValue = _this$state.loadedInputValue,
15198 loadedOptions = _this$state.loadedOptions,
15199 passEmptyOptions = _this$state.passEmptyOptions;
15200 var options = passEmptyOptions ? [] : inputValue && loadedInputValue ? loadedOptions : defaultOptions || [];
15201 return React__default.createElement(SelectComponent, _extends$2({}, props, {
15202 ref: function ref(_ref) {
15203 _this3.select = _ref;
15204 },
15205 options: options,
15206 isLoading: isLoading,
15207 onInputChange: this.handleInputChange
15208 }));
15209 }
15210 }]);
15211
15212 return Async;
15213 }(React.Component), _defineProperty$1(_class, "defaultProps", defaultProps$2), _temp;
15214};
15215var SelectState = manageState(Select);
15216var Async = makeAsyncSelect(SelectState);
15217
15218var compareOption = function compareOption() {
15219 var inputValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
15220 var option = arguments.length > 1 ? arguments[1] : undefined;
15221 var candidate = String(inputValue).toLowerCase();
15222 var optionValue = String(option.value).toLowerCase();
15223 var optionLabel = String(option.label).toLowerCase();
15224 return optionValue === candidate || optionLabel === candidate;
15225};
15226
15227var builtins = {
15228 formatCreateLabel: function formatCreateLabel(inputValue) {
15229 return "Create \"".concat(inputValue, "\"");
15230 },
15231 isValidNewOption: function isValidNewOption(inputValue, selectValue, selectOptions) {
15232 return !(!inputValue || selectValue.some(function (option) {
15233 return compareOption(inputValue, option);
15234 }) || selectOptions.some(function (option) {
15235 return compareOption(inputValue, option);
15236 }));
15237 },
15238 getNewOptionData: function getNewOptionData(inputValue, optionLabel) {
15239 return {
15240 label: optionLabel,
15241 value: inputValue,
15242 __isNew__: true
15243 };
15244 }
15245};
15246var defaultProps$3 = _objectSpread({
15247 allowCreateWhileLoading: false,
15248 createOptionPosition: 'last'
15249}, builtins);
15250var makeCreatableSelect = function makeCreatableSelect(SelectComponent) {
15251 var _class, _temp;
15252
15253 return _temp = _class =
15254 /*#__PURE__*/
15255 function (_Component) {
15256 _inherits(Creatable, _Component);
15257
15258 function Creatable(props) {
15259 var _this;
15260
15261 _classCallCheck(this, Creatable);
15262
15263 _this = _possibleConstructorReturn(this, _getPrototypeOf(Creatable).call(this, props));
15264
15265 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "select", void 0);
15266
15267 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onChange", function (newValue, actionMeta) {
15268 var _this$props = _this.props,
15269 getNewOptionData = _this$props.getNewOptionData,
15270 inputValue = _this$props.inputValue,
15271 isMulti = _this$props.isMulti,
15272 onChange = _this$props.onChange,
15273 onCreateOption = _this$props.onCreateOption,
15274 value = _this$props.value;
15275
15276 if (actionMeta.action !== 'select-option') {
15277 return onChange(newValue, actionMeta);
15278 }
15279
15280 var newOption = _this.state.newOption;
15281 var valueArray = Array.isArray(newValue) ? newValue : [newValue];
15282
15283 if (valueArray[valueArray.length - 1] === newOption) {
15284 if (onCreateOption) onCreateOption(inputValue);else {
15285 var newOptionData = getNewOptionData(inputValue, inputValue);
15286 var newActionMeta = {
15287 action: 'create-option'
15288 };
15289
15290 if (isMulti) {
15291 onChange([].concat(_toConsumableArray(cleanValue(value)), [newOptionData]), newActionMeta);
15292 } else {
15293 onChange(newOptionData, newActionMeta);
15294 }
15295 }
15296 return;
15297 }
15298
15299 onChange(newValue, actionMeta);
15300 });
15301
15302 var options = props.options || [];
15303 _this.state = {
15304 newOption: undefined,
15305 options: options
15306 };
15307 return _this;
15308 }
15309
15310 _createClass(Creatable, [{
15311 key: "componentWillReceiveProps",
15312 value: function componentWillReceiveProps(nextProps) {
15313 var allowCreateWhileLoading = nextProps.allowCreateWhileLoading,
15314 createOptionPosition = nextProps.createOptionPosition,
15315 formatCreateLabel = nextProps.formatCreateLabel,
15316 getNewOptionData = nextProps.getNewOptionData,
15317 inputValue = nextProps.inputValue,
15318 isLoading = nextProps.isLoading,
15319 isValidNewOption = nextProps.isValidNewOption,
15320 value = nextProps.value;
15321 var options = nextProps.options || [];
15322 var newOption = this.state.newOption;
15323
15324 if (isValidNewOption(inputValue, cleanValue(value), options)) {
15325 newOption = getNewOptionData(inputValue, formatCreateLabel(inputValue));
15326 } else {
15327 newOption = undefined;
15328 }
15329
15330 this.setState({
15331 newOption: newOption,
15332 options: (allowCreateWhileLoading || !isLoading) && newOption ? createOptionPosition === 'first' ? [newOption].concat(_toConsumableArray(options)) : [].concat(_toConsumableArray(options), [newOption]) : options
15333 });
15334 }
15335 }, {
15336 key: "focus",
15337 value: function focus() {
15338 this.select.focus();
15339 }
15340 }, {
15341 key: "blur",
15342 value: function blur() {
15343 this.select.blur();
15344 }
15345 }, {
15346 key: "render",
15347 value: function render() {
15348 var _this2 = this;
15349
15350 var props = _extends$2({}, this.props);
15351
15352 var options = this.state.options;
15353 return React__default.createElement(SelectComponent, _extends$2({}, props, {
15354 ref: function ref(_ref) {
15355 _this2.select = _ref;
15356 },
15357 options: options,
15358 onChange: this.onChange
15359 }));
15360 }
15361 }]);
15362
15363 return Creatable;
15364 }(React.Component), _defineProperty$1(_class, "defaultProps", defaultProps$3), _temp;
15365}; // TODO: do this in package entrypoint
15366
15367var SelectCreatable = makeCreatableSelect(Select);
15368var Creatable = manageState(SelectCreatable);
15369
15370var SelectCreatable$1 = makeCreatableSelect(Select);
15371var SelectCreatableState = manageState(SelectCreatable$1);
15372var AsyncCreatable = makeAsyncSelect(SelectCreatableState);
15373
15374// strip transition props off before spreading onto select component
15375// note we need to be explicit about innerRef for flow
15376var AnimatedInput = function AnimatedInput(WrappedComponent) {
15377 return function (_ref) {
15378 var inProp = _ref.in,
15379 onExited = _ref.onExited,
15380 appear = _ref.appear,
15381 enter = _ref.enter,
15382 exit = _ref.exit,
15383 props = _objectWithoutProperties(_ref, ["in", "onExited", "appear", "enter", "exit"]);
15384
15385 return React__default.createElement(WrappedComponent, props);
15386 };
15387};
15388
15389var Fade = function Fade(_ref) {
15390 var Tag = _ref.component,
15391 _ref$duration = _ref.duration,
15392 duration = _ref$duration === void 0 ? 1 : _ref$duration,
15393 inProp = _ref.in,
15394 onExited = _ref.onExited,
15395 props = _objectWithoutProperties(_ref, ["component", "duration", "in", "onExited"]);
15396
15397 var transition = {
15398 entering: {
15399 opacity: 0
15400 },
15401 entered: {
15402 opacity: 1,
15403 transition: "opacity ".concat(duration, "ms")
15404 },
15405 exiting: {
15406 opacity: 0
15407 },
15408 exited: {
15409 opacity: 0
15410 }
15411 };
15412 return React__default.createElement(reactTransitionGroup_1, {
15413 mountOnEnter: true,
15414 unmountOnExit: true,
15415 in: inProp,
15416 timeout: duration
15417 }, function (state) {
15418 var innerProps = {
15419 style: _objectSpread({}, transition[state])
15420 };
15421 return React__default.createElement(Tag, _extends$2({
15422 innerProps: innerProps
15423 }, props));
15424 });
15425}; // ==============================
15426// Collapse Transition
15427// ==============================
15428
15429var collapseDuration = 260;
15430// wrap each MultiValue with a collapse transition; decreases width until
15431// finally removing from DOM
15432var Collapse =
15433/*#__PURE__*/
15434function (_Component) {
15435 _inherits(Collapse, _Component);
15436
15437 function Collapse() {
15438 var _getPrototypeOf2;
15439
15440 var _this;
15441
15442 _classCallCheck(this, Collapse);
15443
15444 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
15445 args[_key] = arguments[_key];
15446 }
15447
15448 _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Collapse)).call.apply(_getPrototypeOf2, [this].concat(args)));
15449
15450 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "duration", collapseDuration);
15451
15452 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "rafID", void 0);
15453
15454 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "state", {
15455 width: 'auto'
15456 });
15457
15458 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "transition", {
15459 exiting: {
15460 width: 0,
15461 transition: "width ".concat(_this.duration, "ms ease-out")
15462 },
15463 exited: {
15464 width: 0
15465 }
15466 });
15467
15468 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getWidth", function (ref) {
15469 if (ref && isNaN(_this.state.width)) {
15470 /*
15471 Here we're invoking requestAnimationFrame with a callback invoking our
15472 call to getBoundingClientRect and setState in order to resolve an edge case
15473 around portalling. Certain portalling solutions briefly remove children from the DOM
15474 before appending them to the target node. This is to avoid us trying to call getBoundingClientrect
15475 while the Select component is in this state.
15476 */
15477 // cannot use `offsetWidth` because it is rounded
15478 _this.rafID = window.requestAnimationFrame(function () {
15479 var _ref$getBoundingClien = ref.getBoundingClientRect(),
15480 width = _ref$getBoundingClien.width;
15481
15482 _this.setState({
15483 width: width
15484 });
15485 });
15486 }
15487 });
15488
15489 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getStyle", function (width) {
15490 return {
15491 overflow: 'hidden',
15492 whiteSpace: 'nowrap',
15493 width: width
15494 };
15495 });
15496
15497 _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getTransition", function (state) {
15498 return _this.transition[state];
15499 });
15500
15501 return _this;
15502 }
15503
15504 _createClass(Collapse, [{
15505 key: "componentWillUnmount",
15506 value: function componentWillUnmount() {
15507 if (this.rafID) {
15508 window.cancelAnimationFrame(this.rafID);
15509 }
15510 } // width must be calculated; cannot transition from `undefined` to `number`
15511
15512 }, {
15513 key: "render",
15514 value: function render() {
15515 var _this2 = this;
15516
15517 var _this$props = this.props,
15518 children = _this$props.children,
15519 inProp = _this$props.in;
15520 var width = this.state.width;
15521 return React__default.createElement(reactTransitionGroup_1, {
15522 enter: false,
15523 mountOnEnter: true,
15524 unmountOnExit: true,
15525 in: inProp,
15526 timeout: this.duration
15527 }, function (state) {
15528 var style = _objectSpread({}, _this2.getStyle(width), _this2.getTransition(state));
15529
15530 return React__default.createElement("div", {
15531 ref: _this2.getWidth,
15532 style: style
15533 }, children);
15534 });
15535 }
15536 }]);
15537
15538 return Collapse;
15539}(React.Component);
15540
15541var AnimatedMultiValue = function AnimatedMultiValue(WrappedComponent) {
15542 return function (_ref) {
15543 var inProp = _ref.in,
15544 onExited = _ref.onExited,
15545 props = _objectWithoutProperties(_ref, ["in", "onExited"]);
15546
15547 return React__default.createElement(Collapse, {
15548 in: inProp,
15549 onExited: onExited
15550 }, React__default.createElement(WrappedComponent, _extends$2({
15551 cropWithEllipsis: inProp
15552 }, props)));
15553 };
15554};
15555
15556var AnimatedPlaceholder = function AnimatedPlaceholder(WrappedComponent) {
15557 return function (props) {
15558 return React__default.createElement(Fade, _extends$2({
15559 component: WrappedComponent,
15560 duration: props.isMulti ? collapseDuration : 1
15561 }, props));
15562 };
15563};
15564
15565var AnimatedSingleValue = function AnimatedSingleValue(WrappedComponent) {
15566 return function (props) {
15567 return React__default.createElement(Fade, _extends$2({
15568 component: WrappedComponent
15569 }, props));
15570 };
15571};
15572
15573// make ValueContainer a transition group
15574var AnimatedValueContainer = function AnimatedValueContainer(WrappedComponent) {
15575 return function (props) {
15576 return React__default.createElement(reactTransitionGroup_2, _extends$2({
15577 component: WrappedComponent
15578 }, props));
15579 };
15580};
15581
15582var makeAnimated = function makeAnimated() {
15583 var externalComponents = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
15584 var components$$1 = defaultComponents({
15585 components: externalComponents
15586 });
15587
15588 var Input = components$$1.Input,
15589 MultiValue = components$$1.MultiValue,
15590 Placeholder = components$$1.Placeholder,
15591 SingleValue = components$$1.SingleValue,
15592 ValueContainer = components$$1.ValueContainer,
15593 rest = _objectWithoutProperties(components$$1, ["Input", "MultiValue", "Placeholder", "SingleValue", "ValueContainer"]);
15594
15595 return _objectSpread({
15596 Input: AnimatedInput(Input),
15597 MultiValue: AnimatedMultiValue(MultiValue),
15598 Placeholder: AnimatedPlaceholder(Placeholder),
15599 SingleValue: AnimatedSingleValue(SingleValue),
15600 ValueContainer: AnimatedValueContainer(ValueContainer)
15601 }, rest);
15602};
15603
15604var AnimatedComponents = makeAnimated();
15605var Input$1$1 = AnimatedComponents.Input;
15606var MultiValue$1 = AnimatedComponents.MultiValue;
15607var Placeholder$1 = AnimatedComponents.Placeholder;
15608var SingleValue$1 = AnimatedComponents.SingleValue;
15609var ValueContainer$1 = AnimatedComponents.ValueContainer;
15610var index$4 = index$2(makeAnimated, exportedEqual);
15611
15612var index$1$1 = manageState(Select);
15613
15614function _templateObject$L() {
15615 var data = taggedTemplateLiteralLoose(["\n\tpointer-events: none;\n"]);
15616
15617 _templateObject$L = function _templateObject() {
15618 return data;
15619 };
15620
15621 return data;
15622}
15623
15624var MultiInputOption = function MultiInputOption(_ref) {
15625 var children = _ref.children,
15626 isSelected = _ref.isSelected,
15627 props = objectWithoutPropertiesLoose(_ref, ["children", "isSelected"]);
15628
15629 return React__default.createElement(components.Option, props, React__default.createElement(CheckboxEventLess, null, React__default.createElement(Checkbox, {
15630 label: children,
15631 checked: isSelected
15632 })));
15633};
15634
15635var CheckboxEventLess = styled__default.div(_templateObject$L());
15636MultiInputOption.defaultProps = {
15637 classNamePrefix: 'multi-input-option',
15638 children: null,
15639 isSelected: false
15640};
15641MultiInputOption.displayName = 'MultiInputOption';
15642MultiInputOption.propTypes = {
15643 isSelected: PropTypes.bool,
15644 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
15645 classNamePrefix: PropTypes.string
15646};
15647
15648var MultiInputValueContainer = function MultiInputValueContainer(_ref) {
15649 var children = _ref.children,
15650 getValue = _ref.getValue,
15651 selectProps = _ref.selectProps,
15652 props = objectWithoutPropertiesLoose(_ref, ["children", "getValue", "selectProps"]);
15653
15654 var valueLength = getValue().length;
15655 var inputValue = selectProps.inputValue,
15656 formatMessage = selectProps.formatMessage;
15657 return React__default.createElement(components.ValueContainer, props, !inputValue && formatMessage(valueLength), React__default.Children.map(children, function (child) {
15658 return child && child.type === components.Input ? child : null;
15659 }));
15660};
15661
15662MultiInputValueContainer.defaultProps = {
15663 getValue: undefined,
15664 selectProps: {},
15665 children: null
15666};
15667MultiInputValueContainer.propTypes = {
15668 getValue: PropTypes.func,
15669 selectProps: PropTypes.shape({
15670 inputValue: PropTypes.string,
15671 formatMessage: PropTypes.func
15672 }),
15673 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])
15674};
15675
15676function _templateObject$M() {
15677 var data = taggedTemplateLiteralLoose(["\n\t& .select__placeholder {\n\t\tcolor: ", ";\n\t}\n\t& .select__control {\n\t\tmin-height: 34px;\n\t\tborder-radius: ", ";\n\t}\n\t& .select__menu {\n\t\tz-index: 3;\n\t\tpadding: ", ";\n\t\tborder-radius: ", ";\n\t}\n\t& .select__option {\n\t\tmargin-top: 2px;\n\t\tmargin-bottom: 2px;\n\t\tborder-radius: ", " !important;\n\t\tcursor: pointer;\n\t}\n\t& .select__option--is-focused {\n\t\tbackground-color: ", " !important;\n\t}\n\t& .select__option--is-selected {\n\t\tbackground-color: ", " !important;\n\t}\n\t& .select__value-container {\n\t\tpadding: 0 8px;\n\t}\n\t& .select__indicator {\n\t\twidth: 32px;\n\t\theight: 32px;\n\t}\n\t& .select__indicator-separator {\n\t\tdisplay: none;\n\t}\n"]);
15678
15679 _templateObject$M = function _templateObject() {
15680 return data;
15681 };
15682
15683 return data;
15684}
15685var SelectStyled = styled__default(index$1$1)(_templateObject$M(), function (_ref) {
15686 var theme = _ref.theme;
15687 return theme.select.placeholderColor;
15688}, function (_ref2) {
15689 var theme = _ref2.theme;
15690 return theme.select.borderRadius;
15691}, function (_ref3) {
15692 var theme = _ref3.theme;
15693 return theme.select.menuPadding;
15694}, function (_ref4) {
15695 var theme = _ref4.theme;
15696 return theme.select.borderRadius;
15697}, function (_ref5) {
15698 var theme = _ref5.theme;
15699 return theme.select.borderRadius;
15700}, function (_ref6) {
15701 var theme = _ref6.theme;
15702 return theme.select.focusedBackgroundColor;
15703}, function (_ref7) {
15704 var theme = _ref7.theme;
15705 return theme.select.selectedBackgroundColor;
15706});
15707
15708var Select$1 = function Select$$1(_ref8) {
15709 var isMulti = _ref8.isMulti,
15710 props = objectWithoutPropertiesLoose(_ref8, ["isMulti"]);
15711
15712 if (isMulti) {
15713 props = _extends_1({}, props, {
15714 isMulti: isMulti,
15715 hideSelectedOptions: false,
15716 closeMenuOnSelect: false,
15717 components: {
15718 Option: MultiInputOption,
15719 ValueContainer: MultiInputValueContainer
15720 }
15721 });
15722 }
15723
15724 return React__default.createElement(SelectStyled, props);
15725};
15726
15727Select$1.defaultProps = {
15728 isMulti: false,
15729 classNamePrefix: 'select',
15730 formatMessage: function formatMessage(elem) {
15731 return elem;
15732 }
15733};
15734Select$1.displayName = 'Select';
15735Select$1.propTypes = {
15736 /** If users are allowed to select more than one option */
15737 isMulti: PropTypes.bool,
15738
15739 /** String to be pre-appended to internal classNames */
15740 classNamePrefix: PropTypes.string,
15741
15742 /** Function to format multi select label container */
15743 formatMessage: PropTypes.func
15744};
15745
15746function _templateObject$N() {
15747 var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-block;\n\tcursor: pointer;\n"]);
15748
15749 _templateObject$N = function _templateObject() {
15750 return data;
15751 };
15752
15753 return data;
15754}
15755
15756var Collapse$1 = function Collapse(_ref) {
15757 var trigger = _ref.trigger,
15758 children = _ref.children;
15759
15760 var _useState = React.useState(false),
15761 open = _useState[0],
15762 setOpen = _useState[1];
15763
15764 return React__default.createElement(React.Fragment, null, React__default.createElement(Wrapper, {
15765 onClick: function onClick() {
15766 return setOpen(!open);
15767 }
15768 }, trigger), React__default.createElement(reactSpring.Spring, {
15769 from: {
15770 height: open ? 0 : 'auto',
15771 opacity: open ? 0 : 1
15772 },
15773 to: {
15774 height: open ? 'auto' : 0,
15775 opacity: open ? 1 : 0
15776 },
15777 after: {
15778 display: open ? 'block' : 'none'
15779 }
15780 }, function (props) {
15781 return React__default.createElement("div", {
15782 open: open,
15783 className: "show",
15784 style: props
15785 }, children);
15786 }));
15787};
15788
15789var Wrapper = styled__default.div(_templateObject$N());
15790Wrapper.displayName = 'Wrapper';
15791Collapse$1.displayName = 'Collapse';
15792Collapse$1.defaultPropTypes = {
15793 children: null,
15794 trigger: null
15795};
15796Collapse$1.propTypes = {
15797 /** Trigger element */
15798 trigger: PropTypes.node.isRequired,
15799
15800 /** hidden element */
15801 children: PropTypes.node.isRequired
15802};
15803
15804function _templateObject6$3() {
15805 var data = taggedTemplateLiteralLoose(["\n\tdisplay: ", ";\n\tpadding: 20px;\n\tborder: thin solid ", ";\n\tborder-radius: 0 0 4px 4px;\n"]);
15806
15807 _templateObject6$3 = function _templateObject6() {
15808 return data;
15809 };
15810
15811 return data;
15812}
15813
15814function _templateObject5$4() {
15815 var data = taggedTemplateLiteralLoose(["\n\tmargin-right: 6px;\n\tcolor: ", ";\n\tfont-size: 13px;\n\ttext-transform: uppercase;\n"]);
15816
15817 _templateObject5$4 = function _templateObject5() {
15818 return data;
15819 };
15820
15821 return data;
15822}
15823
15824function _templateObject4$9() {
15825 var data = taggedTemplateLiteralLoose(["\n\tcolor: ", " !important;\n\ttransform: ", ";\n\ttransition: 0.33s;\n"]);
15826
15827 _templateObject4$9 = function _templateObject4() {
15828 return data;
15829 };
15830
15831 return data;
15832}
15833
15834function _templateObject3$c() {
15835 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n"]);
15836
15837 _templateObject3$c = function _templateObject3() {
15838 return data;
15839 };
15840
15841 return data;
15842}
15843
15844function _templateObject2$h() {
15845 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\talign-items: center;\n\tjustify-content: space-between;\n\tpadding: 12px 20px;\n\n\tbackground: ", ";\n\tborder-radius: ", ";\n\tcolor: white;\n\tcursor: ", ";\n"]);
15846
15847 _templateObject2$h = function _templateObject2() {
15848 return data;
15849 };
15850
15851 return data;
15852}
15853
15854function _templateObject$O() {
15855 var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-flex;\n\tmargin-right: 18px;\n\tmargin-left: auto;\n"]);
15856
15857 _templateObject$O = function _templateObject() {
15858 return data;
15859 };
15860
15861 return data;
15862}
15863
15864var Expandable = function Expandable(_ref) {
15865 var title = _ref.title,
15866 icon = _ref.icon,
15867 tooltip = _ref.tooltip,
15868 children = _ref.children,
15869 open = _ref.open,
15870 disabled = _ref.disabled,
15871 onClick = _ref.onClick,
15872 headerComponent = _ref.headerComponent,
15873 props = objectWithoutPropertiesLoose(_ref, ["title", "icon", "tooltip", "children", "open", "disabled", "onClick", "headerComponent"]);
15874
15875 var id = title.replace(/ /g, '-');
15876 var color = disabled ? colors.gray : colors.yellow;
15877 var text = disabled ? '' : tooltip;
15878
15879 var handleOnClick = function handleOnClick(e) {
15880 return disabled ? e.stopPropagation() : onClick();
15881 };
15882
15883 return React__default.createElement(React.Fragment, null, React__default.createElement(ExpandableHeader, _extends_1({
15884 onClick: handleOnClick,
15885 open: open,
15886 disabled: disabled
15887 }, props), React__default.createElement(Flex$1, null, React__default.createElement(Title$1, {
15888 disabled: disabled
15889 }, title), icon && React__default.createElement(HelpTooltip, {
15890 id: id,
15891 disabled: disabled,
15892 icon: icon,
15893 color: color,
15894 text: text,
15895 place: "bottom",
15896 multiline: true
15897 })), headerComponent && React__default.createElement(HeaderComponentContainer, {
15898 onClick: function onClick(e) {
15899 return e.stopPropagation();
15900 }
15901 }, headerComponent), React__default.createElement(IconAnimated, {
15902 open: open,
15903 icon: "select-down",
15904 color: "#FFF",
15905 disabled: disabled
15906 })), React__default.createElement(ExpandableContent, {
15907 open: open,
15908 disabled: disabled
15909 }, children));
15910};
15911
15912var HeaderComponentContainer = styled__default.div(_templateObject$O());
15913HeaderComponentContainer.displayName = 'HeaderComponentContainer';
15914var ExpandableHeader = styled__default.div(_templateObject2$h(), function (_ref2) {
15915 var open = _ref2.open,
15916 disabled = _ref2.disabled,
15917 theme = _ref2.theme;
15918 return disabled ? theme.colors.strokeGray : open ? theme.colors.deepBlue : theme.colors.activeBlue;
15919}, function (_ref3) {
15920 var open = _ref3.open;
15921 return open ? '4px 4px 0 0' : '4px';
15922}, function (_ref4) {
15923 var disabled = _ref4.disabled;
15924 return disabled ? 'not-allowed' : 'pointer';
15925});
15926ExpandableHeader.displayName = 'ExpandableHeader';
15927var Flex$1 = styled__default.div(_templateObject3$c());
15928var IconAnimated = styled__default(Icon)(_templateObject4$9(), function (_ref5) {
15929 var disabled = _ref5.disabled,
15930 theme = _ref5.theme;
15931 return disabled ? theme.colors.gray : 'white';
15932}, function (_ref6) {
15933 var open = _ref6.open;
15934 return open && 'rotate(180deg)';
15935});
15936IconAnimated.displayName = 'IconAnimated';
15937var Title$1 = styled__default.div(_templateObject5$4(), function (_ref7) {
15938 var disabled = _ref7.disabled,
15939 theme = _ref7.theme;
15940 return disabled ? theme.colors.gray : 'white';
15941});
15942var ExpandableContent = styled__default.div(_templateObject6$3(), function (_ref8) {
15943 var open = _ref8.open;
15944 return open ? 'block' : 'none';
15945}, function (_ref9) {
15946 var disabled = _ref9.disabled,
15947 theme = _ref9.theme;
15948 return disabled ? theme.colors.strokeGray : theme.colors.deepBlue;
15949});
15950ExpandableContent.displayName = 'ExpandableContent';
15951Expandable.displayName = 'Expandable';
15952Expandable.defaultProps = {
15953 icon: null,
15954 tooltip: null,
15955 disabled: false,
15956 headerComponent: null
15957};
15958Expandable.propTypes = {
15959 /** Title */
15960 title: PropTypes.string.isRequired,
15961
15962 /** Disabled flag */
15963 disabled: PropTypes.bool,
15964
15965 /** Warning icon name */
15966 icon: PropTypes.string,
15967
15968 /** Anything that can be rendered */
15969 children: PropTypes.node.isRequired,
15970
15971 /** Tooltip text message */
15972 tooltip: PropTypes.string,
15973
15974 /** If it is open prop */
15975 open: PropTypes.bool.isRequired,
15976
15977 /** Set onClick handler */
15978 onClick: PropTypes.func.isRequired,
15979
15980 /** Displayed component to the arrow's left side */
15981 headerComponent: PropTypes.node
15982};
15983
15984var ExpandableSection = function ExpandableSection(_ref) {
15985 var title = _ref.title,
15986 icon = _ref.icon,
15987 children = _ref.children,
15988 tooltip = _ref.tooltip,
15989 disabled = _ref.disabled,
15990 props = objectWithoutPropertiesLoose(_ref, ["title", "icon", "children", "tooltip", "disabled"]);
15991
15992 var _useState = React.useState(false),
15993 open = _useState[0],
15994 setOpen = _useState[1];
15995
15996 return React__default.createElement(Expandable, _extends_1({
15997 title: title,
15998 icon: icon,
15999 tooltip: tooltip,
16000 onClick: function onClick() {
16001 return setOpen(!open);
16002 },
16003 open: open,
16004 disabled: disabled
16005 }, props), children);
16006};
16007
16008ExpandableSection.displayName = 'ExpandableSection';
16009ExpandableSection.defaultProps = {
16010 icon: null,
16011 tooltip: null,
16012 disabled: false,
16013 headerComponent: null
16014};
16015ExpandableSection.propTypes = {
16016 /** Title */
16017 title: PropTypes.string.isRequired,
16018
16019 /** Warning icon name */
16020 icon: PropTypes.string,
16021
16022 /** Anything that can be rendered */
16023 children: PropTypes.node.isRequired,
16024
16025 /** Tooltip text message */
16026 tooltip: PropTypes.string,
16027
16028 /** Disabled flag */
16029 disabled: PropTypes.bool,
16030
16031 /** Displayed component to the arrow's left side */
16032 headerComponent: PropTypes.node
16033};
16034
16035var moment = createCommonjsModule(function (module, exports) {
16036(function (global, factory) {
16037 module.exports = factory();
16038}(commonjsGlobal, (function () {
16039 var hookCallback;
16040
16041 function hooks () {
16042 return hookCallback.apply(null, arguments);
16043 }
16044
16045 // This is done to register the method called with moment()
16046 // without creating circular dependencies.
16047 function setHookCallback (callback) {
16048 hookCallback = callback;
16049 }
16050
16051 function isArray(input) {
16052 return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]';
16053 }
16054
16055 function isObject(input) {
16056 // IE8 will treat undefined and null as object if it wasn't for
16057 // input != null
16058 return input != null && Object.prototype.toString.call(input) === '[object Object]';
16059 }
16060
16061 function isObjectEmpty(obj) {
16062 if (Object.getOwnPropertyNames) {
16063 return (Object.getOwnPropertyNames(obj).length === 0);
16064 } else {
16065 var k;
16066 for (k in obj) {
16067 if (obj.hasOwnProperty(k)) {
16068 return false;
16069 }
16070 }
16071 return true;
16072 }
16073 }
16074
16075 function isUndefined(input) {
16076 return input === void 0;
16077 }
16078
16079 function isNumber(input) {
16080 return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]';
16081 }
16082
16083 function isDate(input) {
16084 return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
16085 }
16086
16087 function map(arr, fn) {
16088 var res = [], i;
16089 for (i = 0; i < arr.length; ++i) {
16090 res.push(fn(arr[i], i));
16091 }
16092 return res;
16093 }
16094
16095 function hasOwnProp(a, b) {
16096 return Object.prototype.hasOwnProperty.call(a, b);
16097 }
16098
16099 function extend(a, b) {
16100 for (var i in b) {
16101 if (hasOwnProp(b, i)) {
16102 a[i] = b[i];
16103 }
16104 }
16105
16106 if (hasOwnProp(b, 'toString')) {
16107 a.toString = b.toString;
16108 }
16109
16110 if (hasOwnProp(b, 'valueOf')) {
16111 a.valueOf = b.valueOf;
16112 }
16113
16114 return a;
16115 }
16116
16117 function createUTC (input, format, locale, strict) {
16118 return createLocalOrUTC(input, format, locale, strict, true).utc();
16119 }
16120
16121 function defaultParsingFlags() {
16122 // We need to deep clone this object.
16123 return {
16124 empty : false,
16125 unusedTokens : [],
16126 unusedInput : [],
16127 overflow : -2,
16128 charsLeftOver : 0,
16129 nullInput : false,
16130 invalidMonth : null,
16131 invalidFormat : false,
16132 userInvalidated : false,
16133 iso : false,
16134 parsedDateParts : [],
16135 meridiem : null,
16136 rfc2822 : false,
16137 weekdayMismatch : false
16138 };
16139 }
16140
16141 function getParsingFlags(m) {
16142 if (m._pf == null) {
16143 m._pf = defaultParsingFlags();
16144 }
16145 return m._pf;
16146 }
16147
16148 var some;
16149 if (Array.prototype.some) {
16150 some = Array.prototype.some;
16151 } else {
16152 some = function (fun) {
16153 var t = Object(this);
16154 var len = t.length >>> 0;
16155
16156 for (var i = 0; i < len; i++) {
16157 if (i in t && fun.call(this, t[i], i, t)) {
16158 return true;
16159 }
16160 }
16161
16162 return false;
16163 };
16164 }
16165
16166 function isValid(m) {
16167 if (m._isValid == null) {
16168 var flags = getParsingFlags(m);
16169 var parsedParts = some.call(flags.parsedDateParts, function (i) {
16170 return i != null;
16171 });
16172 var isNowValid = !isNaN(m._d.getTime()) &&
16173 flags.overflow < 0 &&
16174 !flags.empty &&
16175 !flags.invalidMonth &&
16176 !flags.invalidWeekday &&
16177 !flags.weekdayMismatch &&
16178 !flags.nullInput &&
16179 !flags.invalidFormat &&
16180 !flags.userInvalidated &&
16181 (!flags.meridiem || (flags.meridiem && parsedParts));
16182
16183 if (m._strict) {
16184 isNowValid = isNowValid &&
16185 flags.charsLeftOver === 0 &&
16186 flags.unusedTokens.length === 0 &&
16187 flags.bigHour === undefined;
16188 }
16189
16190 if (Object.isFrozen == null || !Object.isFrozen(m)) {
16191 m._isValid = isNowValid;
16192 }
16193 else {
16194 return isNowValid;
16195 }
16196 }
16197 return m._isValid;
16198 }
16199
16200 function createInvalid (flags) {
16201 var m = createUTC(NaN);
16202 if (flags != null) {
16203 extend(getParsingFlags(m), flags);
16204 }
16205 else {
16206 getParsingFlags(m).userInvalidated = true;
16207 }
16208
16209 return m;
16210 }
16211
16212 // Plugins that add properties should also add the key here (null value),
16213 // so we can properly clone ourselves.
16214 var momentProperties = hooks.momentProperties = [];
16215
16216 function copyConfig(to, from) {
16217 var i, prop, val;
16218
16219 if (!isUndefined(from._isAMomentObject)) {
16220 to._isAMomentObject = from._isAMomentObject;
16221 }
16222 if (!isUndefined(from._i)) {
16223 to._i = from._i;
16224 }
16225 if (!isUndefined(from._f)) {
16226 to._f = from._f;
16227 }
16228 if (!isUndefined(from._l)) {
16229 to._l = from._l;
16230 }
16231 if (!isUndefined(from._strict)) {
16232 to._strict = from._strict;
16233 }
16234 if (!isUndefined(from._tzm)) {
16235 to._tzm = from._tzm;
16236 }
16237 if (!isUndefined(from._isUTC)) {
16238 to._isUTC = from._isUTC;
16239 }
16240 if (!isUndefined(from._offset)) {
16241 to._offset = from._offset;
16242 }
16243 if (!isUndefined(from._pf)) {
16244 to._pf = getParsingFlags(from);
16245 }
16246 if (!isUndefined(from._locale)) {
16247 to._locale = from._locale;
16248 }
16249
16250 if (momentProperties.length > 0) {
16251 for (i = 0; i < momentProperties.length; i++) {
16252 prop = momentProperties[i];
16253 val = from[prop];
16254 if (!isUndefined(val)) {
16255 to[prop] = val;
16256 }
16257 }
16258 }
16259
16260 return to;
16261 }
16262
16263 var updateInProgress = false;
16264
16265 // Moment prototype object
16266 function Moment(config) {
16267 copyConfig(this, config);
16268 this._d = new Date(config._d != null ? config._d.getTime() : NaN);
16269 if (!this.isValid()) {
16270 this._d = new Date(NaN);
16271 }
16272 // Prevent infinite loop in case updateOffset creates new moment
16273 // objects.
16274 if (updateInProgress === false) {
16275 updateInProgress = true;
16276 hooks.updateOffset(this);
16277 updateInProgress = false;
16278 }
16279 }
16280
16281 function isMoment (obj) {
16282 return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
16283 }
16284
16285 function absFloor (number) {
16286 if (number < 0) {
16287 // -0 -> 0
16288 return Math.ceil(number) || 0;
16289 } else {
16290 return Math.floor(number);
16291 }
16292 }
16293
16294 function toInt(argumentForCoercion) {
16295 var coercedNumber = +argumentForCoercion,
16296 value = 0;
16297
16298 if (coercedNumber !== 0 && isFinite(coercedNumber)) {
16299 value = absFloor(coercedNumber);
16300 }
16301
16302 return value;
16303 }
16304
16305 // compare two arrays, return the number of differences
16306 function compareArrays(array1, array2, dontConvert) {
16307 var len = Math.min(array1.length, array2.length),
16308 lengthDiff = Math.abs(array1.length - array2.length),
16309 diffs = 0,
16310 i;
16311 for (i = 0; i < len; i++) {
16312 if ((dontConvert && array1[i] !== array2[i]) ||
16313 (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
16314 diffs++;
16315 }
16316 }
16317 return diffs + lengthDiff;
16318 }
16319
16320 function warn(msg) {
16321 if (hooks.suppressDeprecationWarnings === false &&
16322 (typeof console !== 'undefined') && console.warn) {
16323 console.warn('Deprecation warning: ' + msg);
16324 }
16325 }
16326
16327 function deprecate(msg, fn) {
16328 var firstTime = true;
16329
16330 return extend(function () {
16331 if (hooks.deprecationHandler != null) {
16332 hooks.deprecationHandler(null, msg);
16333 }
16334 if (firstTime) {
16335 var args = [];
16336 var arg;
16337 for (var i = 0; i < arguments.length; i++) {
16338 arg = '';
16339 if (typeof arguments[i] === 'object') {
16340 arg += '\n[' + i + '] ';
16341 for (var key in arguments[0]) {
16342 arg += key + ': ' + arguments[0][key] + ', ';
16343 }
16344 arg = arg.slice(0, -2); // Remove trailing comma and space
16345 } else {
16346 arg = arguments[i];
16347 }
16348 args.push(arg);
16349 }
16350 warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack);
16351 firstTime = false;
16352 }
16353 return fn.apply(this, arguments);
16354 }, fn);
16355 }
16356
16357 var deprecations = {};
16358
16359 function deprecateSimple(name, msg) {
16360 if (hooks.deprecationHandler != null) {
16361 hooks.deprecationHandler(name, msg);
16362 }
16363 if (!deprecations[name]) {
16364 warn(msg);
16365 deprecations[name] = true;
16366 }
16367 }
16368
16369 hooks.suppressDeprecationWarnings = false;
16370 hooks.deprecationHandler = null;
16371
16372 function isFunction(input) {
16373 return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]';
16374 }
16375
16376 function set (config) {
16377 var prop, i;
16378 for (i in config) {
16379 prop = config[i];
16380 if (isFunction(prop)) {
16381 this[i] = prop;
16382 } else {
16383 this['_' + i] = prop;
16384 }
16385 }
16386 this._config = config;
16387 // Lenient ordinal parsing accepts just a number in addition to
16388 // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
16389 // TODO: Remove "ordinalParse" fallback in next major release.
16390 this._dayOfMonthOrdinalParseLenient = new RegExp(
16391 (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
16392 '|' + (/\d{1,2}/).source);
16393 }
16394
16395 function mergeConfigs(parentConfig, childConfig) {
16396 var res = extend({}, parentConfig), prop;
16397 for (prop in childConfig) {
16398 if (hasOwnProp(childConfig, prop)) {
16399 if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
16400 res[prop] = {};
16401 extend(res[prop], parentConfig[prop]);
16402 extend(res[prop], childConfig[prop]);
16403 } else if (childConfig[prop] != null) {
16404 res[prop] = childConfig[prop];
16405 } else {
16406 delete res[prop];
16407 }
16408 }
16409 }
16410 for (prop in parentConfig) {
16411 if (hasOwnProp(parentConfig, prop) &&
16412 !hasOwnProp(childConfig, prop) &&
16413 isObject(parentConfig[prop])) {
16414 // make sure changes to properties don't modify parent config
16415 res[prop] = extend({}, res[prop]);
16416 }
16417 }
16418 return res;
16419 }
16420
16421 function Locale(config) {
16422 if (config != null) {
16423 this.set(config);
16424 }
16425 }
16426
16427 var keys;
16428
16429 if (Object.keys) {
16430 keys = Object.keys;
16431 } else {
16432 keys = function (obj) {
16433 var i, res = [];
16434 for (i in obj) {
16435 if (hasOwnProp(obj, i)) {
16436 res.push(i);
16437 }
16438 }
16439 return res;
16440 };
16441 }
16442
16443 var defaultCalendar = {
16444 sameDay : '[Today at] LT',
16445 nextDay : '[Tomorrow at] LT',
16446 nextWeek : 'dddd [at] LT',
16447 lastDay : '[Yesterday at] LT',
16448 lastWeek : '[Last] dddd [at] LT',
16449 sameElse : 'L'
16450 };
16451
16452 function calendar (key, mom, now) {
16453 var output = this._calendar[key] || this._calendar['sameElse'];
16454 return isFunction(output) ? output.call(mom, now) : output;
16455 }
16456
16457 var defaultLongDateFormat = {
16458 LTS : 'h:mm:ss A',
16459 LT : 'h:mm A',
16460 L : 'MM/DD/YYYY',
16461 LL : 'MMMM D, YYYY',
16462 LLL : 'MMMM D, YYYY h:mm A',
16463 LLLL : 'dddd, MMMM D, YYYY h:mm A'
16464 };
16465
16466 function longDateFormat (key) {
16467 var format = this._longDateFormat[key],
16468 formatUpper = this._longDateFormat[key.toUpperCase()];
16469
16470 if (format || !formatUpper) {
16471 return format;
16472 }
16473
16474 this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
16475 return val.slice(1);
16476 });
16477
16478 return this._longDateFormat[key];
16479 }
16480
16481 var defaultInvalidDate = 'Invalid date';
16482
16483 function invalidDate () {
16484 return this._invalidDate;
16485 }
16486
16487 var defaultOrdinal = '%d';
16488 var defaultDayOfMonthOrdinalParse = /\d{1,2}/;
16489
16490 function ordinal (number) {
16491 return this._ordinal.replace('%d', number);
16492 }
16493
16494 var defaultRelativeTime = {
16495 future : 'in %s',
16496 past : '%s ago',
16497 s : 'a few seconds',
16498 ss : '%d seconds',
16499 m : 'a minute',
16500 mm : '%d minutes',
16501 h : 'an hour',
16502 hh : '%d hours',
16503 d : 'a day',
16504 dd : '%d days',
16505 M : 'a month',
16506 MM : '%d months',
16507 y : 'a year',
16508 yy : '%d years'
16509 };
16510
16511 function relativeTime (number, withoutSuffix, string, isFuture) {
16512 var output = this._relativeTime[string];
16513 return (isFunction(output)) ?
16514 output(number, withoutSuffix, string, isFuture) :
16515 output.replace(/%d/i, number);
16516 }
16517
16518 function pastFuture (diff, output) {
16519 var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
16520 return isFunction(format) ? format(output) : format.replace(/%s/i, output);
16521 }
16522
16523 var aliases = {};
16524
16525 function addUnitAlias (unit, shorthand) {
16526 var lowerCase = unit.toLowerCase();
16527 aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
16528 }
16529
16530 function normalizeUnits(units) {
16531 return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
16532 }
16533
16534 function normalizeObjectUnits(inputObject) {
16535 var normalizedInput = {},
16536 normalizedProp,
16537 prop;
16538
16539 for (prop in inputObject) {
16540 if (hasOwnProp(inputObject, prop)) {
16541 normalizedProp = normalizeUnits(prop);
16542 if (normalizedProp) {
16543 normalizedInput[normalizedProp] = inputObject[prop];
16544 }
16545 }
16546 }
16547
16548 return normalizedInput;
16549 }
16550
16551 var priorities = {};
16552
16553 function addUnitPriority(unit, priority) {
16554 priorities[unit] = priority;
16555 }
16556
16557 function getPrioritizedUnits(unitsObj) {
16558 var units = [];
16559 for (var u in unitsObj) {
16560 units.push({unit: u, priority: priorities[u]});
16561 }
16562 units.sort(function (a, b) {
16563 return a.priority - b.priority;
16564 });
16565 return units;
16566 }
16567
16568 function zeroFill(number, targetLength, forceSign) {
16569 var absNumber = '' + Math.abs(number),
16570 zerosToFill = targetLength - absNumber.length,
16571 sign = number >= 0;
16572 return (sign ? (forceSign ? '+' : '') : '-') +
16573 Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
16574 }
16575
16576 var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
16577
16578 var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
16579
16580 var formatFunctions = {};
16581
16582 var formatTokenFunctions = {};
16583
16584 // token: 'M'
16585 // padded: ['MM', 2]
16586 // ordinal: 'Mo'
16587 // callback: function () { this.month() + 1 }
16588 function addFormatToken (token, padded, ordinal, callback) {
16589 var func = callback;
16590 if (typeof callback === 'string') {
16591 func = function () {
16592 return this[callback]();
16593 };
16594 }
16595 if (token) {
16596 formatTokenFunctions[token] = func;
16597 }
16598 if (padded) {
16599 formatTokenFunctions[padded[0]] = function () {
16600 return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
16601 };
16602 }
16603 if (ordinal) {
16604 formatTokenFunctions[ordinal] = function () {
16605 return this.localeData().ordinal(func.apply(this, arguments), token);
16606 };
16607 }
16608 }
16609
16610 function removeFormattingTokens(input) {
16611 if (input.match(/\[[\s\S]/)) {
16612 return input.replace(/^\[|\]$/g, '');
16613 }
16614 return input.replace(/\\/g, '');
16615 }
16616
16617 function makeFormatFunction(format) {
16618 var array = format.match(formattingTokens), i, length;
16619
16620 for (i = 0, length = array.length; i < length; i++) {
16621 if (formatTokenFunctions[array[i]]) {
16622 array[i] = formatTokenFunctions[array[i]];
16623 } else {
16624 array[i] = removeFormattingTokens(array[i]);
16625 }
16626 }
16627
16628 return function (mom) {
16629 var output = '', i;
16630 for (i = 0; i < length; i++) {
16631 output += isFunction(array[i]) ? array[i].call(mom, format) : array[i];
16632 }
16633 return output;
16634 };
16635 }
16636
16637 // format date using native date object
16638 function formatMoment(m, format) {
16639 if (!m.isValid()) {
16640 return m.localeData().invalidDate();
16641 }
16642
16643 format = expandFormat(format, m.localeData());
16644 formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
16645
16646 return formatFunctions[format](m);
16647 }
16648
16649 function expandFormat(format, locale) {
16650 var i = 5;
16651
16652 function replaceLongDateFormatTokens(input) {
16653 return locale.longDateFormat(input) || input;
16654 }
16655
16656 localFormattingTokens.lastIndex = 0;
16657 while (i >= 0 && localFormattingTokens.test(format)) {
16658 format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
16659 localFormattingTokens.lastIndex = 0;
16660 i -= 1;
16661 }
16662
16663 return format;
16664 }
16665
16666 var match1 = /\d/; // 0 - 9
16667 var match2 = /\d\d/; // 00 - 99
16668 var match3 = /\d{3}/; // 000 - 999
16669 var match4 = /\d{4}/; // 0000 - 9999
16670 var match6 = /[+-]?\d{6}/; // -999999 - 999999
16671 var match1to2 = /\d\d?/; // 0 - 99
16672 var match3to4 = /\d\d\d\d?/; // 999 - 9999
16673 var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999
16674 var match1to3 = /\d{1,3}/; // 0 - 999
16675 var match1to4 = /\d{1,4}/; // 0 - 9999
16676 var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999
16677
16678 var matchUnsigned = /\d+/; // 0 - inf
16679 var matchSigned = /[+-]?\d+/; // -inf - inf
16680
16681 var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
16682 var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z
16683
16684 var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
16685
16686 // any word (or two) characters or numbers including two/three word month in arabic.
16687 // includes scottish gaelic two word and hyphenated months
16688 var 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;
16689
16690 var regexes = {};
16691
16692 function addRegexToken (token, regex, strictRegex) {
16693 regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) {
16694 return (isStrict && strictRegex) ? strictRegex : regex;
16695 };
16696 }
16697
16698 function getParseRegexForToken (token, config) {
16699 if (!hasOwnProp(regexes, token)) {
16700 return new RegExp(unescapeFormat(token));
16701 }
16702
16703 return regexes[token](config._strict, config._locale);
16704 }
16705
16706 // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
16707 function unescapeFormat(s) {
16708 return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
16709 return p1 || p2 || p3 || p4;
16710 }));
16711 }
16712
16713 function regexEscape(s) {
16714 return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
16715 }
16716
16717 var tokens = {};
16718
16719 function addParseToken (token, callback) {
16720 var i, func = callback;
16721 if (typeof token === 'string') {
16722 token = [token];
16723 }
16724 if (isNumber(callback)) {
16725 func = function (input, array) {
16726 array[callback] = toInt(input);
16727 };
16728 }
16729 for (i = 0; i < token.length; i++) {
16730 tokens[token[i]] = func;
16731 }
16732 }
16733
16734 function addWeekParseToken (token, callback) {
16735 addParseToken(token, function (input, array, config, token) {
16736 config._w = config._w || {};
16737 callback(input, config._w, config, token);
16738 });
16739 }
16740
16741 function addTimeToArrayFromToken(token, input, config) {
16742 if (input != null && hasOwnProp(tokens, token)) {
16743 tokens[token](input, config._a, config, token);
16744 }
16745 }
16746
16747 var YEAR = 0;
16748 var MONTH = 1;
16749 var DATE = 2;
16750 var HOUR = 3;
16751 var MINUTE = 4;
16752 var SECOND = 5;
16753 var MILLISECOND = 6;
16754 var WEEK = 7;
16755 var WEEKDAY = 8;
16756
16757 // FORMATTING
16758
16759 addFormatToken('Y', 0, 0, function () {
16760 var y = this.year();
16761 return y <= 9999 ? '' + y : '+' + y;
16762 });
16763
16764 addFormatToken(0, ['YY', 2], 0, function () {
16765 return this.year() % 100;
16766 });
16767
16768 addFormatToken(0, ['YYYY', 4], 0, 'year');
16769 addFormatToken(0, ['YYYYY', 5], 0, 'year');
16770 addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
16771
16772 // ALIASES
16773
16774 addUnitAlias('year', 'y');
16775
16776 // PRIORITIES
16777
16778 addUnitPriority('year', 1);
16779
16780 // PARSING
16781
16782 addRegexToken('Y', matchSigned);
16783 addRegexToken('YY', match1to2, match2);
16784 addRegexToken('YYYY', match1to4, match4);
16785 addRegexToken('YYYYY', match1to6, match6);
16786 addRegexToken('YYYYYY', match1to6, match6);
16787
16788 addParseToken(['YYYYY', 'YYYYYY'], YEAR);
16789 addParseToken('YYYY', function (input, array) {
16790 array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
16791 });
16792 addParseToken('YY', function (input, array) {
16793 array[YEAR] = hooks.parseTwoDigitYear(input);
16794 });
16795 addParseToken('Y', function (input, array) {
16796 array[YEAR] = parseInt(input, 10);
16797 });
16798
16799 // HELPERS
16800
16801 function daysInYear(year) {
16802 return isLeapYear(year) ? 366 : 365;
16803 }
16804
16805 function isLeapYear(year) {
16806 return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
16807 }
16808
16809 // HOOKS
16810
16811 hooks.parseTwoDigitYear = function (input) {
16812 return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
16813 };
16814
16815 // MOMENTS
16816
16817 var getSetYear = makeGetSet('FullYear', true);
16818
16819 function getIsLeapYear () {
16820 return isLeapYear(this.year());
16821 }
16822
16823 function makeGetSet (unit, keepTime) {
16824 return function (value) {
16825 if (value != null) {
16826 set$1(this, unit, value);
16827 hooks.updateOffset(this, keepTime);
16828 return this;
16829 } else {
16830 return get(this, unit);
16831 }
16832 };
16833 }
16834
16835 function get (mom, unit) {
16836 return mom.isValid() ?
16837 mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN;
16838 }
16839
16840 function set$1 (mom, unit, value) {
16841 if (mom.isValid() && !isNaN(value)) {
16842 if (unit === 'FullYear' && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29) {
16843 mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value, mom.month(), daysInMonth(value, mom.month()));
16844 }
16845 else {
16846 mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
16847 }
16848 }
16849 }
16850
16851 // MOMENTS
16852
16853 function stringGet (units) {
16854 units = normalizeUnits(units);
16855 if (isFunction(this[units])) {
16856 return this[units]();
16857 }
16858 return this;
16859 }
16860
16861
16862 function stringSet (units, value) {
16863 if (typeof units === 'object') {
16864 units = normalizeObjectUnits(units);
16865 var prioritized = getPrioritizedUnits(units);
16866 for (var i = 0; i < prioritized.length; i++) {
16867 this[prioritized[i].unit](units[prioritized[i].unit]);
16868 }
16869 } else {
16870 units = normalizeUnits(units);
16871 if (isFunction(this[units])) {
16872 return this[units](value);
16873 }
16874 }
16875 return this;
16876 }
16877
16878 function mod(n, x) {
16879 return ((n % x) + x) % x;
16880 }
16881
16882 var indexOf;
16883
16884 if (Array.prototype.indexOf) {
16885 indexOf = Array.prototype.indexOf;
16886 } else {
16887 indexOf = function (o) {
16888 // I know
16889 var i;
16890 for (i = 0; i < this.length; ++i) {
16891 if (this[i] === o) {
16892 return i;
16893 }
16894 }
16895 return -1;
16896 };
16897 }
16898
16899 function daysInMonth(year, month) {
16900 if (isNaN(year) || isNaN(month)) {
16901 return NaN;
16902 }
16903 var modMonth = mod(month, 12);
16904 year += (month - modMonth) / 12;
16905 return modMonth === 1 ? (isLeapYear(year) ? 29 : 28) : (31 - modMonth % 7 % 2);
16906 }
16907
16908 // FORMATTING
16909
16910 addFormatToken('M', ['MM', 2], 'Mo', function () {
16911 return this.month() + 1;
16912 });
16913
16914 addFormatToken('MMM', 0, 0, function (format) {
16915 return this.localeData().monthsShort(this, format);
16916 });
16917
16918 addFormatToken('MMMM', 0, 0, function (format) {
16919 return this.localeData().months(this, format);
16920 });
16921
16922 // ALIASES
16923
16924 addUnitAlias('month', 'M');
16925
16926 // PRIORITY
16927
16928 addUnitPriority('month', 8);
16929
16930 // PARSING
16931
16932 addRegexToken('M', match1to2);
16933 addRegexToken('MM', match1to2, match2);
16934 addRegexToken('MMM', function (isStrict, locale) {
16935 return locale.monthsShortRegex(isStrict);
16936 });
16937 addRegexToken('MMMM', function (isStrict, locale) {
16938 return locale.monthsRegex(isStrict);
16939 });
16940
16941 addParseToken(['M', 'MM'], function (input, array) {
16942 array[MONTH] = toInt(input) - 1;
16943 });
16944
16945 addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
16946 var month = config._locale.monthsParse(input, token, config._strict);
16947 // if we didn't find a month name, mark the date as invalid.
16948 if (month != null) {
16949 array[MONTH] = month;
16950 } else {
16951 getParsingFlags(config).invalidMonth = input;
16952 }
16953 });
16954
16955 // LOCALES
16956
16957 var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;
16958 var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
16959 function localeMonths (m, format) {
16960 if (!m) {
16961 return isArray(this._months) ? this._months :
16962 this._months['standalone'];
16963 }
16964 return isArray(this._months) ? this._months[m.month()] :
16965 this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()];
16966 }
16967
16968 var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
16969 function localeMonthsShort (m, format) {
16970 if (!m) {
16971 return isArray(this._monthsShort) ? this._monthsShort :
16972 this._monthsShort['standalone'];
16973 }
16974 return isArray(this._monthsShort) ? this._monthsShort[m.month()] :
16975 this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
16976 }
16977
16978 function handleStrictParse(monthName, format, strict) {
16979 var i, ii, mom, llc = monthName.toLocaleLowerCase();
16980 if (!this._monthsParse) {
16981 // this is not used
16982 this._monthsParse = [];
16983 this._longMonthsParse = [];
16984 this._shortMonthsParse = [];
16985 for (i = 0; i < 12; ++i) {
16986 mom = createUTC([2000, i]);
16987 this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase();
16988 this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
16989 }
16990 }
16991
16992 if (strict) {
16993 if (format === 'MMM') {
16994 ii = indexOf.call(this._shortMonthsParse, llc);
16995 return ii !== -1 ? ii : null;
16996 } else {
16997 ii = indexOf.call(this._longMonthsParse, llc);
16998 return ii !== -1 ? ii : null;
16999 }
17000 } else {
17001 if (format === 'MMM') {
17002 ii = indexOf.call(this._shortMonthsParse, llc);
17003 if (ii !== -1) {
17004 return ii;
17005 }
17006 ii = indexOf.call(this._longMonthsParse, llc);
17007 return ii !== -1 ? ii : null;
17008 } else {
17009 ii = indexOf.call(this._longMonthsParse, llc);
17010 if (ii !== -1) {
17011 return ii;
17012 }
17013 ii = indexOf.call(this._shortMonthsParse, llc);
17014 return ii !== -1 ? ii : null;
17015 }
17016 }
17017 }
17018
17019 function localeMonthsParse (monthName, format, strict) {
17020 var i, mom, regex;
17021
17022 if (this._monthsParseExact) {
17023 return handleStrictParse.call(this, monthName, format, strict);
17024 }
17025
17026 if (!this._monthsParse) {
17027 this._monthsParse = [];
17028 this._longMonthsParse = [];
17029 this._shortMonthsParse = [];
17030 }
17031
17032 // TODO: add sorting
17033 // Sorting makes sure if one month (or abbr) is a prefix of another
17034 // see sorting in computeMonthsParse
17035 for (i = 0; i < 12; i++) {
17036 // make the regex if we don't have it already
17037 mom = createUTC([2000, i]);
17038 if (strict && !this._longMonthsParse[i]) {
17039 this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
17040 this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
17041 }
17042 if (!strict && !this._monthsParse[i]) {
17043 regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
17044 this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
17045 }
17046 // test the regex
17047 if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
17048 return i;
17049 } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
17050 return i;
17051 } else if (!strict && this._monthsParse[i].test(monthName)) {
17052 return i;
17053 }
17054 }
17055 }
17056
17057 // MOMENTS
17058
17059 function setMonth (mom, value) {
17060 var dayOfMonth;
17061
17062 if (!mom.isValid()) {
17063 // No op
17064 return mom;
17065 }
17066
17067 if (typeof value === 'string') {
17068 if (/^\d+$/.test(value)) {
17069 value = toInt(value);
17070 } else {
17071 value = mom.localeData().monthsParse(value);
17072 // TODO: Another silent failure?
17073 if (!isNumber(value)) {
17074 return mom;
17075 }
17076 }
17077 }
17078
17079 dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
17080 mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
17081 return mom;
17082 }
17083
17084 function getSetMonth (value) {
17085 if (value != null) {
17086 setMonth(this, value);
17087 hooks.updateOffset(this, true);
17088 return this;
17089 } else {
17090 return get(this, 'Month');
17091 }
17092 }
17093
17094 function getDaysInMonth () {
17095 return daysInMonth(this.year(), this.month());
17096 }
17097
17098 var defaultMonthsShortRegex = matchWord;
17099 function monthsShortRegex (isStrict) {
17100 if (this._monthsParseExact) {
17101 if (!hasOwnProp(this, '_monthsRegex')) {
17102 computeMonthsParse.call(this);
17103 }
17104 if (isStrict) {
17105 return this._monthsShortStrictRegex;
17106 } else {
17107 return this._monthsShortRegex;
17108 }
17109 } else {
17110 if (!hasOwnProp(this, '_monthsShortRegex')) {
17111 this._monthsShortRegex = defaultMonthsShortRegex;
17112 }
17113 return this._monthsShortStrictRegex && isStrict ?
17114 this._monthsShortStrictRegex : this._monthsShortRegex;
17115 }
17116 }
17117
17118 var defaultMonthsRegex = matchWord;
17119 function monthsRegex (isStrict) {
17120 if (this._monthsParseExact) {
17121 if (!hasOwnProp(this, '_monthsRegex')) {
17122 computeMonthsParse.call(this);
17123 }
17124 if (isStrict) {
17125 return this._monthsStrictRegex;
17126 } else {
17127 return this._monthsRegex;
17128 }
17129 } else {
17130 if (!hasOwnProp(this, '_monthsRegex')) {
17131 this._monthsRegex = defaultMonthsRegex;
17132 }
17133 return this._monthsStrictRegex && isStrict ?
17134 this._monthsStrictRegex : this._monthsRegex;
17135 }
17136 }
17137
17138 function computeMonthsParse () {
17139 function cmpLenRev(a, b) {
17140 return b.length - a.length;
17141 }
17142
17143 var shortPieces = [], longPieces = [], mixedPieces = [],
17144 i, mom;
17145 for (i = 0; i < 12; i++) {
17146 // make the regex if we don't have it already
17147 mom = createUTC([2000, i]);
17148 shortPieces.push(this.monthsShort(mom, ''));
17149 longPieces.push(this.months(mom, ''));
17150 mixedPieces.push(this.months(mom, ''));
17151 mixedPieces.push(this.monthsShort(mom, ''));
17152 }
17153 // Sorting makes sure if one month (or abbr) is a prefix of another it
17154 // will match the longer piece.
17155 shortPieces.sort(cmpLenRev);
17156 longPieces.sort(cmpLenRev);
17157 mixedPieces.sort(cmpLenRev);
17158 for (i = 0; i < 12; i++) {
17159 shortPieces[i] = regexEscape(shortPieces[i]);
17160 longPieces[i] = regexEscape(longPieces[i]);
17161 }
17162 for (i = 0; i < 24; i++) {
17163 mixedPieces[i] = regexEscape(mixedPieces[i]);
17164 }
17165
17166 this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
17167 this._monthsShortRegex = this._monthsRegex;
17168 this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
17169 this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
17170 }
17171
17172 function createDate (y, m, d, h, M, s, ms) {
17173 // can't just apply() to create a date:
17174 // https://stackoverflow.com/q/181348
17175 var date;
17176 // the date constructor remaps years 0-99 to 1900-1999
17177 if (y < 100 && y >= 0) {
17178 // preserve leap years using a full 400 year cycle, then reset
17179 date = new Date(y + 400, m, d, h, M, s, ms);
17180 if (isFinite(date.getFullYear())) {
17181 date.setFullYear(y);
17182 }
17183 } else {
17184 date = new Date(y, m, d, h, M, s, ms);
17185 }
17186
17187 return date;
17188 }
17189
17190 function createUTCDate (y) {
17191 var date;
17192 // the Date.UTC function remaps years 0-99 to 1900-1999
17193 if (y < 100 && y >= 0) {
17194 var args = Array.prototype.slice.call(arguments);
17195 // preserve leap years using a full 400 year cycle, then reset
17196 args[0] = y + 400;
17197 date = new Date(Date.UTC.apply(null, args));
17198 if (isFinite(date.getUTCFullYear())) {
17199 date.setUTCFullYear(y);
17200 }
17201 } else {
17202 date = new Date(Date.UTC.apply(null, arguments));
17203 }
17204
17205 return date;
17206 }
17207
17208 // start-of-first-week - start-of-year
17209 function firstWeekOffset(year, dow, doy) {
17210 var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
17211 fwd = 7 + dow - doy,
17212 // first-week day local weekday -- which local weekday is fwd
17213 fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
17214
17215 return -fwdlw + fwd - 1;
17216 }
17217
17218 // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
17219 function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
17220 var localWeekday = (7 + weekday - dow) % 7,
17221 weekOffset = firstWeekOffset(year, dow, doy),
17222 dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
17223 resYear, resDayOfYear;
17224
17225 if (dayOfYear <= 0) {
17226 resYear = year - 1;
17227 resDayOfYear = daysInYear(resYear) + dayOfYear;
17228 } else if (dayOfYear > daysInYear(year)) {
17229 resYear = year + 1;
17230 resDayOfYear = dayOfYear - daysInYear(year);
17231 } else {
17232 resYear = year;
17233 resDayOfYear = dayOfYear;
17234 }
17235
17236 return {
17237 year: resYear,
17238 dayOfYear: resDayOfYear
17239 };
17240 }
17241
17242 function weekOfYear(mom, dow, doy) {
17243 var weekOffset = firstWeekOffset(mom.year(), dow, doy),
17244 week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
17245 resWeek, resYear;
17246
17247 if (week < 1) {
17248 resYear = mom.year() - 1;
17249 resWeek = week + weeksInYear(resYear, dow, doy);
17250 } else if (week > weeksInYear(mom.year(), dow, doy)) {
17251 resWeek = week - weeksInYear(mom.year(), dow, doy);
17252 resYear = mom.year() + 1;
17253 } else {
17254 resYear = mom.year();
17255 resWeek = week;
17256 }
17257
17258 return {
17259 week: resWeek,
17260 year: resYear
17261 };
17262 }
17263
17264 function weeksInYear(year, dow, doy) {
17265 var weekOffset = firstWeekOffset(year, dow, doy),
17266 weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
17267 return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
17268 }
17269
17270 // FORMATTING
17271
17272 addFormatToken('w', ['ww', 2], 'wo', 'week');
17273 addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
17274
17275 // ALIASES
17276
17277 addUnitAlias('week', 'w');
17278 addUnitAlias('isoWeek', 'W');
17279
17280 // PRIORITIES
17281
17282 addUnitPriority('week', 5);
17283 addUnitPriority('isoWeek', 5);
17284
17285 // PARSING
17286
17287 addRegexToken('w', match1to2);
17288 addRegexToken('ww', match1to2, match2);
17289 addRegexToken('W', match1to2);
17290 addRegexToken('WW', match1to2, match2);
17291
17292 addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
17293 week[token.substr(0, 1)] = toInt(input);
17294 });
17295
17296 // HELPERS
17297
17298 // LOCALES
17299
17300 function localeWeek (mom) {
17301 return weekOfYear(mom, this._week.dow, this._week.doy).week;
17302 }
17303
17304 var defaultLocaleWeek = {
17305 dow : 0, // Sunday is the first day of the week.
17306 doy : 6 // The week that contains Jan 6th is the first week of the year.
17307 };
17308
17309 function localeFirstDayOfWeek () {
17310 return this._week.dow;
17311 }
17312
17313 function localeFirstDayOfYear () {
17314 return this._week.doy;
17315 }
17316
17317 // MOMENTS
17318
17319 function getSetWeek (input) {
17320 var week = this.localeData().week(this);
17321 return input == null ? week : this.add((input - week) * 7, 'd');
17322 }
17323
17324 function getSetISOWeek (input) {
17325 var week = weekOfYear(this, 1, 4).week;
17326 return input == null ? week : this.add((input - week) * 7, 'd');
17327 }
17328
17329 // FORMATTING
17330
17331 addFormatToken('d', 0, 'do', 'day');
17332
17333 addFormatToken('dd', 0, 0, function (format) {
17334 return this.localeData().weekdaysMin(this, format);
17335 });
17336
17337 addFormatToken('ddd', 0, 0, function (format) {
17338 return this.localeData().weekdaysShort(this, format);
17339 });
17340
17341 addFormatToken('dddd', 0, 0, function (format) {
17342 return this.localeData().weekdays(this, format);
17343 });
17344
17345 addFormatToken('e', 0, 0, 'weekday');
17346 addFormatToken('E', 0, 0, 'isoWeekday');
17347
17348 // ALIASES
17349
17350 addUnitAlias('day', 'd');
17351 addUnitAlias('weekday', 'e');
17352 addUnitAlias('isoWeekday', 'E');
17353
17354 // PRIORITY
17355 addUnitPriority('day', 11);
17356 addUnitPriority('weekday', 11);
17357 addUnitPriority('isoWeekday', 11);
17358
17359 // PARSING
17360
17361 addRegexToken('d', match1to2);
17362 addRegexToken('e', match1to2);
17363 addRegexToken('E', match1to2);
17364 addRegexToken('dd', function (isStrict, locale) {
17365 return locale.weekdaysMinRegex(isStrict);
17366 });
17367 addRegexToken('ddd', function (isStrict, locale) {
17368 return locale.weekdaysShortRegex(isStrict);
17369 });
17370 addRegexToken('dddd', function (isStrict, locale) {
17371 return locale.weekdaysRegex(isStrict);
17372 });
17373
17374 addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
17375 var weekday = config._locale.weekdaysParse(input, token, config._strict);
17376 // if we didn't get a weekday name, mark the date as invalid
17377 if (weekday != null) {
17378 week.d = weekday;
17379 } else {
17380 getParsingFlags(config).invalidWeekday = input;
17381 }
17382 });
17383
17384 addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
17385 week[token] = toInt(input);
17386 });
17387
17388 // HELPERS
17389
17390 function parseWeekday(input, locale) {
17391 if (typeof input !== 'string') {
17392 return input;
17393 }
17394
17395 if (!isNaN(input)) {
17396 return parseInt(input, 10);
17397 }
17398
17399 input = locale.weekdaysParse(input);
17400 if (typeof input === 'number') {
17401 return input;
17402 }
17403
17404 return null;
17405 }
17406
17407 function parseIsoWeekday(input, locale) {
17408 if (typeof input === 'string') {
17409 return locale.weekdaysParse(input) % 7 || 7;
17410 }
17411 return isNaN(input) ? null : input;
17412 }
17413
17414 // LOCALES
17415 function shiftWeekdays (ws, n) {
17416 return ws.slice(n, 7).concat(ws.slice(0, n));
17417 }
17418
17419 var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
17420 function localeWeekdays (m, format) {
17421 var weekdays = isArray(this._weekdays) ? this._weekdays :
17422 this._weekdays[(m && m !== true && this._weekdays.isFormat.test(format)) ? 'format' : 'standalone'];
17423 return (m === true) ? shiftWeekdays(weekdays, this._week.dow)
17424 : (m) ? weekdays[m.day()] : weekdays;
17425 }
17426
17427 var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
17428 function localeWeekdaysShort (m) {
17429 return (m === true) ? shiftWeekdays(this._weekdaysShort, this._week.dow)
17430 : (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
17431 }
17432
17433 var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
17434 function localeWeekdaysMin (m) {
17435 return (m === true) ? shiftWeekdays(this._weekdaysMin, this._week.dow)
17436 : (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin;
17437 }
17438
17439 function handleStrictParse$1(weekdayName, format, strict) {
17440 var i, ii, mom, llc = weekdayName.toLocaleLowerCase();
17441 if (!this._weekdaysParse) {
17442 this._weekdaysParse = [];
17443 this._shortWeekdaysParse = [];
17444 this._minWeekdaysParse = [];
17445
17446 for (i = 0; i < 7; ++i) {
17447 mom = createUTC([2000, 1]).day(i);
17448 this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase();
17449 this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase();
17450 this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
17451 }
17452 }
17453
17454 if (strict) {
17455 if (format === 'dddd') {
17456 ii = indexOf.call(this._weekdaysParse, llc);
17457 return ii !== -1 ? ii : null;
17458 } else if (format === 'ddd') {
17459 ii = indexOf.call(this._shortWeekdaysParse, llc);
17460 return ii !== -1 ? ii : null;
17461 } else {
17462 ii = indexOf.call(this._minWeekdaysParse, llc);
17463 return ii !== -1 ? ii : null;
17464 }
17465 } else {
17466 if (format === 'dddd') {
17467 ii = indexOf.call(this._weekdaysParse, llc);
17468 if (ii !== -1) {
17469 return ii;
17470 }
17471 ii = indexOf.call(this._shortWeekdaysParse, llc);
17472 if (ii !== -1) {
17473 return ii;
17474 }
17475 ii = indexOf.call(this._minWeekdaysParse, llc);
17476 return ii !== -1 ? ii : null;
17477 } else if (format === 'ddd') {
17478 ii = indexOf.call(this._shortWeekdaysParse, llc);
17479 if (ii !== -1) {
17480 return ii;
17481 }
17482 ii = indexOf.call(this._weekdaysParse, llc);
17483 if (ii !== -1) {
17484 return ii;
17485 }
17486 ii = indexOf.call(this._minWeekdaysParse, llc);
17487 return ii !== -1 ? ii : null;
17488 } else {
17489 ii = indexOf.call(this._minWeekdaysParse, llc);
17490 if (ii !== -1) {
17491 return ii;
17492 }
17493 ii = indexOf.call(this._weekdaysParse, llc);
17494 if (ii !== -1) {
17495 return ii;
17496 }
17497 ii = indexOf.call(this._shortWeekdaysParse, llc);
17498 return ii !== -1 ? ii : null;
17499 }
17500 }
17501 }
17502
17503 function localeWeekdaysParse (weekdayName, format, strict) {
17504 var i, mom, regex;
17505
17506 if (this._weekdaysParseExact) {
17507 return handleStrictParse$1.call(this, weekdayName, format, strict);
17508 }
17509
17510 if (!this._weekdaysParse) {
17511 this._weekdaysParse = [];
17512 this._minWeekdaysParse = [];
17513 this._shortWeekdaysParse = [];
17514 this._fullWeekdaysParse = [];
17515 }
17516
17517 for (i = 0; i < 7; i++) {
17518 // make the regex if we don't have it already
17519
17520 mom = createUTC([2000, 1]).day(i);
17521 if (strict && !this._fullWeekdaysParse[i]) {
17522 this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 'i');
17523 this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 'i');
17524 this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 'i');
17525 }
17526 if (!this._weekdaysParse[i]) {
17527 regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
17528 this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
17529 }
17530 // test the regex
17531 if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) {
17532 return i;
17533 } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) {
17534 return i;
17535 } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) {
17536 return i;
17537 } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
17538 return i;
17539 }
17540 }
17541 }
17542
17543 // MOMENTS
17544
17545 function getSetDayOfWeek (input) {
17546 if (!this.isValid()) {
17547 return input != null ? this : NaN;
17548 }
17549 var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
17550 if (input != null) {
17551 input = parseWeekday(input, this.localeData());
17552 return this.add(input - day, 'd');
17553 } else {
17554 return day;
17555 }
17556 }
17557
17558 function getSetLocaleDayOfWeek (input) {
17559 if (!this.isValid()) {
17560 return input != null ? this : NaN;
17561 }
17562 var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
17563 return input == null ? weekday : this.add(input - weekday, 'd');
17564 }
17565
17566 function getSetISODayOfWeek (input) {
17567 if (!this.isValid()) {
17568 return input != null ? this : NaN;
17569 }
17570
17571 // behaves the same as moment#day except
17572 // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
17573 // as a setter, sunday should belong to the previous week.
17574
17575 if (input != null) {
17576 var weekday = parseIsoWeekday(input, this.localeData());
17577 return this.day(this.day() % 7 ? weekday : weekday - 7);
17578 } else {
17579 return this.day() || 7;
17580 }
17581 }
17582
17583 var defaultWeekdaysRegex = matchWord;
17584 function weekdaysRegex (isStrict) {
17585 if (this._weekdaysParseExact) {
17586 if (!hasOwnProp(this, '_weekdaysRegex')) {
17587 computeWeekdaysParse.call(this);
17588 }
17589 if (isStrict) {
17590 return this._weekdaysStrictRegex;
17591 } else {
17592 return this._weekdaysRegex;
17593 }
17594 } else {
17595 if (!hasOwnProp(this, '_weekdaysRegex')) {
17596 this._weekdaysRegex = defaultWeekdaysRegex;
17597 }
17598 return this._weekdaysStrictRegex && isStrict ?
17599 this._weekdaysStrictRegex : this._weekdaysRegex;
17600 }
17601 }
17602
17603 var defaultWeekdaysShortRegex = matchWord;
17604 function weekdaysShortRegex (isStrict) {
17605 if (this._weekdaysParseExact) {
17606 if (!hasOwnProp(this, '_weekdaysRegex')) {
17607 computeWeekdaysParse.call(this);
17608 }
17609 if (isStrict) {
17610 return this._weekdaysShortStrictRegex;
17611 } else {
17612 return this._weekdaysShortRegex;
17613 }
17614 } else {
17615 if (!hasOwnProp(this, '_weekdaysShortRegex')) {
17616 this._weekdaysShortRegex = defaultWeekdaysShortRegex;
17617 }
17618 return this._weekdaysShortStrictRegex && isStrict ?
17619 this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
17620 }
17621 }
17622
17623 var defaultWeekdaysMinRegex = matchWord;
17624 function weekdaysMinRegex (isStrict) {
17625 if (this._weekdaysParseExact) {
17626 if (!hasOwnProp(this, '_weekdaysRegex')) {
17627 computeWeekdaysParse.call(this);
17628 }
17629 if (isStrict) {
17630 return this._weekdaysMinStrictRegex;
17631 } else {
17632 return this._weekdaysMinRegex;
17633 }
17634 } else {
17635 if (!hasOwnProp(this, '_weekdaysMinRegex')) {
17636 this._weekdaysMinRegex = defaultWeekdaysMinRegex;
17637 }
17638 return this._weekdaysMinStrictRegex && isStrict ?
17639 this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
17640 }
17641 }
17642
17643
17644 function computeWeekdaysParse () {
17645 function cmpLenRev(a, b) {
17646 return b.length - a.length;
17647 }
17648
17649 var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [],
17650 i, mom, minp, shortp, longp;
17651 for (i = 0; i < 7; i++) {
17652 // make the regex if we don't have it already
17653 mom = createUTC([2000, 1]).day(i);
17654 minp = this.weekdaysMin(mom, '');
17655 shortp = this.weekdaysShort(mom, '');
17656 longp = this.weekdays(mom, '');
17657 minPieces.push(minp);
17658 shortPieces.push(shortp);
17659 longPieces.push(longp);
17660 mixedPieces.push(minp);
17661 mixedPieces.push(shortp);
17662 mixedPieces.push(longp);
17663 }
17664 // Sorting makes sure if one weekday (or abbr) is a prefix of another it
17665 // will match the longer piece.
17666 minPieces.sort(cmpLenRev);
17667 shortPieces.sort(cmpLenRev);
17668 longPieces.sort(cmpLenRev);
17669 mixedPieces.sort(cmpLenRev);
17670 for (i = 0; i < 7; i++) {
17671 shortPieces[i] = regexEscape(shortPieces[i]);
17672 longPieces[i] = regexEscape(longPieces[i]);
17673 mixedPieces[i] = regexEscape(mixedPieces[i]);
17674 }
17675
17676 this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
17677 this._weekdaysShortRegex = this._weekdaysRegex;
17678 this._weekdaysMinRegex = this._weekdaysRegex;
17679
17680 this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
17681 this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
17682 this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i');
17683 }
17684
17685 // FORMATTING
17686
17687 function hFormat() {
17688 return this.hours() % 12 || 12;
17689 }
17690
17691 function kFormat() {
17692 return this.hours() || 24;
17693 }
17694
17695 addFormatToken('H', ['HH', 2], 0, 'hour');
17696 addFormatToken('h', ['hh', 2], 0, hFormat);
17697 addFormatToken('k', ['kk', 2], 0, kFormat);
17698
17699 addFormatToken('hmm', 0, 0, function () {
17700 return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
17701 });
17702
17703 addFormatToken('hmmss', 0, 0, function () {
17704 return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) +
17705 zeroFill(this.seconds(), 2);
17706 });
17707
17708 addFormatToken('Hmm', 0, 0, function () {
17709 return '' + this.hours() + zeroFill(this.minutes(), 2);
17710 });
17711
17712 addFormatToken('Hmmss', 0, 0, function () {
17713 return '' + this.hours() + zeroFill(this.minutes(), 2) +
17714 zeroFill(this.seconds(), 2);
17715 });
17716
17717 function meridiem (token, lowercase) {
17718 addFormatToken(token, 0, 0, function () {
17719 return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
17720 });
17721 }
17722
17723 meridiem('a', true);
17724 meridiem('A', false);
17725
17726 // ALIASES
17727
17728 addUnitAlias('hour', 'h');
17729
17730 // PRIORITY
17731 addUnitPriority('hour', 13);
17732
17733 // PARSING
17734
17735 function matchMeridiem (isStrict, locale) {
17736 return locale._meridiemParse;
17737 }
17738
17739 addRegexToken('a', matchMeridiem);
17740 addRegexToken('A', matchMeridiem);
17741 addRegexToken('H', match1to2);
17742 addRegexToken('h', match1to2);
17743 addRegexToken('k', match1to2);
17744 addRegexToken('HH', match1to2, match2);
17745 addRegexToken('hh', match1to2, match2);
17746 addRegexToken('kk', match1to2, match2);
17747
17748 addRegexToken('hmm', match3to4);
17749 addRegexToken('hmmss', match5to6);
17750 addRegexToken('Hmm', match3to4);
17751 addRegexToken('Hmmss', match5to6);
17752
17753 addParseToken(['H', 'HH'], HOUR);
17754 addParseToken(['k', 'kk'], function (input, array, config) {
17755 var kInput = toInt(input);
17756 array[HOUR] = kInput === 24 ? 0 : kInput;
17757 });
17758 addParseToken(['a', 'A'], function (input, array, config) {
17759 config._isPm = config._locale.isPM(input);
17760 config._meridiem = input;
17761 });
17762 addParseToken(['h', 'hh'], function (input, array, config) {
17763 array[HOUR] = toInt(input);
17764 getParsingFlags(config).bigHour = true;
17765 });
17766 addParseToken('hmm', function (input, array, config) {
17767 var pos = input.length - 2;
17768 array[HOUR] = toInt(input.substr(0, pos));
17769 array[MINUTE] = toInt(input.substr(pos));
17770 getParsingFlags(config).bigHour = true;
17771 });
17772 addParseToken('hmmss', function (input, array, config) {
17773 var pos1 = input.length - 4;
17774 var pos2 = input.length - 2;
17775 array[HOUR] = toInt(input.substr(0, pos1));
17776 array[MINUTE] = toInt(input.substr(pos1, 2));
17777 array[SECOND] = toInt(input.substr(pos2));
17778 getParsingFlags(config).bigHour = true;
17779 });
17780 addParseToken('Hmm', function (input, array, config) {
17781 var pos = input.length - 2;
17782 array[HOUR] = toInt(input.substr(0, pos));
17783 array[MINUTE] = toInt(input.substr(pos));
17784 });
17785 addParseToken('Hmmss', function (input, array, config) {
17786 var pos1 = input.length - 4;
17787 var pos2 = input.length - 2;
17788 array[HOUR] = toInt(input.substr(0, pos1));
17789 array[MINUTE] = toInt(input.substr(pos1, 2));
17790 array[SECOND] = toInt(input.substr(pos2));
17791 });
17792
17793 // LOCALES
17794
17795 function localeIsPM (input) {
17796 // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
17797 // Using charAt should be more compatible.
17798 return ((input + '').toLowerCase().charAt(0) === 'p');
17799 }
17800
17801 var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
17802 function localeMeridiem (hours, minutes, isLower) {
17803 if (hours > 11) {
17804 return isLower ? 'pm' : 'PM';
17805 } else {
17806 return isLower ? 'am' : 'AM';
17807 }
17808 }
17809
17810
17811 // MOMENTS
17812
17813 // Setting the hour should keep the time, because the user explicitly
17814 // specified which hour they want. So trying to maintain the same hour (in
17815 // a new timezone) makes sense. Adding/subtracting hours does not follow
17816 // this rule.
17817 var getSetHour = makeGetSet('Hours', true);
17818
17819 var baseConfig = {
17820 calendar: defaultCalendar,
17821 longDateFormat: defaultLongDateFormat,
17822 invalidDate: defaultInvalidDate,
17823 ordinal: defaultOrdinal,
17824 dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
17825 relativeTime: defaultRelativeTime,
17826
17827 months: defaultLocaleMonths,
17828 monthsShort: defaultLocaleMonthsShort,
17829
17830 week: defaultLocaleWeek,
17831
17832 weekdays: defaultLocaleWeekdays,
17833 weekdaysMin: defaultLocaleWeekdaysMin,
17834 weekdaysShort: defaultLocaleWeekdaysShort,
17835
17836 meridiemParse: defaultLocaleMeridiemParse
17837 };
17838
17839 // internal storage for locale config files
17840 var locales = {};
17841 var localeFamilies = {};
17842 var globalLocale;
17843
17844 function normalizeLocale(key) {
17845 return key ? key.toLowerCase().replace('_', '-') : key;
17846 }
17847
17848 // pick the locale from the array
17849 // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
17850 // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
17851 function chooseLocale(names) {
17852 var i = 0, j, next, locale, split;
17853
17854 while (i < names.length) {
17855 split = normalizeLocale(names[i]).split('-');
17856 j = split.length;
17857 next = normalizeLocale(names[i + 1]);
17858 next = next ? next.split('-') : null;
17859 while (j > 0) {
17860 locale = loadLocale(split.slice(0, j).join('-'));
17861 if (locale) {
17862 return locale;
17863 }
17864 if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
17865 //the next array item is better than a shallower substring of this one
17866 break;
17867 }
17868 j--;
17869 }
17870 i++;
17871 }
17872 return globalLocale;
17873 }
17874
17875 function loadLocale(name) {
17876 var oldLocale = null;
17877 // TODO: Find a better way to register and load all the locales in Node
17878 if (!locales[name] && ('object' !== 'undefined') &&
17879 module && module.exports) {
17880 try {
17881 oldLocale = globalLocale._abbr;
17882 var aliasedRequire = commonjsRequire;
17883 aliasedRequire('./locale/' + name);
17884 getSetGlobalLocale(oldLocale);
17885 } catch (e) {}
17886 }
17887 return locales[name];
17888 }
17889
17890 // This function will load locale and then set the global locale. If
17891 // no arguments are passed in, it will simply return the current global
17892 // locale key.
17893 function getSetGlobalLocale (key, values) {
17894 var data;
17895 if (key) {
17896 if (isUndefined(values)) {
17897 data = getLocale(key);
17898 }
17899 else {
17900 data = defineLocale(key, values);
17901 }
17902
17903 if (data) {
17904 // moment.duration._locale = moment._locale = data;
17905 globalLocale = data;
17906 }
17907 else {
17908 if ((typeof console !== 'undefined') && console.warn) {
17909 //warn user if arguments are passed but the locale could not be set
17910 console.warn('Locale ' + key + ' not found. Did you forget to load it?');
17911 }
17912 }
17913 }
17914
17915 return globalLocale._abbr;
17916 }
17917
17918 function defineLocale (name, config) {
17919 if (config !== null) {
17920 var locale, parentConfig = baseConfig;
17921 config.abbr = name;
17922 if (locales[name] != null) {
17923 deprecateSimple('defineLocaleOverride',
17924 'use moment.updateLocale(localeName, config) to change ' +
17925 'an existing locale. moment.defineLocale(localeName, ' +
17926 'config) should only be used for creating a new locale ' +
17927 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.');
17928 parentConfig = locales[name]._config;
17929 } else if (config.parentLocale != null) {
17930 if (locales[config.parentLocale] != null) {
17931 parentConfig = locales[config.parentLocale]._config;
17932 } else {
17933 locale = loadLocale(config.parentLocale);
17934 if (locale != null) {
17935 parentConfig = locale._config;
17936 } else {
17937 if (!localeFamilies[config.parentLocale]) {
17938 localeFamilies[config.parentLocale] = [];
17939 }
17940 localeFamilies[config.parentLocale].push({
17941 name: name,
17942 config: config
17943 });
17944 return null;
17945 }
17946 }
17947 }
17948 locales[name] = new Locale(mergeConfigs(parentConfig, config));
17949
17950 if (localeFamilies[name]) {
17951 localeFamilies[name].forEach(function (x) {
17952 defineLocale(x.name, x.config);
17953 });
17954 }
17955
17956 // backwards compat for now: also set the locale
17957 // make sure we set the locale AFTER all child locales have been
17958 // created, so we won't end up with the child locale set.
17959 getSetGlobalLocale(name);
17960
17961
17962 return locales[name];
17963 } else {
17964 // useful for testing
17965 delete locales[name];
17966 return null;
17967 }
17968 }
17969
17970 function updateLocale(name, config) {
17971 if (config != null) {
17972 var locale, tmpLocale, parentConfig = baseConfig;
17973 // MERGE
17974 tmpLocale = loadLocale(name);
17975 if (tmpLocale != null) {
17976 parentConfig = tmpLocale._config;
17977 }
17978 config = mergeConfigs(parentConfig, config);
17979 locale = new Locale(config);
17980 locale.parentLocale = locales[name];
17981 locales[name] = locale;
17982
17983 // backwards compat for now: also set the locale
17984 getSetGlobalLocale(name);
17985 } else {
17986 // pass null for config to unupdate, useful for tests
17987 if (locales[name] != null) {
17988 if (locales[name].parentLocale != null) {
17989 locales[name] = locales[name].parentLocale;
17990 } else if (locales[name] != null) {
17991 delete locales[name];
17992 }
17993 }
17994 }
17995 return locales[name];
17996 }
17997
17998 // returns locale data
17999 function getLocale (key) {
18000 var locale;
18001
18002 if (key && key._locale && key._locale._abbr) {
18003 key = key._locale._abbr;
18004 }
18005
18006 if (!key) {
18007 return globalLocale;
18008 }
18009
18010 if (!isArray(key)) {
18011 //short-circuit everything else
18012 locale = loadLocale(key);
18013 if (locale) {
18014 return locale;
18015 }
18016 key = [key];
18017 }
18018
18019 return chooseLocale(key);
18020 }
18021
18022 function listLocales() {
18023 return keys(locales);
18024 }
18025
18026 function checkOverflow (m) {
18027 var overflow;
18028 var a = m._a;
18029
18030 if (a && getParsingFlags(m).overflow === -2) {
18031 overflow =
18032 a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
18033 a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
18034 a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
18035 a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE :
18036 a[SECOND] < 0 || a[SECOND] > 59 ? SECOND :
18037 a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
18038 -1;
18039
18040 if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
18041 overflow = DATE;
18042 }
18043 if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
18044 overflow = WEEK;
18045 }
18046 if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
18047 overflow = WEEKDAY;
18048 }
18049
18050 getParsingFlags(m).overflow = overflow;
18051 }
18052
18053 return m;
18054 }
18055
18056 // Pick the first defined of two or three arguments.
18057 function defaults(a, b, c) {
18058 if (a != null) {
18059 return a;
18060 }
18061 if (b != null) {
18062 return b;
18063 }
18064 return c;
18065 }
18066
18067 function currentDateArray(config) {
18068 // hooks is actually the exported moment object
18069 var nowValue = new Date(hooks.now());
18070 if (config._useUTC) {
18071 return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()];
18072 }
18073 return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
18074 }
18075
18076 // convert an array to a date.
18077 // the array should mirror the parameters below
18078 // note: all values past the year are optional and will default to the lowest possible value.
18079 // [year, month, day , hour, minute, second, millisecond]
18080 function configFromArray (config) {
18081 var i, date, input = [], currentDate, expectedWeekday, yearToUse;
18082
18083 if (config._d) {
18084 return;
18085 }
18086
18087 currentDate = currentDateArray(config);
18088
18089 //compute day of the year from weeks and weekdays
18090 if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
18091 dayOfYearFromWeekInfo(config);
18092 }
18093
18094 //if the day of the year is set, figure out what it is
18095 if (config._dayOfYear != null) {
18096 yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
18097
18098 if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {
18099 getParsingFlags(config)._overflowDayOfYear = true;
18100 }
18101
18102 date = createUTCDate(yearToUse, 0, config._dayOfYear);
18103 config._a[MONTH] = date.getUTCMonth();
18104 config._a[DATE] = date.getUTCDate();
18105 }
18106
18107 // Default to current date.
18108 // * if no year, month, day of month are given, default to today
18109 // * if day of month is given, default month and year
18110 // * if month is given, default only year
18111 // * if year is given, don't default anything
18112 for (i = 0; i < 3 && config._a[i] == null; ++i) {
18113 config._a[i] = input[i] = currentDate[i];
18114 }
18115
18116 // Zero out whatever was not defaulted, including time
18117 for (; i < 7; i++) {
18118 config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
18119 }
18120
18121 // Check for 24:00:00.000
18122 if (config._a[HOUR] === 24 &&
18123 config._a[MINUTE] === 0 &&
18124 config._a[SECOND] === 0 &&
18125 config._a[MILLISECOND] === 0) {
18126 config._nextDay = true;
18127 config._a[HOUR] = 0;
18128 }
18129
18130 config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
18131 expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay();
18132
18133 // Apply timezone offset from input. The actual utcOffset can be changed
18134 // with parseZone.
18135 if (config._tzm != null) {
18136 config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
18137 }
18138
18139 if (config._nextDay) {
18140 config._a[HOUR] = 24;
18141 }
18142
18143 // check for mismatching day of week
18144 if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) {
18145 getParsingFlags(config).weekdayMismatch = true;
18146 }
18147 }
18148
18149 function dayOfYearFromWeekInfo(config) {
18150 var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
18151
18152 w = config._w;
18153 if (w.GG != null || w.W != null || w.E != null) {
18154 dow = 1;
18155 doy = 4;
18156
18157 // TODO: We need to take the current isoWeekYear, but that depends on
18158 // how we interpret now (local, utc, fixed offset). So create
18159 // a now version of current config (take local/utc/offset flags, and
18160 // create now).
18161 weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year);
18162 week = defaults(w.W, 1);
18163 weekday = defaults(w.E, 1);
18164 if (weekday < 1 || weekday > 7) {
18165 weekdayOverflow = true;
18166 }
18167 } else {
18168 dow = config._locale._week.dow;
18169 doy = config._locale._week.doy;
18170
18171 var curWeek = weekOfYear(createLocal(), dow, doy);
18172
18173 weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
18174
18175 // Default to current week.
18176 week = defaults(w.w, curWeek.week);
18177
18178 if (w.d != null) {
18179 // weekday -- low day numbers are considered next week
18180 weekday = w.d;
18181 if (weekday < 0 || weekday > 6) {
18182 weekdayOverflow = true;
18183 }
18184 } else if (w.e != null) {
18185 // local weekday -- counting starts from beginning of week
18186 weekday = w.e + dow;
18187 if (w.e < 0 || w.e > 6) {
18188 weekdayOverflow = true;
18189 }
18190 } else {
18191 // default to beginning of week
18192 weekday = dow;
18193 }
18194 }
18195 if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
18196 getParsingFlags(config)._overflowWeeks = true;
18197 } else if (weekdayOverflow != null) {
18198 getParsingFlags(config)._overflowWeekday = true;
18199 } else {
18200 temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
18201 config._a[YEAR] = temp.year;
18202 config._dayOfYear = temp.dayOfYear;
18203 }
18204 }
18205
18206 // iso 8601 regex
18207 // 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)
18208 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)?)?$/;
18209 var 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)?)?$/;
18210
18211 var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
18212
18213 var isoDates = [
18214 ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
18215 ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
18216 ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
18217 ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
18218 ['YYYY-DDD', /\d{4}-\d{3}/],
18219 ['YYYY-MM', /\d{4}-\d\d/, false],
18220 ['YYYYYYMMDD', /[+-]\d{10}/],
18221 ['YYYYMMDD', /\d{8}/],
18222 // YYYYMM is NOT allowed by the standard
18223 ['GGGG[W]WWE', /\d{4}W\d{3}/],
18224 ['GGGG[W]WW', /\d{4}W\d{2}/, false],
18225 ['YYYYDDD', /\d{7}/]
18226 ];
18227
18228 // iso time formats and regexes
18229 var isoTimes = [
18230 ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
18231 ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
18232 ['HH:mm:ss', /\d\d:\d\d:\d\d/],
18233 ['HH:mm', /\d\d:\d\d/],
18234 ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
18235 ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
18236 ['HHmmss', /\d\d\d\d\d\d/],
18237 ['HHmm', /\d\d\d\d/],
18238 ['HH', /\d\d/]
18239 ];
18240
18241 var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
18242
18243 // date from iso format
18244 function configFromISO(config) {
18245 var i, l,
18246 string = config._i,
18247 match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
18248 allowTime, dateFormat, timeFormat, tzFormat;
18249
18250 if (match) {
18251 getParsingFlags(config).iso = true;
18252
18253 for (i = 0, l = isoDates.length; i < l; i++) {
18254 if (isoDates[i][1].exec(match[1])) {
18255 dateFormat = isoDates[i][0];
18256 allowTime = isoDates[i][2] !== false;
18257 break;
18258 }
18259 }
18260 if (dateFormat == null) {
18261 config._isValid = false;
18262 return;
18263 }
18264 if (match[3]) {
18265 for (i = 0, l = isoTimes.length; i < l; i++) {
18266 if (isoTimes[i][1].exec(match[3])) {
18267 // match[2] should be 'T' or space
18268 timeFormat = (match[2] || ' ') + isoTimes[i][0];
18269 break;
18270 }
18271 }
18272 if (timeFormat == null) {
18273 config._isValid = false;
18274 return;
18275 }
18276 }
18277 if (!allowTime && timeFormat != null) {
18278 config._isValid = false;
18279 return;
18280 }
18281 if (match[4]) {
18282 if (tzRegex.exec(match[4])) {
18283 tzFormat = 'Z';
18284 } else {
18285 config._isValid = false;
18286 return;
18287 }
18288 }
18289 config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
18290 configFromStringAndFormat(config);
18291 } else {
18292 config._isValid = false;
18293 }
18294 }
18295
18296 // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
18297 var 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}))$/;
18298
18299 function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
18300 var result = [
18301 untruncateYear(yearStr),
18302 defaultLocaleMonthsShort.indexOf(monthStr),
18303 parseInt(dayStr, 10),
18304 parseInt(hourStr, 10),
18305 parseInt(minuteStr, 10)
18306 ];
18307
18308 if (secondStr) {
18309 result.push(parseInt(secondStr, 10));
18310 }
18311
18312 return result;
18313 }
18314
18315 function untruncateYear(yearStr) {
18316 var year = parseInt(yearStr, 10);
18317 if (year <= 49) {
18318 return 2000 + year;
18319 } else if (year <= 999) {
18320 return 1900 + year;
18321 }
18322 return year;
18323 }
18324
18325 function preprocessRFC2822(s) {
18326 // Remove comments and folding whitespace and replace multiple-spaces with a single space
18327 return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, '');
18328 }
18329
18330 function checkWeekday(weekdayStr, parsedInput, config) {
18331 if (weekdayStr) {
18332 // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check.
18333 var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
18334 weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay();
18335 if (weekdayProvided !== weekdayActual) {
18336 getParsingFlags(config).weekdayMismatch = true;
18337 config._isValid = false;
18338 return false;
18339 }
18340 }
18341 return true;
18342 }
18343
18344 var obsOffsets = {
18345 UT: 0,
18346 GMT: 0,
18347 EDT: -4 * 60,
18348 EST: -5 * 60,
18349 CDT: -5 * 60,
18350 CST: -6 * 60,
18351 MDT: -6 * 60,
18352 MST: -7 * 60,
18353 PDT: -7 * 60,
18354 PST: -8 * 60
18355 };
18356
18357 function calculateOffset(obsOffset, militaryOffset, numOffset) {
18358 if (obsOffset) {
18359 return obsOffsets[obsOffset];
18360 } else if (militaryOffset) {
18361 // the only allowed military tz is Z
18362 return 0;
18363 } else {
18364 var hm = parseInt(numOffset, 10);
18365 var m = hm % 100, h = (hm - m) / 100;
18366 return h * 60 + m;
18367 }
18368 }
18369
18370 // date and time from ref 2822 format
18371 function configFromRFC2822(config) {
18372 var match = rfc2822.exec(preprocessRFC2822(config._i));
18373 if (match) {
18374 var parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]);
18375 if (!checkWeekday(match[1], parsedArray, config)) {
18376 return;
18377 }
18378
18379 config._a = parsedArray;
18380 config._tzm = calculateOffset(match[8], match[9], match[10]);
18381
18382 config._d = createUTCDate.apply(null, config._a);
18383 config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
18384
18385 getParsingFlags(config).rfc2822 = true;
18386 } else {
18387 config._isValid = false;
18388 }
18389 }
18390
18391 // date from iso format or fallback
18392 function configFromString(config) {
18393 var matched = aspNetJsonRegex.exec(config._i);
18394
18395 if (matched !== null) {
18396 config._d = new Date(+matched[1]);
18397 return;
18398 }
18399
18400 configFromISO(config);
18401 if (config._isValid === false) {
18402 delete config._isValid;
18403 } else {
18404 return;
18405 }
18406
18407 configFromRFC2822(config);
18408 if (config._isValid === false) {
18409 delete config._isValid;
18410 } else {
18411 return;
18412 }
18413
18414 // Final attempt, use Input Fallback
18415 hooks.createFromInputFallback(config);
18416 }
18417
18418 hooks.createFromInputFallback = deprecate(
18419 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
18420 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
18421 'discouraged and will be removed in an upcoming major release. Please refer to ' +
18422 'http://momentjs.com/guides/#/warnings/js-date/ for more info.',
18423 function (config) {
18424 config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
18425 }
18426 );
18427
18428 // constant that refers to the ISO standard
18429 hooks.ISO_8601 = function () {};
18430
18431 // constant that refers to the RFC 2822 form
18432 hooks.RFC_2822 = function () {};
18433
18434 // date from string and format string
18435 function configFromStringAndFormat(config) {
18436 // TODO: Move this to another part of the creation flow to prevent circular deps
18437 if (config._f === hooks.ISO_8601) {
18438 configFromISO(config);
18439 return;
18440 }
18441 if (config._f === hooks.RFC_2822) {
18442 configFromRFC2822(config);
18443 return;
18444 }
18445 config._a = [];
18446 getParsingFlags(config).empty = true;
18447
18448 // This array is used to make a Date, either with `new Date` or `Date.UTC`
18449 var string = '' + config._i,
18450 i, parsedInput, tokens, token, skipped,
18451 stringLength = string.length,
18452 totalParsedInputLength = 0;
18453
18454 tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
18455
18456 for (i = 0; i < tokens.length; i++) {
18457 token = tokens[i];
18458 parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
18459 // console.log('token', token, 'parsedInput', parsedInput,
18460 // 'regex', getParseRegexForToken(token, config));
18461 if (parsedInput) {
18462 skipped = string.substr(0, string.indexOf(parsedInput));
18463 if (skipped.length > 0) {
18464 getParsingFlags(config).unusedInput.push(skipped);
18465 }
18466 string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
18467 totalParsedInputLength += parsedInput.length;
18468 }
18469 // don't parse if it's not a known token
18470 if (formatTokenFunctions[token]) {
18471 if (parsedInput) {
18472 getParsingFlags(config).empty = false;
18473 }
18474 else {
18475 getParsingFlags(config).unusedTokens.push(token);
18476 }
18477 addTimeToArrayFromToken(token, parsedInput, config);
18478 }
18479 else if (config._strict && !parsedInput) {
18480 getParsingFlags(config).unusedTokens.push(token);
18481 }
18482 }
18483
18484 // add remaining unparsed input length to the string
18485 getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
18486 if (string.length > 0) {
18487 getParsingFlags(config).unusedInput.push(string);
18488 }
18489
18490 // clear _12h flag if hour is <= 12
18491 if (config._a[HOUR] <= 12 &&
18492 getParsingFlags(config).bigHour === true &&
18493 config._a[HOUR] > 0) {
18494 getParsingFlags(config).bigHour = undefined;
18495 }
18496
18497 getParsingFlags(config).parsedDateParts = config._a.slice(0);
18498 getParsingFlags(config).meridiem = config._meridiem;
18499 // handle meridiem
18500 config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
18501
18502 configFromArray(config);
18503 checkOverflow(config);
18504 }
18505
18506
18507 function meridiemFixWrap (locale, hour, meridiem) {
18508 var isPm;
18509
18510 if (meridiem == null) {
18511 // nothing to do
18512 return hour;
18513 }
18514 if (locale.meridiemHour != null) {
18515 return locale.meridiemHour(hour, meridiem);
18516 } else if (locale.isPM != null) {
18517 // Fallback
18518 isPm = locale.isPM(meridiem);
18519 if (isPm && hour < 12) {
18520 hour += 12;
18521 }
18522 if (!isPm && hour === 12) {
18523 hour = 0;
18524 }
18525 return hour;
18526 } else {
18527 // this is not supposed to happen
18528 return hour;
18529 }
18530 }
18531
18532 // date from string and array of format strings
18533 function configFromStringAndArray(config) {
18534 var tempConfig,
18535 bestMoment,
18536
18537 scoreToBeat,
18538 i,
18539 currentScore;
18540
18541 if (config._f.length === 0) {
18542 getParsingFlags(config).invalidFormat = true;
18543 config._d = new Date(NaN);
18544 return;
18545 }
18546
18547 for (i = 0; i < config._f.length; i++) {
18548 currentScore = 0;
18549 tempConfig = copyConfig({}, config);
18550 if (config._useUTC != null) {
18551 tempConfig._useUTC = config._useUTC;
18552 }
18553 tempConfig._f = config._f[i];
18554 configFromStringAndFormat(tempConfig);
18555
18556 if (!isValid(tempConfig)) {
18557 continue;
18558 }
18559
18560 // if there is any input that was not parsed add a penalty for that format
18561 currentScore += getParsingFlags(tempConfig).charsLeftOver;
18562
18563 //or tokens
18564 currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
18565
18566 getParsingFlags(tempConfig).score = currentScore;
18567
18568 if (scoreToBeat == null || currentScore < scoreToBeat) {
18569 scoreToBeat = currentScore;
18570 bestMoment = tempConfig;
18571 }
18572 }
18573
18574 extend(config, bestMoment || tempConfig);
18575 }
18576
18577 function configFromObject(config) {
18578 if (config._d) {
18579 return;
18580 }
18581
18582 var i = normalizeObjectUnits(config._i);
18583 config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) {
18584 return obj && parseInt(obj, 10);
18585 });
18586
18587 configFromArray(config);
18588 }
18589
18590 function createFromConfig (config) {
18591 var res = new Moment(checkOverflow(prepareConfig(config)));
18592 if (res._nextDay) {
18593 // Adding is smart enough around DST
18594 res.add(1, 'd');
18595 res._nextDay = undefined;
18596 }
18597
18598 return res;
18599 }
18600
18601 function prepareConfig (config) {
18602 var input = config._i,
18603 format = config._f;
18604
18605 config._locale = config._locale || getLocale(config._l);
18606
18607 if (input === null || (format === undefined && input === '')) {
18608 return createInvalid({nullInput: true});
18609 }
18610
18611 if (typeof input === 'string') {
18612 config._i = input = config._locale.preparse(input);
18613 }
18614
18615 if (isMoment(input)) {
18616 return new Moment(checkOverflow(input));
18617 } else if (isDate(input)) {
18618 config._d = input;
18619 } else if (isArray(format)) {
18620 configFromStringAndArray(config);
18621 } else if (format) {
18622 configFromStringAndFormat(config);
18623 } else {
18624 configFromInput(config);
18625 }
18626
18627 if (!isValid(config)) {
18628 config._d = null;
18629 }
18630
18631 return config;
18632 }
18633
18634 function configFromInput(config) {
18635 var input = config._i;
18636 if (isUndefined(input)) {
18637 config._d = new Date(hooks.now());
18638 } else if (isDate(input)) {
18639 config._d = new Date(input.valueOf());
18640 } else if (typeof input === 'string') {
18641 configFromString(config);
18642 } else if (isArray(input)) {
18643 config._a = map(input.slice(0), function (obj) {
18644 return parseInt(obj, 10);
18645 });
18646 configFromArray(config);
18647 } else if (isObject(input)) {
18648 configFromObject(config);
18649 } else if (isNumber(input)) {
18650 // from milliseconds
18651 config._d = new Date(input);
18652 } else {
18653 hooks.createFromInputFallback(config);
18654 }
18655 }
18656
18657 function createLocalOrUTC (input, format, locale, strict, isUTC) {
18658 var c = {};
18659
18660 if (locale === true || locale === false) {
18661 strict = locale;
18662 locale = undefined;
18663 }
18664
18665 if ((isObject(input) && isObjectEmpty(input)) ||
18666 (isArray(input) && input.length === 0)) {
18667 input = undefined;
18668 }
18669 // object construction must be done this way.
18670 // https://github.com/moment/moment/issues/1423
18671 c._isAMomentObject = true;
18672 c._useUTC = c._isUTC = isUTC;
18673 c._l = locale;
18674 c._i = input;
18675 c._f = format;
18676 c._strict = strict;
18677
18678 return createFromConfig(c);
18679 }
18680
18681 function createLocal (input, format, locale, strict) {
18682 return createLocalOrUTC(input, format, locale, strict, false);
18683 }
18684
18685 var prototypeMin = deprecate(
18686 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
18687 function () {
18688 var other = createLocal.apply(null, arguments);
18689 if (this.isValid() && other.isValid()) {
18690 return other < this ? this : other;
18691 } else {
18692 return createInvalid();
18693 }
18694 }
18695 );
18696
18697 var prototypeMax = deprecate(
18698 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
18699 function () {
18700 var other = createLocal.apply(null, arguments);
18701 if (this.isValid() && other.isValid()) {
18702 return other > this ? this : other;
18703 } else {
18704 return createInvalid();
18705 }
18706 }
18707 );
18708
18709 // Pick a moment m from moments so that m[fn](other) is true for all
18710 // other. This relies on the function fn to be transitive.
18711 //
18712 // moments should either be an array of moment objects or an array, whose
18713 // first element is an array of moment objects.
18714 function pickBy(fn, moments) {
18715 var res, i;
18716 if (moments.length === 1 && isArray(moments[0])) {
18717 moments = moments[0];
18718 }
18719 if (!moments.length) {
18720 return createLocal();
18721 }
18722 res = moments[0];
18723 for (i = 1; i < moments.length; ++i) {
18724 if (!moments[i].isValid() || moments[i][fn](res)) {
18725 res = moments[i];
18726 }
18727 }
18728 return res;
18729 }
18730
18731 // TODO: Use [].sort instead?
18732 function min () {
18733 var args = [].slice.call(arguments, 0);
18734
18735 return pickBy('isBefore', args);
18736 }
18737
18738 function max () {
18739 var args = [].slice.call(arguments, 0);
18740
18741 return pickBy('isAfter', args);
18742 }
18743
18744 var now = function () {
18745 return Date.now ? Date.now() : +(new Date());
18746 };
18747
18748 var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond'];
18749
18750 function isDurationValid(m) {
18751 for (var key in m) {
18752 if (!(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) {
18753 return false;
18754 }
18755 }
18756
18757 var unitHasDecimal = false;
18758 for (var i = 0; i < ordering.length; ++i) {
18759 if (m[ordering[i]]) {
18760 if (unitHasDecimal) {
18761 return false; // only allow non-integers for smallest unit
18762 }
18763 if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
18764 unitHasDecimal = true;
18765 }
18766 }
18767 }
18768
18769 return true;
18770 }
18771
18772 function isValid$1() {
18773 return this._isValid;
18774 }
18775
18776 function createInvalid$1() {
18777 return createDuration(NaN);
18778 }
18779
18780 function Duration (duration) {
18781 var normalizedInput = normalizeObjectUnits(duration),
18782 years = normalizedInput.year || 0,
18783 quarters = normalizedInput.quarter || 0,
18784 months = normalizedInput.month || 0,
18785 weeks = normalizedInput.week || normalizedInput.isoWeek || 0,
18786 days = normalizedInput.day || 0,
18787 hours = normalizedInput.hour || 0,
18788 minutes = normalizedInput.minute || 0,
18789 seconds = normalizedInput.second || 0,
18790 milliseconds = normalizedInput.millisecond || 0;
18791
18792 this._isValid = isDurationValid(normalizedInput);
18793
18794 // representation for dateAddRemove
18795 this._milliseconds = +milliseconds +
18796 seconds * 1e3 + // 1000
18797 minutes * 6e4 + // 1000 * 60
18798 hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
18799 // Because of dateAddRemove treats 24 hours as different from a
18800 // day when working around DST, we need to store them separately
18801 this._days = +days +
18802 weeks * 7;
18803 // It is impossible to translate months into days without knowing
18804 // which months you are are talking about, so we have to store
18805 // it separately.
18806 this._months = +months +
18807 quarters * 3 +
18808 years * 12;
18809
18810 this._data = {};
18811
18812 this._locale = getLocale();
18813
18814 this._bubble();
18815 }
18816
18817 function isDuration (obj) {
18818 return obj instanceof Duration;
18819 }
18820
18821 function absRound (number) {
18822 if (number < 0) {
18823 return Math.round(-1 * number) * -1;
18824 } else {
18825 return Math.round(number);
18826 }
18827 }
18828
18829 // FORMATTING
18830
18831 function offset (token, separator) {
18832 addFormatToken(token, 0, 0, function () {
18833 var offset = this.utcOffset();
18834 var sign = '+';
18835 if (offset < 0) {
18836 offset = -offset;
18837 sign = '-';
18838 }
18839 return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2);
18840 });
18841 }
18842
18843 offset('Z', ':');
18844 offset('ZZ', '');
18845
18846 // PARSING
18847
18848 addRegexToken('Z', matchShortOffset);
18849 addRegexToken('ZZ', matchShortOffset);
18850 addParseToken(['Z', 'ZZ'], function (input, array, config) {
18851 config._useUTC = true;
18852 config._tzm = offsetFromString(matchShortOffset, input);
18853 });
18854
18855 // HELPERS
18856
18857 // timezone chunker
18858 // '+10:00' > ['10', '00']
18859 // '-1530' > ['-15', '30']
18860 var chunkOffset = /([\+\-]|\d\d)/gi;
18861
18862 function offsetFromString(matcher, string) {
18863 var matches = (string || '').match(matcher);
18864
18865 if (matches === null) {
18866 return null;
18867 }
18868
18869 var chunk = matches[matches.length - 1] || [];
18870 var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
18871 var minutes = +(parts[1] * 60) + toInt(parts[2]);
18872
18873 return minutes === 0 ?
18874 0 :
18875 parts[0] === '+' ? minutes : -minutes;
18876 }
18877
18878 // Return a moment from input, that is local/utc/zone equivalent to model.
18879 function cloneWithOffset(input, model) {
18880 var res, diff;
18881 if (model._isUTC) {
18882 res = model.clone();
18883 diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();
18884 // Use low-level api, because this fn is low-level api.
18885 res._d.setTime(res._d.valueOf() + diff);
18886 hooks.updateOffset(res, false);
18887 return res;
18888 } else {
18889 return createLocal(input).local();
18890 }
18891 }
18892
18893 function getDateOffset (m) {
18894 // On Firefox.24 Date#getTimezoneOffset returns a floating point.
18895 // https://github.com/moment/moment/pull/1871
18896 return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
18897 }
18898
18899 // HOOKS
18900
18901 // This function will be called whenever a moment is mutated.
18902 // It is intended to keep the offset in sync with the timezone.
18903 hooks.updateOffset = function () {};
18904
18905 // MOMENTS
18906
18907 // keepLocalTime = true means only change the timezone, without
18908 // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
18909 // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
18910 // +0200, so we adjust the time as needed, to be valid.
18911 //
18912 // Keeping the time actually adds/subtracts (one hour)
18913 // from the actual represented time. That is why we call updateOffset
18914 // a second time. In case it wants us to change the offset again
18915 // _changeInProgress == true case, then we have to adjust, because
18916 // there is no such time in the given timezone.
18917 function getSetOffset (input, keepLocalTime, keepMinutes) {
18918 var offset = this._offset || 0,
18919 localAdjust;
18920 if (!this.isValid()) {
18921 return input != null ? this : NaN;
18922 }
18923 if (input != null) {
18924 if (typeof input === 'string') {
18925 input = offsetFromString(matchShortOffset, input);
18926 if (input === null) {
18927 return this;
18928 }
18929 } else if (Math.abs(input) < 16 && !keepMinutes) {
18930 input = input * 60;
18931 }
18932 if (!this._isUTC && keepLocalTime) {
18933 localAdjust = getDateOffset(this);
18934 }
18935 this._offset = input;
18936 this._isUTC = true;
18937 if (localAdjust != null) {
18938 this.add(localAdjust, 'm');
18939 }
18940 if (offset !== input) {
18941 if (!keepLocalTime || this._changeInProgress) {
18942 addSubtract(this, createDuration(input - offset, 'm'), 1, false);
18943 } else if (!this._changeInProgress) {
18944 this._changeInProgress = true;
18945 hooks.updateOffset(this, true);
18946 this._changeInProgress = null;
18947 }
18948 }
18949 return this;
18950 } else {
18951 return this._isUTC ? offset : getDateOffset(this);
18952 }
18953 }
18954
18955 function getSetZone (input, keepLocalTime) {
18956 if (input != null) {
18957 if (typeof input !== 'string') {
18958 input = -input;
18959 }
18960
18961 this.utcOffset(input, keepLocalTime);
18962
18963 return this;
18964 } else {
18965 return -this.utcOffset();
18966 }
18967 }
18968
18969 function setOffsetToUTC (keepLocalTime) {
18970 return this.utcOffset(0, keepLocalTime);
18971 }
18972
18973 function setOffsetToLocal (keepLocalTime) {
18974 if (this._isUTC) {
18975 this.utcOffset(0, keepLocalTime);
18976 this._isUTC = false;
18977
18978 if (keepLocalTime) {
18979 this.subtract(getDateOffset(this), 'm');
18980 }
18981 }
18982 return this;
18983 }
18984
18985 function setOffsetToParsedOffset () {
18986 if (this._tzm != null) {
18987 this.utcOffset(this._tzm, false, true);
18988 } else if (typeof this._i === 'string') {
18989 var tZone = offsetFromString(matchOffset, this._i);
18990 if (tZone != null) {
18991 this.utcOffset(tZone);
18992 }
18993 else {
18994 this.utcOffset(0, true);
18995 }
18996 }
18997 return this;
18998 }
18999
19000 function hasAlignedHourOffset (input) {
19001 if (!this.isValid()) {
19002 return false;
19003 }
19004 input = input ? createLocal(input).utcOffset() : 0;
19005
19006 return (this.utcOffset() - input) % 60 === 0;
19007 }
19008
19009 function isDaylightSavingTime () {
19010 return (
19011 this.utcOffset() > this.clone().month(0).utcOffset() ||
19012 this.utcOffset() > this.clone().month(5).utcOffset()
19013 );
19014 }
19015
19016 function isDaylightSavingTimeShifted () {
19017 if (!isUndefined(this._isDSTShifted)) {
19018 return this._isDSTShifted;
19019 }
19020
19021 var c = {};
19022
19023 copyConfig(c, this);
19024 c = prepareConfig(c);
19025
19026 if (c._a) {
19027 var other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
19028 this._isDSTShifted = this.isValid() &&
19029 compareArrays(c._a, other.toArray()) > 0;
19030 } else {
19031 this._isDSTShifted = false;
19032 }
19033
19034 return this._isDSTShifted;
19035 }
19036
19037 function isLocal () {
19038 return this.isValid() ? !this._isUTC : false;
19039 }
19040
19041 function isUtcOffset () {
19042 return this.isValid() ? this._isUTC : false;
19043 }
19044
19045 function isUtc () {
19046 return this.isValid() ? this._isUTC && this._offset === 0 : false;
19047 }
19048
19049 // ASP.NET json date format regex
19050 var aspNetRegex = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/;
19051
19052 // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
19053 // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
19054 // and further modified to allow for strings containing both week and day
19055 var isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
19056
19057 function createDuration (input, key) {
19058 var duration = input,
19059 // matching against regexp is expensive, do it on demand
19060 match = null,
19061 sign,
19062 ret,
19063 diffRes;
19064
19065 if (isDuration(input)) {
19066 duration = {
19067 ms : input._milliseconds,
19068 d : input._days,
19069 M : input._months
19070 };
19071 } else if (isNumber(input)) {
19072 duration = {};
19073 if (key) {
19074 duration[key] = input;
19075 } else {
19076 duration.milliseconds = input;
19077 }
19078 } else if (!!(match = aspNetRegex.exec(input))) {
19079 sign = (match[1] === '-') ? -1 : 1;
19080 duration = {
19081 y : 0,
19082 d : toInt(match[DATE]) * sign,
19083 h : toInt(match[HOUR]) * sign,
19084 m : toInt(match[MINUTE]) * sign,
19085 s : toInt(match[SECOND]) * sign,
19086 ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match
19087 };
19088 } else if (!!(match = isoRegex.exec(input))) {
19089 sign = (match[1] === '-') ? -1 : 1;
19090 duration = {
19091 y : parseIso(match[2], sign),
19092 M : parseIso(match[3], sign),
19093 w : parseIso(match[4], sign),
19094 d : parseIso(match[5], sign),
19095 h : parseIso(match[6], sign),
19096 m : parseIso(match[7], sign),
19097 s : parseIso(match[8], sign)
19098 };
19099 } else if (duration == null) {// checks for null or undefined
19100 duration = {};
19101 } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {
19102 diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to));
19103
19104 duration = {};
19105 duration.ms = diffRes.milliseconds;
19106 duration.M = diffRes.months;
19107 }
19108
19109 ret = new Duration(duration);
19110
19111 if (isDuration(input) && hasOwnProp(input, '_locale')) {
19112 ret._locale = input._locale;
19113 }
19114
19115 return ret;
19116 }
19117
19118 createDuration.fn = Duration.prototype;
19119 createDuration.invalid = createInvalid$1;
19120
19121 function parseIso (inp, sign) {
19122 // We'd normally use ~~inp for this, but unfortunately it also
19123 // converts floats to ints.
19124 // inp may be undefined, so careful calling replace on it.
19125 var res = inp && parseFloat(inp.replace(',', '.'));
19126 // apply sign while we're at it
19127 return (isNaN(res) ? 0 : res) * sign;
19128 }
19129
19130 function positiveMomentsDifference(base, other) {
19131 var res = {};
19132
19133 res.months = other.month() - base.month() +
19134 (other.year() - base.year()) * 12;
19135 if (base.clone().add(res.months, 'M').isAfter(other)) {
19136 --res.months;
19137 }
19138
19139 res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
19140
19141 return res;
19142 }
19143
19144 function momentsDifference(base, other) {
19145 var res;
19146 if (!(base.isValid() && other.isValid())) {
19147 return {milliseconds: 0, months: 0};
19148 }
19149
19150 other = cloneWithOffset(other, base);
19151 if (base.isBefore(other)) {
19152 res = positiveMomentsDifference(base, other);
19153 } else {
19154 res = positiveMomentsDifference(other, base);
19155 res.milliseconds = -res.milliseconds;
19156 res.months = -res.months;
19157 }
19158
19159 return res;
19160 }
19161
19162 // TODO: remove 'name' arg after deprecation is removed
19163 function createAdder(direction, name) {
19164 return function (val, period) {
19165 var dur, tmp;
19166 //invert the arguments, but complain about it
19167 if (period !== null && !isNaN(+period)) {
19168 deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' +
19169 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.');
19170 tmp = val; val = period; period = tmp;
19171 }
19172
19173 val = typeof val === 'string' ? +val : val;
19174 dur = createDuration(val, period);
19175 addSubtract(this, dur, direction);
19176 return this;
19177 };
19178 }
19179
19180 function addSubtract (mom, duration, isAdding, updateOffset) {
19181 var milliseconds = duration._milliseconds,
19182 days = absRound(duration._days),
19183 months = absRound(duration._months);
19184
19185 if (!mom.isValid()) {
19186 // No op
19187 return;
19188 }
19189
19190 updateOffset = updateOffset == null ? true : updateOffset;
19191
19192 if (months) {
19193 setMonth(mom, get(mom, 'Month') + months * isAdding);
19194 }
19195 if (days) {
19196 set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
19197 }
19198 if (milliseconds) {
19199 mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
19200 }
19201 if (updateOffset) {
19202 hooks.updateOffset(mom, days || months);
19203 }
19204 }
19205
19206 var add = createAdder(1, 'add');
19207 var subtract = createAdder(-1, 'subtract');
19208
19209 function getCalendarFormat(myMoment, now) {
19210 var diff = myMoment.diff(now, 'days', true);
19211 return diff < -6 ? 'sameElse' :
19212 diff < -1 ? 'lastWeek' :
19213 diff < 0 ? 'lastDay' :
19214 diff < 1 ? 'sameDay' :
19215 diff < 2 ? 'nextDay' :
19216 diff < 7 ? 'nextWeek' : 'sameElse';
19217 }
19218
19219 function calendar$1 (time, formats) {
19220 // We want to compare the start of today, vs this.
19221 // Getting start-of-today depends on whether we're local/utc/offset or not.
19222 var now = time || createLocal(),
19223 sod = cloneWithOffset(now, this).startOf('day'),
19224 format = hooks.calendarFormat(this, sod) || 'sameElse';
19225
19226 var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);
19227
19228 return this.format(output || this.localeData().calendar(format, this, createLocal(now)));
19229 }
19230
19231 function clone () {
19232 return new Moment(this);
19233 }
19234
19235 function isAfter (input, units) {
19236 var localInput = isMoment(input) ? input : createLocal(input);
19237 if (!(this.isValid() && localInput.isValid())) {
19238 return false;
19239 }
19240 units = normalizeUnits(units) || 'millisecond';
19241 if (units === 'millisecond') {
19242 return this.valueOf() > localInput.valueOf();
19243 } else {
19244 return localInput.valueOf() < this.clone().startOf(units).valueOf();
19245 }
19246 }
19247
19248 function isBefore (input, units) {
19249 var localInput = isMoment(input) ? input : createLocal(input);
19250 if (!(this.isValid() && localInput.isValid())) {
19251 return false;
19252 }
19253 units = normalizeUnits(units) || 'millisecond';
19254 if (units === 'millisecond') {
19255 return this.valueOf() < localInput.valueOf();
19256 } else {
19257 return this.clone().endOf(units).valueOf() < localInput.valueOf();
19258 }
19259 }
19260
19261 function isBetween (from, to, units, inclusivity) {
19262 var localFrom = isMoment(from) ? from : createLocal(from),
19263 localTo = isMoment(to) ? to : createLocal(to);
19264 if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
19265 return false;
19266 }
19267 inclusivity = inclusivity || '()';
19268 return (inclusivity[0] === '(' ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) &&
19269 (inclusivity[1] === ')' ? this.isBefore(localTo, units) : !this.isAfter(localTo, units));
19270 }
19271
19272 function isSame (input, units) {
19273 var localInput = isMoment(input) ? input : createLocal(input),
19274 inputMs;
19275 if (!(this.isValid() && localInput.isValid())) {
19276 return false;
19277 }
19278 units = normalizeUnits(units) || 'millisecond';
19279 if (units === 'millisecond') {
19280 return this.valueOf() === localInput.valueOf();
19281 } else {
19282 inputMs = localInput.valueOf();
19283 return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
19284 }
19285 }
19286
19287 function isSameOrAfter (input, units) {
19288 return this.isSame(input, units) || this.isAfter(input, units);
19289 }
19290
19291 function isSameOrBefore (input, units) {
19292 return this.isSame(input, units) || this.isBefore(input, units);
19293 }
19294
19295 function diff (input, units, asFloat) {
19296 var that,
19297 zoneDelta,
19298 output;
19299
19300 if (!this.isValid()) {
19301 return NaN;
19302 }
19303
19304 that = cloneWithOffset(input, this);
19305
19306 if (!that.isValid()) {
19307 return NaN;
19308 }
19309
19310 zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
19311
19312 units = normalizeUnits(units);
19313
19314 switch (units) {
19315 case 'year': output = monthDiff(this, that) / 12; break;
19316 case 'month': output = monthDiff(this, that); break;
19317 case 'quarter': output = monthDiff(this, that) / 3; break;
19318 case 'second': output = (this - that) / 1e3; break; // 1000
19319 case 'minute': output = (this - that) / 6e4; break; // 1000 * 60
19320 case 'hour': output = (this - that) / 36e5; break; // 1000 * 60 * 60
19321 case 'day': output = (this - that - zoneDelta) / 864e5; break; // 1000 * 60 * 60 * 24, negate dst
19322 case 'week': output = (this - that - zoneDelta) / 6048e5; break; // 1000 * 60 * 60 * 24 * 7, negate dst
19323 default: output = this - that;
19324 }
19325
19326 return asFloat ? output : absFloor(output);
19327 }
19328
19329 function monthDiff (a, b) {
19330 // difference in months
19331 var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()),
19332 // b is in (anchor - 1 month, anchor + 1 month)
19333 anchor = a.clone().add(wholeMonthDiff, 'months'),
19334 anchor2, adjust;
19335
19336 if (b - anchor < 0) {
19337 anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
19338 // linear across the month
19339 adjust = (b - anchor) / (anchor - anchor2);
19340 } else {
19341 anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
19342 // linear across the month
19343 adjust = (b - anchor) / (anchor2 - anchor);
19344 }
19345
19346 //check for negative zero, return zero if negative zero
19347 return -(wholeMonthDiff + adjust) || 0;
19348 }
19349
19350 hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
19351 hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
19352
19353 function toString () {
19354 return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
19355 }
19356
19357 function toISOString(keepOffset) {
19358 if (!this.isValid()) {
19359 return null;
19360 }
19361 var utc = keepOffset !== true;
19362 var m = utc ? this.clone().utc() : this;
19363 if (m.year() < 0 || m.year() > 9999) {
19364 return formatMoment(m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ');
19365 }
19366 if (isFunction(Date.prototype.toISOString)) {
19367 // native implementation is ~50x faster, use it when we can
19368 if (utc) {
19369 return this.toDate().toISOString();
19370 } else {
19371 return new Date(this.valueOf() + this.utcOffset() * 60 * 1000).toISOString().replace('Z', formatMoment(m, 'Z'));
19372 }
19373 }
19374 return formatMoment(m, utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ');
19375 }
19376
19377 /**
19378 * Return a human readable representation of a moment that can
19379 * also be evaluated to get a new moment which is the same
19380 *
19381 * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
19382 */
19383 function inspect () {
19384 if (!this.isValid()) {
19385 return 'moment.invalid(/* ' + this._i + ' */)';
19386 }
19387 var func = 'moment';
19388 var zone = '';
19389 if (!this.isLocal()) {
19390 func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
19391 zone = 'Z';
19392 }
19393 var prefix = '[' + func + '("]';
19394 var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';
19395 var datetime = '-MM-DD[T]HH:mm:ss.SSS';
19396 var suffix = zone + '[")]';
19397
19398 return this.format(prefix + year + datetime + suffix);
19399 }
19400
19401 function format (inputString) {
19402 if (!inputString) {
19403 inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat;
19404 }
19405 var output = formatMoment(this, inputString);
19406 return this.localeData().postformat(output);
19407 }
19408
19409 function from (time, withoutSuffix) {
19410 if (this.isValid() &&
19411 ((isMoment(time) && time.isValid()) ||
19412 createLocal(time).isValid())) {
19413 return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
19414 } else {
19415 return this.localeData().invalidDate();
19416 }
19417 }
19418
19419 function fromNow (withoutSuffix) {
19420 return this.from(createLocal(), withoutSuffix);
19421 }
19422
19423 function to (time, withoutSuffix) {
19424 if (this.isValid() &&
19425 ((isMoment(time) && time.isValid()) ||
19426 createLocal(time).isValid())) {
19427 return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
19428 } else {
19429 return this.localeData().invalidDate();
19430 }
19431 }
19432
19433 function toNow (withoutSuffix) {
19434 return this.to(createLocal(), withoutSuffix);
19435 }
19436
19437 // If passed a locale key, it will set the locale for this
19438 // instance. Otherwise, it will return the locale configuration
19439 // variables for this instance.
19440 function locale (key) {
19441 var newLocaleData;
19442
19443 if (key === undefined) {
19444 return this._locale._abbr;
19445 } else {
19446 newLocaleData = getLocale(key);
19447 if (newLocaleData != null) {
19448 this._locale = newLocaleData;
19449 }
19450 return this;
19451 }
19452 }
19453
19454 var lang = deprecate(
19455 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
19456 function (key) {
19457 if (key === undefined) {
19458 return this.localeData();
19459 } else {
19460 return this.locale(key);
19461 }
19462 }
19463 );
19464
19465 function localeData () {
19466 return this._locale;
19467 }
19468
19469 var MS_PER_SECOND = 1000;
19470 var MS_PER_MINUTE = 60 * MS_PER_SECOND;
19471 var MS_PER_HOUR = 60 * MS_PER_MINUTE;
19472 var MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
19473
19474 // actual modulo - handles negative numbers (for dates before 1970):
19475 function mod$1(dividend, divisor) {
19476 return (dividend % divisor + divisor) % divisor;
19477 }
19478
19479 function localStartOfDate(y, m, d) {
19480 // the date constructor remaps years 0-99 to 1900-1999
19481 if (y < 100 && y >= 0) {
19482 // preserve leap years using a full 400 year cycle, then reset
19483 return new Date(y + 400, m, d) - MS_PER_400_YEARS;
19484 } else {
19485 return new Date(y, m, d).valueOf();
19486 }
19487 }
19488
19489 function utcStartOfDate(y, m, d) {
19490 // Date.UTC remaps years 0-99 to 1900-1999
19491 if (y < 100 && y >= 0) {
19492 // preserve leap years using a full 400 year cycle, then reset
19493 return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
19494 } else {
19495 return Date.UTC(y, m, d);
19496 }
19497 }
19498
19499 function startOf (units) {
19500 var time;
19501 units = normalizeUnits(units);
19502 if (units === undefined || units === 'millisecond' || !this.isValid()) {
19503 return this;
19504 }
19505
19506 var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
19507
19508 switch (units) {
19509 case 'year':
19510 time = startOfDate(this.year(), 0, 1);
19511 break;
19512 case 'quarter':
19513 time = startOfDate(this.year(), this.month() - this.month() % 3, 1);
19514 break;
19515 case 'month':
19516 time = startOfDate(this.year(), this.month(), 1);
19517 break;
19518 case 'week':
19519 time = startOfDate(this.year(), this.month(), this.date() - this.weekday());
19520 break;
19521 case 'isoWeek':
19522 time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1));
19523 break;
19524 case 'day':
19525 case 'date':
19526 time = startOfDate(this.year(), this.month(), this.date());
19527 break;
19528 case 'hour':
19529 time = this._d.valueOf();
19530 time -= mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR);
19531 break;
19532 case 'minute':
19533 time = this._d.valueOf();
19534 time -= mod$1(time, MS_PER_MINUTE);
19535 break;
19536 case 'second':
19537 time = this._d.valueOf();
19538 time -= mod$1(time, MS_PER_SECOND);
19539 break;
19540 }
19541
19542 this._d.setTime(time);
19543 hooks.updateOffset(this, true);
19544 return this;
19545 }
19546
19547 function endOf (units) {
19548 var time;
19549 units = normalizeUnits(units);
19550 if (units === undefined || units === 'millisecond' || !this.isValid()) {
19551 return this;
19552 }
19553
19554 var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
19555
19556 switch (units) {
19557 case 'year':
19558 time = startOfDate(this.year() + 1, 0, 1) - 1;
19559 break;
19560 case 'quarter':
19561 time = startOfDate(this.year(), this.month() - this.month() % 3 + 3, 1) - 1;
19562 break;
19563 case 'month':
19564 time = startOfDate(this.year(), this.month() + 1, 1) - 1;
19565 break;
19566 case 'week':
19567 time = startOfDate(this.year(), this.month(), this.date() - this.weekday() + 7) - 1;
19568 break;
19569 case 'isoWeek':
19570 time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1;
19571 break;
19572 case 'day':
19573 case 'date':
19574 time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
19575 break;
19576 case 'hour':
19577 time = this._d.valueOf();
19578 time += MS_PER_HOUR - mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR) - 1;
19579 break;
19580 case 'minute':
19581 time = this._d.valueOf();
19582 time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
19583 break;
19584 case 'second':
19585 time = this._d.valueOf();
19586 time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
19587 break;
19588 }
19589
19590 this._d.setTime(time);
19591 hooks.updateOffset(this, true);
19592 return this;
19593 }
19594
19595 function valueOf () {
19596 return this._d.valueOf() - ((this._offset || 0) * 60000);
19597 }
19598
19599 function unix () {
19600 return Math.floor(this.valueOf() / 1000);
19601 }
19602
19603 function toDate () {
19604 return new Date(this.valueOf());
19605 }
19606
19607 function toArray () {
19608 var m = this;
19609 return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
19610 }
19611
19612 function toObject () {
19613 var m = this;
19614 return {
19615 years: m.year(),
19616 months: m.month(),
19617 date: m.date(),
19618 hours: m.hours(),
19619 minutes: m.minutes(),
19620 seconds: m.seconds(),
19621 milliseconds: m.milliseconds()
19622 };
19623 }
19624
19625 function toJSON () {
19626 // new Date(NaN).toJSON() === null
19627 return this.isValid() ? this.toISOString() : null;
19628 }
19629
19630 function isValid$2 () {
19631 return isValid(this);
19632 }
19633
19634 function parsingFlags () {
19635 return extend({}, getParsingFlags(this));
19636 }
19637
19638 function invalidAt () {
19639 return getParsingFlags(this).overflow;
19640 }
19641
19642 function creationData() {
19643 return {
19644 input: this._i,
19645 format: this._f,
19646 locale: this._locale,
19647 isUTC: this._isUTC,
19648 strict: this._strict
19649 };
19650 }
19651
19652 // FORMATTING
19653
19654 addFormatToken(0, ['gg', 2], 0, function () {
19655 return this.weekYear() % 100;
19656 });
19657
19658 addFormatToken(0, ['GG', 2], 0, function () {
19659 return this.isoWeekYear() % 100;
19660 });
19661
19662 function addWeekYearFormatToken (token, getter) {
19663 addFormatToken(0, [token, token.length], 0, getter);
19664 }
19665
19666 addWeekYearFormatToken('gggg', 'weekYear');
19667 addWeekYearFormatToken('ggggg', 'weekYear');
19668 addWeekYearFormatToken('GGGG', 'isoWeekYear');
19669 addWeekYearFormatToken('GGGGG', 'isoWeekYear');
19670
19671 // ALIASES
19672
19673 addUnitAlias('weekYear', 'gg');
19674 addUnitAlias('isoWeekYear', 'GG');
19675
19676 // PRIORITY
19677
19678 addUnitPriority('weekYear', 1);
19679 addUnitPriority('isoWeekYear', 1);
19680
19681
19682 // PARSING
19683
19684 addRegexToken('G', matchSigned);
19685 addRegexToken('g', matchSigned);
19686 addRegexToken('GG', match1to2, match2);
19687 addRegexToken('gg', match1to2, match2);
19688 addRegexToken('GGGG', match1to4, match4);
19689 addRegexToken('gggg', match1to4, match4);
19690 addRegexToken('GGGGG', match1to6, match6);
19691 addRegexToken('ggggg', match1to6, match6);
19692
19693 addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
19694 week[token.substr(0, 2)] = toInt(input);
19695 });
19696
19697 addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
19698 week[token] = hooks.parseTwoDigitYear(input);
19699 });
19700
19701 // MOMENTS
19702
19703 function getSetWeekYear (input) {
19704 return getSetWeekYearHelper.call(this,
19705 input,
19706 this.week(),
19707 this.weekday(),
19708 this.localeData()._week.dow,
19709 this.localeData()._week.doy);
19710 }
19711
19712 function getSetISOWeekYear (input) {
19713 return getSetWeekYearHelper.call(this,
19714 input, this.isoWeek(), this.isoWeekday(), 1, 4);
19715 }
19716
19717 function getISOWeeksInYear () {
19718 return weeksInYear(this.year(), 1, 4);
19719 }
19720
19721 function getWeeksInYear () {
19722 var weekInfo = this.localeData()._week;
19723 return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
19724 }
19725
19726 function getSetWeekYearHelper(input, week, weekday, dow, doy) {
19727 var weeksTarget;
19728 if (input == null) {
19729 return weekOfYear(this, dow, doy).year;
19730 } else {
19731 weeksTarget = weeksInYear(input, dow, doy);
19732 if (week > weeksTarget) {
19733 week = weeksTarget;
19734 }
19735 return setWeekAll.call(this, input, week, weekday, dow, doy);
19736 }
19737 }
19738
19739 function setWeekAll(weekYear, week, weekday, dow, doy) {
19740 var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
19741 date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
19742
19743 this.year(date.getUTCFullYear());
19744 this.month(date.getUTCMonth());
19745 this.date(date.getUTCDate());
19746 return this;
19747 }
19748
19749 // FORMATTING
19750
19751 addFormatToken('Q', 0, 'Qo', 'quarter');
19752
19753 // ALIASES
19754
19755 addUnitAlias('quarter', 'Q');
19756
19757 // PRIORITY
19758
19759 addUnitPriority('quarter', 7);
19760
19761 // PARSING
19762
19763 addRegexToken('Q', match1);
19764 addParseToken('Q', function (input, array) {
19765 array[MONTH] = (toInt(input) - 1) * 3;
19766 });
19767
19768 // MOMENTS
19769
19770 function getSetQuarter (input) {
19771 return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
19772 }
19773
19774 // FORMATTING
19775
19776 addFormatToken('D', ['DD', 2], 'Do', 'date');
19777
19778 // ALIASES
19779
19780 addUnitAlias('date', 'D');
19781
19782 // PRIORITY
19783 addUnitPriority('date', 9);
19784
19785 // PARSING
19786
19787 addRegexToken('D', match1to2);
19788 addRegexToken('DD', match1to2, match2);
19789 addRegexToken('Do', function (isStrict, locale) {
19790 // TODO: Remove "ordinalParse" fallback in next major release.
19791 return isStrict ?
19792 (locale._dayOfMonthOrdinalParse || locale._ordinalParse) :
19793 locale._dayOfMonthOrdinalParseLenient;
19794 });
19795
19796 addParseToken(['D', 'DD'], DATE);
19797 addParseToken('Do', function (input, array) {
19798 array[DATE] = toInt(input.match(match1to2)[0]);
19799 });
19800
19801 // MOMENTS
19802
19803 var getSetDayOfMonth = makeGetSet('Date', true);
19804
19805 // FORMATTING
19806
19807 addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
19808
19809 // ALIASES
19810
19811 addUnitAlias('dayOfYear', 'DDD');
19812
19813 // PRIORITY
19814 addUnitPriority('dayOfYear', 4);
19815
19816 // PARSING
19817
19818 addRegexToken('DDD', match1to3);
19819 addRegexToken('DDDD', match3);
19820 addParseToken(['DDD', 'DDDD'], function (input, array, config) {
19821 config._dayOfYear = toInt(input);
19822 });
19823
19824 // HELPERS
19825
19826 // MOMENTS
19827
19828 function getSetDayOfYear (input) {
19829 var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
19830 return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
19831 }
19832
19833 // FORMATTING
19834
19835 addFormatToken('m', ['mm', 2], 0, 'minute');
19836
19837 // ALIASES
19838
19839 addUnitAlias('minute', 'm');
19840
19841 // PRIORITY
19842
19843 addUnitPriority('minute', 14);
19844
19845 // PARSING
19846
19847 addRegexToken('m', match1to2);
19848 addRegexToken('mm', match1to2, match2);
19849 addParseToken(['m', 'mm'], MINUTE);
19850
19851 // MOMENTS
19852
19853 var getSetMinute = makeGetSet('Minutes', false);
19854
19855 // FORMATTING
19856
19857 addFormatToken('s', ['ss', 2], 0, 'second');
19858
19859 // ALIASES
19860
19861 addUnitAlias('second', 's');
19862
19863 // PRIORITY
19864
19865 addUnitPriority('second', 15);
19866
19867 // PARSING
19868
19869 addRegexToken('s', match1to2);
19870 addRegexToken('ss', match1to2, match2);
19871 addParseToken(['s', 'ss'], SECOND);
19872
19873 // MOMENTS
19874
19875 var getSetSecond = makeGetSet('Seconds', false);
19876
19877 // FORMATTING
19878
19879 addFormatToken('S', 0, 0, function () {
19880 return ~~(this.millisecond() / 100);
19881 });
19882
19883 addFormatToken(0, ['SS', 2], 0, function () {
19884 return ~~(this.millisecond() / 10);
19885 });
19886
19887 addFormatToken(0, ['SSS', 3], 0, 'millisecond');
19888 addFormatToken(0, ['SSSS', 4], 0, function () {
19889 return this.millisecond() * 10;
19890 });
19891 addFormatToken(0, ['SSSSS', 5], 0, function () {
19892 return this.millisecond() * 100;
19893 });
19894 addFormatToken(0, ['SSSSSS', 6], 0, function () {
19895 return this.millisecond() * 1000;
19896 });
19897 addFormatToken(0, ['SSSSSSS', 7], 0, function () {
19898 return this.millisecond() * 10000;
19899 });
19900 addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
19901 return this.millisecond() * 100000;
19902 });
19903 addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
19904 return this.millisecond() * 1000000;
19905 });
19906
19907
19908 // ALIASES
19909
19910 addUnitAlias('millisecond', 'ms');
19911
19912 // PRIORITY
19913
19914 addUnitPriority('millisecond', 16);
19915
19916 // PARSING
19917
19918 addRegexToken('S', match1to3, match1);
19919 addRegexToken('SS', match1to3, match2);
19920 addRegexToken('SSS', match1to3, match3);
19921
19922 var token;
19923 for (token = 'SSSS'; token.length <= 9; token += 'S') {
19924 addRegexToken(token, matchUnsigned);
19925 }
19926
19927 function parseMs(input, array) {
19928 array[MILLISECOND] = toInt(('0.' + input) * 1000);
19929 }
19930
19931 for (token = 'S'; token.length <= 9; token += 'S') {
19932 addParseToken(token, parseMs);
19933 }
19934 // MOMENTS
19935
19936 var getSetMillisecond = makeGetSet('Milliseconds', false);
19937
19938 // FORMATTING
19939
19940 addFormatToken('z', 0, 0, 'zoneAbbr');
19941 addFormatToken('zz', 0, 0, 'zoneName');
19942
19943 // MOMENTS
19944
19945 function getZoneAbbr () {
19946 return this._isUTC ? 'UTC' : '';
19947 }
19948
19949 function getZoneName () {
19950 return this._isUTC ? 'Coordinated Universal Time' : '';
19951 }
19952
19953 var proto = Moment.prototype;
19954
19955 proto.add = add;
19956 proto.calendar = calendar$1;
19957 proto.clone = clone;
19958 proto.diff = diff;
19959 proto.endOf = endOf;
19960 proto.format = format;
19961 proto.from = from;
19962 proto.fromNow = fromNow;
19963 proto.to = to;
19964 proto.toNow = toNow;
19965 proto.get = stringGet;
19966 proto.invalidAt = invalidAt;
19967 proto.isAfter = isAfter;
19968 proto.isBefore = isBefore;
19969 proto.isBetween = isBetween;
19970 proto.isSame = isSame;
19971 proto.isSameOrAfter = isSameOrAfter;
19972 proto.isSameOrBefore = isSameOrBefore;
19973 proto.isValid = isValid$2;
19974 proto.lang = lang;
19975 proto.locale = locale;
19976 proto.localeData = localeData;
19977 proto.max = prototypeMax;
19978 proto.min = prototypeMin;
19979 proto.parsingFlags = parsingFlags;
19980 proto.set = stringSet;
19981 proto.startOf = startOf;
19982 proto.subtract = subtract;
19983 proto.toArray = toArray;
19984 proto.toObject = toObject;
19985 proto.toDate = toDate;
19986 proto.toISOString = toISOString;
19987 proto.inspect = inspect;
19988 proto.toJSON = toJSON;
19989 proto.toString = toString;
19990 proto.unix = unix;
19991 proto.valueOf = valueOf;
19992 proto.creationData = creationData;
19993 proto.year = getSetYear;
19994 proto.isLeapYear = getIsLeapYear;
19995 proto.weekYear = getSetWeekYear;
19996 proto.isoWeekYear = getSetISOWeekYear;
19997 proto.quarter = proto.quarters = getSetQuarter;
19998 proto.month = getSetMonth;
19999 proto.daysInMonth = getDaysInMonth;
20000 proto.week = proto.weeks = getSetWeek;
20001 proto.isoWeek = proto.isoWeeks = getSetISOWeek;
20002 proto.weeksInYear = getWeeksInYear;
20003 proto.isoWeeksInYear = getISOWeeksInYear;
20004 proto.date = getSetDayOfMonth;
20005 proto.day = proto.days = getSetDayOfWeek;
20006 proto.weekday = getSetLocaleDayOfWeek;
20007 proto.isoWeekday = getSetISODayOfWeek;
20008 proto.dayOfYear = getSetDayOfYear;
20009 proto.hour = proto.hours = getSetHour;
20010 proto.minute = proto.minutes = getSetMinute;
20011 proto.second = proto.seconds = getSetSecond;
20012 proto.millisecond = proto.milliseconds = getSetMillisecond;
20013 proto.utcOffset = getSetOffset;
20014 proto.utc = setOffsetToUTC;
20015 proto.local = setOffsetToLocal;
20016 proto.parseZone = setOffsetToParsedOffset;
20017 proto.hasAlignedHourOffset = hasAlignedHourOffset;
20018 proto.isDST = isDaylightSavingTime;
20019 proto.isLocal = isLocal;
20020 proto.isUtcOffset = isUtcOffset;
20021 proto.isUtc = isUtc;
20022 proto.isUTC = isUtc;
20023 proto.zoneAbbr = getZoneAbbr;
20024 proto.zoneName = getZoneName;
20025 proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
20026 proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
20027 proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
20028 proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone);
20029 proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted);
20030
20031 function createUnix (input) {
20032 return createLocal(input * 1000);
20033 }
20034
20035 function createInZone () {
20036 return createLocal.apply(null, arguments).parseZone();
20037 }
20038
20039 function preParsePostFormat (string) {
20040 return string;
20041 }
20042
20043 var proto$1 = Locale.prototype;
20044
20045 proto$1.calendar = calendar;
20046 proto$1.longDateFormat = longDateFormat;
20047 proto$1.invalidDate = invalidDate;
20048 proto$1.ordinal = ordinal;
20049 proto$1.preparse = preParsePostFormat;
20050 proto$1.postformat = preParsePostFormat;
20051 proto$1.relativeTime = relativeTime;
20052 proto$1.pastFuture = pastFuture;
20053 proto$1.set = set;
20054
20055 proto$1.months = localeMonths;
20056 proto$1.monthsShort = localeMonthsShort;
20057 proto$1.monthsParse = localeMonthsParse;
20058 proto$1.monthsRegex = monthsRegex;
20059 proto$1.monthsShortRegex = monthsShortRegex;
20060 proto$1.week = localeWeek;
20061 proto$1.firstDayOfYear = localeFirstDayOfYear;
20062 proto$1.firstDayOfWeek = localeFirstDayOfWeek;
20063
20064 proto$1.weekdays = localeWeekdays;
20065 proto$1.weekdaysMin = localeWeekdaysMin;
20066 proto$1.weekdaysShort = localeWeekdaysShort;
20067 proto$1.weekdaysParse = localeWeekdaysParse;
20068
20069 proto$1.weekdaysRegex = weekdaysRegex;
20070 proto$1.weekdaysShortRegex = weekdaysShortRegex;
20071 proto$1.weekdaysMinRegex = weekdaysMinRegex;
20072
20073 proto$1.isPM = localeIsPM;
20074 proto$1.meridiem = localeMeridiem;
20075
20076 function get$1 (format, index, field, setter) {
20077 var locale = getLocale();
20078 var utc = createUTC().set(setter, index);
20079 return locale[field](utc, format);
20080 }
20081
20082 function listMonthsImpl (format, index, field) {
20083 if (isNumber(format)) {
20084 index = format;
20085 format = undefined;
20086 }
20087
20088 format = format || '';
20089
20090 if (index != null) {
20091 return get$1(format, index, field, 'month');
20092 }
20093
20094 var i;
20095 var out = [];
20096 for (i = 0; i < 12; i++) {
20097 out[i] = get$1(format, i, field, 'month');
20098 }
20099 return out;
20100 }
20101
20102 // ()
20103 // (5)
20104 // (fmt, 5)
20105 // (fmt)
20106 // (true)
20107 // (true, 5)
20108 // (true, fmt, 5)
20109 // (true, fmt)
20110 function listWeekdaysImpl (localeSorted, format, index, field) {
20111 if (typeof localeSorted === 'boolean') {
20112 if (isNumber(format)) {
20113 index = format;
20114 format = undefined;
20115 }
20116
20117 format = format || '';
20118 } else {
20119 format = localeSorted;
20120 index = format;
20121 localeSorted = false;
20122
20123 if (isNumber(format)) {
20124 index = format;
20125 format = undefined;
20126 }
20127
20128 format = format || '';
20129 }
20130
20131 var locale = getLocale(),
20132 shift = localeSorted ? locale._week.dow : 0;
20133
20134 if (index != null) {
20135 return get$1(format, (index + shift) % 7, field, 'day');
20136 }
20137
20138 var i;
20139 var out = [];
20140 for (i = 0; i < 7; i++) {
20141 out[i] = get$1(format, (i + shift) % 7, field, 'day');
20142 }
20143 return out;
20144 }
20145
20146 function listMonths (format, index) {
20147 return listMonthsImpl(format, index, 'months');
20148 }
20149
20150 function listMonthsShort (format, index) {
20151 return listMonthsImpl(format, index, 'monthsShort');
20152 }
20153
20154 function listWeekdays (localeSorted, format, index) {
20155 return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
20156 }
20157
20158 function listWeekdaysShort (localeSorted, format, index) {
20159 return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
20160 }
20161
20162 function listWeekdaysMin (localeSorted, format, index) {
20163 return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
20164 }
20165
20166 getSetGlobalLocale('en', {
20167 dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
20168 ordinal : function (number) {
20169 var b = number % 10,
20170 output = (toInt(number % 100 / 10) === 1) ? 'th' :
20171 (b === 1) ? 'st' :
20172 (b === 2) ? 'nd' :
20173 (b === 3) ? 'rd' : 'th';
20174 return number + output;
20175 }
20176 });
20177
20178 // Side effect imports
20179
20180 hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale);
20181 hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale);
20182
20183 var mathAbs = Math.abs;
20184
20185 function abs () {
20186 var data = this._data;
20187
20188 this._milliseconds = mathAbs(this._milliseconds);
20189 this._days = mathAbs(this._days);
20190 this._months = mathAbs(this._months);
20191
20192 data.milliseconds = mathAbs(data.milliseconds);
20193 data.seconds = mathAbs(data.seconds);
20194 data.minutes = mathAbs(data.minutes);
20195 data.hours = mathAbs(data.hours);
20196 data.months = mathAbs(data.months);
20197 data.years = mathAbs(data.years);
20198
20199 return this;
20200 }
20201
20202 function addSubtract$1 (duration, input, value, direction) {
20203 var other = createDuration(input, value);
20204
20205 duration._milliseconds += direction * other._milliseconds;
20206 duration._days += direction * other._days;
20207 duration._months += direction * other._months;
20208
20209 return duration._bubble();
20210 }
20211
20212 // supports only 2.0-style add(1, 's') or add(duration)
20213 function add$1 (input, value) {
20214 return addSubtract$1(this, input, value, 1);
20215 }
20216
20217 // supports only 2.0-style subtract(1, 's') or subtract(duration)
20218 function subtract$1 (input, value) {
20219 return addSubtract$1(this, input, value, -1);
20220 }
20221
20222 function absCeil (number) {
20223 if (number < 0) {
20224 return Math.floor(number);
20225 } else {
20226 return Math.ceil(number);
20227 }
20228 }
20229
20230 function bubble () {
20231 var milliseconds = this._milliseconds;
20232 var days = this._days;
20233 var months = this._months;
20234 var data = this._data;
20235 var seconds, minutes, hours, years, monthsFromDays;
20236
20237 // if we have a mix of positive and negative values, bubble down first
20238 // check: https://github.com/moment/moment/issues/2166
20239 if (!((milliseconds >= 0 && days >= 0 && months >= 0) ||
20240 (milliseconds <= 0 && days <= 0 && months <= 0))) {
20241 milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
20242 days = 0;
20243 months = 0;
20244 }
20245
20246 // The following code bubbles up values, see the tests for
20247 // examples of what that means.
20248 data.milliseconds = milliseconds % 1000;
20249
20250 seconds = absFloor(milliseconds / 1000);
20251 data.seconds = seconds % 60;
20252
20253 minutes = absFloor(seconds / 60);
20254 data.minutes = minutes % 60;
20255
20256 hours = absFloor(minutes / 60);
20257 data.hours = hours % 24;
20258
20259 days += absFloor(hours / 24);
20260
20261 // convert days to months
20262 monthsFromDays = absFloor(daysToMonths(days));
20263 months += monthsFromDays;
20264 days -= absCeil(monthsToDays(monthsFromDays));
20265
20266 // 12 months -> 1 year
20267 years = absFloor(months / 12);
20268 months %= 12;
20269
20270 data.days = days;
20271 data.months = months;
20272 data.years = years;
20273
20274 return this;
20275 }
20276
20277 function daysToMonths (days) {
20278 // 400 years have 146097 days (taking into account leap year rules)
20279 // 400 years have 12 months === 4800
20280 return days * 4800 / 146097;
20281 }
20282
20283 function monthsToDays (months) {
20284 // the reverse of daysToMonths
20285 return months * 146097 / 4800;
20286 }
20287
20288 function as (units) {
20289 if (!this.isValid()) {
20290 return NaN;
20291 }
20292 var days;
20293 var months;
20294 var milliseconds = this._milliseconds;
20295
20296 units = normalizeUnits(units);
20297
20298 if (units === 'month' || units === 'quarter' || units === 'year') {
20299 days = this._days + milliseconds / 864e5;
20300 months = this._months + daysToMonths(days);
20301 switch (units) {
20302 case 'month': return months;
20303 case 'quarter': return months / 3;
20304 case 'year': return months / 12;
20305 }
20306 } else {
20307 // handle milliseconds separately because of floating point math errors (issue #1867)
20308 days = this._days + Math.round(monthsToDays(this._months));
20309 switch (units) {
20310 case 'week' : return days / 7 + milliseconds / 6048e5;
20311 case 'day' : return days + milliseconds / 864e5;
20312 case 'hour' : return days * 24 + milliseconds / 36e5;
20313 case 'minute' : return days * 1440 + milliseconds / 6e4;
20314 case 'second' : return days * 86400 + milliseconds / 1000;
20315 // Math.floor prevents floating point math errors here
20316 case 'millisecond': return Math.floor(days * 864e5) + milliseconds;
20317 default: throw new Error('Unknown unit ' + units);
20318 }
20319 }
20320 }
20321
20322 // TODO: Use this.as('ms')?
20323 function valueOf$1 () {
20324 if (!this.isValid()) {
20325 return NaN;
20326 }
20327 return (
20328 this._milliseconds +
20329 this._days * 864e5 +
20330 (this._months % 12) * 2592e6 +
20331 toInt(this._months / 12) * 31536e6
20332 );
20333 }
20334
20335 function makeAs (alias) {
20336 return function () {
20337 return this.as(alias);
20338 };
20339 }
20340
20341 var asMilliseconds = makeAs('ms');
20342 var asSeconds = makeAs('s');
20343 var asMinutes = makeAs('m');
20344 var asHours = makeAs('h');
20345 var asDays = makeAs('d');
20346 var asWeeks = makeAs('w');
20347 var asMonths = makeAs('M');
20348 var asQuarters = makeAs('Q');
20349 var asYears = makeAs('y');
20350
20351 function clone$1 () {
20352 return createDuration(this);
20353 }
20354
20355 function get$2 (units) {
20356 units = normalizeUnits(units);
20357 return this.isValid() ? this[units + 's']() : NaN;
20358 }
20359
20360 function makeGetter(name) {
20361 return function () {
20362 return this.isValid() ? this._data[name] : NaN;
20363 };
20364 }
20365
20366 var milliseconds = makeGetter('milliseconds');
20367 var seconds = makeGetter('seconds');
20368 var minutes = makeGetter('minutes');
20369 var hours = makeGetter('hours');
20370 var days = makeGetter('days');
20371 var months = makeGetter('months');
20372 var years = makeGetter('years');
20373
20374 function weeks () {
20375 return absFloor(this.days() / 7);
20376 }
20377
20378 var round = Math.round;
20379 var thresholds = {
20380 ss: 44, // a few seconds to seconds
20381 s : 45, // seconds to minute
20382 m : 45, // minutes to hour
20383 h : 22, // hours to day
20384 d : 26, // days to month
20385 M : 11 // months to year
20386 };
20387
20388 // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
20389 function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
20390 return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
20391 }
20392
20393 function relativeTime$1 (posNegDuration, withoutSuffix, locale) {
20394 var duration = createDuration(posNegDuration).abs();
20395 var seconds = round(duration.as('s'));
20396 var minutes = round(duration.as('m'));
20397 var hours = round(duration.as('h'));
20398 var days = round(duration.as('d'));
20399 var months = round(duration.as('M'));
20400 var years = round(duration.as('y'));
20401
20402 var a = seconds <= thresholds.ss && ['s', seconds] ||
20403 seconds < thresholds.s && ['ss', seconds] ||
20404 minutes <= 1 && ['m'] ||
20405 minutes < thresholds.m && ['mm', minutes] ||
20406 hours <= 1 && ['h'] ||
20407 hours < thresholds.h && ['hh', hours] ||
20408 days <= 1 && ['d'] ||
20409 days < thresholds.d && ['dd', days] ||
20410 months <= 1 && ['M'] ||
20411 months < thresholds.M && ['MM', months] ||
20412 years <= 1 && ['y'] || ['yy', years];
20413
20414 a[2] = withoutSuffix;
20415 a[3] = +posNegDuration > 0;
20416 a[4] = locale;
20417 return substituteTimeAgo.apply(null, a);
20418 }
20419
20420 // This function allows you to set the rounding function for relative time strings
20421 function getSetRelativeTimeRounding (roundingFunction) {
20422 if (roundingFunction === undefined) {
20423 return round;
20424 }
20425 if (typeof(roundingFunction) === 'function') {
20426 round = roundingFunction;
20427 return true;
20428 }
20429 return false;
20430 }
20431
20432 // This function allows you to set a threshold for relative time strings
20433 function getSetRelativeTimeThreshold (threshold, limit) {
20434 if (thresholds[threshold] === undefined) {
20435 return false;
20436 }
20437 if (limit === undefined) {
20438 return thresholds[threshold];
20439 }
20440 thresholds[threshold] = limit;
20441 if (threshold === 's') {
20442 thresholds.ss = limit - 1;
20443 }
20444 return true;
20445 }
20446
20447 function humanize (withSuffix) {
20448 if (!this.isValid()) {
20449 return this.localeData().invalidDate();
20450 }
20451
20452 var locale = this.localeData();
20453 var output = relativeTime$1(this, !withSuffix, locale);
20454
20455 if (withSuffix) {
20456 output = locale.pastFuture(+this, output);
20457 }
20458
20459 return locale.postformat(output);
20460 }
20461
20462 var abs$1 = Math.abs;
20463
20464 function sign(x) {
20465 return ((x > 0) - (x < 0)) || +x;
20466 }
20467
20468 function toISOString$1() {
20469 // for ISO strings we do not use the normal bubbling rules:
20470 // * milliseconds bubble up until they become hours
20471 // * days do not bubble at all
20472 // * months bubble up until they become years
20473 // This is because there is no context-free conversion between hours and days
20474 // (think of clock changes)
20475 // and also not between days and months (28-31 days per month)
20476 if (!this.isValid()) {
20477 return this.localeData().invalidDate();
20478 }
20479
20480 var seconds = abs$1(this._milliseconds) / 1000;
20481 var days = abs$1(this._days);
20482 var months = abs$1(this._months);
20483 var minutes, hours, years;
20484
20485 // 3600 seconds -> 60 minutes -> 1 hour
20486 minutes = absFloor(seconds / 60);
20487 hours = absFloor(minutes / 60);
20488 seconds %= 60;
20489 minutes %= 60;
20490
20491 // 12 months -> 1 year
20492 years = absFloor(months / 12);
20493 months %= 12;
20494
20495
20496 // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
20497 var Y = years;
20498 var M = months;
20499 var D = days;
20500 var h = hours;
20501 var m = minutes;
20502 var s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
20503 var total = this.asSeconds();
20504
20505 if (!total) {
20506 // this is the same as C#'s (Noda) and python (isodate)...
20507 // but not other JS (goog.date)
20508 return 'P0D';
20509 }
20510
20511 var totalSign = total < 0 ? '-' : '';
20512 var ymSign = sign(this._months) !== sign(total) ? '-' : '';
20513 var daysSign = sign(this._days) !== sign(total) ? '-' : '';
20514 var hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
20515
20516 return totalSign + 'P' +
20517 (Y ? ymSign + Y + 'Y' : '') +
20518 (M ? ymSign + M + 'M' : '') +
20519 (D ? daysSign + D + 'D' : '') +
20520 ((h || m || s) ? 'T' : '') +
20521 (h ? hmsSign + h + 'H' : '') +
20522 (m ? hmsSign + m + 'M' : '') +
20523 (s ? hmsSign + s + 'S' : '');
20524 }
20525
20526 var proto$2 = Duration.prototype;
20527
20528 proto$2.isValid = isValid$1;
20529 proto$2.abs = abs;
20530 proto$2.add = add$1;
20531 proto$2.subtract = subtract$1;
20532 proto$2.as = as;
20533 proto$2.asMilliseconds = asMilliseconds;
20534 proto$2.asSeconds = asSeconds;
20535 proto$2.asMinutes = asMinutes;
20536 proto$2.asHours = asHours;
20537 proto$2.asDays = asDays;
20538 proto$2.asWeeks = asWeeks;
20539 proto$2.asMonths = asMonths;
20540 proto$2.asQuarters = asQuarters;
20541 proto$2.asYears = asYears;
20542 proto$2.valueOf = valueOf$1;
20543 proto$2._bubble = bubble;
20544 proto$2.clone = clone$1;
20545 proto$2.get = get$2;
20546 proto$2.milliseconds = milliseconds;
20547 proto$2.seconds = seconds;
20548 proto$2.minutes = minutes;
20549 proto$2.hours = hours;
20550 proto$2.days = days;
20551 proto$2.weeks = weeks;
20552 proto$2.months = months;
20553 proto$2.years = years;
20554 proto$2.humanize = humanize;
20555 proto$2.toISOString = toISOString$1;
20556 proto$2.toString = toISOString$1;
20557 proto$2.toJSON = toISOString$1;
20558 proto$2.locale = locale;
20559 proto$2.localeData = localeData;
20560
20561 proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1);
20562 proto$2.lang = lang;
20563
20564 // Side effect imports
20565
20566 // FORMATTING
20567
20568 addFormatToken('X', 0, 0, 'unix');
20569 addFormatToken('x', 0, 0, 'valueOf');
20570
20571 // PARSING
20572
20573 addRegexToken('x', matchSigned);
20574 addRegexToken('X', matchTimestamp);
20575 addParseToken('X', function (input, array, config) {
20576 config._d = new Date(parseFloat(input, 10) * 1000);
20577 });
20578 addParseToken('x', function (input, array, config) {
20579 config._d = new Date(toInt(input));
20580 });
20581
20582 // Side effect imports
20583
20584
20585 hooks.version = '2.24.0';
20586
20587 setHookCallback(createLocal);
20588
20589 hooks.fn = proto;
20590 hooks.min = min;
20591 hooks.max = max;
20592 hooks.now = now;
20593 hooks.utc = createUTC;
20594 hooks.unix = createUnix;
20595 hooks.months = listMonths;
20596 hooks.isDate = isDate;
20597 hooks.locale = getSetGlobalLocale;
20598 hooks.invalid = createInvalid;
20599 hooks.duration = createDuration;
20600 hooks.isMoment = isMoment;
20601 hooks.weekdays = listWeekdays;
20602 hooks.parseZone = createInZone;
20603 hooks.localeData = getLocale;
20604 hooks.isDuration = isDuration;
20605 hooks.monthsShort = listMonthsShort;
20606 hooks.weekdaysMin = listWeekdaysMin;
20607 hooks.defineLocale = defineLocale;
20608 hooks.updateLocale = updateLocale;
20609 hooks.locales = listLocales;
20610 hooks.weekdaysShort = listWeekdaysShort;
20611 hooks.normalizeUnits = normalizeUnits;
20612 hooks.relativeTimeRounding = getSetRelativeTimeRounding;
20613 hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
20614 hooks.calendarFormat = getCalendarFormat;
20615 hooks.prototype = proto;
20616
20617 // currently HTML5 input type only supports 24-hour formats
20618 hooks.HTML5_FMT = {
20619 DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" />
20620 DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" />
20621 DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" />
20622 DATE: 'YYYY-MM-DD', // <input type="date" />
20623 TIME: 'HH:mm', // <input type="time" />
20624 TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" />
20625 TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" />
20626 WEEK: 'GGGG-[W]WW', // <input type="week" />
20627 MONTH: 'YYYY-MM' // <input type="month" />
20628 };
20629
20630 return hooks;
20631
20632})));
20633});
20634
20635function isValidMoment(testMoment) {
20636 if (typeof moment.isMoment === 'function' && !moment.isMoment(testMoment)) {
20637 return false;
20638 }
20639
20640 /* istanbul ignore else */
20641 if (typeof testMoment.isValid === 'function') {
20642 // moment 1.7.0+
20643 return testMoment.isValid();
20644 }
20645
20646 /* istanbul ignore next */
20647 return !isNaN(testMoment);
20648}
20649
20650var momentValidationWrapper = {
20651 isValidMoment : isValidMoment,
20652};
20653
20654var messages = {
20655 invalidPredicate: '`predicate` must be a function',
20656 invalidPropValidator: '`propValidator` must be a function',
20657 requiredCore: 'is marked as required',
20658 invalidTypeCore: 'Invalid input type',
20659 predicateFailureCore: 'Failed to succeed with predicate',
20660 anonymousMessage: '<<anonymous>>',
20661 baseInvalidMessage: 'Invalid ',
20662};
20663
20664function constructPropValidatorVariations(propValidator) {
20665 if (typeof propValidator !== 'function') {
20666 throw new Error(messages.invalidPropValidator);
20667 }
20668
20669 var requiredPropValidator = propValidator.bind(null, false, null);
20670 requiredPropValidator.isRequired = propValidator.bind(null, true, null);
20671
20672 requiredPropValidator.withPredicate = function predicateApplication(predicate) {
20673 if (typeof predicate !== 'function') {
20674 throw new Error(messages.invalidPredicate);
20675 }
20676 var basePropValidator = propValidator.bind(null, false, predicate);
20677 basePropValidator.isRequired = propValidator.bind(null, true, predicate);
20678 return basePropValidator;
20679 };
20680
20681 return requiredPropValidator;
20682}
20683
20684function createInvalidRequiredErrorMessage(propName, componentName, value) {
20685 return new Error(
20686 'The prop `' + propName + '` ' + messages.requiredCore +
20687 ' in `' + componentName + '`, but its value is `' + value + '`.'
20688 );
20689}
20690
20691var independentGuardianValue = -1;
20692
20693function preValidationRequireCheck(isRequired, componentName, propFullName, propValue) {
20694 var isPropValueUndefined = typeof propValue === 'undefined';
20695 var isPropValueNull = propValue === null;
20696
20697 if (isRequired) {
20698 if (isPropValueUndefined) {
20699 return createInvalidRequiredErrorMessage(propFullName, componentName, 'undefined');
20700 } else if (isPropValueNull) {
20701 return createInvalidRequiredErrorMessage(propFullName, componentName, 'null');
20702 }
20703 }
20704
20705 if (isPropValueUndefined || isPropValueNull) {
20706 return null;
20707 }
20708
20709 return independentGuardianValue;
20710}
20711
20712function createMomentChecker(type, typeValidator, validator, momentType) {
20713
20714 function propValidator(
20715 isRequired, // Bound parameter to indicate with the propType is required
20716 predicate, // Bound parameter to allow user to add dynamic validation
20717 props,
20718 propName,
20719 componentName,
20720 location,
20721 propFullName
20722 ) {
20723 var propValue = props[ propName ];
20724 var propType = typeof propValue;
20725
20726 componentName = componentName || messages.anonymousMessage;
20727 propFullName = propFullName || propName;
20728
20729 var preValidationRequireCheckValue = preValidationRequireCheck(
20730 isRequired, componentName, propFullName, propValue
20731 );
20732
20733 if (preValidationRequireCheckValue !== independentGuardianValue) {
20734 return preValidationRequireCheckValue;
20735 }
20736
20737 if (typeValidator && !typeValidator(propValue)) {
20738 return new Error(
20739 messages.invalidTypeCore + ': `' + propName + '` of type `' + propType + '` ' +
20740 'supplied to `' + componentName + '`, expected `' + type + '`.'
20741 );
20742 }
20743
20744 if (!validator(propValue)) {
20745 return new Error(
20746 messages.baseInvalidMessage + location + ' `' + propName + '` of type `' + propType + '` ' +
20747 'supplied to `' + componentName + '`, expected `' + momentType + '`.'
20748 );
20749 }
20750
20751 if (predicate && !predicate(propValue)) {
20752 var predicateName = predicate.name || messages.anonymousMessage;
20753 return new Error(
20754 messages.baseInvalidMessage + location + ' `' + propName + '` of type `' + propType + '` ' +
20755 'supplied to `' + componentName + '`. ' + messages.predicateFailureCore + ' `' +
20756 predicateName + '`.'
20757 );
20758 }
20759
20760 return null;
20761
20762 }
20763
20764 return constructPropValidatorVariations(propValidator);
20765
20766}
20767
20768var core = {
20769 constructPropValidatorVariations: constructPropValidatorVariations,
20770 createMomentChecker: createMomentChecker,
20771 messages: messages,
20772};
20773
20774var src = {
20775
20776 momentObj : core.createMomentChecker(
20777 'object',
20778 function(obj) {
20779 return typeof obj === 'object';
20780 },
20781 function isValid(value) {
20782 return momentValidationWrapper.isValidMoment(value);
20783 },
20784 'Moment'
20785 ),
20786
20787 momentString : core.createMomentChecker(
20788 'string',
20789 function(str) {
20790 return typeof str === 'string';
20791 },
20792 function isValid(value) {
20793 return momentValidationWrapper.isValidMoment(moment(value));
20794 },
20795 'Moment'
20796 ),
20797
20798 momentDurationObj : core.createMomentChecker(
20799 'object',
20800 function(obj) {
20801 return typeof obj === 'object';
20802 },
20803 function isValid(value) {
20804 return moment.isDuration(value);
20805 },
20806 'Duration'
20807 ),
20808
20809};
20810var src_1 = src.momentObj;
20811
20812function _templateObject$P() {
20813 var data = taggedTemplateLiteralLoose(["\n\t.DayPicker__withBorder {\n\t\tbox-shadow: 0px 2px 4px rgba(0, 0, 0, 0.25);\n\t}\n\t.DateRangePickerInput {\n\t\tdisplay: flex;\n\t\tbackground-color: ", ";\n\t}\n\n\t.DateRangePickerInput__withBorder {\n\t\tborder: thin solid ", ";\n\t\tborder-radius: 4px;\n\t}\n\n\t.DateRangePickerInput_calendarIcon {\n\t\twidth: 34px;\n\t\theight: 34px;\n\t\tpadding: 0;\n\t\tmargin: 0;\n\t\toutline: none;\n\t}\n\n\t.DateInput {\n\t\twidth: 50%;\n\t}\n\n\t.DateInput:before {\n\t\tposition: absolute;\n\t\ttop: 20%;\n\t\tbottom: 20%;\n\t\tborder-right: thin solid ", ";\n\t\tcontent: '';\n\t}\n\n\t.DateInput_input {\n\t\tpadding: 7px 7px 5px 7px;\n\t\tfont-size: 15px;\n\t\tline-height: 20px;\n\t}\n\n\t.DateInput_input__focused {\n\t\tborder-bottom: 2px solid ", ";\n\t}\n\n\t.DateRangePickerInput_arrow {\n\t\tdisplay: none;\n\t\twidth: 0;\n\t\tmargin: 0 4px;\n\t}\n\n\t.DateRangePickerInput_arrow svg {\n\t\twidth: 22px;\n\t}\n\n\t/* NOTE: the order of these styles DO matter */\n\n\t.CalendarDay__default {\n\t\tborder: 1px solid transparent;\n\t\tbackground: ", ";\n\t\tcolor: ", ";\n\t}\n\n\t.CalendarDay__blocked_out_of_range:active,\n\t.CalendarDay__blocked_out_of_range:hover {\n\t\tborder: 1px solid transparent;\n\t\tbackground: ", ";\n\t\tcolor: ", ";\n\t}\n\t/* Will edit everything selected including everything between a range of dates */\n\t.CalendarDay__selected_span {\n\t\tborder: 1px solid transparent; /* default styles include a border */\n\t\tbackground: ", "; /* background */\n\t\tcolor: ", "; /* text */\n\t}\n\n\t.CalendarDay__selected_span:hover {\n\t\tborder: 1px solid transparent;\n\t\tbackground: ", "; /* background */\n\t\tcolor: ", "; /* text */\n\t}\n\n\t/* Will edit selected date or the endpoints of a range of dates */\n\t.CalendarDay__selected {\n\t\tborder: 1px solid transparent; /* default styles include a border */\n\t\tbackground: ", ";\n\t\tcolor: ", ";\n\t}\n\n\t/* Will edit when hovered over. _span style also has this property */\n\t.CalendarDay__selected:hover {\n\t\tborder: 1px solid transparent;\n\t\tbackground: ", ";\n\t\tcolor: ", ";\n\t}\n\n\t/* Will edit when the second date (end date) in a range of dates */\n\t/* is not yet selected. Edits the dates between your mouse and said date */\n\t.CalendarDay__hovered_span {\n\t\tborder: 1px solid transparent;\n\t\tbackground: ", "; /* background */\n\t}\n\n\t.CalendarDay__hovered_span:hover {\n\t\tborder: 1px solid transparent; /* default styles include a border */\n\t\tbackground: ", "; /* background */\n\t\tcolor: ", ";\n\t}\n"]);
20814
20815 _templateObject$P = function _templateObject() {
20816 return data;
20817 };
20818
20819 return data;
20820}
20821
20822var DatePicker = function DatePicker(props) {
20823 return React__default.createElement(DatePickerStyledWrapper, null, React__default.createElement(reactDates.DateRangePicker, _extends_1({}, props, {
20824 hideKeyboardShortcutsPanel: true,
20825 customInputIcon: React__default.createElement(Icon, {
20826 icon: "calendar",
20827 color: theme.colors.activeBlue
20828 })
20829 })));
20830};
20831
20832var DatePickerStyledWrapper = styled__default.div(_templateObject$P(), theme.colors.white, theme.colors.strokeGray, theme.colors.strokeGray, theme.colors.activeBlue, theme.colors.white, theme.colors.black, theme.colors.lightGray, theme.colors.strokeGray, theme.colors.strokeGray, theme.colors.black, theme.colors.activeBlue, theme.colors.white, theme.colors.deepBlue, theme.colors.white, theme.colors.activeBlue, theme.colors.white, theme.colors.lightBlue, theme.colors.lightBlue, theme.colors.activeBlue);
20833DatePicker.displayName = 'DatePicker';
20834DatePicker.defaultProps = {
20835 startDatePlaceholderText: '',
20836 endDatePlaceholderText: '',
20837 startDate: null,
20838 endDate: null,
20839 startDateId: 'startDate',
20840 endDateId: 'endDate'
20841};
20842DatePicker.propTypes = {
20843 /** starDate placeholder text */
20844 startDatePlaceholderText: PropTypes.string,
20845
20846 /** endDate placeholder text */
20847 endDatePlaceholderText: PropTypes.string,
20848
20849 /** momentPropTypes.momentObj or null */
20850 startDate: src_1,
20851
20852 /** momentPropTypes.momentObj or null */
20853 endDate: src_1,
20854
20855 /** triggers when Dates changes */
20856 onDatesChange: PropTypes.func.isRequired,
20857
20858 /** triggers when focus changes */
20859 onFocusChange: PropTypes.func.isRequired,
20860
20861 /** START_DATE, END_DATE or null */
20862 focusedInput: PropTypes.oneOf(['startDate', 'endDate']),
20863 startDateId: PropTypes.string,
20864 endDateId: PropTypes.string
20865};
20866
20867function _templateObject4$a() {
20868 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n\tmargin: 16px;\n\n\t& > div {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tflex-direction: row-reverse;\n\t}\n\t& span {\n\t\twidth: 25%;\n\t\tpadding-right: 8px;\n\t\tfont-weight: bold;\n\t}\n\t& input {\n\t\tborder: 1px solid ", " !important;\n\t\tborder-radius: 4px !important;\n\t\tpadding: 7px;\n\t\twidth: 75%;\n\t\t:focus {\n\t\t\tborder: 1px solid ", " !important;\n\t\t\toutline: 0;\n\t\t}\n\t}\n"]);
20869
20870 _templateObject4$a = function _templateObject4() {
20871 return data;
20872 };
20873
20874 return data;
20875}
20876
20877function _templateObject3$d() {
20878 var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\theight: 14px;\n\tmargin: 16px;\n\t& .hue-horizontal {\n\t\tborder-radius: 5% / 50%;\n\t\t//Hue picker indicator\n\t\t& > div > div {\n\t\t\tmargin-top: 0 !important;\n\t\t\twidth: 14px !important;\n\t\t\tborder-radius: 50% !important;\n\t\t\theight: 14px !important;\n\t\t\ttransform: translateX(-7px) !important;\n\t\t}\n\t}\n"]);
20879
20880 _templateObject3$d = function _templateObject3() {
20881 return data;
20882 };
20883
20884 return data;
20885}
20886
20887function _templateObject2$i() {
20888 var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\theight: 180px;\n\n\t& .saturation-white > div > div {\n\t\twidth: 8px !important;\n\t\theight: 8px !important;\n\t\ttransform: translate(-4px, -4px) !important;\n\t}\n"]);
20889
20890 _templateObject2$i = function _templateObject2() {
20891 return data;
20892 };
20893
20894 return data;
20895}
20896
20897function _templateObject$Q() {
20898 var data = taggedTemplateLiteralLoose(["\n\twidth: 180px;\n"]);
20899
20900 _templateObject$Q = function _templateObject() {
20901 return data;
20902 };
20903
20904 return data;
20905}
20906
20907var CustomColorPicker = function CustomColorPicker(_ref) {
20908 var hex = _ref.hex,
20909 hsl = _ref.hsl,
20910 hsv = _ref.hsv,
20911 onChange = _ref.onChange;
20912 return React__default.createElement(CustomColorPickerContainer, null, React__default.createElement(SaturationContainer, null, React__default.createElement(common.Saturation, {
20913 hsl: hsl,
20914 hsv: hsv,
20915 onChange: onChange
20916 })), React__default.createElement(HueContainer, null, React__default.createElement(common.Hue, {
20917 hsl: hsl,
20918 onChange: onChange
20919 })), React__default.createElement(EditableInputContainer, null, React__default.createElement(common.EditableInput, {
20920 label: "hex",
20921 value: hex,
20922 onChange: onChange
20923 })));
20924};
20925
20926CustomColorPicker.displayName = 'ColorPicker';
20927CustomColorPicker.defaultProps = {
20928 hex: null,
20929 hsv: null,
20930 hsl: null,
20931 onChange: null
20932};
20933CustomColorPicker.propTypes = {
20934 hex: PropTypes.string,
20935 hsl: PropTypes.shape({
20936 h: PropTypes.number,
20937 s: PropTypes.number,
20938 l: PropTypes.number,
20939 a: PropTypes.number
20940 }),
20941 hsv: PropTypes.shape({
20942 h: PropTypes.number,
20943 s: PropTypes.number,
20944 v: PropTypes.number,
20945 a: PropTypes.number
20946 }),
20947 onChange: PropTypes.func
20948};
20949var CustomColorPickerContainer = styled__default.div(_templateObject$Q());
20950var SaturationContainer = styled__default.div(_templateObject2$i());
20951var HueContainer = styled__default.div(_templateObject3$d());
20952var EditableInputContainer = styled__default.div(_templateObject4$a(), function (_ref2) {
20953 var theme = _ref2.theme;
20954 return theme.colors.strokeGray;
20955}, function (_ref3) {
20956 var theme = _ref3.theme;
20957 return theme.colors.deepBlue;
20958});
20959var CustomColorPicker$1 = reactColor.CustomPicker(CustomColorPicker);
20960
20961function _templateObject2$j() {
20962 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 180px;\n\theight: 20px;\n\tflex-direction: row-reverse;\n\talign-items: center;\n\n\tpadding: 5px;\n\n\tbackground: #424242;\n"]);
20963
20964 _templateObject2$j = function _templateObject2() {
20965 return data;
20966 };
20967
20968 return data;
20969}
20970
20971function _templateObject$R() {
20972 var data = taggedTemplateLiteralLoose(["\n\tposition: ", ";\n\tz-index: 5;\n\n\tdisplay: ", ";\n\tbox-shadow: rgba(0, 0, 0, 0.3) 0px 0px 2px, rgba(0, 0, 0, 0.3) 0px 4px 8px;\n\tbackground-color: ", ";\n"]);
20973
20974 _templateObject$R = function _templateObject() {
20975 return data;
20976 };
20977
20978 return data;
20979}
20980
20981var ColorPicker =
20982/*#__PURE__*/
20983function (_Component) {
20984 inheritsLoose(ColorPicker, _Component);
20985
20986 function ColorPicker(props) {
20987 var _this;
20988
20989 _this = _Component.call(this, props) || this;
20990
20991 defineProperty(assertThisInitialized(_this), "handleOnClose", function () {
20992 var _this$props = _this.props,
20993 onClose = _this$props.onClose,
20994 setColor = _this$props.setColor;
20995 var color = _this.state.color;
20996 setColor(color);
20997 onClose();
20998 });
20999
21000 var _color = props.color;
21001 _this.state = {
21002 color: _color
21003 };
21004 _this.setWrapperRef = _this.setWrapperRef.bind(assertThisInitialized(_this));
21005 _this.handleClickOutside = _this.handleClickOutside.bind(assertThisInitialized(_this));
21006 return _this;
21007 }
21008
21009 var _proto = ColorPicker.prototype;
21010
21011 _proto.componentDidMount = function componentDidMount() {
21012 document.addEventListener('mousedown', this.handleClickOutside);
21013 };
21014
21015 _proto.componentWillUnmount = function componentWillUnmount() {
21016 document.removeEventListener('mousedown', this.handleClickOutside);
21017 };
21018
21019 _proto.setWrapperRef = function setWrapperRef(node) {
21020 this.wrapperRef = node;
21021 };
21022
21023 _proto.handleClickOutside = function handleClickOutside(event) {
21024 var _this$props2 = this.props,
21025 isVisible = _this$props2.isVisible,
21026 isDisplayerMode = _this$props2.isDisplayerMode;
21027
21028 if (this.wrapperRef && !this.wrapperRef.contains(event.target) && isVisible && isDisplayerMode) {
21029 this.handleOnClose();
21030 }
21031 };
21032
21033 _proto.render = function render() {
21034 var _this2 = this;
21035
21036 var _this$props3 = this.props,
21037 isVisible = _this$props3.isVisible,
21038 isDisplayerMode = _this$props3.isDisplayerMode,
21039 setColor = _this$props3.setColor,
21040 props = objectWithoutPropertiesLoose(_this$props3, ["isVisible", "isDisplayerMode", "setColor"]);
21041
21042 var color = this.state.color;
21043 return React__default.createElement(ColorPickerStyled, {
21044 className: "" + (isVisible && 'isActive'),
21045 isVisible: isVisible,
21046 isDisplayerMode: isDisplayerMode,
21047 ref: this.setWrapperRef,
21048 onClick: function onClick(e) {
21049 return e.stopPropagation();
21050 }
21051 }, React__default.createElement(TopHeader, null, React__default.createElement(Icon, {
21052 style: {
21053 cursor: 'pointer'
21054 },
21055 icon: "error",
21056 color: "white",
21057 size: "tiny",
21058 onClick: this.handleOnClose
21059 })), React__default.createElement(CustomColorPicker$1, _extends_1({}, props, {
21060 color: color,
21061 onChangeComplete: function onChangeComplete(colorValue) {
21062 return _this2.setState({
21063 color: colorValue
21064 }) || !isDisplayerMode && setColor(colorValue);
21065 },
21066 disableAlpha: true,
21067 className: "color-picker"
21068 })));
21069 };
21070
21071 return ColorPicker;
21072}(React.Component);
21073
21074var ColorPickerStyled = styled__default.div(_templateObject$R(), function (_ref) {
21075 var isDisplayerMode = _ref.isDisplayerMode;
21076 return isDisplayerMode ? 'absolute' : 'inherit';
21077}, function (_ref2) {
21078 var isVisible = _ref2.isVisible;
21079 return isVisible ? 'inline-block' : 'none';
21080}, function (_ref3) {
21081 var theme = _ref3.theme;
21082 return theme.colors.white;
21083});
21084ColorPickerStyled.displayName = 'ColorPickerStyled';
21085var TopHeader = styled__default.div(_templateObject2$j());
21086ColorPicker.displayName = 'ColorPicker';
21087ColorPicker.defaultProps = {
21088 isVisible: true,
21089 isDisplayerMode: true
21090};
21091ColorPicker.propTypes = {
21092 isVisible: PropTypes.bool,
21093 color: PropTypes.shape({
21094 hex: PropTypes.string.isRequired
21095 }).isRequired,
21096 setColor: PropTypes.func.isRequired,
21097 onClose: PropTypes.func.isRequired,
21098 isDisplayerMode: PropTypes.bool
21099};
21100
21101function _templateObject3$e() {
21102 var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-block;\n\twidth: 22px;\n\theight: 22px;\n\tbackground: transparent;\n\tcursor: pointer;\n"]);
21103
21104 _templateObject3$e = function _templateObject3() {
21105 return data;
21106 };
21107
21108 return data;
21109}
21110
21111function _templateObject2$k() {
21112 var data = taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\theight: 100%;\n\tbackground: ", ";\n\tborder-radius: 50%;\n\tcursor: ", ";\n"]);
21113
21114 _templateObject2$k = function _templateObject2() {
21115 return data;
21116 };
21117
21118 return data;
21119}
21120
21121function _templateObject$S() {
21122 var data = taggedTemplateLiteralLoose(["\n\tposition: fixed;\n\tdisplay: block;\n\twidth: 0;\n\theight: 0;\n\tborder: 0;\n\tbackground: transparent;\n\toutline: 0;\n"]);
21123
21124 _templateObject$S = function _templateObject() {
21125 return data;
21126 };
21127
21128 return data;
21129}
21130
21131var ColorDisplayer = function ColorDisplayer(_ref) {
21132 var escKeyCall = _ref.escKeyCall,
21133 color = _ref.color,
21134 style = _ref.style,
21135 onChange = _ref.onChange,
21136 activeFocus = _ref.activeFocus,
21137 disabled = _ref.disabled,
21138 props = objectWithoutPropertiesLoose(_ref, ["escKeyCall", "color", "style", "onChange", "activeFocus", "disabled"]);
21139
21140 var _useState = React.useState(false),
21141 display = _useState[0],
21142 setDisplay = _useState[1];
21143
21144 var inputFocus = React__default.createRef();
21145
21146 var handleEscKey = function handleEscKey(event) {
21147 if (event.keyCode === 27) {
21148 escKeyCall();
21149 setDisplay(false);
21150 }
21151 };
21152
21153 React.useEffect(function () {
21154 document.addEventListener('keydown', handleEscKey);
21155 return function () {
21156 document.removeEventListener('keydown', handleEscKey);
21157 };
21158 });
21159
21160 var handleOpen = function handleOpen(flag) {
21161 if (activeFocus && flag) {
21162 inputFocus.current.focus();
21163 }
21164
21165 setDisplay(flag);
21166 };
21167
21168 return React__default.createElement(React.Fragment, null, React__default.createElement(ColorButtonContainer, {
21169 onClick: function onClick(event) {
21170 event.stopPropagation();
21171 if (!disabled) handleOpen(!display);
21172 },
21173 style: style
21174 }, React__default.createElement(ColorBox, {
21175 color: color,
21176 disabled: disabled
21177 })), activeFocus && React__default.createElement(InputHidden, {
21178 ref: inputFocus
21179 }), React__default.createElement(ColorPicker, _extends_1({}, props, {
21180 isVisible: display,
21181 color: color,
21182 setColor: onChange,
21183 onClose: function onClose() {
21184 return setDisplay(false);
21185 }
21186 })));
21187};
21188
21189var InputHidden = styled__default.input(_templateObject$S());
21190var ColorBox = styled__default(function (_ref2) {
21191 var color = _ref2.color,
21192 disabled = _ref2.disabled,
21193 props = objectWithoutPropertiesLoose(_ref2, ["color", "disabled"]);
21194
21195 return React__default.createElement("div", props);
21196})(_templateObject2$k(), function (_ref3) {
21197 var theme = _ref3.theme,
21198 color = _ref3.color,
21199 disabled = _ref3.disabled;
21200 return disabled ? theme.colors.lightGray : color.hex;
21201}, function (_ref4) {
21202 var disabled = _ref4.disabled;
21203 return disabled ? 'not-allowed' : 'inherit';
21204});
21205ColorBox.displayName = 'ColorBox';
21206var ColorButtonContainer = styled__default.div(_templateObject3$e());
21207ColorButtonContainer.displayName = 'ColorButtonContainer';
21208ColorDisplayer.displayName = 'ColorDisplayer';
21209ColorDisplayer.defaultProps = {
21210 escKeyCall: function escKeyCall() {},
21211 color: {
21212 hex: '#e10020'
21213 },
21214 activeFocus: false,
21215 style: {},
21216 disabled: false
21217};
21218ColorDisplayer.propTypes = {
21219 escKeyCall: PropTypes.func,
21220 onChange: PropTypes.func.isRequired,
21221 style: PropTypes.shape({}),
21222 color: PropTypes.shape({
21223 hex: PropTypes.string.isRequired
21224 }),
21225 activeFocus: PropTypes.bool,
21226 disabled: PropTypes.bool
21227};
21228
21229function _templateObject2$l() {
21230 var data = taggedTemplateLiteralLoose(["\n\twidth: 5px;\n\tpadding-bottom: 2px;\n\tcolor: ", " !important;\n\ttext-align: center;\n"]);
21231
21232 _templateObject2$l = function _templateObject2() {
21233 return data;
21234 };
21235
21236 return data;
21237}
21238
21239function _templateObject$T() {
21240 var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-flex;\n\talign-items: center;\n"]);
21241
21242 _templateObject$T = function _templateObject() {
21243 return data;
21244 };
21245
21246 return data;
21247}
21248
21249var TimePicker =
21250/*#__PURE__*/
21251function (_Component) {
21252 inheritsLoose(TimePicker, _Component);
21253
21254 function TimePicker(props) {
21255 var _this;
21256
21257 _this = _Component.call(this, props) || this;
21258
21259 defineProperty(assertThisInitialized(_this), "formatMomentDuration", function (value, format) {
21260 return moment.utc(value.asMilliseconds()).format(format);
21261 });
21262
21263 defineProperty(assertThisInitialized(_this), "formatTimeItem", function (value) {
21264 return ((value || '') + "00").substr(0, 2);
21265 });
21266
21267 defineProperty(assertThisInitialized(_this), "isNumber", function (value) {
21268 return Number.isInteger(Number(value)) && String(value) === String(Number(value));
21269 });
21270
21271 defineProperty(assertThisInitialized(_this), "isValidTime", function (event, type, value) {
21272 switch (type) {
21273 case 'hours':
21274 return event.target.selectionEnd === 0 || event.target.selectionEnd === 1 && Number(value.charAt(0)) < 3 || event.target.selectionEnd === 2 && Number(value.charAt(0)) < 2 || event.target.selectionEnd === 2 && Number(value.charAt(0)) === 2 && Number(value.charAt(1)) < 4;
21275
21276 case 'minutes':
21277 case 'seconds':
21278 default:
21279 return event.target.selectionEnd !== 1 || event.target.selectionEnd === 1 && Number(value.charAt(0)) < 6;
21280 }
21281 });
21282
21283 defineProperty(assertThisInitialized(_this), "onInputChange", function (event, type) {
21284 var oldValue = _this.state[type];
21285 var _event$target = event.target,
21286 inputValue = _event$target.value,
21287 position = _event$target.selectionEnd;
21288 var isTyped = inputValue.length > oldValue.length;
21289 var cursorCharacter = inputValue[position - 1];
21290 var addedCharacter = isTyped ? cursorCharacter : null;
21291 var removedCharacter = isTyped ? null : oldValue[position - 1];
21292 var replacedSingleCharacter = inputValue.length === oldValue.length ? oldValue[position - 1] : null;
21293 var newValue = oldValue;
21294 var newPosition = position;
21295
21296 if (addedCharacter !== null) {
21297 if (position > 2) {
21298 newPosition = 2;
21299 } else if (_this.isNumber(addedCharacter)) {
21300 if (position === 2) {
21301 newValue = "" + inputValue.substr(0, 1) + inputValue.substr(1, 1);
21302 }
21303
21304 if (position === 1) {
21305 newValue = "" + inputValue.substr(0, 1) + inputValue.substr(2, 1);
21306 }
21307 } else {
21308 newPosition = position - 1;
21309 }
21310 } else if (replacedSingleCharacter !== null) {
21311 if (_this.isNumber(cursorCharacter)) {
21312 newValue = inputValue;
21313 } else {
21314 newValue = oldValue;
21315 newPosition = position - 1;
21316 }
21317 } else if (removedCharacter !== null) {
21318 if (position === 0) newValue = "0" + inputValue.substr(0, 1);else newValue = inputValue.substr(0, 1);
21319 }
21320
21321 return {
21322 newValue: newValue,
21323 newPosition: newPosition
21324 };
21325 });
21326
21327 defineProperty(assertThisInitialized(_this), "onChange", function (event, type, value) {
21328 var onChange = _this.props.onChange;
21329 var _this$state = _this.state,
21330 hoursValue = _this$state.hoursValue,
21331 minutesValue = _this$state.minutesValue,
21332 secondsValue = _this$state.secondsValue;
21333 var target = event.target,
21334 nativeEvent = event.nativeEvent,
21335 selectionEnd = event.target.selectionEnd;
21336 var durationObject = {
21337 hours: hoursValue,
21338 minutes: minutesValue,
21339 seconds: secondsValue
21340 };
21341 var typeValue = type + "Value";
21342
21343 if (nativeEvent.type === 'click') {
21344 var _this$setState, _extends2;
21345
21346 _this.setState((_this$setState = {}, _this$setState[typeValue] = value, _this$setState));
21347
21348 onChange(moment.duration(_extends_1({}, durationObject, (_extends2 = {}, _extends2[type] = value, _extends2))));
21349 } else {
21350 var _this$onInputChange = _this.onInputChange(event, typeValue),
21351 newValue = _this$onInputChange.newValue,
21352 newPosition = _this$onInputChange.newPosition;
21353
21354 newValue = _this.formatTimeItem(newValue);
21355
21356 if (_this.isValidTime(event, type, newValue)) {
21357 var _this$setState2, _extends3;
21358
21359 _this.setState((_this$setState2 = {}, _this$setState2[typeValue] = newValue, _this$setState2), function () {
21360 target.selectionStart = newPosition;
21361 target.selectionEnd = newPosition;
21362 });
21363
21364 onChange(moment.duration(_extends_1({}, durationObject, (_extends3 = {}, _extends3[type] = newValue, _extends3))));
21365 } else {
21366 _this.setState({}, function () {
21367 target.selectionStart = selectionEnd - 1;
21368 target.selectionEnd = selectionEnd - 1;
21369 });
21370 }
21371 }
21372 });
21373
21374 defineProperty(assertThisInitialized(_this), "onBlur", function () {
21375 var onBlur = _this.props.onBlur;
21376 var _this$state2 = _this.state,
21377 hoursValue = _this$state2.hoursValue,
21378 minutesValue = _this$state2.minutesValue,
21379 secondsValue = _this$state2.secondsValue;
21380 onBlur(moment.duration({
21381 hours: hoursValue,
21382 minutes: minutesValue,
21383 seconds: secondsValue
21384 }));
21385 });
21386
21387 var _this$props = _this.props,
21388 _value = _this$props.value,
21389 hours = _this$props.hours,
21390 minutes = _this$props.minutes,
21391 seconds = _this$props.seconds;
21392 _this.state = {
21393 hoursValue: hours ? _this.formatMomentDuration(_value, 'HH') : 0,
21394 minutesValue: minutes ? _this.formatMomentDuration(_value, 'mm') : 0,
21395 secondsValue: seconds ? _this.formatMomentDuration(_value, 'ss') : 0
21396 };
21397 return _this;
21398 }
21399
21400 var _proto = TimePicker.prototype;
21401
21402 _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
21403 var value = this.props.value;
21404
21405 if (value.hours() !== Number(prevState.hoursValue)) {
21406 this.setState({
21407 hoursValue: this.formatMomentDuration(value, 'HH')
21408 });
21409 }
21410
21411 if (value.minutes() !== Number(prevState.minutesValue)) {
21412 this.setState({
21413 minutesValue: this.formatMomentDuration(value, 'mm')
21414 });
21415 }
21416
21417 if (value.seconds() !== Number(prevState.secondsValue)) {
21418 this.setState({
21419 secondsValue: this.formatMomentDuration(value, 'ss')
21420 });
21421 }
21422 };
21423
21424 _proto.render = function render() {
21425 var _this2 = this;
21426
21427 var _this$props2 = this.props,
21428 disabled = _this$props2.disabled,
21429 error = _this$props2.error,
21430 hours = _this$props2.hours,
21431 minutes = _this$props2.minutes,
21432 seconds = _this$props2.seconds,
21433 onChange = _this$props2.onChange,
21434 onBlur = _this$props2.onBlur,
21435 value = _this$props2.value,
21436 props = objectWithoutPropertiesLoose(_this$props2, ["disabled", "error", "hours", "minutes", "seconds", "onChange", "onBlur", "value"]);
21437
21438 var _this$state3 = this.state,
21439 hoursValue = _this$state3.hoursValue,
21440 minutesValue = _this$state3.minutesValue,
21441 secondsValue = _this$state3.secondsValue;
21442 return React__default.createElement(Container$1, null, hours && React__default.createElement("div", null, React__default.createElement(NumberSpinner, _extends_1({
21443 name: "hours",
21444 disabled: disabled,
21445 error: error,
21446 min: 0,
21447 max: 23,
21448 onChange: function onChange(event, val) {
21449 return _this2.onChange(event, 'hours', val);
21450 },
21451 onBlur: this.onBlur,
21452 value: hoursValue
21453 }, props))), minutes && hours && React__default.createElement(MiddleColumn, {
21454 disabled: disabled
21455 }, ":"), minutes && React__default.createElement("div", null, React__default.createElement(NumberSpinner, _extends_1({
21456 name: "minutes",
21457 disabled: disabled,
21458 error: error,
21459 min: 0,
21460 max: 59,
21461 onChange: function onChange(event, val) {
21462 return _this2.onChange(event, 'minutes', val);
21463 },
21464 onBlur: this.onBlur,
21465 value: minutesValue
21466 }, props))), seconds && minutes && React__default.createElement(MiddleColumn, {
21467 disabled: disabled
21468 }, ":"), seconds && React__default.createElement("div", null, React__default.createElement(NumberSpinner, _extends_1({
21469 name: "seconds",
21470 disabled: disabled,
21471 error: error,
21472 min: 0,
21473 max: 59,
21474 onChange: function onChange(event, val) {
21475 return _this2.onChange(event, 'seconds', val);
21476 },
21477 onBlur: this.onBlur,
21478 value: secondsValue
21479 }, props))));
21480 };
21481
21482 return TimePicker;
21483}(React.Component);
21484
21485var hoursPropValidation = function hoursPropValidation(props, propName, componentName) {
21486 var minutes = props.minutes,
21487 seconds = props.seconds,
21488 hours = props.hours;
21489
21490 if (props[propName] === undefined || typeof props[propName] !== 'boolean') {
21491 return new Error("Failed prop format: The prop '" + propName + "' is marked as required in " + componentName + ", but its value is " + typeof props[propName] + ".");
21492 }
21493
21494 if (minutes === false && seconds === true && hours === true || minutes === false && seconds === false && hours === false) {
21495 return new Error('Please provide a valid time combination!');
21496 }
21497
21498 return null;
21499};
21500
21501TimePicker.defaultProps = {
21502 disabled: false,
21503 error: false,
21504 onBlur: function onBlur() {}
21505};
21506TimePicker.displayName = 'TimePicker';
21507TimePicker.propTypes = {
21508 onChange: PropTypes.func.isRequired,
21509 onBlur: PropTypes.func,
21510 name: PropTypes.string.isRequired,
21511 value: PropTypes.objectOf(moment).isRequired,
21512 disabled: PropTypes.bool,
21513 error: PropTypes.bool,
21514 seconds: PropTypes.bool.isRequired,
21515 minutes: PropTypes.bool.isRequired,
21516 hours: hoursPropValidation
21517};
21518var Container$1 = styled__default.div(_templateObject$T());
21519Container$1.displayName = 'Container';
21520var MiddleColumn = styled__default.div(_templateObject2$l(), function (_ref) {
21521 var disabled = _ref.disabled,
21522 theme = _ref.theme;
21523 return disabled ? theme.timePicker.disabledColor : theme.timePicker.textColor;
21524});
21525MiddleColumn.displayName = 'MiddleColumn';
21526
21527var Header$1 = function Header(_ref) {
21528 var bold = _ref.bold,
21529 italic = _ref.italic,
21530 underlined = _ref.underlined,
21531 uppercase = _ref.uppercase,
21532 size = _ref.size,
21533 color = _ref.color,
21534 props = objectWithoutPropertiesLoose(_ref, ["bold", "italic", "underlined", "uppercase", "size", "color"]);
21535
21536 return React__default.createElement(semanticUiReact.Header, _extends_1({
21537 as: function as(textProps) {
21538 return React__default.createElement(Text, _extends_1({
21539 size: size,
21540 color: color,
21541 bold: bold,
21542 underlined: underlined,
21543 uppercase: uppercase
21544 }, textProps));
21545 }
21546 }, props));
21547};
21548
21549Header$1.displayName = 'Header';
21550Header$1.defaultProps = {
21551 color: 'darkGray',
21552 italic: false,
21553 uppercase: false,
21554 size: 'xl',
21555 bold: true,
21556 underlined: false
21557};
21558Header$1.propTypes = {
21559 color: PropTypes.string,
21560 italic: PropTypes.bool,
21561 uppercase: PropTypes.bool,
21562 size: PropTypes.oneOf(['sm', 'md', 'lg', 'xl', 'xxl']),
21563 bold: PropTypes.bool,
21564 underlined: PropTypes.bool
21565};
21566
21567var BigHeader = function BigHeader(props) {
21568 return React__default.createElement(Header$1, _extends_1({
21569 color: "darkGray",
21570 bold: true,
21571 size: "xxl"
21572 }, props));
21573};
21574
21575BigHeader.displayName = 'BigHeader';
21576
21577var SubHeader = function SubHeader(props) {
21578 return React__default.createElement(Header$1, _extends_1({
21579 color: "darkGray",
21580 bold: true,
21581 size: "lg"
21582 }, props));
21583};
21584
21585SubHeader.displayName = 'SubHeader';
21586
21587var TextTruncate = function TextTruncate(_ref) {
21588 var text = _ref.text,
21589 length = _ref.length,
21590 place = _ref.place;
21591 var ending = '...';
21592 var truncatedString = "" + text.substring(0, length - ending.length) + ending;
21593 var slashedString = text.split(' ').join('_') + "-tooltip";
21594 if (text.length < length) return text;
21595 return React__default.createElement(React.Fragment, null, React__default.createElement(Tooltip, {
21596 multiline: true,
21597 id: slashedString,
21598 place: place,
21599 trigger: React__default.createElement("div", {
21600 "data-tip": text,
21601 "data-for": slashedString
21602 }, truncatedString)
21603 }));
21604};
21605
21606TextTruncate.defaultProps = {
21607 length: 38,
21608 place: 'top'
21609};
21610TextTruncate.propTypes = {
21611 /** The string to truncate */
21612 text: PropTypes.string.isRequired,
21613
21614 /** Tooltip position */
21615 place: PropTypes.oneOf(['top', 'right', 'left', 'bottom']),
21616
21617 /** The max lenght of the visible string */
21618 length: PropTypes.number
21619};
21620
21621function _templateObject4$b() {
21622 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tpadding-left: 0;\n\tpadding-right: 0;\n\theight: 100%;\n\tfont-weight: bold;\n"]);
21623
21624 _templateObject4$b = function _templateObject4() {
21625 return data;
21626 };
21627
21628 return data;
21629}
21630
21631function _templateObject3$f() {
21632 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n"]);
21633
21634 _templateObject3$f = function _templateObject3() {
21635 return data;
21636 };
21637
21638 return data;
21639}
21640
21641function _templateObject2$m() {
21642 var data = taggedTemplateLiteralLoose(["\n\tmargin: 0 15px;\n"]);
21643
21644 _templateObject2$m = function _templateObject2() {
21645 return data;
21646 };
21647
21648 return data;
21649}
21650
21651function _templateObject$U() {
21652 var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-flex;\n\talign-items: center;\n"]);
21653
21654 _templateObject$U = function _templateObject() {
21655 return data;
21656 };
21657
21658 return data;
21659}
21660var FROM_LOWER_LIMIT = moment.duration('00:00').asMilliseconds();
21661var FROM_HIGHER_LIMIT = moment.duration('23:58').asMilliseconds();
21662var TO_LOWER_LIMIT = moment.duration('00:01').asMilliseconds();
21663var TO_HIGHER_LIMIT = moment.duration('23:59').asMilliseconds();
21664
21665var TimePickerGroup = function TimePickerGroup(_ref) {
21666 var from = _ref.from,
21667 to = _ref.to,
21668 onChange = _ref.onChange,
21669 disabled = _ref.disabled,
21670 hours = _ref.hours,
21671 minutes = _ref.minutes,
21672 seconds = _ref.seconds,
21673 fromLabel = _ref.fromLabel,
21674 toLabel = _ref.toLabel,
21675 middleLabel = _ref.middleLabel,
21676 props = objectWithoutPropertiesLoose(_ref, ["from", "to", "onChange", "disabled", "hours", "minutes", "seconds", "fromLabel", "toLabel", "middleLabel"]);
21677
21678 var _useState = React.useState(from),
21679 beginTime = _useState[0],
21680 setBeginTime = _useState[1];
21681
21682 var _useState2 = React.useState(to),
21683 endTime = _useState2[0],
21684 setEndTime = _useState2[1];
21685
21686 var getLeastSignificantValue = function getLeastSignificantValue() {
21687 return seconds ? 's' : minutes ? 'm' : 'h';
21688 };
21689
21690 var checkBounds = function checkBounds(value, isFrom) {
21691 if (isFrom === void 0) {
21692 isFrom = false;
21693 }
21694
21695 return isFrom ? value >= FROM_LOWER_LIMIT && value <= FROM_HIGHER_LIMIT : value >= TO_LOWER_LIMIT && value <= TO_HIGHER_LIMIT;
21696 };
21697
21698 var handleChangeFrom = function handleChangeFrom(value) {
21699 if (checkBounds(value, true)) {
21700 var newEndTime = endTime;
21701
21702 if (value.asMilliseconds() >= endTime.asMilliseconds()) {
21703 newEndTime = value.clone().add(moment.duration(1, getLeastSignificantValue()));
21704 setEndTime(newEndTime);
21705 }
21706
21707 setBeginTime(value);
21708 onChange({
21709 from: value,
21710 to: newEndTime
21711 });
21712 } else {
21713 setBeginTime(beginTime.clone());
21714 }
21715 };
21716
21717 var handleChangeTo = function handleChangeTo(value) {
21718 if (checkBounds(value)) {
21719 var newBeginTime = beginTime;
21720
21721 if (beginTime.asMilliseconds() >= value.asMilliseconds()) {
21722 newBeginTime = value.clone().subtract(moment.duration(1, getLeastSignificantValue()));
21723 setBeginTime(newBeginTime);
21724 }
21725
21726 setEndTime(value);
21727 onChange({
21728 from: newBeginTime,
21729 to: value
21730 });
21731 } else {
21732 setEndTime(endTime.clone());
21733 }
21734 };
21735
21736 return React__default.createElement(Container$2, _extends_1({
21737 middleLabel: middleLabel
21738 }, props), React__default.createElement(TimePickerWithLabel, null, fromLabel && React__default.createElement(LabelText, null, fromLabel), React__default.createElement(TimePicker, {
21739 name: "TimePickerFrom",
21740 disabled: disabled,
21741 onChange: handleChangeFrom,
21742 hours: hours,
21743 minutes: minutes,
21744 seconds: seconds,
21745 value: beginTime
21746 })), React__default.createElement(MiddleLabel, null, middleLabel && React__default.createElement(SpanStyled, null, middleLabel)), React__default.createElement(TimePickerWithLabel, null, toLabel && React__default.createElement(LabelText, null, toLabel), React__default.createElement(TimePicker, {
21747 name: "TimePickerTo",
21748 disabled: disabled,
21749 onChange: handleChangeTo,
21750 hours: hours,
21751 minutes: minutes,
21752 seconds: seconds,
21753 value: endTime
21754 })));
21755};
21756
21757var Container$2 = styled__default.div(_templateObject$U());
21758Container$2.displayName = 'Container';
21759var MiddleLabel = styled__default.div(_templateObject2$m());
21760var TimePickerWithLabel = styled__default.div(_templateObject3$f());
21761var SpanStyled = styled__default.span(_templateObject4$b());
21762TimePickerGroup.defaultProps = {
21763 fromLabel: '',
21764 toLabel: '',
21765 disabled: false,
21766 hours: true,
21767 minutes: true,
21768 seconds: false,
21769 middleLabel: ''
21770};
21771TimePickerGroup.propTypes = {
21772 from: PropTypes.objectOf(moment).isRequired,
21773 to: PropTypes.objectOf(moment).isRequired,
21774 fromLabel: PropTypes.string,
21775 toLabel: PropTypes.string,
21776 onChange: PropTypes.func.isRequired,
21777 disabled: PropTypes.bool,
21778 hours: PropTypes.bool,
21779 minutes: PropTypes.bool,
21780 seconds: PropTypes.bool,
21781 middleLabel: PropTypes.string
21782};
21783
21784var SmileyVeryBad = function SmileyVeryBad(_ref) {
21785 var fill = _ref.fill,
21786 width = _ref.width,
21787 height = _ref.height;
21788 return React__default.createElement("svg", {
21789 width: width,
21790 height: height,
21791 viewBox: "0 0 88 88",
21792 fill: "none",
21793 xmlns: "http://www.w3.org/2000/svg"
21794 }, React__default.createElement("path", {
21795 d: "M43.9955 0C19.7366 0 0 19.7366 0 43.9965C0 68.2583 19.7366 87.996 43.9955 87.996C68.2583 87.996 87.998 68.2583 87.998 43.9965C87.998 19.7366 68.2593 0 43.9955 0ZM43.9955 81.9499C23.0716 81.9499 6.04707 64.9234 6.04707 43.9965C6.04707 23.0716 23.0716 6.04707 43.9955 6.04707C64.9244 6.04707 81.9509 23.0716 81.9509 43.9965C81.9509 64.9234 64.9244 81.9499 43.9955 81.9499Z",
21796 fill: fill
21797 }), React__default.createElement("path", {
21798 d: "M44.0327 15.0532C27.882 15.0532 14.7427 28.1935 14.7427 44.3432C14.7427 60.4929 27.882 73.6322 44.0327 73.6322C60.1844 73.6322 73.3247 60.4929 73.3247 44.3432C73.3257 28.1925 60.1854 15.0532 44.0327 15.0532ZM28.784 31.1001C29.2587 30.2939 30.2998 30.0187 31.1111 30.4924L41.4516 36.5526C42.2629 37.0293 42.53 38.0674 42.0603 38.8787C41.7439 39.4179 41.1744 39.7192 40.5919 39.7192C40.3954 39.7192 40.1938 39.6708 40.0053 39.6013C39.958 39.6991 39.9227 39.7988 39.8693 39.8976C38.9168 41.5162 36.8336 42.0604 35.216 41.1121C33.5924 40.1627 33.0542 38.0764 34.0016 36.4599C34.051 36.3752 34.1155 36.3046 34.1689 36.228L29.3917 33.4303C28.5804 32.9515 28.3113 31.9104 28.784 31.1001ZM58.7331 57.2981C58.1052 57.9945 57.0288 58.0469 56.3354 57.417C52.9571 54.3723 48.5972 50.6775 44.0488 50.6775C39.4863 50.6775 35.1163 54.3814 31.738 57.4422C31.4134 57.7385 31.0053 57.8846 30.5981 57.8846C30.1375 57.8846 29.6769 57.6962 29.3403 57.3253C28.7084 56.6319 28.7618 55.5565 29.4562 54.9296C33.4604 51.2984 38.6427 47.2781 44.0518 47.2781C49.4418 47.2781 54.613 51.2822 58.6101 54.8933C59.3106 55.5273 59.363 56.6026 58.7331 57.2981ZM58.6767 33.4293L53.8975 36.223C53.9589 36.3036 54.0194 36.3742 54.0668 36.4588C55.0192 38.0754 54.4739 40.1617 52.8543 41.1111C51.2368 42.0564 49.1495 41.5112 48.2052 39.8946C48.1517 39.7978 48.1124 39.6981 48.0671 39.5953C47.8746 39.6668 47.6791 39.7152 47.4805 39.7152C46.8939 39.7152 46.3265 39.4169 46.0121 38.8757C45.5374 38.0664 45.8075 37.0283 46.6168 36.5516L56.9613 30.4914C57.7686 30.0167 58.8097 30.2848 59.2844 31.0991C59.7571 31.9104 59.487 32.9515 58.6767 33.4293Z",
21799 fill: fill
21800 }));
21801};
21802
21803SmileyVeryBad.defaultProps = {
21804 fill: theme.colors.red,
21805 width: 24,
21806 height: 24
21807};
21808SmileyVeryBad.propTypes = {
21809 fill: PropTypes.string,
21810 width: PropTypes.number,
21811 height: PropTypes.number
21812};
21813
21814var SmileyBad = function SmileyBad(_ref) {
21815 var fill = _ref.fill,
21816 width = _ref.width,
21817 height = _ref.height;
21818 return React__default.createElement("svg", {
21819 width: width,
21820 height: height,
21821 viewBox: "0 0 89 88",
21822 fill: "none",
21823 xmlns: "http://www.w3.org/2000/svg"
21824 }, React__default.createElement("path", {
21825 d: "M44.0305 14.7104C27.8808 14.7104 14.7415 27.8507 14.7415 44.0015C14.7415 60.1512 27.8798 73.2904 44.0305 73.2904C60.1813 73.2904 73.3225 60.1512 73.3225 44.0015C73.3215 27.8497 60.1813 14.7104 44.0305 14.7104ZM50.8597 31.736C52.7393 31.736 54.2632 33.2568 54.2632 35.1364C54.2632 37.011 52.7393 38.5369 50.8597 38.5369C48.9841 38.5369 47.4622 37.011 47.4622 35.1364C47.4622 33.2568 48.9841 31.736 50.8597 31.736ZM36.7025 31.736C38.5862 31.736 40.102 33.2568 40.102 35.1364C40.102 37.011 38.5862 38.5369 36.7025 38.5369C34.8289 38.5369 33.305 37.011 33.305 35.1364C33.305 33.2568 34.8289 31.736 36.7025 31.736ZM58.7632 54.9366C58.1373 55.634 57.0589 55.6894 56.3635 55.0605C52.9913 52.0138 48.6293 50.3358 44.0799 50.3358C39.5214 50.3358 35.1494 52.0209 31.7731 55.0867C31.4466 55.379 31.0374 55.5272 30.6292 55.5272C30.1686 55.5272 29.708 55.3397 29.3714 54.9698C28.7395 54.2754 28.7949 53.2001 29.4914 52.5691C33.4955 48.9399 38.6779 46.9373 44.0799 46.9373C49.4739 46.9373 54.6442 48.9268 58.6423 52.5399C59.3357 53.1688 59.3911 54.2402 58.7632 54.9366Z",
21826 fill: fill
21827 }), React__default.createElement("path", {
21828 d: "M44.0025 0C19.7386 0 0 19.7366 0 43.9975C0 68.2603 19.7386 88 44.0025 88C68.2624 88 88.002 68.2603 88.002 43.9975C88.002 19.7366 68.2624 0 44.0025 0ZM44.0025 81.9529C23.0746 81.9529 6.04707 64.9264 6.04707 43.9975C6.04707 23.0716 23.0746 6.04707 44.0025 6.04707C64.9304 6.04707 81.9549 23.0716 81.9549 43.9975C81.9549 64.9264 64.9304 81.9529 44.0025 81.9529Z",
21829 fill: fill
21830 }));
21831};
21832
21833SmileyBad.defaultProps = {
21834 fill: theme.colors.red,
21835 width: 24,
21836 height: 24
21837};
21838SmileyBad.propTypes = {
21839 fill: PropTypes.string,
21840 width: PropTypes.number,
21841 height: PropTypes.number
21842};
21843
21844var SmileyBlank = function SmileyBlank(_ref) {
21845 var fill = _ref.fill,
21846 width = _ref.width,
21847 height = _ref.height;
21848 return React__default.createElement("svg", {
21849 width: width,
21850 height: height,
21851 viewBox: "0 0 89 88",
21852 fill: "none",
21853 xmlns: "http://www.w3.org/2000/svg"
21854 }, React__default.createElement("path", {
21855 d: "M44.0025 0C19.7386 0 0 19.7366 0 43.9975C0 68.2603 19.7386 88 44.0025 88C68.2624 88 88.002 68.2603 88.002 43.9975C88.002 19.7366 68.2624 0 44.0025 0ZM44.0025 81.9529C23.0746 81.9529 6.04707 64.9264 6.04707 43.9975C6.04707 23.0716 23.0746 6.04707 44.0025 6.04707C64.9304 6.04707 81.9549 23.0716 81.9549 43.9975C81.9549 64.9264 64.9304 81.9529 44.0025 81.9529Z",
21856 fill: fill
21857 }), React__default.createElement("path", {
21858 d: "M44.0328 14.7126C27.8821 14.7126 14.7428 27.8519 14.7428 44.0016C14.7428 60.1513 27.8821 73.2896 44.0328 73.2896C60.1835 73.2896 73.3228 60.1503 73.3228 44.0006C73.3228 27.8509 60.1845 14.7126 44.0328 14.7126ZM51.1159 31.7341C52.9895 31.7341 54.5093 33.257 54.5093 35.1366C54.5093 37.0112 52.9895 38.5361 51.1159 38.5361C49.2383 38.5361 47.7165 37.0112 47.7165 35.1366C47.7165 33.257 49.2373 31.7341 51.1159 31.7341ZM36.9587 31.7341C38.8343 31.7341 40.3562 33.257 40.3562 35.1366C40.3562 37.0112 38.8343 38.5361 36.9587 38.5361C35.0771 38.5361 33.5552 37.0112 33.5552 35.1366C33.5552 33.257 35.0771 31.7341 36.9587 31.7341ZM53.4622 54.5235H34.6044C33.6691 54.5235 32.9092 53.7606 32.9092 52.8243C32.9092 51.885 33.6691 51.1241 34.6044 51.1241H53.4622C54.4015 51.1241 55.1614 51.885 55.1614 52.8243C55.1604 53.7606 54.4015 54.5235 53.4622 54.5235Z",
21859 fill: fill
21860 }));
21861};
21862
21863SmileyBlank.defaultProps = {
21864 fill: '#FBDC3B',
21865 width: 24,
21866 height: 24
21867};
21868SmileyBlank.propTypes = {
21869 fill: PropTypes.string,
21870 width: PropTypes.number,
21871 height: PropTypes.number
21872};
21873
21874var SmileyGood = function SmileyGood(_ref) {
21875 var fill = _ref.fill,
21876 width = _ref.width,
21877 height = _ref.height;
21878 return React__default.createElement("svg", {
21879 width: width,
21880 height: height,
21881 viewBox: "0 0 89 88",
21882 fill: "none",
21883 xmlns: "http://www.w3.org/2000/svg"
21884 }, React__default.createElement("path", {
21885 d: "M44.0025 0C19.7386 0 0 19.7366 0 43.9975C0 68.2603 19.7386 88 44.0025 88C68.2624 88 88.002 68.2603 88.002 43.9975C88.002 19.7366 68.2624 0 44.0025 0ZM44.0025 81.9529C23.0746 81.9529 6.04707 64.9264 6.04707 43.9975C6.04707 23.0716 23.0746 6.04707 44.0025 6.04707C64.9304 6.04707 81.9549 23.0716 81.9549 43.9975C81.9549 64.9264 64.9304 81.9529 44.0025 81.9529Z",
21886 fill: fill
21887 }), React__default.createElement("path", {
21888 d: "M44.0325 14.7126C27.8818 14.7126 14.7426 27.8519 14.7426 44.0016C14.7426 60.1513 27.8818 73.2896 44.0325 73.2896C60.1833 73.2896 73.3225 60.1503 73.3225 44.0006C73.3225 27.8509 60.1843 14.7126 44.0325 14.7126ZM51.1157 31.7341C52.9893 31.7341 54.5091 33.257 54.5091 35.1366C54.5091 37.0112 52.9893 38.5361 51.1157 38.5361C49.2381 38.5361 47.7162 37.0112 47.7162 35.1366C47.7162 33.257 49.2371 31.7341 51.1157 31.7341ZM36.9212 31.7341C38.7988 31.7341 40.3227 33.257 40.3227 35.1366C40.3227 37.0112 38.7988 38.5361 36.9212 38.5361C35.0416 38.5361 33.5237 37.0112 33.5237 35.1366C33.5237 33.257 35.0416 31.7341 36.9212 31.7341ZM58.5697 50.1777C54.5857 53.9259 50.6077 57.792 44.0114 57.792C37.4745 57.792 33.3262 53.9894 29.4188 50.1424C28.7526 49.4863 28.675 48.4402 29.3029 47.7448C29.9288 47.0514 31.0051 47 31.7026 47.6279C35.0768 50.6917 37.9643 54.3935 44.0114 54.3935C50.0585 54.3935 52.9207 50.7018 56.293 47.6541C56.9894 47.0252 58.0628 47.0806 58.6927 47.773C59.3195 48.4745 59.2671 49.5458 58.5697 50.1777Z",
21889 fill: fill
21890 }));
21891};
21892
21893SmileyGood.defaultProps = {
21894 fill: '#44A40A',
21895 width: 24,
21896 height: 24
21897};
21898SmileyGood.propTypes = {
21899 fill: PropTypes.string,
21900 width: PropTypes.number,
21901 height: PropTypes.number
21902};
21903
21904var SmileyVeryGood = function SmileyVeryGood(_ref) {
21905 var fill = _ref.fill,
21906 width = _ref.width,
21907 height = _ref.height;
21908 return React__default.createElement("svg", {
21909 width: width,
21910 height: height,
21911 viewBox: "0 0 88 88",
21912 fill: "none",
21913 xmlns: "http://www.w3.org/2000/svg"
21914 }, React__default.createElement("path", {
21915 d: "M44.0025 0C19.7397 0 0 19.7366 0 43.9975C0 68.2603 19.7397 88 44.0025 88C68.2634 88 88.001 68.2603 88.001 43.9975C88.001 19.7366 68.2634 0 44.0025 0ZM44.0025 81.9529C23.0746 81.9529 6.04707 64.9264 6.04707 43.9975C6.04707 23.0716 23.0746 6.04707 44.0025 6.04707C64.9294 6.04707 81.9539 23.0716 81.9539 43.9975C81.9539 64.9264 64.9294 81.9529 44.0025 81.9529Z",
21916 fill: fill
21917 }), React__default.createElement("path", {
21918 d: "M59.0276 46.9375H28.9757C28.6703 46.9375 28.4345 47.0212 28.3277 47.1653C28.2229 47.3104 28.2148 47.5603 28.3065 47.8526C28.4597 48.3283 32.2099 59.5799 44.0027 59.5799C54.4561 59.5799 59.457 47.768 59.5074 47.649C59.6384 47.3275 59.6071 47.1431 59.5709 47.0897C59.5346 47.0363 59.3764 46.9375 59.0276 46.9375Z",
21919 fill: fill
21920 }), React__default.createElement("path", {
21921 d: "M43.9988 14.7126C27.8501 14.7126 14.7119 27.8519 14.7119 44.0016C14.7119 60.1513 27.8491 73.2906 43.9988 73.2906C60.1506 73.2906 73.2908 60.1513 73.2908 44.0016C73.2908 27.8519 60.1516 14.7126 43.9988 14.7126ZM51.3773 28.1936C54.1922 28.1936 56.481 30.4814 56.481 33.2953C56.481 34.2346 55.7211 34.9955 54.7818 34.9955C53.8424 34.9955 53.0825 34.2346 53.0825 33.2953C53.0825 32.354 52.3166 31.59 51.3763 31.59C50.4369 31.59 49.668 32.355 49.668 33.2953C49.668 34.2346 48.9101 34.9955 47.9707 34.9955C47.0375 34.9955 46.2735 34.2346 46.2735 33.2953C46.2745 30.4824 48.5624 28.1936 51.3773 28.1936ZM36.6254 28.1936C39.4383 28.1936 41.7271 30.4814 41.7271 33.2953C41.7271 34.2346 40.9672 34.9955 40.0299 34.9955C39.0926 34.9955 38.3307 34.2346 38.3307 33.2953C38.3307 32.354 37.5627 31.59 36.6244 31.59C35.6831 31.59 34.9202 32.355 34.9202 33.2953C34.9202 34.2346 34.1562 34.9955 33.2209 34.9955C32.2836 34.9955 31.5197 34.2346 31.5197 33.2953C31.5207 30.4824 33.8105 28.1936 36.6254 28.1936ZM62.3033 48.797C62.0725 49.3614 56.5001 62.6034 44.0029 62.6034C29.9676 62.6034 25.4676 48.9028 25.4242 48.7647C25.0372 47.5442 25.2065 46.3096 25.8889 45.3794C26.5712 44.4491 27.6959 43.914 28.9749 43.914H59.0268C60.332 43.914 61.4436 44.4582 62.0806 45.4046C62.7175 46.3529 62.7992 47.5896 62.3033 48.797Z",
21922 fill: fill
21923 }));
21924};
21925
21926SmileyVeryGood.defaultProps = {
21927 fill: '#44A40A',
21928 width: 24,
21929 height: 24
21930};
21931SmileyVeryGood.propTypes = {
21932 fill: PropTypes.string,
21933 width: PropTypes.number,
21934 height: PropTypes.number
21935};
21936
21937var Star = function Star(_ref) {
21938 var fill = _ref.fill,
21939 width = _ref.width,
21940 height = _ref.height;
21941 return React__default.createElement("svg", {
21942 width: width,
21943 height: height,
21944 viewBox: "0 0 26 24",
21945 fill: "none",
21946 xmlns: "http://www.w3.org/2000/svg"
21947 }, React__default.createElement("path", {
21948 d: "M12.7502 0L16.6898 7.90022L25.5 9.16742L19.1249 15.3165L20.6298 24L12.7502 19.9004L4.87022 24L6.37512 15.3165L0 9.16742L8.81023 7.90022L12.7502 0Z",
21949 fill: fill
21950 }));
21951};
21952
21953Star.displayName = 'Star';
21954Star.defaultProps = {
21955 fill: theme.colors.gray,
21956 width: 26,
21957 height: 24
21958};
21959Star.propTypes = {
21960 fill: PropTypes.string,
21961 width: PropTypes.number,
21962 height: PropTypes.number
21963};
21964
21965function _templateObject$V() {
21966 var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-block;\n\tmargin: 0 2px;\n"]);
21967
21968 _templateObject$V = function _templateObject() {
21969 return data;
21970 };
21971
21972 return data;
21973}
21974
21975var Rating = function Rating(_ref) {
21976 var number = _ref.number,
21977 type = _ref.type;
21978 var _theme$colors = theme.colors,
21979 yellow = _theme$colors.yellow,
21980 gray = _theme$colors.gray,
21981 orange = _theme$colors.orange;
21982 var threeStars = [yellow, yellow, gray];
21983 var fiveStars = [yellow, yellow, yellow, gray, gray];
21984 var threeSmileys = [function () {
21985 return React__default.createElement(SmileyBad, null);
21986 }, function () {
21987 return React__default.createElement(SmileyBlank, null);
21988 }, function () {
21989 return React__default.createElement(SmileyGood, null);
21990 }];
21991 var fiveSmileys = [function () {
21992 return React__default.createElement(SmileyVeryBad, null);
21993 }, function () {
21994 return React__default.createElement(SmileyBad, {
21995 fill: orange
21996 });
21997 }, function () {
21998 return React__default.createElement(SmileyBlank, null);
21999 }, function () {
22000 return React__default.createElement(SmileyGood, {
22001 fill: "#95C623"
22002 });
22003 }, function () {
22004 return React__default.createElement(SmileyVeryGood, null);
22005 }];
22006 var stars = number === 3 ? threeStars : fiveStars;
22007 var smileys = number === 3 ? threeSmileys : fiveSmileys;
22008
22009 var renderSmileys = function renderSmileys() {
22010 return smileys.map(function (Smiley, index$$1) {
22011 return React__default.createElement(SvgContainer, {
22012 key: index$$1
22013 }, React__default.createElement(Smiley, null));
22014 });
22015 };
22016
22017 var renderStars = function renderStars() {
22018 return stars.map(function (color, index$$1) {
22019 return React__default.createElement(SvgContainer, {
22020 key: index$$1
22021 }, React__default.createElement(Star, {
22022 fill: color
22023 }));
22024 });
22025 };
22026
22027 return React__default.createElement("div", null, type === 'stars' ? renderStars(stars) : renderSmileys(smileys));
22028};
22029
22030var SvgContainer = styled__default.div(_templateObject$V());
22031Rating.displayName = 'Rating';
22032Rating.defaultProps = {
22033 number: 3,
22034 type: 'stars'
22035};
22036Rating.propTypes = {
22037 /** number of Rating elements */
22038 number: PropTypes.oneOf([3, 5]),
22039
22040 /** type of Rating */
22041 type: PropTypes.oneOf(['stars', 'smileys'])
22042};
22043
22044function _templateObject$W() {
22045 var data = taggedTemplateLiteralLoose(["\n\twidth: ", "px;\n\theight: ", "px;\n\tbox-sizing: border-box;\n\tborder: thin ", ";\n\tborder-color: ", ";\n\tborder-radius: 4px;\n\tbox-shadow: ", ";\n\n\t:active,\n\t:hover {\n\t\tborder-color: ", ";\n\t}\n\tcursor: pointer;\n\tuser-select: none;\n"]);
22046
22047 _templateObject$W = function _templateObject() {
22048 return data;
22049 };
22050
22051 return data;
22052}
22053var WidgetCardWrapper = styled__default.div(_templateObject$W(), function (_ref) {
22054 var width = _ref.width;
22055 return width;
22056}, function (_ref2) {
22057 var height = _ref2.height;
22058 return height;
22059}, function (_ref3) {
22060 var borderStyle = _ref3.borderStyle;
22061 return borderStyle;
22062}, function (_ref4) {
22063 var theme = _ref4.theme,
22064 selected = _ref4.selected;
22065 return selected ? theme.colors.deepBlue : theme.colors.strokeGray;
22066}, function (_ref5) {
22067 var borderStyle = _ref5.borderStyle;
22068 return borderStyle === 'dashed' && '0px 0px 4px rgba(0, 0, 0, 0.25)';
22069}, function (_ref6) {
22070 var theme = _ref6.theme;
22071 return theme.colors.deepBlue;
22072});
22073WidgetCardWrapper.displayName = 'WidgetCardWrapper';
22074WidgetCardWrapper.defaultProps = {
22075 borderStyle: 'solid',
22076 width: 57,
22077 height: 57,
22078 selected: false
22079};
22080WidgetCardWrapper.propTypes = {
22081 borderStyle: PropTypes.oneOf(['dashed', 'solid']),
22082 width: PropTypes.number,
22083 height: PropTypes.number,
22084 selected: PropTypes.bool
22085};
22086
22087var WidgetCardContainer = function WidgetCardContainer(_ref) {
22088 var borderStyle = _ref.borderStyle,
22089 selected = _ref.selected,
22090 children = _ref.children,
22091 width = _ref.width,
22092 height = _ref.height,
22093 props = objectWithoutPropertiesLoose(_ref, ["borderStyle", "selected", "children", "width", "height"]);
22094
22095 return React__default.createElement(WidgetCardWrapper, _extends_1({
22096 borderStyle: borderStyle,
22097 selected: selected,
22098 width: width,
22099 height: height
22100 }, props), children);
22101};
22102
22103WidgetCardContainer.defaultProps = {
22104 borderStyle: 'solid',
22105 children: undefined,
22106 width: 57,
22107 height: 57,
22108 selected: false
22109};
22110WidgetCardContainer.propTypes = {
22111 /** Style of the border (can be dashed or solid) */
22112 borderStyle: PropTypes.oneOf(['dashed', 'solid']),
22113
22114 /** Card content */
22115 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
22116
22117 /** Card Width in pixels */
22118 width: PropTypes.number,
22119
22120 /** Card Height in pixels */
22121 height: PropTypes.number,
22122
22123 /** is selected */
22124 selected: PropTypes.bool
22125};
22126WidgetCardContainer.displayName = 'WidgetCardContainer';
22127
22128function _templateObject3$g() {
22129 var data = taggedTemplateLiteralLoose(["\n\tcolor: ", ";\n\tfont-size: 12px;\n"]);
22130
22131 _templateObject3$g = function _templateObject3() {
22132 return data;
22133 };
22134
22135 return data;
22136}
22137
22138function _templateObject2$n() {
22139 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n"]);
22140
22141 _templateObject2$n = function _templateObject2() {
22142 return data;
22143 };
22144
22145 return data;
22146}
22147
22148function _templateObject$X() {
22149 var data = taggedTemplateLiteralLoose(["\n\twidth: fit-content;\n\ttext-align: center;\n\n\t:hover {\n\t\t.Rating-label {\n\t\t\tcolor: ", ";\n\t\t}\n\t}\n"]);
22150
22151 _templateObject$X = function _templateObject() {
22152 return data;
22153 };
22154
22155 return data;
22156}
22157
22158var RatingBox = function RatingBox(_ref) {
22159 var number = _ref.number,
22160 label = _ref.label,
22161 type = _ref.type;
22162 return React__default.createElement(RatingBoxStyled, null, React__default.createElement(RatingBoxWrapper, {
22163 width: 169,
22164 height: 60,
22165 number: number
22166 }, React__default.createElement(Rating, {
22167 number: number,
22168 type: type
22169 })), label && React__default.createElement(Label$2, {
22170 className: "Rating-label"
22171 }, label));
22172};
22173
22174var RatingBoxStyled = styled__default.div(_templateObject$X(), function (_ref2) {
22175 var theme = _ref2.theme;
22176 return theme.colors.deepBlue;
22177});
22178var RatingBoxWrapper = styled__default(WidgetCardContainer)(_templateObject2$n());
22179var Label$2 = styled__default.div(_templateObject3$g(), function (_ref3) {
22180 var theme = _ref3.theme;
22181 return theme.colors.mediumGray;
22182});
22183RatingBox.displayName = 'RatingBox';
22184RatingBox.defaultProps = {
22185 number: 3,
22186 label: undefined,
22187 type: 'stars'
22188};
22189RatingBox.propTypes = {
22190 /** number of Rating elements */
22191 number: PropTypes.oneOf([3, 5]),
22192
22193 /** type of Rating */
22194 type: PropTypes.oneOf(['stars', 'smileys']),
22195
22196 /** Label bellow the box */
22197 label: PropTypes.string
22198};
22199
22200var constant$2 = createCommonjsModule(function (module, exports) {
22201
22202exports.__esModule = true;
22203exports.ACTION = exports.TYPE = exports.POSITION = void 0;
22204var POSITION = {
22205 TOP_LEFT: 'top-left',
22206 TOP_RIGHT: 'top-right',
22207 TOP_CENTER: 'top-center',
22208 BOTTOM_LEFT: 'bottom-left',
22209 BOTTOM_RIGHT: 'bottom-right',
22210 BOTTOM_CENTER: 'bottom-center'
22211};
22212exports.POSITION = POSITION;
22213var TYPE = {
22214 INFO: 'info',
22215 SUCCESS: 'success',
22216 WARNING: 'warning',
22217 ERROR: 'error',
22218 DEFAULT: 'default'
22219};
22220exports.TYPE = TYPE;
22221var ACTION = {
22222 SHOW: 0,
22223 CLEAR: 1,
22224 DID_MOUNT: 2,
22225 WILL_UNMOUNT: 3,
22226 ON_CHANGE: 4
22227};
22228exports.ACTION = ACTION;
22229});
22230
22231unwrapExports(constant$2);
22232var constant_1 = constant$2.ACTION;
22233var constant_2 = constant$2.TYPE;
22234var constant_3 = constant$2.POSITION;
22235
22236var propValidator = createCommonjsModule(function (module, exports) {
22237
22238exports.__esModule = true;
22239exports.isValidDelay = isValidDelay;
22240exports.objectValues = objectValues;
22241exports.falseOrElement = exports.falseOrDelay = void 0;
22242
22243
22244
22245function isValidDelay(val) {
22246 return typeof val === 'number' && !isNaN(val) && val > 0;
22247}
22248
22249function objectValues(obj) {
22250 return Object.keys(obj).map(function (key) {
22251 return obj[key];
22252 });
22253}
22254
22255function withRequired(fn) {
22256 fn.isRequired = function (props, propName, componentName) {
22257 var prop = props[propName];
22258
22259 if (typeof prop === 'undefined') {
22260 return new Error("The prop " + propName + " is marked as required in \n " + componentName + ", but its value is undefined.");
22261 }
22262
22263 fn(props, propName, componentName);
22264 };
22265
22266 return fn;
22267}
22268
22269var falseOrDelay = withRequired(function (props, propName, componentName) {
22270 var prop = props[propName];
22271
22272 if (prop !== false && !isValidDelay(prop)) {
22273 return new Error(componentName + " expect " + propName + " \n to be a valid Number > 0 or equal to false. " + prop + " given.");
22274 }
22275
22276 return null;
22277});
22278exports.falseOrDelay = falseOrDelay;
22279var falseOrElement = withRequired(function (props, propName, componentName) {
22280 var prop = props[propName];
22281
22282 if (prop !== false && !(0, React__default.isValidElement)(prop)) {
22283 return new Error(componentName + " expect " + propName + " \n to be a valid react element or equal to false. " + prop + " given.");
22284 }
22285
22286 return null;
22287});
22288exports.falseOrElement = falseOrElement;
22289});
22290
22291unwrapExports(propValidator);
22292var propValidator_1 = propValidator.isValidDelay;
22293var propValidator_2 = propValidator.objectValues;
22294var propValidator_3 = propValidator.falseOrElement;
22295var propValidator_4 = propValidator.falseOrDelay;
22296
22297var ProgressBar_1 = createCommonjsModule(function (module, exports) {
22298
22299exports.__esModule = true;
22300exports.default = void 0;
22301
22302var _react = _interopRequireDefault(React__default);
22303
22304var _propTypes = _interopRequireDefault(PropTypes);
22305
22306var _classnames = _interopRequireDefault(classnames);
22307
22308
22309
22310
22311
22312function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22313
22314function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
22315
22316function ProgressBar(_ref) {
22317 var _animationEvent;
22318
22319 var delay = _ref.delay,
22320 isRunning = _ref.isRunning,
22321 closeToast = _ref.closeToast,
22322 type = _ref.type,
22323 hide = _ref.hide,
22324 className = _ref.className,
22325 userStyle = _ref.style,
22326 controlledProgress = _ref.controlledProgress,
22327 progress = _ref.progress,
22328 isProgressDone = _ref.isProgressDone,
22329 rtl = _ref.rtl;
22330
22331 var style = _extends({}, userStyle, {
22332 animationDuration: delay + "ms",
22333 animationPlayState: isRunning ? 'running' : 'paused',
22334 opacity: hide ? 0 : 1,
22335 transform: controlledProgress ? "scaleX(" + progress + ")" : null
22336 });
22337
22338 var classNames = (0, _classnames.default)('Toastify__progress-bar', controlledProgress ? 'Toastify__progress-bar--controlled' : 'Toastify__progress-bar--animated', "Toastify__progress-bar--" + type, {
22339 'Toastify__progress-bar--rtl': rtl
22340 }, className);
22341 var animationEvent = (_animationEvent = {}, _animationEvent[controlledProgress && isProgressDone ? 'onTransitionEnd' : 'onAnimationEnd'] = controlledProgress && !isProgressDone ? null : closeToast, _animationEvent);
22342 return _react.default.createElement("div", _extends({
22343 className: classNames,
22344 style: style
22345 }, animationEvent));
22346}
22347
22348ProgressBar.propTypes = {
22349 /**
22350 * The animation delay which determine when to close the toast
22351 */
22352 delay: propValidator.falseOrDelay.isRequired,
22353
22354 /**
22355 * Whether or not the animation is running or paused
22356 */
22357 isRunning: _propTypes.default.bool.isRequired,
22358
22359 /**
22360 * Func to close the current toast
22361 */
22362 closeToast: _propTypes.default.func.isRequired,
22363
22364 /**
22365 * Support rtl content
22366 */
22367 rtl: _propTypes.default.bool.isRequired,
22368
22369 /**
22370 * Optional type : info, success ...
22371 */
22372 type: _propTypes.default.string,
22373
22374 /**
22375 * Hide or not the progress bar
22376 */
22377 hide: _propTypes.default.bool,
22378
22379 /**
22380 * Optionnal className
22381 */
22382 className: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]),
22383
22384 /**
22385 * Controlled progress value
22386 */
22387 progress: _propTypes.default.number,
22388
22389 /**
22390 * Tell wether or not controlled progress bar is used
22391 */
22392 controlledProgress: _propTypes.default.bool,
22393
22394 /**
22395 * Helper to close the toast when using controlled progress value
22396 */
22397 isProgressDone: _propTypes.default.bool
22398};
22399ProgressBar.defaultProps = {
22400 type: constant$2.TYPE.DEFAULT,
22401 hide: false
22402};
22403var _default = ProgressBar;
22404exports.default = _default;
22405});
22406
22407unwrapExports(ProgressBar_1);
22408
22409var Toast_1 = createCommonjsModule(function (module, exports) {
22410
22411exports.__esModule = true;
22412exports.default = void 0;
22413
22414var _react = _interopRequireWildcard(React__default);
22415
22416var _propTypes = _interopRequireDefault(PropTypes);
22417
22418var _classnames = _interopRequireDefault(classnames);
22419
22420var _ProgressBar = _interopRequireDefault(ProgressBar_1);
22421
22422
22423
22424
22425
22426function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22427
22428function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
22429
22430function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
22431
22432function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
22433
22434function getX(e) {
22435 return e.targetTouches && e.targetTouches.length >= 1 ? e.targetTouches[0].clientX : e.clientX;
22436}
22437
22438function getY(e) {
22439 return e.targetTouches && e.targetTouches.length >= 1 ? e.targetTouches[0].clientY : e.clientY;
22440}
22441
22442var noop = function noop() {};
22443
22444var Toast =
22445/*#__PURE__*/
22446function (_Component) {
22447 _inheritsLoose(Toast, _Component);
22448
22449 function Toast() {
22450 var _this;
22451
22452 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
22453 args[_key] = arguments[_key];
22454 }
22455
22456 _this = _Component.call.apply(_Component, [this].concat(args)) || this;
22457 _this.state = {
22458 isRunning: true,
22459 preventExitTransition: false
22460 };
22461 _this.flag = {
22462 canCloseOnClick: true,
22463 canDrag: false
22464 };
22465 _this.drag = {
22466 start: 0,
22467 x: 0,
22468 y: 0,
22469 deltaX: 0,
22470 removalDistance: 0
22471 };
22472 _this.ref = null;
22473
22474 _this.pauseToast = function () {
22475 if (_this.props.autoClose) {
22476 _this.setState({
22477 isRunning: false
22478 });
22479 }
22480 };
22481
22482 _this.playToast = function () {
22483 if (_this.props.autoClose) {
22484 _this.setState({
22485 isRunning: true
22486 });
22487 }
22488 };
22489
22490 _this.onDragStart = function (e) {
22491 _this.flag.canCloseOnClick = true;
22492 _this.flag.canDrag = true;
22493 _this.ref.style.transition = '';
22494 _this.drag.start = _this.drag.x = getX(e.nativeEvent);
22495 _this.drag.removalDistance = _this.ref.offsetWidth * (_this.props.draggablePercent / 100);
22496 };
22497
22498 _this.onDragMove = function (e) {
22499 if (_this.flag.canDrag) {
22500 if (_this.state.isRunning) {
22501 _this.pauseToast();
22502 }
22503
22504 _this.drag.x = getX(e);
22505 _this.drag.deltaX = _this.drag.x - _this.drag.start; // prevent false positif during a toast click
22506
22507 _this.drag.start !== _this.drag.x && (_this.flag.canCloseOnClick = false);
22508 _this.ref.style.transform = "translateX(" + _this.drag.deltaX + "px)";
22509 _this.ref.style.opacity = 1 - Math.abs(_this.drag.deltaX / _this.drag.removalDistance);
22510 }
22511 };
22512
22513 _this.onDragEnd = function (e) {
22514 if (_this.flag.canDrag) {
22515 _this.flag.canDrag = false;
22516
22517 if (Math.abs(_this.drag.deltaX) > _this.drag.removalDistance) {
22518 _this.setState({
22519 preventExitTransition: true
22520 }, _this.props.closeToast);
22521
22522 return;
22523 }
22524
22525 _this.drag.y = getY(e);
22526 _this.ref.style.transition = 'transform 0.2s, opacity 0.2s';
22527 _this.ref.style.transform = 'translateX(0)';
22528 _this.ref.style.opacity = 1;
22529 }
22530 };
22531
22532 _this.onDragTransitionEnd = function () {
22533 var _this$ref$getBounding = _this.ref.getBoundingClientRect(),
22534 top = _this$ref$getBounding.top,
22535 bottom = _this$ref$getBounding.bottom,
22536 left = _this$ref$getBounding.left,
22537 right = _this$ref$getBounding.right;
22538
22539 if (_this.props.pauseOnHover && _this.drag.x >= left && _this.drag.x <= right && _this.drag.y >= top && _this.drag.y <= bottom) {
22540 _this.pauseToast();
22541 } else {
22542 _this.playToast();
22543 }
22544 };
22545
22546 return _this;
22547 }
22548
22549 var _proto = Toast.prototype;
22550
22551 _proto.componentDidMount = function componentDidMount() {
22552 this.props.onOpen(this.props.children.props);
22553
22554 if (this.props.draggable) {
22555 this.bindDragEvents();
22556 } // Maybe I could bind the event in the ToastContainer and rely on delegation
22557
22558
22559 if (this.props.pauseOnFocusLoss) {
22560 this.bindFocusEvents();
22561 }
22562 };
22563
22564 _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
22565 if (prevProps.draggable !== this.props.draggable) {
22566 if (this.props.draggable) {
22567 this.bindDragEvents();
22568 } else {
22569 this.unbindDragEvents();
22570 }
22571 }
22572
22573 if (prevProps.pauseOnFocusLoss !== this.props.pauseOnFocusLoss) {
22574 if (this.props.pauseOnFocusLoss) {
22575 this.bindFocusEvents();
22576 } else {
22577 this.unbindFocusEvents();
22578 }
22579 }
22580 };
22581
22582 _proto.componentWillUnmount = function componentWillUnmount() {
22583 this.props.onClose(this.props.children.props);
22584
22585 if (this.props.draggable) {
22586 this.unbindDragEvents();
22587 }
22588
22589 if (this.props.pauseOnFocusLoss) {
22590 this.unbindFocusEvents();
22591 }
22592 };
22593
22594 _proto.bindFocusEvents = function bindFocusEvents() {
22595 window.addEventListener('focus', this.playToast);
22596 window.addEventListener('blur', this.pauseToast);
22597 };
22598
22599 _proto.unbindFocusEvents = function unbindFocusEvents() {
22600 window.removeEventListener('focus', this.playToast);
22601 window.removeEventListener('blur', this.pauseToast);
22602 };
22603
22604 _proto.bindDragEvents = function bindDragEvents() {
22605 document.addEventListener('mousemove', this.onDragMove);
22606 document.addEventListener('mouseup', this.onDragEnd);
22607 document.addEventListener('touchmove', this.onDragMove);
22608 document.addEventListener('touchend', this.onDragEnd);
22609 };
22610
22611 _proto.unbindDragEvents = function unbindDragEvents() {
22612 document.removeEventListener('mousemove', this.onDragMove);
22613 document.removeEventListener('mouseup', this.onDragEnd);
22614 document.removeEventListener('touchmove', this.onDragMove);
22615 document.removeEventListener('touchend', this.onDragEnd);
22616 };
22617
22618 _proto.render = function render() {
22619 var _this2 = this;
22620
22621 var _this$props = this.props,
22622 closeButton = _this$props.closeButton,
22623 children = _this$props.children,
22624 autoClose = _this$props.autoClose,
22625 pauseOnHover = _this$props.pauseOnHover,
22626 closeOnClick = _this$props.closeOnClick,
22627 type = _this$props.type,
22628 hideProgressBar = _this$props.hideProgressBar,
22629 closeToast = _this$props.closeToast,
22630 Transition = _this$props.transition,
22631 position = _this$props.position,
22632 onExited = _this$props.onExited,
22633 className = _this$props.className,
22634 bodyClassName = _this$props.bodyClassName,
22635 progressClassName = _this$props.progressClassName,
22636 progressStyle = _this$props.progressStyle,
22637 updateId = _this$props.updateId,
22638 role = _this$props.role,
22639 progress = _this$props.progress,
22640 isProgressDone = _this$props.isProgressDone,
22641 rtl = _this$props.rtl;
22642 var toastProps = {
22643 className: (0, _classnames.default)('Toastify__toast', "Toastify__toast--" + type, {
22644 'Toastify__toast--rtl': rtl
22645 }, className)
22646 };
22647
22648 if (autoClose && pauseOnHover) {
22649 toastProps.onMouseEnter = this.pauseToast;
22650 toastProps.onMouseLeave = this.playToast;
22651 } // prevent toast from closing when user drags the toast
22652
22653
22654 if (closeOnClick) {
22655 toastProps.onClick = function () {
22656 return _this2.flag.canCloseOnClick && closeToast();
22657 };
22658 }
22659
22660 var controlledProgress = parseFloat(progress) === progress;
22661 return _react.default.createElement(Transition, {
22662 in: this.props.in,
22663 appear: true,
22664 unmountOnExit: true,
22665 onExited: onExited,
22666 position: position,
22667 preventExitTransition: this.state.preventExitTransition
22668 }, _react.default.createElement("div", _extends({}, toastProps, {
22669 ref: function ref(_ref) {
22670 return _this2.ref = _ref;
22671 },
22672 onMouseDown: this.onDragStart,
22673 onTouchStart: this.onDragStart,
22674 onTransitionEnd: this.onDragTransitionEnd
22675 }), _react.default.createElement("div", _extends({}, this.props.in && {
22676 role: role
22677 }, {
22678 className: (0, _classnames.default)('Toastify__toast-body', bodyClassName)
22679 }), children), closeButton && closeButton, (autoClose || controlledProgress) && _react.default.createElement(_ProgressBar.default, _extends({}, updateId && !controlledProgress ? {
22680 key: "pb-" + updateId
22681 } : {}, {
22682 rtl: rtl,
22683 delay: autoClose,
22684 isRunning: this.state.isRunning,
22685 closeToast: closeToast,
22686 hide: hideProgressBar,
22687 type: type,
22688 style: progressStyle,
22689 className: progressClassName,
22690 controlledProgress: controlledProgress,
22691 isProgressDone: isProgressDone,
22692 progress: progress
22693 }))));
22694 };
22695
22696 return Toast;
22697}(_react.Component);
22698
22699Toast.propTypes = {
22700 closeButton: propValidator.falseOrElement.isRequired,
22701 autoClose: propValidator.falseOrDelay.isRequired,
22702 children: _propTypes.default.node.isRequired,
22703 closeToast: _propTypes.default.func.isRequired,
22704 position: _propTypes.default.oneOf((0, propValidator.objectValues)(constant$2.POSITION)).isRequired,
22705 pauseOnHover: _propTypes.default.bool.isRequired,
22706 pauseOnFocusLoss: _propTypes.default.bool.isRequired,
22707 closeOnClick: _propTypes.default.bool.isRequired,
22708 transition: _propTypes.default.func.isRequired,
22709 rtl: _propTypes.default.bool.isRequired,
22710 hideProgressBar: _propTypes.default.bool.isRequired,
22711 draggable: _propTypes.default.bool.isRequired,
22712 draggablePercent: _propTypes.default.number.isRequired,
22713 in: _propTypes.default.bool,
22714 onExited: _propTypes.default.func,
22715 onOpen: _propTypes.default.func,
22716 onClose: _propTypes.default.func,
22717 type: _propTypes.default.oneOf((0, propValidator.objectValues)(constant$2.TYPE)),
22718 className: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]),
22719 bodyClassName: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]),
22720 progressClassName: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]),
22721 progressStyle: _propTypes.default.object,
22722 progress: _propTypes.default.number,
22723 isProgressDone: _propTypes.default.bool,
22724 updateId: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
22725 ariaLabel: _propTypes.default.string
22726};
22727Toast.defaultProps = {
22728 type: constant$2.TYPE.DEFAULT,
22729 in: true,
22730 onOpen: noop,
22731 onClose: noop,
22732 className: null,
22733 bodyClassName: null,
22734 progressClassName: null,
22735 updateId: null,
22736 role: 'alert'
22737};
22738var _default = Toast;
22739exports.default = _default;
22740});
22741
22742unwrapExports(Toast_1);
22743
22744var CloseButton_1 = createCommonjsModule(function (module, exports) {
22745
22746exports.__esModule = true;
22747exports.default = void 0;
22748
22749var _react = _interopRequireDefault(React__default);
22750
22751var _propTypes = _interopRequireDefault(PropTypes);
22752
22753function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22754
22755function CloseButton(_ref) {
22756 var closeToast = _ref.closeToast,
22757 type = _ref.type,
22758 ariaLabel = _ref.ariaLabel;
22759 return _react.default.createElement("button", {
22760 className: "Toastify__close-button Toastify__close-button--" + type,
22761 type: "button",
22762 onClick: closeToast,
22763 "aria-label": ariaLabel
22764 }, "\u2716");
22765}
22766
22767CloseButton.propTypes = {
22768 closeToast: _propTypes.default.func,
22769 arialLabel: _propTypes.default.string
22770};
22771CloseButton.defaultProps = {
22772 ariaLabel: 'close'
22773};
22774var _default = CloseButton;
22775exports.default = _default;
22776});
22777
22778unwrapExports(CloseButton_1);
22779
22780var cssTransition = createCommonjsModule(function (module, exports) {
22781
22782exports.__esModule = true;
22783exports.default = _default;
22784
22785var _react = _interopRequireDefault(React__default);
22786
22787var _Transition = _interopRequireDefault(Transition_1);
22788
22789function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22790
22791function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
22792
22793function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
22794
22795var noop = function noop() {};
22796
22797function _default(_ref) {
22798 var enter = _ref.enter,
22799 exit = _ref.exit,
22800 _ref$duration = _ref.duration,
22801 duration = _ref$duration === void 0 ? 750 : _ref$duration,
22802 _ref$appendPosition = _ref.appendPosition,
22803 appendPosition = _ref$appendPosition === void 0 ? false : _ref$appendPosition;
22804 return function Animation(_ref2) {
22805 var children = _ref2.children,
22806 position = _ref2.position,
22807 preventExitTransition = _ref2.preventExitTransition,
22808 props = _objectWithoutPropertiesLoose(_ref2, ["children", "position", "preventExitTransition"]);
22809
22810 var enterClassName = appendPosition ? enter + "--" + position : enter;
22811 var exitClassName = appendPosition ? exit + "--" + position : exit;
22812 var enterDuration, exitDuration;
22813
22814 if (Array.isArray(duration) && duration.length === 2) {
22815 enterDuration = duration[0];
22816 exitDuration = duration[1];
22817 } else {
22818 enterDuration = exitDuration = duration;
22819 }
22820
22821 var onEnter = function onEnter(node) {
22822 node.classList.add(enterClassName);
22823 node.style.animationFillMode = 'forwards';
22824 node.style.animationDuration = enterDuration * 0.001 + "s";
22825 };
22826
22827 var onEntered = function onEntered(node) {
22828 node.classList.remove(enterClassName);
22829 node.style.cssText = '';
22830 };
22831
22832 var onExit = function onExit(node) {
22833 node.classList.add(exitClassName);
22834 node.style.animationFillMode = 'forwards';
22835 node.style.animationDuration = exitDuration * 0.001 + "s";
22836 };
22837
22838 return _react.default.createElement(_Transition.default, _extends({}, props, {
22839 timeout: preventExitTransition ? 0 : {
22840 enter: enterDuration,
22841 exit: exitDuration
22842 },
22843 onEnter: onEnter,
22844 onEntered: onEntered,
22845 onExit: preventExitTransition ? noop : onExit
22846 }), children);
22847 };
22848}
22849});
22850
22851unwrapExports(cssTransition);
22852
22853var Transitions = createCommonjsModule(function (module, exports) {
22854
22855exports.__esModule = true;
22856exports.Flip = exports.Zoom = exports.Slide = exports.Bounce = void 0;
22857
22858var _cssTransition = _interopRequireDefault(cssTransition);
22859
22860function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22861
22862var Bounce = (0, _cssTransition.default)({
22863 enter: 'Toastify__bounce-enter',
22864 exit: 'Toastify__bounce-exit',
22865 appendPosition: true
22866});
22867exports.Bounce = Bounce;
22868var Slide = (0, _cssTransition.default)({
22869 enter: 'Toastify__slide-enter',
22870 exit: 'Toastify__slide-exit',
22871 duration: [450, 750],
22872 appendPosition: true
22873});
22874exports.Slide = Slide;
22875var Zoom = (0, _cssTransition.default)({
22876 enter: 'Toastify__zoom-enter',
22877 exit: 'Toastify__zoom-exit'
22878});
22879exports.Zoom = Zoom;
22880var Flip = (0, _cssTransition.default)({
22881 enter: 'Toastify__flip-enter',
22882 exit: 'Toastify__flip-exit'
22883});
22884exports.Flip = Flip;
22885});
22886
22887unwrapExports(Transitions);
22888var Transitions_1 = Transitions.Flip;
22889var Transitions_2 = Transitions.Zoom;
22890var Transitions_3 = Transitions.Slide;
22891var Transitions_4 = Transitions.Bounce;
22892
22893var eventManager_1 = createCommonjsModule(function (module, exports) {
22894
22895exports.__esModule = true;
22896exports.default = void 0;
22897var eventManager = {
22898 list: new Map(),
22899 on: function on(event, callback) {
22900 this.list.has(event) || this.list.set(event, []);
22901 this.list.get(event).push(callback);
22902 return this;
22903 },
22904 off: function off(event) {
22905 this.list.delete(event);
22906 return this;
22907 },
22908 emit: function emit(event) {
22909 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
22910 args[_key - 1] = arguments[_key];
22911 }
22912
22913 if (!this.list.has(event)) {
22914 return false;
22915 }
22916
22917 this.list.get(event).forEach(function (callback) {
22918 return setTimeout(function () {
22919 return callback.call.apply(callback, [null].concat(args));
22920 }, 0);
22921 });
22922 return true;
22923 }
22924};
22925var _default = eventManager;
22926exports.default = _default;
22927});
22928
22929unwrapExports(eventManager_1);
22930
22931var ToastContainer_1 = createCommonjsModule(function (module, exports) {
22932
22933exports.__esModule = true;
22934exports.default = void 0;
22935
22936var _react = _interopRequireWildcard(React__default);
22937
22938var _propTypes = _interopRequireDefault(PropTypes);
22939
22940var _classnames = _interopRequireDefault(classnames);
22941
22942var _TransitionGroup = _interopRequireDefault(TransitionGroup_1);
22943
22944var _Toast = _interopRequireDefault(Toast_1);
22945
22946var _CloseButton = _interopRequireDefault(CloseButton_1);
22947
22948
22949
22950
22951
22952var _eventManager = _interopRequireDefault(eventManager_1);
22953
22954
22955
22956function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22957
22958function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
22959
22960function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
22961
22962function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
22963
22964function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
22965
22966function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
22967
22968function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
22969
22970function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
22971
22972var ToastContainer =
22973/*#__PURE__*/
22974function (_Component) {
22975 _inheritsLoose(ToastContainer, _Component);
22976
22977 function ToastContainer() {
22978 var _this;
22979
22980 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
22981 args[_key] = arguments[_key];
22982 }
22983
22984 _this = _Component.call.apply(_Component, [this].concat(args)) || this;
22985 _this.state = {
22986 toast: []
22987 };
22988 _this.toastKey = 1;
22989 _this.collection = {};
22990
22991 _this.isToastActive = function (id) {
22992 return _this.state.toast.indexOf(id) !== -1;
22993 };
22994
22995 return _this;
22996 }
22997
22998 var _proto = ToastContainer.prototype;
22999
23000 _proto.componentDidMount = function componentDidMount() {
23001 var _this2 = this;
23002
23003 _eventManager.default.on(constant$2.ACTION.SHOW, function (content, options) {
23004 return _this2.show(content, options);
23005 }).on(constant$2.ACTION.CLEAR, function (id) {
23006 return !id ? _this2.clear() : _this2.removeToast(id);
23007 }).emit(constant$2.ACTION.DID_MOUNT, this);
23008 };
23009
23010 _proto.componentWillUnmount = function componentWillUnmount() {
23011 _eventManager.default.off(constant$2.ACTION.SHOW).off(constant$2.ACTION.CLEAR).emit(constant$2.ACTION.WILL_UNMOUNT);
23012 };
23013
23014 _proto.removeToast = function removeToast(id) {
23015 this.setState({
23016 toast: this.state.toast.filter(function (v) {
23017 return v !== id;
23018 })
23019 }, this.dispatchChange);
23020 };
23021
23022 _proto.dispatchChange = function dispatchChange() {
23023 _eventManager.default.emit(constant$2.ACTION.ON_CHANGE, this.state.toast.length);
23024 };
23025
23026 _proto.makeCloseButton = function makeCloseButton(toastClose, toastId, type) {
23027 var _this3 = this;
23028
23029 var closeButton = this.props.closeButton;
23030
23031 if ((0, _react.isValidElement)(toastClose) || toastClose === false) {
23032 closeButton = toastClose;
23033 }
23034
23035 return closeButton === false ? false : (0, _react.cloneElement)(closeButton, {
23036 closeToast: function closeToast() {
23037 return _this3.removeToast(toastId);
23038 },
23039 type: type
23040 });
23041 };
23042
23043 _proto.getAutoCloseDelay = function getAutoCloseDelay(toastAutoClose) {
23044 return toastAutoClose === false || (0, propValidator.isValidDelay)(toastAutoClose) ? toastAutoClose : this.props.autoClose;
23045 };
23046
23047 _proto.canBeRendered = function canBeRendered(content) {
23048 return (0, _react.isValidElement)(content) || typeof content === 'string' || typeof content === 'number' || typeof content === 'function';
23049 };
23050
23051 _proto.parseClassName = function parseClassName(prop) {
23052 if (typeof prop === 'string') {
23053 return prop;
23054 } else if (prop !== null && typeof prop === 'object' && 'toString' in prop) {
23055 return prop.toString();
23056 }
23057
23058 return null;
23059 };
23060
23061 _proto.show = function show(content, options) {
23062 var _this4 = this,
23063 _extends2;
23064
23065 if (!this.canBeRendered(content)) {
23066 throw new Error("The element you provided cannot be rendered. You provided an element of type " + typeof content);
23067 }
23068
23069 var toastId = options.toastId;
23070
23071 var closeToast = function closeToast() {
23072 return _this4.removeToast(toastId);
23073 };
23074
23075 var toastOptions = {
23076 id: toastId,
23077 // ⚠️ if no options.key, this.toastKey - 1 is assigned
23078 key: options.key || this.toastKey++,
23079 type: options.type,
23080 closeToast: closeToast,
23081 updateId: options.updateId,
23082 rtl: this.props.rtl,
23083 position: options.position || this.props.position,
23084 transition: options.transition || this.props.transition,
23085 className: this.parseClassName(options.className || this.props.toastClassName),
23086 bodyClassName: this.parseClassName(options.bodyClassName || this.props.bodyClassName),
23087 closeButton: this.makeCloseButton(options.closeButton, toastId, options.type),
23088 pauseOnHover: typeof options.pauseOnHover === 'boolean' ? options.pauseOnHover : this.props.pauseOnHover,
23089 pauseOnFocusLoss: typeof options.pauseOnFocusLoss === 'boolean' ? options.pauseOnFocusLoss : this.props.pauseOnFocusLoss,
23090 draggable: typeof options.draggable === 'boolean' ? options.draggable : this.props.draggable,
23091 draggablePercent: typeof options.draggablePercent === 'number' && !isNaN(options.draggablePercent) ? options.draggablePercent : this.props.draggablePercent,
23092 closeOnClick: typeof options.closeOnClick === 'boolean' ? options.closeOnClick : this.props.closeOnClick,
23093 progressClassName: this.parseClassName(options.progressClassName || this.props.progressClassName),
23094 progressStyle: this.props.progressStyle,
23095 autoClose: this.getAutoCloseDelay(options.autoClose),
23096 hideProgressBar: typeof options.hideProgressBar === 'boolean' ? options.hideProgressBar : this.props.hideProgressBar,
23097 progress: parseFloat(options.progress),
23098 isProgressDone: options.isProgressDone
23099 };
23100 typeof options.onOpen === 'function' && (toastOptions.onOpen = options.onOpen);
23101 typeof options.onClose === 'function' && (toastOptions.onClose = options.onClose); // add closeToast function to react component only
23102
23103 if ((0, _react.isValidElement)(content) && typeof content.type !== 'string' && typeof content.type !== 'number') {
23104 content = (0, _react.cloneElement)(content, {
23105 closeToast: closeToast
23106 });
23107 } else if (typeof content === 'function') {
23108 content = content({
23109 closeToast: closeToast
23110 });
23111 }
23112
23113 this.collection = _extends({}, this.collection, (_extends2 = {}, _extends2[toastId] = {
23114 position: toastOptions.position,
23115 options: toastOptions,
23116 content: content
23117 }, _extends2));
23118 this.setState({
23119 toast: (toastOptions.updateId ? _toConsumableArray(this.state.toast) : _toConsumableArray(this.state.toast).concat([toastId])).filter(function (id) {
23120 return id !== options.staleToastId;
23121 })
23122 }, this.dispatchChange);
23123 };
23124
23125 _proto.makeToast = function makeToast(content, options) {
23126 return _react.default.createElement(_Toast.default, _extends({}, options, {
23127 isDocumentHidden: this.state.isDocumentHidden,
23128 key: "toast-" + options.key
23129 }), content);
23130 };
23131
23132 _proto.clear = function clear() {
23133 this.setState({
23134 toast: []
23135 });
23136 };
23137
23138 _proto.renderToast = function renderToast() {
23139 var _this5 = this;
23140
23141 var toastToRender = {};
23142 var _this$props = this.props,
23143 className = _this$props.className,
23144 style = _this$props.style,
23145 newestOnTop = _this$props.newestOnTop;
23146 var collection = newestOnTop ? Object.keys(this.collection).reverse() : Object.keys(this.collection); // group toast by position
23147
23148 collection.forEach(function (toastId) {
23149 var _this5$collection$toa = _this5.collection[toastId],
23150 position = _this5$collection$toa.position,
23151 options = _this5$collection$toa.options,
23152 content = _this5$collection$toa.content;
23153 toastToRender[position] || (toastToRender[position] = []);
23154
23155 if (_this5.state.toast.indexOf(options.id) !== -1) {
23156 toastToRender[position].push(_this5.makeToast(content, options));
23157 } else {
23158 toastToRender[position].push(null);
23159 delete _this5.collection[toastId];
23160 }
23161 });
23162 return Object.keys(toastToRender).map(function (position) {
23163 var disablePointer = toastToRender[position].length === 1 && toastToRender[position][0] === null;
23164 var props = {
23165 className: (0, _classnames.default)('Toastify__toast-container', "Toastify__toast-container--" + position, {
23166 'Toastify__toast-container--rtl': _this5.props.rtl
23167 }, _this5.parseClassName(className)),
23168 style: disablePointer ? _extends({}, style, {
23169 pointerEvents: 'none'
23170 }) : _extends({}, style)
23171 };
23172 return _react.default.createElement(_TransitionGroup.default, _extends({}, props, {
23173 key: "container-" + position
23174 }), toastToRender[position]);
23175 });
23176 };
23177
23178 _proto.render = function render() {
23179 return _react.default.createElement("div", {
23180 className: "Toastify"
23181 }, this.renderToast());
23182 };
23183
23184 return ToastContainer;
23185}(_react.Component);
23186
23187ToastContainer.propTypes = {
23188 /**
23189 * Set toast position
23190 */
23191 position: _propTypes.default.oneOf((0, propValidator.objectValues)(constant$2.POSITION)),
23192
23193 /**
23194 * Disable or set autoClose delay
23195 */
23196 autoClose: propValidator.falseOrDelay,
23197
23198 /**
23199 * Disable or set a custom react element for the close button
23200 */
23201 closeButton: propValidator.falseOrElement,
23202
23203 /**
23204 * Hide or not progress bar when autoClose is enabled
23205 */
23206 hideProgressBar: _propTypes.default.bool,
23207
23208 /**
23209 * Pause toast duration on hover
23210 */
23211 pauseOnHover: _propTypes.default.bool,
23212
23213 /**
23214 * Dismiss toast on click
23215 */
23216 closeOnClick: _propTypes.default.bool,
23217
23218 /**
23219 * Newest on top
23220 */
23221 newestOnTop: _propTypes.default.bool,
23222
23223 /**
23224 * An optional className
23225 */
23226 className: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]),
23227
23228 /**
23229 * An optional style
23230 */
23231 style: _propTypes.default.object,
23232
23233 /**
23234 * An optional className for the toast
23235 */
23236 toastClassName: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]),
23237
23238 /**
23239 * An optional className for the toast body
23240 */
23241 bodyClassName: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]),
23242
23243 /**
23244 * An optional className for the toast progress bar
23245 */
23246 progressClassName: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]),
23247
23248 /**
23249 * An optional style for the toast progress bar
23250 */
23251 progressStyle: _propTypes.default.object,
23252
23253 /**
23254 * Define enter and exit transition using react-transition-group
23255 */
23256 transition: _propTypes.default.func,
23257
23258 /**
23259 * Support rtl display
23260 */
23261 rtl: _propTypes.default.bool,
23262
23263 /**
23264 * Allow toast to be draggable
23265 */
23266 draggable: _propTypes.default.bool,
23267
23268 /**
23269 * The percentage of the toast's width it takes for a drag to dismiss a toast
23270 */
23271 draggablePercent: _propTypes.default.number,
23272
23273 /**
23274 * Pause the toast on focus loss
23275 */
23276 pauseOnFocusLoss: _propTypes.default.bool
23277};
23278ToastContainer.defaultProps = {
23279 position: constant$2.POSITION.TOP_RIGHT,
23280 transition: Transitions.Bounce,
23281 rtl: false,
23282 autoClose: 5000,
23283 hideProgressBar: false,
23284 closeButton: _react.default.createElement(_CloseButton.default, null),
23285 pauseOnHover: true,
23286 pauseOnFocusLoss: true,
23287 closeOnClick: true,
23288 newestOnTop: false,
23289 draggable: true,
23290 draggablePercent: 80,
23291 className: null,
23292 style: null,
23293 toastClassName: null,
23294 bodyClassName: null,
23295 progressClassName: null,
23296 progressStyle: null
23297};
23298var _default = ToastContainer;
23299exports.default = _default;
23300});
23301
23302unwrapExports(ToastContainer_1);
23303
23304var toast_1 = createCommonjsModule(function (module, exports) {
23305
23306exports.__esModule = true;
23307exports.default = void 0;
23308
23309var _eventManager = _interopRequireDefault(eventManager_1);
23310
23311
23312
23313function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23314
23315function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
23316
23317var container = null;
23318var queue = [];
23319
23320var noop = function noop() {
23321 return false;
23322};
23323/**
23324 * Merge provided options with the defaults settings and generate the toastId
23325 */
23326
23327
23328function mergeOptions(options, type) {
23329 return _extends({}, options, {
23330 type: type,
23331 toastId: getToastId(options)
23332 });
23333}
23334/**
23335 * Generate a random toastId
23336 */
23337
23338
23339function generateToastId() {
23340 return (Math.random().toString(36) + Date.now().toString(36)).substr(2, 10);
23341}
23342/**
23343 * Generate the toastId either automatically or by provided toastId
23344 */
23345
23346
23347function getToastId(options) {
23348 if (options && (typeof options.toastId === 'string' || typeof options.toastId === 'number' && !isNaN(options.toastId))) {
23349 return options.toastId;
23350 }
23351
23352 return generateToastId();
23353}
23354/**
23355 * Dispatch toast. If the container is not mounted, the toast is enqueued
23356 */
23357
23358
23359function emitEvent(content, options) {
23360 if (container !== null) {
23361 _eventManager.default.emit(constant$2.ACTION.SHOW, content, options);
23362 } else {
23363 queue.push({
23364 action: constant$2.ACTION.SHOW,
23365 content: content,
23366 options: options
23367 });
23368 }
23369
23370 return options.toastId;
23371}
23372
23373var toast = _extends(function (content, options) {
23374 return emitEvent(content, mergeOptions(options, options && options.type || constant$2.TYPE.DEFAULT));
23375}, {
23376 success: function success(content, options) {
23377 return emitEvent(content, mergeOptions(options, constant$2.TYPE.SUCCESS));
23378 },
23379 info: function info(content, options) {
23380 return emitEvent(content, mergeOptions(options, constant$2.TYPE.INFO));
23381 },
23382 warn: function warn(content, options) {
23383 return emitEvent(content, mergeOptions(options, constant$2.TYPE.WARNING));
23384 },
23385 warning: function warning(content, options) {
23386 return emitEvent(content, mergeOptions(options, constant$2.TYPE.WARNING));
23387 },
23388 error: function error(content, options) {
23389 return emitEvent(content, mergeOptions(options, constant$2.TYPE.ERROR));
23390 },
23391 dismiss: function dismiss(id) {
23392 if (id === void 0) {
23393 id = null;
23394 }
23395
23396 return container && _eventManager.default.emit(constant$2.ACTION.CLEAR, id);
23397 },
23398 isActive: noop,
23399 update: function update(toastId, options) {
23400 setTimeout(function () {
23401 if (container && typeof container.collection[toastId] !== 'undefined') {
23402 var _container$collection = container.collection[toastId],
23403 oldOptions = _container$collection.options,
23404 oldContent = _container$collection.content;
23405
23406 var nextOptions = _extends({}, oldOptions, options, {
23407 toastId: options.toastId || toastId
23408 });
23409
23410 if (!options.toastId || options.toastId === toastId) {
23411 nextOptions.updateId = generateToastId();
23412 } else {
23413 nextOptions.staleToastId = toastId;
23414 }
23415
23416 var content = typeof nextOptions.render !== 'undefined' ? nextOptions.render : oldContent;
23417 delete nextOptions.render;
23418 emitEvent(content, nextOptions);
23419 }
23420 }, 0);
23421 },
23422 done: function done(id, progress) {
23423 if (progress === void 0) {
23424 progress = 1;
23425 }
23426
23427 toast.update(id, {
23428 progress: progress,
23429 isProgressDone: true
23430 });
23431 },
23432 onChange: function onChange(callback) {
23433 if (typeof callback === 'function') {
23434 _eventManager.default.on(constant$2.ACTION.ON_CHANGE, callback);
23435 }
23436 },
23437 POSITION: constant$2.POSITION,
23438 TYPE: constant$2.TYPE
23439});
23440/**
23441 * Wait until the ToastContainer is mounted to dispatch the toast
23442 * and attach isActive method
23443 */
23444
23445
23446_eventManager.default.on(constant$2.ACTION.DID_MOUNT, function (containerInstance) {
23447 container = containerInstance;
23448
23449 toast.isActive = function (id) {
23450 return container.isToastActive(id);
23451 };
23452
23453 queue.forEach(function (item) {
23454 _eventManager.default.emit(item.action, item.content, item.options);
23455 });
23456 queue = [];
23457}).on(constant$2.ACTION.WILL_UNMOUNT, function () {
23458 container = null;
23459 toast.isActive = noop;
23460});
23461
23462var _default = toast;
23463exports.default = _default;
23464});
23465
23466unwrapExports(toast_1);
23467
23468var lib = createCommonjsModule(function (module, exports) {
23469
23470exports.__esModule = true;
23471
23472var _ToastContainer = _interopRequireDefault(ToastContainer_1);
23473
23474exports.ToastContainer = _ToastContainer.default;
23475
23476
23477
23478exports.Bounce = Transitions.Bounce;
23479exports.Slide = Transitions.Slide;
23480exports.Zoom = Transitions.Zoom;
23481exports.Flip = Transitions.Flip;
23482
23483
23484
23485exports.ToastPosition = constant$2.POSITION;
23486exports.ToastType = constant$2.TYPE;
23487
23488var _toast = _interopRequireDefault(toast_1);
23489
23490exports.toast = _toast.default;
23491
23492var _cssTransition = _interopRequireDefault(cssTransition);
23493
23494exports.cssTransition = _cssTransition.default;
23495
23496function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23497});
23498
23499unwrapExports(lib);
23500var lib_1 = lib.ToastContainer;
23501var lib_2 = lib.Bounce;
23502var lib_3 = lib.Slide;
23503var lib_4 = lib.Zoom;
23504var lib_5 = lib.Flip;
23505var lib_6 = lib.ToastPosition;
23506var lib_7 = lib.ToastType;
23507var lib_8 = lib.toast;
23508var lib_9 = lib.cssTransition;
23509
23510function _templateObject$Y() {
23511 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\n\twidth: 60px;\n\theight: 60px;\n\talign-items: center;\n\tjustify-content: center;\n\tpadding: 0;\n\n\tbackground: ", ";\n"]);
23512
23513 _templateObject$Y = function _templateObject() {
23514 return data;
23515 };
23516
23517 return data;
23518}
23519var ToastIconWrapper = styled__default.div(_templateObject$Y(), function (_ref) {
23520 var bgColor = _ref.bgColor;
23521 return bgColor;
23522});
23523ToastIconWrapper.displayName = 'ToastIconWrapper';
23524
23525var ToastIcon = function ToastIcon(_ref2) {
23526 var bgColor = _ref2.bgColor,
23527 icon = _ref2.icon,
23528 size = _ref2.size,
23529 color = _ref2.color,
23530 props = objectWithoutPropertiesLoose(_ref2, ["bgColor", "icon", "size", "color"]);
23531
23532 return React__default.createElement(ToastIconWrapper, _extends_1({
23533 bgColor: bgColor
23534 }, props), React__default.createElement(Icon, {
23535 icon: icon,
23536 size: size,
23537 color: color
23538 }));
23539};
23540
23541ToastIcon.defaultProps = {
23542 bgColor: theme.toast.successColor,
23543 size: 'big',
23544 color: 'white'
23545};
23546ToastIcon.propTypes = {
23547 bgColor: PropTypes.string,
23548 icon: PropTypes.oneOf(IconName).isRequired,
23549 size: PropTypes.string,
23550 color: PropTypes.string
23551};
23552ToastIcon.displayName = 'ToastIcon';
23553
23554function _templateObject2$o() {
23555 var data = taggedTemplateLiteralLoose(["\n\tpadding-left: 16px;\n\n\tcolor: ", ";\n\tfont-size: 13px;\n"]);
23556
23557 _templateObject2$o = function _templateObject2() {
23558 return data;
23559 };
23560
23561 return data;
23562}
23563
23564function _templateObject$Z() {
23565 var data = taggedTemplateLiteralLoose(["\n\tpadding: 8px 16px;\n\n\tcolor: ", ";\n\tfont-size: 15px;\n\tfont-weight: bold;\n"]);
23566
23567 _templateObject$Z = function _templateObject() {
23568 return data;
23569 };
23570
23571 return data;
23572}
23573var ToastTitle = styled__default.div(_templateObject$Z(), function (_ref) {
23574 var theme = _ref.theme;
23575 return theme.toast.titleColor;
23576});
23577var ToastMessage = styled__default.div(_templateObject2$o(), function (_ref2) {
23578 var theme = _ref2.theme;
23579 return theme.toast.messageColor;
23580});
23581
23582var ToastBody = function ToastBody(_ref3) {
23583 var title = _ref3.title,
23584 message = _ref3.message;
23585 return React__default.createElement("div", null, React__default.createElement(ToastTitle, null, title), React__default.createElement(ToastMessage, null, message));
23586};
23587
23588ToastBody.defaultProps = {
23589 title: ''
23590};
23591ToastBody.propTypes = {
23592 /** Text that will show on top in the body */
23593 title: PropTypes.string,
23594
23595 /** Text that will show on bottom in the body, bellow title if exists */
23596 message: PropTypes.string.isRequired
23597};
23598ToastBody.displayName = 'ToastBody';
23599
23600function _templateObject$_() {
23601 var data = taggedTemplateLiteralLoose(["\n\t.Toastify__toast {\n\t\tmin-height: 0;\n\t\tpadding: 0;\n\t}\n\n\t.Toastify__toast-body {\n\t\tdisplay: flex;\n\t\tmargin: 0;\n\t}\n\n\t.Toastify__close-button.Toastify__close-button--default .qube {\n\t\twidth: 300px !important;\n\t\theight: 60px !important;\n\n\t\tbackground: transparent;\n\t\tborder-radius: 4px;\n\n\t\tbox-shadow: 0 0 3px rgba(0, 0, 0, 0.25);\n\t}\n"]);
23602
23603 _templateObject$_ = function _templateObject() {
23604 return data;
23605 };
23606
23607 return data;
23608}
23609var ToastWrapper = styled__default(lib_1)(_templateObject$_());
23610ToastWrapper.defaultProps = {
23611 suppressClassNameWarning: true
23612};
23613ToastWrapper.displayName = 'ToastWrapper';
23614
23615var Toast$1 = function Toast(_ref) {
23616 var bgColor = _ref.bgColor,
23617 icon = _ref.icon,
23618 title = _ref.title,
23619 message = _ref.message,
23620 size = _ref.size,
23621 color = _ref.color;
23622 return React__default.createElement(React.Fragment, null, React__default.createElement(ToastIcon, {
23623 bgColor: bgColor,
23624 icon: icon,
23625 size: size,
23626 color: color
23627 }), React__default.createElement(ToastBody, {
23628 title: title,
23629 message: message
23630 }));
23631};
23632
23633Toast$1.defaultProps = {
23634 bgColor: theme.toast.successColor,
23635 size: 'big',
23636 title: '',
23637 color: 'white'
23638};
23639Toast$1.propTypes = {
23640 bgColor: PropTypes.string,
23641 icon: PropTypes.oneOf(IconName).isRequired,
23642 title: PropTypes.string,
23643 message: PropTypes.string.isRequired,
23644 size: PropTypes.string,
23645 color: PropTypes.string
23646};
23647Toast$1.displayName = 'Toast';
23648
23649var notify = function notify(bgColor, icon, title, message, size, color, options) {
23650 lib_8(React__default.createElement(Toast$1, {
23651 bgColor: bgColor,
23652 icon: icon,
23653 title: title,
23654 message: message,
23655 size: size,
23656 color: color
23657 }), _extends_1({}, options));
23658};
23659
23660var notifyError = function notifyError(title, message, options) {
23661 lib_8(React__default.createElement(Toast$1, {
23662 bgColor: theme.toast.errorColor,
23663 icon: "error",
23664 title: title,
23665 message: message,
23666 size: "big",
23667 color: "white"
23668 }), _extends_1({
23669 hideProgressBar: true,
23670 closeButton: false,
23671 autoClose: 5000,
23672 pauseOnFocusLoss: false,
23673 position: 'bottom-right'
23674 }, options));
23675};
23676
23677var notifySuccess = function notifySuccess(title, message, options) {
23678 lib_8(React__default.createElement(Toast$1, {
23679 bgColor: theme.toast.successColor,
23680 icon: "success",
23681 title: title,
23682 message: message,
23683 size: "big",
23684 color: "white"
23685 }), _extends_1({
23686 hideProgressBar: true,
23687 closeButton: false,
23688 autoClose: 5000,
23689 pauseOnFocusLoss: false,
23690 position: 'bottom-right'
23691 }, options));
23692};
23693
23694var notifyWarning = function notifyWarning(title, message, options) {
23695 lib_8(React__default.createElement(Toast$1, {
23696 bgColor: theme.toast.warningColor,
23697 icon: "warning",
23698 title: title,
23699 message: message,
23700 size: "big",
23701 color: "white"
23702 }), _extends_1({
23703 hideProgressBar: true,
23704 closeButton: false,
23705 autoClose: 5000,
23706 pauseOnFocusLoss: false,
23707 position: 'bottom-right'
23708 }, options));
23709};
23710
23711function _templateObject$10() {
23712 var data = taggedTemplateLiteralLoose(["\n\tdisplay: block;\n\twidth: ", ";\n\theight: ", ";\n\tmargin: 0 auto;\n"]);
23713
23714 _templateObject$10 = function _templateObject() {
23715 return data;
23716 };
23717
23718 return data;
23719}
23720var CenteredGridStyled = styled__default.div(_templateObject$10(), function (_ref) {
23721 var width = _ref.width;
23722 return width.toString().indexOf('%') !== -1 ? width : width + "px";
23723}, function (_ref2) {
23724 var height = _ref2.height;
23725 return height.toString().indexOf('%') !== -1 ? height : height + "px";
23726});
23727/**
23728 * @param children
23729 * @param props height and width
23730 */
23731
23732var CenteredGrid = function CenteredGrid(_ref3) {
23733 var children = _ref3.children,
23734 props = objectWithoutPropertiesLoose(_ref3, ["children"]);
23735
23736 return React__default.createElement(CenteredGridStyled, props, React__default.createElement(semanticUiReact.Grid, {
23737 verticalAlign: "middle",
23738 style: {
23739 height: '100%'
23740 }
23741 }, React__default.createElement(semanticUiReact.Grid.Row, null, React__default.createElement(semanticUiReact.Grid.Column, null, children))));
23742};
23743
23744CenteredGrid.defaultProps = {
23745 width: '100%',
23746 height: '100%'
23747};
23748CenteredGrid.propTypes = {
23749 /** children nodes */
23750 children: PropTypes.node.isRequired,
23751
23752 /** width in pixels or percentage ('100' - pixels; '100%' - percentage) */
23753 width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
23754
23755 /** height in pixels or percentage ('100' - pixels; '100%' - percentage) */
23756 height: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
23757};
23758
23759function _templateObject$11() {
23760 var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tdisplay: block;\n\twidth: 100%;\n\tbox-sizing: border-box;\n\tpadding: 20px;\n\tmargin-bottom: 17px;\n\tborder: thin solid ", ";\n\tborder-radius: 4px;\n"]);
23761
23762 _templateObject$11 = function _templateObject() {
23763 return data;
23764 };
23765
23766 return data;
23767}
23768var Section = styled__default.div(_templateObject$11(), theme.colors.strokeGray);
23769Section.displayName = 'Section';
23770
23771function _templateObject2$p() {
23772 var data = taggedTemplateLiteralLoose(["\n\tcolor: ", " !important;\n\tcursor: ", ";\n\tuser-select: ", ";\n\n\t:hover {\n\t\ttext-decoration: ", ";\n\t}\n"]);
23773
23774 _templateObject2$p = function _templateObject2() {
23775 return data;
23776 };
23777
23778 return data;
23779}
23780
23781function _templateObject$12() {
23782 var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline;\n\n\t:after {\n\t\tcontent: ' > ';\n\t}\n"]);
23783
23784 _templateObject$12 = function _templateObject() {
23785 return data;
23786 };
23787
23788 return data;
23789}
23790
23791var Crumb = function Crumb(_ref) {
23792 var crumbIndex = _ref.crumbIndex,
23793 crumbs = _ref.crumbs,
23794 _onClick = _ref.onClick,
23795 children = _ref.children,
23796 props = objectWithoutPropertiesLoose(_ref, ["crumbIndex", "crumbs", "onClick", "children"]);
23797
23798 var newPath = [''].concat(crumbs.slice(0, crumbIndex + 1)).join('/');
23799 return React__default.createElement(StyledCrumb, {
23800 key: newPath
23801 }, React__default.createElement(StyledCrumbSpan, _extends_1({
23802 index: crumbIndex,
23803 onClick: function onClick() {
23804 return crumbIndex !== 0 && _onClick(newPath);
23805 }
23806 }, props), children));
23807};
23808
23809Crumb.displayName = 'Crumb';
23810Crumb.propTypes = {
23811 /** specific location of the breadcrumb in the crumbs array */
23812 crumbIndex: PropTypes.number.isRequired,
23813
23814 /** Array of crumb keys to be translated */
23815 crumbs: PropTypes.arrayOf(PropTypes.string.isRequired).isRequired,
23816
23817 /** onClick crumb handler */
23818 onClick: PropTypes.func.isRequired,
23819
23820 /** children nodes */
23821 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
23822};
23823var StyledCrumb = styled__default.span(_templateObject$12());
23824StyledCrumb.displayName = 'StyledCrumb';
23825var StyledCrumbSpan = styled__default.a(_templateObject2$p(), function (_ref2) {
23826 var theme = _ref2.theme;
23827 return theme.colors.gray;
23828}, function (_ref3) {
23829 var index = _ref3.index;
23830 return index !== 0 && 'pointer';
23831}, function (_ref4) {
23832 var index = _ref4.index;
23833 return index === 0 && 'none';
23834}, function (_ref5) {
23835 var index = _ref5.index;
23836 return index !== 0 && 'underline';
23837});
23838StyledCrumbSpan.displayName = 'StyledCrumbSpan';
23839
23840function _templateObject2$q() {
23841 var data = taggedTemplateLiteralLoose(["\n\tuser-select: none;\n"]);
23842
23843 _templateObject2$q = function _templateObject2() {
23844 return data;
23845 };
23846
23847 return data;
23848}
23849
23850function _templateObject$13() {
23851 var data = taggedTemplateLiteralLoose(["\n\tcolor: ", " !important;\n\tfont-size: 11px;\n"]);
23852
23853 _templateObject$13 = function _templateObject() {
23854 return data;
23855 };
23856
23857 return data;
23858}
23859
23860var isNotNumber = function isNotNumber(segment) {
23861 return Number.isNaN(Number(segment));
23862};
23863
23864var BreadCrumbs = function BreadCrumbs(_ref) {
23865 var path = _ref.path,
23866 finalItem = _ref.finalItem,
23867 onClick = _ref.onClick,
23868 translationFunction = _ref.translationFunction,
23869 props = objectWithoutPropertiesLoose(_ref, ["path", "finalItem", "onClick", "translationFunction"]);
23870
23871 var items = path.split('/').filter(function (item) {
23872 return item;
23873 });
23874 var lastItem = items.length > 1 ? items[items.length - 1] : null;
23875 items = items.slice(0, items.length - 1);
23876 return React__default.createElement(Text, _extends_1({}, props, {
23877 color: theme.colors.gray,
23878 size: "sm"
23879 }), items.filter(isNotNumber).map(function (crumb, index$$1) {
23880 return React__default.createElement(Crumb, _extends_1({
23881 key: crumb,
23882 crumbIndex: index$$1,
23883 crumbs: items,
23884 onClick: onClick
23885 }, props), translationFunction(crumb));
23886 }), lastItem && React__default.createElement(NoUserSelect, null, finalItem || translationFunction(lastItem)));
23887};
23888
23889BreadCrumbs.defaultProps = {
23890 finalItem: ''
23891};
23892BreadCrumbs.displayName = 'BreadCrumbs';
23893BreadCrumbs.propTypes = {
23894 /** Path of the page: with react router -> props.location.pathname */
23895 path: PropTypes.string.isRequired,
23896
23897 /** Custom Name for the last crumb name */
23898 finalItem: PropTypes.string,
23899
23900 /** Action for the crumb click */
23901 onClick: PropTypes.func.isRequired,
23902
23903 /** translation function applied to reach crumb item */
23904 translationFunction: PropTypes.func.isRequired
23905};
23906var BreadCrumbsStyled = styled__default.p(_templateObject$13(), function (_ref2) {
23907 var theme$$1 = _ref2.theme;
23908 return theme$$1.colors.gray;
23909});
23910BreadCrumbsStyled.displayName = 'BreadCrumbsStyled';
23911var NoUserSelect = styled__default.span(_templateObject2$q());
23912
23913var lottie = createCommonjsModule(function (module) {
23914(typeof navigator !== "undefined") && (function(root, factory) {
23915 if (module.exports) {
23916 module.exports = factory(root);
23917 } else {
23918 root.lottie = factory(root);
23919 root.bodymovin = root.lottie;
23920 }
23921}((window || {}), function(window) {
23922 var svgNS = "http://www.w3.org/2000/svg";
23923
23924var locationHref = '';
23925
23926var initialDefaultFrame = -999999;
23927
23928var subframeEnabled = true;
23929var expressionsPlugin;
23930var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
23931var bm_pow = Math.pow;
23932var bm_sqrt = Math.sqrt;
23933var bm_floor = Math.floor;
23934var bm_max = Math.max;
23935var bm_min = Math.min;
23936
23937var BMMath = {};
23938(function(){
23939 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"];
23940 var i, len = propertyNames.length;
23941 for(i=0;i<len;i+=1){
23942 BMMath[propertyNames[i]] = Math[propertyNames[i]];
23943 }
23944}());
23945
23946function ProjectInterface(){return {};}
23947
23948BMMath.random = Math.random;
23949BMMath.abs = function(val){
23950 var tOfVal = typeof val;
23951 if(tOfVal === 'object' && val.length){
23952 var absArr = createSizedArray(val.length);
23953 var i, len = val.length;
23954 for(i=0;i<len;i+=1){
23955 absArr[i] = Math.abs(val[i]);
23956 }
23957 return absArr;
23958 }
23959 return Math.abs(val);
23960
23961};
23962var defaultCurveSegments = 150;
23963var degToRads = Math.PI/180;
23964var roundCorner = 0.5519;
23965
23966function styleDiv(element){
23967 element.style.position = 'absolute';
23968 element.style.top = 0;
23969 element.style.left = 0;
23970 element.style.display = 'block';
23971 element.style.transformOrigin = element.style.webkitTransformOrigin = '0 0';
23972 element.style.backfaceVisibility = element.style.webkitBackfaceVisibility = 'visible';
23973 element.style.transformStyle = element.style.webkitTransformStyle = element.style.mozTransformStyle = "preserve-3d";
23974}
23975
23976function BMEnterFrameEvent(n,c,t,d){
23977 this.type = n;
23978 this.currentTime = c;
23979 this.totalTime = t;
23980 this.direction = d < 0 ? -1:1;
23981}
23982
23983function BMCompleteEvent(n,d){
23984 this.type = n;
23985 this.direction = d < 0 ? -1:1;
23986}
23987
23988function BMCompleteLoopEvent(n,c,t,d){
23989 this.type = n;
23990 this.currentLoop = t;
23991 this.totalLoops = c;
23992 this.direction = d < 0 ? -1:1;
23993}
23994
23995function BMSegmentStartEvent(n,f,t){
23996 this.type = n;
23997 this.firstFrame = f;
23998 this.totalFrames = t;
23999}
24000
24001function BMDestroyEvent(n,t){
24002 this.type = n;
24003 this.target = t;
24004}
24005
24006var createElementID = (function(){
24007 var _count = 0;
24008 return function createID() {
24009 return '__lottie_element_' + ++_count
24010 }
24011}());
24012
24013function HSVtoRGB(h, s, v) {
24014 var r, g, b, i, f, p, q, t;
24015 i = Math.floor(h * 6);
24016 f = h * 6 - i;
24017 p = v * (1 - s);
24018 q = v * (1 - f * s);
24019 t = v * (1 - (1 - f) * s);
24020 switch (i % 6) {
24021 case 0: r = v; g = t; b = p; break;
24022 case 1: r = q; g = v; b = p; break;
24023 case 2: r = p; g = v; b = t; break;
24024 case 3: r = p; g = q; b = v; break;
24025 case 4: r = t; g = p; b = v; break;
24026 case 5: r = v; g = p; b = q; break;
24027 }
24028 return [ r,
24029 g,
24030 b ];
24031}
24032
24033function RGBtoHSV(r, g, b) {
24034 var max = Math.max(r, g, b), min = Math.min(r, g, b),
24035 d = max - min,
24036 h,
24037 s = (max === 0 ? 0 : d / max),
24038 v = max / 255;
24039
24040 switch (max) {
24041 case min: h = 0; break;
24042 case r: h = (g - b) + d * (g < b ? 6: 0); h /= 6 * d; break;
24043 case g: h = (b - r) + d * 2; h /= 6 * d; break;
24044 case b: h = (r - g) + d * 4; h /= 6 * d; break;
24045 }
24046
24047 return [
24048 h,
24049 s,
24050 v
24051 ];
24052}
24053
24054function addSaturationToRGB(color,offset){
24055 var hsv = RGBtoHSV(color[0]*255,color[1]*255,color[2]*255);
24056 hsv[1] += offset;
24057 if (hsv[1] > 1) {
24058 hsv[1] = 1;
24059 }
24060 else if (hsv[1] <= 0) {
24061 hsv[1] = 0;
24062 }
24063 return HSVtoRGB(hsv[0],hsv[1],hsv[2]);
24064}
24065
24066function addBrightnessToRGB(color,offset){
24067 var hsv = RGBtoHSV(color[0]*255,color[1]*255,color[2]*255);
24068 hsv[2] += offset;
24069 if (hsv[2] > 1) {
24070 hsv[2] = 1;
24071 }
24072 else if (hsv[2] < 0) {
24073 hsv[2] = 0;
24074 }
24075 return HSVtoRGB(hsv[0],hsv[1],hsv[2]);
24076}
24077
24078function addHueToRGB(color,offset) {
24079 var hsv = RGBtoHSV(color[0]*255,color[1]*255,color[2]*255);
24080 hsv[0] += offset/360;
24081 if (hsv[0] > 1) {
24082 hsv[0] -= 1;
24083 }
24084 else if (hsv[0] < 0) {
24085 hsv[0] += 1;
24086 }
24087 return HSVtoRGB(hsv[0],hsv[1],hsv[2]);
24088}
24089
24090var rgbToHex = (function(){
24091 var colorMap = [];
24092 var i;
24093 var hex;
24094 for(i=0;i<256;i+=1){
24095 hex = i.toString(16);
24096 colorMap[i] = hex.length == 1 ? '0' + hex : hex;
24097 }
24098
24099 return function(r, g, b) {
24100 if(r<0){
24101 r = 0;
24102 }
24103 if(g<0){
24104 g = 0;
24105 }
24106 if(b<0){
24107 b = 0;
24108 }
24109 return '#' + colorMap[r] + colorMap[g] + colorMap[b];
24110 };
24111}());
24112function BaseEvent(){}
24113BaseEvent.prototype = {
24114 triggerEvent: function (eventName, args) {
24115 if (this._cbs[eventName]) {
24116 var len = this._cbs[eventName].length;
24117 for (var i = 0; i < len; i++){
24118 this._cbs[eventName][i](args);
24119 }
24120 }
24121 },
24122 addEventListener: function (eventName, callback) {
24123 if (!this._cbs[eventName]){
24124 this._cbs[eventName] = [];
24125 }
24126 this._cbs[eventName].push(callback);
24127
24128 return function() {
24129 this.removeEventListener(eventName, callback);
24130 }.bind(this);
24131 },
24132 removeEventListener: function (eventName,callback){
24133 if (!callback){
24134 this._cbs[eventName] = null;
24135 }else if(this._cbs[eventName]){
24136 var i = 0, len = this._cbs[eventName].length;
24137 while(i<len){
24138 if(this._cbs[eventName][i] === callback){
24139 this._cbs[eventName].splice(i,1);
24140 i -=1;
24141 len -= 1;
24142 }
24143 i += 1;
24144 }
24145 if(!this._cbs[eventName].length){
24146 this._cbs[eventName] = null;
24147 }
24148 }
24149 }
24150};
24151var createTypedArray = (function(){
24152 function createRegularArray(type, len){
24153 var i = 0, arr = [], value;
24154 switch(type) {
24155 case 'int16':
24156 case 'uint8c':
24157 value = 1;
24158 break;
24159 default:
24160 value = 1.1;
24161 break;
24162 }
24163 for(i = 0; i < len; i += 1) {
24164 arr.push(value);
24165 }
24166 return arr;
24167 }
24168 function createTypedArray(type, len){
24169 if(type === 'float32') {
24170 return new Float32Array(len);
24171 } else if(type === 'int16') {
24172 return new Int16Array(len);
24173 } else if(type === 'uint8c') {
24174 return new Uint8ClampedArray(len);
24175 }
24176 }
24177 if(typeof Uint8ClampedArray === 'function' && typeof Float32Array === 'function') {
24178 return createTypedArray;
24179 } else {
24180 return createRegularArray;
24181 }
24182}());
24183
24184function createSizedArray(len) {
24185 return Array.apply(null,{length:len});
24186}
24187function createNS(type) {
24188 //return {appendChild:function(){},setAttribute:function(){},style:{}}
24189 return document.createElementNS(svgNS, type);
24190}
24191function createTag(type) {
24192 //return {appendChild:function(){},setAttribute:function(){},style:{}}
24193 return document.createElement(type);
24194}
24195function DynamicPropertyContainer(){}DynamicPropertyContainer.prototype = {
24196 addDynamicProperty: function(prop) {
24197 if(this.dynamicProperties.indexOf(prop) === -1) {
24198 this.dynamicProperties.push(prop);
24199 this.container.addDynamicProperty(this);
24200 this._isAnimated = true;
24201 }
24202 },
24203 iterateDynamicProperties: function(){
24204 this._mdf = false;
24205 var i, len = this.dynamicProperties.length;
24206 for(i=0;i<len;i+=1){
24207 this.dynamicProperties[i].getValue();
24208 if(this.dynamicProperties[i]._mdf) {
24209 this._mdf = true;
24210 }
24211 }
24212 },
24213 initDynamicPropertyContainer: function(container){
24214 this.container = container;
24215 this.dynamicProperties = [];
24216 this._mdf = false;
24217 this._isAnimated = false;
24218 }
24219};
24220var getBlendMode = (function() {
24221
24222 var blendModeEnums = {
24223 0:'source-over',
24224 1:'multiply',
24225 2:'screen',
24226 3:'overlay',
24227 4:'darken',
24228 5:'lighten',
24229 6:'color-dodge',
24230 7:'color-burn',
24231 8:'hard-light',
24232 9:'soft-light',
24233 10:'difference',
24234 11:'exclusion',
24235 12:'hue',
24236 13:'saturation',
24237 14:'color',
24238 15:'luminosity'
24239 };
24240
24241 return function(mode) {
24242 return blendModeEnums[mode] || '';
24243 }
24244}());
24245/*!
24246 Transformation Matrix v2.0
24247 (c) Epistemex 2014-2015
24248 www.epistemex.com
24249 By Ken Fyrstenberg
24250 Contributions by leeoniya.
24251 License: MIT, header required.
24252 */
24253
24254/**
24255 * 2D transformation matrix object initialized with identity matrix.
24256 *
24257 * The matrix can synchronize a canvas context by supplying the context
24258 * as an argument, or later apply current absolute transform to an
24259 * existing context.
24260 *
24261 * All values are handled as floating point values.
24262 *
24263 * @param {CanvasRenderingContext2D} [context] - Optional context to sync with Matrix
24264 * @prop {number} a - scale x
24265 * @prop {number} b - shear y
24266 * @prop {number} c - shear x
24267 * @prop {number} d - scale y
24268 * @prop {number} e - translate x
24269 * @prop {number} f - translate y
24270 * @prop {CanvasRenderingContext2D|null} [context=null] - set or get current canvas context
24271 * @constructor
24272 */
24273
24274var Matrix = (function(){
24275
24276 var _cos = Math.cos;
24277 var _sin = Math.sin;
24278 var _tan = Math.tan;
24279 var _rnd = Math.round;
24280
24281 function reset(){
24282 this.props[0] = 1;
24283 this.props[1] = 0;
24284 this.props[2] = 0;
24285 this.props[3] = 0;
24286 this.props[4] = 0;
24287 this.props[5] = 1;
24288 this.props[6] = 0;
24289 this.props[7] = 0;
24290 this.props[8] = 0;
24291 this.props[9] = 0;
24292 this.props[10] = 1;
24293 this.props[11] = 0;
24294 this.props[12] = 0;
24295 this.props[13] = 0;
24296 this.props[14] = 0;
24297 this.props[15] = 1;
24298 return this;
24299 }
24300
24301 function rotate(angle) {
24302 if(angle === 0){
24303 return this;
24304 }
24305 var mCos = _cos(angle);
24306 var mSin = _sin(angle);
24307 return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
24308 }
24309
24310 function rotateX(angle){
24311 if(angle === 0){
24312 return this;
24313 }
24314 var mCos = _cos(angle);
24315 var mSin = _sin(angle);
24316 return this._t(1, 0, 0, 0, 0, mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1);
24317 }
24318
24319 function rotateY(angle){
24320 if(angle === 0){
24321 return this;
24322 }
24323 var mCos = _cos(angle);
24324 var mSin = _sin(angle);
24325 return this._t(mCos, 0, mSin, 0, 0, 1, 0, 0, -mSin, 0, mCos, 0, 0, 0, 0, 1);
24326 }
24327
24328 function rotateZ(angle){
24329 if(angle === 0){
24330 return this;
24331 }
24332 var mCos = _cos(angle);
24333 var mSin = _sin(angle);
24334 return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
24335 }
24336
24337 function shear(sx,sy){
24338 return this._t(1, sy, sx, 1, 0, 0);
24339 }
24340
24341 function skew(ax, ay){
24342 return this.shear(_tan(ax), _tan(ay));
24343 }
24344
24345 function skewFromAxis(ax, angle){
24346 var mCos = _cos(angle);
24347 var mSin = _sin(angle);
24348 return this._t(mCos, mSin, 0, 0, -mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
24349 ._t(1, 0, 0, 0, _tan(ax), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
24350 ._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
24351 //return this._t(mCos, mSin, -mSin, mCos, 0, 0)._t(1, 0, _tan(ax), 1, 0, 0)._t(mCos, -mSin, mSin, mCos, 0, 0);
24352 }
24353
24354 function scale(sx, sy, sz) {
24355 if(!sz && sz !== 0) {
24356 sz = 1;
24357 }
24358 if(sx === 1 && sy === 1 && sz === 1){
24359 return this;
24360 }
24361 return this._t(sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0, 0, 0, 0, 1);
24362 }
24363
24364 function setTransform(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {
24365 this.props[0] = a;
24366 this.props[1] = b;
24367 this.props[2] = c;
24368 this.props[3] = d;
24369 this.props[4] = e;
24370 this.props[5] = f;
24371 this.props[6] = g;
24372 this.props[7] = h;
24373 this.props[8] = i;
24374 this.props[9] = j;
24375 this.props[10] = k;
24376 this.props[11] = l;
24377 this.props[12] = m;
24378 this.props[13] = n;
24379 this.props[14] = o;
24380 this.props[15] = p;
24381 return this;
24382 }
24383
24384 function translate(tx, ty, tz) {
24385 tz = tz || 0;
24386 if(tx !== 0 || ty !== 0 || tz !== 0){
24387 return this._t(1,0,0,0,0,1,0,0,0,0,1,0,tx,ty,tz,1);
24388 }
24389 return this;
24390 }
24391
24392 function transform(a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2, l2, m2, n2, o2, p2) {
24393
24394 var _p = this.props;
24395
24396 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){
24397 //NOTE: commenting this condition because TurboFan deoptimizes code when present
24398 //if(m2 !== 0 || n2 !== 0 || o2 !== 0){
24399 _p[12] = _p[12] * a2 + _p[15] * m2;
24400 _p[13] = _p[13] * f2 + _p[15] * n2;
24401 _p[14] = _p[14] * k2 + _p[15] * o2;
24402 _p[15] = _p[15] * p2;
24403 //}
24404 this._identityCalculated = false;
24405 return this;
24406 }
24407
24408 var a1 = _p[0];
24409 var b1 = _p[1];
24410 var c1 = _p[2];
24411 var d1 = _p[3];
24412 var e1 = _p[4];
24413 var f1 = _p[5];
24414 var g1 = _p[6];
24415 var h1 = _p[7];
24416 var i1 = _p[8];
24417 var j1 = _p[9];
24418 var k1 = _p[10];
24419 var l1 = _p[11];
24420 var m1 = _p[12];
24421 var n1 = _p[13];
24422 var o1 = _p[14];
24423 var p1 = _p[15];
24424
24425 /* matrix order (canvas compatible):
24426 * ace
24427 * bdf
24428 * 001
24429 */
24430 _p[0] = a1 * a2 + b1 * e2 + c1 * i2 + d1 * m2;
24431 _p[1] = a1 * b2 + b1 * f2 + c1 * j2 + d1 * n2 ;
24432 _p[2] = a1 * c2 + b1 * g2 + c1 * k2 + d1 * o2 ;
24433 _p[3] = a1 * d2 + b1 * h2 + c1 * l2 + d1 * p2 ;
24434
24435 _p[4] = e1 * a2 + f1 * e2 + g1 * i2 + h1 * m2 ;
24436 _p[5] = e1 * b2 + f1 * f2 + g1 * j2 + h1 * n2 ;
24437 _p[6] = e1 * c2 + f1 * g2 + g1 * k2 + h1 * o2 ;
24438 _p[7] = e1 * d2 + f1 * h2 + g1 * l2 + h1 * p2 ;
24439
24440 _p[8] = i1 * a2 + j1 * e2 + k1 * i2 + l1 * m2 ;
24441 _p[9] = i1 * b2 + j1 * f2 + k1 * j2 + l1 * n2 ;
24442 _p[10] = i1 * c2 + j1 * g2 + k1 * k2 + l1 * o2 ;
24443 _p[11] = i1 * d2 + j1 * h2 + k1 * l2 + l1 * p2 ;
24444
24445 _p[12] = m1 * a2 + n1 * e2 + o1 * i2 + p1 * m2 ;
24446 _p[13] = m1 * b2 + n1 * f2 + o1 * j2 + p1 * n2 ;
24447 _p[14] = m1 * c2 + n1 * g2 + o1 * k2 + p1 * o2 ;
24448 _p[15] = m1 * d2 + n1 * h2 + o1 * l2 + p1 * p2 ;
24449
24450 this._identityCalculated = false;
24451 return this;
24452 }
24453
24454 function isIdentity() {
24455 if(!this._identityCalculated){
24456 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);
24457 this._identityCalculated = true;
24458 }
24459 return this._identity;
24460 }
24461
24462 function equals(matr){
24463 var i = 0;
24464 while (i < 16) {
24465 if(matr.props[i] !== this.props[i]) {
24466 return false;
24467 }
24468 i+=1;
24469 }
24470 return true;
24471 }
24472
24473 function clone(matr){
24474 var i;
24475 for(i=0;i<16;i+=1){
24476 matr.props[i] = this.props[i];
24477 }
24478 }
24479
24480 function cloneFromProps(props){
24481 var i;
24482 for(i=0;i<16;i+=1){
24483 this.props[i] = props[i];
24484 }
24485 }
24486
24487 function applyToPoint(x, y, z) {
24488
24489 return {
24490 x: x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12],
24491 y: x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13],
24492 z: x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14]
24493 };
24494 /*return {
24495 x: x * me.a + y * me.c + me.e,
24496 y: x * me.b + y * me.d + me.f
24497 };*/
24498 }
24499 function applyToX(x, y, z) {
24500 return x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12];
24501 }
24502 function applyToY(x, y, z) {
24503 return x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13];
24504 }
24505 function applyToZ(x, y, z) {
24506 return x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14];
24507 }
24508
24509 function inversePoint(pt) {
24510 var determinant = this.props[0] * this.props[5] - this.props[1] * this.props[4];
24511 var a = this.props[5]/determinant;
24512 var b = - this.props[1]/determinant;
24513 var c = - this.props[4]/determinant;
24514 var d = this.props[0]/determinant;
24515 var e = (this.props[4] * this.props[13] - this.props[5] * this.props[12])/determinant;
24516 var f = - (this.props[0] * this.props[13] - this.props[1] * this.props[12])/determinant;
24517 return [pt[0] * a + pt[1] * c + e, pt[0] * b + pt[1] * d + f, 0];
24518 }
24519
24520 function inversePoints(pts){
24521 var i, len = pts.length, retPts = [];
24522 for(i=0;i<len;i+=1){
24523 retPts[i] = inversePoint(pts[i]);
24524 }
24525 return retPts;
24526 }
24527
24528 function applyToTriplePoints(pt1, pt2, pt3) {
24529 var arr = createTypedArray('float32', 6);
24530 if(this.isIdentity()) {
24531 arr[0] = pt1[0];
24532 arr[1] = pt1[1];
24533 arr[2] = pt2[0];
24534 arr[3] = pt2[1];
24535 arr[4] = pt3[0];
24536 arr[5] = pt3[1];
24537 } else {
24538 var p0 = this.props[0], p1 = this.props[1], p4 = this.props[4], p5 = this.props[5], p12 = this.props[12], p13 = this.props[13];
24539 arr[0] = pt1[0] * p0 + pt1[1] * p4 + p12;
24540 arr[1] = pt1[0] * p1 + pt1[1] * p5 + p13;
24541 arr[2] = pt2[0] * p0 + pt2[1] * p4 + p12;
24542 arr[3] = pt2[0] * p1 + pt2[1] * p5 + p13;
24543 arr[4] = pt3[0] * p0 + pt3[1] * p4 + p12;
24544 arr[5] = pt3[0] * p1 + pt3[1] * p5 + p13;
24545 }
24546 return arr;
24547 }
24548
24549 function applyToPointArray(x,y,z){
24550 var arr;
24551 if(this.isIdentity()) {
24552 arr = [x,y,z];
24553 } else {
24554 arr = [x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12],x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13],x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14]];
24555 }
24556 return arr;
24557 }
24558
24559 function applyToPointStringified(x, y) {
24560 if(this.isIdentity()) {
24561 return x + ',' + y;
24562 }
24563 var _p = this.props;
24564 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;
24565 }
24566
24567 function toCSS() {
24568 //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.
24569 /*if(this.isIdentity()) {
24570 return '';
24571 }*/
24572 var i = 0;
24573 var props = this.props;
24574 var cssValue = 'matrix3d(';
24575 var v = 10000;
24576 while(i<16){
24577 cssValue += _rnd(props[i]*v)/v;
24578 cssValue += i === 15 ? ')':',';
24579 i += 1;
24580 }
24581 return cssValue;
24582 }
24583
24584 function roundMatrixProperty(val) {
24585 var v = 10000;
24586 if((val < 0.000001 && val > 0) || (val > -0.000001 && val < 0)) {
24587 return _rnd(val * v) / v;
24588 }
24589 return val;
24590 }
24591
24592 function to2dCSS() {
24593 //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.
24594 /*if(this.isIdentity()) {
24595 return '';
24596 }*/
24597 var props = this.props;
24598 var _a = roundMatrixProperty(props[0]);
24599 var _b = roundMatrixProperty(props[1]);
24600 var _c = roundMatrixProperty(props[4]);
24601 var _d = roundMatrixProperty(props[5]);
24602 var _e = roundMatrixProperty(props[12]);
24603 var _f = roundMatrixProperty(props[13]);
24604 return "matrix(" + _a + ',' + _b + ',' + _c + ',' + _d + ',' + _e + ',' + _f + ")";
24605 }
24606
24607 return function(){
24608 this.reset = reset;
24609 this.rotate = rotate;
24610 this.rotateX = rotateX;
24611 this.rotateY = rotateY;
24612 this.rotateZ = rotateZ;
24613 this.skew = skew;
24614 this.skewFromAxis = skewFromAxis;
24615 this.shear = shear;
24616 this.scale = scale;
24617 this.setTransform = setTransform;
24618 this.translate = translate;
24619 this.transform = transform;
24620 this.applyToPoint = applyToPoint;
24621 this.applyToX = applyToX;
24622 this.applyToY = applyToY;
24623 this.applyToZ = applyToZ;
24624 this.applyToPointArray = applyToPointArray;
24625 this.applyToTriplePoints = applyToTriplePoints;
24626 this.applyToPointStringified = applyToPointStringified;
24627 this.toCSS = toCSS;
24628 this.to2dCSS = to2dCSS;
24629 this.clone = clone;
24630 this.cloneFromProps = cloneFromProps;
24631 this.equals = equals;
24632 this.inversePoints = inversePoints;
24633 this.inversePoint = inversePoint;
24634 this._t = this.transform;
24635 this.isIdentity = isIdentity;
24636 this._identity = true;
24637 this._identityCalculated = false;
24638
24639 this.props = createTypedArray('float32', 16);
24640 this.reset();
24641 };
24642}());
24643
24644/*
24645 Copyright 2014 David Bau.
24646
24647 Permission is hereby granted, free of charge, to any person obtaining
24648 a copy of this software and associated documentation files (the
24649 "Software"), to deal in the Software without restriction, including
24650 without limitation the rights to use, copy, modify, merge, publish,
24651 distribute, sublicense, and/or sell copies of the Software, and to
24652 permit persons to whom the Software is furnished to do so, subject to
24653 the following conditions:
24654
24655 The above copyright notice and this permission notice shall be
24656 included in all copies or substantial portions of the Software.
24657
24658 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24659 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24660 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24661 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24662 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24663 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24664 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24665
24666 */
24667
24668(function (pool, math) {
24669//
24670// The following constants are related to IEEE 754 limits.
24671//
24672 var global = this,
24673 width = 256, // each RC4 output is 0 <= x < 256
24674 chunks = 6, // at least six RC4 outputs for each double
24675 digits = 52, // there are 52 significant digits in a double
24676 rngname = 'random', // rngname: name for Math.random and Math.seedrandom
24677 startdenom = math.pow(width, chunks),
24678 significance = math.pow(2, digits),
24679 overflow = significance * 2,
24680 mask = width - 1;
24681 // node.js crypto module, initialized at the bottom.
24682
24683//
24684// seedrandom()
24685// This is the seedrandom function described above.
24686//
24687 function seedrandom(seed, options, callback) {
24688 var key = [];
24689 options = (options === true) ? { entropy: true } : (options || {});
24690
24691 // Flatten the seed string or build one from local entropy if needed.
24692 var shortseed = mixkey(flatten(
24693 options.entropy ? [seed, tostring(pool)] :
24694 (seed === null) ? autoseed() : seed, 3), key);
24695
24696 // Use the seed to initialize an ARC4 generator.
24697 var arc4 = new ARC4(key);
24698
24699 // This function returns a random double in [0, 1) that contains
24700 // randomness in every bit of the mantissa of the IEEE 754 value.
24701 var prng = function() {
24702 var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48
24703 d = startdenom, // and denominator d = 2 ^ 48.
24704 x = 0; // and no 'extra last byte'.
24705 while (n < significance) { // Fill up all significant digits by
24706 n = (n + x) * width; // shifting numerator and
24707 d *= width; // denominator and generating a
24708 x = arc4.g(1); // new least-significant-byte.
24709 }
24710 while (n >= overflow) { // To avoid rounding up, before adding
24711 n /= 2; // last byte, shift everything
24712 d /= 2; // right using integer math until
24713 x >>>= 1; // we have exactly the desired bits.
24714 }
24715 return (n + x) / d; // Form the number within [0, 1).
24716 };
24717
24718 prng.int32 = function() { return arc4.g(4) | 0; };
24719 prng.quick = function() { return arc4.g(4) / 0x100000000; };
24720 prng.double = prng;
24721
24722 // Mix the randomness into accumulated entropy.
24723 mixkey(tostring(arc4.S), pool);
24724
24725 // Calling convention: what to return as a function of prng, seed, is_math.
24726 return (options.pass || callback ||
24727 function(prng, seed, is_math_call, state) {
24728 if (state) {
24729 // Load the arc4 state from the given state if it has an S array.
24730 if (state.S) { copy(state, arc4); }
24731 // Only provide the .state method if requested via options.state.
24732 prng.state = function() { return copy(arc4, {}); };
24733 }
24734
24735 // If called as a method of Math (Math.seedrandom()), mutate
24736 // Math.random because that is how seedrandom.js has worked since v1.0.
24737 if (is_math_call) { math[rngname] = prng; return seed; }
24738
24739 // Otherwise, it is a newer calling convention, so return the
24740 // prng directly.
24741 else return prng;
24742 })(
24743 prng,
24744 shortseed,
24745 'global' in options ? options.global : (this == math),
24746 options.state);
24747 }
24748 math['seed' + rngname] = seedrandom;
24749
24750//
24751// ARC4
24752//
24753// An ARC4 implementation. The constructor takes a key in the form of
24754// an array of at most (width) integers that should be 0 <= x < (width).
24755//
24756// The g(count) method returns a pseudorandom integer that concatenates
24757// the next (count) outputs from ARC4. Its return value is a number x
24758// that is in the range 0 <= x < (width ^ count).
24759//
24760 function ARC4(key) {
24761 var t, keylen = key.length,
24762 me = this, i = 0, j = me.i = me.j = 0, s = me.S = [];
24763
24764 // The empty key [] is treated as [0].
24765 if (!keylen) { key = [keylen++]; }
24766
24767 // Set up S using the standard key scheduling algorithm.
24768 while (i < width) {
24769 s[i] = i++;
24770 }
24771 for (i = 0; i < width; i++) {
24772 s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))];
24773 s[j] = t;
24774 }
24775
24776 // The "g" method returns the next (count) outputs as one number.
24777 me.g = function(count) {
24778 // Using instance members instead of closure state nearly doubles speed.
24779 var t, r = 0,
24780 i = me.i, j = me.j, s = me.S;
24781 while (count--) {
24782 t = s[i = mask & (i + 1)];
24783 r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))];
24784 }
24785 me.i = i; me.j = j;
24786 return r;
24787 // For robust unpredictability, the function call below automatically
24788 // discards an initial batch of values. This is called RC4-drop[256].
24789 // See http://google.com/search?q=rsa+fluhrer+response&btnI
24790 };
24791 }
24792
24793//
24794// copy()
24795// Copies internal state of ARC4 to or from a plain object.
24796//
24797 function copy(f, t) {
24798 t.i = f.i;
24799 t.j = f.j;
24800 t.S = f.S.slice();
24801 return t;
24802 }
24803
24804//
24805// flatten()
24806// Converts an object tree to nested arrays of strings.
24807//
24808 function flatten(obj, depth) {
24809 var result = [], typ = (typeof obj), prop;
24810 if (depth && typ == 'object') {
24811 for (prop in obj) {
24812 try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {}
24813 }
24814 }
24815 return (result.length ? result : typ == 'string' ? obj : obj + '\0');
24816 }
24817
24818//
24819// mixkey()
24820// Mixes a string seed into a key that is an array of integers, and
24821// returns a shortened string seed that is equivalent to the result key.
24822//
24823 function mixkey(seed, key) {
24824 var stringseed = seed + '', smear, j = 0;
24825 while (j < stringseed.length) {
24826 key[mask & j] =
24827 mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++));
24828 }
24829 return tostring(key);
24830 }
24831
24832//
24833// autoseed()
24834// Returns an object for autoseeding, using window.crypto and Node crypto
24835// module if available.
24836//
24837 function autoseed() {
24838 try {
24839 var out = new Uint8Array(width);
24840 (global.crypto || global.msCrypto).getRandomValues(out);
24841 return tostring(out);
24842 } catch (e) {
24843 var browser = global.navigator,
24844 plugins = browser && browser.plugins;
24845 return [+new Date(), global, plugins, global.screen, tostring(pool)];
24846 }
24847 }
24848
24849//
24850// tostring()
24851// Converts an array of charcodes to a string
24852//
24853 function tostring(a) {
24854 return String.fromCharCode.apply(0, a);
24855 }
24856
24857//
24858// When seedrandom.js is loaded, we immediately mix a few bits
24859// from the built-in RNG into the entropy pool. Because we do
24860// not want to interfere with deterministic PRNG state later,
24861// seedrandom will not call math.random on its own again after
24862// initialization.
24863//
24864 mixkey(math.random(), pool);
24865
24866//
24867// Nodejs and AMD support: export the implementation as a module using
24868// either convention.
24869//
24870
24871// End anonymous scope, and pass initial values.
24872})(
24873 [], // pool: entropy pool starts empty
24874 BMMath // math: package containing random, pow, and seedrandom
24875);
24876var BezierFactory = (function(){
24877 /**
24878 * BezierEasing - use bezier curve for transition easing function
24879 * by Gaëtan Renaudeau 2014 - 2015 – MIT License
24880 *
24881 * Credits: is based on Firefox's nsSMILKeySpline.cpp
24882 * Usage:
24883 * var spline = BezierEasing([ 0.25, 0.1, 0.25, 1.0 ])
24884 * spline.get(x) => returns the easing value | x must be in [0, 1] range
24885 *
24886 */
24887
24888 var ob = {};
24889 ob.getBezierEasing = getBezierEasing;
24890 var beziers = {};
24891
24892 function getBezierEasing(a,b,c,d,nm){
24893 var str = nm || ('bez_' + a+'_'+b+'_'+c+'_'+d).replace(/\./g, 'p');
24894 if(beziers[str]){
24895 return beziers[str];
24896 }
24897 var bezEasing = new BezierEasing([a,b,c,d]);
24898 beziers[str] = bezEasing;
24899 return bezEasing;
24900 }
24901
24902// These values are established by empiricism with tests (tradeoff: performance VS precision)
24903 var NEWTON_ITERATIONS = 4;
24904 var NEWTON_MIN_SLOPE = 0.001;
24905 var SUBDIVISION_PRECISION = 0.0000001;
24906 var SUBDIVISION_MAX_ITERATIONS = 10;
24907
24908 var kSplineTableSize = 11;
24909 var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
24910
24911 var float32ArraySupported = typeof Float32Array === "function";
24912
24913 function A (aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1; }
24914 function B (aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1; }
24915 function C (aA1) { return 3.0 * aA1; }
24916
24917// Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.
24918 function calcBezier (aT, aA1, aA2) {
24919 return ((A(aA1, aA2)*aT + B(aA1, aA2))*aT + C(aA1))*aT;
24920 }
24921
24922// Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2.
24923 function getSlope (aT, aA1, aA2) {
24924 return 3.0 * A(aA1, aA2)*aT*aT + 2.0 * B(aA1, aA2) * aT + C(aA1);
24925 }
24926
24927 function binarySubdivide (aX, aA, aB, mX1, mX2) {
24928 var currentX, currentT, i = 0;
24929 do {
24930 currentT = aA + (aB - aA) / 2.0;
24931 currentX = calcBezier(currentT, mX1, mX2) - aX;
24932 if (currentX > 0.0) {
24933 aB = currentT;
24934 } else {
24935 aA = currentT;
24936 }
24937 } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);
24938 return currentT;
24939 }
24940
24941 function newtonRaphsonIterate (aX, aGuessT, mX1, mX2) {
24942 for (var i = 0; i < NEWTON_ITERATIONS; ++i) {
24943 var currentSlope = getSlope(aGuessT, mX1, mX2);
24944 if (currentSlope === 0.0) return aGuessT;
24945 var currentX = calcBezier(aGuessT, mX1, mX2) - aX;
24946 aGuessT -= currentX / currentSlope;
24947 }
24948 return aGuessT;
24949 }
24950
24951 /**
24952 * points is an array of [ mX1, mY1, mX2, mY2 ]
24953 */
24954 function BezierEasing (points) {
24955 this._p = points;
24956 this._mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize);
24957 this._precomputed = false;
24958
24959 this.get = this.get.bind(this);
24960 }
24961
24962 BezierEasing.prototype = {
24963
24964 get: function (x) {
24965 var mX1 = this._p[0],
24966 mY1 = this._p[1],
24967 mX2 = this._p[2],
24968 mY2 = this._p[3];
24969 if (!this._precomputed) this._precompute();
24970 if (mX1 === mY1 && mX2 === mY2) return x; // linear
24971 // Because JavaScript number are imprecise, we should guarantee the extremes are right.
24972 if (x === 0) return 0;
24973 if (x === 1) return 1;
24974 return calcBezier(this._getTForX(x), mY1, mY2);
24975 },
24976
24977 // Private part
24978
24979 _precompute: function () {
24980 var mX1 = this._p[0],
24981 mY1 = this._p[1],
24982 mX2 = this._p[2],
24983 mY2 = this._p[3];
24984 this._precomputed = true;
24985 if (mX1 !== mY1 || mX2 !== mY2)
24986 this._calcSampleValues();
24987 },
24988
24989 _calcSampleValues: function () {
24990 var mX1 = this._p[0],
24991 mX2 = this._p[2];
24992 for (var i = 0; i < kSplineTableSize; ++i) {
24993 this._mSampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
24994 }
24995 },
24996
24997 /**
24998 * getTForX chose the fastest heuristic to determine the percentage value precisely from a given X projection.
24999 */
25000 _getTForX: function (aX) {
25001 var mX1 = this._p[0],
25002 mX2 = this._p[2],
25003 mSampleValues = this._mSampleValues;
25004
25005 var intervalStart = 0.0;
25006 var currentSample = 1;
25007 var lastSample = kSplineTableSize - 1;
25008
25009 for (; currentSample !== lastSample && mSampleValues[currentSample] <= aX; ++currentSample) {
25010 intervalStart += kSampleStepSize;
25011 }
25012 --currentSample;
25013
25014 // Interpolate to provide an initial guess for t
25015 var dist = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample+1] - mSampleValues[currentSample]);
25016 var guessForT = intervalStart + dist * kSampleStepSize;
25017
25018 var initialSlope = getSlope(guessForT, mX1, mX2);
25019 if (initialSlope >= NEWTON_MIN_SLOPE) {
25020 return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
25021 } else if (initialSlope === 0.0) {
25022 return guessForT;
25023 } else {
25024 return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);
25025 }
25026 }
25027 };
25028
25029 return ob;
25030
25031}());
25032(function () {
25033 var lastTime = 0;
25034 var vendors = ['ms', 'moz', 'webkit', 'o'];
25035 for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
25036 window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
25037 window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame'];
25038 }
25039 if(!window.requestAnimationFrame)
25040 window.requestAnimationFrame = function (callback, element) {
25041 var currTime = new Date().getTime();
25042 var timeToCall = Math.max(0, 16 - (currTime - lastTime));
25043 var id = setTimeout(function () {
25044 callback(currTime + timeToCall);
25045 },
25046 timeToCall);
25047 lastTime = currTime + timeToCall;
25048 return id;
25049 };
25050 if(!window.cancelAnimationFrame)
25051 window.cancelAnimationFrame = function (id) {
25052 clearTimeout(id);
25053 };
25054}());
25055
25056function extendPrototype(sources,destination){
25057 var i, len = sources.length, sourcePrototype;
25058 for (i = 0;i < len;i += 1) {
25059 sourcePrototype = sources[i].prototype;
25060 for (var attr in sourcePrototype) {
25061 if (sourcePrototype.hasOwnProperty(attr)) destination.prototype[attr] = sourcePrototype[attr];
25062 }
25063 }
25064}
25065
25066function getDescriptor(object, prop) {
25067 return Object.getOwnPropertyDescriptor(object, prop);
25068}
25069
25070function createProxyFunction(prototype) {
25071 function ProxyFunction(){}
25072 ProxyFunction.prototype = prototype;
25073 return ProxyFunction;
25074}
25075function bezFunction(){
25076
25077 function pointOnLine2D(x1,y1, x2,y2, x3,y3){
25078 var det1 = (x1*y2) + (y1*x3) + (x2*y3) - (x3*y2) - (y3*x1) - (x2*y1);
25079 return det1 > -0.001 && det1 < 0.001;
25080 }
25081
25082 function pointOnLine3D(x1,y1,z1, x2,y2,z2, x3,y3,z3){
25083 if(z1 === 0 && z2 === 0 && z3 === 0) {
25084 return pointOnLine2D(x1,y1, x2,y2, x3,y3);
25085 }
25086 var dist1 = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2) + Math.pow(z2 - z1, 2));
25087 var dist2 = Math.sqrt(Math.pow(x3 - x1, 2) + Math.pow(y3 - y1, 2) + Math.pow(z3 - z1, 2));
25088 var dist3 = Math.sqrt(Math.pow(x3 - x2, 2) + Math.pow(y3 - y2, 2) + Math.pow(z3 - z2, 2));
25089 var diffDist;
25090 if(dist1 > dist2){
25091 if(dist1 > dist3){
25092 diffDist = dist1 - dist2 - dist3;
25093 } else {
25094 diffDist = dist3 - dist2 - dist1;
25095 }
25096 } else if(dist3 > dist2){
25097 diffDist = dist3 - dist2 - dist1;
25098 } else {
25099 diffDist = dist2 - dist1 - dist3;
25100 }
25101 return diffDist > -0.0001 && diffDist < 0.0001;
25102 }
25103
25104 var getBezierLength = (function(){
25105
25106 return function(pt1,pt2,pt3,pt4){
25107 var curveSegments = defaultCurveSegments;
25108 var k;
25109 var i, len;
25110 var ptCoord,perc,addedLength = 0;
25111 var ptDistance;
25112 var point = [],lastPoint = [];
25113 var lengthData = bezier_length_pool.newElement();
25114 len = pt3.length;
25115 for(k=0;k<curveSegments;k+=1){
25116 perc = k/(curveSegments-1);
25117 ptDistance = 0;
25118 for(i=0;i<len;i+=1){
25119 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];
25120 point[i] = ptCoord;
25121 if(lastPoint[i] !== null){
25122 ptDistance += bm_pow(point[i] - lastPoint[i],2);
25123 }
25124 lastPoint[i] = point[i];
25125 }
25126 if(ptDistance){
25127 ptDistance = bm_sqrt(ptDistance);
25128 addedLength += ptDistance;
25129 }
25130 lengthData.percents[k] = perc;
25131 lengthData.lengths[k] = addedLength;
25132 }
25133 lengthData.addedLength = addedLength;
25134 return lengthData;
25135 };
25136 }());
25137
25138 function getSegmentsLength(shapeData) {
25139 var segmentsLength = segments_length_pool.newElement();
25140 var closed = shapeData.c;
25141 var pathV = shapeData.v;
25142 var pathO = shapeData.o;
25143 var pathI = shapeData.i;
25144 var i, len = shapeData._length;
25145 var lengths = segmentsLength.lengths;
25146 var totalLength = 0;
25147 for(i=0;i<len-1;i+=1){
25148 lengths[i] = getBezierLength(pathV[i],pathV[i+1],pathO[i],pathI[i+1]);
25149 totalLength += lengths[i].addedLength;
25150 }
25151 if(closed && len){
25152 lengths[i] = getBezierLength(pathV[i],pathV[0],pathO[i],pathI[0]);
25153 totalLength += lengths[i].addedLength;
25154 }
25155 segmentsLength.totalLength = totalLength;
25156 return segmentsLength;
25157 }
25158
25159 function BezierData(length){
25160 this.segmentLength = 0;
25161 this.points = new Array(length);
25162 }
25163
25164 function PointData(partial,point){
25165 this.partialLength = partial;
25166 this.point = point;
25167 }
25168
25169 var buildBezierData = (function(){
25170
25171 var storedData = {};
25172
25173 return function (pt1, pt2, pt3, pt4){
25174 var bezierName = (pt1[0]+'_'+pt1[1]+'_'+pt2[0]+'_'+pt2[1]+'_'+pt3[0]+'_'+pt3[1]+'_'+pt4[0]+'_'+pt4[1]).replace(/\./g, 'p');
25175 if(!storedData[bezierName]){
25176 var curveSegments = defaultCurveSegments;
25177 var k, i, len;
25178 var ptCoord,perc,addedLength = 0;
25179 var ptDistance;
25180 var point,lastPoint = null;
25181 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])){
25182 curveSegments = 2;
25183 }
25184 var bezierData = new BezierData(curveSegments);
25185 len = pt3.length;
25186 for (k = 0; k < curveSegments; k += 1) {
25187 point = createSizedArray(len);
25188 perc = k / (curveSegments - 1);
25189 ptDistance = 0;
25190 for (i = 0; i < len; i += 1){
25191 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];
25192 point[i] = ptCoord;
25193 if(lastPoint !== null){
25194 ptDistance += bm_pow(point[i] - lastPoint[i],2);
25195 }
25196 }
25197 ptDistance = bm_sqrt(ptDistance);
25198 addedLength += ptDistance;
25199 bezierData.points[k] = new PointData(ptDistance, point);
25200 lastPoint = point;
25201 }
25202 bezierData.segmentLength = addedLength;
25203 storedData[bezierName] = bezierData;
25204 }
25205 return storedData[bezierName];
25206 };
25207 }());
25208
25209 function getDistancePerc(perc,bezierData){
25210 var percents = bezierData.percents;
25211 var lengths = bezierData.lengths;
25212 var len = percents.length;
25213 var initPos = bm_floor((len-1)*perc);
25214 var lengthPos = perc*bezierData.addedLength;
25215 var lPerc = 0;
25216 if(initPos === len - 1 || initPos === 0 || lengthPos === lengths[initPos]){
25217 return percents[initPos];
25218 }else{
25219 var dir = lengths[initPos] > lengthPos ? -1 : 1;
25220 var flag = true;
25221 while(flag){
25222 if(lengths[initPos] <= lengthPos && lengths[initPos+1] > lengthPos){
25223 lPerc = (lengthPos - lengths[initPos]) / (lengths[initPos+1] - lengths[initPos]);
25224 flag = false;
25225 }else{
25226 initPos += dir;
25227 }
25228 if(initPos < 0 || initPos >= len - 1){
25229 //FIX for TypedArrays that don't store floating point values with enough accuracy
25230 if(initPos === len - 1) {
25231 return percents[initPos];
25232 }
25233 flag = false;
25234 }
25235 }
25236 return percents[initPos] + (percents[initPos+1] - percents[initPos])*lPerc;
25237 }
25238 }
25239
25240 function getPointInSegment(pt1, pt2, pt3, pt4, percent, bezierData) {
25241 var t1 = getDistancePerc(percent,bezierData);
25242 var u1 = 1 - t1;
25243 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;
25244 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;
25245 return [ptX, ptY];
25246 }
25247
25248 var bezier_segment_points = createTypedArray('float32', 8);
25249
25250 function getNewSegment(pt1,pt2,pt3,pt4,startPerc,endPerc, bezierData){
25251
25252 startPerc = startPerc < 0 ? 0 : startPerc > 1 ? 1 : startPerc;
25253 var t0 = getDistancePerc(startPerc,bezierData);
25254 endPerc = endPerc > 1 ? 1 : endPerc;
25255 var t1 = getDistancePerc(endPerc,bezierData);
25256 var i, len = pt1.length;
25257 var u0 = 1 - t0;
25258 var u1 = 1 - t1;
25259 var u0u0u0 = u0*u0*u0;
25260 var t0u0u0_3 = t0*u0*u0*3;
25261 var t0t0u0_3 = t0*t0*u0*3;
25262 var t0t0t0 = t0*t0*t0;
25263 //
25264 var u0u0u1 = u0*u0*u1;
25265 var t0u0u1_3 = t0*u0*u1 + u0*t0*u1 + u0*u0*t1;
25266 var t0t0u1_3 = t0*t0*u1 + u0*t0*t1 + t0*u0*t1;
25267 var t0t0t1 = t0*t0*t1;
25268 //
25269 var u0u1u1 = u0*u1*u1;
25270 var t0u1u1_3 = t0*u1*u1 + u0*t1*u1 + u0*u1*t1;
25271 var t0t1u1_3 = t0*t1*u1 + u0*t1*t1 + t0*u1*t1;
25272 var t0t1t1 = t0*t1*t1;
25273 //
25274 var u1u1u1 = u1*u1*u1;
25275 var t1u1u1_3 = t1*u1*u1 + u1*t1*u1 + u1*u1*t1;
25276 var t1t1u1_3 = t1*t1*u1 + u1*t1*t1 + t1*u1*t1;
25277 var t1t1t1 = t1*t1*t1;
25278 for(i=0;i<len;i+=1){
25279 bezier_segment_points[i * 4] = Math.round((u0u0u0 * pt1[i] + t0u0u0_3 * pt3[i] + t0t0u0_3 * pt4[i] + t0t0t0 * pt2[i]) * 1000) / 1000;
25280 bezier_segment_points[i * 4 + 1] = Math.round((u0u0u1 * pt1[i] + t0u0u1_3 * pt3[i] + t0t0u1_3 * pt4[i] + t0t0t1 * pt2[i]) * 1000) / 1000;
25281 bezier_segment_points[i * 4 + 2] = Math.round((u0u1u1 * pt1[i] + t0u1u1_3 * pt3[i] + t0t1u1_3 * pt4[i] + t0t1t1 * pt2[i]) * 1000) / 1000;
25282 bezier_segment_points[i * 4 + 3] = Math.round((u1u1u1 * pt1[i] + t1u1u1_3 * pt3[i] + t1t1u1_3 * pt4[i] + t1t1t1 * pt2[i]) * 1000) / 1000;
25283 }
25284
25285 return bezier_segment_points;
25286 }
25287
25288 return {
25289 getSegmentsLength : getSegmentsLength,
25290 getNewSegment : getNewSegment,
25291 getPointInSegment : getPointInSegment,
25292 buildBezierData : buildBezierData,
25293 pointOnLine2D : pointOnLine2D,
25294 pointOnLine3D : pointOnLine3D
25295 };
25296}
25297
25298var bez = bezFunction();
25299function dataFunctionManager(){
25300
25301 //var tCanvasHelper = createTag('canvas').getContext('2d');
25302
25303 function completeLayers(layers, comps, fontManager){
25304 var layerData;
25305 var i, len = layers.length;
25306 var j, jLen, k, kLen;
25307 for(i=0;i<len;i+=1){
25308 layerData = layers[i];
25309 if(!('ks' in layerData) || layerData.completed){
25310 continue;
25311 }
25312 layerData.completed = true;
25313 if(layerData.tt){
25314 layers[i-1].td = layerData.tt;
25315 }
25316 if(layerData.hasMask){
25317 var maskProps = layerData.masksProperties;
25318 jLen = maskProps.length;
25319 for(j=0;j<jLen;j+=1){
25320 if(maskProps[j].pt.k.i){
25321 convertPathsToAbsoluteValues(maskProps[j].pt.k);
25322 }else{
25323 kLen = maskProps[j].pt.k.length;
25324 for(k=0;k<kLen;k+=1){
25325 if(maskProps[j].pt.k[k].s){
25326 convertPathsToAbsoluteValues(maskProps[j].pt.k[k].s[0]);
25327 }
25328 if(maskProps[j].pt.k[k].e){
25329 convertPathsToAbsoluteValues(maskProps[j].pt.k[k].e[0]);
25330 }
25331 }
25332 }
25333 }
25334 }
25335 if(layerData.ty===0){
25336 layerData.layers = findCompLayers(layerData.refId, comps);
25337 completeLayers(layerData.layers,comps, fontManager);
25338 }else if(layerData.ty === 4){
25339 completeShapes(layerData.shapes);
25340 }else if(layerData.ty == 5){
25341 completeText(layerData, fontManager);
25342 }
25343 }
25344 }
25345
25346 function findCompLayers(id,comps){
25347 var i = 0, len = comps.length;
25348 while(i<len){
25349 if(comps[i].id === id){
25350 if(!comps[i].layers.__used) {
25351 comps[i].layers.__used = true;
25352 return comps[i].layers;
25353 }
25354 return JSON.parse(JSON.stringify(comps[i].layers));
25355 }
25356 i += 1;
25357 }
25358 }
25359
25360 function completeShapes(arr){
25361 var i, len = arr.length;
25362 var j, jLen;
25363 for(i=len-1;i>=0;i-=1){
25364 if(arr[i].ty == 'sh'){
25365 if(arr[i].ks.k.i){
25366 convertPathsToAbsoluteValues(arr[i].ks.k);
25367 }else{
25368 jLen = arr[i].ks.k.length;
25369 for(j=0;j<jLen;j+=1){
25370 if(arr[i].ks.k[j].s){
25371 convertPathsToAbsoluteValues(arr[i].ks.k[j].s[0]);
25372 }
25373 if(arr[i].ks.k[j].e){
25374 convertPathsToAbsoluteValues(arr[i].ks.k[j].e[0]);
25375 }
25376 }
25377 }
25378 }else if(arr[i].ty == 'gr'){
25379 completeShapes(arr[i].it);
25380 }
25381 }
25382 /*if(hasPaths){
25383 //mx: distance
25384 //ss: sensitivity
25385 //dc: decay
25386 arr.splice(arr.length-1,0,{
25387 "ty": "ms",
25388 "mx":20,
25389 "ss":10,
25390 "dc":0.001,
25391 "maxDist":200
25392 });
25393 }*/
25394 }
25395
25396 function convertPathsToAbsoluteValues(path){
25397 var i, len = path.i.length;
25398 for(i=0;i<len;i+=1){
25399 path.i[i][0] += path.v[i][0];
25400 path.i[i][1] += path.v[i][1];
25401 path.o[i][0] += path.v[i][0];
25402 path.o[i][1] += path.v[i][1];
25403 }
25404 }
25405
25406 function checkVersion(minimum,animVersionString){
25407 var animVersion = animVersionString ? animVersionString.split('.') : [100,100,100];
25408 if(minimum[0]>animVersion[0]){
25409 return true;
25410 } else if(animVersion[0] > minimum[0]){
25411 return false;
25412 }
25413 if(minimum[1]>animVersion[1]){
25414 return true;
25415 } else if(animVersion[1] > minimum[1]){
25416 return false;
25417 }
25418 if(minimum[2]>animVersion[2]){
25419 return true;
25420 } else if(animVersion[2] > minimum[2]){
25421 return false;
25422 }
25423 }
25424
25425 var checkText = (function(){
25426 var minimumVersion = [4,4,14];
25427
25428 function updateTextLayer(textLayer){
25429 var documentData = textLayer.t.d;
25430 textLayer.t.d = {
25431 k: [
25432 {
25433 s:documentData,
25434 t:0
25435 }
25436 ]
25437 };
25438 }
25439
25440 function iterateLayers(layers){
25441 var i, len = layers.length;
25442 for(i=0;i<len;i+=1){
25443 if(layers[i].ty === 5){
25444 updateTextLayer(layers[i]);
25445 }
25446 }
25447 }
25448
25449 return function (animationData){
25450 if(checkVersion(minimumVersion,animationData.v)){
25451 iterateLayers(animationData.layers);
25452 if(animationData.assets){
25453 var i, len = animationData.assets.length;
25454 for(i=0;i<len;i+=1){
25455 if(animationData.assets[i].layers){
25456 iterateLayers(animationData.assets[i].layers);
25457
25458 }
25459 }
25460 }
25461 }
25462 };
25463 }());
25464
25465 var checkChars = (function() {
25466 var minimumVersion = [4,7,99];
25467 return function (animationData){
25468 if(animationData.chars && !checkVersion(minimumVersion,animationData.v)){
25469 var i, len = animationData.chars.length, j, jLen;
25470 var pathData, paths;
25471 for(i = 0; i < len; i += 1) {
25472 if(animationData.chars[i].data && animationData.chars[i].data.shapes) {
25473 paths = animationData.chars[i].data.shapes[0].it;
25474 jLen = paths.length;
25475
25476 for(j = 0; j < jLen; j += 1) {
25477 pathData = paths[j].ks.k;
25478 if(!pathData.__converted) {
25479 convertPathsToAbsoluteValues(paths[j].ks.k);
25480 pathData.__converted = true;
25481 }
25482 }
25483 }
25484 }
25485 }
25486 };
25487 }());
25488
25489 var checkColors = (function(){
25490 var minimumVersion = [4,1,9];
25491
25492 function iterateShapes(shapes){
25493 var i, len = shapes.length;
25494 var j, jLen;
25495 for(i=0;i<len;i+=1){
25496 if(shapes[i].ty === 'gr'){
25497 iterateShapes(shapes[i].it);
25498 }else if(shapes[i].ty === 'fl' || shapes[i].ty === 'st'){
25499 if(shapes[i].c.k && shapes[i].c.k[0].i){
25500 jLen = shapes[i].c.k.length;
25501 for(j=0;j<jLen;j+=1){
25502 if(shapes[i].c.k[j].s){
25503 shapes[i].c.k[j].s[0] /= 255;
25504 shapes[i].c.k[j].s[1] /= 255;
25505 shapes[i].c.k[j].s[2] /= 255;
25506 shapes[i].c.k[j].s[3] /= 255;
25507 }
25508 if(shapes[i].c.k[j].e){
25509 shapes[i].c.k[j].e[0] /= 255;
25510 shapes[i].c.k[j].e[1] /= 255;
25511 shapes[i].c.k[j].e[2] /= 255;
25512 shapes[i].c.k[j].e[3] /= 255;
25513 }
25514 }
25515 } else {
25516 shapes[i].c.k[0] /= 255;
25517 shapes[i].c.k[1] /= 255;
25518 shapes[i].c.k[2] /= 255;
25519 shapes[i].c.k[3] /= 255;
25520 }
25521 }
25522 }
25523 }
25524
25525 function iterateLayers(layers){
25526 var i, len = layers.length;
25527 for(i=0;i<len;i+=1){
25528 if(layers[i].ty === 4){
25529 iterateShapes(layers[i].shapes);
25530 }
25531 }
25532 }
25533
25534 return function (animationData){
25535 if(checkVersion(minimumVersion,animationData.v)){
25536 iterateLayers(animationData.layers);
25537 if(animationData.assets){
25538 var i, len = animationData.assets.length;
25539 for(i=0;i<len;i+=1){
25540 if(animationData.assets[i].layers){
25541 iterateLayers(animationData.assets[i].layers);
25542
25543 }
25544 }
25545 }
25546 }
25547 };
25548 }());
25549
25550 var checkShapes = (function(){
25551 var minimumVersion = [4,4,18];
25552
25553
25554
25555 function completeShapes(arr){
25556 var i, len = arr.length;
25557 var j, jLen;
25558 for(i=len-1;i>=0;i-=1){
25559 if(arr[i].ty == 'sh'){
25560 if(arr[i].ks.k.i){
25561 arr[i].ks.k.c = arr[i].closed;
25562 }else{
25563 jLen = arr[i].ks.k.length;
25564 for(j=0;j<jLen;j+=1){
25565 if(arr[i].ks.k[j].s){
25566 arr[i].ks.k[j].s[0].c = arr[i].closed;
25567 }
25568 if(arr[i].ks.k[j].e){
25569 arr[i].ks.k[j].e[0].c = arr[i].closed;
25570 }
25571 }
25572 }
25573 }else if(arr[i].ty == 'gr'){
25574 completeShapes(arr[i].it);
25575 }
25576 }
25577 }
25578
25579 function iterateLayers(layers){
25580 var layerData;
25581 var i, len = layers.length;
25582 var j, jLen, k, kLen;
25583 for(i=0;i<len;i+=1){
25584 layerData = layers[i];
25585 if(layerData.hasMask){
25586 var maskProps = layerData.masksProperties;
25587 jLen = maskProps.length;
25588 for(j=0;j<jLen;j+=1){
25589 if(maskProps[j].pt.k.i){
25590 maskProps[j].pt.k.c = maskProps[j].cl;
25591 }else{
25592 kLen = maskProps[j].pt.k.length;
25593 for(k=0;k<kLen;k+=1){
25594 if(maskProps[j].pt.k[k].s){
25595 maskProps[j].pt.k[k].s[0].c = maskProps[j].cl;
25596 }
25597 if(maskProps[j].pt.k[k].e){
25598 maskProps[j].pt.k[k].e[0].c = maskProps[j].cl;
25599 }
25600 }
25601 }
25602 }
25603 }
25604 if(layerData.ty === 4){
25605 completeShapes(layerData.shapes);
25606 }
25607 }
25608 }
25609
25610 return function (animationData){
25611 if(checkVersion(minimumVersion,animationData.v)){
25612 iterateLayers(animationData.layers);
25613 if(animationData.assets){
25614 var i, len = animationData.assets.length;
25615 for(i=0;i<len;i+=1){
25616 if(animationData.assets[i].layers){
25617 iterateLayers(animationData.assets[i].layers);
25618
25619 }
25620 }
25621 }
25622 }
25623 };
25624 }());
25625
25626 function completeData(animationData, fontManager){
25627 if(animationData.__complete){
25628 return;
25629 }
25630 checkColors(animationData);
25631 checkText(animationData);
25632 checkChars(animationData);
25633 checkShapes(animationData);
25634 completeLayers(animationData.layers, animationData.assets, fontManager);
25635 animationData.__complete = true;
25636 //blitAnimation(animationData, animationData.assets, fontManager);
25637 }
25638
25639 function completeText(data, fontManager){
25640 if(data.t.a.length === 0 && !('m' in data.t.p)){
25641 data.singleShape = true;
25642 }
25643 }
25644
25645 var moduleOb = {};
25646 moduleOb.completeData = completeData;
25647
25648 return moduleOb;
25649}
25650
25651var dataManager = dataFunctionManager();
25652var FontManager = (function(){
25653
25654 var maxWaitingTime = 5000;
25655 var emptyChar = {
25656 w: 0,
25657 size:0,
25658 shapes:[]
25659 };
25660 var combinedCharacters = [];
25661 //Hindi characters
25662 combinedCharacters = combinedCharacters.concat([2304, 2305, 2306, 2307, 2362, 2363, 2364, 2364, 2366
25663 , 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 2375, 2376, 2377, 2378, 2379
25664 , 2380, 2381, 2382, 2383, 2387, 2388, 2389, 2390, 2391, 2402, 2403]);
25665
25666 function setUpNode(font, family){
25667 var parentNode = createTag('span');
25668 parentNode.style.fontFamily = family;
25669 var node = createTag('span');
25670 // Characters that vary significantly among different fonts
25671 node.innerHTML = 'giItT1WQy@!-/#';
25672 // Visible - so we can measure it - but not on the screen
25673 parentNode.style.position = 'absolute';
25674 parentNode.style.left = '-10000px';
25675 parentNode.style.top = '-10000px';
25676 // Large font size makes even subtle changes obvious
25677 parentNode.style.fontSize = '300px';
25678 // Reset any font properties
25679 parentNode.style.fontVariant = 'normal';
25680 parentNode.style.fontStyle = 'normal';
25681 parentNode.style.fontWeight = 'normal';
25682 parentNode.style.letterSpacing = '0';
25683 parentNode.appendChild(node);
25684 document.body.appendChild(parentNode);
25685
25686 // Remember width with no applied web font
25687 var width = node.offsetWidth;
25688 node.style.fontFamily = font + ', '+family;
25689 return {node:node, w:width, parent:parentNode};
25690 }
25691
25692 function checkLoadedFonts() {
25693 var i, len = this.fonts.length;
25694 var node, w;
25695 var loadedCount = len;
25696 for(i=0;i<len; i+= 1){
25697 if(this.fonts[i].loaded){
25698 loadedCount -= 1;
25699 continue;
25700 }
25701 if(this.fonts[i].fOrigin === 'n' || this.fonts[i].origin === 0){
25702 this.fonts[i].loaded = true;
25703 } else{
25704 node = this.fonts[i].monoCase.node;
25705 w = this.fonts[i].monoCase.w;
25706 if(node.offsetWidth !== w){
25707 loadedCount -= 1;
25708 this.fonts[i].loaded = true;
25709 }else{
25710 node = this.fonts[i].sansCase.node;
25711 w = this.fonts[i].sansCase.w;
25712 if(node.offsetWidth !== w){
25713 loadedCount -= 1;
25714 this.fonts[i].loaded = true;
25715 }
25716 }
25717 if(this.fonts[i].loaded){
25718 this.fonts[i].sansCase.parent.parentNode.removeChild(this.fonts[i].sansCase.parent);
25719 this.fonts[i].monoCase.parent.parentNode.removeChild(this.fonts[i].monoCase.parent);
25720 }
25721 }
25722 }
25723
25724 if(loadedCount !== 0 && Date.now() - this.initTime < maxWaitingTime){
25725 setTimeout(this.checkLoadedFonts.bind(this),20);
25726 }else{
25727 setTimeout(function(){this.isLoaded = true;}.bind(this),0);
25728
25729 }
25730 }
25731
25732 function createHelper(def, fontData){
25733 var tHelper = createNS('text');
25734 tHelper.style.fontSize = '100px';
25735 //tHelper.style.fontFamily = fontData.fFamily;
25736 tHelper.setAttribute('font-family', fontData.fFamily);
25737 tHelper.setAttribute('font-style', fontData.fStyle);
25738 tHelper.setAttribute('font-weight', fontData.fWeight);
25739 tHelper.textContent = '1';
25740 if(fontData.fClass){
25741 tHelper.style.fontFamily = 'inherit';
25742 tHelper.setAttribute('class', fontData.fClass);
25743 } else {
25744 tHelper.style.fontFamily = fontData.fFamily;
25745 }
25746 def.appendChild(tHelper);
25747 var tCanvasHelper = createTag('canvas').getContext('2d');
25748 tCanvasHelper.font = fontData.fWeight + ' ' + fontData.fStyle + ' 100px '+ fontData.fFamily;
25749 //tCanvasHelper.font = ' 100px '+ fontData.fFamily;
25750 return tHelper;
25751 }
25752
25753 function addFonts(fontData, defs){
25754 if(!fontData){
25755 this.isLoaded = true;
25756 return;
25757 }
25758 if(this.chars){
25759 this.isLoaded = true;
25760 this.fonts = fontData.list;
25761 return;
25762 }
25763
25764
25765 var fontArr = fontData.list;
25766 var i, len = fontArr.length;
25767 var _pendingFonts = len;
25768 for(i=0; i<len; i+= 1){
25769 var shouldLoadFont = true;
25770 var loadedSelector;
25771 var j;
25772 fontArr[i].loaded = false;
25773 fontArr[i].monoCase = setUpNode(fontArr[i].fFamily,'monospace');
25774 fontArr[i].sansCase = setUpNode(fontArr[i].fFamily,'sans-serif');
25775 if(!fontArr[i].fPath) {
25776 fontArr[i].loaded = true;
25777 _pendingFonts -= 1;
25778 }else if(fontArr[i].fOrigin === 'p' || fontArr[i].origin === 3){
25779 loadedSelector = document.querySelectorAll('style[f-forigin="p"][f-family="'+ fontArr[i].fFamily +'"], style[f-origin="3"][f-family="'+ fontArr[i].fFamily +'"]');
25780
25781 if (loadedSelector.length > 0) {
25782 shouldLoadFont = false;
25783 }
25784
25785 if (shouldLoadFont) {
25786 var s = createTag('style');
25787 s.setAttribute('f-forigin', fontArr[i].fOrigin);
25788 s.setAttribute('f-origin', fontArr[i].origin);
25789 s.setAttribute('f-family', fontArr[i].fFamily);
25790 s.type = "text/css";
25791 s.innerHTML = "@font-face {" + "font-family: "+fontArr[i].fFamily+"; font-style: normal; src: url('"+fontArr[i].fPath+"');}";
25792 defs.appendChild(s);
25793 }
25794 } else if(fontArr[i].fOrigin === 'g' || fontArr[i].origin === 1){
25795 loadedSelector = document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]');
25796
25797 for (j = 0; j < loadedSelector.length; j++) {
25798 if (loadedSelector[j].href.indexOf(fontArr[i].fPath) !== -1) {
25799 // Font is already loaded
25800 shouldLoadFont = false;
25801 }
25802 }
25803
25804 if (shouldLoadFont) {
25805 var l = createTag('link');
25806 l.setAttribute('f-forigin', fontArr[i].fOrigin);
25807 l.setAttribute('f-origin', fontArr[i].origin);
25808 l.type = "text/css";
25809 l.rel = "stylesheet";
25810 l.href = fontArr[i].fPath;
25811 document.body.appendChild(l);
25812 }
25813 } else if(fontArr[i].fOrigin === 't' || fontArr[i].origin === 2){
25814 loadedSelector = document.querySelectorAll('script[f-forigin="t"], script[f-origin="2"]');
25815
25816 for (j = 0; j < loadedSelector.length; j++) {
25817 if (fontArr[i].fPath === loadedSelector[j].src) {
25818 // Font is already loaded
25819 shouldLoadFont = false;
25820 }
25821 }
25822
25823 if (shouldLoadFont) {
25824 var sc = createTag('link');
25825 sc.setAttribute('f-forigin', fontArr[i].fOrigin);
25826 sc.setAttribute('f-origin', fontArr[i].origin);
25827 sc.setAttribute('rel','stylesheet');
25828 sc.setAttribute('href',fontArr[i].fPath);
25829 defs.appendChild(sc);
25830 }
25831 }
25832 fontArr[i].helper = createHelper(defs,fontArr[i]);
25833 fontArr[i].cache = {};
25834 this.fonts.push(fontArr[i]);
25835 }
25836 if (_pendingFonts === 0) {
25837 this.isLoaded = true;
25838 } else {
25839 //On some cases even if the font is loaded, it won't load correctly when measuring text on canvas.
25840 //Adding this timeout seems to fix it
25841 setTimeout(this.checkLoadedFonts.bind(this), 100);
25842 }
25843 }
25844
25845 function addChars(chars){
25846 if(!chars){
25847 return;
25848 }
25849 if(!this.chars){
25850 this.chars = [];
25851 }
25852 var i, len = chars.length;
25853 var j, jLen = this.chars.length, found;
25854 for(i=0;i<len;i+=1){
25855 j = 0;
25856 found = false;
25857 while(j<jLen){
25858 if(this.chars[j].style === chars[i].style && this.chars[j].fFamily === chars[i].fFamily && this.chars[j].ch === chars[i].ch){
25859 found = true;
25860 }
25861 j += 1;
25862 }
25863 if(!found){
25864 this.chars.push(chars[i]);
25865 jLen += 1;
25866 }
25867 }
25868 }
25869
25870 function getCharData(char, style, font){
25871 var i = 0, len = this.chars.length;
25872 while( i < len) {
25873 if(this.chars[i].ch === char && this.chars[i].style === style && this.chars[i].fFamily === font){
25874 return this.chars[i];
25875 }
25876 i+= 1;
25877 }
25878 if(console && console.warn) {
25879 console.warn('Missing character from exported characters list: ', char, style, font);
25880 }
25881 return emptyChar;
25882 }
25883
25884 function measureText(char, fontName, size) {
25885 var fontData = this.getFontByName(fontName);
25886 var index = char.charCodeAt(0);
25887 if(!fontData.cache[index + 1]) {
25888 var tHelper = fontData.helper;
25889 //Canvas version
25890 //fontData.cache[index] = tHelper.measureText(char).width / 100;
25891 //SVG version
25892 //console.log(tHelper.getBBox().width)
25893 if (char === ' ') {
25894 tHelper.textContent = '|' + char + '|';
25895 var doubleSize = tHelper.getComputedTextLength();
25896 tHelper.textContent = '||';
25897 var singleSize = tHelper.getComputedTextLength();
25898 fontData.cache[index + 1] = (doubleSize - singleSize)/100;
25899 } else {
25900 tHelper.textContent = char;
25901 fontData.cache[index + 1] = (tHelper.getComputedTextLength())/100;
25902 }
25903 }
25904 return fontData.cache[index + 1] * size;
25905 }
25906
25907 function getFontByName(name){
25908 var i = 0, len = this.fonts.length;
25909 while(i<len){
25910 if(this.fonts[i].fName === name) {
25911 return this.fonts[i];
25912 }
25913 i += 1;
25914 }
25915 return this.fonts[0];
25916 }
25917
25918 function getCombinedCharacterCodes() {
25919 return combinedCharacters;
25920 }
25921
25922 function loaded() {
25923 return this.isLoaded;
25924 }
25925
25926 var Font = function(){
25927 this.fonts = [];
25928 this.chars = null;
25929 this.typekitLoaded = 0;
25930 this.isLoaded = false;
25931 this.initTime = Date.now();
25932 };
25933 //TODO: for now I'm adding these methods to the Class and not the prototype. Think of a better way to implement it.
25934 Font.getCombinedCharacterCodes = getCombinedCharacterCodes;
25935
25936 Font.prototype.addChars = addChars;
25937 Font.prototype.addFonts = addFonts;
25938 Font.prototype.getCharData = getCharData;
25939 Font.prototype.getFontByName = getFontByName;
25940 Font.prototype.measureText = measureText;
25941 Font.prototype.checkLoadedFonts = checkLoadedFonts;
25942 Font.prototype.loaded = loaded;
25943
25944 return Font;
25945
25946}());
25947var PropertyFactory = (function(){
25948
25949 var initFrame = initialDefaultFrame;
25950 var math_abs = Math.abs;
25951
25952 function interpolateValue(frameNum, caching) {
25953 var offsetTime = this.offsetTime;
25954 var newValue;
25955 if (this.propType === 'multidimensional') {
25956 newValue = createTypedArray('float32', this.pv.length);
25957 }
25958 var iterationIndex = caching.lastIndex;
25959 var i = iterationIndex;
25960 var len = this.keyframes.length - 1, flag = true;
25961 var keyData, nextKeyData;
25962
25963 while (flag) {
25964 keyData = this.keyframes[i];
25965 nextKeyData = this.keyframes[i + 1];
25966 if (i === len - 1 && frameNum >= nextKeyData.t - offsetTime){
25967 if(keyData.h){
25968 keyData = nextKeyData;
25969 }
25970 iterationIndex = 0;
25971 break;
25972 }
25973 if ((nextKeyData.t - offsetTime) > frameNum){
25974 iterationIndex = i;
25975 break;
25976 }
25977 if (i < len - 1){
25978 i += 1;
25979 } else {
25980 iterationIndex = 0;
25981 flag = false;
25982 }
25983 }
25984
25985 var k, kLen, perc, jLen, j, fnc;
25986 var nextKeyTime = nextKeyData.t - offsetTime;
25987 var keyTime = keyData.t - offsetTime;
25988 var endValue;
25989 if (keyData.to) {
25990 if (!keyData.bezierData) {
25991 keyData.bezierData = bez.buildBezierData(keyData.s, nextKeyData.s || keyData.e, keyData.to, keyData.ti);
25992 }
25993 var bezierData = keyData.bezierData;
25994 if (frameNum >= nextKeyTime || frameNum < keyTime) {
25995 var ind = frameNum >= nextKeyTime ? bezierData.points.length - 1 : 0;
25996 kLen = bezierData.points[ind].point.length;
25997 for (k = 0; k < kLen; k += 1) {
25998 newValue[k] = bezierData.points[ind].point[k];
25999 }
26000 // caching._lastKeyframeIndex = -1;
26001 } else {
26002 if (keyData.__fnct) {
26003 fnc = keyData.__fnct;
26004 } else {
26005 fnc = BezierFactory.getBezierEasing(keyData.o.x, keyData.o.y, keyData.i.x, keyData.i.y, keyData.n).get;
26006 keyData.__fnct = fnc;
26007 }
26008 perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime));
26009 var distanceInLine = bezierData.segmentLength*perc;
26010
26011 var segmentPerc;
26012 var addedLength = (caching.lastFrame < frameNum && caching._lastKeyframeIndex === i) ? caching._lastAddedLength : 0;
26013 j = (caching.lastFrame < frameNum && caching._lastKeyframeIndex === i) ? caching._lastPoint : 0;
26014 flag = true;
26015 jLen = bezierData.points.length;
26016 while (flag) {
26017 addedLength += bezierData.points[j].partialLength;
26018 if (distanceInLine === 0 || perc === 0 || j === bezierData.points.length - 1) {
26019 kLen = bezierData.points[j].point.length;
26020 for (k = 0; k < kLen; k += 1) {
26021 newValue[k] = bezierData.points[j].point[k];
26022 }
26023 break;
26024 } else if (distanceInLine >= addedLength && distanceInLine < addedLength + bezierData.points[j + 1].partialLength) {
26025 segmentPerc = (distanceInLine - addedLength) / bezierData.points[j + 1].partialLength;
26026 kLen = bezierData.points[j].point.length;
26027 for (k = 0; k < kLen; k += 1) {
26028 newValue[k] = bezierData.points[j].point[k] + (bezierData.points[j + 1].point[k] - bezierData.points[j].point[k]) * segmentPerc;
26029 }
26030 break;
26031 }
26032 if (j < jLen - 1){
26033 j += 1;
26034 } else {
26035 flag = false;
26036 }
26037 }
26038 caching._lastPoint = j;
26039 caching._lastAddedLength = addedLength - bezierData.points[j].partialLength;
26040 caching._lastKeyframeIndex = i;
26041 }
26042 } else {
26043 var outX, outY, inX, inY, keyValue;
26044 len = keyData.s.length;
26045 endValue = nextKeyData.s || keyData.e;
26046 if (this.sh && keyData.h !== 1) {
26047 if (frameNum >= nextKeyTime) {
26048 newValue[0] = endValue[0];
26049 newValue[1] = endValue[1];
26050 newValue[2] = endValue[2];
26051 } else if (frameNum <= keyTime) {
26052 newValue[0] = keyData.s[0];
26053 newValue[1] = keyData.s[1];
26054 newValue[2] = keyData.s[2];
26055 } else {
26056 var quatStart = createQuaternion(keyData.s);
26057 var quatEnd = createQuaternion(endValue);
26058 var time = (frameNum - keyTime) / (nextKeyTime - keyTime);
26059 quaternionToEuler(newValue, slerp(quatStart, quatEnd, time));
26060 }
26061
26062 } else {
26063 for(i = 0; i < len; i += 1) {
26064 if (keyData.h !== 1) {
26065 if (frameNum >= nextKeyTime) {
26066 perc = 1;
26067 } else if(frameNum < keyTime) {
26068 perc = 0;
26069 } else {
26070 if(keyData.o.x.constructor === Array) {
26071 if (!keyData.__fnct) {
26072 keyData.__fnct = [];
26073 }
26074 if (!keyData.__fnct[i]) {
26075 outX = (typeof keyData.o.x[i] === 'undefined') ? keyData.o.x[0] : keyData.o.x[i];
26076 outY = (typeof keyData.o.y[i] === 'undefined') ? keyData.o.y[0] : keyData.o.y[i];
26077 inX = (typeof keyData.i.x[i] === 'undefined') ? keyData.i.x[0] : keyData.i.x[i];
26078 inY = (typeof keyData.i.y[i] === 'undefined') ? keyData.i.y[0] : keyData.i.y[i];
26079 fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get;
26080 keyData.__fnct[i] = fnc;
26081 } else {
26082 fnc = keyData.__fnct[i];
26083 }
26084 } else {
26085 if (!keyData.__fnct) {
26086 outX = keyData.o.x;
26087 outY = keyData.o.y;
26088 inX = keyData.i.x;
26089 inY = keyData.i.y;
26090 fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get;
26091 keyData.__fnct = fnc;
26092 } else {
26093 fnc = keyData.__fnct;
26094 }
26095 }
26096 perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime ));
26097 }
26098 }
26099
26100 endValue = nextKeyData.s || keyData.e;
26101 keyValue = keyData.h === 1 ? keyData.s[i] : keyData.s[i] + (endValue[i] - keyData.s[i]) * perc;
26102
26103 if (len === 1) {
26104 newValue = keyValue;
26105 } else {
26106 newValue[i] = keyValue;
26107 }
26108 }
26109 }
26110 }
26111 caching.lastIndex = iterationIndex;
26112 return newValue;
26113 }
26114
26115 //based on @Toji's https://github.com/toji/gl-matrix/
26116 function slerp(a, b, t) {
26117 var out = [];
26118 var ax = a[0], ay = a[1], az = a[2], aw = a[3],
26119 bx = b[0], by = b[1], bz = b[2], bw = b[3];
26120
26121 var omega, cosom, sinom, scale0, scale1;
26122
26123 cosom = ax * bx + ay * by + az * bz + aw * bw;
26124 if (cosom < 0.0) {
26125 cosom = -cosom;
26126 bx = -bx;
26127 by = -by;
26128 bz = -bz;
26129 bw = -bw;
26130 }
26131 if ((1.0 - cosom) > 0.000001) {
26132 omega = Math.acos(cosom);
26133 sinom = Math.sin(omega);
26134 scale0 = Math.sin((1.0 - t) * omega) / sinom;
26135 scale1 = Math.sin(t * omega) / sinom;
26136 } else {
26137 scale0 = 1.0 - t;
26138 scale1 = t;
26139 }
26140 out[0] = scale0 * ax + scale1 * bx;
26141 out[1] = scale0 * ay + scale1 * by;
26142 out[2] = scale0 * az + scale1 * bz;
26143 out[3] = scale0 * aw + scale1 * bw;
26144
26145 return out;
26146 }
26147
26148 function quaternionToEuler(out, quat) {
26149 var qx = quat[0];
26150 var qy = quat[1];
26151 var qz = quat[2];
26152 var qw = quat[3];
26153 var heading = Math.atan2(2*qy*qw-2*qx*qz , 1 - 2*qy*qy - 2*qz*qz);
26154 var attitude = Math.asin(2*qx*qy + 2*qz*qw);
26155 var bank = Math.atan2(2*qx*qw-2*qy*qz , 1 - 2*qx*qx - 2*qz*qz);
26156 out[0] = heading/degToRads;
26157 out[1] = attitude/degToRads;
26158 out[2] = bank/degToRads;
26159 }
26160
26161 function createQuaternion(values) {
26162 var heading = values[0] * degToRads;
26163 var attitude = values[1] * degToRads;
26164 var bank = values[2] * degToRads;
26165 var c1 = Math.cos(heading / 2);
26166 var c2 = Math.cos(attitude / 2);
26167 var c3 = Math.cos(bank / 2);
26168 var s1 = Math.sin(heading / 2);
26169 var s2 = Math.sin(attitude / 2);
26170 var s3 = Math.sin(bank / 2);
26171 var w = c1 * c2 * c3 - s1 * s2 * s3;
26172 var x = s1 * s2 * c3 + c1 * c2 * s3;
26173 var y = s1 * c2 * c3 + c1 * s2 * s3;
26174 var z = c1 * s2 * c3 - s1 * c2 * s3;
26175
26176 return [x,y,z,w];
26177 }
26178
26179 function getValueAtCurrentTime(){
26180 var frameNum = this.comp.renderedFrame - this.offsetTime;
26181 var initTime = this.keyframes[0].t - this.offsetTime;
26182 var endTime = this.keyframes[this.keyframes.length- 1].t-this.offsetTime;
26183 if(!(frameNum === this._caching.lastFrame || (this._caching.lastFrame !== initFrame && ((this._caching.lastFrame >= endTime && frameNum >= endTime) || (this._caching.lastFrame < initTime && frameNum < initTime))))){
26184 if(this._caching.lastFrame >= frameNum) {
26185 this._caching._lastKeyframeIndex = -1;
26186 this._caching.lastIndex = 0;
26187 }
26188
26189 var renderResult = this.interpolateValue(frameNum, this._caching);
26190 this.pv = renderResult;
26191 }
26192 this._caching.lastFrame = frameNum;
26193 return this.pv;
26194 }
26195
26196 function setVValue(val) {
26197 var multipliedValue;
26198 if(this.propType === 'unidimensional') {
26199 multipliedValue = val * this.mult;
26200 if(math_abs(this.v - multipliedValue) > 0.00001) {
26201 this.v = multipliedValue;
26202 this._mdf = true;
26203 }
26204 } else {
26205 var i = 0, len = this.v.length;
26206 while (i < len) {
26207 multipliedValue = val[i] * this.mult;
26208 if (math_abs(this.v[i] - multipliedValue) > 0.00001) {
26209 this.v[i] = multipliedValue;
26210 this._mdf = true;
26211 }
26212 i += 1;
26213 }
26214 }
26215 }
26216
26217 function processEffectsSequence() {
26218 if(this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) {
26219 return;
26220 }
26221 if(this.lock) {
26222 this.setVValue(this.pv);
26223 return;
26224 }
26225 this.lock = true;
26226 this._mdf = this._isFirstFrame;
26227 var i, len = this.effectsSequence.length;
26228 var finalValue = this.kf ? this.pv : this.data.k;
26229 for(i = 0; i < len; i += 1) {
26230 finalValue = this.effectsSequence[i](finalValue);
26231 }
26232 this.setVValue(finalValue);
26233 this._isFirstFrame = false;
26234 this.lock = false;
26235 this.frameId = this.elem.globalData.frameId;
26236 }
26237
26238 function addEffect(effectFunction) {
26239 this.effectsSequence.push(effectFunction);
26240 this.container.addDynamicProperty(this);
26241 }
26242
26243 function ValueProperty(elem, data, mult, container){
26244 this.propType = 'unidimensional';
26245 this.mult = mult || 1;
26246 this.data = data;
26247 this.v = mult ? data.k * mult : data.k;
26248 this.pv = data.k;
26249 this._mdf = false;
26250 this.elem = elem;
26251 this.container = container;
26252 this.comp = elem.comp;
26253 this.k = false;
26254 this.kf = false;
26255 this.vel = 0;
26256 this.effectsSequence = [];
26257 this._isFirstFrame = true;
26258 this.getValue = processEffectsSequence;
26259 this.setVValue = setVValue;
26260 this.addEffect = addEffect;
26261 }
26262
26263 function MultiDimensionalProperty(elem, data, mult, container) {
26264 this.propType = 'multidimensional';
26265 this.mult = mult || 1;
26266 this.data = data;
26267 this._mdf = false;
26268 this.elem = elem;
26269 this.container = container;
26270 this.comp = elem.comp;
26271 this.k = false;
26272 this.kf = false;
26273 this.frameId = -1;
26274 var i, len = data.k.length;
26275 this.v = createTypedArray('float32', len);
26276 this.pv = createTypedArray('float32', len);
26277 var arr = createTypedArray('float32', len);
26278 this.vel = createTypedArray('float32', len);
26279 for (i = 0; i < len; i += 1) {
26280 this.v[i] = data.k[i] * this.mult;
26281 this.pv[i] = data.k[i];
26282 }
26283 this._isFirstFrame = true;
26284 this.effectsSequence = [];
26285 this.getValue = processEffectsSequence;
26286 this.setVValue = setVValue;
26287 this.addEffect = addEffect;
26288 }
26289
26290 function KeyframedValueProperty(elem, data, mult, container) {
26291 this.propType = 'unidimensional';
26292 this.keyframes = data.k;
26293 this.offsetTime = elem.data.st;
26294 this.frameId = -1;
26295 this._caching = {lastFrame: initFrame, lastIndex: 0, value: 0, _lastKeyframeIndex: -1};
26296 this.k = true;
26297 this.kf = true;
26298 this.data = data;
26299 this.mult = mult || 1;
26300 this.elem = elem;
26301 this.container = container;
26302 this.comp = elem.comp;
26303 this.v = initFrame;
26304 this.pv = initFrame;
26305 this._isFirstFrame = true;
26306 this.getValue = processEffectsSequence;
26307 this.setVValue = setVValue;
26308 this.interpolateValue = interpolateValue;
26309 this.effectsSequence = [getValueAtCurrentTime.bind(this)];
26310 this.addEffect = addEffect;
26311 }
26312
26313 function KeyframedMultidimensionalProperty(elem, data, mult, container){
26314 this.propType = 'multidimensional';
26315 var i, len = data.k.length;
26316 var s, e,to,ti;
26317 for (i = 0; i < len - 1; i += 1) {
26318 if (data.k[i].to && data.k[i].s && data.k[i].e) {
26319 s = data.k[i].s;
26320 e = data.k[i].e;
26321 to = data.k[i].to;
26322 ti = data.k[i].ti;
26323 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]))){
26324 data.k[i].to = null;
26325 data.k[i].ti = null;
26326 }
26327 if(s[0] === e[0] && s[1] === e[1] && to[0] === 0 && to[1] === 0 && ti[0] === 0 && ti[1] === 0) {
26328 if(s.length === 2 || (s[2] === e[2] && to[2] === 0 && ti[2] === 0)) {
26329 data.k[i].to = null;
26330 data.k[i].ti = null;
26331 }
26332 }
26333 }
26334 }
26335 this.effectsSequence = [getValueAtCurrentTime.bind(this)];
26336 this.keyframes = data.k;
26337 this.offsetTime = elem.data.st;
26338 this.k = true;
26339 this.kf = true;
26340 this._isFirstFrame = true;
26341 this.mult = mult || 1;
26342 this.elem = elem;
26343 this.container = container;
26344 this.comp = elem.comp;
26345 this.getValue = processEffectsSequence;
26346 this.setVValue = setVValue;
26347 this.interpolateValue = interpolateValue;
26348 this.frameId = -1;
26349 var arrLen = data.k[0].s.length;
26350 this.v = createTypedArray('float32', arrLen);
26351 this.pv = createTypedArray('float32', arrLen);
26352 for (i = 0; i < arrLen; i += 1) {
26353 this.v[i] = initFrame;
26354 this.pv[i] = initFrame;
26355 }
26356 this._caching={lastFrame:initFrame,lastIndex:0,value:createTypedArray('float32', arrLen)};
26357 this.addEffect = addEffect;
26358 }
26359
26360 function getProp(elem,data,type, mult, container) {
26361 var p;
26362 if(!data.k.length){
26363 p = new ValueProperty(elem,data, mult, container);
26364 }else if(typeof(data.k[0]) === 'number'){
26365 p = new MultiDimensionalProperty(elem,data, mult, container);
26366 }else{
26367 switch(type){
26368 case 0:
26369 p = new KeyframedValueProperty(elem,data,mult, container);
26370 break;
26371 case 1:
26372 p = new KeyframedMultidimensionalProperty(elem,data,mult, container);
26373 break;
26374 }
26375 }
26376 if(p.effectsSequence.length){
26377 container.addDynamicProperty(p);
26378 }
26379 return p;
26380 }
26381
26382 var ob = {
26383 getProp: getProp
26384 };
26385 return ob;
26386}());
26387var TransformPropertyFactory = (function() {
26388
26389 function applyToMatrix(mat) {
26390 var _mdf = this._mdf;
26391 this.iterateDynamicProperties();
26392 this._mdf = this._mdf || _mdf;
26393 if (this.a) {
26394 mat.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);
26395 }
26396 if (this.s) {
26397 mat.scale(this.s.v[0], this.s.v[1], this.s.v[2]);
26398 }
26399 if (this.sk) {
26400 mat.skewFromAxis(-this.sk.v, this.sa.v);
26401 }
26402 if (this.r) {
26403 mat.rotate(-this.r.v);
26404 } else {
26405 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]);
26406 }
26407 if (this.data.p.s) {
26408 if (this.data.p.z) {
26409 mat.translate(this.px.v, this.py.v, -this.pz.v);
26410 } else {
26411 mat.translate(this.px.v, this.py.v, 0);
26412 }
26413 } else {
26414 mat.translate(this.p.v[0], this.p.v[1], -this.p.v[2]);
26415 }
26416 }
26417 function processKeys(forceRender){
26418 if (this.elem.globalData.frameId === this.frameId) {
26419 return;
26420 }
26421 if(this._isDirty) {
26422 this.precalculateMatrix();
26423 this._isDirty = false;
26424 }
26425
26426 this.iterateDynamicProperties();
26427
26428 if (this._mdf || forceRender) {
26429 this.v.cloneFromProps(this.pre.props);
26430 if (this.appliedTransformations < 1) {
26431 this.v.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);
26432 }
26433 if(this.appliedTransformations < 2) {
26434 this.v.scale(this.s.v[0], this.s.v[1], this.s.v[2]);
26435 }
26436 if (this.sk && this.appliedTransformations < 3) {
26437 this.v.skewFromAxis(-this.sk.v, this.sa.v);
26438 }
26439 if (this.r && this.appliedTransformations < 4) {
26440 this.v.rotate(-this.r.v);
26441 } else if (!this.r && this.appliedTransformations < 4){
26442 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]);
26443 }
26444 if (this.autoOriented) {
26445 var v1,v2, frameRate = this.elem.globalData.frameRate;
26446 if(this.p && this.p.keyframes && this.p.getValueAtTime) {
26447 if (this.p._caching.lastFrame+this.p.offsetTime <= this.p.keyframes[0].t) {
26448 v1 = this.p.getValueAtTime((this.p.keyframes[0].t + 0.01) / frameRate,0);
26449 v2 = this.p.getValueAtTime(this.p.keyframes[0].t / frameRate, 0);
26450 } else if(this.p._caching.lastFrame+this.p.offsetTime >= this.p.keyframes[this.p.keyframes.length - 1].t) {
26451 v1 = this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length - 1].t / frameRate), 0);
26452 v2 = this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length - 1].t - 0.01) / frameRate, 0);
26453 } else {
26454 v1 = this.p.pv;
26455 v2 = this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime - 0.01) / frameRate, this.p.offsetTime);
26456 }
26457 } else if(this.px && this.px.keyframes && this.py.keyframes && this.px.getValueAtTime && this.py.getValueAtTime) {
26458 v1 = [];
26459 v2 = [];
26460 var px = this.px, py = this.py, frameRate;
26461 if (px._caching.lastFrame+px.offsetTime <= px.keyframes[0].t) {
26462 v1[0] = px.getValueAtTime((px.keyframes[0].t + 0.01) / frameRate,0);
26463 v1[1] = py.getValueAtTime((py.keyframes[0].t + 0.01) / frameRate,0);
26464 v2[0] = px.getValueAtTime((px.keyframes[0].t) / frameRate,0);
26465 v2[1] = py.getValueAtTime((py.keyframes[0].t) / frameRate,0);
26466 } else if(px._caching.lastFrame+px.offsetTime >= px.keyframes[px.keyframes.length - 1].t) {
26467 v1[0] = px.getValueAtTime((px.keyframes[px.keyframes.length - 1].t / frameRate),0);
26468 v1[1] = py.getValueAtTime((py.keyframes[py.keyframes.length - 1].t / frameRate),0);
26469 v2[0] = px.getValueAtTime((px.keyframes[px.keyframes.length - 1].t - 0.01) / frameRate,0);
26470 v2[1] = py.getValueAtTime((py.keyframes[py.keyframes.length - 1].t - 0.01) / frameRate,0);
26471 } else {
26472 v1 = [px.pv, py.pv];
26473 v2[0] = px.getValueAtTime((px._caching.lastFrame+px.offsetTime - 0.01) / frameRate,px.offsetTime);
26474 v2[1] = py.getValueAtTime((py._caching.lastFrame+py.offsetTime - 0.01) / frameRate,py.offsetTime);
26475 }
26476 }
26477 this.v.rotate(-Math.atan2(v1[1] - v2[1], v1[0] - v2[0]));
26478 }
26479 if(this.data.p && this.data.p.s){
26480 if(this.data.p.z) {
26481 this.v.translate(this.px.v, this.py.v, -this.pz.v);
26482 } else {
26483 this.v.translate(this.px.v, this.py.v, 0);
26484 }
26485 }else{
26486 this.v.translate(this.p.v[0],this.p.v[1],-this.p.v[2]);
26487 }
26488 }
26489 this.frameId = this.elem.globalData.frameId;
26490 }
26491
26492 function precalculateMatrix() {
26493 if(!this.a.k) {
26494 this.pre.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);
26495 this.appliedTransformations = 1;
26496 } else {
26497 return;
26498 }
26499 if(!this.s.effectsSequence.length) {
26500 this.pre.scale(this.s.v[0], this.s.v[1], this.s.v[2]);
26501 this.appliedTransformations = 2;
26502 } else {
26503 return;
26504 }
26505 if(this.sk) {
26506 if(!this.sk.effectsSequence.length && !this.sa.effectsSequence.length) {
26507 this.pre.skewFromAxis(-this.sk.v, this.sa.v);
26508 this.appliedTransformations = 3;
26509 } else {
26510 return;
26511 }
26512 }
26513 if (this.r) {
26514 if(!this.r.effectsSequence.length) {
26515 this.pre.rotate(-this.r.v);
26516 this.appliedTransformations = 4;
26517 } else {
26518 return;
26519 }
26520 } else if(!this.rz.effectsSequence.length && !this.ry.effectsSequence.length && !this.rx.effectsSequence.length && !this.or.effectsSequence.length) {
26521 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]);
26522 this.appliedTransformations = 4;
26523 }
26524 }
26525
26526 function autoOrient(){
26527 //
26528 //var prevP = this.getValueAtTime();
26529 }
26530
26531 function addDynamicProperty(prop) {
26532 this._addDynamicProperty(prop);
26533 this.elem.addDynamicProperty(prop);
26534 this._isDirty = true;
26535 }
26536
26537 function TransformProperty(elem,data,container){
26538 this.elem = elem;
26539 this.frameId = -1;
26540 this.propType = 'transform';
26541 this.data = data;
26542 this.v = new Matrix();
26543 //Precalculated matrix with non animated properties
26544 this.pre = new Matrix();
26545 this.appliedTransformations = 0;
26546 this.initDynamicPropertyContainer(container || elem);
26547 if(data.p && data.p.s){
26548 this.px = PropertyFactory.getProp(elem,data.p.x,0,0,this);
26549 this.py = PropertyFactory.getProp(elem,data.p.y,0,0,this);
26550 if(data.p.z){
26551 this.pz = PropertyFactory.getProp(elem,data.p.z,0,0,this);
26552 }
26553 }else{
26554 this.p = PropertyFactory.getProp(elem,data.p || {k:[0,0,0]},1,0,this);
26555 }
26556 if(data.rx) {
26557 this.rx = PropertyFactory.getProp(elem, data.rx, 0, degToRads, this);
26558 this.ry = PropertyFactory.getProp(elem, data.ry, 0, degToRads, this);
26559 this.rz = PropertyFactory.getProp(elem, data.rz, 0, degToRads, this);
26560 if(data.or.k[0].ti) {
26561 var i, len = data.or.k.length;
26562 for(i=0;i<len;i+=1) {
26563 data.or.k[i].to = data.or.k[i].ti = null;
26564 }
26565 }
26566 this.or = PropertyFactory.getProp(elem, data.or, 1, degToRads, this);
26567 //sh Indicates it needs to be capped between -180 and 180
26568 this.or.sh = true;
26569 } else {
26570 this.r = PropertyFactory.getProp(elem, data.r || {k: 0}, 0, degToRads, this);
26571 }
26572 if(data.sk){
26573 this.sk = PropertyFactory.getProp(elem, data.sk, 0, degToRads, this);
26574 this.sa = PropertyFactory.getProp(elem, data.sa, 0, degToRads, this);
26575 }
26576 this.a = PropertyFactory.getProp(elem,data.a || {k:[0,0,0]},1,0,this);
26577 this.s = PropertyFactory.getProp(elem,data.s || {k:[100,100,100]},1,0.01,this);
26578 // 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.
26579 if(data.o){
26580 this.o = PropertyFactory.getProp(elem,data.o,0,0.01,elem);
26581 } else {
26582 this.o = {_mdf:false,v:1};
26583 }
26584 this._isDirty = true;
26585 if(!this.dynamicProperties.length){
26586 this.getValue(true);
26587 }
26588 }
26589
26590 TransformProperty.prototype = {
26591 applyToMatrix: applyToMatrix,
26592 getValue: processKeys,
26593 precalculateMatrix: precalculateMatrix,
26594 autoOrient: autoOrient
26595 };
26596
26597 extendPrototype([DynamicPropertyContainer], TransformProperty);
26598 TransformProperty.prototype.addDynamicProperty = addDynamicProperty;
26599 TransformProperty.prototype._addDynamicProperty = DynamicPropertyContainer.prototype.addDynamicProperty;
26600
26601 function getTransformProperty(elem,data,container){
26602 return new TransformProperty(elem,data,container);
26603 }
26604
26605 return {
26606 getTransformProperty: getTransformProperty
26607 };
26608
26609}());
26610function ShapePath(){
26611 this.c = false;
26612 this._length = 0;
26613 this._maxLength = 8;
26614 this.v = createSizedArray(this._maxLength);
26615 this.o = createSizedArray(this._maxLength);
26616 this.i = createSizedArray(this._maxLength);
26617}
26618
26619ShapePath.prototype.setPathData = function(closed, len) {
26620 this.c = closed;
26621 this.setLength(len);
26622 var i = 0;
26623 while(i < len){
26624 this.v[i] = point_pool.newElement();
26625 this.o[i] = point_pool.newElement();
26626 this.i[i] = point_pool.newElement();
26627 i += 1;
26628 }
26629};
26630
26631ShapePath.prototype.setLength = function(len) {
26632 while(this._maxLength < len) {
26633 this.doubleArrayLength();
26634 }
26635 this._length = len;
26636};
26637
26638ShapePath.prototype.doubleArrayLength = function() {
26639 this.v = this.v.concat(createSizedArray(this._maxLength));
26640 this.i = this.i.concat(createSizedArray(this._maxLength));
26641 this.o = this.o.concat(createSizedArray(this._maxLength));
26642 this._maxLength *= 2;
26643};
26644
26645ShapePath.prototype.setXYAt = function(x, y, type, pos, replace) {
26646 var arr;
26647 this._length = Math.max(this._length, pos + 1);
26648 if(this._length >= this._maxLength) {
26649 this.doubleArrayLength();
26650 }
26651 switch(type){
26652 case 'v':
26653 arr = this.v;
26654 break;
26655 case 'i':
26656 arr = this.i;
26657 break;
26658 case 'o':
26659 arr = this.o;
26660 break;
26661 }
26662 if(!arr[pos] || (arr[pos] && !replace)){
26663 arr[pos] = point_pool.newElement();
26664 }
26665 arr[pos][0] = x;
26666 arr[pos][1] = y;
26667};
26668
26669ShapePath.prototype.setTripleAt = function(vX,vY,oX,oY,iX,iY,pos, replace) {
26670 this.setXYAt(vX,vY,'v',pos, replace);
26671 this.setXYAt(oX,oY,'o',pos, replace);
26672 this.setXYAt(iX,iY,'i',pos, replace);
26673};
26674
26675ShapePath.prototype.reverse = function() {
26676 var newPath = new ShapePath();
26677 newPath.setPathData(this.c, this._length);
26678 var vertices = this.v, outPoints = this.o, inPoints = this.i;
26679 var init = 0;
26680 if (this.c) {
26681 newPath.setTripleAt(vertices[0][0], vertices[0][1], inPoints[0][0], inPoints[0][1], outPoints[0][0], outPoints[0][1], 0, false);
26682 init = 1;
26683 }
26684 var cnt = this._length - 1;
26685 var len = this._length;
26686
26687 var i;
26688 for (i = init; i < len; i += 1) {
26689 newPath.setTripleAt(vertices[cnt][0], vertices[cnt][1], inPoints[cnt][0], inPoints[cnt][1], outPoints[cnt][0], outPoints[cnt][1], i, false);
26690 cnt -= 1;
26691 }
26692 return newPath;
26693};
26694var ShapePropertyFactory = (function(){
26695
26696 var initFrame = -999999;
26697
26698 function interpolateShape(frameNum, previousValue, caching) {
26699 var iterationIndex = caching.lastIndex;
26700 var keyPropS,keyPropE,isHold, j, k, jLen, kLen, perc, vertexValue;
26701 var kf = this.keyframes;
26702 if(frameNum < kf[0].t-this.offsetTime){
26703 keyPropS = kf[0].s[0];
26704 isHold = true;
26705 iterationIndex = 0;
26706 }else if(frameNum >= kf[kf.length - 1].t-this.offsetTime){
26707 keyPropS = kf[kf.length - 1].s ? kf[kf.length - 1].s[0] : kf[kf.length - 2].e[0];
26708 /*if(kf[kf.length - 1].s){
26709 keyPropS = kf[kf.length - 1].s[0];
26710 }else{
26711 keyPropS = kf[kf.length - 2].e[0];
26712 }*/
26713 isHold = true;
26714 }else{
26715 var i = iterationIndex;
26716 var len = kf.length- 1,flag = true,keyData,nextKeyData;
26717 while(flag){
26718 keyData = kf[i];
26719 nextKeyData = kf[i+1];
26720 if((nextKeyData.t - this.offsetTime) > frameNum){
26721 break;
26722 }
26723 if(i < len - 1){
26724 i += 1;
26725 }else{
26726 flag = false;
26727 }
26728 }
26729 isHold = keyData.h === 1;
26730 iterationIndex = i;
26731 if(!isHold){
26732 if(frameNum >= nextKeyData.t-this.offsetTime){
26733 perc = 1;
26734 }else if(frameNum < keyData.t-this.offsetTime){
26735 perc = 0;
26736 }else{
26737 var fnc;
26738 if(keyData.__fnct){
26739 fnc = keyData.__fnct;
26740 }else{
26741 fnc = BezierFactory.getBezierEasing(keyData.o.x,keyData.o.y,keyData.i.x,keyData.i.y).get;
26742 keyData.__fnct = fnc;
26743 }
26744 perc = fnc((frameNum-(keyData.t-this.offsetTime))/((nextKeyData.t-this.offsetTime)-(keyData.t-this.offsetTime)));
26745 }
26746 keyPropE = nextKeyData.s ? nextKeyData.s[0] : keyData.e[0];
26747 }
26748 keyPropS = keyData.s[0];
26749 }
26750 jLen = previousValue._length;
26751 kLen = keyPropS.i[0].length;
26752 caching.lastIndex = iterationIndex;
26753
26754 for(j=0;j<jLen;j+=1){
26755 for(k=0;k<kLen;k+=1){
26756 vertexValue = isHold ? keyPropS.i[j][k] : keyPropS.i[j][k]+(keyPropE.i[j][k]-keyPropS.i[j][k])*perc;
26757 previousValue.i[j][k] = vertexValue;
26758 vertexValue = isHold ? keyPropS.o[j][k] : keyPropS.o[j][k]+(keyPropE.o[j][k]-keyPropS.o[j][k])*perc;
26759 previousValue.o[j][k] = vertexValue;
26760 vertexValue = isHold ? keyPropS.v[j][k] : keyPropS.v[j][k]+(keyPropE.v[j][k]-keyPropS.v[j][k])*perc;
26761 previousValue.v[j][k] = vertexValue;
26762 }
26763 }
26764 }
26765
26766 function interpolateShapeCurrentTime(){
26767 var frameNum = this.comp.renderedFrame - this.offsetTime;
26768 var initTime = this.keyframes[0].t - this.offsetTime;
26769 var endTime = this.keyframes[this.keyframes.length - 1].t - this.offsetTime;
26770 var lastFrame = this._caching.lastFrame;
26771 if(!(lastFrame !== initFrame && ((lastFrame < initTime && frameNum < initTime) || (lastFrame > endTime && frameNum > endTime)))){
26772 ////
26773 this._caching.lastIndex = lastFrame < frameNum ? this._caching.lastIndex : 0;
26774 this.interpolateShape(frameNum, this.pv, this._caching);
26775 ////
26776 }
26777 this._caching.lastFrame = frameNum;
26778 return this.pv;
26779 }
26780
26781 function resetShape(){
26782 this.paths = this.localShapeCollection;
26783 }
26784
26785 function shapesEqual(shape1, shape2) {
26786 if(shape1._length !== shape2._length || shape1.c !== shape2.c){
26787 return false;
26788 }
26789 var i, len = shape1._length;
26790 for(i = 0; i < len; i += 1) {
26791 if(shape1.v[i][0] !== shape2.v[i][0]
26792 || shape1.v[i][1] !== shape2.v[i][1]
26793 || shape1.o[i][0] !== shape2.o[i][0]
26794 || shape1.o[i][1] !== shape2.o[i][1]
26795 || shape1.i[i][0] !== shape2.i[i][0]
26796 || shape1.i[i][1] !== shape2.i[i][1]) {
26797 return false;
26798 }
26799 }
26800 return true;
26801 }
26802
26803 function setVValue(newPath) {
26804 if(!shapesEqual(this.v, newPath)) {
26805 this.v = shape_pool.clone(newPath);
26806 this.localShapeCollection.releaseShapes();
26807 this.localShapeCollection.addShape(this.v);
26808 this._mdf = true;
26809 this.paths = this.localShapeCollection;
26810 }
26811 }
26812
26813 function processEffectsSequence() {
26814 if(this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) {
26815 return;
26816 }
26817 if(this.lock) {
26818 this.setVValue(this.pv);
26819 return;
26820 }
26821 this.lock = true;
26822 this._mdf = false;
26823 var finalValue = this.kf ? this.pv : this.data.ks ? this.data.ks.k : this.data.pt.k;
26824 var i, len = this.effectsSequence.length;
26825 for(i = 0; i < len; i += 1) {
26826 finalValue = this.effectsSequence[i](finalValue);
26827 }
26828 this.setVValue(finalValue);
26829 this.lock = false;
26830 this.frameId = this.elem.globalData.frameId;
26831 }
26832 function ShapeProperty(elem, data, type){
26833 this.propType = 'shape';
26834 this.comp = elem.comp;
26835 this.container = elem;
26836 this.elem = elem;
26837 this.data = data;
26838 this.k = false;
26839 this.kf = false;
26840 this._mdf = false;
26841 var pathData = type === 3 ? data.pt.k : data.ks.k;
26842 this.v = shape_pool.clone(pathData);
26843 this.pv = shape_pool.clone(this.v);
26844 this.localShapeCollection = shapeCollection_pool.newShapeCollection();
26845 this.paths = this.localShapeCollection;
26846 this.paths.addShape(this.v);
26847 this.reset = resetShape;
26848 this.effectsSequence = [];
26849 }
26850
26851 function addEffect(effectFunction) {
26852 this.effectsSequence.push(effectFunction);
26853 this.container.addDynamicProperty(this);
26854 }
26855
26856 ShapeProperty.prototype.interpolateShape = interpolateShape;
26857 ShapeProperty.prototype.getValue = processEffectsSequence;
26858 ShapeProperty.prototype.setVValue = setVValue;
26859 ShapeProperty.prototype.addEffect = addEffect;
26860
26861 function KeyframedShapeProperty(elem,data,type){
26862 this.propType = 'shape';
26863 this.comp = elem.comp;
26864 this.elem = elem;
26865 this.container = elem;
26866 this.offsetTime = elem.data.st;
26867 this.keyframes = type === 3 ? data.pt.k : data.ks.k;
26868 this.k = true;
26869 this.kf = true;
26870 var len = this.keyframes[0].s[0].i.length;
26871 var jLen = this.keyframes[0].s[0].i[0].length;
26872 this.v = shape_pool.newElement();
26873 this.v.setPathData(this.keyframes[0].s[0].c, len);
26874 this.pv = shape_pool.clone(this.v);
26875 this.localShapeCollection = shapeCollection_pool.newShapeCollection();
26876 this.paths = this.localShapeCollection;
26877 this.paths.addShape(this.v);
26878 this.lastFrame = initFrame;
26879 this.reset = resetShape;
26880 this._caching = {lastFrame: initFrame, lastIndex: 0};
26881 this.effectsSequence = [interpolateShapeCurrentTime.bind(this)];
26882 }
26883 KeyframedShapeProperty.prototype.getValue = processEffectsSequence;
26884 KeyframedShapeProperty.prototype.interpolateShape = interpolateShape;
26885 KeyframedShapeProperty.prototype.setVValue = setVValue;
26886 KeyframedShapeProperty.prototype.addEffect = addEffect;
26887
26888 var EllShapeProperty = (function(){
26889
26890 var cPoint = roundCorner;
26891
26892 function EllShapeProperty(elem,data) {
26893 /*this.v = {
26894 v: createSizedArray(4),
26895 i: createSizedArray(4),
26896 o: createSizedArray(4),
26897 c: true
26898 };*/
26899 this.v = shape_pool.newElement();
26900 this.v.setPathData(true, 4);
26901 this.localShapeCollection = shapeCollection_pool.newShapeCollection();
26902 this.paths = this.localShapeCollection;
26903 this.localShapeCollection.addShape(this.v);
26904 this.d = data.d;
26905 this.elem = elem;
26906 this.comp = elem.comp;
26907 this.frameId = -1;
26908 this.initDynamicPropertyContainer(elem);
26909 this.p = PropertyFactory.getProp(elem,data.p,1,0,this);
26910 this.s = PropertyFactory.getProp(elem,data.s,1,0,this);
26911 if(this.dynamicProperties.length){
26912 this.k = true;
26913 }else{
26914 this.k = false;
26915 this.convertEllToPath();
26916 }
26917 }
26918 EllShapeProperty.prototype = {
26919 reset: resetShape,
26920 getValue: function (){
26921 if(this.elem.globalData.frameId === this.frameId){
26922 return;
26923 }
26924 this.frameId = this.elem.globalData.frameId;
26925 this.iterateDynamicProperties();
26926
26927 if(this._mdf){
26928 this.convertEllToPath();
26929 }
26930 },
26931 convertEllToPath: function() {
26932 var p0 = this.p.v[0], p1 = this.p.v[1], s0 = this.s.v[0]/2, s1 = this.s.v[1]/2;
26933 var _cw = this.d !== 3;
26934 var _v = this.v;
26935 _v.v[0][0] = p0;
26936 _v.v[0][1] = p1 - s1;
26937 _v.v[1][0] = _cw ? p0 + s0 : p0 - s0;
26938 _v.v[1][1] = p1;
26939 _v.v[2][0] = p0;
26940 _v.v[2][1] = p1 + s1;
26941 _v.v[3][0] = _cw ? p0 - s0 : p0 + s0;
26942 _v.v[3][1] = p1;
26943 _v.i[0][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint;
26944 _v.i[0][1] = p1 - s1;
26945 _v.i[1][0] = _cw ? p0 + s0 : p0 - s0;
26946 _v.i[1][1] = p1 - s1 * cPoint;
26947 _v.i[2][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint;
26948 _v.i[2][1] = p1 + s1;
26949 _v.i[3][0] = _cw ? p0 - s0 : p0 + s0;
26950 _v.i[3][1] = p1 + s1 * cPoint;
26951 _v.o[0][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint;
26952 _v.o[0][1] = p1 - s1;
26953 _v.o[1][0] = _cw ? p0 + s0 : p0 - s0;
26954 _v.o[1][1] = p1 + s1 * cPoint;
26955 _v.o[2][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint;
26956 _v.o[2][1] = p1 + s1;
26957 _v.o[3][0] = _cw ? p0 - s0 : p0 + s0;
26958 _v.o[3][1] = p1 - s1 * cPoint;
26959 }
26960 };
26961
26962 extendPrototype([DynamicPropertyContainer], EllShapeProperty);
26963
26964 return EllShapeProperty;
26965 }());
26966
26967 var StarShapeProperty = (function() {
26968
26969 function StarShapeProperty(elem,data) {
26970 this.v = shape_pool.newElement();
26971 this.v.setPathData(true, 0);
26972 this.elem = elem;
26973 this.comp = elem.comp;
26974 this.data = data;
26975 this.frameId = -1;
26976 this.d = data.d;
26977 this.initDynamicPropertyContainer(elem);
26978 if(data.sy === 1){
26979 this.ir = PropertyFactory.getProp(elem,data.ir,0,0,this);
26980 this.is = PropertyFactory.getProp(elem,data.is,0,0.01,this);
26981 this.convertToPath = this.convertStarToPath;
26982 } else {
26983 this.convertToPath = this.convertPolygonToPath;
26984 }
26985 this.pt = PropertyFactory.getProp(elem,data.pt,0,0,this);
26986 this.p = PropertyFactory.getProp(elem,data.p,1,0,this);
26987 this.r = PropertyFactory.getProp(elem,data.r,0,degToRads,this);
26988 this.or = PropertyFactory.getProp(elem,data.or,0,0,this);
26989 this.os = PropertyFactory.getProp(elem,data.os,0,0.01,this);
26990 this.localShapeCollection = shapeCollection_pool.newShapeCollection();
26991 this.localShapeCollection.addShape(this.v);
26992 this.paths = this.localShapeCollection;
26993 if(this.dynamicProperties.length){
26994 this.k = true;
26995 }else{
26996 this.k = false;
26997 this.convertToPath();
26998 }
26999 }
27000 StarShapeProperty.prototype = {
27001 reset: resetShape,
27002 getValue: function() {
27003 if(this.elem.globalData.frameId === this.frameId){
27004 return;
27005 }
27006 this.frameId = this.elem.globalData.frameId;
27007 this.iterateDynamicProperties();
27008 if(this._mdf){
27009 this.convertToPath();
27010 }
27011 },
27012 convertStarToPath: function() {
27013 var numPts = Math.floor(this.pt.v)*2;
27014 var angle = Math.PI*2/numPts;
27015 /*this.v.v.length = numPts;
27016 this.v.i.length = numPts;
27017 this.v.o.length = numPts;*/
27018 var longFlag = true;
27019 var longRad = this.or.v;
27020 var shortRad = this.ir.v;
27021 var longRound = this.os.v;
27022 var shortRound = this.is.v;
27023 var longPerimSegment = 2*Math.PI*longRad/(numPts*2);
27024 var shortPerimSegment = 2*Math.PI*shortRad/(numPts*2);
27025 var i, rad,roundness,perimSegment, currentAng = -Math.PI/ 2;
27026 currentAng += this.r.v;
27027 var dir = this.data.d === 3 ? -1 : 1;
27028 this.v._length = 0;
27029 for(i=0;i<numPts;i+=1){
27030 rad = longFlag ? longRad : shortRad;
27031 roundness = longFlag ? longRound : shortRound;
27032 perimSegment = longFlag ? longPerimSegment : shortPerimSegment;
27033 var x = rad * Math.cos(currentAng);
27034 var y = rad * Math.sin(currentAng);
27035 var ox = x === 0 && y === 0 ? 0 : y/Math.sqrt(x*x + y*y);
27036 var oy = x === 0 && y === 0 ? 0 : -x/Math.sqrt(x*x + y*y);
27037 x += + this.p.v[0];
27038 y += + this.p.v[1];
27039 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);
27040
27041 /*this.v.v[i] = [x,y];
27042 this.v.i[i] = [x+ox*perimSegment*roundness*dir,y+oy*perimSegment*roundness*dir];
27043 this.v.o[i] = [x-ox*perimSegment*roundness*dir,y-oy*perimSegment*roundness*dir];
27044 this.v._length = numPts;*/
27045 longFlag = !longFlag;
27046 currentAng += angle*dir;
27047 }
27048 },
27049 convertPolygonToPath: function() {
27050 var numPts = Math.floor(this.pt.v);
27051 var angle = Math.PI*2/numPts;
27052 var rad = this.or.v;
27053 var roundness = this.os.v;
27054 var perimSegment = 2*Math.PI*rad/(numPts*4);
27055 var i, currentAng = -Math.PI/ 2;
27056 var dir = this.data.d === 3 ? -1 : 1;
27057 currentAng += this.r.v;
27058 this.v._length = 0;
27059 for(i=0;i<numPts;i+=1){
27060 var x = rad * Math.cos(currentAng);
27061 var y = rad * Math.sin(currentAng);
27062 var ox = x === 0 && y === 0 ? 0 : y/Math.sqrt(x*x + y*y);
27063 var oy = x === 0 && y === 0 ? 0 : -x/Math.sqrt(x*x + y*y);
27064 x += + this.p.v[0];
27065 y += + this.p.v[1];
27066 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);
27067 currentAng += angle*dir;
27068 }
27069 this.paths.length = 0;
27070 this.paths[0] = this.v;
27071 }
27072
27073 };
27074 extendPrototype([DynamicPropertyContainer], StarShapeProperty);
27075
27076 return StarShapeProperty;
27077 }());
27078
27079 var RectShapeProperty = (function() {
27080
27081 function RectShapeProperty(elem,data) {
27082 this.v = shape_pool.newElement();
27083 this.v.c = true;
27084 this.localShapeCollection = shapeCollection_pool.newShapeCollection();
27085 this.localShapeCollection.addShape(this.v);
27086 this.paths = this.localShapeCollection;
27087 this.elem = elem;
27088 this.comp = elem.comp;
27089 this.frameId = -1;
27090 this.d = data.d;
27091 this.initDynamicPropertyContainer(elem);
27092 this.p = PropertyFactory.getProp(elem,data.p,1,0,this);
27093 this.s = PropertyFactory.getProp(elem,data.s,1,0,this);
27094 this.r = PropertyFactory.getProp(elem,data.r,0,0,this);
27095 if(this.dynamicProperties.length){
27096 this.k = true;
27097 }else{
27098 this.k = false;
27099 this.convertRectToPath();
27100 }
27101 }
27102 RectShapeProperty.prototype = {
27103 convertRectToPath: function (){
27104 var p0 = this.p.v[0], p1 = this.p.v[1], v0 = this.s.v[0]/2, v1 = this.s.v[1]/2;
27105 var round = bm_min(v0,v1,this.r.v);
27106 var cPoint = round*(1-roundCorner);
27107 this.v._length = 0;
27108
27109 if(this.d === 2 || this.d === 1) {
27110 this.v.setTripleAt(p0+v0, p1-v1+round,p0+v0, p1-v1+round,p0+v0,p1-v1+cPoint,0, true);
27111 this.v.setTripleAt(p0+v0, p1+v1-round,p0+v0, p1+v1-cPoint,p0+v0, p1+v1-round,1, true);
27112 if(round!== 0){
27113 this.v.setTripleAt(p0+v0-round, p1+v1,p0+v0-round,p1+v1,p0+v0-cPoint,p1+v1,2, true);
27114 this.v.setTripleAt(p0-v0+round,p1+v1,p0-v0+cPoint,p1+v1,p0-v0+round,p1+v1,3, true);
27115 this.v.setTripleAt(p0-v0,p1+v1-round,p0-v0,p1+v1-round,p0-v0,p1+v1-cPoint,4, true);
27116 this.v.setTripleAt(p0-v0,p1-v1+round,p0-v0,p1-v1+cPoint,p0-v0,p1-v1+round,5, true);
27117 this.v.setTripleAt(p0-v0+round,p1-v1,p0-v0+round,p1-v1,p0-v0+cPoint,p1-v1,6, true);
27118 this.v.setTripleAt(p0+v0-round,p1-v1,p0+v0-cPoint,p1-v1,p0+v0-round,p1-v1,7, true);
27119 } else {
27120 this.v.setTripleAt(p0-v0,p1+v1,p0-v0+cPoint,p1+v1,p0-v0,p1+v1,2);
27121 this.v.setTripleAt(p0-v0,p1-v1,p0-v0,p1-v1+cPoint,p0-v0,p1-v1,3);
27122 }
27123 }else{
27124 this.v.setTripleAt(p0+v0,p1-v1+round,p0+v0,p1-v1+cPoint,p0+v0,p1-v1+round,0, true);
27125 if(round!== 0){
27126 this.v.setTripleAt(p0+v0-round,p1-v1,p0+v0-round,p1-v1,p0+v0-cPoint,p1-v1,1, true);
27127 this.v.setTripleAt(p0-v0+round,p1-v1,p0-v0+cPoint,p1-v1,p0-v0+round,p1-v1,2, true);
27128 this.v.setTripleAt(p0-v0,p1-v1+round,p0-v0,p1-v1+round,p0-v0,p1-v1+cPoint,3, true);
27129 this.v.setTripleAt(p0-v0,p1+v1-round,p0-v0,p1+v1-cPoint,p0-v0,p1+v1-round,4, true);
27130 this.v.setTripleAt(p0-v0+round,p1+v1,p0-v0+round,p1+v1,p0-v0+cPoint,p1+v1,5, true);
27131 this.v.setTripleAt(p0+v0-round,p1+v1,p0+v0-cPoint,p1+v1,p0+v0-round,p1+v1,6, true);
27132 this.v.setTripleAt(p0+v0,p1+v1-round,p0+v0,p1+v1-round,p0+v0,p1+v1-cPoint,7, true);
27133 } else {
27134 this.v.setTripleAt(p0-v0,p1-v1,p0-v0+cPoint,p1-v1,p0-v0,p1-v1,1, true);
27135 this.v.setTripleAt(p0-v0,p1+v1,p0-v0,p1+v1-cPoint,p0-v0,p1+v1,2, true);
27136 this.v.setTripleAt(p0+v0,p1+v1,p0+v0-cPoint,p1+v1,p0+v0,p1+v1,3, true);
27137
27138 }
27139 }
27140 },
27141 getValue: function(frameNum){
27142 if(this.elem.globalData.frameId === this.frameId){
27143 return;
27144 }
27145 this.frameId = this.elem.globalData.frameId;
27146 this.iterateDynamicProperties();
27147 if(this._mdf){
27148 this.convertRectToPath();
27149 }
27150
27151 },
27152 reset: resetShape
27153 };
27154 extendPrototype([DynamicPropertyContainer], RectShapeProperty);
27155
27156 return RectShapeProperty;
27157 }());
27158
27159 function getShapeProp(elem,data,type){
27160 var prop;
27161 if(type === 3 || type === 4){
27162 var dataProp = type === 3 ? data.pt : data.ks;
27163 var keys = dataProp.k;
27164 if(keys.length){
27165 prop = new KeyframedShapeProperty(elem, data, type);
27166 }else{
27167 prop = new ShapeProperty(elem, data, type);
27168 }
27169 }else if(type === 5){
27170 prop = new RectShapeProperty(elem, data);
27171 }else if(type === 6){
27172 prop = new EllShapeProperty(elem, data);
27173 }else if(type === 7){
27174 prop = new StarShapeProperty(elem, data);
27175 }
27176 if(prop.k){
27177 elem.addDynamicProperty(prop);
27178 }
27179 return prop;
27180 }
27181
27182 function getConstructorFunction() {
27183 return ShapeProperty;
27184 }
27185
27186 function getKeyframedConstructorFunction() {
27187 return KeyframedShapeProperty;
27188 }
27189
27190 var ob = {};
27191 ob.getShapeProp = getShapeProp;
27192 ob.getConstructorFunction = getConstructorFunction;
27193 ob.getKeyframedConstructorFunction = getKeyframedConstructorFunction;
27194 return ob;
27195}());
27196var ShapeModifiers = (function(){
27197 var ob = {};
27198 var modifiers = {};
27199 ob.registerModifier = registerModifier;
27200 ob.getModifier = getModifier;
27201
27202 function registerModifier(nm,factory){
27203 if(!modifiers[nm]){
27204 modifiers[nm] = factory;
27205 }
27206 }
27207
27208 function getModifier(nm,elem, data){
27209 return new modifiers[nm](elem, data);
27210 }
27211
27212 return ob;
27213}());
27214
27215function ShapeModifier(){}
27216ShapeModifier.prototype.initModifierProperties = function(){};
27217ShapeModifier.prototype.addShapeToModifier = function(){};
27218ShapeModifier.prototype.addShape = function(data){
27219 if(!this.closed){
27220 var shapeData = {shape:data.sh, data: data, localShapeCollection:shapeCollection_pool.newShapeCollection()};
27221 this.shapes.push(shapeData);
27222 this.addShapeToModifier(shapeData);
27223 if(this._isAnimated) {
27224 data.setAsAnimated();
27225 }
27226 }
27227};
27228ShapeModifier.prototype.init = function(elem,data){
27229 this.shapes = [];
27230 this.elem = elem;
27231 this.initDynamicPropertyContainer(elem);
27232 this.initModifierProperties(elem,data);
27233 this.frameId = initialDefaultFrame;
27234 this.closed = false;
27235 this.k = false;
27236 if(this.dynamicProperties.length){
27237 this.k = true;
27238 }else{
27239 this.getValue(true);
27240 }
27241};
27242ShapeModifier.prototype.processKeys = function(){
27243 if(this.elem.globalData.frameId === this.frameId){
27244 return;
27245 }
27246 this.frameId = this.elem.globalData.frameId;
27247 this.iterateDynamicProperties();
27248};
27249
27250extendPrototype([DynamicPropertyContainer], ShapeModifier);
27251function TrimModifier(){
27252}
27253extendPrototype([ShapeModifier], TrimModifier);
27254TrimModifier.prototype.initModifierProperties = function(elem, data) {
27255 this.s = PropertyFactory.getProp(elem, data.s, 0, 0.01, this);
27256 this.e = PropertyFactory.getProp(elem, data.e, 0, 0.01, this);
27257 this.o = PropertyFactory.getProp(elem, data.o, 0, 0, this);
27258 this.sValue = 0;
27259 this.eValue = 0;
27260 this.getValue = this.processKeys;
27261 this.m = data.m;
27262 this._isAnimated = !!this.s.effectsSequence.length || !!this.e.effectsSequence.length || !!this.o.effectsSequence.length;
27263};
27264
27265TrimModifier.prototype.addShapeToModifier = function(shapeData){
27266 shapeData.pathsData = [];
27267};
27268
27269TrimModifier.prototype.calculateShapeEdges = function(s, e, shapeLength, addedLength, totalModifierLength) {
27270 var segments = [];
27271 if (e <= 1) {
27272 segments.push({
27273 s: s,
27274 e: e
27275 });
27276 } else if (s >= 1) {
27277 segments.push({
27278 s: s - 1,
27279 e: e - 1
27280 });
27281 } else {
27282 segments.push({
27283 s: s,
27284 e: 1
27285 });
27286 segments.push({
27287 s: 0,
27288 e: e - 1
27289 });
27290 }
27291 var shapeSegments = [];
27292 var i, len = segments.length, segmentOb;
27293 for (i = 0; i < len; i += 1) {
27294 segmentOb = segments[i];
27295 if (segmentOb.e * totalModifierLength < addedLength || segmentOb.s * totalModifierLength > addedLength + shapeLength) ; else {
27296 var shapeS, shapeE;
27297 if (segmentOb.s * totalModifierLength <= addedLength) {
27298 shapeS = 0;
27299 } else {
27300 shapeS = (segmentOb.s * totalModifierLength - addedLength) / shapeLength;
27301 }
27302 if(segmentOb.e * totalModifierLength >= addedLength + shapeLength) {
27303 shapeE = 1;
27304 } else {
27305 shapeE = ((segmentOb.e * totalModifierLength - addedLength) / shapeLength);
27306 }
27307 shapeSegments.push([shapeS, shapeE]);
27308 }
27309 }
27310 if (!shapeSegments.length) {
27311 shapeSegments.push([0, 0]);
27312 }
27313 return shapeSegments;
27314};
27315
27316TrimModifier.prototype.releasePathsData = function(pathsData) {
27317 var i, len = pathsData.length;
27318 for (i = 0; i < len; i += 1) {
27319 segments_length_pool.release(pathsData[i]);
27320 }
27321 pathsData.length = 0;
27322 return pathsData;
27323};
27324
27325TrimModifier.prototype.processShapes = function(_isFirstFrame) {
27326 var s, e;
27327 if (this._mdf || _isFirstFrame) {
27328 var o = (this.o.v % 360) / 360;
27329 if (o < 0) {
27330 o += 1;
27331 }
27332 s = (this.s.v > 1 ? 1 : this.s.v < 0 ? 0 : this.s.v) + o;
27333 e = (this.e.v > 1 ? 1 : this.e.v < 0 ? 0 : this.e.v) + o;
27334 if (s > e) {
27335 var _s = s;
27336 s = e;
27337 e = _s;
27338 }
27339 s = Math.round(s * 10000) * 0.0001;
27340 e = Math.round(e * 10000) * 0.0001;
27341 this.sValue = s;
27342 this.eValue = e;
27343 } else {
27344 s = this.sValue;
27345 e = this.eValue;
27346 }
27347 var shapePaths;
27348 var i, len = this.shapes.length, j, jLen;
27349 var pathsData, pathData, totalShapeLength, totalModifierLength = 0;
27350
27351 if (e === s) {
27352 for (i = 0; i < len; i += 1) {
27353 this.shapes[i].localShapeCollection.releaseShapes();
27354 this.shapes[i].shape._mdf = true;
27355 this.shapes[i].shape.paths = this.shapes[i].localShapeCollection;
27356 }
27357 } else if (!((e === 1 && s === 0) || (e===0 && s === 1))){
27358 var segments = [], shapeData, localShapeCollection;
27359 for (i = 0; i < len; i += 1) {
27360 shapeData = this.shapes[i];
27361 // if shape hasn't changed and trim properties haven't changed, cached previous path can be used
27362 if (!shapeData.shape._mdf && !this._mdf && !_isFirstFrame && this.m !== 2) {
27363 shapeData.shape.paths = shapeData.localShapeCollection;
27364 } else {
27365 shapePaths = shapeData.shape.paths;
27366 jLen = shapePaths._length;
27367 totalShapeLength = 0;
27368 if (!shapeData.shape._mdf && shapeData.pathsData.length) {
27369 totalShapeLength = shapeData.totalShapeLength;
27370 } else {
27371 pathsData = this.releasePathsData(shapeData.pathsData);
27372 for (j = 0; j < jLen; j += 1) {
27373 pathData = bez.getSegmentsLength(shapePaths.shapes[j]);
27374 pathsData.push(pathData);
27375 totalShapeLength += pathData.totalLength;
27376 }
27377 shapeData.totalShapeLength = totalShapeLength;
27378 shapeData.pathsData = pathsData;
27379 }
27380
27381 totalModifierLength += totalShapeLength;
27382 shapeData.shape._mdf = true;
27383 }
27384 }
27385 var shapeS = s, shapeE = e, addedLength = 0, edges;
27386 for (i = len - 1; i >= 0; i -= 1) {
27387 shapeData = this.shapes[i];
27388 if (shapeData.shape._mdf) {
27389 localShapeCollection = shapeData.localShapeCollection;
27390 localShapeCollection.releaseShapes();
27391 //if m === 2 means paths are trimmed individually so edges need to be found for this specific shape relative to whoel group
27392 if (this.m === 2 && len > 1) {
27393 edges = this.calculateShapeEdges(s, e, shapeData.totalShapeLength, addedLength, totalModifierLength);
27394 addedLength += shapeData.totalShapeLength;
27395 } else {
27396 edges = [[shapeS, shapeE]];
27397 }
27398 jLen = edges.length;
27399 for (j = 0; j < jLen; j += 1) {
27400 shapeS = edges[j][0];
27401 shapeE = edges[j][1];
27402 segments.length = 0;
27403 if (shapeE <= 1) {
27404 segments.push({
27405 s:shapeData.totalShapeLength * shapeS,
27406 e:shapeData.totalShapeLength * shapeE
27407 });
27408 } else if (shapeS >= 1) {
27409 segments.push({
27410 s:shapeData.totalShapeLength * (shapeS - 1),
27411 e:shapeData.totalShapeLength * (shapeE - 1)
27412 });
27413 } else {
27414 segments.push({
27415 s:shapeData.totalShapeLength * shapeS,
27416 e:shapeData.totalShapeLength
27417 });
27418 segments.push({
27419 s:0,
27420 e:shapeData.totalShapeLength * (shapeE - 1)
27421 });
27422 }
27423 var newShapesData = this.addShapes(shapeData,segments[0]);
27424 if (segments[0].s !== segments[0].e) {
27425 if (segments.length > 1) {
27426 var lastShapeInCollection = shapeData.shape.paths.shapes[shapeData.shape.paths._length - 1];
27427 if (lastShapeInCollection.c) {
27428 var lastShape = newShapesData.pop();
27429 this.addPaths(newShapesData, localShapeCollection);
27430 newShapesData = this.addShapes(shapeData, segments[1], lastShape);
27431 } else {
27432 this.addPaths(newShapesData, localShapeCollection);
27433 newShapesData = this.addShapes(shapeData, segments[1]);
27434 }
27435 }
27436 this.addPaths(newShapesData, localShapeCollection);
27437 }
27438
27439 }
27440 shapeData.shape.paths = localShapeCollection;
27441 }
27442 }
27443 } else if (this._mdf) {
27444 for (i = 0; i < len; i += 1) {
27445 //Releasign Trim Cached paths data when no trim applied in case shapes are modified inbetween.
27446 //Don't remove this even if it's losing cached info.
27447 this.shapes[i].pathsData.length = 0;
27448 this.shapes[i].shape._mdf = true;
27449 }
27450 }
27451};
27452
27453TrimModifier.prototype.addPaths = function(newPaths, localShapeCollection) {
27454 var i, len = newPaths.length;
27455 for (i = 0; i < len; i += 1) {
27456 localShapeCollection.addShape(newPaths[i]);
27457 }
27458};
27459
27460TrimModifier.prototype.addSegment = function(pt1, pt2, pt3, pt4, shapePath, pos, newShape) {
27461 shapePath.setXYAt(pt2[0], pt2[1], 'o', pos);
27462 shapePath.setXYAt(pt3[0], pt3[1], 'i', pos + 1);
27463 if(newShape){
27464 shapePath.setXYAt(pt1[0], pt1[1], 'v', pos);
27465 }
27466 shapePath.setXYAt(pt4[0], pt4[1], 'v', pos + 1);
27467};
27468
27469TrimModifier.prototype.addSegmentFromArray = function(points, shapePath, pos, newShape) {
27470 shapePath.setXYAt(points[1], points[5], 'o', pos);
27471 shapePath.setXYAt(points[2], points[6], 'i', pos + 1);
27472 if(newShape){
27473 shapePath.setXYAt(points[0], points[4], 'v', pos);
27474 }
27475 shapePath.setXYAt(points[3], points[7], 'v', pos + 1);
27476};
27477
27478TrimModifier.prototype.addShapes = function(shapeData, shapeSegment, shapePath) {
27479 var pathsData = shapeData.pathsData;
27480 var shapePaths = shapeData.shape.paths.shapes;
27481 var i, len = shapeData.shape.paths._length, j, jLen;
27482 var addedLength = 0;
27483 var currentLengthData,segmentCount;
27484 var lengths;
27485 var segment;
27486 var shapes = [];
27487 var initPos;
27488 var newShape = true;
27489 if (!shapePath) {
27490 shapePath = shape_pool.newElement();
27491 segmentCount = 0;
27492 initPos = 0;
27493 } else {
27494 segmentCount = shapePath._length;
27495 initPos = shapePath._length;
27496 }
27497 shapes.push(shapePath);
27498 for (i = 0; i < len; i += 1) {
27499 lengths = pathsData[i].lengths;
27500 shapePath.c = shapePaths[i].c;
27501 jLen = shapePaths[i].c ? lengths.length : lengths.length + 1;
27502 for (j = 1; j < jLen; j +=1) {
27503 currentLengthData = lengths[j-1];
27504 if (addedLength + currentLengthData.addedLength < shapeSegment.s) {
27505 addedLength += currentLengthData.addedLength;
27506 shapePath.c = false;
27507 } else if(addedLength > shapeSegment.e) {
27508 shapePath.c = false;
27509 break;
27510 } else {
27511 if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + currentLengthData.addedLength) {
27512 this.addSegment(shapePaths[i].v[j - 1], shapePaths[i].o[j - 1], shapePaths[i].i[j], shapePaths[i].v[j], shapePath, segmentCount, newShape);
27513 newShape = false;
27514 } else {
27515 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]);
27516 this.addSegmentFromArray(segment, shapePath, segmentCount, newShape);
27517 // this.addSegment(segment.pt1, segment.pt3, segment.pt4, segment.pt2, shapePath, segmentCount, newShape);
27518 newShape = false;
27519 shapePath.c = false;
27520 }
27521 addedLength += currentLengthData.addedLength;
27522 segmentCount += 1;
27523 }
27524 }
27525 if (shapePaths[i].c && lengths.length) {
27526 currentLengthData = lengths[j - 1];
27527 if (addedLength <= shapeSegment.e) {
27528 var segmentLength = lengths[j - 1].addedLength;
27529 if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + segmentLength) {
27530 this.addSegment(shapePaths[i].v[j - 1], shapePaths[i].o[j - 1], shapePaths[i].i[0], shapePaths[i].v[0], shapePath, segmentCount, newShape);
27531 newShape = false;
27532 } else {
27533 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]);
27534 this.addSegmentFromArray(segment, shapePath, segmentCount, newShape);
27535 // this.addSegment(segment.pt1, segment.pt3, segment.pt4, segment.pt2, shapePath, segmentCount, newShape);
27536 newShape = false;
27537 shapePath.c = false;
27538 }
27539 } else {
27540 shapePath.c = false;
27541 }
27542 addedLength += currentLengthData.addedLength;
27543 segmentCount += 1;
27544 }
27545 if (shapePath._length) {
27546 shapePath.setXYAt(shapePath.v[initPos][0], shapePath.v[initPos][1], 'i', initPos);
27547 shapePath.setXYAt(shapePath.v[shapePath._length - 1][0], shapePath.v[shapePath._length - 1][1],'o', shapePath._length - 1);
27548 }
27549 if (addedLength > shapeSegment.e) {
27550 break;
27551 }
27552 if (i < len - 1) {
27553 shapePath = shape_pool.newElement();
27554 newShape = true;
27555 shapes.push(shapePath);
27556 segmentCount = 0;
27557 }
27558 }
27559 return shapes;
27560};
27561
27562
27563ShapeModifiers.registerModifier('tm', TrimModifier);
27564function RoundCornersModifier(){}
27565extendPrototype([ShapeModifier],RoundCornersModifier);
27566RoundCornersModifier.prototype.initModifierProperties = function(elem,data){
27567 this.getValue = this.processKeys;
27568 this.rd = PropertyFactory.getProp(elem,data.r,0,null,this);
27569 this._isAnimated = !!this.rd.effectsSequence.length;
27570};
27571
27572RoundCornersModifier.prototype.processPath = function(path, round){
27573 var cloned_path = shape_pool.newElement();
27574 cloned_path.c = path.c;
27575 var i, len = path._length;
27576 var currentV,currentI,currentO,closerV, distance,newPosPerc,index = 0;
27577 var vX,vY,oX,oY,iX,iY;
27578 for(i=0;i<len;i+=1){
27579 currentV = path.v[i];
27580 currentO = path.o[i];
27581 currentI = path.i[i];
27582 if(currentV[0]===currentO[0] && currentV[1]===currentO[1] && currentV[0]===currentI[0] && currentV[1]===currentI[1]){
27583 if((i===0 || i === len - 1) && !path.c){
27584 cloned_path.setTripleAt(currentV[0],currentV[1],currentO[0],currentO[1],currentI[0],currentI[1],index);
27585 /*cloned_path.v[index] = currentV;
27586 cloned_path.o[index] = currentO;
27587 cloned_path.i[index] = currentI;*/
27588 index += 1;
27589 } else {
27590 if(i===0){
27591 closerV = path.v[len-1];
27592 } else {
27593 closerV = path.v[i-1];
27594 }
27595 distance = Math.sqrt(Math.pow(currentV[0]-closerV[0],2)+Math.pow(currentV[1]-closerV[1],2));
27596 newPosPerc = distance ? Math.min(distance/2,round)/distance : 0;
27597 vX = iX = currentV[0]+(closerV[0]-currentV[0])*newPosPerc;
27598 vY = iY = currentV[1]-(currentV[1]-closerV[1])*newPosPerc;
27599 oX = vX-(vX-currentV[0])*roundCorner;
27600 oY = vY-(vY-currentV[1])*roundCorner;
27601 cloned_path.setTripleAt(vX,vY,oX,oY,iX,iY,index);
27602 index += 1;
27603
27604 if(i === len - 1){
27605 closerV = path.v[0];
27606 } else {
27607 closerV = path.v[i+1];
27608 }
27609 distance = Math.sqrt(Math.pow(currentV[0]-closerV[0],2)+Math.pow(currentV[1]-closerV[1],2));
27610 newPosPerc = distance ? Math.min(distance/2,round)/distance : 0;
27611 vX = oX = currentV[0]+(closerV[0]-currentV[0])*newPosPerc;
27612 vY = oY = currentV[1]+(closerV[1]-currentV[1])*newPosPerc;
27613 iX = vX-(vX-currentV[0])*roundCorner;
27614 iY = vY-(vY-currentV[1])*roundCorner;
27615 cloned_path.setTripleAt(vX,vY,oX,oY,iX,iY,index);
27616 index += 1;
27617 }
27618 } else {
27619 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);
27620 index += 1;
27621 }
27622 }
27623 return cloned_path;
27624};
27625
27626RoundCornersModifier.prototype.processShapes = function(_isFirstFrame){
27627 var shapePaths;
27628 var i, len = this.shapes.length;
27629 var j, jLen;
27630 var rd = this.rd.v;
27631
27632 if(rd !== 0){
27633 var shapeData, newPaths, localShapeCollection;
27634 for(i=0;i<len;i+=1){
27635 shapeData = this.shapes[i];
27636 newPaths = shapeData.shape.paths;
27637 localShapeCollection = shapeData.localShapeCollection;
27638 if(!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)){
27639 localShapeCollection.releaseShapes();
27640 shapeData.shape._mdf = true;
27641 shapePaths = shapeData.shape.paths.shapes;
27642 jLen = shapeData.shape.paths._length;
27643 for(j=0;j<jLen;j+=1){
27644 localShapeCollection.addShape(this.processPath(shapePaths[j],rd));
27645 }
27646 }
27647 shapeData.shape.paths = shapeData.localShapeCollection;
27648 }
27649
27650 }
27651 if(!this.dynamicProperties.length){
27652 this._mdf = false;
27653 }
27654};
27655
27656ShapeModifiers.registerModifier('rd',RoundCornersModifier);
27657function RepeaterModifier(){}
27658extendPrototype([ShapeModifier], RepeaterModifier);
27659
27660RepeaterModifier.prototype.initModifierProperties = function(elem,data){
27661 this.getValue = this.processKeys;
27662 this.c = PropertyFactory.getProp(elem,data.c,0,null,this);
27663 this.o = PropertyFactory.getProp(elem,data.o,0,null,this);
27664 this.tr = TransformPropertyFactory.getTransformProperty(elem,data.tr,this);
27665 this.so = PropertyFactory.getProp(elem,data.tr.so,0,0.01,this);
27666 this.eo = PropertyFactory.getProp(elem,data.tr.eo,0,0.01,this);
27667 this.data = data;
27668 if(!this.dynamicProperties.length){
27669 this.getValue(true);
27670 }
27671 this._isAnimated = !!this.dynamicProperties.length;
27672 this.pMatrix = new Matrix();
27673 this.rMatrix = new Matrix();
27674 this.sMatrix = new Matrix();
27675 this.tMatrix = new Matrix();
27676 this.matrix = new Matrix();
27677};
27678
27679RepeaterModifier.prototype.applyTransforms = function(pMatrix, rMatrix, sMatrix, transform, perc, inv){
27680 var dir = inv ? -1 : 1;
27681 var scaleX = transform.s.v[0] + (1 - transform.s.v[0]) * (1 - perc);
27682 var scaleY = transform.s.v[1] + (1 - transform.s.v[1]) * (1 - perc);
27683 pMatrix.translate(transform.p.v[0] * dir * perc, transform.p.v[1] * dir * perc, transform.p.v[2]);
27684 rMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2]);
27685 rMatrix.rotate(-transform.r.v * dir * perc);
27686 rMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2]);
27687 sMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2]);
27688 sMatrix.scale(inv ? 1/scaleX : scaleX, inv ? 1/scaleY : scaleY);
27689 sMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2]);
27690};
27691
27692RepeaterModifier.prototype.init = function(elem, arr, pos, elemsData) {
27693 this.elem = elem;
27694 this.arr = arr;
27695 this.pos = pos;
27696 this.elemsData = elemsData;
27697 this._currentCopies = 0;
27698 this._elements = [];
27699 this._groups = [];
27700 this.frameId = -1;
27701 this.initDynamicPropertyContainer(elem);
27702 this.initModifierProperties(elem,arr[pos]);
27703 while(pos>0){
27704 pos -= 1;
27705 //this._elements.unshift(arr.splice(pos,1)[0]);
27706 this._elements.unshift(arr[pos]);
27707 }
27708 if(this.dynamicProperties.length){
27709 this.k = true;
27710 }else{
27711 this.getValue(true);
27712 }
27713};
27714
27715RepeaterModifier.prototype.resetElements = function(elements){
27716 var i, len = elements.length;
27717 for(i = 0; i < len; i += 1) {
27718 elements[i]._processed = false;
27719 if(elements[i].ty === 'gr'){
27720 this.resetElements(elements[i].it);
27721 }
27722 }
27723};
27724
27725RepeaterModifier.prototype.cloneElements = function(elements){
27726 var len = elements.length;
27727 var newElements = JSON.parse(JSON.stringify(elements));
27728 this.resetElements(newElements);
27729 return newElements;
27730};
27731
27732RepeaterModifier.prototype.changeGroupRender = function(elements, renderFlag) {
27733 var i, len = elements.length;
27734 for(i = 0; i < len; i += 1) {
27735 elements[i]._render = renderFlag;
27736 if(elements[i].ty === 'gr') {
27737 this.changeGroupRender(elements[i].it, renderFlag);
27738 }
27739 }
27740};
27741
27742RepeaterModifier.prototype.processShapes = function(_isFirstFrame) {
27743 var items, itemsTransform, i, dir, cont;
27744 if(this._mdf || _isFirstFrame){
27745 var copies = Math.ceil(this.c.v);
27746 if(this._groups.length < copies){
27747 while(this._groups.length < copies){
27748 var group = {
27749 it:this.cloneElements(this._elements),
27750 ty:'gr'
27751 };
27752 group.it.push({"a":{"a":0,"ix":1,"k":[0,0]},"nm":"Transform","o":{"a":0,"ix":7,"k":100},"p":{"a":0,"ix":2,"k":[0,0]},"r":{"a":1,"ix":6,"k":[{s:0,e:0,t:0},{s:0,e:0,t:1}]},"s":{"a":0,"ix":3,"k":[100,100]},"sa":{"a":0,"ix":5,"k":0},"sk":{"a":0,"ix":4,"k":0},"ty":"tr"});
27753
27754 this.arr.splice(0,0,group);
27755 this._groups.splice(0,0,group);
27756 this._currentCopies += 1;
27757 }
27758 this.elem.reloadShapes();
27759 }
27760 cont = 0;
27761 var renderFlag;
27762 for(i = 0; i <= this._groups.length - 1; i += 1){
27763 renderFlag = cont < copies;
27764 this._groups[i]._render = renderFlag;
27765 this.changeGroupRender(this._groups[i].it, renderFlag);
27766 cont += 1;
27767 }
27768
27769 this._currentCopies = copies;
27770 ////
27771
27772 var offset = this.o.v;
27773 var offsetModulo = offset%1;
27774 var roundOffset = offset > 0 ? Math.floor(offset) : Math.ceil(offset);
27775 var tMat = this.tr.v.props;
27776 var pProps = this.pMatrix.props;
27777 var rProps = this.rMatrix.props;
27778 var sProps = this.sMatrix.props;
27779 this.pMatrix.reset();
27780 this.rMatrix.reset();
27781 this.sMatrix.reset();
27782 this.tMatrix.reset();
27783 this.matrix.reset();
27784 var iteration = 0;
27785
27786 if(offset > 0) {
27787 while(iteration<roundOffset){
27788 this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false);
27789 iteration += 1;
27790 }
27791 if(offsetModulo){
27792 this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, offsetModulo, false);
27793 iteration += offsetModulo;
27794 }
27795 } else if(offset < 0) {
27796 while(iteration>roundOffset){
27797 this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, true);
27798 iteration -= 1;
27799 }
27800 if(offsetModulo){
27801 this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, - offsetModulo, true);
27802 iteration -= offsetModulo;
27803 }
27804 }
27805 i = this.data.m === 1 ? 0 : this._currentCopies - 1;
27806 dir = this.data.m === 1 ? 1 : -1;
27807 cont = this._currentCopies;
27808 var j, jLen;
27809 while(cont){
27810 items = this.elemsData[i].it;
27811 itemsTransform = items[items.length - 1].transform.mProps.v.props;
27812 jLen = itemsTransform.length;
27813 items[items.length - 1].transform.mProps._mdf = true;
27814 items[items.length - 1].transform.op._mdf = true;
27815 items[items.length - 1].transform.op.v = this.so.v + (this.eo.v - this.so.v) * (i / (this._currentCopies - 1));
27816 if(iteration !== 0){
27817 if((i !== 0 && dir === 1) || (i !== this._currentCopies - 1 && dir === -1)){
27818 this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false);
27819 }
27820 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]);
27821 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]);
27822 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]);
27823
27824 for(j=0;j<jLen;j+=1) {
27825 itemsTransform[j] = this.matrix.props[j];
27826 }
27827 this.matrix.reset();
27828 } else {
27829 this.matrix.reset();
27830 for(j=0;j<jLen;j+=1) {
27831 itemsTransform[j] = this.matrix.props[j];
27832 }
27833 }
27834 iteration += 1;
27835 cont -= 1;
27836 i += dir;
27837 }
27838 } else {
27839 cont = this._currentCopies;
27840 i = 0;
27841 dir = 1;
27842 while(cont){
27843 items = this.elemsData[i].it;
27844 itemsTransform = items[items.length - 1].transform.mProps.v.props;
27845 items[items.length - 1].transform.mProps._mdf = false;
27846 items[items.length - 1].transform.op._mdf = false;
27847 cont -= 1;
27848 i += dir;
27849 }
27850 }
27851};
27852
27853RepeaterModifier.prototype.addShape = function(){};
27854
27855ShapeModifiers.registerModifier('rp',RepeaterModifier);
27856function ShapeCollection(){
27857 this._length = 0;
27858 this._maxLength = 4;
27859 this.shapes = createSizedArray(this._maxLength);
27860}
27861
27862ShapeCollection.prototype.addShape = function(shapeData){
27863 if(this._length === this._maxLength){
27864 this.shapes = this.shapes.concat(createSizedArray(this._maxLength));
27865 this._maxLength *= 2;
27866 }
27867 this.shapes[this._length] = shapeData;
27868 this._length += 1;
27869};
27870
27871ShapeCollection.prototype.releaseShapes = function(){
27872 var i;
27873 for(i = 0; i < this._length; i += 1) {
27874 shape_pool.release(this.shapes[i]);
27875 }
27876 this._length = 0;
27877};
27878function DashProperty(elem, data, renderer, container) {
27879 this.elem = elem;
27880 this.frameId = -1;
27881 this.dataProps = createSizedArray(data.length);
27882 this.renderer = renderer;
27883 this.k = false;
27884 this.dashStr = '';
27885 this.dashArray = createTypedArray('float32', data.length ? data.length - 1 : 0);
27886 this.dashoffset = createTypedArray('float32', 1);
27887 this.initDynamicPropertyContainer(container);
27888 var i, len = data.length || 0, prop;
27889 for(i = 0; i < len; i += 1) {
27890 prop = PropertyFactory.getProp(elem,data[i].v,0, 0, this);
27891 this.k = prop.k || this.k;
27892 this.dataProps[i] = {n:data[i].n,p:prop};
27893 }
27894 if(!this.k){
27895 this.getValue(true);
27896 }
27897 this._isAnimated = this.k;
27898}
27899
27900DashProperty.prototype.getValue = function(forceRender) {
27901 if(this.elem.globalData.frameId === this.frameId && !forceRender){
27902 return;
27903 }
27904 this.frameId = this.elem.globalData.frameId;
27905 this.iterateDynamicProperties();
27906 this._mdf = this._mdf || forceRender;
27907 if (this._mdf) {
27908 var i = 0, len = this.dataProps.length;
27909 if(this.renderer === 'svg') {
27910 this.dashStr = '';
27911 }
27912 for(i=0;i<len;i+=1){
27913 if(this.dataProps[i].n != 'o'){
27914 if(this.renderer === 'svg') {
27915 this.dashStr += ' ' + this.dataProps[i].p.v;
27916 }else{
27917 this.dashArray[i] = this.dataProps[i].p.v;
27918 }
27919 }else{
27920 this.dashoffset[0] = this.dataProps[i].p.v;
27921 }
27922 }
27923 }
27924};
27925extendPrototype([DynamicPropertyContainer], DashProperty);
27926function GradientProperty(elem,data,container){
27927 this.data = data;
27928 this.c = createTypedArray('uint8c', data.p*4);
27929 var cLength = data.k.k[0].s ? (data.k.k[0].s.length - data.p*4) : data.k.k.length - data.p*4;
27930 this.o = createTypedArray('float32', cLength);
27931 this._cmdf = false;
27932 this._omdf = false;
27933 this._collapsable = this.checkCollapsable();
27934 this._hasOpacity = cLength;
27935 this.initDynamicPropertyContainer(container);
27936 this.prop = PropertyFactory.getProp(elem,data.k,1,null,this);
27937 this.k = this.prop.k;
27938 this.getValue(true);
27939}
27940
27941GradientProperty.prototype.comparePoints = function(values, points) {
27942 var i = 0, len = this.o.length/2, diff;
27943 while(i < len) {
27944 diff = Math.abs(values[i*4] - values[points*4 + i*2]);
27945 if(diff > 0.01){
27946 return false;
27947 }
27948 i += 1;
27949 }
27950 return true;
27951};
27952
27953GradientProperty.prototype.checkCollapsable = function() {
27954 if (this.o.length/2 !== this.c.length/4) {
27955 return false;
27956 }
27957 if (this.data.k.k[0].s) {
27958 var i = 0, len = this.data.k.k.length;
27959 while (i < len) {
27960 if (!this.comparePoints(this.data.k.k[i].s, this.data.p)) {
27961 return false;
27962 }
27963 i += 1;
27964 }
27965 } else if(!this.comparePoints(this.data.k.k, this.data.p)) {
27966 return false;
27967 }
27968 return true;
27969};
27970
27971GradientProperty.prototype.getValue = function(forceRender){
27972 this.prop.getValue();
27973 this._mdf = false;
27974 this._cmdf = false;
27975 this._omdf = false;
27976 if(this.prop._mdf || forceRender){
27977 var i, len = this.data.p*4;
27978 var mult, val;
27979 for(i=0;i<len;i+=1){
27980 mult = i%4 === 0 ? 100 : 255;
27981 val = Math.round(this.prop.v[i]*mult);
27982 if(this.c[i] !== val){
27983 this.c[i] = val;
27984 this._cmdf = !forceRender;
27985 }
27986 }
27987 if(this.o.length){
27988 len = this.prop.v.length;
27989 for(i=this.data.p*4;i<len;i+=1){
27990 mult = i%2 === 0 ? 100 : 1;
27991 val = i%2 === 0 ? Math.round(this.prop.v[i]*100):this.prop.v[i];
27992 if(this.o[i-this.data.p*4] !== val){
27993 this.o[i-this.data.p*4] = val;
27994 this._omdf = !forceRender;
27995 }
27996 }
27997 }
27998 this._mdf = !forceRender;
27999 }
28000};
28001
28002extendPrototype([DynamicPropertyContainer], GradientProperty);
28003var buildShapeString = function(pathNodes, length, closed, mat) {
28004 if(length === 0) {
28005 return '';
28006 }
28007 var _o = pathNodes.o;
28008 var _i = pathNodes.i;
28009 var _v = pathNodes.v;
28010 var i, shapeString = " M" + mat.applyToPointStringified(_v[0][0], _v[0][1]);
28011 for(i = 1; i < length; i += 1) {
28012 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]);
28013 }
28014 if (closed && length) {
28015 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]);
28016 shapeString += 'z';
28017 }
28018 return shapeString;
28019};
28020var ImagePreloader = (function(){
28021
28022 var proxyImage = (function(){
28023 var canvas = createTag('canvas');
28024 canvas.width = 1;
28025 canvas.height = 1;
28026 var ctx = canvas.getContext('2d');
28027 ctx.fillStyle = '#FF0000';
28028 ctx.fillRect(0, 0, 1, 1);
28029 return canvas;
28030 }());
28031
28032 function imageLoaded(){
28033 this.loadedAssets += 1;
28034 if(this.loadedAssets === this.totalImages){
28035 if(this.imagesLoadedCb) {
28036 this.imagesLoadedCb(null);
28037 }
28038 }
28039 }
28040
28041 function getAssetsPath(assetData, assetsPath, original_path) {
28042 var path = '';
28043 if (assetData.e) {
28044 path = assetData.p;
28045 } else if(assetsPath) {
28046 var imagePath = assetData.p;
28047 if (imagePath.indexOf('images/') !== -1) {
28048 imagePath = imagePath.split('/')[1];
28049 }
28050 path = assetsPath + imagePath;
28051 } else {
28052 path = original_path;
28053 path += assetData.u ? assetData.u : '';
28054 path += assetData.p;
28055 }
28056 return path;
28057 }
28058
28059 function createImageData(assetData) {
28060 var path = getAssetsPath(assetData, this.assetsPath, this.path);
28061 var img = createTag('img');
28062 img.crossOrigin = 'anonymous';
28063 img.addEventListener('load', this._imageLoaded.bind(this), false);
28064 img.addEventListener('error', function() {
28065 ob.img = proxyImage;
28066 this._imageLoaded();
28067 }.bind(this), false);
28068 img.src = path;
28069 var ob = {
28070 img: img,
28071 assetData: assetData
28072 };
28073 return ob;
28074 }
28075
28076 function loadAssets(assets, cb){
28077 this.imagesLoadedCb = cb;
28078 var i, len = assets.length;
28079 for (i = 0; i < len; i += 1) {
28080 if(!assets[i].layers){
28081 this.totalImages += 1;
28082 this.images.push(this._createImageData(assets[i]));
28083 }
28084 }
28085 }
28086
28087 function setPath(path){
28088 this.path = path || '';
28089 }
28090
28091 function setAssetsPath(path){
28092 this.assetsPath = path || '';
28093 }
28094
28095 function getImage(assetData) {
28096 var i = 0, len = this.images.length;
28097 while (i < len) {
28098 if (this.images[i].assetData === assetData) {
28099 return this.images[i].img;
28100 }
28101 i += 1;
28102 }
28103 }
28104
28105 function destroy() {
28106 this.imagesLoadedCb = null;
28107 this.images.length = 0;
28108 }
28109
28110 function loaded() {
28111 return this.totalImages === this.loadedAssets;
28112 }
28113
28114 return function ImagePreloader(){
28115 this.loadAssets = loadAssets;
28116 this.setAssetsPath = setAssetsPath;
28117 this.setPath = setPath;
28118 this.loaded = loaded;
28119 this.destroy = destroy;
28120 this.getImage = getImage;
28121 this._createImageData = createImageData;
28122 this._imageLoaded = imageLoaded;
28123 this.assetsPath = '';
28124 this.path = '';
28125 this.totalImages = 0;
28126 this.loadedAssets = 0;
28127 this.imagesLoadedCb = null;
28128 this.images = [];
28129 };
28130}());
28131var featureSupport = (function(){
28132 var ob = {
28133 maskType: true
28134 };
28135 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)) {
28136 ob.maskType = false;
28137 }
28138 return ob;
28139}());
28140var filtersFactory = (function(){
28141 var ob = {};
28142 ob.createFilter = createFilter;
28143 ob.createAlphaToLuminanceFilter = createAlphaToLuminanceFilter;
28144
28145 function createFilter(filId){
28146 var fil = createNS('filter');
28147 fil.setAttribute('id',filId);
28148 fil.setAttribute('filterUnits','objectBoundingBox');
28149 fil.setAttribute('x','0%');
28150 fil.setAttribute('y','0%');
28151 fil.setAttribute('width','100%');
28152 fil.setAttribute('height','100%');
28153 return fil;
28154 }
28155
28156 function createAlphaToLuminanceFilter(){
28157 var feColorMatrix = createNS('feColorMatrix');
28158 feColorMatrix.setAttribute('type','matrix');
28159 feColorMatrix.setAttribute('color-interpolation-filters','sRGB');
28160 feColorMatrix.setAttribute('values','0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1');
28161 return feColorMatrix;
28162 }
28163
28164 return ob;
28165}());
28166var assetLoader = (function(){
28167
28168 function formatResponse(xhr) {
28169 if(xhr.response && typeof xhr.response === 'object') {
28170 return xhr.response;
28171 } else if(xhr.response && typeof xhr.response === 'string') {
28172 return JSON.parse(xhr.response);
28173 } else if(xhr.responseText) {
28174 return JSON.parse(xhr.responseText);
28175 }
28176 }
28177
28178 function loadAsset(path, callback, errorCallback) {
28179 var response;
28180 var xhr = new XMLHttpRequest();
28181 xhr.open('GET', path, true);
28182 // set responseType after calling open or IE will break.
28183 xhr.responseType = "json";
28184 xhr.send();
28185 xhr.onreadystatechange = function () {
28186 if (xhr.readyState == 4) {
28187 if(xhr.status == 200){
28188 response = formatResponse(xhr);
28189 callback(response);
28190 }else{
28191 try{
28192 response = formatResponse(xhr);
28193 callback(response);
28194 }catch(err){
28195 if(errorCallback) {
28196 errorCallback(err);
28197 }
28198 }
28199 }
28200 }
28201 };
28202 }
28203 return {
28204 load: loadAsset
28205 }
28206}());
28207
28208function TextAnimatorProperty(textData, renderType, elem){
28209 this._isFirstFrame = true;
28210 this._hasMaskedPath = false;
28211 this._frameId = -1;
28212 this._textData = textData;
28213 this._renderType = renderType;
28214 this._elem = elem;
28215 this._animatorsData = createSizedArray(this._textData.a.length);
28216 this._pathData = {};
28217 this._moreOptions = {
28218 alignment: {}
28219 };
28220 this.renderedLetters = [];
28221 this.lettersChangedFlag = false;
28222 this.initDynamicPropertyContainer(elem);
28223
28224}
28225
28226TextAnimatorProperty.prototype.searchProperties = function(){
28227 var i, len = this._textData.a.length, animatorProps;
28228 var getProp = PropertyFactory.getProp;
28229 for(i=0;i<len;i+=1){
28230 animatorProps = this._textData.a[i];
28231 this._animatorsData[i] = new TextAnimatorDataProperty(this._elem, animatorProps, this);
28232 }
28233 if(this._textData.p && 'm' in this._textData.p){
28234 this._pathData = {
28235 f: getProp(this._elem,this._textData.p.f,0,0,this),
28236 l: getProp(this._elem,this._textData.p.l,0,0,this),
28237 r: this._textData.p.r,
28238 m: this._elem.maskManager.getMaskProperty(this._textData.p.m)
28239 };
28240 this._hasMaskedPath = true;
28241 } else {
28242 this._hasMaskedPath = false;
28243 }
28244 this._moreOptions.alignment = getProp(this._elem,this._textData.m.a,1,0,this);
28245};
28246
28247TextAnimatorProperty.prototype.getMeasures = function(documentData, lettersChangedFlag){
28248 this.lettersChangedFlag = lettersChangedFlag;
28249 if(!this._mdf && !this._isFirstFrame && !lettersChangedFlag && (!this._hasMaskedPath || !this._pathData.m._mdf)) {
28250 return;
28251 }
28252 this._isFirstFrame = false;
28253 var alignment = this._moreOptions.alignment.v;
28254 var animators = this._animatorsData;
28255 var textData = this._textData;
28256 var matrixHelper = this.mHelper;
28257 var renderType = this._renderType;
28258 var renderedLettersCount = this.renderedLetters.length;
28259 var data = this.data;
28260 var xPos,yPos;
28261 var i, len;
28262 var letters = documentData.l, pathInfo, currentLength, currentPoint, segmentLength, flag, pointInd, segmentInd, prevPoint, points, segments, partialLength, totalLength, perc, tanAngle, mask;
28263 if(this._hasMaskedPath) {
28264 mask = this._pathData.m;
28265 if(!this._pathData.n || this._pathData._mdf){
28266 var paths = mask.v;
28267 if(this._pathData.r){
28268 paths = paths.reverse();
28269 }
28270 // TODO: release bezier data cached from previous pathInfo: this._pathData.pi
28271 pathInfo = {
28272 tLength: 0,
28273 segments: []
28274 };
28275 len = paths._length - 1;
28276 var bezierData;
28277 totalLength = 0;
28278 for (i = 0; i < len; i += 1) {
28279 bezierData = bez.buildBezierData(paths.v[i]
28280 , paths.v[i + 1]
28281 , [paths.o[i][0] - paths.v[i][0], paths.o[i][1] - paths.v[i][1]]
28282 , [paths.i[i + 1][0] - paths.v[i + 1][0], paths.i[i + 1][1] - paths.v[i + 1][1]]);
28283 pathInfo.tLength += bezierData.segmentLength;
28284 pathInfo.segments.push(bezierData);
28285 totalLength += bezierData.segmentLength;
28286 }
28287 i = len;
28288 if (mask.v.c) {
28289 bezierData = bez.buildBezierData(paths.v[i]
28290 , paths.v[0]
28291 , [paths.o[i][0] - paths.v[i][0], paths.o[i][1] - paths.v[i][1]]
28292 , [paths.i[0][0] - paths.v[0][0], paths.i[0][1] - paths.v[0][1]]);
28293 pathInfo.tLength += bezierData.segmentLength;
28294 pathInfo.segments.push(bezierData);
28295 totalLength += bezierData.segmentLength;
28296 }
28297 this._pathData.pi = pathInfo;
28298 }
28299 pathInfo = this._pathData.pi;
28300
28301 currentLength = this._pathData.f.v;
28302 segmentInd = 0;
28303 pointInd = 1;
28304 segmentLength = 0;
28305 flag = true;
28306 segments = pathInfo.segments;
28307 if (currentLength < 0 && mask.v.c) {
28308 if (pathInfo.tLength < Math.abs(currentLength)) {
28309 currentLength = -Math.abs(currentLength) % pathInfo.tLength;
28310 }
28311 segmentInd = segments.length - 1;
28312 points = segments[segmentInd].points;
28313 pointInd = points.length - 1;
28314 while (currentLength < 0) {
28315 currentLength += points[pointInd].partialLength;
28316 pointInd -= 1;
28317 if (pointInd < 0) {
28318 segmentInd -= 1;
28319 points = segments[segmentInd].points;
28320 pointInd = points.length - 1;
28321 }
28322 }
28323
28324 }
28325 points = segments[segmentInd].points;
28326 prevPoint = points[pointInd - 1];
28327 currentPoint = points[pointInd];
28328 partialLength = currentPoint.partialLength;
28329 }
28330
28331
28332 len = letters.length;
28333 xPos = 0;
28334 yPos = 0;
28335 var yOff = documentData.finalSize * 1.2 * 0.714;
28336 var firstLine = true;
28337 var animatorProps, animatorSelector;
28338 var j, jLen;
28339 var letterValue;
28340
28341 jLen = animators.length;
28342
28343 var mult, ind = -1, offf, xPathPos, yPathPos;
28344 var initPathPos = currentLength,initSegmentInd = segmentInd, initPointInd = pointInd, currentLine = -1;
28345 var elemOpacity;
28346 var sc,sw,fc,k;
28347 var lineLength = 0;
28348 var letterSw, letterSc, letterFc, letterM = '', letterP = this.defaultPropsArray, letterO;
28349
28350 //
28351 if(documentData.j === 2 || documentData.j === 1) {
28352 var animatorJustifyOffset = 0;
28353 var animatorFirstCharOffset = 0;
28354 var justifyOffsetMult = documentData.j === 2 ? -0.5 : -1;
28355 var lastIndex = 0;
28356 var isNewLine = true;
28357
28358 for (i = 0; i < len; i += 1) {
28359 if (letters[i].n) {
28360 if(animatorJustifyOffset) {
28361 animatorJustifyOffset += animatorFirstCharOffset;
28362 }
28363 while (lastIndex < i) {
28364 letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset;
28365 lastIndex += 1;
28366 }
28367 animatorJustifyOffset = 0;
28368 isNewLine = true;
28369 } else {
28370 for (j = 0; j < jLen; j += 1) {
28371 animatorProps = animators[j].a;
28372 if (animatorProps.t.propType) {
28373 if (isNewLine && documentData.j === 2) {
28374 animatorFirstCharOffset += animatorProps.t.v * justifyOffsetMult;
28375 }
28376 animatorSelector = animators[j].s;
28377 mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
28378 if (mult.length) {
28379 animatorJustifyOffset += animatorProps.t.v*mult[0] * justifyOffsetMult;
28380 } else {
28381 animatorJustifyOffset += animatorProps.t.v*mult * justifyOffsetMult;
28382 }
28383 }
28384 }
28385 isNewLine = false;
28386 }
28387 }
28388 if(animatorJustifyOffset) {
28389 animatorJustifyOffset += animatorFirstCharOffset;
28390 }
28391 while(lastIndex < i) {
28392 letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset;
28393 lastIndex += 1;
28394 }
28395 }
28396 //
28397
28398 for( i = 0; i < len; i += 1) {
28399
28400 matrixHelper.reset();
28401 elemOpacity = 1;
28402 if(letters[i].n) {
28403 xPos = 0;
28404 yPos += documentData.yOffset;
28405 yPos += firstLine ? 1 : 0;
28406 currentLength = initPathPos ;
28407 firstLine = false;
28408 lineLength = 0;
28409 if(this._hasMaskedPath) {
28410 segmentInd = initSegmentInd;
28411 pointInd = initPointInd;
28412 points = segments[segmentInd].points;
28413 prevPoint = points[pointInd - 1];
28414 currentPoint = points[pointInd];
28415 partialLength = currentPoint.partialLength;
28416 segmentLength = 0;
28417 }
28418 letterO = letterSw = letterFc = letterM = '';
28419 letterP = this.defaultPropsArray;
28420 }else{
28421 if(this._hasMaskedPath) {
28422 if(currentLine !== letters[i].line){
28423 switch(documentData.j){
28424 case 1:
28425 currentLength += totalLength - documentData.lineWidths[letters[i].line];
28426 break;
28427 case 2:
28428 currentLength += (totalLength - documentData.lineWidths[letters[i].line])/2;
28429 break;
28430 }
28431 currentLine = letters[i].line;
28432 }
28433 if (ind !== letters[i].ind) {
28434 if (letters[ind]) {
28435 currentLength += letters[ind].extra;
28436 }
28437 currentLength += letters[i].an / 2;
28438 ind = letters[i].ind;
28439 }
28440 currentLength += alignment[0] * letters[i].an / 200;
28441 var animatorOffset = 0;
28442 for (j = 0; j < jLen; j += 1) {
28443 animatorProps = animators[j].a;
28444 if (animatorProps.p.propType) {
28445 animatorSelector = animators[j].s;
28446 mult = animatorSelector.getMult(letters[i].anIndexes[j],textData.a[j].s.totalChars);
28447 if(mult.length){
28448 animatorOffset += animatorProps.p.v[0] * mult[0];
28449 } else{
28450 animatorOffset += animatorProps.p.v[0] * mult;
28451 }
28452
28453 }
28454 if (animatorProps.a.propType) {
28455 animatorSelector = animators[j].s;
28456 mult = animatorSelector.getMult(letters[i].anIndexes[j],textData.a[j].s.totalChars);
28457 if(mult.length){
28458 animatorOffset += animatorProps.a.v[0] * mult[0];
28459 } else{
28460 animatorOffset += animatorProps.a.v[0] * mult;
28461 }
28462
28463 }
28464 }
28465 flag = true;
28466 while (flag) {
28467 if (segmentLength + partialLength >= currentLength + animatorOffset || !points) {
28468 perc = (currentLength + animatorOffset - segmentLength) / currentPoint.partialLength;
28469 xPathPos = prevPoint.point[0] + (currentPoint.point[0] - prevPoint.point[0]) * perc;
28470 yPathPos = prevPoint.point[1] + (currentPoint.point[1] - prevPoint.point[1]) * perc;
28471 matrixHelper.translate(-alignment[0]*letters[i].an/200, -(alignment[1] * yOff / 100));
28472 flag = false;
28473 } else if (points) {
28474 segmentLength += currentPoint.partialLength;
28475 pointInd += 1;
28476 if (pointInd >= points.length) {
28477 pointInd = 0;
28478 segmentInd += 1;
28479 if (!segments[segmentInd]) {
28480 if (mask.v.c) {
28481 pointInd = 0;
28482 segmentInd = 0;
28483 points = segments[segmentInd].points;
28484 } else {
28485 segmentLength -= currentPoint.partialLength;
28486 points = null;
28487 }
28488 } else {
28489 points = segments[segmentInd].points;
28490 }
28491 }
28492 if (points) {
28493 prevPoint = currentPoint;
28494 currentPoint = points[pointInd];
28495 partialLength = currentPoint.partialLength;
28496 }
28497 }
28498 }
28499 offf = letters[i].an / 2 - letters[i].add;
28500 matrixHelper.translate(-offf, 0, 0);
28501 } else {
28502 offf = letters[i].an/2 - letters[i].add;
28503 matrixHelper.translate(-offf,0,0);
28504
28505 // Grouping alignment
28506 matrixHelper.translate(-alignment[0]*letters[i].an/200, -alignment[1]*yOff/100, 0);
28507 }
28508
28509 lineLength += letters[i].l/2;
28510 for(j=0;j<jLen;j+=1){
28511 animatorProps = animators[j].a;
28512 if (animatorProps.t.propType) {
28513 animatorSelector = animators[j].s;
28514 mult = animatorSelector.getMult(letters[i].anIndexes[j],textData.a[j].s.totalChars);
28515 //This condition is to prevent applying tracking to first character in each line. Might be better to use a boolean "isNewLine"
28516 if(xPos !== 0 || documentData.j !== 0) {
28517 if(this._hasMaskedPath) {
28518 if(mult.length) {
28519 currentLength += animatorProps.t.v*mult[0];
28520 } else {
28521 currentLength += animatorProps.t.v*mult;
28522 }
28523 }else{
28524 if(mult.length) {
28525 xPos += animatorProps.t.v*mult[0];
28526 } else {
28527 xPos += animatorProps.t.v*mult;
28528 }
28529 }
28530 }
28531 }
28532 }
28533 lineLength += letters[i].l/2;
28534 if(documentData.strokeWidthAnim) {
28535 sw = documentData.sw || 0;
28536 }
28537 if(documentData.strokeColorAnim) {
28538 if(documentData.sc){
28539 sc = [documentData.sc[0], documentData.sc[1], documentData.sc[2]];
28540 }else{
28541 sc = [0,0,0];
28542 }
28543 }
28544 if(documentData.fillColorAnim && documentData.fc) {
28545 fc = [documentData.fc[0], documentData.fc[1], documentData.fc[2]];
28546 }
28547 for(j=0;j<jLen;j+=1){
28548 animatorProps = animators[j].a;
28549 if (animatorProps.a.propType) {
28550 animatorSelector = animators[j].s;
28551 mult = animatorSelector.getMult(letters[i].anIndexes[j],textData.a[j].s.totalChars);
28552
28553 if(mult.length){
28554 matrixHelper.translate(-animatorProps.a.v[0]*mult[0], -animatorProps.a.v[1]*mult[1], animatorProps.a.v[2]*mult[2]);
28555 } else {
28556 matrixHelper.translate(-animatorProps.a.v[0]*mult, -animatorProps.a.v[1]*mult, animatorProps.a.v[2]*mult);
28557 }
28558 }
28559 }
28560 for(j=0;j<jLen;j+=1){
28561 animatorProps = animators[j].a;
28562 if (animatorProps.s.propType) {
28563 animatorSelector = animators[j].s;
28564 mult = animatorSelector.getMult(letters[i].anIndexes[j],textData.a[j].s.totalChars);
28565 if(mult.length){
28566 matrixHelper.scale(1+((animatorProps.s.v[0]-1)*mult[0]),1+((animatorProps.s.v[1]-1)*mult[1]),1);
28567 } else {
28568 matrixHelper.scale(1+((animatorProps.s.v[0]-1)*mult),1+((animatorProps.s.v[1]-1)*mult),1);
28569 }
28570 }
28571 }
28572 for(j=0;j<jLen;j+=1) {
28573 animatorProps = animators[j].a;
28574 animatorSelector = animators[j].s;
28575 mult = animatorSelector.getMult(letters[i].anIndexes[j],textData.a[j].s.totalChars);
28576 if (animatorProps.sk.propType) {
28577 if(mult.length) {
28578 matrixHelper.skewFromAxis(-animatorProps.sk.v * mult[0], animatorProps.sa.v * mult[1]);
28579 } else {
28580 matrixHelper.skewFromAxis(-animatorProps.sk.v * mult, animatorProps.sa.v * mult);
28581 }
28582 }
28583 if (animatorProps.r.propType) {
28584 if(mult.length) {
28585 matrixHelper.rotateZ(-animatorProps.r.v * mult[2]);
28586 } else {
28587 matrixHelper.rotateZ(-animatorProps.r.v * mult);
28588 }
28589 }
28590 if (animatorProps.ry.propType) {
28591
28592 if(mult.length) {
28593 matrixHelper.rotateY(animatorProps.ry.v*mult[1]);
28594 }else{
28595 matrixHelper.rotateY(animatorProps.ry.v*mult);
28596 }
28597 }
28598 if (animatorProps.rx.propType) {
28599 if(mult.length) {
28600 matrixHelper.rotateX(animatorProps.rx.v*mult[0]);
28601 } else {
28602 matrixHelper.rotateX(animatorProps.rx.v*mult);
28603 }
28604 }
28605 if (animatorProps.o.propType) {
28606 if(mult.length) {
28607 elemOpacity += ((animatorProps.o.v)*mult[0] - elemOpacity)*mult[0];
28608 } else {
28609 elemOpacity += ((animatorProps.o.v)*mult - elemOpacity)*mult;
28610 }
28611 }
28612 if (documentData.strokeWidthAnim && animatorProps.sw.propType) {
28613 if(mult.length) {
28614 sw += animatorProps.sw.v*mult[0];
28615 } else {
28616 sw += animatorProps.sw.v*mult;
28617 }
28618 }
28619 if (documentData.strokeColorAnim && animatorProps.sc.propType) {
28620 for(k=0;k<3;k+=1){
28621 if(mult.length) {
28622 sc[k] = sc[k] + (animatorProps.sc.v[k] - sc[k])*mult[0];
28623 } else {
28624 sc[k] = sc[k] + (animatorProps.sc.v[k] - sc[k])*mult;
28625 }
28626 }
28627 }
28628 if (documentData.fillColorAnim && documentData.fc) {
28629 if(animatorProps.fc.propType){
28630 for(k=0;k<3;k+=1){
28631 if(mult.length) {
28632 fc[k] = fc[k] + (animatorProps.fc.v[k] - fc[k])*mult[0];
28633 } else {
28634 fc[k] = fc[k] + (animatorProps.fc.v[k] - fc[k])*mult;
28635 }
28636 }
28637 }
28638 if(animatorProps.fh.propType){
28639 if(mult.length) {
28640 fc = addHueToRGB(fc,animatorProps.fh.v*mult[0]);
28641 } else {
28642 fc = addHueToRGB(fc,animatorProps.fh.v*mult);
28643 }
28644 }
28645 if(animatorProps.fs.propType){
28646 if(mult.length) {
28647 fc = addSaturationToRGB(fc,animatorProps.fs.v*mult[0]);
28648 } else {
28649 fc = addSaturationToRGB(fc,animatorProps.fs.v*mult);
28650 }
28651 }
28652 if(animatorProps.fb.propType){
28653 if(mult.length) {
28654 fc = addBrightnessToRGB(fc,animatorProps.fb.v*mult[0]);
28655 } else {
28656 fc = addBrightnessToRGB(fc,animatorProps.fb.v*mult);
28657 }
28658 }
28659 }
28660 }
28661
28662 for(j=0;j<jLen;j+=1){
28663 animatorProps = animators[j].a;
28664
28665 if (animatorProps.p.propType) {
28666 animatorSelector = animators[j].s;
28667 mult = animatorSelector.getMult(letters[i].anIndexes[j],textData.a[j].s.totalChars);
28668 if(this._hasMaskedPath) {
28669 if(mult.length) {
28670 matrixHelper.translate(0, animatorProps.p.v[1] * mult[0], -animatorProps.p.v[2] * mult[1]);
28671 } else {
28672 matrixHelper.translate(0, animatorProps.p.v[1] * mult, -animatorProps.p.v[2] * mult);
28673 }
28674 }else{
28675 if(mult.length) {
28676 matrixHelper.translate(animatorProps.p.v[0] * mult[0], animatorProps.p.v[1] * mult[1], -animatorProps.p.v[2] * mult[2]);
28677 } else {
28678 matrixHelper.translate(animatorProps.p.v[0] * mult, animatorProps.p.v[1] * mult, -animatorProps.p.v[2] * mult);
28679
28680 }
28681 }
28682 }
28683 }
28684 if(documentData.strokeWidthAnim){
28685 letterSw = sw < 0 ? 0 : sw;
28686 }
28687 if(documentData.strokeColorAnim){
28688 letterSc = 'rgb('+Math.round(sc[0]*255)+','+Math.round(sc[1]*255)+','+Math.round(sc[2]*255)+')';
28689 }
28690 if(documentData.fillColorAnim && documentData.fc){
28691 letterFc = 'rgb('+Math.round(fc[0]*255)+','+Math.round(fc[1]*255)+','+Math.round(fc[2]*255)+')';
28692 }
28693
28694 if(this._hasMaskedPath) {
28695 matrixHelper.translate(0,-documentData.ls);
28696
28697 matrixHelper.translate(0, alignment[1]*yOff/100 + yPos,0);
28698 if (textData.p.p) {
28699 tanAngle = (currentPoint.point[1] - prevPoint.point[1]) / (currentPoint.point[0] - prevPoint.point[0]);
28700 var rot = Math.atan(tanAngle) * 180 / Math.PI;
28701 if (currentPoint.point[0] < prevPoint.point[0]) {
28702 rot += 180;
28703 }
28704 matrixHelper.rotate(-rot * Math.PI / 180);
28705 }
28706 matrixHelper.translate(xPathPos, yPathPos, 0);
28707 currentLength -= alignment[0]*letters[i].an/200;
28708 if(letters[i+1] && ind !== letters[i+1].ind){
28709 currentLength += letters[i].an / 2;
28710 currentLength += documentData.tr/1000*documentData.finalSize;
28711 }
28712 }else{
28713
28714 matrixHelper.translate(xPos,yPos,0);
28715
28716 if(documentData.ps){
28717 //matrixHelper.translate(documentData.ps[0],documentData.ps[1],0);
28718 matrixHelper.translate(documentData.ps[0],documentData.ps[1] + documentData.ascent,0);
28719 }
28720 switch(documentData.j){
28721 case 1:
28722 matrixHelper.translate(letters[i].animatorJustifyOffset + documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[letters[i].line]),0,0);
28723 break;
28724 case 2:
28725 matrixHelper.translate(letters[i].animatorJustifyOffset + documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[letters[i].line])/2,0,0);
28726 break;
28727 }
28728 matrixHelper.translate(0,-documentData.ls);
28729 matrixHelper.translate(offf,0,0);
28730 matrixHelper.translate(alignment[0]*letters[i].an/200,alignment[1]*yOff/100,0);
28731 xPos += letters[i].l + documentData.tr/1000*documentData.finalSize;
28732 }
28733 if(renderType === 'html'){
28734 letterM = matrixHelper.toCSS();
28735 }else if(renderType === 'svg'){
28736 letterM = matrixHelper.to2dCSS();
28737 }else{
28738 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]];
28739 }
28740 letterO = elemOpacity;
28741 }
28742
28743 if(renderedLettersCount <= i) {
28744 letterValue = new LetterProps(letterO,letterSw,letterSc,letterFc,letterM,letterP);
28745 this.renderedLetters.push(letterValue);
28746 renderedLettersCount += 1;
28747 this.lettersChangedFlag = true;
28748 } else {
28749 letterValue = this.renderedLetters[i];
28750 this.lettersChangedFlag = letterValue.update(letterO, letterSw, letterSc, letterFc, letterM, letterP) || this.lettersChangedFlag;
28751 }
28752 }
28753};
28754
28755TextAnimatorProperty.prototype.getValue = function(){
28756 if(this._elem.globalData.frameId === this._frameId){
28757 return;
28758 }
28759 this._frameId = this._elem.globalData.frameId;
28760 this.iterateDynamicProperties();
28761};
28762
28763TextAnimatorProperty.prototype.mHelper = new Matrix();
28764TextAnimatorProperty.prototype.defaultPropsArray = [];
28765extendPrototype([DynamicPropertyContainer], TextAnimatorProperty);
28766function TextAnimatorDataProperty(elem, animatorProps, container) {
28767 var defaultData = {propType:false};
28768 var getProp = PropertyFactory.getProp;
28769 var textAnimator_animatables = animatorProps.a;
28770 this.a = {
28771 r: textAnimator_animatables.r ? getProp(elem, textAnimator_animatables.r, 0, degToRads, container) : defaultData,
28772 rx: textAnimator_animatables.rx ? getProp(elem, textAnimator_animatables.rx, 0, degToRads, container) : defaultData,
28773 ry: textAnimator_animatables.ry ? getProp(elem, textAnimator_animatables.ry, 0, degToRads, container) : defaultData,
28774 sk: textAnimator_animatables.sk ? getProp(elem, textAnimator_animatables.sk, 0, degToRads, container) : defaultData,
28775 sa: textAnimator_animatables.sa ? getProp(elem, textAnimator_animatables.sa, 0, degToRads, container) : defaultData,
28776 s: textAnimator_animatables.s ? getProp(elem, textAnimator_animatables.s, 1, 0.01, container) : defaultData,
28777 a: textAnimator_animatables.a ? getProp(elem, textAnimator_animatables.a, 1, 0, container) : defaultData,
28778 o: textAnimator_animatables.o ? getProp(elem, textAnimator_animatables.o, 0, 0.01, container) : defaultData,
28779 p: textAnimator_animatables.p ? getProp(elem,textAnimator_animatables.p, 1, 0, container) : defaultData,
28780 sw: textAnimator_animatables.sw ? getProp(elem, textAnimator_animatables.sw, 0, 0, container) : defaultData,
28781 sc: textAnimator_animatables.sc ? getProp(elem, textAnimator_animatables.sc, 1, 0, container) : defaultData,
28782 fc: textAnimator_animatables.fc ? getProp(elem, textAnimator_animatables.fc, 1, 0, container) : defaultData,
28783 fh: textAnimator_animatables.fh ? getProp(elem, textAnimator_animatables.fh, 0, 0, container) : defaultData,
28784 fs: textAnimator_animatables.fs ? getProp(elem, textAnimator_animatables.fs, 0, 0.01, container) : defaultData,
28785 fb: textAnimator_animatables.fb ? getProp(elem, textAnimator_animatables.fb, 0, 0.01, container) : defaultData,
28786 t: textAnimator_animatables.t ? getProp(elem, textAnimator_animatables.t, 0, 0, container) : defaultData
28787 };
28788
28789 this.s = TextSelectorProp.getTextSelectorProp(elem,animatorProps.s, container);
28790 this.s.t = animatorProps.s.t;
28791}
28792function LetterProps(o, sw, sc, fc, m, p){
28793 this.o = o;
28794 this.sw = sw;
28795 this.sc = sc;
28796 this.fc = fc;
28797 this.m = m;
28798 this.p = p;
28799 this._mdf = {
28800 o: true,
28801 sw: !!sw,
28802 sc: !!sc,
28803 fc: !!fc,
28804 m: true,
28805 p: true
28806 };
28807}
28808
28809LetterProps.prototype.update = function(o, sw, sc, fc, m, p) {
28810 this._mdf.o = false;
28811 this._mdf.sw = false;
28812 this._mdf.sc = false;
28813 this._mdf.fc = false;
28814 this._mdf.m = false;
28815 this._mdf.p = false;
28816 var updated = false;
28817
28818 if(this.o !== o) {
28819 this.o = o;
28820 this._mdf.o = true;
28821 updated = true;
28822 }
28823 if(this.sw !== sw) {
28824 this.sw = sw;
28825 this._mdf.sw = true;
28826 updated = true;
28827 }
28828 if(this.sc !== sc) {
28829 this.sc = sc;
28830 this._mdf.sc = true;
28831 updated = true;
28832 }
28833 if(this.fc !== fc) {
28834 this.fc = fc;
28835 this._mdf.fc = true;
28836 updated = true;
28837 }
28838 if(this.m !== m) {
28839 this.m = m;
28840 this._mdf.m = true;
28841 updated = true;
28842 }
28843 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])) {
28844 this.p = p;
28845 this._mdf.p = true;
28846 updated = true;
28847 }
28848 return updated;
28849};
28850function TextProperty(elem, data){
28851 this._frameId = initialDefaultFrame;
28852 this.pv = '';
28853 this.v = '';
28854 this.kf = false;
28855 this._isFirstFrame = true;
28856 this._mdf = false;
28857 this.data = data;
28858 this.elem = elem;
28859 this.comp = this.elem.comp;
28860 this.keysIndex = 0;
28861 this.canResize = false;
28862 this.minimumFontSize = 1;
28863 this.effectsSequence = [];
28864 this.currentData = {
28865 ascent: 0,
28866 boxWidth: this.defaultBoxWidth,
28867 f: '',
28868 fStyle: '',
28869 fWeight: '',
28870 fc: '',
28871 j: '',
28872 justifyOffset: '',
28873 l: [],
28874 lh: 0,
28875 lineWidths: [],
28876 ls: '',
28877 of: '',
28878 s: '',
28879 sc: '',
28880 sw: 0,
28881 t: 0,
28882 tr: 0,
28883 sz:0,
28884 ps:null,
28885 fillColorAnim: false,
28886 strokeColorAnim: false,
28887 strokeWidthAnim: false,
28888 yOffset: 0,
28889 finalSize:0,
28890 finalText:[],
28891 finalLineHeight: 0,
28892 __complete: false
28893
28894 };
28895 this.copyData(this.currentData, this.data.d.k[0].s);
28896
28897 if(!this.searchProperty()) {
28898 this.completeTextData(this.currentData);
28899 }
28900}
28901
28902TextProperty.prototype.defaultBoxWidth = [0,0];
28903
28904TextProperty.prototype.copyData = function(obj, data) {
28905 for(var s in data) {
28906 if(data.hasOwnProperty(s)) {
28907 obj[s] = data[s];
28908 }
28909 }
28910 return obj;
28911};
28912
28913TextProperty.prototype.setCurrentData = function(data){
28914 if(!data.__complete) {
28915 this.completeTextData(data);
28916 }
28917 this.currentData = data;
28918 this.currentData.boxWidth = this.currentData.boxWidth || this.defaultBoxWidth;
28919 this._mdf = true;
28920};
28921
28922TextProperty.prototype.searchProperty = function() {
28923 return this.searchKeyframes();
28924};
28925
28926TextProperty.prototype.searchKeyframes = function() {
28927 this.kf = this.data.d.k.length > 1;
28928 if(this.kf) {
28929 this.addEffect(this.getKeyframeValue.bind(this));
28930 }
28931 return this.kf;
28932};
28933
28934TextProperty.prototype.addEffect = function(effectFunction) {
28935 this.effectsSequence.push(effectFunction);
28936 this.elem.addDynamicProperty(this);
28937};
28938
28939TextProperty.prototype.getValue = function(_finalValue) {
28940 if((this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) && !_finalValue) {
28941 return;
28942 }
28943 this.currentData.t = this.data.d.k[this.keysIndex].s.t;
28944 var currentValue = this.currentData;
28945 var currentIndex = this.keysIndex;
28946 if(this.lock) {
28947 this.setCurrentData(this.currentData);
28948 return;
28949 }
28950 this.lock = true;
28951 this._mdf = false;
28952 var i, len = this.effectsSequence.length;
28953 var finalValue = _finalValue || this.data.d.k[this.keysIndex].s;
28954 for(i = 0; i < len; i += 1) {
28955 //Checking if index changed to prevent creating a new object every time the expression updates.
28956 if(currentIndex !== this.keysIndex) {
28957 finalValue = this.effectsSequence[i](finalValue, finalValue.t);
28958 } else {
28959 finalValue = this.effectsSequence[i](this.currentData, finalValue.t);
28960 }
28961 }
28962 if(currentValue !== finalValue) {
28963 this.setCurrentData(finalValue);
28964 }
28965 this.pv = this.v = this.currentData;
28966 this.lock = false;
28967 this.frameId = this.elem.globalData.frameId;
28968};
28969
28970TextProperty.prototype.getKeyframeValue = function() {
28971 var textKeys = this.data.d.k, textDocumentData;
28972 var frameNum = this.elem.comp.renderedFrame;
28973 var i = 0, len = textKeys.length;
28974 while(i <= len - 1) {
28975 textDocumentData = textKeys[i].s;
28976 if(i === len - 1 || textKeys[i+1].t > frameNum){
28977 break;
28978 }
28979 i += 1;
28980 }
28981 if(this.keysIndex !== i) {
28982 this.keysIndex = i;
28983 }
28984 return this.data.d.k[this.keysIndex].s;
28985};
28986
28987TextProperty.prototype.buildFinalText = function(text) {
28988 var combinedCharacters = FontManager.getCombinedCharacterCodes();
28989 var charactersArray = [];
28990 var i = 0, len = text.length;
28991 while (i < len) {
28992 if (combinedCharacters.indexOf(text.charCodeAt(i)) !== -1) {
28993 charactersArray[charactersArray.length - 1] += text.charAt(i);
28994 } else {
28995 charactersArray.push(text.charAt(i));
28996 }
28997 i += 1;
28998 }
28999 return charactersArray;
29000};
29001
29002TextProperty.prototype.completeTextData = function(documentData) {
29003 documentData.__complete = true;
29004 var fontManager = this.elem.globalData.fontManager;
29005 var data = this.data;
29006 var letters = [];
29007 var i, len;
29008 var newLineFlag, index = 0, val;
29009 var anchorGrouping = data.m.g;
29010 var currentSize = 0, currentPos = 0, currentLine = 0, lineWidths = [];
29011 var lineWidth = 0;
29012 var maxLineWidth = 0;
29013 var j, jLen;
29014 var fontData = fontManager.getFontByName(documentData.f);
29015 var charData, cLength = 0;
29016 var styles = fontData.fStyle ? fontData.fStyle.split(' ') : [];
29017
29018 var fWeight = 'normal', fStyle = 'normal';
29019 len = styles.length;
29020 var styleName;
29021 for(i=0;i<len;i+=1){
29022 styleName = styles[i].toLowerCase();
29023 switch(styleName) {
29024 case 'italic':
29025 fStyle = 'italic';
29026 break;
29027 case 'bold':
29028 fWeight = '700';
29029 break;
29030 case 'black':
29031 fWeight = '900';
29032 break;
29033 case 'medium':
29034 fWeight = '500';
29035 break;
29036 case 'regular':
29037 case 'normal':
29038 fWeight = '400';
29039 break;
29040 case 'light':
29041 case 'thin':
29042 fWeight = '200';
29043 break;
29044 }
29045 }
29046 documentData.fWeight = fontData.fWeight || fWeight;
29047 documentData.fStyle = fStyle;
29048 len = documentData.t.length;
29049 documentData.finalSize = documentData.s;
29050 documentData.finalText = this.buildFinalText(documentData.t);
29051 documentData.finalLineHeight = documentData.lh;
29052 var trackingOffset = documentData.tr/1000*documentData.finalSize;
29053 var charCode;
29054 if(documentData.sz){
29055 var flag = true;
29056 var boxWidth = documentData.sz[0];
29057 var boxHeight = documentData.sz[1];
29058 var currentHeight, finalText;
29059 while(flag) {
29060 finalText = this.buildFinalText(documentData.t);
29061 currentHeight = 0;
29062 lineWidth = 0;
29063 len = finalText.length;
29064 trackingOffset = documentData.tr/1000*documentData.finalSize;
29065 var lastSpaceIndex = -1;
29066 for(i=0;i<len;i+=1){
29067 charCode = finalText[i].charCodeAt(0);
29068 newLineFlag = false;
29069 if(finalText[i] === ' '){
29070 lastSpaceIndex = i;
29071 }else if(charCode === 13 || charCode === 3){
29072 lineWidth = 0;
29073 newLineFlag = true;
29074 currentHeight += documentData.finalLineHeight || documentData.finalSize*1.2;
29075 }
29076 if(fontManager.chars){
29077 charData = fontManager.getCharData(finalText[i], fontData.fStyle, fontData.fFamily);
29078 cLength = newLineFlag ? 0 : charData.w*documentData.finalSize/100;
29079 }else{
29080 //tCanvasHelper.font = documentData.s + 'px '+ fontData.fFamily;
29081 cLength = fontManager.measureText(finalText[i], documentData.f, documentData.finalSize);
29082 }
29083 if(lineWidth + cLength > boxWidth && finalText[i] !== ' '){
29084 if(lastSpaceIndex === -1){
29085 len += 1;
29086 } else {
29087 i = lastSpaceIndex;
29088 }
29089 currentHeight += documentData.finalLineHeight || documentData.finalSize*1.2;
29090 finalText.splice(i, lastSpaceIndex === i ? 1 : 0,"\r");
29091 //finalText = finalText.substr(0,i) + "\r" + finalText.substr(i === lastSpaceIndex ? i + 1 : i);
29092 lastSpaceIndex = -1;
29093 lineWidth = 0;
29094 }else {
29095 lineWidth += cLength;
29096 lineWidth += trackingOffset;
29097 }
29098 }
29099 currentHeight += fontData.ascent*documentData.finalSize/100;
29100 if(this.canResize && documentData.finalSize > this.minimumFontSize && boxHeight < currentHeight) {
29101 documentData.finalSize -= 1;
29102 documentData.finalLineHeight = documentData.finalSize * documentData.lh / documentData.s;
29103 } else {
29104 documentData.finalText = finalText;
29105 len = documentData.finalText.length;
29106 flag = false;
29107 }
29108 }
29109
29110 }
29111 lineWidth = - trackingOffset;
29112 cLength = 0;
29113 var uncollapsedSpaces = 0;
29114 var currentChar;
29115 for (i = 0;i < len ;i += 1) {
29116 newLineFlag = false;
29117 currentChar = documentData.finalText[i];
29118 charCode = currentChar.charCodeAt(0);
29119 if (currentChar === ' '){
29120 val = '\u00A0';
29121 } else if (charCode === 13 || charCode === 3) {
29122 uncollapsedSpaces = 0;
29123 lineWidths.push(lineWidth);
29124 maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth;
29125 lineWidth = - 2 * trackingOffset;
29126 val = '';
29127 newLineFlag = true;
29128 currentLine += 1;
29129 }else{
29130 val = documentData.finalText[i];
29131 }
29132 if(fontManager.chars){
29133 charData = fontManager.getCharData(currentChar, fontData.fStyle, fontManager.getFontByName(documentData.f).fFamily);
29134 cLength = newLineFlag ? 0 : charData.w*documentData.finalSize/100;
29135 }else{
29136 //var charWidth = fontManager.measureText(val, documentData.f, documentData.finalSize);
29137 //tCanvasHelper.font = documentData.finalSize + 'px '+ fontManager.getFontByName(documentData.f).fFamily;
29138 cLength = fontManager.measureText(val, documentData.f, documentData.finalSize);
29139 }
29140
29141 //
29142 if(currentChar === ' '){
29143 uncollapsedSpaces += cLength + trackingOffset;
29144 } else {
29145 lineWidth += cLength + trackingOffset + uncollapsedSpaces;
29146 uncollapsedSpaces = 0;
29147 }
29148 letters.push({l:cLength,an:cLength,add:currentSize,n:newLineFlag, anIndexes:[], val: val, line: currentLine, animatorJustifyOffset: 0});
29149 if(anchorGrouping == 2){
29150 currentSize += cLength;
29151 if(val === '' || val === '\u00A0' || i === len - 1){
29152 if(val === '' || val === '\u00A0'){
29153 currentSize -= cLength;
29154 }
29155 while(currentPos<=i){
29156 letters[currentPos].an = currentSize;
29157 letters[currentPos].ind = index;
29158 letters[currentPos].extra = cLength;
29159 currentPos += 1;
29160 }
29161 index += 1;
29162 currentSize = 0;
29163 }
29164 }else if(anchorGrouping == 3){
29165 currentSize += cLength;
29166 if(val === '' || i === len - 1){
29167 if(val === ''){
29168 currentSize -= cLength;
29169 }
29170 while(currentPos<=i){
29171 letters[currentPos].an = currentSize;
29172 letters[currentPos].ind = index;
29173 letters[currentPos].extra = cLength;
29174 currentPos += 1;
29175 }
29176 currentSize = 0;
29177 index += 1;
29178 }
29179 }else{
29180 letters[index].ind = index;
29181 letters[index].extra = 0;
29182 index += 1;
29183 }
29184 }
29185 documentData.l = letters;
29186 maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth;
29187 lineWidths.push(lineWidth);
29188 if(documentData.sz){
29189 documentData.boxWidth = documentData.sz[0];
29190 documentData.justifyOffset = 0;
29191 }else{
29192 documentData.boxWidth = maxLineWidth;
29193 switch(documentData.j){
29194 case 1:
29195 documentData.justifyOffset = - documentData.boxWidth;
29196 break;
29197 case 2:
29198 documentData.justifyOffset = - documentData.boxWidth/2;
29199 break;
29200 default:
29201 documentData.justifyOffset = 0;
29202 }
29203 }
29204 documentData.lineWidths = lineWidths;
29205
29206 var animators = data.a, animatorData, letterData;
29207 jLen = animators.length;
29208 var based, ind, indexes = [];
29209 for(j=0;j<jLen;j+=1){
29210 animatorData = animators[j];
29211 if(animatorData.a.sc){
29212 documentData.strokeColorAnim = true;
29213 }
29214 if(animatorData.a.sw){
29215 documentData.strokeWidthAnim = true;
29216 }
29217 if(animatorData.a.fc || animatorData.a.fh || animatorData.a.fs || animatorData.a.fb){
29218 documentData.fillColorAnim = true;
29219 }
29220 ind = 0;
29221 based = animatorData.s.b;
29222 for(i=0;i<len;i+=1){
29223 letterData = letters[i];
29224 letterData.anIndexes[j] = ind;
29225 if((based == 1 && letterData.val !== '') || (based == 2 && letterData.val !== '' && letterData.val !== '\u00A0') || (based == 3 && (letterData.n || letterData.val == '\u00A0' || i == len - 1)) || (based == 4 && (letterData.n || i == len - 1))){
29226 if(animatorData.s.rn === 1){
29227 indexes.push(ind);
29228 }
29229 ind += 1;
29230 }
29231 }
29232 data.a[j].s.totalChars = ind;
29233 var currentInd = -1, newInd;
29234 if(animatorData.s.rn === 1){
29235 for(i = 0; i < len; i += 1){
29236 letterData = letters[i];
29237 if(currentInd != letterData.anIndexes[j]){
29238 currentInd = letterData.anIndexes[j];
29239 newInd = indexes.splice(Math.floor(Math.random()*indexes.length),1)[0];
29240 }
29241 letterData.anIndexes[j] = newInd;
29242 }
29243 }
29244 }
29245 documentData.yOffset = documentData.finalLineHeight || documentData.finalSize*1.2;
29246 documentData.ls = documentData.ls || 0;
29247 documentData.ascent = fontData.ascent*documentData.finalSize/100;
29248};
29249
29250TextProperty.prototype.updateDocumentData = function(newData, index) {
29251 index = index === undefined ? this.keysIndex : index;
29252 var dData = this.copyData({}, this.data.d.k[index].s);
29253 dData = this.copyData(dData, newData);
29254 this.data.d.k[index].s = dData;
29255 this.recalculate(index);
29256 this.elem.addDynamicProperty(this);
29257};
29258
29259TextProperty.prototype.recalculate = function(index) {
29260 var dData = this.data.d.k[index].s;
29261 dData.__complete = false;
29262 this.keysIndex = 0;
29263 this._isFirstFrame = true;
29264 this.getValue(dData);
29265};
29266
29267TextProperty.prototype.canResizeFont = function(_canResize) {
29268 this.canResize = _canResize;
29269 this.recalculate(this.keysIndex);
29270 this.elem.addDynamicProperty(this);
29271};
29272
29273TextProperty.prototype.setMinimumFontSize = function(_fontValue) {
29274 this.minimumFontSize = Math.floor(_fontValue) || 1;
29275 this.recalculate(this.keysIndex);
29276 this.elem.addDynamicProperty(this);
29277};
29278
29279var TextSelectorProp = (function(){
29280 var max = Math.max;
29281 var min = Math.min;
29282 var floor = Math.floor;
29283
29284 function TextSelectorProp(elem,data){
29285 this._currentTextLength = -1;
29286 this.k = false;
29287 this.data = data;
29288 this.elem = elem;
29289 this.comp = elem.comp;
29290 this.finalS = 0;
29291 this.finalE = 0;
29292 this.initDynamicPropertyContainer(elem);
29293 this.s = PropertyFactory.getProp(elem,data.s || {k:0},0,0,this);
29294 if('e' in data){
29295 this.e = PropertyFactory.getProp(elem,data.e,0,0,this);
29296 }else{
29297 this.e = {v:100};
29298 }
29299 this.o = PropertyFactory.getProp(elem,data.o || {k:0},0,0,this);
29300 this.xe = PropertyFactory.getProp(elem,data.xe || {k:0},0,0,this);
29301 this.ne = PropertyFactory.getProp(elem,data.ne || {k:0},0,0,this);
29302 this.a = PropertyFactory.getProp(elem,data.a,0,0.01,this);
29303 if(!this.dynamicProperties.length){
29304 this.getValue();
29305 }
29306 }
29307
29308 TextSelectorProp.prototype = {
29309 getMult: function(ind) {
29310 if(this._currentTextLength !== this.elem.textProperty.currentData.l.length) {
29311 this.getValue();
29312 }
29313 //var easer = bez.getEasingCurve(this.ne.v/100,0,1-this.xe.v/100,1);
29314 var easer = BezierFactory.getBezierEasing(this.ne.v/100,0,1-this.xe.v/100,1).get;
29315 var mult = 0;
29316 var s = this.finalS;
29317 var e = this.finalE;
29318 var type = this.data.sh;
29319 if(type == 2){
29320 if(e === s){
29321 mult = ind >= e ? 1 : 0;
29322 }else{
29323 mult = max(0,min(0.5/(e-s) + (ind-s)/(e-s),1));
29324 }
29325 mult = easer(mult);
29326 }else if(type == 3){
29327 if(e === s){
29328 mult = ind >= e ? 0 : 1;
29329 }else{
29330 mult = 1 - max(0,min(0.5/(e-s) + (ind-s)/(e-s),1));
29331 }
29332
29333 mult = easer(mult);
29334 }else if(type == 4){
29335 if(e === s){
29336 mult = 0;
29337 }else{
29338 mult = max(0,min(0.5/(e-s) + (ind-s)/(e-s),1));
29339 if(mult<0.5){
29340 mult *= 2;
29341 }else{
29342 mult = 1 - 2*(mult-0.5);
29343 }
29344 }
29345 mult = easer(mult);
29346 }else if(type == 5){
29347 if(e === s){
29348 mult = 0;
29349 }else{
29350 var tot = e - s;
29351 /*ind += 0.5;
29352 mult = -4/(tot*tot)*(ind*ind)+(4/tot)*ind;*/
29353 ind = min(max(0,ind+0.5-s),e-s);
29354 var x = -tot/2+ind;
29355 var a = tot/2;
29356 mult = Math.sqrt(1 - (x*x)/(a*a));
29357 }
29358 mult = easer(mult);
29359 }else if(type == 6){
29360 if(e === s){
29361 mult = 0;
29362 }else{
29363 ind = min(max(0,ind+0.5-s),e-s);
29364 mult = (1+(Math.cos((Math.PI+Math.PI*2*(ind)/(e-s)))))/2;
29365 /*
29366 ind = Math.min(Math.max(s,ind),e-1);
29367 mult = (1+(Math.cos((Math.PI+Math.PI*2*(ind-s)/(e-1-s)))))/2;
29368 mult = Math.max(mult,(1/(e-1-s))/(e-1-s));*/
29369 }
29370 mult = easer(mult);
29371 }else {
29372 if(ind >= floor(s)){
29373 if(ind-s < 0){
29374 mult = 1 - (s - ind);
29375 }else{
29376 mult = max(0,min(e-ind,1));
29377 }
29378 }
29379 mult = easer(mult);
29380 }
29381 return mult*this.a.v;
29382 },
29383 getValue: function(newCharsFlag) {
29384 this.iterateDynamicProperties();
29385 this._mdf = newCharsFlag || this._mdf;
29386 this._currentTextLength = this.elem.textProperty.currentData.l.length || 0;
29387 if(newCharsFlag && this.data.r === 2) {
29388 this.e.v = this._currentTextLength;
29389 }
29390 var divisor = this.data.r === 2 ? 1 : 100 / this.data.totalChars;
29391 var o = this.o.v/divisor;
29392 var s = this.s.v/divisor + o;
29393 var e = (this.e.v/divisor) + o;
29394 if(s>e){
29395 var _s = s;
29396 s = e;
29397 e = _s;
29398 }
29399 this.finalS = s;
29400 this.finalE = e;
29401 }
29402 };
29403 extendPrototype([DynamicPropertyContainer], TextSelectorProp);
29404
29405 function getTextSelectorProp(elem, data,arr) {
29406 return new TextSelectorProp(elem, data, arr);
29407 }
29408
29409 return {
29410 getTextSelectorProp: getTextSelectorProp
29411 };
29412}());
29413
29414
29415var pool_factory = (function() {
29416 return function(initialLength, _create, _release, _clone) {
29417
29418 var _length = 0;
29419 var _maxLength = initialLength;
29420 var pool = createSizedArray(_maxLength);
29421
29422 var ob = {
29423 newElement: newElement,
29424 release: release
29425 };
29426
29427 function newElement(){
29428 var element;
29429 if(_length){
29430 _length -= 1;
29431 element = pool[_length];
29432 } else {
29433 element = _create();
29434 }
29435 return element;
29436 }
29437
29438 function release(element) {
29439 if(_length === _maxLength) {
29440 pool = pooling.double(pool);
29441 _maxLength = _maxLength*2;
29442 }
29443 if (_release) {
29444 _release(element);
29445 }
29446 pool[_length] = element;
29447 _length += 1;
29448 }
29449
29450 return ob;
29451 };
29452}());
29453
29454var pooling = (function(){
29455
29456 function double(arr){
29457 return arr.concat(createSizedArray(arr.length));
29458 }
29459
29460 return {
29461 double: double
29462 };
29463}());
29464var point_pool = (function(){
29465
29466 function create() {
29467 return createTypedArray('float32', 2);
29468 }
29469 return pool_factory(8, create);
29470}());
29471var shape_pool = (function(){
29472
29473 function create() {
29474 return new ShapePath();
29475 }
29476
29477 function release(shapePath) {
29478 var len = shapePath._length, i;
29479 for(i = 0; i < len; i += 1) {
29480 point_pool.release(shapePath.v[i]);
29481 point_pool.release(shapePath.i[i]);
29482 point_pool.release(shapePath.o[i]);
29483 shapePath.v[i] = null;
29484 shapePath.i[i] = null;
29485 shapePath.o[i] = null;
29486 }
29487 shapePath._length = 0;
29488 shapePath.c = false;
29489 }
29490
29491 function clone(shape) {
29492 var cloned = factory.newElement();
29493 var i, len = shape._length === undefined ? shape.v.length : shape._length;
29494 cloned.setLength(len);
29495 cloned.c = shape.c;
29496
29497 for(i = 0; i < len; i += 1) {
29498 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);
29499 }
29500 return cloned;
29501 }
29502
29503 var factory = pool_factory(4, create, release);
29504 factory.clone = clone;
29505
29506 return factory;
29507}());
29508var shapeCollection_pool = (function(){
29509 var ob = {
29510 newShapeCollection: newShapeCollection,
29511 release: release
29512 };
29513
29514 var _length = 0;
29515 var _maxLength = 4;
29516 var pool = createSizedArray(_maxLength);
29517
29518 function newShapeCollection(){
29519 var shapeCollection;
29520 if(_length){
29521 _length -= 1;
29522 shapeCollection = pool[_length];
29523 } else {
29524 shapeCollection = new ShapeCollection();
29525 }
29526 return shapeCollection;
29527 }
29528
29529 function release(shapeCollection) {
29530 var i, len = shapeCollection._length;
29531 for(i = 0; i < len; i += 1) {
29532 shape_pool.release(shapeCollection.shapes[i]);
29533 }
29534 shapeCollection._length = 0;
29535
29536 if(_length === _maxLength) {
29537 pool = pooling.double(pool);
29538 _maxLength = _maxLength*2;
29539 }
29540 pool[_length] = shapeCollection;
29541 _length += 1;
29542 }
29543
29544 return ob;
29545}());
29546var segments_length_pool = (function(){
29547
29548 function create() {
29549 return {
29550 lengths: [],
29551 totalLength: 0
29552 };
29553 }
29554
29555 function release(element) {
29556 var i, len = element.lengths.length;
29557 for(i=0;i<len;i+=1) {
29558 bezier_length_pool.release(element.lengths[i]);
29559 }
29560 element.lengths.length = 0;
29561 }
29562
29563 return pool_factory(8, create, release);
29564}());
29565var bezier_length_pool = (function(){
29566
29567 function create() {
29568 return {
29569 addedLength: 0,
29570 percents: createTypedArray('float32', defaultCurveSegments),
29571 lengths: createTypedArray('float32', defaultCurveSegments),
29572 };
29573 }
29574 return pool_factory(8, create);
29575}());
29576function BaseRenderer(){}
29577BaseRenderer.prototype.checkLayers = function(num){
29578 var i, len = this.layers.length, data;
29579 this.completeLayers = true;
29580 for (i = len - 1; i >= 0; i--) {
29581 if (!this.elements[i]) {
29582 data = this.layers[i];
29583 if(data.ip - data.st <= (num - this.layers[i].st) && data.op - data.st > (num - this.layers[i].st))
29584 {
29585 this.buildItem(i);
29586 }
29587 }
29588 this.completeLayers = this.elements[i] ? this.completeLayers:false;
29589 }
29590 this.checkPendingElements();
29591};
29592
29593BaseRenderer.prototype.createItem = function(layer){
29594 switch(layer.ty){
29595 case 2:
29596 return this.createImage(layer);
29597 case 0:
29598 return this.createComp(layer);
29599 case 1:
29600 return this.createSolid(layer);
29601 case 3:
29602 return this.createNull(layer);
29603 case 4:
29604 return this.createShape(layer);
29605 case 5:
29606 return this.createText(layer);
29607 case 13:
29608 return this.createCamera(layer);
29609 }
29610 return this.createNull(layer);
29611};
29612
29613BaseRenderer.prototype.createCamera = function(){
29614 throw new Error('You\'re using a 3d camera. Try the html renderer.');
29615};
29616
29617BaseRenderer.prototype.buildAllItems = function(){
29618 var i, len = this.layers.length;
29619 for(i=0;i<len;i+=1){
29620 this.buildItem(i);
29621 }
29622 this.checkPendingElements();
29623};
29624
29625BaseRenderer.prototype.includeLayers = function(newLayers){
29626 this.completeLayers = false;
29627 var i, len = newLayers.length;
29628 var j, jLen = this.layers.length;
29629 for(i=0;i<len;i+=1){
29630 j = 0;
29631 while(j<jLen){
29632 if(this.layers[j].id == newLayers[i].id){
29633 this.layers[j] = newLayers[i];
29634 break;
29635 }
29636 j += 1;
29637 }
29638 }
29639};
29640
29641BaseRenderer.prototype.setProjectInterface = function(pInterface){
29642 this.globalData.projectInterface = pInterface;
29643};
29644
29645BaseRenderer.prototype.initItems = function(){
29646 if(!this.globalData.progressiveLoad){
29647 this.buildAllItems();
29648 }
29649};
29650BaseRenderer.prototype.buildElementParenting = function(element, parentName, hierarchy) {
29651 var elements = this.elements;
29652 var layers = this.layers;
29653 var i=0, len = layers.length;
29654 while (i < len) {
29655 if (layers[i].ind == parentName) {
29656 if (!elements[i] || elements[i] === true) {
29657 this.buildItem(i);
29658 this.addPendingElement(element);
29659 } else {
29660 hierarchy.push(elements[i]);
29661 elements[i].setAsParent();
29662 if(layers[i].parent !== undefined) {
29663 this.buildElementParenting(element, layers[i].parent, hierarchy);
29664 } else {
29665 element.setHierarchy(hierarchy);
29666 }
29667 }
29668 }
29669 i += 1;
29670 }
29671};
29672
29673BaseRenderer.prototype.addPendingElement = function(element){
29674 this.pendingElements.push(element);
29675};
29676
29677BaseRenderer.prototype.searchExtraCompositions = function(assets){
29678 var i, len = assets.length;
29679 for(i=0;i<len;i+=1){
29680 if(assets[i].xt){
29681 var comp = this.createComp(assets[i]);
29682 comp.initExpressions();
29683 this.globalData.projectInterface.registerComposition(comp);
29684 }
29685 }
29686};
29687
29688BaseRenderer.prototype.setupGlobalData = function(animData, fontsContainer) {
29689 this.globalData.fontManager = new FontManager();
29690 this.globalData.fontManager.addChars(animData.chars);
29691 this.globalData.fontManager.addFonts(animData.fonts, fontsContainer);
29692 this.globalData.getAssetData = this.animationItem.getAssetData.bind(this.animationItem);
29693 this.globalData.getAssetsPath = this.animationItem.getAssetsPath.bind(this.animationItem);
29694 this.globalData.imageLoader = this.animationItem.imagePreloader;
29695 this.globalData.frameId = 0;
29696 this.globalData.frameRate = animData.fr;
29697 this.globalData.nm = animData.nm;
29698 this.globalData.compSize = {
29699 w: animData.w,
29700 h: animData.h
29701 };
29702};
29703function SVGRenderer(animationItem, config){
29704 this.animationItem = animationItem;
29705 this.layers = null;
29706 this.renderedFrame = -1;
29707 this.svgElement = createNS('svg');
29708 var ariaLabel = '';
29709 if (config && config.title) {
29710 var titleElement = createNS('title');
29711 var titleId = createElementID();
29712 titleElement.setAttribute('id', titleId);
29713 titleElement.textContent = config.title;
29714 this.svgElement.appendChild(titleElement);
29715 ariaLabel += titleId;
29716 }
29717 if (config && config.description) {
29718 var descElement = createNS('desc');
29719 var descId = createElementID();
29720 descElement.setAttribute('id', descId);
29721 descElement.textContent = config.description;
29722 this.svgElement.appendChild(descElement);
29723 ariaLabel += ' ' + descId;
29724 }
29725 if (ariaLabel) {
29726 this.svgElement.setAttribute('aria-labelledby', ariaLabel);
29727 }
29728 var defs = createNS( 'defs');
29729 this.svgElement.appendChild(defs);
29730 var maskElement = createNS('g');
29731 this.svgElement.appendChild(maskElement);
29732 this.layerElement = maskElement;
29733 this.renderConfig = {
29734 preserveAspectRatio: (config && config.preserveAspectRatio) || 'xMidYMid meet',
29735 imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice',
29736 progressiveLoad: (config && config.progressiveLoad) || false,
29737 hideOnTransparent: (config && config.hideOnTransparent === false) ? false : true,
29738 viewBoxOnly: (config && config.viewBoxOnly) || false,
29739 viewBoxSize: (config && config.viewBoxSize) || false,
29740 className: (config && config.className) || ''
29741 };
29742
29743 this.globalData = {
29744 _mdf: false,
29745 frameNum: -1,
29746 defs: defs,
29747 renderConfig: this.renderConfig
29748 };
29749 this.elements = [];
29750 this.pendingElements = [];
29751 this.destroyed = false;
29752 this.rendererType = 'svg';
29753
29754}
29755
29756extendPrototype([BaseRenderer],SVGRenderer);
29757
29758SVGRenderer.prototype.createNull = function (data) {
29759 return new NullElement(data,this.globalData,this);
29760};
29761
29762SVGRenderer.prototype.createShape = function (data) {
29763 return new SVGShapeElement(data,this.globalData,this);
29764};
29765
29766SVGRenderer.prototype.createText = function (data) {
29767 return new SVGTextElement(data,this.globalData,this);
29768
29769};
29770
29771SVGRenderer.prototype.createImage = function (data) {
29772 return new IImageElement(data,this.globalData,this);
29773};
29774
29775SVGRenderer.prototype.createComp = function (data) {
29776 return new SVGCompElement(data,this.globalData,this);
29777
29778};
29779
29780SVGRenderer.prototype.createSolid = function (data) {
29781 return new ISolidElement(data,this.globalData,this);
29782};
29783
29784SVGRenderer.prototype.configAnimation = function(animData){
29785 this.svgElement.setAttribute('xmlns','http://www.w3.org/2000/svg');
29786 if(this.renderConfig.viewBoxSize) {
29787 this.svgElement.setAttribute('viewBox',this.renderConfig.viewBoxSize);
29788 } else {
29789 this.svgElement.setAttribute('viewBox','0 0 '+animData.w+' '+animData.h);
29790 }
29791
29792 if(!this.renderConfig.viewBoxOnly) {
29793 this.svgElement.setAttribute('width',animData.w);
29794 this.svgElement.setAttribute('height',animData.h);
29795 this.svgElement.style.width = '100%';
29796 this.svgElement.style.height = '100%';
29797 this.svgElement.style.transform = 'translate3d(0,0,0)';
29798 }
29799 if(this.renderConfig.className) {
29800 this.svgElement.setAttribute('class', this.renderConfig.className);
29801 }
29802 this.svgElement.setAttribute('preserveAspectRatio',this.renderConfig.preserveAspectRatio);
29803 //this.layerElement.style.transform = 'translate3d(0,0,0)';
29804 //this.layerElement.style.transformOrigin = this.layerElement.style.mozTransformOrigin = this.layerElement.style.webkitTransformOrigin = this.layerElement.style['-webkit-transform'] = "0px 0px 0px";
29805 this.animationItem.wrapper.appendChild(this.svgElement);
29806 //Mask animation
29807 var defs = this.globalData.defs;
29808
29809 this.setupGlobalData(animData, defs);
29810 this.globalData.progressiveLoad = this.renderConfig.progressiveLoad;
29811 this.data = animData;
29812
29813 var maskElement = createNS( 'clipPath');
29814 var rect = createNS('rect');
29815 rect.setAttribute('width',animData.w);
29816 rect.setAttribute('height',animData.h);
29817 rect.setAttribute('x',0);
29818 rect.setAttribute('y',0);
29819 var maskId = createElementID();
29820 maskElement.setAttribute('id', maskId);
29821 maskElement.appendChild(rect);
29822 this.layerElement.setAttribute("clip-path", "url(" + locationHref + "#"+maskId+")");
29823
29824 defs.appendChild(maskElement);
29825 this.layers = animData.layers;
29826 this.elements = createSizedArray(animData.layers.length);
29827};
29828
29829
29830SVGRenderer.prototype.destroy = function () {
29831 this.animationItem.wrapper.innerHTML = '';
29832 this.layerElement = null;
29833 this.globalData.defs = null;
29834 var i, len = this.layers ? this.layers.length : 0;
29835 for (i = 0; i < len; i++) {
29836 if(this.elements[i]){
29837 this.elements[i].destroy();
29838 }
29839 }
29840 this.elements.length = 0;
29841 this.destroyed = true;
29842 this.animationItem = null;
29843};
29844
29845SVGRenderer.prototype.updateContainerSize = function () {
29846};
29847
29848SVGRenderer.prototype.buildItem = function(pos){
29849 var elements = this.elements;
29850 if(elements[pos] || this.layers[pos].ty == 99){
29851 return;
29852 }
29853 elements[pos] = true;
29854 var element = this.createItem(this.layers[pos]);
29855
29856 elements[pos] = element;
29857 if(expressionsPlugin){
29858 if(this.layers[pos].ty === 0){
29859 this.globalData.projectInterface.registerComposition(element);
29860 }
29861 element.initExpressions();
29862 }
29863 this.appendElementInPos(element,pos);
29864 if(this.layers[pos].tt){
29865 if(!this.elements[pos - 1] || this.elements[pos - 1] === true){
29866 this.buildItem(pos - 1);
29867 this.addPendingElement(element);
29868 } else {
29869 element.setMatte(elements[pos - 1].layerId);
29870 }
29871 }
29872};
29873
29874SVGRenderer.prototype.checkPendingElements = function(){
29875 while(this.pendingElements.length){
29876 var element = this.pendingElements.pop();
29877 element.checkParenting();
29878 if(element.data.tt){
29879 var i = 0, len = this.elements.length;
29880 while(i<len){
29881 if(this.elements[i] === element){
29882 element.setMatte(this.elements[i - 1].layerId);
29883 break;
29884 }
29885 i += 1;
29886 }
29887 }
29888 }
29889};
29890
29891SVGRenderer.prototype.renderFrame = function(num){
29892 if(this.renderedFrame === num || this.destroyed){
29893 return;
29894 }
29895 if(num === null){
29896 num = this.renderedFrame;
29897 }else{
29898 this.renderedFrame = num;
29899 }
29900 // console.log('-------');
29901 // console.log('FRAME ',num);
29902 this.globalData.frameNum = num;
29903 this.globalData.frameId += 1;
29904 this.globalData.projectInterface.currentFrame = num;
29905 this.globalData._mdf = false;
29906 var i, len = this.layers.length;
29907 if(!this.completeLayers){
29908 this.checkLayers(num);
29909 }
29910 for (i = len - 1; i >= 0; i--) {
29911 if(this.completeLayers || this.elements[i]){
29912 this.elements[i].prepareFrame(num - this.layers[i].st);
29913 }
29914 }
29915 if(this.globalData._mdf) {
29916 for (i = 0; i < len; i += 1) {
29917 if(this.completeLayers || this.elements[i]){
29918 this.elements[i].renderFrame();
29919 }
29920 }
29921 }
29922};
29923
29924SVGRenderer.prototype.appendElementInPos = function(element, pos){
29925 var newElement = element.getBaseElement();
29926 if(!newElement){
29927 return;
29928 }
29929 var i = 0;
29930 var nextElement;
29931 while(i<pos){
29932 if(this.elements[i] && this.elements[i]!== true && this.elements[i].getBaseElement()){
29933 nextElement = this.elements[i].getBaseElement();
29934 }
29935 i += 1;
29936 }
29937 if(nextElement){
29938 this.layerElement.insertBefore(newElement, nextElement);
29939 } else {
29940 this.layerElement.appendChild(newElement);
29941 }
29942};
29943
29944SVGRenderer.prototype.hide = function(){
29945 this.layerElement.style.display = 'none';
29946};
29947
29948SVGRenderer.prototype.show = function(){
29949 this.layerElement.style.display = 'block';
29950};
29951
29952function CanvasRenderer(animationItem, config){
29953 this.animationItem = animationItem;
29954 this.renderConfig = {
29955 clearCanvas: (config && config.clearCanvas !== undefined) ? config.clearCanvas : true,
29956 context: (config && config.context) || null,
29957 progressiveLoad: (config && config.progressiveLoad) || false,
29958 preserveAspectRatio: (config && config.preserveAspectRatio) || 'xMidYMid meet',
29959 imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice',
29960 className: (config && config.className) || ''
29961 };
29962 this.renderConfig.dpr = (config && config.dpr) || 1;
29963 if (this.animationItem.wrapper) {
29964 this.renderConfig.dpr = (config && config.dpr) || window.devicePixelRatio || 1;
29965 }
29966 this.renderedFrame = -1;
29967 this.globalData = {
29968 frameNum: -1,
29969 _mdf: false,
29970 renderConfig: this.renderConfig,
29971 currentGlobalAlpha: -1
29972 };
29973 this.contextData = new CVContextData();
29974 this.elements = [];
29975 this.pendingElements = [];
29976 this.transformMat = new Matrix();
29977 this.completeLayers = false;
29978 this.rendererType = 'canvas';
29979}
29980extendPrototype([BaseRenderer],CanvasRenderer);
29981
29982CanvasRenderer.prototype.createShape = function (data) {
29983 return new CVShapeElement(data, this.globalData, this);
29984};
29985
29986CanvasRenderer.prototype.createText = function (data) {
29987 return new CVTextElement(data, this.globalData, this);
29988};
29989
29990CanvasRenderer.prototype.createImage = function (data) {
29991 return new CVImageElement(data, this.globalData, this);
29992};
29993
29994CanvasRenderer.prototype.createComp = function (data) {
29995 return new CVCompElement(data, this.globalData, this);
29996};
29997
29998CanvasRenderer.prototype.createSolid = function (data) {
29999 return new CVSolidElement(data, this.globalData, this);
30000};
30001
30002CanvasRenderer.prototype.createNull = SVGRenderer.prototype.createNull;
30003
30004CanvasRenderer.prototype.ctxTransform = function(props){
30005 if(props[0] === 1 && props[1] === 0 && props[4] === 0 && props[5] === 1 && props[12] === 0 && props[13] === 0){
30006 return;
30007 }
30008 if(!this.renderConfig.clearCanvas){
30009 this.canvasContext.transform(props[0],props[1],props[4],props[5],props[12],props[13]);
30010 return;
30011 }
30012 this.transformMat.cloneFromProps(props);
30013 var cProps = this.contextData.cTr.props;
30014 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]);
30015 //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]);
30016 this.contextData.cTr.cloneFromProps(this.transformMat.props);
30017 var trProps = this.contextData.cTr.props;
30018 this.canvasContext.setTransform(trProps[0],trProps[1],trProps[4],trProps[5],trProps[12],trProps[13]);
30019};
30020
30021CanvasRenderer.prototype.ctxOpacity = function(op){
30022 /*if(op === 1){
30023 return;
30024 }*/
30025 if(!this.renderConfig.clearCanvas){
30026 this.canvasContext.globalAlpha *= op < 0 ? 0 : op;
30027 this.globalData.currentGlobalAlpha = this.contextData.cO;
30028 return;
30029 }
30030 this.contextData.cO *= op < 0 ? 0 : op;
30031 if(this.globalData.currentGlobalAlpha !== this.contextData.cO) {
30032 this.canvasContext.globalAlpha = this.contextData.cO;
30033 this.globalData.currentGlobalAlpha = this.contextData.cO;
30034 }
30035};
30036
30037CanvasRenderer.prototype.reset = function(){
30038 if(!this.renderConfig.clearCanvas){
30039 this.canvasContext.restore();
30040 return;
30041 }
30042 this.contextData.reset();
30043};
30044
30045CanvasRenderer.prototype.save = function(actionFlag){
30046 if(!this.renderConfig.clearCanvas){
30047 this.canvasContext.save();
30048 return;
30049 }
30050 if(actionFlag){
30051 this.canvasContext.save();
30052 }
30053 var props = this.contextData.cTr.props;
30054 if(this.contextData._length <= this.contextData.cArrPos) {
30055 this.contextData.duplicate();
30056 }
30057 var i, arr = this.contextData.saved[this.contextData.cArrPos];
30058 for (i = 0; i < 16; i += 1) {
30059 arr[i] = props[i];
30060 }
30061 this.contextData.savedOp[this.contextData.cArrPos] = this.contextData.cO;
30062 this.contextData.cArrPos += 1;
30063};
30064
30065CanvasRenderer.prototype.restore = function(actionFlag){
30066 if(!this.renderConfig.clearCanvas){
30067 this.canvasContext.restore();
30068 return;
30069 }
30070 if(actionFlag){
30071 this.canvasContext.restore();
30072 this.globalData.blendMode = 'source-over';
30073 }
30074 this.contextData.cArrPos -= 1;
30075 var popped = this.contextData.saved[this.contextData.cArrPos];
30076 var i,arr = this.contextData.cTr.props;
30077 for(i=0;i<16;i+=1){
30078 arr[i] = popped[i];
30079 }
30080 this.canvasContext.setTransform(popped[0],popped[1],popped[4],popped[5],popped[12],popped[13]);
30081 popped = this.contextData.savedOp[this.contextData.cArrPos];
30082 this.contextData.cO = popped;
30083 if(this.globalData.currentGlobalAlpha !== popped) {
30084 this.canvasContext.globalAlpha = popped;
30085 this.globalData.currentGlobalAlpha = popped;
30086 }
30087};
30088
30089CanvasRenderer.prototype.configAnimation = function(animData){
30090 if(this.animationItem.wrapper){
30091 this.animationItem.container = createTag('canvas');
30092 this.animationItem.container.style.width = '100%';
30093 this.animationItem.container.style.height = '100%';
30094 //this.animationItem.container.style.transform = 'translate3d(0,0,0)';
30095 //this.animationItem.container.style.webkitTransform = 'translate3d(0,0,0)';
30096 this.animationItem.container.style.transformOrigin = this.animationItem.container.style.mozTransformOrigin = this.animationItem.container.style.webkitTransformOrigin = this.animationItem.container.style['-webkit-transform'] = "0px 0px 0px";
30097 this.animationItem.wrapper.appendChild(this.animationItem.container);
30098 this.canvasContext = this.animationItem.container.getContext('2d');
30099 if(this.renderConfig.className) {
30100 this.animationItem.container.setAttribute('class', this.renderConfig.className);
30101 }
30102 }else{
30103 this.canvasContext = this.renderConfig.context;
30104 }
30105 this.data = animData;
30106 this.layers = animData.layers;
30107 this.transformCanvas = {
30108 w: animData.w,
30109 h:animData.h,
30110 sx:0,
30111 sy:0,
30112 tx:0,
30113 ty:0
30114 };
30115 this.setupGlobalData(animData, document.body);
30116 this.globalData.canvasContext = this.canvasContext;
30117 this.globalData.renderer = this;
30118 this.globalData.isDashed = false;
30119 this.globalData.progressiveLoad = this.renderConfig.progressiveLoad;
30120 this.globalData.transformCanvas = this.transformCanvas;
30121 this.elements = createSizedArray(animData.layers.length);
30122
30123 this.updateContainerSize();
30124};
30125
30126CanvasRenderer.prototype.updateContainerSize = function () {
30127 this.reset();
30128 var elementWidth,elementHeight;
30129 if(this.animationItem.wrapper && this.animationItem.container){
30130 elementWidth = this.animationItem.wrapper.offsetWidth;
30131 elementHeight = this.animationItem.wrapper.offsetHeight;
30132 this.animationItem.container.setAttribute('width',elementWidth * this.renderConfig.dpr );
30133 this.animationItem.container.setAttribute('height',elementHeight * this.renderConfig.dpr);
30134 }else{
30135 elementWidth = this.canvasContext.canvas.width * this.renderConfig.dpr;
30136 elementHeight = this.canvasContext.canvas.height * this.renderConfig.dpr;
30137 }
30138 var elementRel,animationRel;
30139 if(this.renderConfig.preserveAspectRatio.indexOf('meet') !== -1 || this.renderConfig.preserveAspectRatio.indexOf('slice') !== -1){
30140 var par = this.renderConfig.preserveAspectRatio.split(' ');
30141 var fillType = par[1] || 'meet';
30142 var pos = par[0] || 'xMidYMid';
30143 var xPos = pos.substr(0,4);
30144 var yPos = pos.substr(4);
30145 elementRel = elementWidth/elementHeight;
30146 animationRel = this.transformCanvas.w/this.transformCanvas.h;
30147 if(animationRel>elementRel && fillType === 'meet' || animationRel<elementRel && fillType === 'slice'){
30148 this.transformCanvas.sx = elementWidth/(this.transformCanvas.w/this.renderConfig.dpr);
30149 this.transformCanvas.sy = elementWidth/(this.transformCanvas.w/this.renderConfig.dpr);
30150 }else{
30151 this.transformCanvas.sx = elementHeight/(this.transformCanvas.h / this.renderConfig.dpr);
30152 this.transformCanvas.sy = elementHeight/(this.transformCanvas.h / this.renderConfig.dpr);
30153 }
30154
30155 if(xPos === 'xMid' && ((animationRel<elementRel && fillType==='meet') || (animationRel>elementRel && fillType === 'slice'))){
30156 this.transformCanvas.tx = (elementWidth-this.transformCanvas.w*(elementHeight/this.transformCanvas.h))/2*this.renderConfig.dpr;
30157 } else if(xPos === 'xMax' && ((animationRel<elementRel && fillType==='meet') || (animationRel>elementRel && fillType === 'slice'))){
30158 this.transformCanvas.tx = (elementWidth-this.transformCanvas.w*(elementHeight/this.transformCanvas.h))*this.renderConfig.dpr;
30159 } else {
30160 this.transformCanvas.tx = 0;
30161 }
30162 if(yPos === 'YMid' && ((animationRel>elementRel && fillType==='meet') || (animationRel<elementRel && fillType === 'slice'))){
30163 this.transformCanvas.ty = ((elementHeight-this.transformCanvas.h*(elementWidth/this.transformCanvas.w))/2)*this.renderConfig.dpr;
30164 } else if(yPos === 'YMax' && ((animationRel>elementRel && fillType==='meet') || (animationRel<elementRel && fillType === 'slice'))){
30165 this.transformCanvas.ty = ((elementHeight-this.transformCanvas.h*(elementWidth/this.transformCanvas.w)))*this.renderConfig.dpr;
30166 } else {
30167 this.transformCanvas.ty = 0;
30168 }
30169
30170 }else if(this.renderConfig.preserveAspectRatio == 'none'){
30171 this.transformCanvas.sx = elementWidth/(this.transformCanvas.w/this.renderConfig.dpr);
30172 this.transformCanvas.sy = elementHeight/(this.transformCanvas.h/this.renderConfig.dpr);
30173 this.transformCanvas.tx = 0;
30174 this.transformCanvas.ty = 0;
30175 }else{
30176 this.transformCanvas.sx = this.renderConfig.dpr;
30177 this.transformCanvas.sy = this.renderConfig.dpr;
30178 this.transformCanvas.tx = 0;
30179 this.transformCanvas.ty = 0;
30180 }
30181 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];
30182 /*var i, len = this.elements.length;
30183 for(i=0;i<len;i+=1){
30184 if(this.elements[i] && this.elements[i].data.ty === 0){
30185 this.elements[i].resize(this.globalData.transformCanvas);
30186 }
30187 }*/
30188 this.ctxTransform(this.transformCanvas.props);
30189 this.canvasContext.beginPath();
30190 this.canvasContext.rect(0,0,this.transformCanvas.w,this.transformCanvas.h);
30191 this.canvasContext.closePath();
30192 this.canvasContext.clip();
30193
30194 this.renderFrame(this.renderedFrame, true);
30195};
30196
30197CanvasRenderer.prototype.destroy = function () {
30198 if(this.renderConfig.clearCanvas) {
30199 this.animationItem.wrapper.innerHTML = '';
30200 }
30201 var i, len = this.layers ? this.layers.length : 0;
30202 for (i = len - 1; i >= 0; i-=1) {
30203 if(this.elements[i]) {
30204 this.elements[i].destroy();
30205 }
30206 }
30207 this.elements.length = 0;
30208 this.globalData.canvasContext = null;
30209 this.animationItem.container = null;
30210 this.destroyed = true;
30211};
30212
30213CanvasRenderer.prototype.renderFrame = function(num, forceRender){
30214 if((this.renderedFrame === num && this.renderConfig.clearCanvas === true && !forceRender) || this.destroyed || num === -1){
30215 return;
30216 }
30217 this.renderedFrame = num;
30218 this.globalData.frameNum = num - this.animationItem._isFirstFrame;
30219 this.globalData.frameId += 1;
30220 this.globalData._mdf = !this.renderConfig.clearCanvas || forceRender;
30221 this.globalData.projectInterface.currentFrame = num;
30222
30223 // console.log('--------');
30224 // console.log('NEW: ',num);
30225 var i, len = this.layers.length;
30226 if(!this.completeLayers){
30227 this.checkLayers(num);
30228 }
30229
30230 for (i = 0; i < len; i++) {
30231 if(this.completeLayers || this.elements[i]){
30232 this.elements[i].prepareFrame(num - this.layers[i].st);
30233 }
30234 }
30235 if(this.globalData._mdf) {
30236 if(this.renderConfig.clearCanvas === true){
30237 this.canvasContext.clearRect(0, 0, this.transformCanvas.w, this.transformCanvas.h);
30238 }else{
30239 this.save();
30240 }
30241 for (i = len - 1; i >= 0; i-=1) {
30242 if(this.completeLayers || this.elements[i]){
30243 this.elements[i].renderFrame();
30244 }
30245 }
30246 if(this.renderConfig.clearCanvas !== true){
30247 this.restore();
30248 }
30249 }
30250};
30251
30252CanvasRenderer.prototype.buildItem = function(pos){
30253 var elements = this.elements;
30254 if(elements[pos] || this.layers[pos].ty == 99){
30255 return;
30256 }
30257 var element = this.createItem(this.layers[pos], this,this.globalData);
30258 elements[pos] = element;
30259 element.initExpressions();
30260 /*if(this.layers[pos].ty === 0){
30261 element.resize(this.globalData.transformCanvas);
30262 }*/
30263};
30264
30265CanvasRenderer.prototype.checkPendingElements = function(){
30266 while(this.pendingElements.length){
30267 var element = this.pendingElements.pop();
30268 element.checkParenting();
30269 }
30270};
30271
30272CanvasRenderer.prototype.hide = function(){
30273 this.animationItem.container.style.display = 'none';
30274};
30275
30276CanvasRenderer.prototype.show = function(){
30277 this.animationItem.container.style.display = 'block';
30278};
30279
30280function HybridRenderer(animationItem, config){
30281 this.animationItem = animationItem;
30282 this.layers = null;
30283 this.renderedFrame = -1;
30284 this.renderConfig = {
30285 className: (config && config.className) || '',
30286 imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice',
30287 hideOnTransparent: (config && config.hideOnTransparent === false) ? false : true
30288 };
30289 this.globalData = {
30290 _mdf: false,
30291 frameNum: -1,
30292 renderConfig: this.renderConfig
30293 };
30294 this.pendingElements = [];
30295 this.elements = [];
30296 this.threeDElements = [];
30297 this.destroyed = false;
30298 this.camera = null;
30299 this.supports3d = true;
30300 this.rendererType = 'html';
30301
30302}
30303
30304extendPrototype([BaseRenderer],HybridRenderer);
30305
30306HybridRenderer.prototype.buildItem = SVGRenderer.prototype.buildItem;
30307
30308HybridRenderer.prototype.checkPendingElements = function(){
30309 while(this.pendingElements.length){
30310 var element = this.pendingElements.pop();
30311 element.checkParenting();
30312 }
30313};
30314
30315HybridRenderer.prototype.appendElementInPos = function(element, pos){
30316 var newDOMElement = element.getBaseElement();
30317 if(!newDOMElement){
30318 return;
30319 }
30320 var layer = this.layers[pos];
30321 if(!layer.ddd || !this.supports3d){
30322 if(this.threeDElements) {
30323 this.addTo3dContainer(newDOMElement,pos);
30324 } else {
30325 var i = 0;
30326 var nextDOMElement, nextLayer, tmpDOMElement;
30327 while(i<pos){
30328 if(this.elements[i] && this.elements[i]!== true && this.elements[i].getBaseElement){
30329 nextLayer = this.elements[i];
30330 tmpDOMElement = this.layers[i].ddd ? this.getThreeDContainerByPos(i) : nextLayer.getBaseElement();
30331 nextDOMElement = tmpDOMElement || nextDOMElement;
30332 }
30333 i += 1;
30334 }
30335 if(nextDOMElement){
30336 if(!layer.ddd || !this.supports3d){
30337 this.layerElement.insertBefore(newDOMElement, nextDOMElement);
30338 }
30339 } else {
30340 if(!layer.ddd || !this.supports3d){
30341 this.layerElement.appendChild(newDOMElement);
30342 }
30343 }
30344 }
30345
30346 } else {
30347 this.addTo3dContainer(newDOMElement,pos);
30348 }
30349};
30350
30351HybridRenderer.prototype.createShape = function (data) {
30352 if(!this.supports3d){
30353 return new SVGShapeElement(data, this.globalData, this);
30354 }
30355 return new HShapeElement(data, this.globalData, this);
30356};
30357
30358HybridRenderer.prototype.createText = function (data) {
30359 if(!this.supports3d){
30360 return new SVGTextElement(data, this.globalData, this);
30361 }
30362 return new HTextElement(data, this.globalData, this);
30363};
30364
30365HybridRenderer.prototype.createCamera = function (data) {
30366 this.camera = new HCameraElement(data, this.globalData, this);
30367 return this.camera;
30368};
30369
30370HybridRenderer.prototype.createImage = function (data) {
30371 if(!this.supports3d){
30372 return new IImageElement(data, this.globalData, this);
30373 }
30374 return new HImageElement(data, this.globalData, this);
30375};
30376
30377HybridRenderer.prototype.createComp = function (data) {
30378 if(!this.supports3d){
30379 return new SVGCompElement(data, this.globalData, this);
30380 }
30381 return new HCompElement(data, this.globalData, this);
30382
30383};
30384
30385HybridRenderer.prototype.createSolid = function (data) {
30386 if(!this.supports3d){
30387 return new ISolidElement(data, this.globalData, this);
30388 }
30389 return new HSolidElement(data, this.globalData, this);
30390};
30391
30392HybridRenderer.prototype.createNull = SVGRenderer.prototype.createNull;
30393
30394HybridRenderer.prototype.getThreeDContainerByPos = function(pos){
30395 var i = 0, len = this.threeDElements.length;
30396 while(i<len) {
30397 if(this.threeDElements[i].startPos <= pos && this.threeDElements[i].endPos >= pos) {
30398 return this.threeDElements[i].perspectiveElem;
30399 }
30400 i += 1;
30401 }
30402};
30403
30404HybridRenderer.prototype.createThreeDContainer = function(pos, type){
30405 var perspectiveElem = createTag('div');
30406 styleDiv(perspectiveElem);
30407 var container = createTag('div');
30408 styleDiv(container);
30409 if(type === '3d') {
30410 perspectiveElem.style.width = this.globalData.compSize.w+'px';
30411 perspectiveElem.style.height = this.globalData.compSize.h+'px';
30412 perspectiveElem.style.transformOrigin = perspectiveElem.style.mozTransformOrigin = perspectiveElem.style.webkitTransformOrigin = "50% 50%";
30413 container.style.transform = container.style.webkitTransform = 'matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)';
30414 }
30415
30416 perspectiveElem.appendChild(container);
30417 //this.resizerElem.appendChild(perspectiveElem);
30418 var threeDContainerData = {
30419 container:container,
30420 perspectiveElem:perspectiveElem,
30421 startPos: pos,
30422 endPos: pos,
30423 type: type
30424 };
30425 this.threeDElements.push(threeDContainerData);
30426 return threeDContainerData;
30427};
30428
30429HybridRenderer.prototype.build3dContainers = function(){
30430 var i, len = this.layers.length;
30431 var lastThreeDContainerData;
30432 var currentContainer = '';
30433 for(i=0;i<len;i+=1){
30434 if(this.layers[i].ddd && this.layers[i].ty !== 3){
30435 if(currentContainer !== '3d'){
30436 currentContainer = '3d';
30437 lastThreeDContainerData = this.createThreeDContainer(i,'3d');
30438 }
30439 lastThreeDContainerData.endPos = Math.max(lastThreeDContainerData.endPos,i);
30440 } else {
30441 if(currentContainer !== '2d'){
30442 currentContainer = '2d';
30443 lastThreeDContainerData = this.createThreeDContainer(i,'2d');
30444 }
30445 lastThreeDContainerData.endPos = Math.max(lastThreeDContainerData.endPos,i);
30446 }
30447 }
30448 len = this.threeDElements.length;
30449 for(i = len - 1; i >= 0; i --) {
30450 this.resizerElem.appendChild(this.threeDElements[i].perspectiveElem);
30451 }
30452};
30453
30454HybridRenderer.prototype.addTo3dContainer = function(elem,pos){
30455 var i = 0, len = this.threeDElements.length;
30456 while(i<len){
30457 if(pos <= this.threeDElements[i].endPos){
30458 var j = this.threeDElements[i].startPos;
30459 var nextElement;
30460 while(j<pos){
30461 if(this.elements[j] && this.elements[j].getBaseElement){
30462 nextElement = this.elements[j].getBaseElement();
30463 }
30464 j += 1;
30465 }
30466 if(nextElement){
30467 this.threeDElements[i].container.insertBefore(elem, nextElement);
30468 } else {
30469 this.threeDElements[i].container.appendChild(elem);
30470 }
30471 break;
30472 }
30473 i += 1;
30474 }
30475};
30476
30477HybridRenderer.prototype.configAnimation = function(animData){
30478 var resizerElem = createTag('div');
30479 var wrapper = this.animationItem.wrapper;
30480 resizerElem.style.width = animData.w+'px';
30481 resizerElem.style.height = animData.h+'px';
30482 this.resizerElem = resizerElem;
30483 styleDiv(resizerElem);
30484 resizerElem.style.transformStyle = resizerElem.style.webkitTransformStyle = resizerElem.style.mozTransformStyle = "flat";
30485 if(this.renderConfig.className) {
30486 resizerElem.setAttribute('class', this.renderConfig.className);
30487 }
30488 wrapper.appendChild(resizerElem);
30489
30490 resizerElem.style.overflow = 'hidden';
30491 var svg = createNS('svg');
30492 svg.setAttribute('width','1');
30493 svg.setAttribute('height','1');
30494 styleDiv(svg);
30495 this.resizerElem.appendChild(svg);
30496 var defs = createNS('defs');
30497 svg.appendChild(defs);
30498 this.data = animData;
30499 //Mask animation
30500 this.setupGlobalData(animData, svg);
30501 this.globalData.defs = defs;
30502 this.layers = animData.layers;
30503 this.layerElement = this.resizerElem;
30504 this.build3dContainers();
30505 this.updateContainerSize();
30506};
30507
30508HybridRenderer.prototype.destroy = function () {
30509 this.animationItem.wrapper.innerHTML = '';
30510 this.animationItem.container = null;
30511 this.globalData.defs = null;
30512 var i, len = this.layers ? this.layers.length : 0;
30513 for (i = 0; i < len; i++) {
30514 this.elements[i].destroy();
30515 }
30516 this.elements.length = 0;
30517 this.destroyed = true;
30518 this.animationItem = null;
30519};
30520
30521HybridRenderer.prototype.updateContainerSize = function () {
30522 var elementWidth = this.animationItem.wrapper.offsetWidth;
30523 var elementHeight = this.animationItem.wrapper.offsetHeight;
30524 var elementRel = elementWidth/elementHeight;
30525 var animationRel = this.globalData.compSize.w/this.globalData.compSize.h;
30526 var sx,sy,tx,ty;
30527 if(animationRel>elementRel){
30528 sx = elementWidth/(this.globalData.compSize.w);
30529 sy = elementWidth/(this.globalData.compSize.w);
30530 tx = 0;
30531 ty = ((elementHeight-this.globalData.compSize.h*(elementWidth/this.globalData.compSize.w))/2);
30532 }else{
30533 sx = elementHeight/(this.globalData.compSize.h);
30534 sy = elementHeight/(this.globalData.compSize.h);
30535 tx = (elementWidth-this.globalData.compSize.w*(elementHeight/this.globalData.compSize.h))/2;
30536 ty = 0;
30537 }
30538 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)';
30539};
30540
30541HybridRenderer.prototype.renderFrame = SVGRenderer.prototype.renderFrame;
30542
30543HybridRenderer.prototype.hide = function(){
30544 this.resizerElem.style.display = 'none';
30545};
30546
30547HybridRenderer.prototype.show = function(){
30548 this.resizerElem.style.display = 'block';
30549};
30550
30551HybridRenderer.prototype.initItems = function(){
30552 this.buildAllItems();
30553 if(this.camera){
30554 this.camera.setup();
30555 } else {
30556 var cWidth = this.globalData.compSize.w;
30557 var cHeight = this.globalData.compSize.h;
30558 var i, len = this.threeDElements.length;
30559 for(i=0;i<len;i+=1){
30560 this.threeDElements[i].perspectiveElem.style.perspective = this.threeDElements[i].perspectiveElem.style.webkitPerspective = Math.sqrt(Math.pow(cWidth,2) + Math.pow(cHeight,2)) + 'px';
30561 }
30562 }
30563};
30564
30565HybridRenderer.prototype.searchExtraCompositions = function(assets){
30566 var i, len = assets.length;
30567 var floatingContainer = createTag('div');
30568 for(i=0;i<len;i+=1){
30569 if(assets[i].xt){
30570 var comp = this.createComp(assets[i],floatingContainer,this.globalData.comp,null);
30571 comp.initExpressions();
30572 this.globalData.projectInterface.registerComposition(comp);
30573 }
30574 }
30575};
30576
30577function MaskElement(data,element,globalData) {
30578 this.data = data;
30579 this.element = element;
30580 this.globalData = globalData;
30581 this.storedData = [];
30582 this.masksProperties = this.data.masksProperties || [];
30583 this.maskElement = null;
30584 var defs = this.globalData.defs;
30585 var i, len = this.masksProperties ? this.masksProperties.length : 0;
30586 this.viewData = createSizedArray(len);
30587 this.solidPath = '';
30588
30589
30590 var path, properties = this.masksProperties;
30591 var count = 0;
30592 var currentMasks = [];
30593 var j, jLen;
30594 var layerId = createElementID();
30595 var rect, expansor, feMorph,x;
30596 var maskType = 'clipPath', maskRef = 'clip-path';
30597 for (i = 0; i < len; i++) {
30598
30599 if((properties[i].mode !== 'a' && properties[i].mode !== 'n')|| properties[i].inv || properties[i].o.k !== 100){
30600 maskType = 'mask';
30601 maskRef = 'mask';
30602 }
30603
30604 if((properties[i].mode == 's' || properties[i].mode == 'i') && count === 0){
30605 rect = createNS( 'rect');
30606 rect.setAttribute('fill', '#ffffff');
30607 rect.setAttribute('width', this.element.comp.data.w || 0);
30608 rect.setAttribute('height', this.element.comp.data.h || 0);
30609 currentMasks.push(rect);
30610 } else {
30611 rect = null;
30612 }
30613
30614 path = createNS( 'path');
30615 if(properties[i].mode == 'n') {
30616 // TODO move this to a factory or to a constructor
30617 this.viewData[i] = {
30618 op: PropertyFactory.getProp(this.element,properties[i].o,0,0.01,this.element),
30619 prop: ShapePropertyFactory.getShapeProp(this.element,properties[i],3),
30620 elem: path,
30621 lastPath: ''
30622 };
30623 defs.appendChild(path);
30624 continue;
30625 }
30626 count += 1;
30627
30628 path.setAttribute('fill', properties[i].mode === 's' ? '#000000':'#ffffff');
30629 path.setAttribute('clip-rule','nonzero');
30630 var filterID;
30631
30632 if (properties[i].x.k !== 0) {
30633 maskType = 'mask';
30634 maskRef = 'mask';
30635 x = PropertyFactory.getProp(this.element,properties[i].x,0,null,this.element);
30636 filterID = createElementID();
30637 expansor = createNS('filter');
30638 expansor.setAttribute('id',filterID);
30639 feMorph = createNS('feMorphology');
30640 feMorph.setAttribute('operator','dilate');
30641 feMorph.setAttribute('in','SourceGraphic');
30642 feMorph.setAttribute('radius','0');
30643 expansor.appendChild(feMorph);
30644 defs.appendChild(expansor);
30645 path.setAttribute('stroke', properties[i].mode === 's' ? '#000000':'#ffffff');
30646 } else {
30647 feMorph = null;
30648 x = null;
30649 }
30650
30651 // TODO move this to a factory or to a constructor
30652 this.storedData[i] = {
30653 elem: path,
30654 x: x,
30655 expan: feMorph,
30656 lastPath: '',
30657 lastOperator:'',
30658 filterId:filterID,
30659 lastRadius:0
30660 };
30661 if(properties[i].mode == 'i'){
30662 jLen = currentMasks.length;
30663 var g = createNS('g');
30664 for(j=0;j<jLen;j+=1){
30665 g.appendChild(currentMasks[j]);
30666 }
30667 var mask = createNS('mask');
30668 mask.setAttribute('mask-type','alpha');
30669 mask.setAttribute('id',layerId+'_'+count);
30670 mask.appendChild(path);
30671 defs.appendChild(mask);
30672 g.setAttribute('mask','url(' + locationHref + '#'+layerId+'_'+count+')');
30673
30674 currentMasks.length = 0;
30675 currentMasks.push(g);
30676 }else{
30677 currentMasks.push(path);
30678 }
30679 if(properties[i].inv && !this.solidPath){
30680 this.solidPath = this.createLayerSolidPath();
30681 }
30682 // TODO move this to a factory or to a constructor
30683 this.viewData[i] = {
30684 elem: path,
30685 lastPath: '',
30686 op: PropertyFactory.getProp(this.element,properties[i].o,0,0.01,this.element),
30687 prop:ShapePropertyFactory.getShapeProp(this.element,properties[i],3),
30688 invRect: rect
30689 };
30690 if(!this.viewData[i].prop.k){
30691 this.drawPath(properties[i],this.viewData[i].prop.v,this.viewData[i]);
30692 }
30693 }
30694
30695 this.maskElement = createNS( maskType);
30696
30697 len = currentMasks.length;
30698 for(i=0;i<len;i+=1){
30699 this.maskElement.appendChild(currentMasks[i]);
30700 }
30701
30702 if(count > 0){
30703 this.maskElement.setAttribute('id', layerId);
30704 this.element.maskedElement.setAttribute(maskRef, "url(" + locationHref + "#" + layerId + ")");
30705 defs.appendChild(this.maskElement);
30706 }
30707 if (this.viewData.length) {
30708 this.element.addRenderableComponent(this);
30709 }
30710
30711}
30712
30713MaskElement.prototype.getMaskProperty = function(pos){
30714 return this.viewData[pos].prop;
30715};
30716
30717MaskElement.prototype.renderFrame = function (isFirstFrame) {
30718 var finalMat = this.element.finalTransform.mat;
30719 var i, len = this.masksProperties.length;
30720 for (i = 0; i < len; i++) {
30721 if(this.viewData[i].prop._mdf || isFirstFrame){
30722 this.drawPath(this.masksProperties[i],this.viewData[i].prop.v,this.viewData[i]);
30723 }
30724 if(this.viewData[i].op._mdf || isFirstFrame){
30725 this.viewData[i].elem.setAttribute('fill-opacity',this.viewData[i].op.v);
30726 }
30727 if(this.masksProperties[i].mode !== 'n'){
30728 if(this.viewData[i].invRect && (this.element.finalTransform.mProp._mdf || isFirstFrame)){
30729 this.viewData[i].invRect.setAttribute('x', -finalMat.props[12]);
30730 this.viewData[i].invRect.setAttribute('y', -finalMat.props[13]);
30731 }
30732 if(this.storedData[i].x && (this.storedData[i].x._mdf || isFirstFrame)){
30733 var feMorph = this.storedData[i].expan;
30734 if(this.storedData[i].x.v < 0){
30735 if(this.storedData[i].lastOperator !== 'erode'){
30736 this.storedData[i].lastOperator = 'erode';
30737 this.storedData[i].elem.setAttribute('filter','url(' + locationHref + '#'+this.storedData[i].filterId+')');
30738 }
30739 feMorph.setAttribute('radius',-this.storedData[i].x.v);
30740 }else{
30741 if(this.storedData[i].lastOperator !== 'dilate'){
30742 this.storedData[i].lastOperator = 'dilate';
30743 this.storedData[i].elem.setAttribute('filter',null);
30744 }
30745 this.storedData[i].elem.setAttribute('stroke-width', this.storedData[i].x.v*2);
30746
30747 }
30748 }
30749 }
30750 }
30751};
30752
30753MaskElement.prototype.getMaskelement = function () {
30754 return this.maskElement;
30755};
30756
30757MaskElement.prototype.createLayerSolidPath = function(){
30758 var path = 'M0,0 ';
30759 path += ' h' + this.globalData.compSize.w ;
30760 path += ' v' + this.globalData.compSize.h ;
30761 path += ' h-' + this.globalData.compSize.w ;
30762 path += ' v-' + this.globalData.compSize.h + ' ';
30763 return path;
30764};
30765
30766MaskElement.prototype.drawPath = function(pathData,pathNodes,viewData){
30767 var pathString = " M"+pathNodes.v[0][0]+','+pathNodes.v[0][1];
30768 var i, len;
30769 len = pathNodes._length;
30770 for(i=1;i<len;i+=1){
30771 //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];
30772 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];
30773 }
30774 //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];
30775 if(pathNodes.c && len > 1){
30776 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];
30777 }
30778 //pathNodes.__renderedString = pathString;
30779
30780 if(viewData.lastPath !== pathString){
30781 var pathShapeValue = '';
30782 if(viewData.elem){
30783 if(pathNodes.c){
30784 pathShapeValue = pathData.inv ? this.solidPath + pathString : pathString;
30785 }
30786 viewData.elem.setAttribute('d',pathShapeValue);
30787 }
30788 viewData.lastPath = pathString;
30789 }
30790};
30791
30792MaskElement.prototype.destroy = function(){
30793 this.element = null;
30794 this.globalData = null;
30795 this.maskElement = null;
30796 this.data = null;
30797 this.masksProperties = null;
30798};
30799
30800/**
30801 * @file
30802 * Handles AE's layer parenting property.
30803 *
30804 */
30805
30806function HierarchyElement(){}
30807
30808HierarchyElement.prototype = {
30809 /**
30810 * @function
30811 * Initializes hierarchy properties
30812 *
30813 */
30814 initHierarchy: function() {
30815 //element's parent list
30816 this.hierarchy = [];
30817 //if element is parent of another layer _isParent will be true
30818 this._isParent = false;
30819 this.checkParenting();
30820 },
30821 /**
30822 * @function
30823 * Sets layer's hierarchy.
30824 * @param {array} hierarch
30825 * layer's parent list
30826 *
30827 */
30828 setHierarchy: function(hierarchy){
30829 this.hierarchy = hierarchy;
30830 },
30831 /**
30832 * @function
30833 * Sets layer as parent.
30834 *
30835 */
30836 setAsParent: function() {
30837 this._isParent = true;
30838 },
30839 /**
30840 * @function
30841 * Searches layer's parenting chain
30842 *
30843 */
30844 checkParenting: function(){
30845 if (this.data.parent !== undefined){
30846 this.comp.buildElementParenting(this, this.data.parent, []);
30847 }
30848 }
30849};
30850/**
30851 * @file
30852 * Handles element's layer frame update.
30853 * Checks layer in point and out point
30854 *
30855 */
30856
30857function FrameElement(){}
30858
30859FrameElement.prototype = {
30860 /**
30861 * @function
30862 * Initializes frame related properties.
30863 *
30864 */
30865 initFrame: function(){
30866 //set to true when inpoint is rendered
30867 this._isFirstFrame = false;
30868 //list of animated properties
30869 this.dynamicProperties = [];
30870 // If layer has been modified in current tick this will be true
30871 this._mdf = false;
30872 },
30873 /**
30874 * @function
30875 * Calculates all dynamic values
30876 *
30877 * @param {number} num
30878 * current frame number in Layer's time
30879 * @param {boolean} isVisible
30880 * if layers is currently in range
30881 *
30882 */
30883 prepareProperties: function(num, isVisible) {
30884 var i, len = this.dynamicProperties.length;
30885 for (i = 0;i < len; i += 1) {
30886 if (isVisible || (this._isParent && this.dynamicProperties[i].propType === 'transform')) {
30887 this.dynamicProperties[i].getValue();
30888 if (this.dynamicProperties[i]._mdf) {
30889 this.globalData._mdf = true;
30890 this._mdf = true;
30891 }
30892 }
30893 }
30894 },
30895 addDynamicProperty: function(prop) {
30896 if(this.dynamicProperties.indexOf(prop) === -1) {
30897 this.dynamicProperties.push(prop);
30898 }
30899 }
30900};
30901function TransformElement(){}
30902
30903TransformElement.prototype = {
30904 initTransform: function() {
30905 this.finalTransform = {
30906 mProp: this.data.ks ? TransformPropertyFactory.getTransformProperty(this, this.data.ks, this) : {o:0},
30907 _matMdf: false,
30908 _opMdf: false,
30909 mat: new Matrix()
30910 };
30911 if (this.data.ao) {
30912 this.finalTransform.mProp.autoOriented = true;
30913 }
30914
30915 //TODO: check TYPE 11: Guided elements
30916 if (this.data.ty !== 11) ;
30917 },
30918 renderTransform: function() {
30919
30920 this.finalTransform._opMdf = this.finalTransform.mProp.o._mdf || this._isFirstFrame;
30921 this.finalTransform._matMdf = this.finalTransform.mProp._mdf || this._isFirstFrame;
30922
30923 if (this.hierarchy) {
30924 var mat;
30925 var finalMat = this.finalTransform.mat;
30926 var i = 0, len = this.hierarchy.length;
30927 //Checking if any of the transformation matrices in the hierarchy chain has changed.
30928 if (!this.finalTransform._matMdf) {
30929 while (i < len) {
30930 if (this.hierarchy[i].finalTransform.mProp._mdf) {
30931 this.finalTransform._matMdf = true;
30932 break;
30933 }
30934 i += 1;
30935 }
30936 }
30937
30938 if (this.finalTransform._matMdf) {
30939 mat = this.finalTransform.mProp.v.props;
30940 finalMat.cloneFromProps(mat);
30941 for (i = 0; i < len; i += 1) {
30942 mat = this.hierarchy[i].finalTransform.mProp.v.props;
30943 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]);
30944 }
30945 }
30946 }
30947 },
30948 globalToLocal: function(pt) {
30949 var transforms = [];
30950 transforms.push(this.finalTransform);
30951 var flag = true;
30952 var comp = this.comp;
30953 while (flag) {
30954 if (comp.finalTransform) {
30955 if (comp.data.hasMask) {
30956 transforms.splice(0, 0, comp.finalTransform);
30957 }
30958 comp = comp.comp;
30959 } else {
30960 flag = false;
30961 }
30962 }
30963 var i, len = transforms.length,ptNew;
30964 for (i = 0; i < len; i += 1) {
30965 ptNew = transforms[i].mat.applyToPointArray(0, 0, 0);
30966 //ptNew = transforms[i].mat.applyToPointArray(pt[0],pt[1],pt[2]);
30967 pt = [pt[0] - ptNew[0], pt[1] - ptNew[1], 0];
30968 }
30969 return pt;
30970 },
30971 mHelper: new Matrix()
30972};
30973function RenderableElement(){
30974
30975}
30976
30977RenderableElement.prototype = {
30978 initRenderable: function() {
30979 //layer's visibility related to inpoint and outpoint. Rename isVisible to isInRange
30980 this.isInRange = false;
30981 //layer's display state
30982 this.hidden = false;
30983 // If layer's transparency equals 0, it can be hidden
30984 this.isTransparent = false;
30985 //list of animated components
30986 this.renderableComponents = [];
30987 },
30988 addRenderableComponent: function(component) {
30989 if(this.renderableComponents.indexOf(component) === -1) {
30990 this.renderableComponents.push(component);
30991 }
30992 },
30993 removeRenderableComponent: function(component) {
30994 if(this.renderableComponents.indexOf(component) !== -1) {
30995 this.renderableComponents.splice(this.renderableComponents.indexOf(component), 1);
30996 }
30997 },
30998 prepareRenderableFrame: function(num) {
30999 this.checkLayerLimits(num);
31000 },
31001 checkTransparency: function(){
31002 if(this.finalTransform.mProp.o.v <= 0) {
31003 if(!this.isTransparent && this.globalData.renderConfig.hideOnTransparent){
31004 this.isTransparent = true;
31005 this.hide();
31006 }
31007 } else if(this.isTransparent) {
31008 this.isTransparent = false;
31009 this.show();
31010 }
31011 },
31012 /**
31013 * @function
31014 * Initializes frame related properties.
31015 *
31016 * @param {number} num
31017 * current frame number in Layer's time
31018 *
31019 */
31020 checkLayerLimits: function(num) {
31021 if(this.data.ip - this.data.st <= num && this.data.op - this.data.st > num)
31022 {
31023 if(this.isInRange !== true){
31024 this.globalData._mdf = true;
31025 this._mdf = true;
31026 this.isInRange = true;
31027 this.show();
31028 }
31029 } else {
31030 if(this.isInRange !== false){
31031 this.globalData._mdf = true;
31032 this.isInRange = false;
31033 this.hide();
31034 }
31035 }
31036 },
31037 renderRenderable: function() {
31038 var i, len = this.renderableComponents.length;
31039 for(i = 0; i < len; i += 1) {
31040 this.renderableComponents[i].renderFrame(this._isFirstFrame);
31041 }
31042 /*this.maskManager.renderFrame(this.finalTransform.mat);
31043 this.renderableEffectsManager.renderFrame(this._isFirstFrame);*/
31044 },
31045 sourceRectAtTime: function(){
31046 return {
31047 top:0,
31048 left:0,
31049 width:100,
31050 height:100
31051 };
31052 },
31053 getLayerSize: function(){
31054 if(this.data.ty === 5){
31055 return {w:this.data.textData.width,h:this.data.textData.height};
31056 }else{
31057 return {w:this.data.width,h:this.data.height};
31058 }
31059 }
31060};
31061function RenderableDOMElement() {}
31062
31063(function(){
31064 var _prototype = {
31065 initElement: function(data,globalData,comp) {
31066 this.initFrame();
31067 this.initBaseData(data, globalData, comp);
31068 this.initTransform(data, globalData, comp);
31069 this.initHierarchy();
31070 this.initRenderable();
31071 this.initRendererElement();
31072 this.createContainerElements();
31073 this.createRenderableComponents();
31074 this.createContent();
31075 this.hide();
31076 },
31077 hide: function(){
31078 if (!this.hidden && (!this.isInRange || this.isTransparent)) {
31079 var elem = this.baseElement || this.layerElement;
31080 elem.style.display = 'none';
31081 this.hidden = true;
31082 }
31083 },
31084 show: function(){
31085 if (this.isInRange && !this.isTransparent){
31086 if (!this.data.hd) {
31087 var elem = this.baseElement || this.layerElement;
31088 elem.style.display = 'block';
31089 }
31090 this.hidden = false;
31091 this._isFirstFrame = true;
31092 }
31093 },
31094 renderFrame: function() {
31095 //If it is exported as hidden (data.hd === true) no need to render
31096 //If it is not visible no need to render
31097 if (this.data.hd || this.hidden) {
31098 return;
31099 }
31100 this.renderTransform();
31101 this.renderRenderable();
31102 this.renderElement();
31103 this.renderInnerContent();
31104 if (this._isFirstFrame) {
31105 this._isFirstFrame = false;
31106 }
31107 },
31108 renderInnerContent: function() {},
31109 prepareFrame: function(num) {
31110 this._mdf = false;
31111 this.prepareRenderableFrame(num);
31112 this.prepareProperties(num, this.isInRange);
31113 this.checkTransparency();
31114 },
31115 destroy: function(){
31116 this.innerElem = null;
31117 this.destroyBaseElement();
31118 }
31119 };
31120 extendPrototype([RenderableElement, createProxyFunction(_prototype)], RenderableDOMElement);
31121}());
31122function ProcessedElement(element, position) {
31123 this.elem = element;
31124 this.pos = position;
31125}
31126function SVGStyleData(data, level) {
31127 this.data = data;
31128 this.type = data.ty;
31129 this.d = '';
31130 this.lvl = level;
31131 this._mdf = false;
31132 this.closed = data.hd === true;
31133 this.pElem = createNS('path');
31134 this.msElem = null;
31135}
31136
31137SVGStyleData.prototype.reset = function() {
31138 this.d = '';
31139 this._mdf = false;
31140};
31141function SVGShapeData(transformers, level, shape) {
31142 this.caches = [];
31143 this.styles = [];
31144 this.transformers = transformers;
31145 this.lStr = '';
31146 this.sh = shape;
31147 this.lvl = level;
31148 //TODO find if there are some cases where _isAnimated can be false.
31149 // For now, since shapes add up with other shapes. They have to be calculated every time.
31150 // One way of finding out is checking if all styles associated to this shape depend only of this shape
31151 this._isAnimated = !!shape.k;
31152 // TODO: commenting this for now since all shapes are animated
31153 var i = 0, len = transformers.length;
31154 while(i < len) {
31155 if(transformers[i].mProps.dynamicProperties.length) {
31156 this._isAnimated = true;
31157 break;
31158 }
31159 i += 1;
31160 }
31161}
31162
31163SVGShapeData.prototype.setAsAnimated = function() {
31164 this._isAnimated = true;
31165};
31166function SVGTransformData(mProps, op, container) {
31167 this.transform = {
31168 mProps: mProps,
31169 op: op,
31170 container: container
31171 };
31172 this.elements = [];
31173 this._isAnimated = this.transform.mProps.dynamicProperties.length || this.transform.op.effectsSequence.length;
31174}
31175function SVGStrokeStyleData(elem, data, styleOb){
31176 this.initDynamicPropertyContainer(elem);
31177 this.getValue = this.iterateDynamicProperties;
31178 this.o = PropertyFactory.getProp(elem,data.o,0,0.01,this);
31179 this.w = PropertyFactory.getProp(elem,data.w,0,null,this);
31180 this.d = new DashProperty(elem,data.d||{},'svg',this);
31181 this.c = PropertyFactory.getProp(elem,data.c,1,255,this);
31182 this.style = styleOb;
31183 this._isAnimated = !!this._isAnimated;
31184}
31185
31186extendPrototype([DynamicPropertyContainer], SVGStrokeStyleData);
31187function SVGFillStyleData(elem, data, styleOb){
31188 this.initDynamicPropertyContainer(elem);
31189 this.getValue = this.iterateDynamicProperties;
31190 this.o = PropertyFactory.getProp(elem,data.o,0,0.01,this);
31191 this.c = PropertyFactory.getProp(elem,data.c,1,255,this);
31192 this.style = styleOb;
31193}
31194
31195extendPrototype([DynamicPropertyContainer], SVGFillStyleData);
31196function SVGGradientFillStyleData(elem, data, styleOb){
31197 this.initDynamicPropertyContainer(elem);
31198 this.getValue = this.iterateDynamicProperties;
31199 this.initGradientData(elem, data, styleOb);
31200}
31201
31202SVGGradientFillStyleData.prototype.initGradientData = function(elem, data, styleOb){
31203 this.o = PropertyFactory.getProp(elem,data.o,0,0.01,this);
31204 this.s = PropertyFactory.getProp(elem,data.s,1,null,this);
31205 this.e = PropertyFactory.getProp(elem,data.e,1,null,this);
31206 this.h = PropertyFactory.getProp(elem,data.h||{k:0},0,0.01,this);
31207 this.a = PropertyFactory.getProp(elem,data.a||{k:0},0,degToRads,this);
31208 this.g = new GradientProperty(elem,data.g,this);
31209 this.style = styleOb;
31210 this.stops = [];
31211 this.setGradientData(styleOb.pElem, data);
31212 this.setGradientOpacity(data, styleOb);
31213 this._isAnimated = !!this._isAnimated;
31214
31215};
31216
31217SVGGradientFillStyleData.prototype.setGradientData = function(pathElement,data){
31218
31219 var gradientId = createElementID();
31220 var gfill = createNS(data.t === 1 ? 'linearGradient' : 'radialGradient');
31221 gfill.setAttribute('id',gradientId);
31222 gfill.setAttribute('spreadMethod','pad');
31223 gfill.setAttribute('gradientUnits','userSpaceOnUse');
31224 var stops = [];
31225 var stop, j, jLen;
31226 jLen = data.g.p*4;
31227 for(j=0;j<jLen;j+=4){
31228 stop = createNS('stop');
31229 gfill.appendChild(stop);
31230 stops.push(stop);
31231 }
31232 pathElement.setAttribute( data.ty === 'gf' ? 'fill':'stroke','url(' + locationHref + '#'+gradientId+')');
31233
31234 this.gf = gfill;
31235 this.cst = stops;
31236};
31237
31238SVGGradientFillStyleData.prototype.setGradientOpacity = function(data, styleOb){
31239 if(this.g._hasOpacity && !this.g._collapsable){
31240 var stop, j, jLen;
31241 var mask = createNS("mask");
31242 var maskElement = createNS( 'path');
31243 mask.appendChild(maskElement);
31244 var opacityId = createElementID();
31245 var maskId = createElementID();
31246 mask.setAttribute('id',maskId);
31247 var opFill = createNS(data.t === 1 ? 'linearGradient' : 'radialGradient');
31248 opFill.setAttribute('id',opacityId);
31249 opFill.setAttribute('spreadMethod','pad');
31250 opFill.setAttribute('gradientUnits','userSpaceOnUse');
31251 jLen = data.g.k.k[0].s ? data.g.k.k[0].s.length : data.g.k.k.length;
31252 var stops = this.stops;
31253 for(j=data.g.p*4;j<jLen;j+=2){
31254 stop = createNS('stop');
31255 stop.setAttribute('stop-color','rgb(255,255,255)');
31256 opFill.appendChild(stop);
31257 stops.push(stop);
31258 }
31259 maskElement.setAttribute( data.ty === 'gf' ? 'fill':'stroke','url(' + locationHref + '#'+opacityId+')');
31260 this.of = opFill;
31261 this.ms = mask;
31262 this.ost = stops;
31263 this.maskId = maskId;
31264 styleOb.msElem = maskElement;
31265 }
31266};
31267
31268extendPrototype([DynamicPropertyContainer], SVGGradientFillStyleData);
31269function SVGGradientStrokeStyleData(elem, data, styleOb){
31270 this.initDynamicPropertyContainer(elem);
31271 this.getValue = this.iterateDynamicProperties;
31272 this.w = PropertyFactory.getProp(elem,data.w,0,null,this);
31273 this.d = new DashProperty(elem,data.d||{},'svg',this);
31274 this.initGradientData(elem, data, styleOb);
31275 this._isAnimated = !!this._isAnimated;
31276}
31277
31278extendPrototype([SVGGradientFillStyleData, DynamicPropertyContainer], SVGGradientStrokeStyleData);
31279function ShapeGroupData() {
31280 this.it = [];
31281 this.prevViewData = [];
31282 this.gr = createNS('g');
31283}
31284var SVGElementsRenderer = (function() {
31285 var _identityMatrix = new Matrix();
31286 var _matrixHelper = new Matrix();
31287
31288 var ob = {
31289 createRenderFunction: createRenderFunction
31290 };
31291
31292 function createRenderFunction(data) {
31293 var ty = data.ty;
31294 switch(data.ty) {
31295 case 'fl':
31296 return renderFill;
31297 case 'gf':
31298 return renderGradient;
31299 case 'gs':
31300 return renderGradientStroke;
31301 case 'st':
31302 return renderStroke;
31303 case 'sh':
31304 case 'el':
31305 case 'rc':
31306 case 'sr':
31307 return renderPath;
31308 case 'tr':
31309 return renderContentTransform;
31310 }
31311 }
31312
31313 function renderContentTransform(styleData, itemData, isFirstFrame) {
31314 if(isFirstFrame || itemData.transform.op._mdf){
31315 itemData.transform.container.setAttribute('opacity',itemData.transform.op.v);
31316 }
31317 if(isFirstFrame || itemData.transform.mProps._mdf){
31318 itemData.transform.container.setAttribute('transform',itemData.transform.mProps.v.to2dCSS());
31319 }
31320 }
31321
31322 function renderPath(styleData, itemData, isFirstFrame) {
31323 var j, jLen,pathStringTransformed,redraw,pathNodes,l, lLen = itemData.styles.length;
31324 var lvl = itemData.lvl;
31325 var paths, mat, props, iterations, k;
31326 for(l=0;l<lLen;l+=1){
31327 redraw = itemData.sh._mdf || isFirstFrame;
31328 if(itemData.styles[l].lvl < lvl){
31329 mat = _matrixHelper.reset();
31330 iterations = lvl - itemData.styles[l].lvl;
31331 k = itemData.transformers.length-1;
31332 while(!redraw && iterations > 0) {
31333 redraw = itemData.transformers[k].mProps._mdf || redraw;
31334 iterations --;
31335 k --;
31336 }
31337 if(redraw) {
31338 iterations = lvl - itemData.styles[l].lvl;
31339 k = itemData.transformers.length-1;
31340 while(iterations > 0) {
31341 props = itemData.transformers[k].mProps.v.props;
31342 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]);
31343 iterations --;
31344 k --;
31345 }
31346 }
31347 } else {
31348 mat = _identityMatrix;
31349 }
31350 paths = itemData.sh.paths;
31351 jLen = paths._length;
31352 if(redraw){
31353 pathStringTransformed = '';
31354 for(j=0;j<jLen;j+=1){
31355 pathNodes = paths.shapes[j];
31356 if(pathNodes && pathNodes._length){
31357 pathStringTransformed += buildShapeString(pathNodes, pathNodes._length, pathNodes.c, mat);
31358 }
31359 }
31360 itemData.caches[l] = pathStringTransformed;
31361 } else {
31362 pathStringTransformed = itemData.caches[l];
31363 }
31364 itemData.styles[l].d += styleData.hd === true ? '' : pathStringTransformed;
31365 itemData.styles[l]._mdf = redraw || itemData.styles[l]._mdf;
31366 }
31367 }
31368
31369 function renderFill (styleData,itemData, isFirstFrame){
31370 var styleElem = itemData.style;
31371
31372 if(itemData.c._mdf || isFirstFrame){
31373 styleElem.pElem.setAttribute('fill','rgb('+bm_floor(itemData.c.v[0])+','+bm_floor(itemData.c.v[1])+','+bm_floor(itemData.c.v[2])+')');
31374 }
31375 if(itemData.o._mdf || isFirstFrame){
31376 styleElem.pElem.setAttribute('fill-opacity',itemData.o.v);
31377 }
31378 }
31379 function renderGradientStroke (styleData, itemData, isFirstFrame) {
31380 renderGradient(styleData, itemData, isFirstFrame);
31381 renderStroke(styleData, itemData, isFirstFrame);
31382 }
31383
31384 function renderGradient(styleData, itemData, isFirstFrame) {
31385 var gfill = itemData.gf;
31386 var hasOpacity = itemData.g._hasOpacity;
31387 var pt1 = itemData.s.v, pt2 = itemData.e.v;
31388
31389 if (itemData.o._mdf || isFirstFrame) {
31390 var attr = styleData.ty === 'gf' ? 'fill-opacity' : 'stroke-opacity';
31391 itemData.style.pElem.setAttribute(attr, itemData.o.v);
31392 }
31393 if (itemData.s._mdf || isFirstFrame) {
31394 var attr1 = styleData.t === 1 ? 'x1' : 'cx';
31395 var attr2 = attr1 === 'x1' ? 'y1' : 'cy';
31396 gfill.setAttribute(attr1, pt1[0]);
31397 gfill.setAttribute(attr2, pt1[1]);
31398 if (hasOpacity && !itemData.g._collapsable) {
31399 itemData.of.setAttribute(attr1, pt1[0]);
31400 itemData.of.setAttribute(attr2, pt1[1]);
31401 }
31402 }
31403 var stops, i, len, stop;
31404 if (itemData.g._cmdf || isFirstFrame) {
31405 stops = itemData.cst;
31406 var cValues = itemData.g.c;
31407 len = stops.length;
31408 for (i = 0; i < len; i += 1){
31409 stop = stops[i];
31410 stop.setAttribute('offset', cValues[i * 4] + '%');
31411 stop.setAttribute('stop-color','rgb('+ cValues[i * 4 + 1] + ',' + cValues[i * 4 + 2] + ','+cValues[i * 4 + 3] + ')');
31412 }
31413 }
31414 if (hasOpacity && (itemData.g._omdf || isFirstFrame)) {
31415 var oValues = itemData.g.o;
31416 if(itemData.g._collapsable) {
31417 stops = itemData.cst;
31418 } else {
31419 stops = itemData.ost;
31420 }
31421 len = stops.length;
31422 for (i = 0; i < len; i += 1) {
31423 stop = stops[i];
31424 if(!itemData.g._collapsable) {
31425 stop.setAttribute('offset', oValues[i * 2] + '%');
31426 }
31427 stop.setAttribute('stop-opacity', oValues[i * 2 + 1]);
31428 }
31429 }
31430 if (styleData.t === 1) {
31431 if (itemData.e._mdf || isFirstFrame) {
31432 gfill.setAttribute('x2', pt2[0]);
31433 gfill.setAttribute('y2', pt2[1]);
31434 if (hasOpacity && !itemData.g._collapsable) {
31435 itemData.of.setAttribute('x2', pt2[0]);
31436 itemData.of.setAttribute('y2', pt2[1]);
31437 }
31438 }
31439 } else {
31440 var rad;
31441 if (itemData.s._mdf || itemData.e._mdf || isFirstFrame) {
31442 rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));
31443 gfill.setAttribute('r', rad);
31444 if(hasOpacity && !itemData.g._collapsable){
31445 itemData.of.setAttribute('r', rad);
31446 }
31447 }
31448 if (itemData.e._mdf || itemData.h._mdf || itemData.a._mdf || isFirstFrame) {
31449 if (!rad) {
31450 rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));
31451 }
31452 var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0]);
31453
31454 var percent = itemData.h.v >= 1 ? 0.99 : itemData.h.v <= -1 ? -0.99: itemData.h.v;
31455 var dist = rad * percent;
31456 var x = Math.cos(ang + itemData.a.v) * dist + pt1[0];
31457 var y = Math.sin(ang + itemData.a.v) * dist + pt1[1];
31458 gfill.setAttribute('fx', x);
31459 gfill.setAttribute('fy', y);
31460 if (hasOpacity && !itemData.g._collapsable) {
31461 itemData.of.setAttribute('fx', x);
31462 itemData.of.setAttribute('fy', y);
31463 }
31464 }
31465 //gfill.setAttribute('fy','200');
31466 }
31467 }
31468 function renderStroke(styleData, itemData, isFirstFrame) {
31469 var styleElem = itemData.style;
31470 var d = itemData.d;
31471 if (d && (d._mdf || isFirstFrame) && d.dashStr) {
31472 styleElem.pElem.setAttribute('stroke-dasharray', d.dashStr);
31473 styleElem.pElem.setAttribute('stroke-dashoffset', d.dashoffset[0]);
31474 }
31475 if(itemData.c && (itemData.c._mdf || isFirstFrame)){
31476 styleElem.pElem.setAttribute('stroke','rgb(' + bm_floor(itemData.c.v[0]) + ',' + bm_floor(itemData.c.v[1]) + ',' + bm_floor(itemData.c.v[2]) + ')');
31477 }
31478 if(itemData.o._mdf || isFirstFrame){
31479 styleElem.pElem.setAttribute('stroke-opacity', itemData.o.v);
31480 }
31481 if(itemData.w._mdf || isFirstFrame){
31482 styleElem.pElem.setAttribute('stroke-width', itemData.w.v);
31483 if(styleElem.msElem){
31484 styleElem.msElem.setAttribute('stroke-width', itemData.w.v);
31485 }
31486 }
31487 }
31488 return ob;
31489}());
31490function ShapeTransformManager() {
31491 this.sequences = {};
31492 this.sequenceList = [];
31493 this.transform_key_count = 0;
31494}
31495
31496ShapeTransformManager.prototype = {
31497 addTransformSequence: function(transforms) {
31498 var i, len = transforms.length;
31499 var key = '_';
31500 for(i = 0; i < len; i += 1) {
31501 key += transforms[i].transform.key + '_';
31502 }
31503 var sequence = this.sequences[key];
31504 if(!sequence) {
31505 sequence = {
31506 transforms: [].concat(transforms),
31507 finalTransform: new Matrix(),
31508 _mdf: false
31509 };
31510 this.sequences[key] = sequence;
31511 this.sequenceList.push(sequence);
31512 }
31513 return sequence;
31514 },
31515 processSequence: function(sequence, isFirstFrame) {
31516 var i = 0, len = sequence.transforms.length, _mdf = isFirstFrame;
31517 while (i < len && !isFirstFrame) {
31518 if (sequence.transforms[i].transform.mProps._mdf) {
31519 _mdf = true;
31520 break;
31521 }
31522 i += 1;
31523 }
31524 if (_mdf) {
31525 var props;
31526 sequence.finalTransform.reset();
31527 for (i = len - 1; i >= 0; i -= 1) {
31528 props = sequence.transforms[i].transform.mProps.v.props;
31529 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]);
31530 }
31531 }
31532 sequence._mdf = _mdf;
31533
31534 },
31535 processSequences: function(isFirstFrame) {
31536 var i, len = this.sequenceList.length;
31537 for (i = 0; i < len; i += 1) {
31538 this.processSequence(this.sequenceList[i], isFirstFrame);
31539 }
31540
31541 },
31542 getNewKey: function() {
31543 return '_' + this.transform_key_count++;
31544 }
31545};
31546function CVShapeData(element, data, styles, transformsManager) {
31547 this.styledShapes = [];
31548 this.tr = [0,0,0,0,0,0];
31549 var ty = 4;
31550 if(data.ty == 'rc'){
31551 ty = 5;
31552 }else if(data.ty == 'el'){
31553 ty = 6;
31554 }else if(data.ty == 'sr'){
31555 ty = 7;
31556 }
31557 this.sh = ShapePropertyFactory.getShapeProp(element,data,ty,element);
31558 var i , len = styles.length,styledShape;
31559 for (i = 0; i < len; i += 1) {
31560 if (!styles[i].closed) {
31561 styledShape = {
31562 transforms: transformsManager.addTransformSequence(styles[i].transforms),
31563 trNodes: []
31564 };
31565 this.styledShapes.push(styledShape);
31566 styles[i].elements.push(styledShape);
31567 }
31568 }
31569}
31570
31571CVShapeData.prototype.setAsAnimated = SVGShapeData.prototype.setAsAnimated;
31572function BaseElement(){
31573}
31574
31575BaseElement.prototype = {
31576 checkMasks: function(){
31577 if(!this.data.hasMask){
31578 return false;
31579 }
31580 var i = 0, len = this.data.masksProperties.length;
31581 while(i<len) {
31582 if((this.data.masksProperties[i].mode !== 'n' && this.data.masksProperties[i].cl !== false)) {
31583 return true;
31584 }
31585 i += 1;
31586 }
31587 return false;
31588 },
31589 initExpressions: function(){
31590 this.layerInterface = LayerExpressionInterface(this);
31591 if(this.data.hasMask && this.maskManager) {
31592 this.layerInterface.registerMaskInterface(this.maskManager);
31593 }
31594 var effectsInterface = EffectsExpressionInterface.createEffectsInterface(this,this.layerInterface);
31595 this.layerInterface.registerEffectsInterface(effectsInterface);
31596
31597 if(this.data.ty === 0 || this.data.xt){
31598 this.compInterface = CompExpressionInterface(this);
31599 } else if(this.data.ty === 4){
31600 this.layerInterface.shapeInterface = ShapeExpressionInterface(this.shapesData,this.itemsData,this.layerInterface);
31601 this.layerInterface.content = this.layerInterface.shapeInterface;
31602 } else if(this.data.ty === 5){
31603 this.layerInterface.textInterface = TextExpressionInterface(this);
31604 this.layerInterface.text = this.layerInterface.textInterface;
31605 }
31606 },
31607 setBlendMode: function(){
31608 var blendModeValue = getBlendMode(this.data.bm);
31609 var elem = this.baseElement || this.layerElement;
31610
31611 elem.style['mix-blend-mode'] = blendModeValue;
31612 },
31613 initBaseData: function(data, globalData, comp){
31614 this.globalData = globalData;
31615 this.comp = comp;
31616 this.data = data;
31617 this.layerId = createElementID();
31618
31619 //Stretch factor for old animations missing this property.
31620 if(!this.data.sr){
31621 this.data.sr = 1;
31622 }
31623 // effects manager
31624 this.effectsManager = new EffectsManager(this.data,this,this.dynamicProperties);
31625
31626 },
31627 getType: function(){
31628 return this.type;
31629 }
31630 ,sourceRectAtTime: function(){}
31631};
31632function NullElement(data,globalData,comp){
31633 this.initFrame();
31634 this.initBaseData(data, globalData, comp);
31635 this.initFrame();
31636 this.initTransform(data, globalData, comp);
31637 this.initHierarchy();
31638}
31639
31640NullElement.prototype.prepareFrame = function(num) {
31641 this.prepareProperties(num, true);
31642};
31643
31644NullElement.prototype.renderFrame = function() {
31645};
31646
31647NullElement.prototype.getBaseElement = function() {
31648 return null;
31649};
31650
31651NullElement.prototype.destroy = function() {
31652};
31653
31654NullElement.prototype.sourceRectAtTime = function() {
31655};
31656
31657NullElement.prototype.hide = function() {
31658};
31659
31660extendPrototype([BaseElement,TransformElement,HierarchyElement,FrameElement], NullElement);
31661
31662function SVGBaseElement(){
31663}
31664
31665SVGBaseElement.prototype = {
31666 initRendererElement: function() {
31667 this.layerElement = createNS('g');
31668 },
31669 createContainerElements: function(){
31670 this.matteElement = createNS('g');
31671 this.transformedElement = this.layerElement;
31672 this.maskedElement = this.layerElement;
31673 this._sizeChanged = false;
31674 var layerElementParent = null;
31675 //If this layer acts as a mask for the following layer
31676 var filId, fil, gg;
31677 if (this.data.td) {
31678 if (this.data.td == 3 || this.data.td == 1) {
31679 var masker = createNS('mask');
31680 masker.setAttribute('id', this.layerId);
31681 masker.setAttribute('mask-type', this.data.td == 3 ? 'luminance' : 'alpha');
31682 masker.appendChild(this.layerElement);
31683 layerElementParent = masker;
31684 this.globalData.defs.appendChild(masker);
31685 // This is only for IE and Edge when mask if of type alpha
31686 if (!featureSupport.maskType && this.data.td == 1) {
31687 masker.setAttribute('mask-type', 'luminance');
31688 filId = createElementID();
31689 fil = filtersFactory.createFilter(filId);
31690 this.globalData.defs.appendChild(fil);
31691 fil.appendChild(filtersFactory.createAlphaToLuminanceFilter());
31692 gg = createNS('g');
31693 gg.appendChild(this.layerElement);
31694 layerElementParent = gg;
31695 masker.appendChild(gg);
31696 gg.setAttribute('filter','url(' + locationHref + '#' + filId + ')');
31697 }
31698 } else if(this.data.td == 2) {
31699 var maskGroup = createNS('mask');
31700 maskGroup.setAttribute('id', this.layerId);
31701 maskGroup.setAttribute('mask-type','alpha');
31702 var maskGrouper = createNS('g');
31703 maskGroup.appendChild(maskGrouper);
31704 filId = createElementID();
31705 fil = filtersFactory.createFilter(filId);
31706 ////
31707
31708 // This solution doesn't work on Android when meta tag with viewport attribute is set
31709 /*var feColorMatrix = createNS('feColorMatrix');
31710 feColorMatrix.setAttribute('type', 'matrix');
31711 feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');
31712 feColorMatrix.setAttribute('values','1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 -1 1');
31713 fil.appendChild(feColorMatrix);*/
31714 ////
31715 var feCTr = createNS('feComponentTransfer');
31716 feCTr.setAttribute('in','SourceGraphic');
31717 fil.appendChild(feCTr);
31718 var feFunc = createNS('feFuncA');
31719 feFunc.setAttribute('type','table');
31720 feFunc.setAttribute('tableValues','1.0 0.0');
31721 feCTr.appendChild(feFunc);
31722 ////
31723 this.globalData.defs.appendChild(fil);
31724 var alphaRect = createNS('rect');
31725 alphaRect.setAttribute('width', this.comp.data.w);
31726 alphaRect.setAttribute('height', this.comp.data.h);
31727 alphaRect.setAttribute('x','0');
31728 alphaRect.setAttribute('y','0');
31729 alphaRect.setAttribute('fill','#ffffff');
31730 alphaRect.setAttribute('opacity','0');
31731 maskGrouper.setAttribute('filter', 'url(' + locationHref + '#'+filId+')');
31732 maskGrouper.appendChild(alphaRect);
31733 maskGrouper.appendChild(this.layerElement);
31734 layerElementParent = maskGrouper;
31735 if (!featureSupport.maskType) {
31736 maskGroup.setAttribute('mask-type', 'luminance');
31737 fil.appendChild(filtersFactory.createAlphaToLuminanceFilter());
31738 gg = createNS('g');
31739 maskGrouper.appendChild(alphaRect);
31740 gg.appendChild(this.layerElement);
31741 layerElementParent = gg;
31742 maskGrouper.appendChild(gg);
31743 }
31744 this.globalData.defs.appendChild(maskGroup);
31745 }
31746 } else if (this.data.tt) {
31747 this.matteElement.appendChild(this.layerElement);
31748 layerElementParent = this.matteElement;
31749 this.baseElement = this.matteElement;
31750 } else {
31751 this.baseElement = this.layerElement;
31752 }
31753 if (this.data.ln) {
31754 this.layerElement.setAttribute('id', this.data.ln);
31755 }
31756 if (this.data.cl) {
31757 this.layerElement.setAttribute('class', this.data.cl);
31758 }
31759 //Clipping compositions to hide content that exceeds boundaries. If collapsed transformations is on, component should not be clipped
31760 if (this.data.ty === 0 && !this.data.hd) {
31761 var cp = createNS( 'clipPath');
31762 var pt = createNS('path');
31763 pt.setAttribute('d','M0,0 L' + this.data.w + ',0' + ' L' + this.data.w + ',' + this.data.h + ' L0,' + this.data.h + 'z');
31764 var clipId = createElementID();
31765 cp.setAttribute('id',clipId);
31766 cp.appendChild(pt);
31767 this.globalData.defs.appendChild(cp);
31768
31769 if (this.checkMasks()) {
31770 var cpGroup = createNS('g');
31771 cpGroup.setAttribute('clip-path','url(' + locationHref + '#'+clipId + ')');
31772 cpGroup.appendChild(this.layerElement);
31773 this.transformedElement = cpGroup;
31774 if (layerElementParent) {
31775 layerElementParent.appendChild(this.transformedElement);
31776 } else {
31777 this.baseElement = this.transformedElement;
31778 }
31779 } else {
31780 this.layerElement.setAttribute('clip-path','url(' + locationHref + '#'+clipId+')');
31781 }
31782
31783 }
31784 if (this.data.bm !== 0) {
31785 this.setBlendMode();
31786 }
31787
31788 },
31789 renderElement: function() {
31790 if (this.finalTransform._matMdf) {
31791 this.transformedElement.setAttribute('transform', this.finalTransform.mat.to2dCSS());
31792 }
31793 if (this.finalTransform._opMdf) {
31794 this.transformedElement.setAttribute('opacity', this.finalTransform.mProp.o.v);
31795 }
31796 },
31797 destroyBaseElement: function() {
31798 this.layerElement = null;
31799 this.matteElement = null;
31800 this.maskManager.destroy();
31801 },
31802 getBaseElement: function() {
31803 if (this.data.hd) {
31804 return null;
31805 }
31806 return this.baseElement;
31807 },
31808 createRenderableComponents: function() {
31809 this.maskManager = new MaskElement(this.data, this, this.globalData);
31810 this.renderableEffectsManager = new SVGEffects(this);
31811 },
31812 setMatte: function(id) {
31813 if (!this.matteElement) {
31814 return;
31815 }
31816 this.matteElement.setAttribute("mask", "url(" + locationHref + "#" + id + ")");
31817 }
31818};
31819function IShapeElement(){
31820}
31821
31822IShapeElement.prototype = {
31823 addShapeToModifiers: function(data) {
31824 var i, len = this.shapeModifiers.length;
31825 for(i=0;i<len;i+=1){
31826 this.shapeModifiers[i].addShape(data);
31827 }
31828 },
31829 isShapeInAnimatedModifiers: function(data) {
31830 var i = 0, len = this.shapeModifiers.length;
31831 while(i < len) {
31832 if(this.shapeModifiers[i].isAnimatedWithShape(data)) {
31833 return true;
31834 }
31835 }
31836 return false;
31837 },
31838 renderModifiers: function() {
31839 if(!this.shapeModifiers.length){
31840 return;
31841 }
31842 var i, len = this.shapes.length;
31843 for(i=0;i<len;i+=1){
31844 this.shapes[i].sh.reset();
31845 }
31846
31847 len = this.shapeModifiers.length;
31848 for(i=len-1;i>=0;i-=1){
31849 this.shapeModifiers[i].processShapes(this._isFirstFrame);
31850 }
31851 },
31852 lcEnum: {
31853 '1': 'butt',
31854 '2': 'round',
31855 '3': 'square'
31856 },
31857 ljEnum: {
31858 '1': 'miter',
31859 '2': 'round',
31860 '3': 'bevel'
31861 },
31862 searchProcessedElement: function(elem){
31863 var elements = this.processedElements;
31864 var i = 0, len = elements.length;
31865 while (i < len) {
31866 if (elements[i].elem === elem) {
31867 return elements[i].pos;
31868 }
31869 i += 1;
31870 }
31871 return 0;
31872 },
31873 addProcessedElement: function(elem, pos){
31874 var elements = this.processedElements;
31875 var i = elements.length;
31876 while(i) {
31877 i -= 1;
31878 if (elements[i].elem === elem) {
31879 elements[i].pos = pos;
31880 return;
31881 }
31882 }
31883 elements.push(new ProcessedElement(elem, pos));
31884 },
31885 prepareFrame: function(num) {
31886 this.prepareRenderableFrame(num);
31887 this.prepareProperties(num, this.isInRange);
31888 }
31889};
31890function ITextElement(){
31891}
31892
31893ITextElement.prototype.initElement = function(data,globalData,comp){
31894 this.lettersChangedFlag = true;
31895 this.initFrame();
31896 this.initBaseData(data, globalData, comp);
31897 this.textProperty = new TextProperty(this, data.t, this.dynamicProperties);
31898 this.textAnimator = new TextAnimatorProperty(data.t, this.renderType, this);
31899 this.initTransform(data, globalData, comp);
31900 this.initHierarchy();
31901 this.initRenderable();
31902 this.initRendererElement();
31903 this.createContainerElements();
31904 this.createRenderableComponents();
31905 this.createContent();
31906 this.hide();
31907 this.textAnimator.searchProperties(this.dynamicProperties);
31908};
31909
31910ITextElement.prototype.prepareFrame = function(num) {
31911 this._mdf = false;
31912 this.prepareRenderableFrame(num);
31913 this.prepareProperties(num, this.isInRange);
31914 if(this.textProperty._mdf || this.textProperty._isFirstFrame) {
31915 this.buildNewText();
31916 this.textProperty._isFirstFrame = false;
31917 this.textProperty._mdf = false;
31918 }
31919};
31920
31921ITextElement.prototype.createPathShape = function(matrixHelper, shapes) {
31922 var j,jLen = shapes.length;
31923 var pathNodes;
31924 var shapeStr = '';
31925 for(j=0;j<jLen;j+=1){
31926 pathNodes = shapes[j].ks.k;
31927 shapeStr += buildShapeString(pathNodes, pathNodes.i.length, true, matrixHelper);
31928 }
31929 return shapeStr;
31930};
31931
31932ITextElement.prototype.updateDocumentData = function(newData, index) {
31933 this.textProperty.updateDocumentData(newData, index);
31934};
31935
31936ITextElement.prototype.canResizeFont = function(_canResize) {
31937 this.textProperty.canResizeFont(_canResize);
31938};
31939
31940ITextElement.prototype.setMinimumFontSize = function(_fontSize) {
31941 this.textProperty.setMinimumFontSize(_fontSize);
31942};
31943
31944ITextElement.prototype.applyTextPropertiesToMatrix = function(documentData, matrixHelper, lineNumber, xPos, yPos) {
31945 if(documentData.ps){
31946 matrixHelper.translate(documentData.ps[0],documentData.ps[1] + documentData.ascent,0);
31947 }
31948 matrixHelper.translate(0,-documentData.ls,0);
31949 switch(documentData.j){
31950 case 1:
31951 matrixHelper.translate(documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]),0,0);
31952 break;
31953 case 2:
31954 matrixHelper.translate(documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber] )/2,0,0);
31955 break;
31956 }
31957 matrixHelper.translate(xPos, yPos, 0);
31958};
31959
31960
31961ITextElement.prototype.buildColor = function(colorData) {
31962 return 'rgb(' + Math.round(colorData[0]*255) + ',' + Math.round(colorData[1]*255) + ',' + Math.round(colorData[2]*255) + ')';
31963};
31964
31965ITextElement.prototype.emptyProp = new LetterProps();
31966
31967ITextElement.prototype.destroy = function(){
31968
31969};
31970function ICompElement(){}
31971
31972extendPrototype([BaseElement, TransformElement, HierarchyElement, FrameElement, RenderableDOMElement], ICompElement);
31973
31974ICompElement.prototype.initElement = function(data,globalData,comp) {
31975 this.initFrame();
31976 this.initBaseData(data, globalData, comp);
31977 this.initTransform(data, globalData, comp);
31978 this.initRenderable();
31979 this.initHierarchy();
31980 this.initRendererElement();
31981 this.createContainerElements();
31982 this.createRenderableComponents();
31983 if(this.data.xt || !globalData.progressiveLoad){
31984 this.buildAllItems();
31985 }
31986 this.hide();
31987};
31988
31989/*ICompElement.prototype.hide = function(){
31990 if(!this.hidden){
31991 this.hideElement();
31992 var i,len = this.elements.length;
31993 for( i = 0; i < len; i+=1 ){
31994 if(this.elements[i]){
31995 this.elements[i].hide();
31996 }
31997 }
31998 }
31999};*/
32000
32001ICompElement.prototype.prepareFrame = function(num){
32002 this._mdf = false;
32003 this.prepareRenderableFrame(num);
32004 this.prepareProperties(num, this.isInRange);
32005 if(!this.isInRange && !this.data.xt){
32006 return;
32007 }
32008
32009 if (!this.tm._placeholder) {
32010 var timeRemapped = this.tm.v;
32011 if(timeRemapped === this.data.op){
32012 timeRemapped = this.data.op - 1;
32013 }
32014 this.renderedFrame = timeRemapped;
32015 } else {
32016 this.renderedFrame = num/this.data.sr;
32017 }
32018 var i,len = this.elements.length;
32019 if(!this.completeLayers){
32020 this.checkLayers(this.renderedFrame);
32021 }
32022 //This iteration needs to be backwards because of how expressions connect between each other
32023 for( i = len - 1; i >= 0; i -= 1 ){
32024 if(this.completeLayers || this.elements[i]){
32025 this.elements[i].prepareFrame(this.renderedFrame - this.layers[i].st);
32026 if(this.elements[i]._mdf) {
32027 this._mdf = true;
32028 }
32029 }
32030 }
32031};
32032
32033ICompElement.prototype.renderInnerContent = function() {
32034 var i,len = this.layers.length;
32035 for( i = 0; i < len; i += 1 ){
32036 if(this.completeLayers || this.elements[i]){
32037 this.elements[i].renderFrame();
32038 }
32039 }
32040};
32041
32042ICompElement.prototype.setElements = function(elems){
32043 this.elements = elems;
32044};
32045
32046ICompElement.prototype.getElements = function(){
32047 return this.elements;
32048};
32049
32050ICompElement.prototype.destroyElements = function(){
32051 var i,len = this.layers.length;
32052 for( i = 0; i < len; i+=1 ){
32053 if(this.elements[i]){
32054 this.elements[i].destroy();
32055 }
32056 }
32057};
32058
32059ICompElement.prototype.destroy = function(){
32060 this.destroyElements();
32061 this.destroyBaseElement();
32062};
32063
32064function IImageElement(data,globalData,comp){
32065 this.assetData = globalData.getAssetData(data.refId);
32066 this.initElement(data,globalData,comp);
32067 this.sourceRect = {top:0,left:0,width:this.assetData.w,height:this.assetData.h};
32068}
32069
32070extendPrototype([BaseElement,TransformElement,SVGBaseElement,HierarchyElement,FrameElement,RenderableDOMElement], IImageElement);
32071
32072IImageElement.prototype.createContent = function(){
32073
32074 var assetPath = this.globalData.getAssetsPath(this.assetData);
32075
32076 this.innerElem = createNS('image');
32077 this.innerElem.setAttribute('width',this.assetData.w+"px");
32078 this.innerElem.setAttribute('height',this.assetData.h+"px");
32079 this.innerElem.setAttribute('preserveAspectRatio',this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio);
32080 this.innerElem.setAttributeNS('http://www.w3.org/1999/xlink','href',assetPath);
32081
32082 this.layerElement.appendChild(this.innerElem);
32083};
32084
32085IImageElement.prototype.sourceRectAtTime = function() {
32086 return this.sourceRect;
32087};
32088function ISolidElement(data,globalData,comp){
32089 this.initElement(data,globalData,comp);
32090}
32091extendPrototype([IImageElement], ISolidElement);
32092
32093ISolidElement.prototype.createContent = function(){
32094
32095 var rect = createNS('rect');
32096 ////rect.style.width = this.data.sw;
32097 ////rect.style.height = this.data.sh;
32098 ////rect.style.fill = this.data.sc;
32099 rect.setAttribute('width',this.data.sw);
32100 rect.setAttribute('height',this.data.sh);
32101 rect.setAttribute('fill',this.data.sc);
32102 this.layerElement.appendChild(rect);
32103};
32104function SVGCompElement(data,globalData,comp){
32105 this.layers = data.layers;
32106 this.supports3d = true;
32107 this.completeLayers = false;
32108 this.pendingElements = [];
32109 this.elements = this.layers ? createSizedArray(this.layers.length) : [];
32110 //this.layerElement = createNS('g');
32111 this.initElement(data,globalData,comp);
32112 this.tm = data.tm ? PropertyFactory.getProp(this,data.tm,0,globalData.frameRate,this) : {_placeholder:true};
32113}
32114
32115extendPrototype([SVGRenderer, ICompElement, SVGBaseElement], SVGCompElement);
32116function SVGTextElement(data,globalData,comp){
32117 this.textSpans = [];
32118 this.renderType = 'svg';
32119 this.initElement(data,globalData,comp);
32120}
32121
32122extendPrototype([BaseElement,TransformElement,SVGBaseElement,HierarchyElement,FrameElement,RenderableDOMElement,ITextElement], SVGTextElement);
32123
32124SVGTextElement.prototype.createContent = function(){
32125
32126 if (this.data.singleShape && !this.globalData.fontManager.chars) {
32127 this.textContainer = createNS('text');
32128 }
32129};
32130
32131SVGTextElement.prototype.buildTextContents = function(textArray) {
32132 var i = 0, len = textArray.length;
32133 var textContents = [], currentTextContent = '';
32134 while (i < len) {
32135 if(textArray[i] === String.fromCharCode(13) || textArray[i] === String.fromCharCode(3)) {
32136 textContents.push(currentTextContent);
32137 currentTextContent = '';
32138 } else {
32139 currentTextContent += textArray[i];
32140 }
32141 i += 1;
32142 }
32143 textContents.push(currentTextContent);
32144 return textContents;
32145};
32146
32147SVGTextElement.prototype.buildNewText = function(){
32148 var i, len;
32149
32150 var documentData = this.textProperty.currentData;
32151 this.renderedLetters = createSizedArray(documentData ? documentData.l.length : 0);
32152 if(documentData.fc) {
32153 this.layerElement.setAttribute('fill', this.buildColor(documentData.fc));
32154 }else{
32155 this.layerElement.setAttribute('fill', 'rgba(0,0,0,0)');
32156 }
32157 if(documentData.sc){
32158 this.layerElement.setAttribute('stroke', this.buildColor(documentData.sc));
32159 this.layerElement.setAttribute('stroke-width', documentData.sw);
32160 }
32161 this.layerElement.setAttribute('font-size', documentData.finalSize);
32162 var fontData = this.globalData.fontManager.getFontByName(documentData.f);
32163 if(fontData.fClass){
32164 this.layerElement.setAttribute('class',fontData.fClass);
32165 } else {
32166 this.layerElement.setAttribute('font-family', fontData.fFamily);
32167 var fWeight = documentData.fWeight, fStyle = documentData.fStyle;
32168 this.layerElement.setAttribute('font-style', fStyle);
32169 this.layerElement.setAttribute('font-weight', fWeight);
32170 }
32171 this.layerElement.setAttribute('arial-label', documentData.t);
32172
32173 var letters = documentData.l || [];
32174 var usesGlyphs = !!this.globalData.fontManager.chars;
32175 len = letters.length;
32176
32177 var tSpan;
32178 var matrixHelper = this.mHelper;
32179 var shapes, shapeStr = '', singleShape = this.data.singleShape;
32180 var xPos = 0, yPos = 0, firstLine = true;
32181 var trackingOffset = documentData.tr/1000*documentData.finalSize;
32182 if(singleShape && !usesGlyphs && !documentData.sz) {
32183 var tElement = this.textContainer;
32184 var justify = 'start';
32185 switch(documentData.j) {
32186 case 1:
32187 justify = 'end';
32188 break;
32189 case 2:
32190 justify = 'middle';
32191 break;
32192 }
32193 tElement.setAttribute('text-anchor',justify);
32194 tElement.setAttribute('letter-spacing',trackingOffset);
32195 var textContent = this.buildTextContents(documentData.finalText);
32196 len = textContent.length;
32197 yPos = documentData.ps ? documentData.ps[1] + documentData.ascent : 0;
32198 for ( i = 0; i < len; i += 1) {
32199 tSpan = this.textSpans[i] || createNS('tspan');
32200 tSpan.textContent = textContent[i];
32201 tSpan.setAttribute('x', 0);
32202 tSpan.setAttribute('y', yPos);
32203 tSpan.style.display = 'inherit';
32204 tElement.appendChild(tSpan);
32205 this.textSpans[i] = tSpan;
32206 yPos += documentData.finalLineHeight;
32207 }
32208
32209 this.layerElement.appendChild(tElement);
32210 } else {
32211 var cachedSpansLength = this.textSpans.length;
32212 var shapeData, charData;
32213 for (i = 0; i < len; i += 1) {
32214 if(!usesGlyphs || !singleShape || i === 0){
32215 tSpan = cachedSpansLength > i ? this.textSpans[i] : createNS(usesGlyphs?'path':'text');
32216 if (cachedSpansLength <= i) {
32217 tSpan.setAttribute('stroke-linecap', 'butt');
32218 tSpan.setAttribute('stroke-linejoin','round');
32219 tSpan.setAttribute('stroke-miterlimit','4');
32220 this.textSpans[i] = tSpan;
32221 this.layerElement.appendChild(tSpan);
32222 }
32223 tSpan.style.display = 'inherit';
32224 }
32225
32226 matrixHelper.reset();
32227 matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100);
32228 if (singleShape) {
32229 if(letters[i].n) {
32230 xPos = -trackingOffset;
32231 yPos += documentData.yOffset;
32232 yPos += firstLine ? 1 : 0;
32233 firstLine = false;
32234 }
32235 this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos);
32236 xPos += letters[i].l || 0;
32237 //xPos += letters[i].val === ' ' ? 0 : trackingOffset;
32238 xPos += trackingOffset;
32239 }
32240 if(usesGlyphs) {
32241 charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);
32242 shapeData = charData && charData.data || {};
32243 shapes = shapeData.shapes ? shapeData.shapes[0].it : [];
32244 if(!singleShape){
32245 tSpan.setAttribute('d',this.createPathShape(matrixHelper,shapes));
32246 } else {
32247 shapeStr += this.createPathShape(matrixHelper,shapes);
32248 }
32249 } else {
32250 if(singleShape) {
32251 tSpan.setAttribute("transform", "translate(" + matrixHelper.props[12] + "," + matrixHelper.props[13] + ")");
32252 }
32253 tSpan.textContent = letters[i].val;
32254 tSpan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space","preserve");
32255 }
32256 //
32257 }
32258 if (singleShape && tSpan) {
32259 tSpan.setAttribute('d',shapeStr);
32260 }
32261 }
32262 while (i < this.textSpans.length){
32263 this.textSpans[i].style.display = 'none';
32264 i += 1;
32265 }
32266
32267 this._sizeChanged = true;
32268};
32269
32270SVGTextElement.prototype.sourceRectAtTime = function(time){
32271 this.prepareFrame(this.comp.renderedFrame - this.data.st);
32272 this.renderInnerContent();
32273 if(this._sizeChanged){
32274 this._sizeChanged = false;
32275 var textBox = this.layerElement.getBBox();
32276 this.bbox = {
32277 top: textBox.y,
32278 left: textBox.x,
32279 width: textBox.width,
32280 height: textBox.height
32281 };
32282 }
32283 return this.bbox;
32284};
32285
32286SVGTextElement.prototype.renderInnerContent = function(){
32287
32288 if(!this.data.singleShape){
32289 this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);
32290 if(this.lettersChangedFlag || this.textAnimator.lettersChangedFlag){
32291 this._sizeChanged = true;
32292 var i,len;
32293 var renderedLetters = this.textAnimator.renderedLetters;
32294
32295 var letters = this.textProperty.currentData.l;
32296
32297 len = letters.length;
32298 var renderedLetter, textSpan;
32299 for(i=0;i<len;i+=1){
32300 if(letters[i].n){
32301 continue;
32302 }
32303 renderedLetter = renderedLetters[i];
32304 textSpan = this.textSpans[i];
32305 if(renderedLetter._mdf.m) {
32306 textSpan.setAttribute('transform',renderedLetter.m);
32307 }
32308 if(renderedLetter._mdf.o) {
32309 textSpan.setAttribute('opacity',renderedLetter.o);
32310 }
32311 if(renderedLetter._mdf.sw){
32312 textSpan.setAttribute('stroke-width',renderedLetter.sw);
32313 }
32314 if(renderedLetter._mdf.sc){
32315 textSpan.setAttribute('stroke',renderedLetter.sc);
32316 }
32317 if(renderedLetter._mdf.fc){
32318 textSpan.setAttribute('fill',renderedLetter.fc);
32319 }
32320 }
32321 }
32322 }
32323};
32324function SVGShapeElement(data,globalData,comp){
32325 //List of drawable elements
32326 this.shapes = [];
32327 // Full shape data
32328 this.shapesData = data.shapes;
32329 //List of styles that will be applied to shapes
32330 this.stylesList = [];
32331 //List of modifiers that will be applied to shapes
32332 this.shapeModifiers = [];
32333 //List of items in shape tree
32334 this.itemsData = [];
32335 //List of items in previous shape tree
32336 this.processedElements = [];
32337 // List of animated components
32338 this.animatedContents = [];
32339 this.initElement(data,globalData,comp);
32340 //Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.
32341 // List of elements that have been created
32342 this.prevViewData = [];
32343 //Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.
32344}
32345
32346extendPrototype([BaseElement,TransformElement,SVGBaseElement,IShapeElement,HierarchyElement,FrameElement,RenderableDOMElement], SVGShapeElement);
32347
32348SVGShapeElement.prototype.initSecondaryElement = function() {
32349};
32350
32351SVGShapeElement.prototype.identityMatrix = new Matrix();
32352
32353SVGShapeElement.prototype.buildExpressionInterface = function(){};
32354
32355SVGShapeElement.prototype.createContent = function(){
32356 this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement, 0, [], true);
32357 this.filterUniqueShapes();
32358};
32359
32360/*
32361This method searches for multiple shapes that affect a single element and one of them is animated
32362*/
32363SVGShapeElement.prototype.filterUniqueShapes = function(){
32364 var i, len = this.shapes.length, shape;
32365 var j, jLen = this.stylesList.length;
32366 var style;
32367 var tempShapes = [];
32368 var areAnimated = false;
32369 for(j = 0; j < jLen; j += 1) {
32370 style = this.stylesList[j];
32371 areAnimated = false;
32372 tempShapes.length = 0;
32373 for(i = 0; i < len; i += 1) {
32374 shape = this.shapes[i];
32375 if(shape.styles.indexOf(style) !== -1) {
32376 tempShapes.push(shape);
32377 areAnimated = shape._isAnimated || areAnimated;
32378 }
32379 }
32380 if(tempShapes.length > 1 && areAnimated) {
32381 this.setShapesAsAnimated(tempShapes);
32382 }
32383 }
32384};
32385
32386SVGShapeElement.prototype.setShapesAsAnimated = function(shapes){
32387 var i, len = shapes.length;
32388 for(i = 0; i < len; i += 1) {
32389 shapes[i].setAsAnimated();
32390 }
32391};
32392
32393SVGShapeElement.prototype.createStyleElement = function(data, level){
32394 //TODO: prevent drawing of hidden styles
32395 var elementData;
32396 var styleOb = new SVGStyleData(data, level);
32397
32398 var pathElement = styleOb.pElem;
32399 if(data.ty === 'st') {
32400 elementData = new SVGStrokeStyleData(this, data, styleOb);
32401 } else if(data.ty === 'fl') {
32402 elementData = new SVGFillStyleData(this, data, styleOb);
32403 } else if(data.ty === 'gf' || data.ty === 'gs') {
32404 var gradientConstructor = data.ty === 'gf' ? SVGGradientFillStyleData : SVGGradientStrokeStyleData;
32405 elementData = new gradientConstructor(this, data, styleOb);
32406 this.globalData.defs.appendChild(elementData.gf);
32407 if (elementData.maskId) {
32408 this.globalData.defs.appendChild(elementData.ms);
32409 this.globalData.defs.appendChild(elementData.of);
32410 pathElement.setAttribute('mask','url(' + locationHref + '#' + elementData.maskId + ')');
32411 }
32412 }
32413
32414 if(data.ty === 'st' || data.ty === 'gs') {
32415 pathElement.setAttribute('stroke-linecap', this.lcEnum[data.lc] || 'round');
32416 pathElement.setAttribute('stroke-linejoin',this.ljEnum[data.lj] || 'round');
32417 pathElement.setAttribute('fill-opacity','0');
32418 if(data.lj === 1) {
32419 pathElement.setAttribute('stroke-miterlimit',data.ml);
32420 }
32421 }
32422
32423 if(data.r === 2) {
32424 pathElement.setAttribute('fill-rule', 'evenodd');
32425 }
32426
32427 if(data.ln){
32428 pathElement.setAttribute('id',data.ln);
32429 }
32430 if(data.cl){
32431 pathElement.setAttribute('class',data.cl);
32432 }
32433 if(data.bm){
32434 pathElement.style['mix-blend-mode'] = getBlendMode(data.bm);
32435 }
32436 this.stylesList.push(styleOb);
32437 this.addToAnimatedContents(data, elementData);
32438 return elementData;
32439};
32440
32441SVGShapeElement.prototype.createGroupElement = function(data) {
32442 var elementData = new ShapeGroupData();
32443 if(data.ln){
32444 elementData.gr.setAttribute('id',data.ln);
32445 }
32446 if(data.cl){
32447 elementData.gr.setAttribute('class',data.cl);
32448 }
32449 if(data.bm){
32450 elementData.gr.style['mix-blend-mode'] = getBlendMode(data.bm);
32451 }
32452 return elementData;
32453};
32454
32455SVGShapeElement.prototype.createTransformElement = function(data, container) {
32456 var transformProperty = TransformPropertyFactory.getTransformProperty(this,data,this);
32457 var elementData = new SVGTransformData(transformProperty, transformProperty.o, container);
32458 this.addToAnimatedContents(data, elementData);
32459 return elementData;
32460};
32461
32462SVGShapeElement.prototype.createShapeElement = function(data, ownTransformers, level) {
32463 var ty = 4;
32464 if(data.ty === 'rc'){
32465 ty = 5;
32466 }else if(data.ty === 'el'){
32467 ty = 6;
32468 }else if(data.ty === 'sr'){
32469 ty = 7;
32470 }
32471 var shapeProperty = ShapePropertyFactory.getShapeProp(this,data,ty,this);
32472 var elementData = new SVGShapeData(ownTransformers, level, shapeProperty);
32473 this.shapes.push(elementData);
32474 this.addShapeToModifiers(elementData);
32475 this.addToAnimatedContents(data, elementData);
32476 return elementData;
32477};
32478
32479SVGShapeElement.prototype.addToAnimatedContents = function(data, element) {
32480 var i = 0, len = this.animatedContents.length;
32481 while(i < len) {
32482 if(this.animatedContents[i].element === element) {
32483 return;
32484 }
32485 i += 1;
32486 }
32487 this.animatedContents.push({
32488 fn: SVGElementsRenderer.createRenderFunction(data),
32489 element: element,
32490 data: data
32491 });
32492};
32493
32494SVGShapeElement.prototype.setElementStyles = function(elementData){
32495 var arr = elementData.styles;
32496 var j, jLen = this.stylesList.length;
32497 for (j = 0; j < jLen; j += 1) {
32498 if (!this.stylesList[j].closed) {
32499 arr.push(this.stylesList[j]);
32500 }
32501 }
32502};
32503
32504SVGShapeElement.prototype.reloadShapes = function(){
32505 this._isFirstFrame = true;
32506 var i, len = this.itemsData.length;
32507 for( i = 0; i < len; i += 1) {
32508 this.prevViewData[i] = this.itemsData[i];
32509 }
32510 this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement, 0, [], true);
32511 this.filterUniqueShapes();
32512 len = this.dynamicProperties.length;
32513 for(i = 0; i < len; i += 1) {
32514 this.dynamicProperties[i].getValue();
32515 }
32516 this.renderModifiers();
32517};
32518
32519SVGShapeElement.prototype.searchShapes = function(arr,itemsData,prevViewData,container, level, transformers, render){
32520 var ownTransformers = [].concat(transformers);
32521 var i, len = arr.length - 1;
32522 var j, jLen;
32523 var ownStyles = [], ownModifiers = [], currentTransform, modifier, processedPos;
32524 for(i=len;i>=0;i-=1){
32525 processedPos = this.searchProcessedElement(arr[i]);
32526 if(!processedPos){
32527 arr[i]._render = render;
32528 } else {
32529 itemsData[i] = prevViewData[processedPos - 1];
32530 }
32531 if(arr[i].ty == 'fl' || arr[i].ty == 'st' || arr[i].ty == 'gf' || arr[i].ty == 'gs'){
32532 if(!processedPos){
32533 itemsData[i] = this.createStyleElement(arr[i], level);
32534 } else {
32535 itemsData[i].style.closed = false;
32536 }
32537 if(arr[i]._render){
32538 container.appendChild(itemsData[i].style.pElem);
32539 }
32540 ownStyles.push(itemsData[i].style);
32541 }else if(arr[i].ty == 'gr'){
32542 if(!processedPos){
32543 itemsData[i] = this.createGroupElement(arr[i]);
32544 } else {
32545 jLen = itemsData[i].it.length;
32546 for(j=0;j<jLen;j+=1){
32547 itemsData[i].prevViewData[j] = itemsData[i].it[j];
32548 }
32549 }
32550 this.searchShapes(arr[i].it,itemsData[i].it,itemsData[i].prevViewData,itemsData[i].gr, level + 1, ownTransformers, render);
32551 if(arr[i]._render){
32552 container.appendChild(itemsData[i].gr);
32553 }
32554 }else if(arr[i].ty == 'tr'){
32555 if(!processedPos){
32556 itemsData[i] = this.createTransformElement(arr[i], container);
32557 }
32558 currentTransform = itemsData[i].transform;
32559 ownTransformers.push(currentTransform);
32560 }else if(arr[i].ty == 'sh' || arr[i].ty == 'rc' || arr[i].ty == 'el' || arr[i].ty == 'sr'){
32561 if(!processedPos){
32562 itemsData[i] = this.createShapeElement(arr[i], ownTransformers, level);
32563 }
32564 this.setElementStyles(itemsData[i]);
32565
32566 }else if(arr[i].ty == 'tm' || arr[i].ty == 'rd' || arr[i].ty == 'ms'){
32567 if(!processedPos){
32568 modifier = ShapeModifiers.getModifier(arr[i].ty);
32569 modifier.init(this,arr[i]);
32570 itemsData[i] = modifier;
32571 this.shapeModifiers.push(modifier);
32572 } else {
32573 modifier = itemsData[i];
32574 modifier.closed = false;
32575 }
32576 ownModifiers.push(modifier);
32577 }else if(arr[i].ty == 'rp'){
32578 if(!processedPos){
32579 modifier = ShapeModifiers.getModifier(arr[i].ty);
32580 itemsData[i] = modifier;
32581 modifier.init(this,arr,i,itemsData);
32582 this.shapeModifiers.push(modifier);
32583 render = false;
32584 }else{
32585 modifier = itemsData[i];
32586 modifier.closed = true;
32587 }
32588 ownModifiers.push(modifier);
32589 }
32590 this.addProcessedElement(arr[i], i + 1);
32591 }
32592 len = ownStyles.length;
32593 for(i=0;i<len;i+=1){
32594 ownStyles[i].closed = true;
32595 }
32596 len = ownModifiers.length;
32597 for(i=0;i<len;i+=1){
32598 ownModifiers[i].closed = true;
32599 }
32600};
32601
32602SVGShapeElement.prototype.renderInnerContent = function() {
32603 this.renderModifiers();
32604 var i, len = this.stylesList.length;
32605 for(i=0;i<len;i+=1){
32606 this.stylesList[i].reset();
32607 }
32608 this.renderShape();
32609
32610 for (i = 0; i < len; i += 1) {
32611 if (this.stylesList[i]._mdf || this._isFirstFrame) {
32612 if(this.stylesList[i].msElem){
32613 this.stylesList[i].msElem.setAttribute('d', this.stylesList[i].d);
32614 //Adding M0 0 fixes same mask bug on all browsers
32615 this.stylesList[i].d = 'M0 0' + this.stylesList[i].d;
32616 }
32617 this.stylesList[i].pElem.setAttribute('d', this.stylesList[i].d || 'M0 0');
32618 }
32619 }
32620};
32621
32622SVGShapeElement.prototype.renderShape = function() {
32623 var i, len = this.animatedContents.length;
32624 var animatedContent;
32625 for(i = 0; i < len; i += 1) {
32626 animatedContent = this.animatedContents[i];
32627 if((this._isFirstFrame || animatedContent.element._isAnimated) && animatedContent.data !== true) {
32628 animatedContent.fn(animatedContent.data, animatedContent.element, this._isFirstFrame);
32629 }
32630 }
32631};
32632
32633SVGShapeElement.prototype.destroy = function(){
32634 this.destroyBaseElement();
32635 this.shapesData = null;
32636 this.itemsData = null;
32637};
32638
32639function SVGTintFilter(filter, filterManager){
32640 this.filterManager = filterManager;
32641 var feColorMatrix = createNS('feColorMatrix');
32642 feColorMatrix.setAttribute('type','matrix');
32643 feColorMatrix.setAttribute('color-interpolation-filters','linearRGB');
32644 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');
32645 feColorMatrix.setAttribute('result','f1');
32646 filter.appendChild(feColorMatrix);
32647 feColorMatrix = createNS('feColorMatrix');
32648 feColorMatrix.setAttribute('type','matrix');
32649 feColorMatrix.setAttribute('color-interpolation-filters','sRGB');
32650 feColorMatrix.setAttribute('values','1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0');
32651 feColorMatrix.setAttribute('result','f2');
32652 filter.appendChild(feColorMatrix);
32653 this.matrixFilter = feColorMatrix;
32654 if(filterManager.effectElements[2].p.v !== 100 || filterManager.effectElements[2].p.k){
32655 var feMerge = createNS('feMerge');
32656 filter.appendChild(feMerge);
32657 var feMergeNode;
32658 feMergeNode = createNS('feMergeNode');
32659 feMergeNode.setAttribute('in','SourceGraphic');
32660 feMerge.appendChild(feMergeNode);
32661 feMergeNode = createNS('feMergeNode');
32662 feMergeNode.setAttribute('in','f2');
32663 feMerge.appendChild(feMergeNode);
32664 }
32665}
32666
32667SVGTintFilter.prototype.renderFrame = function(forceRender){
32668 if(forceRender || this.filterManager._mdf){
32669 var colorBlack = this.filterManager.effectElements[0].p.v;
32670 var colorWhite = this.filterManager.effectElements[1].p.v;
32671 var opacity = this.filterManager.effectElements[2].p.v/100;
32672 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');
32673 }
32674};
32675function SVGFillFilter(filter, filterManager){
32676 this.filterManager = filterManager;
32677 var feColorMatrix = createNS('feColorMatrix');
32678 feColorMatrix.setAttribute('type','matrix');
32679 feColorMatrix.setAttribute('color-interpolation-filters','sRGB');
32680 feColorMatrix.setAttribute('values','1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0');
32681 filter.appendChild(feColorMatrix);
32682 this.matrixFilter = feColorMatrix;
32683}
32684SVGFillFilter.prototype.renderFrame = function(forceRender){
32685 if(forceRender || this.filterManager._mdf){
32686 var color = this.filterManager.effectElements[2].p.v;
32687 var opacity = this.filterManager.effectElements[6].p.v;
32688 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');
32689 }
32690};
32691function SVGStrokeEffect(elem, filterManager){
32692 this.initialized = false;
32693 this.filterManager = filterManager;
32694 this.elem = elem;
32695 this.paths = [];
32696}
32697
32698SVGStrokeEffect.prototype.initialize = function(){
32699
32700 var elemChildren = this.elem.layerElement.children || this.elem.layerElement.childNodes;
32701 var path,groupPath, i, len;
32702 if(this.filterManager.effectElements[1].p.v === 1){
32703 len = this.elem.maskManager.masksProperties.length;
32704 i = 0;
32705 } else {
32706 i = this.filterManager.effectElements[0].p.v - 1;
32707 len = i + 1;
32708 }
32709 groupPath = createNS('g');
32710 groupPath.setAttribute('fill','none');
32711 groupPath.setAttribute('stroke-linecap','round');
32712 groupPath.setAttribute('stroke-dashoffset',1);
32713 for(i;i<len;i+=1){
32714 path = createNS('path');
32715 groupPath.appendChild(path);
32716 this.paths.push({p:path,m:i});
32717 }
32718 if(this.filterManager.effectElements[10].p.v === 3){
32719 var mask = createNS('mask');
32720 var id = createElementID();
32721 mask.setAttribute('id',id);
32722 mask.setAttribute('mask-type','alpha');
32723 mask.appendChild(groupPath);
32724 this.elem.globalData.defs.appendChild(mask);
32725 var g = createNS('g');
32726 g.setAttribute('mask','url(' + locationHref + '#'+id+')');
32727 while (elemChildren[0]) {
32728 g.appendChild(elemChildren[0]);
32729 }
32730 this.elem.layerElement.appendChild(g);
32731 this.masker = mask;
32732 groupPath.setAttribute('stroke','#fff');
32733 } else if(this.filterManager.effectElements[10].p.v === 1 || this.filterManager.effectElements[10].p.v === 2){
32734 if(this.filterManager.effectElements[10].p.v === 2){
32735 elemChildren = this.elem.layerElement.children || this.elem.layerElement.childNodes;
32736 while(elemChildren.length){
32737 this.elem.layerElement.removeChild(elemChildren[0]);
32738 }
32739 }
32740 this.elem.layerElement.appendChild(groupPath);
32741 this.elem.layerElement.removeAttribute('mask');
32742 groupPath.setAttribute('stroke','#fff');
32743 }
32744 this.initialized = true;
32745 this.pathMasker = groupPath;
32746};
32747
32748SVGStrokeEffect.prototype.renderFrame = function(forceRender){
32749 if(!this.initialized){
32750 this.initialize();
32751 }
32752 var i, len = this.paths.length;
32753 var mask, path;
32754 for(i=0;i<len;i+=1){
32755 if(this.paths[i].m === -1) {
32756 continue;
32757 }
32758 mask = this.elem.maskManager.viewData[this.paths[i].m];
32759 path = this.paths[i].p;
32760 if(forceRender || this.filterManager._mdf || mask.prop._mdf){
32761 path.setAttribute('d',mask.lastPath);
32762 }
32763 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){
32764 var dasharrayValue;
32765 if(this.filterManager.effectElements[7].p.v !== 0 || this.filterManager.effectElements[8].p.v !== 100){
32766 var s = Math.min(this.filterManager.effectElements[7].p.v,this.filterManager.effectElements[8].p.v)/100;
32767 var e = Math.max(this.filterManager.effectElements[7].p.v,this.filterManager.effectElements[8].p.v)/100;
32768 var l = path.getTotalLength();
32769 dasharrayValue = '0 0 0 ' + l*s + ' ';
32770 var lineLength = l*(e-s);
32771 var segment = 1+this.filterManager.effectElements[4].p.v*2*this.filterManager.effectElements[9].p.v/100;
32772 var units = Math.floor(lineLength/segment);
32773 var j;
32774 for(j=0;j<units;j+=1){
32775 dasharrayValue += '1 ' + this.filterManager.effectElements[4].p.v*2*this.filterManager.effectElements[9].p.v/100 + ' ';
32776 }
32777 dasharrayValue += '0 ' + l*10 + ' 0 0';
32778 } else {
32779 dasharrayValue = '1 ' + this.filterManager.effectElements[4].p.v*2*this.filterManager.effectElements[9].p.v/100;
32780 }
32781 path.setAttribute('stroke-dasharray',dasharrayValue);
32782 }
32783 }
32784 if(forceRender || this.filterManager.effectElements[4].p._mdf){
32785 this.pathMasker.setAttribute('stroke-width',this.filterManager.effectElements[4].p.v*2);
32786 }
32787
32788 if(forceRender || this.filterManager.effectElements[6].p._mdf){
32789 this.pathMasker.setAttribute('opacity',this.filterManager.effectElements[6].p.v);
32790 }
32791 if(this.filterManager.effectElements[10].p.v === 1 || this.filterManager.effectElements[10].p.v === 2){
32792 if(forceRender || this.filterManager.effectElements[3].p._mdf){
32793 var color = this.filterManager.effectElements[3].p.v;
32794 this.pathMasker.setAttribute('stroke','rgb('+bm_floor(color[0]*255)+','+bm_floor(color[1]*255)+','+bm_floor(color[2]*255)+')');
32795 }
32796 }
32797};
32798function SVGTritoneFilter(filter, filterManager){
32799 this.filterManager = filterManager;
32800 var feColorMatrix = createNS('feColorMatrix');
32801 feColorMatrix.setAttribute('type','matrix');
32802 feColorMatrix.setAttribute('color-interpolation-filters','linearRGB');
32803 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');
32804 feColorMatrix.setAttribute('result','f1');
32805 filter.appendChild(feColorMatrix);
32806 var feComponentTransfer = createNS('feComponentTransfer');
32807 feComponentTransfer.setAttribute('color-interpolation-filters','sRGB');
32808 filter.appendChild(feComponentTransfer);
32809 this.matrixFilter = feComponentTransfer;
32810 var feFuncR = createNS('feFuncR');
32811 feFuncR.setAttribute('type','table');
32812 feComponentTransfer.appendChild(feFuncR);
32813 this.feFuncR = feFuncR;
32814 var feFuncG = createNS('feFuncG');
32815 feFuncG.setAttribute('type','table');
32816 feComponentTransfer.appendChild(feFuncG);
32817 this.feFuncG = feFuncG;
32818 var feFuncB = createNS('feFuncB');
32819 feFuncB.setAttribute('type','table');
32820 feComponentTransfer.appendChild(feFuncB);
32821 this.feFuncB = feFuncB;
32822}
32823
32824SVGTritoneFilter.prototype.renderFrame = function(forceRender){
32825 if(forceRender || this.filterManager._mdf){
32826 var color1 = this.filterManager.effectElements[0].p.v;
32827 var color2 = this.filterManager.effectElements[1].p.v;
32828 var color3 = this.filterManager.effectElements[2].p.v;
32829 var tableR = color3[0] + ' ' + color2[0] + ' ' + color1[0];
32830 var tableG = color3[1] + ' ' + color2[1] + ' ' + color1[1];
32831 var tableB = color3[2] + ' ' + color2[2] + ' ' + color1[2];
32832 this.feFuncR.setAttribute('tableValues', tableR);
32833 this.feFuncG.setAttribute('tableValues', tableG);
32834 this.feFuncB.setAttribute('tableValues', tableB);
32835 //var opacity = this.filterManager.effectElements[2].p.v/100;
32836 //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');
32837 }
32838};
32839function SVGProLevelsFilter(filter, filterManager){
32840 this.filterManager = filterManager;
32841 var effectElements = this.filterManager.effectElements;
32842 var feComponentTransfer = createNS('feComponentTransfer');
32843
32844 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){
32845 this.feFuncR = this.createFeFunc('feFuncR', feComponentTransfer);
32846 }
32847 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){
32848 this.feFuncG = this.createFeFunc('feFuncG', feComponentTransfer);
32849 }
32850 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){
32851 this.feFuncB = this.createFeFunc('feFuncB', feComponentTransfer);
32852 }
32853 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){
32854 this.feFuncA = this.createFeFunc('feFuncA', feComponentTransfer);
32855 }
32856
32857 if(this.feFuncR || this.feFuncG || this.feFuncB || this.feFuncA){
32858 feComponentTransfer.setAttribute('color-interpolation-filters','sRGB');
32859 filter.appendChild(feComponentTransfer);
32860 feComponentTransfer = createNS('feComponentTransfer');
32861 }
32862
32863 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){
32864
32865 feComponentTransfer.setAttribute('color-interpolation-filters','sRGB');
32866 filter.appendChild(feComponentTransfer);
32867 this.feFuncRComposed = this.createFeFunc('feFuncR', feComponentTransfer);
32868 this.feFuncGComposed = this.createFeFunc('feFuncG', feComponentTransfer);
32869 this.feFuncBComposed = this.createFeFunc('feFuncB', feComponentTransfer);
32870 }
32871}
32872
32873SVGProLevelsFilter.prototype.createFeFunc = function(type, feComponentTransfer) {
32874 var feFunc = createNS(type);
32875 feFunc.setAttribute('type','table');
32876 feComponentTransfer.appendChild(feFunc);
32877 return feFunc;
32878};
32879
32880SVGProLevelsFilter.prototype.getTableValue = function(inputBlack, inputWhite, gamma, outputBlack, outputWhite) {
32881 var cnt = 0;
32882 var segments = 256;
32883 var perc;
32884 var min = Math.min(inputBlack, inputWhite);
32885 var max = Math.max(inputBlack, inputWhite);
32886 var table = Array.call(null,{length:segments});
32887 var colorValue;
32888 var pos = 0;
32889 var outputDelta = outputWhite - outputBlack;
32890 var inputDelta = inputWhite - inputBlack;
32891 while(cnt <= 256) {
32892 perc = cnt/256;
32893 if(perc <= min){
32894 colorValue = inputDelta < 0 ? outputWhite : outputBlack;
32895 } else if(perc >= max){
32896 colorValue = inputDelta < 0 ? outputBlack : outputWhite;
32897 } else {
32898 colorValue = (outputBlack + outputDelta * Math.pow((perc - inputBlack) / inputDelta, 1 / gamma));
32899 }
32900 table[pos++] = colorValue;
32901 cnt += 256/(segments-1);
32902 }
32903 return table.join(' ');
32904};
32905
32906SVGProLevelsFilter.prototype.renderFrame = function(forceRender){
32907 if(forceRender || this.filterManager._mdf){
32908 var val;
32909 var effectElements = this.filterManager.effectElements;
32910 if(this.feFuncRComposed && (forceRender || effectElements[3].p._mdf || effectElements[4].p._mdf || effectElements[5].p._mdf || effectElements[6].p._mdf || effectElements[7].p._mdf)){
32911 val = this.getTableValue(effectElements[3].p.v,effectElements[4].p.v,effectElements[5].p.v,effectElements[6].p.v,effectElements[7].p.v);
32912 this.feFuncRComposed.setAttribute('tableValues',val);
32913 this.feFuncGComposed.setAttribute('tableValues',val);
32914 this.feFuncBComposed.setAttribute('tableValues',val);
32915 }
32916
32917
32918 if(this.feFuncR && (forceRender || effectElements[10].p._mdf || effectElements[11].p._mdf || effectElements[12].p._mdf || effectElements[13].p._mdf || effectElements[14].p._mdf)){
32919 val = this.getTableValue(effectElements[10].p.v,effectElements[11].p.v,effectElements[12].p.v,effectElements[13].p.v,effectElements[14].p.v);
32920 this.feFuncR.setAttribute('tableValues',val);
32921 }
32922
32923 if(this.feFuncG && (forceRender || effectElements[17].p._mdf || effectElements[18].p._mdf || effectElements[19].p._mdf || effectElements[20].p._mdf || effectElements[21].p._mdf)){
32924 val = this.getTableValue(effectElements[17].p.v,effectElements[18].p.v,effectElements[19].p.v,effectElements[20].p.v,effectElements[21].p.v);
32925 this.feFuncG.setAttribute('tableValues',val);
32926 }
32927
32928 if(this.feFuncB && (forceRender || effectElements[24].p._mdf || effectElements[25].p._mdf || effectElements[26].p._mdf || effectElements[27].p._mdf || effectElements[28].p._mdf)){
32929 val = this.getTableValue(effectElements[24].p.v,effectElements[25].p.v,effectElements[26].p.v,effectElements[27].p.v,effectElements[28].p.v);
32930 this.feFuncB.setAttribute('tableValues',val);
32931 }
32932
32933 if(this.feFuncA && (forceRender || effectElements[31].p._mdf || effectElements[32].p._mdf || effectElements[33].p._mdf || effectElements[34].p._mdf || effectElements[35].p._mdf)){
32934 val = this.getTableValue(effectElements[31].p.v,effectElements[32].p.v,effectElements[33].p.v,effectElements[34].p.v,effectElements[35].p.v);
32935 this.feFuncA.setAttribute('tableValues',val);
32936 }
32937
32938 }
32939};
32940function SVGDropShadowEffect(filter, filterManager){
32941 filter.setAttribute('x','-100%');
32942 filter.setAttribute('y','-100%');
32943 filter.setAttribute('width','400%');
32944 filter.setAttribute('height','400%');
32945 this.filterManager = filterManager;
32946
32947 var feGaussianBlur = createNS('feGaussianBlur');
32948 feGaussianBlur.setAttribute('in','SourceAlpha');
32949 feGaussianBlur.setAttribute('result','drop_shadow_1');
32950 feGaussianBlur.setAttribute('stdDeviation','0');
32951 this.feGaussianBlur = feGaussianBlur;
32952 filter.appendChild(feGaussianBlur);
32953
32954 var feOffset = createNS('feOffset');
32955 feOffset.setAttribute('dx','25');
32956 feOffset.setAttribute('dy','0');
32957 feOffset.setAttribute('in','drop_shadow_1');
32958 feOffset.setAttribute('result','drop_shadow_2');
32959 this.feOffset = feOffset;
32960 filter.appendChild(feOffset);
32961 var feFlood = createNS('feFlood');
32962 feFlood.setAttribute('flood-color','#00ff00');
32963 feFlood.setAttribute('flood-opacity','1');
32964 feFlood.setAttribute('result','drop_shadow_3');
32965 this.feFlood = feFlood;
32966 filter.appendChild(feFlood);
32967
32968 var feComposite = createNS('feComposite');
32969 feComposite.setAttribute('in','drop_shadow_3');
32970 feComposite.setAttribute('in2','drop_shadow_2');
32971 feComposite.setAttribute('operator','in');
32972 feComposite.setAttribute('result','drop_shadow_4');
32973 filter.appendChild(feComposite);
32974
32975
32976 var feMerge = createNS('feMerge');
32977 filter.appendChild(feMerge);
32978 var feMergeNode;
32979 feMergeNode = createNS('feMergeNode');
32980 feMerge.appendChild(feMergeNode);
32981 feMergeNode = createNS('feMergeNode');
32982 feMergeNode.setAttribute('in','SourceGraphic');
32983 this.feMergeNode = feMergeNode;
32984 this.feMerge = feMerge;
32985 this.originalNodeAdded = false;
32986 feMerge.appendChild(feMergeNode);
32987}
32988
32989SVGDropShadowEffect.prototype.renderFrame = function(forceRender){
32990 if(forceRender || this.filterManager._mdf){
32991 if(forceRender || this.filterManager.effectElements[4].p._mdf){
32992 this.feGaussianBlur.setAttribute('stdDeviation', this.filterManager.effectElements[4].p.v / 4);
32993 }
32994 if(forceRender || this.filterManager.effectElements[0].p._mdf){
32995 var col = this.filterManager.effectElements[0].p.v;
32996 this.feFlood.setAttribute('flood-color',rgbToHex(Math.round(col[0]*255),Math.round(col[1]*255),Math.round(col[2]*255)));
32997 }
32998 if(forceRender || this.filterManager.effectElements[1].p._mdf){
32999 this.feFlood.setAttribute('flood-opacity',this.filterManager.effectElements[1].p.v/255);
33000 }
33001 if(forceRender || this.filterManager.effectElements[2].p._mdf || this.filterManager.effectElements[3].p._mdf){
33002 var distance = this.filterManager.effectElements[3].p.v;
33003 var angle = (this.filterManager.effectElements[2].p.v - 90) * degToRads;
33004 var x = distance * Math.cos(angle);
33005 var y = distance * Math.sin(angle);
33006 this.feOffset.setAttribute('dx', x);
33007 this.feOffset.setAttribute('dy', y);
33008 }
33009 /*if(forceRender || this.filterManager.effectElements[5].p._mdf){
33010 if(this.filterManager.effectElements[5].p.v === 1 && this.originalNodeAdded) {
33011 this.feMerge.removeChild(this.feMergeNode);
33012 this.originalNodeAdded = false;
33013 } else if(this.filterManager.effectElements[5].p.v === 0 && !this.originalNodeAdded) {
33014 this.feMerge.appendChild(this.feMergeNode);
33015 this.originalNodeAdded = true;
33016 }
33017 }*/
33018 }
33019};
33020var _svgMatteSymbols = [];
33021
33022function SVGMatte3Effect(filterElem, filterManager, elem){
33023 this.initialized = false;
33024 this.filterManager = filterManager;
33025 this.filterElem = filterElem;
33026 this.elem = elem;
33027 elem.matteElement = createNS('g');
33028 elem.matteElement.appendChild(elem.layerElement);
33029 elem.matteElement.appendChild(elem.transformedElement);
33030 elem.baseElement = elem.matteElement;
33031}
33032
33033SVGMatte3Effect.prototype.findSymbol = function(mask) {
33034 var i = 0, len = _svgMatteSymbols.length;
33035 while(i < len) {
33036 if(_svgMatteSymbols[i] === mask) {
33037 return _svgMatteSymbols[i];
33038 }
33039 i += 1;
33040 }
33041 return null;
33042};
33043
33044SVGMatte3Effect.prototype.replaceInParent = function(mask, symbolId) {
33045 var parentNode = mask.layerElement.parentNode;
33046 if(!parentNode) {
33047 return;
33048 }
33049 var children = parentNode.children;
33050 var i = 0, len = children.length;
33051 while (i < len) {
33052 if (children[i] === mask.layerElement) {
33053 break;
33054 }
33055 i += 1;
33056 }
33057 var nextChild;
33058 if (i <= len - 2) {
33059 nextChild = children[i + 1];
33060 }
33061 var useElem = createNS('use');
33062 useElem.setAttribute('href', '#' + symbolId);
33063 if(nextChild) {
33064 parentNode.insertBefore(useElem, nextChild);
33065 } else {
33066 parentNode.appendChild(useElem);
33067 }
33068};
33069
33070SVGMatte3Effect.prototype.setElementAsMask = function(elem, mask) {
33071 if(!this.findSymbol(mask)) {
33072 var symbolId = createElementID();
33073 var masker = createNS('mask');
33074 masker.setAttribute('id', mask.layerId);
33075 masker.setAttribute('mask-type', 'alpha');
33076 _svgMatteSymbols.push(mask);
33077 var defs = elem.globalData.defs;
33078 defs.appendChild(masker);
33079 var symbol = createNS('symbol');
33080 symbol.setAttribute('id', symbolId);
33081 this.replaceInParent(mask, symbolId);
33082 symbol.appendChild(mask.layerElement);
33083 defs.appendChild(symbol);
33084 var useElem = createNS('use');
33085 useElem.setAttribute('href', '#' + symbolId);
33086 masker.appendChild(useElem);
33087 mask.data.hd = false;
33088 mask.show();
33089 }
33090 elem.setMatte(mask.layerId);
33091};
33092
33093SVGMatte3Effect.prototype.initialize = function() {
33094 var ind = this.filterManager.effectElements[0].p.v;
33095 var elements = this.elem.comp.elements;
33096 var i = 0, len = elements.length;
33097 while (i < len) {
33098 if (elements[i] && elements[i].data.ind === ind) {
33099 this.setElementAsMask(this.elem, elements[i]);
33100 }
33101 i += 1;
33102 }
33103 this.initialized = true;
33104};
33105
33106SVGMatte3Effect.prototype.renderFrame = function() {
33107 if(!this.initialized) {
33108 this.initialize();
33109 }
33110};
33111function SVGEffects(elem){
33112 var i, len = elem.data.ef ? elem.data.ef.length : 0;
33113 var filId = createElementID();
33114 var fil = filtersFactory.createFilter(filId);
33115 var count = 0;
33116 this.filters = [];
33117 var filterManager;
33118 for(i=0;i<len;i+=1){
33119 filterManager = null;
33120 if(elem.data.ef[i].ty === 20){
33121 count += 1;
33122 filterManager = new SVGTintFilter(fil, elem.effectsManager.effectElements[i]);
33123 }else if(elem.data.ef[i].ty === 21){
33124 count += 1;
33125 filterManager = new SVGFillFilter(fil, elem.effectsManager.effectElements[i]);
33126 }else if(elem.data.ef[i].ty === 22){
33127 filterManager = new SVGStrokeEffect(elem, elem.effectsManager.effectElements[i]);
33128 }else if(elem.data.ef[i].ty === 23){
33129 count += 1;
33130 filterManager = new SVGTritoneFilter(fil, elem.effectsManager.effectElements[i]);
33131 }else if(elem.data.ef[i].ty === 24){
33132 count += 1;
33133 filterManager = new SVGProLevelsFilter(fil, elem.effectsManager.effectElements[i]);
33134 }else if(elem.data.ef[i].ty === 25){
33135 count += 1;
33136 filterManager = new SVGDropShadowEffect(fil, elem.effectsManager.effectElements[i]);
33137 }else if(elem.data.ef[i].ty === 28){
33138 //count += 1;
33139 filterManager = new SVGMatte3Effect(fil, elem.effectsManager.effectElements[i], elem);
33140 }
33141 if(filterManager) {
33142 this.filters.push(filterManager);
33143 }
33144 }
33145 if(count){
33146 elem.globalData.defs.appendChild(fil);
33147 elem.layerElement.setAttribute('filter','url(' + locationHref + '#'+filId+')');
33148 }
33149 if (this.filters.length) {
33150 elem.addRenderableComponent(this);
33151 }
33152}
33153
33154SVGEffects.prototype.renderFrame = function(_isFirstFrame){
33155 var i, len = this.filters.length;
33156 for(i=0;i<len;i+=1){
33157 this.filters[i].renderFrame(_isFirstFrame);
33158 }
33159};
33160function CVContextData() {
33161 this.saved = [];
33162 this.cArrPos = 0;
33163 this.cTr = new Matrix();
33164 this.cO = 1;
33165 var i, len = 15;
33166 this.savedOp = createTypedArray('float32', len);
33167 for(i=0;i<len;i+=1){
33168 this.saved[i] = createTypedArray('float32', 16);
33169 }
33170 this._length = len;
33171}
33172
33173CVContextData.prototype.duplicate = function() {
33174 var newLength = this._length * 2;
33175 var currentSavedOp = this.savedOp;
33176 this.savedOp = createTypedArray('float32', newLength);
33177 this.savedOp.set(currentSavedOp);
33178 var i = 0;
33179 for(i = this._length; i < newLength; i += 1) {
33180 this.saved[i] = createTypedArray('float32', 16);
33181 }
33182 this._length = newLength;
33183};
33184
33185CVContextData.prototype.reset = function() {
33186 this.cArrPos = 0;
33187 this.cTr.reset();
33188 this.cO = 1;
33189};
33190function CVBaseElement(){
33191}
33192
33193CVBaseElement.prototype = {
33194 createElements: function(){},
33195 initRendererElement: function(){},
33196 createContainerElements: function(){
33197 this.canvasContext = this.globalData.canvasContext;
33198 this.renderableEffectsManager = new CVEffects(this);
33199 },
33200 createContent: function(){},
33201 setBlendMode: function(){
33202 var globalData = this.globalData;
33203 if(globalData.blendMode !== this.data.bm) {
33204 globalData.blendMode = this.data.bm;
33205 var blendModeValue = getBlendMode(this.data.bm);
33206 globalData.canvasContext.globalCompositeOperation = blendModeValue;
33207 }
33208 },
33209 createRenderableComponents: function(){
33210 this.maskManager = new CVMaskElement(this.data, this);
33211 },
33212 hideElement: function(){
33213 if (!this.hidden && (!this.isInRange || this.isTransparent)) {
33214 this.hidden = true;
33215 }
33216 },
33217 showElement: function(){
33218 if (this.isInRange && !this.isTransparent){
33219 this.hidden = false;
33220 this._isFirstFrame = true;
33221 this.maskManager._isFirstFrame = true;
33222 }
33223 },
33224 renderFrame: function() {
33225 if (this.hidden || this.data.hd) {
33226 return;
33227 }
33228 this.renderTransform();
33229 this.renderRenderable();
33230 this.setBlendMode();
33231 this.globalData.renderer.save();
33232 this.globalData.renderer.ctxTransform(this.finalTransform.mat.props);
33233 this.globalData.renderer.ctxOpacity(this.finalTransform.mProp.o.v);
33234 this.renderInnerContent();
33235 this.globalData.renderer.restore();
33236 if(this.maskManager.hasMasks) {
33237 this.globalData.renderer.restore(true);
33238 }
33239 if (this._isFirstFrame) {
33240 this._isFirstFrame = false;
33241 }
33242 },
33243 destroy: function(){
33244 this.canvasContext = null;
33245 this.data = null;
33246 this.globalData = null;
33247 this.maskManager.destroy();
33248 },
33249 mHelper: new Matrix()
33250};
33251CVBaseElement.prototype.hide = CVBaseElement.prototype.hideElement;
33252CVBaseElement.prototype.show = CVBaseElement.prototype.showElement;
33253
33254function CVImageElement(data, globalData, comp){
33255 this.failed = false;
33256 this.assetData = globalData.getAssetData(data.refId);
33257 this.img = globalData.imageLoader.getImage(this.assetData);
33258 this.initElement(data,globalData,comp);
33259}
33260extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement], CVImageElement);
33261
33262CVImageElement.prototype.initElement = SVGShapeElement.prototype.initElement;
33263CVImageElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame;
33264
33265CVImageElement.prototype.createContent = function(){
33266
33267 if (this.img.width && (this.assetData.w !== this.img.width || this.assetData.h !== this.img.height)) {
33268 var canvas = createTag('canvas');
33269 canvas.width = this.assetData.w;
33270 canvas.height = this.assetData.h;
33271 var ctx = canvas.getContext('2d');
33272
33273 var imgW = this.img.width;
33274 var imgH = this.img.height;
33275 var imgRel = imgW / imgH;
33276 var canvasRel = this.assetData.w/this.assetData.h;
33277 var widthCrop, heightCrop;
33278 var par = this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio;
33279 if((imgRel > canvasRel && par === 'xMidYMid slice') || (imgRel < canvasRel && par !== 'xMidYMid slice')) {
33280 heightCrop = imgH;
33281 widthCrop = heightCrop*canvasRel;
33282 } else {
33283 widthCrop = imgW;
33284 heightCrop = widthCrop/canvasRel;
33285 }
33286 ctx.drawImage(this.img,(imgW-widthCrop)/2,(imgH-heightCrop)/2,widthCrop,heightCrop,0,0,this.assetData.w,this.assetData.h);
33287 this.img = canvas;
33288 }
33289
33290};
33291
33292CVImageElement.prototype.renderInnerContent = function(parentMatrix){
33293 if (this.failed) {
33294 return;
33295 }
33296 this.canvasContext.drawImage(this.img, 0, 0);
33297};
33298
33299CVImageElement.prototype.destroy = function(){
33300 this.img = null;
33301};
33302function CVCompElement(data, globalData, comp) {
33303 this.completeLayers = false;
33304 this.layers = data.layers;
33305 this.pendingElements = [];
33306 this.elements = createSizedArray(this.layers.length);
33307 this.initElement(data, globalData, comp);
33308 this.tm = data.tm ? PropertyFactory.getProp(this,data.tm,0,globalData.frameRate, this) : {_placeholder:true};
33309}
33310
33311extendPrototype([CanvasRenderer, ICompElement, CVBaseElement], CVCompElement);
33312
33313CVCompElement.prototype.renderInnerContent = function() {
33314 var i,len = this.layers.length;
33315 for( i = len - 1; i >= 0; i -= 1 ){
33316 if(this.completeLayers || this.elements[i]){
33317 this.elements[i].renderFrame();
33318 }
33319 }
33320};
33321
33322CVCompElement.prototype.destroy = function(){
33323 var i,len = this.layers.length;
33324 for( i = len - 1; i >= 0; i -= 1 ){
33325 if(this.elements[i]) {
33326 this.elements[i].destroy();
33327 }
33328 }
33329 this.layers = null;
33330 this.elements = null;
33331};
33332
33333function CVMaskElement(data,element){
33334 this.data = data;
33335 this.element = element;
33336 this.masksProperties = this.data.masksProperties || [];
33337 this.viewData = createSizedArray(this.masksProperties.length);
33338 var i, len = this.masksProperties.length, hasMasks = false;
33339 for (i = 0; i < len; i++) {
33340 if(this.masksProperties[i].mode !== 'n'){
33341 hasMasks = true;
33342 }
33343 this.viewData[i] = ShapePropertyFactory.getShapeProp(this.element,this.masksProperties[i],3);
33344 }
33345 this.hasMasks = hasMasks;
33346 if(hasMasks) {
33347 this.element.addRenderableComponent(this);
33348 }
33349}
33350
33351CVMaskElement.prototype.renderFrame = function () {
33352 if(!this.hasMasks){
33353 return;
33354 }
33355 var transform = this.element.finalTransform.mat;
33356 var ctx = this.element.canvasContext;
33357 var i, len = this.masksProperties.length;
33358 var pt,pts,data;
33359 ctx.beginPath();
33360 for (i = 0; i < len; i++) {
33361 if(this.masksProperties[i].mode !== 'n'){
33362 if (this.masksProperties[i].inv) {
33363 ctx.moveTo(0, 0);
33364 ctx.lineTo(this.element.globalData.compSize.w, 0);
33365 ctx.lineTo(this.element.globalData.compSize.w, this.element.globalData.compSize.h);
33366 ctx.lineTo(0, this.element.globalData.compSize.h);
33367 ctx.lineTo(0, 0);
33368 }
33369 data = this.viewData[i].v;
33370 pt = transform.applyToPointArray(data.v[0][0],data.v[0][1],0);
33371 ctx.moveTo(pt[0], pt[1]);
33372 var j, jLen = data._length;
33373 for (j = 1; j < jLen; j++) {
33374 pts = transform.applyToTriplePoints(data.o[j - 1], data.i[j], data.v[j]);
33375 ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]);
33376 }
33377 pts = transform.applyToTriplePoints(data.o[j - 1], data.i[0], data.v[0]);
33378 ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]);
33379 }
33380 }
33381 this.element.globalData.renderer.save(true);
33382 ctx.clip();
33383};
33384
33385CVMaskElement.prototype.getMaskProperty = MaskElement.prototype.getMaskProperty;
33386
33387CVMaskElement.prototype.destroy = function(){
33388 this.element = null;
33389};
33390function CVShapeElement(data, globalData, comp) {
33391 this.shapes = [];
33392 this.shapesData = data.shapes;
33393 this.stylesList = [];
33394 this.itemsData = [];
33395 this.prevViewData = [];
33396 this.shapeModifiers = [];
33397 this.processedElements = [];
33398 this.transformsManager = new ShapeTransformManager();
33399 this.initElement(data, globalData, comp);
33400}
33401
33402extendPrototype([BaseElement,TransformElement,CVBaseElement,IShapeElement,HierarchyElement,FrameElement,RenderableElement], CVShapeElement);
33403
33404CVShapeElement.prototype.initElement = RenderableDOMElement.prototype.initElement;
33405
33406CVShapeElement.prototype.transformHelper = {opacity:1,_opMdf:false};
33407
33408CVShapeElement.prototype.dashResetter = [];
33409
33410CVShapeElement.prototype.createContent = function(){
33411 this.searchShapes(this.shapesData,this.itemsData,this.prevViewData, true, []);
33412};
33413
33414CVShapeElement.prototype.createStyleElement = function(data, transforms) {
33415 var styleElem = {
33416 data: data,
33417 type: data.ty,
33418 preTransforms: this.transformsManager.addTransformSequence(transforms),
33419 transforms: [],
33420 elements: [],
33421 closed: data.hd === true
33422 };
33423 var elementData = {};
33424 if(data.ty == 'fl' || data.ty == 'st'){
33425 elementData.c = PropertyFactory.getProp(this,data.c,1,255,this);
33426 if(!elementData.c.k){
33427 styleElem.co = 'rgb('+bm_floor(elementData.c.v[0])+','+bm_floor(elementData.c.v[1])+','+bm_floor(elementData.c.v[2])+')';
33428 }
33429 } else if (data.ty === 'gf' || data.ty === 'gs') {
33430 elementData.s = PropertyFactory.getProp(this,data.s,1,null,this);
33431 elementData.e = PropertyFactory.getProp(this,data.e,1,null,this);
33432 elementData.h = PropertyFactory.getProp(this,data.h||{k:0},0,0.01,this);
33433 elementData.a = PropertyFactory.getProp(this,data.a||{k:0},0,degToRads,this);
33434 elementData.g = new GradientProperty(this,data.g,this);
33435 }
33436 elementData.o = PropertyFactory.getProp(this,data.o,0,0.01,this);
33437 if(data.ty == 'st' || data.ty == 'gs') {
33438 styleElem.lc = this.lcEnum[data.lc] || 'round';
33439 styleElem.lj = this.ljEnum[data.lj] || 'round';
33440 if(data.lj == 1) {
33441 styleElem.ml = data.ml;
33442 }
33443 elementData.w = PropertyFactory.getProp(this,data.w,0,null,this);
33444 if(!elementData.w.k){
33445 styleElem.wi = elementData.w.v;
33446 }
33447 if(data.d){
33448 var d = new DashProperty(this,data.d,'canvas', this);
33449 elementData.d = d;
33450 if(!elementData.d.k){
33451 styleElem.da = elementData.d.dashArray;
33452 styleElem.do = elementData.d.dashoffset[0];
33453 }
33454 }
33455 } else {
33456 styleElem.r = data.r === 2 ? 'evenodd' : 'nonzero';
33457 }
33458 this.stylesList.push(styleElem);
33459 elementData.style = styleElem;
33460 return elementData;
33461};
33462
33463CVShapeElement.prototype.createGroupElement = function(data) {
33464 var elementData = {
33465 it: [],
33466 prevViewData: []
33467 };
33468 return elementData;
33469};
33470
33471CVShapeElement.prototype.createTransformElement = function(data) {
33472 var elementData = {
33473 transform : {
33474 opacity: 1,
33475 _opMdf:false,
33476 key: this.transformsManager.getNewKey(),
33477 op: PropertyFactory.getProp(this,data.o,0,0.01,this),
33478 mProps: TransformPropertyFactory.getTransformProperty(this,data,this)
33479 }
33480 };
33481 return elementData;
33482};
33483
33484CVShapeElement.prototype.createShapeElement = function(data) {
33485 var elementData = new CVShapeData(this, data, this.stylesList, this.transformsManager);
33486
33487 this.shapes.push(elementData);
33488 this.addShapeToModifiers(elementData);
33489 return elementData;
33490};
33491
33492CVShapeElement.prototype.reloadShapes = function() {
33493 this._isFirstFrame = true;
33494 var i, len = this.itemsData.length;
33495 for (i = 0; i < len; i += 1) {
33496 this.prevViewData[i] = this.itemsData[i];
33497 }
33498 this.searchShapes(this.shapesData,this.itemsData,this.prevViewData, true, []);
33499 len = this.dynamicProperties.length;
33500 for (i = 0; i < len; i += 1) {
33501 this.dynamicProperties[i].getValue();
33502 }
33503 this.renderModifiers();
33504 this.transformsManager.processSequences(this._isFirstFrame);
33505};
33506
33507CVShapeElement.prototype.addTransformToStyleList = function(transform) {
33508 var i, len = this.stylesList.length;
33509 for (i = 0; i < len; i += 1) {
33510 if(!this.stylesList[i].closed) {
33511 this.stylesList[i].transforms.push(transform);
33512 }
33513 }
33514};
33515
33516CVShapeElement.prototype.removeTransformFromStyleList = function() {
33517 var i, len = this.stylesList.length;
33518 for (i = 0; i < len; i += 1) {
33519 if(!this.stylesList[i].closed) {
33520 this.stylesList[i].transforms.pop();
33521 }
33522 }
33523};
33524
33525CVShapeElement.prototype.closeStyles = function(styles) {
33526 var i, len = styles.length;
33527 for (i = 0; i < len; i += 1) {
33528 styles[i].closed = true;
33529 }
33530};
33531
33532CVShapeElement.prototype.searchShapes = function(arr,itemsData, prevViewData, shouldRender, transforms){
33533 var i, len = arr.length - 1;
33534 var j, jLen;
33535 var ownStyles = [], ownModifiers = [], processedPos, modifier, currentTransform;
33536 var ownTransforms = [].concat(transforms);
33537 for(i=len;i>=0;i-=1){
33538 processedPos = this.searchProcessedElement(arr[i]);
33539 if(!processedPos){
33540 arr[i]._shouldRender = shouldRender;
33541 } else {
33542 itemsData[i] = prevViewData[processedPos - 1];
33543 }
33544 if(arr[i].ty == 'fl' || arr[i].ty == 'st'|| arr[i].ty == 'gf'|| arr[i].ty == 'gs'){
33545 if(!processedPos){
33546 itemsData[i] = this.createStyleElement(arr[i], ownTransforms);
33547 } else {
33548 itemsData[i].style.closed = false;
33549 }
33550
33551 ownStyles.push(itemsData[i].style);
33552 }else if(arr[i].ty == 'gr'){
33553 if(!processedPos){
33554 itemsData[i] = this.createGroupElement(arr[i]);
33555 } else {
33556 jLen = itemsData[i].it.length;
33557 for(j=0;j<jLen;j+=1){
33558 itemsData[i].prevViewData[j] = itemsData[i].it[j];
33559 }
33560 }
33561 this.searchShapes(arr[i].it,itemsData[i].it,itemsData[i].prevViewData, shouldRender, ownTransforms);
33562 }else if(arr[i].ty == 'tr'){
33563 if(!processedPos){
33564 currentTransform = this.createTransformElement(arr[i]);
33565 itemsData[i] = currentTransform;
33566 }
33567 ownTransforms.push(itemsData[i]);
33568 this.addTransformToStyleList(itemsData[i]);
33569 }else if(arr[i].ty == 'sh' || arr[i].ty == 'rc' || arr[i].ty == 'el' || arr[i].ty == 'sr'){
33570 if(!processedPos){
33571 itemsData[i] = this.createShapeElement(arr[i]);
33572 }
33573
33574 }else if(arr[i].ty == 'tm' || arr[i].ty == 'rd'){
33575 if(!processedPos){
33576 modifier = ShapeModifiers.getModifier(arr[i].ty);
33577 modifier.init(this,arr[i]);
33578 itemsData[i] = modifier;
33579 this.shapeModifiers.push(modifier);
33580 } else {
33581 modifier = itemsData[i];
33582 modifier.closed = false;
33583 }
33584 ownModifiers.push(modifier);
33585 } else if(arr[i].ty == 'rp'){
33586 if(!processedPos){
33587 modifier = ShapeModifiers.getModifier(arr[i].ty);
33588 itemsData[i] = modifier;
33589 modifier.init(this,arr,i,itemsData);
33590 this.shapeModifiers.push(modifier);
33591 shouldRender = false;
33592 }else{
33593 modifier = itemsData[i];
33594 modifier.closed = true;
33595 }
33596 ownModifiers.push(modifier);
33597 }
33598 this.addProcessedElement(arr[i], i + 1);
33599 }
33600 this.removeTransformFromStyleList();
33601 this.closeStyles(ownStyles);
33602 len = ownModifiers.length;
33603 for(i=0;i<len;i+=1){
33604 ownModifiers[i].closed = true;
33605 }
33606};
33607
33608CVShapeElement.prototype.renderInnerContent = function() {
33609 this.transformHelper.opacity = 1;
33610 this.transformHelper._opMdf = false;
33611 this.renderModifiers();
33612 this.transformsManager.processSequences(this._isFirstFrame);
33613 this.renderShape(this.transformHelper,this.shapesData,this.itemsData,true);
33614};
33615
33616CVShapeElement.prototype.renderShapeTransform = function(parentTransform, groupTransform) {
33617 if(parentTransform._opMdf || groupTransform.op._mdf || this._isFirstFrame) {
33618 groupTransform.opacity = parentTransform.opacity;
33619 groupTransform.opacity *= groupTransform.op.v;
33620 groupTransform._opMdf = true;
33621 }
33622};
33623
33624CVShapeElement.prototype.drawLayer = function() {
33625 var i, len = this.stylesList.length;
33626 var j, jLen, k, kLen,elems,nodes, renderer = this.globalData.renderer, ctx = this.globalData.canvasContext, type, currentStyle;
33627 for(i=0;i<len;i+=1){
33628 currentStyle = this.stylesList[i];
33629 type = currentStyle.type;
33630
33631 //Skipping style when
33632 //Stroke width equals 0
33633 //style should not be rendered (extra unused repeaters)
33634 //current opacity equals 0
33635 //global opacity equals 0
33636 if(((type === 'st' || type === 'gs') && currentStyle.wi === 0) || !currentStyle.data._shouldRender || currentStyle.coOp === 0 || this.globalData.currentGlobalAlpha === 0){
33637 continue;
33638 }
33639 renderer.save();
33640 elems = currentStyle.elements;
33641 if(type === 'st' || type === 'gs'){
33642 ctx.strokeStyle = type === 'st' ? currentStyle.co : currentStyle.grd;
33643 ctx.lineWidth = currentStyle.wi;
33644 ctx.lineCap = currentStyle.lc;
33645 ctx.lineJoin = currentStyle.lj;
33646 ctx.miterLimit = currentStyle.ml || 0;
33647 } else {
33648 ctx.fillStyle = type === 'fl' ? currentStyle.co : currentStyle.grd;
33649 }
33650 renderer.ctxOpacity(currentStyle.coOp);
33651 if(type !== 'st' && type !== 'gs'){
33652 ctx.beginPath();
33653 }
33654 renderer.ctxTransform(currentStyle.preTransforms.finalTransform.props);
33655 jLen = elems.length;
33656 for(j=0;j<jLen;j+=1){
33657 if(type === 'st' || type === 'gs'){
33658 ctx.beginPath();
33659 if(currentStyle.da){
33660 ctx.setLineDash(currentStyle.da);
33661 ctx.lineDashOffset = currentStyle.do;
33662 }
33663 }
33664 nodes = elems[j].trNodes;
33665 kLen = nodes.length;
33666
33667 for(k=0;k<kLen;k+=1){
33668 if(nodes[k].t == 'm'){
33669 ctx.moveTo(nodes[k].p[0],nodes[k].p[1]);
33670 }else if(nodes[k].t == 'c'){
33671 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]);
33672 }else{
33673 ctx.closePath();
33674 }
33675 }
33676 if(type === 'st' || type === 'gs'){
33677 ctx.stroke();
33678 if(currentStyle.da){
33679 ctx.setLineDash(this.dashResetter);
33680 }
33681 }
33682 }
33683 if(type !== 'st' && type !== 'gs'){
33684 ctx.fill(currentStyle.r);
33685 }
33686 renderer.restore();
33687 }
33688};
33689
33690CVShapeElement.prototype.renderShape = function(parentTransform,items,data,isMain){
33691 var i, len = items.length - 1;
33692 var groupTransform;
33693 groupTransform = parentTransform;
33694 for(i=len;i>=0;i-=1){
33695 if(items[i].ty == 'tr'){
33696 groupTransform = data[i].transform;
33697 this.renderShapeTransform(parentTransform, groupTransform);
33698 }else if(items[i].ty == 'sh' || items[i].ty == 'el' || items[i].ty == 'rc' || items[i].ty == 'sr'){
33699 this.renderPath(items[i],data[i]);
33700 }else if(items[i].ty == 'fl'){
33701 this.renderFill(items[i],data[i],groupTransform);
33702 }else if(items[i].ty == 'st'){
33703 this.renderStroke(items[i],data[i],groupTransform);
33704 }else if(items[i].ty == 'gf' || items[i].ty == 'gs'){
33705 this.renderGradientFill(items[i],data[i],groupTransform);
33706 }else if(items[i].ty == 'gr'){
33707 this.renderShape(groupTransform,items[i].it,data[i].it);
33708 }else if(items[i].ty == 'tm');
33709 }
33710 if(isMain){
33711 this.drawLayer();
33712 }
33713
33714};
33715
33716CVShapeElement.prototype.renderStyledShape = function(styledShape, shape){
33717 if(this._isFirstFrame || shape._mdf || styledShape.transforms._mdf) {
33718 var shapeNodes = styledShape.trNodes;
33719 var paths = shape.paths;
33720 var i, len, j, jLen = paths._length;
33721 shapeNodes.length = 0;
33722 var groupTransformMat = styledShape.transforms.finalTransform;
33723 for (j = 0; j < jLen; j += 1) {
33724 var pathNodes = paths.shapes[j];
33725 if(pathNodes && pathNodes.v){
33726 len = pathNodes._length;
33727 for (i = 1; i < len; i += 1) {
33728 if (i === 1) {
33729 shapeNodes.push({
33730 t: 'm',
33731 p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0)
33732 });
33733 }
33734 shapeNodes.push({
33735 t: 'c',
33736 pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[i], pathNodes.v[i])
33737 });
33738 }
33739 if (len === 1) {
33740 shapeNodes.push({
33741 t: 'm',
33742 p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0)
33743 });
33744 }
33745 if (pathNodes.c && len) {
33746 shapeNodes.push({
33747 t: 'c',
33748 pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[0], pathNodes.v[0])
33749 });
33750 shapeNodes.push({
33751 t: 'z'
33752 });
33753 }
33754 }
33755 }
33756 styledShape.trNodes = shapeNodes;
33757 }
33758};
33759
33760CVShapeElement.prototype.renderPath = function(pathData,itemData){
33761 if(pathData.hd !== true && pathData._shouldRender) {
33762 var i, len = itemData.styledShapes.length;
33763 for (i = 0; i < len; i += 1) {
33764 this.renderStyledShape(itemData.styledShapes[i], itemData.sh);
33765 }
33766 }
33767};
33768
33769CVShapeElement.prototype.renderFill = function(styleData,itemData, groupTransform){
33770 var styleElem = itemData.style;
33771
33772 if (itemData.c._mdf || this._isFirstFrame) {
33773 styleElem.co = 'rgb('
33774 + bm_floor(itemData.c.v[0]) + ','
33775 + bm_floor(itemData.c.v[1]) + ','
33776 + bm_floor(itemData.c.v[2]) + ')';
33777 }
33778 if (itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame) {
33779 styleElem.coOp = itemData.o.v * groupTransform.opacity;
33780 }
33781};
33782
33783CVShapeElement.prototype.renderGradientFill = function(styleData,itemData, groupTransform){
33784 var styleElem = itemData.style;
33785 if(!styleElem.grd || itemData.g._mdf || itemData.s._mdf || itemData.e._mdf || (styleData.t !== 1 && (itemData.h._mdf || itemData.a._mdf))) {
33786 var ctx = this.globalData.canvasContext;
33787 var grd;
33788 var pt1 = itemData.s.v, pt2 = itemData.e.v;
33789 if (styleData.t === 1) {
33790 grd = ctx.createLinearGradient(pt1[0], pt1[1], pt2[0], pt2[1]);
33791 } else {
33792 var rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));
33793 var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0]);
33794
33795 var percent = itemData.h.v >= 1 ? 0.99 : itemData.h.v <= -1 ? -0.99: itemData.h.v;
33796 var dist = rad * percent;
33797 var x = Math.cos(ang + itemData.a.v) * dist + pt1[0];
33798 var y = Math.sin(ang + itemData.a.v) * dist + pt1[1];
33799 var grd = ctx.createRadialGradient(x, y, 0, pt1[0], pt1[1], rad);
33800 }
33801
33802 var i, len = styleData.g.p;
33803 var cValues = itemData.g.c;
33804 var opacity = 1;
33805
33806 for (i = 0; i < len; i += 1){
33807 if(itemData.g._hasOpacity && itemData.g._collapsable) {
33808 opacity = itemData.g.o[i*2 + 1];
33809 }
33810 grd.addColorStop(cValues[i * 4] / 100,'rgba('+ cValues[i * 4 + 1] + ',' + cValues[i * 4 + 2] + ','+cValues[i * 4 + 3] + ',' + opacity + ')');
33811 }
33812 styleElem.grd = grd;
33813 }
33814 styleElem.coOp = itemData.o.v*groupTransform.opacity;
33815
33816};
33817
33818CVShapeElement.prototype.renderStroke = function(styleData,itemData, groupTransform){
33819 var styleElem = itemData.style;
33820 var d = itemData.d;
33821 if(d && (d._mdf || this._isFirstFrame)){
33822 styleElem.da = d.dashArray;
33823 styleElem.do = d.dashoffset[0];
33824 }
33825 if(itemData.c._mdf || this._isFirstFrame){
33826 styleElem.co = 'rgb('+bm_floor(itemData.c.v[0])+','+bm_floor(itemData.c.v[1])+','+bm_floor(itemData.c.v[2])+')';
33827 }
33828 if(itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame){
33829 styleElem.coOp = itemData.o.v*groupTransform.opacity;
33830 }
33831 if(itemData.w._mdf || this._isFirstFrame){
33832 styleElem.wi = itemData.w.v;
33833 }
33834};
33835
33836
33837CVShapeElement.prototype.destroy = function(){
33838 this.shapesData = null;
33839 this.globalData = null;
33840 this.canvasContext = null;
33841 this.stylesList.length = 0;
33842 this.itemsData.length = 0;
33843};
33844
33845
33846function CVSolidElement(data, globalData, comp) {
33847 this.initElement(data,globalData,comp);
33848}
33849extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement], CVSolidElement);
33850
33851CVSolidElement.prototype.initElement = SVGShapeElement.prototype.initElement;
33852CVSolidElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame;
33853
33854CVSolidElement.prototype.renderInnerContent = function() {
33855 var ctx = this.canvasContext;
33856 ctx.fillStyle = this.data.sc;
33857 ctx.fillRect(0, 0, this.data.sw, this.data.sh);
33858 //
33859};
33860function CVTextElement(data, globalData, comp){
33861 this.textSpans = [];
33862 this.yOffset = 0;
33863 this.fillColorAnim = false;
33864 this.strokeColorAnim = false;
33865 this.strokeWidthAnim = false;
33866 this.stroke = false;
33867 this.fill = false;
33868 this.justifyOffset = 0;
33869 this.currentRender = null;
33870 this.renderType = 'canvas';
33871 this.values = {
33872 fill: 'rgba(0,0,0,0)',
33873 stroke: 'rgba(0,0,0,0)',
33874 sWidth: 0,
33875 fValue: ''
33876 };
33877 this.initElement(data,globalData,comp);
33878}
33879extendPrototype([BaseElement,TransformElement,CVBaseElement,HierarchyElement,FrameElement,RenderableElement,ITextElement], CVTextElement);
33880
33881CVTextElement.prototype.tHelper = createTag('canvas').getContext('2d');
33882
33883CVTextElement.prototype.buildNewText = function(){
33884 var documentData = this.textProperty.currentData;
33885 this.renderedLetters = createSizedArray(documentData.l ? documentData.l.length : 0);
33886
33887 var hasFill = false;
33888 if(documentData.fc) {
33889 hasFill = true;
33890 this.values.fill = this.buildColor(documentData.fc);
33891 }else{
33892 this.values.fill = 'rgba(0,0,0,0)';
33893 }
33894 this.fill = hasFill;
33895 var hasStroke = false;
33896 if(documentData.sc){
33897 hasStroke = true;
33898 this.values.stroke = this.buildColor(documentData.sc);
33899 this.values.sWidth = documentData.sw;
33900 }
33901 var fontData = this.globalData.fontManager.getFontByName(documentData.f);
33902 var i, len;
33903 var letters = documentData.l;
33904 var matrixHelper = this.mHelper;
33905 this.stroke = hasStroke;
33906 this.values.fValue = documentData.finalSize + 'px '+ this.globalData.fontManager.getFontByName(documentData.f).fFamily;
33907 len = documentData.finalText.length;
33908 //this.tHelper.font = this.values.fValue;
33909 var charData, shapeData, k, kLen, shapes, j, jLen, pathNodes, commands, pathArr, singleShape = this.data.singleShape;
33910 var trackingOffset = documentData.tr/1000*documentData.finalSize;
33911 var xPos = 0, yPos = 0, firstLine = true;
33912 var cnt = 0;
33913 for (i = 0; i < len; i += 1) {
33914 charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);
33915 shapeData = charData && charData.data || {};
33916 matrixHelper.reset();
33917 if(singleShape && letters[i].n) {
33918 xPos = -trackingOffset;
33919 yPos += documentData.yOffset;
33920 yPos += firstLine ? 1 : 0;
33921 firstLine = false;
33922 }
33923
33924 shapes = shapeData.shapes ? shapeData.shapes[0].it : [];
33925 jLen = shapes.length;
33926 matrixHelper.scale(documentData.finalSize/100,documentData.finalSize/100);
33927 if(singleShape){
33928 this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos);
33929 }
33930 commands = createSizedArray(jLen);
33931 for(j=0;j<jLen;j+=1){
33932 kLen = shapes[j].ks.k.i.length;
33933 pathNodes = shapes[j].ks.k;
33934 pathArr = [];
33935 for(k=1;k<kLen;k+=1){
33936 if(k==1){
33937 pathArr.push(matrixHelper.applyToX(pathNodes.v[0][0],pathNodes.v[0][1],0),matrixHelper.applyToY(pathNodes.v[0][0],pathNodes.v[0][1],0));
33938 }
33939 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));
33940 }
33941 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));
33942 commands[j] = pathArr;
33943 }
33944 if(singleShape){
33945 xPos += letters[i].l;
33946 xPos += trackingOffset;
33947 }
33948 if(this.textSpans[cnt]){
33949 this.textSpans[cnt].elem = commands;
33950 } else {
33951 this.textSpans[cnt] = {elem: commands};
33952 }
33953 cnt +=1;
33954 }
33955};
33956
33957CVTextElement.prototype.renderInnerContent = function(){
33958 var ctx = this.canvasContext;
33959 var finalMat = this.finalTransform.mat.props;
33960 ctx.font = this.values.fValue;
33961 ctx.lineCap = 'butt';
33962 ctx.lineJoin = 'miter';
33963 ctx.miterLimit = 4;
33964
33965 if(!this.data.singleShape){
33966 this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);
33967 }
33968
33969 var i,len, j, jLen, k, kLen;
33970 var renderedLetters = this.textAnimator.renderedLetters;
33971
33972 var letters = this.textProperty.currentData.l;
33973
33974 len = letters.length;
33975 var renderedLetter;
33976 var lastFill = null, lastStroke = null, lastStrokeW = null, commands, pathArr;
33977 for(i=0;i<len;i+=1){
33978 if(letters[i].n){
33979 continue;
33980 }
33981 renderedLetter = renderedLetters[i];
33982 if(renderedLetter){
33983 this.globalData.renderer.save();
33984 this.globalData.renderer.ctxTransform(renderedLetter.p);
33985 this.globalData.renderer.ctxOpacity(renderedLetter.o);
33986 }
33987 if(this.fill){
33988 if(renderedLetter && renderedLetter.fc){
33989 if(lastFill !== renderedLetter.fc){
33990 lastFill = renderedLetter.fc;
33991 ctx.fillStyle = renderedLetter.fc;
33992 }
33993 }else if(lastFill !== this.values.fill){
33994 lastFill = this.values.fill;
33995 ctx.fillStyle = this.values.fill;
33996 }
33997 commands = this.textSpans[i].elem;
33998 jLen = commands.length;
33999 this.globalData.canvasContext.beginPath();
34000 for(j=0;j<jLen;j+=1) {
34001 pathArr = commands[j];
34002 kLen = pathArr.length;
34003 this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1]);
34004 for (k = 2; k < kLen; k += 6) {
34005 this.globalData.canvasContext.bezierCurveTo(pathArr[k], pathArr[k + 1], pathArr[k + 2], pathArr[k + 3], pathArr[k + 4], pathArr[k + 5]);
34006 }
34007 }
34008 this.globalData.canvasContext.closePath();
34009 this.globalData.canvasContext.fill();
34010 ///ctx.fillText(this.textSpans[i].val,0,0);
34011 }
34012 if(this.stroke){
34013 if(renderedLetter && renderedLetter.sw){
34014 if(lastStrokeW !== renderedLetter.sw){
34015 lastStrokeW = renderedLetter.sw;
34016 ctx.lineWidth = renderedLetter.sw;
34017 }
34018 }else if(lastStrokeW !== this.values.sWidth){
34019 lastStrokeW = this.values.sWidth;
34020 ctx.lineWidth = this.values.sWidth;
34021 }
34022 if(renderedLetter && renderedLetter.sc){
34023 if(lastStroke !== renderedLetter.sc){
34024 lastStroke = renderedLetter.sc;
34025 ctx.strokeStyle = renderedLetter.sc;
34026 }
34027 }else if(lastStroke !== this.values.stroke){
34028 lastStroke = this.values.stroke;
34029 ctx.strokeStyle = this.values.stroke;
34030 }
34031 commands = this.textSpans[i].elem;
34032 jLen = commands.length;
34033 this.globalData.canvasContext.beginPath();
34034 for(j=0;j<jLen;j+=1) {
34035 pathArr = commands[j];
34036 kLen = pathArr.length;
34037 this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1]);
34038 for (k = 2; k < kLen; k += 6) {
34039 this.globalData.canvasContext.bezierCurveTo(pathArr[k], pathArr[k + 1], pathArr[k + 2], pathArr[k + 3], pathArr[k + 4], pathArr[k + 5]);
34040 }
34041 }
34042 this.globalData.canvasContext.closePath();
34043 this.globalData.canvasContext.stroke();
34044 ///ctx.strokeText(letters[i].val,0,0);
34045 }
34046 if(renderedLetter) {
34047 this.globalData.renderer.restore();
34048 }
34049 }
34050};
34051function CVEffects() {
34052
34053}
34054CVEffects.prototype.renderFrame = function(){};
34055function HBaseElement(data,globalData,comp){}
34056HBaseElement.prototype = {
34057 checkBlendMode: function(){},
34058 initRendererElement: function(){
34059 this.baseElement = createTag(this.data.tg || 'div');
34060 if(this.data.hasMask) {
34061 this.svgElement = createNS('svg');
34062 this.layerElement = createNS('g');
34063 this.maskedElement = this.layerElement;
34064 this.svgElement.appendChild(this.layerElement);
34065 this.baseElement.appendChild(this.svgElement);
34066 } else {
34067 this.layerElement = this.baseElement;
34068 }
34069 styleDiv(this.baseElement);
34070 },
34071 createContainerElements: function(){
34072 this.renderableEffectsManager = new CVEffects(this);
34073 this.transformedElement = this.baseElement;
34074 this.maskedElement = this.layerElement;
34075 if (this.data.ln) {
34076 this.layerElement.setAttribute('id',this.data.ln);
34077 }
34078 if (this.data.cl) {
34079 this.layerElement.setAttribute('class', this.data.cl);
34080 }
34081 if (this.data.bm !== 0) {
34082 this.setBlendMode();
34083 }
34084 },
34085 renderElement: function() {
34086 if(this.finalTransform._matMdf){
34087 this.transformedElement.style.transform = this.transformedElement.style.webkitTransform = this.finalTransform.mat.toCSS();
34088 }
34089 if(this.finalTransform._opMdf){
34090 this.transformedElement.style.opacity = this.finalTransform.mProp.o.v;
34091 }
34092 },
34093 renderFrame: function() {
34094 //If it is exported as hidden (data.hd === true) no need to render
34095 //If it is not visible no need to render
34096 if (this.data.hd || this.hidden) {
34097 return;
34098 }
34099 this.renderTransform();
34100 this.renderRenderable();
34101 this.renderElement();
34102 this.renderInnerContent();
34103 if (this._isFirstFrame) {
34104 this._isFirstFrame = false;
34105 }
34106 },
34107 destroy: function(){
34108 this.layerElement = null;
34109 this.transformedElement = null;
34110 if(this.matteElement) {
34111 this.matteElement = null;
34112 }
34113 if(this.maskManager) {
34114 this.maskManager.destroy();
34115 this.maskManager = null;
34116 }
34117 },
34118 createRenderableComponents: function(){
34119 this.maskManager = new MaskElement(this.data, this, this.globalData);
34120 },
34121 addEffects: function(){
34122 },
34123 setMatte: function(){}
34124};
34125HBaseElement.prototype.getBaseElement = SVGBaseElement.prototype.getBaseElement;
34126HBaseElement.prototype.destroyBaseElement = HBaseElement.prototype.destroy;
34127HBaseElement.prototype.buildElementParenting = HybridRenderer.prototype.buildElementParenting;
34128function HSolidElement(data,globalData,comp){
34129 this.initElement(data,globalData,comp);
34130}
34131extendPrototype([BaseElement,TransformElement,HBaseElement,HierarchyElement,FrameElement,RenderableDOMElement], HSolidElement);
34132
34133HSolidElement.prototype.createContent = function(){
34134 var rect;
34135 if(this.data.hasMask){
34136 rect = createNS('rect');
34137 rect.setAttribute('width',this.data.sw);
34138 rect.setAttribute('height',this.data.sh);
34139 rect.setAttribute('fill',this.data.sc);
34140 this.svgElement.setAttribute('width',this.data.sw);
34141 this.svgElement.setAttribute('height',this.data.sh);
34142 } else {
34143 rect = createTag('div');
34144 rect.style.width = this.data.sw + 'px';
34145 rect.style.height = this.data.sh + 'px';
34146 rect.style.backgroundColor = this.data.sc;
34147 }
34148 this.layerElement.appendChild(rect);
34149};
34150
34151function HCompElement(data,globalData,comp){
34152 this.layers = data.layers;
34153 this.supports3d = !data.hasMask;
34154 this.completeLayers = false;
34155 this.pendingElements = [];
34156 this.elements = this.layers ? createSizedArray(this.layers.length) : [];
34157 this.initElement(data,globalData,comp);
34158 this.tm = data.tm ? PropertyFactory.getProp(this,data.tm,0,globalData.frameRate,this) : {_placeholder:true};
34159}
34160
34161extendPrototype([HybridRenderer, ICompElement, HBaseElement], HCompElement);
34162HCompElement.prototype._createBaseContainerElements = HCompElement.prototype.createContainerElements;
34163
34164HCompElement.prototype.createContainerElements = function(){
34165 this._createBaseContainerElements();
34166 //divElement.style.clip = 'rect(0px, '+this.data.w+'px, '+this.data.h+'px, 0px)';
34167 if(this.data.hasMask){
34168 this.svgElement.setAttribute('width',this.data.w);
34169 this.svgElement.setAttribute('height',this.data.h);
34170 this.transformedElement = this.baseElement;
34171 } else {
34172 this.transformedElement = this.layerElement;
34173 }
34174};
34175
34176HCompElement.prototype.addTo3dContainer = function(elem,pos) {
34177 var j = 0;
34178 var nextElement;
34179 while(j<pos){
34180 if(this.elements[j] && this.elements[j].getBaseElement){
34181 nextElement = this.elements[j].getBaseElement();
34182 }
34183 j += 1;
34184 }
34185 if(nextElement){
34186 this.layerElement.insertBefore(elem, nextElement);
34187 } else {
34188 this.layerElement.appendChild(elem);
34189 }
34190};
34191
34192function HShapeElement(data,globalData,comp){
34193 //List of drawable elements
34194 this.shapes = [];
34195 // Full shape data
34196 this.shapesData = data.shapes;
34197 //List of styles that will be applied to shapes
34198 this.stylesList = [];
34199 //List of modifiers that will be applied to shapes
34200 this.shapeModifiers = [];
34201 //List of items in shape tree
34202 this.itemsData = [];
34203 //List of items in previous shape tree
34204 this.processedElements = [];
34205 // List of animated components
34206 this.animatedContents = [];
34207 this.shapesContainer = createNS('g');
34208 this.initElement(data,globalData,comp);
34209 //Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.
34210 // List of elements that have been created
34211 this.prevViewData = [];
34212 this.currentBBox = {
34213 x:999999,
34214 y: -999999,
34215 h: 0,
34216 w: 0
34217 };
34218}
34219extendPrototype([BaseElement,TransformElement,HSolidElement,SVGShapeElement,HBaseElement,HierarchyElement,FrameElement,RenderableElement], HShapeElement);
34220HShapeElement.prototype._renderShapeFrame = HShapeElement.prototype.renderInnerContent;
34221
34222HShapeElement.prototype.createContent = function(){
34223 var cont;
34224 this.baseElement.style.fontSize = 0;
34225 if (this.data.hasMask) {
34226 this.layerElement.appendChild(this.shapesContainer);
34227 cont = this.svgElement;
34228 } else {
34229 cont = createNS('svg');
34230 var size = this.comp.data ? this.comp.data : this.globalData.compSize;
34231 cont.setAttribute('width',size.w);
34232 cont.setAttribute('height',size.h);
34233 cont.appendChild(this.shapesContainer);
34234 this.layerElement.appendChild(cont);
34235 }
34236
34237 this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.shapesContainer,0, [], true);
34238 this.filterUniqueShapes();
34239 this.shapeCont = cont;
34240};
34241
34242HShapeElement.prototype.getTransformedPoint = function(transformers, point) {
34243 var i, len = transformers.length;
34244 for(i = 0; i < len; i += 1) {
34245 point = transformers[i].mProps.v.applyToPointArray(point[0], point[1], 0);
34246 }
34247 return point;
34248};
34249
34250HShapeElement.prototype.calculateShapeBoundingBox = function(item, boundingBox) {
34251 var shape = item.sh.v;
34252 var transformers = item.transformers;
34253 var i, len = shape._length, vPoint, oPoint, nextIPoint, nextVPoint;
34254 if (len <= 1) {
34255 return;
34256 }
34257 for (i = 0; i < len - 1; i += 1) {
34258 vPoint = this.getTransformedPoint(transformers, shape.v[i]);
34259 oPoint = this.getTransformedPoint(transformers, shape.o[i]);
34260 nextIPoint = this.getTransformedPoint(transformers, shape.i[i + 1]);
34261 nextVPoint = this.getTransformedPoint(transformers, shape.v[i + 1]);
34262 this.checkBounds(vPoint, oPoint, nextIPoint, nextVPoint, boundingBox);
34263 }
34264 if(shape.c) {
34265 vPoint = this.getTransformedPoint(transformers, shape.v[i]);
34266 oPoint = this.getTransformedPoint(transformers, shape.o[i]);
34267 nextIPoint = this.getTransformedPoint(transformers, shape.i[0]);
34268 nextVPoint = this.getTransformedPoint(transformers, shape.v[0]);
34269 this.checkBounds(vPoint, oPoint, nextIPoint, nextVPoint, boundingBox);
34270 }
34271};
34272
34273HShapeElement.prototype.checkBounds = function(vPoint, oPoint, nextIPoint, nextVPoint, boundingBox) {
34274 this.getBoundsOfCurve(vPoint, oPoint, nextIPoint, nextVPoint);
34275 var bounds = this.shapeBoundingBox;
34276 boundingBox.x = bm_min(bounds.left, boundingBox.x);
34277 boundingBox.xMax = bm_max(bounds.right, boundingBox.xMax);
34278 boundingBox.y = bm_min(bounds.top, boundingBox.y);
34279 boundingBox.yMax = bm_max(bounds.bottom, boundingBox.yMax);
34280};
34281
34282HShapeElement.prototype.shapeBoundingBox = {
34283 left:0,
34284 right:0,
34285 top:0,
34286 bottom:0,
34287};
34288
34289HShapeElement.prototype.tempBoundingBox = {
34290 x:0,
34291 xMax:0,
34292 y:0,
34293 yMax:0,
34294 width:0,
34295 height:0
34296};
34297
34298HShapeElement.prototype.getBoundsOfCurve = function(p0, p1, p2, p3) {
34299
34300 var bounds = [[p0[0],p3[0]], [p0[1],p3[1]]];
34301
34302 for (var a, b, c, t, b2ac, t1, t2, i = 0; i < 2; ++i) {
34303
34304 b = 6 * p0[i] - 12 * p1[i] + 6 * p2[i];
34305 a = -3 * p0[i] + 9 * p1[i] - 9 * p2[i] + 3 * p3[i];
34306 c = 3 * p1[i] - 3 * p0[i];
34307
34308 b = b | 0;
34309 a = a | 0;
34310 c = c | 0;
34311
34312 if (a === 0) {
34313
34314 if (b === 0) {
34315 continue;
34316 }
34317
34318 t = -c / b;
34319
34320 if (0 < t && t < 1) {
34321 bounds[i].push(this.calculateF(t,p0,p1,p2,p3,i));
34322 }
34323 continue;
34324 }
34325
34326 b2ac = b * b - 4 * c * a;
34327
34328 if (b2ac < 0) {
34329 continue;
34330 }
34331
34332 t1 = (-b + bm_sqrt(b2ac))/(2 * a);
34333 if (0 < t1 && t1 < 1) bounds[i].push(this.calculateF(t1,p0,p1,p2,p3,i));
34334
34335 t2 = (-b - bm_sqrt(b2ac))/(2 * a);
34336 if (0 < t2 && t2 < 1) bounds[i].push(this.calculateF(t2,p0,p1,p2,p3,i));
34337
34338 }
34339
34340 this.shapeBoundingBox.left = bm_min.apply(null, bounds[0]);
34341 this.shapeBoundingBox.top = bm_min.apply(null, bounds[1]);
34342 this.shapeBoundingBox.right = bm_max.apply(null, bounds[0]);
34343 this.shapeBoundingBox.bottom = bm_max.apply(null, bounds[1]);
34344 };
34345
34346 HShapeElement.prototype.calculateF = function(t, p0, p1, p2, p3, i) {
34347 return bm_pow(1-t, 3) * p0[i]
34348 + 3 * bm_pow(1-t, 2) * t * p1[i]
34349 + 3 * (1-t) * bm_pow(t, 2) * p2[i]
34350 + bm_pow(t, 3) * p3[i];
34351 };
34352
34353HShapeElement.prototype.calculateBoundingBox = function(itemsData, boundingBox) {
34354 var i, len = itemsData.length;
34355 for(i = 0; i < len; i += 1) {
34356 if(itemsData[i] && itemsData[i].sh) {
34357 this.calculateShapeBoundingBox(itemsData[i], boundingBox);
34358 } else if(itemsData[i] && itemsData[i].it) {
34359 this.calculateBoundingBox(itemsData[i].it, boundingBox);
34360 }
34361 }
34362};
34363
34364HShapeElement.prototype.currentBoxContains = function(box) {
34365 return this.currentBBox.x <= box.x
34366 && this.currentBBox.y <= box.y
34367 && this.currentBBox.width + this.currentBBox.x >= box.x + box.width
34368 && this.currentBBox.height + this.currentBBox.y >= box.y + box.height
34369};
34370
34371HShapeElement.prototype.renderInnerContent = function() {
34372 this._renderShapeFrame();
34373
34374 if(!this.hidden && (this._isFirstFrame || this._mdf)) {
34375 var tempBoundingBox = this.tempBoundingBox;
34376 var max = 999999;
34377 tempBoundingBox.x = max;
34378 tempBoundingBox.xMax = -max;
34379 tempBoundingBox.y = max;
34380 tempBoundingBox.yMax = -max;
34381 this.calculateBoundingBox(this.itemsData, tempBoundingBox);
34382 tempBoundingBox.width = tempBoundingBox.xMax < tempBoundingBox.x ? 0 : tempBoundingBox.xMax - tempBoundingBox.x;
34383 tempBoundingBox.height = tempBoundingBox.yMax < tempBoundingBox.y ? 0 : tempBoundingBox.yMax - tempBoundingBox.y;
34384 //var tempBoundingBox = this.shapeCont.getBBox();
34385 if(this.currentBoxContains(tempBoundingBox)) {
34386 return;
34387 }
34388 var changed = false;
34389 if(this.currentBBox.w !== tempBoundingBox.width){
34390 this.currentBBox.w = tempBoundingBox.width;
34391 this.shapeCont.setAttribute('width',tempBoundingBox.width);
34392 changed = true;
34393 }
34394 if(this.currentBBox.h !== tempBoundingBox.height){
34395 this.currentBBox.h = tempBoundingBox.height;
34396 this.shapeCont.setAttribute('height',tempBoundingBox.height);
34397 changed = true;
34398 }
34399 if(changed || this.currentBBox.x !== tempBoundingBox.x || this.currentBBox.y !== tempBoundingBox.y){
34400 this.currentBBox.w = tempBoundingBox.width;
34401 this.currentBBox.h = tempBoundingBox.height;
34402 this.currentBBox.x = tempBoundingBox.x;
34403 this.currentBBox.y = tempBoundingBox.y;
34404
34405 this.shapeCont.setAttribute('viewBox',this.currentBBox.x+' '+this.currentBBox.y+' '+this.currentBBox.w+' '+this.currentBBox.h);
34406 this.shapeCont.style.transform = this.shapeCont.style.webkitTransform = 'translate(' + this.currentBBox.x + 'px,' + this.currentBBox.y + 'px)';
34407 }
34408 }
34409
34410};
34411function HTextElement(data,globalData,comp){
34412 this.textSpans = [];
34413 this.textPaths = [];
34414 this.currentBBox = {
34415 x:999999,
34416 y: -999999,
34417 h: 0,
34418 w: 0
34419 };
34420 this.renderType = 'svg';
34421 this.isMasked = false;
34422 this.initElement(data,globalData,comp);
34423
34424}
34425extendPrototype([BaseElement,TransformElement,HBaseElement,HierarchyElement,FrameElement,RenderableDOMElement,ITextElement], HTextElement);
34426
34427HTextElement.prototype.createContent = function(){
34428 this.isMasked = this.checkMasks();
34429 if(this.isMasked){
34430 this.renderType = 'svg';
34431 this.compW = this.comp.data.w;
34432 this.compH = this.comp.data.h;
34433 this.svgElement.setAttribute('width',this.compW);
34434 this.svgElement.setAttribute('height',this.compH);
34435 var g = createNS('g');
34436 this.maskedElement.appendChild(g);
34437 this.innerElem = g;
34438 } else {
34439 this.renderType = 'html';
34440 this.innerElem = this.layerElement;
34441 }
34442
34443 this.checkParenting();
34444
34445};
34446
34447HTextElement.prototype.buildNewText = function(){
34448 var documentData = this.textProperty.currentData;
34449 this.renderedLetters = createSizedArray(documentData.l ? documentData.l.length : 0);
34450 var innerElemStyle = this.innerElem.style;
34451 innerElemStyle.color = innerElemStyle.fill = documentData.fc ? this.buildColor(documentData.fc) : 'rgba(0,0,0,0)';
34452 if(documentData.sc){
34453 innerElemStyle.stroke = this.buildColor(documentData.sc);
34454 innerElemStyle.strokeWidth = documentData.sw+'px';
34455 }
34456 var fontData = this.globalData.fontManager.getFontByName(documentData.f);
34457 if(!this.globalData.fontManager.chars){
34458 innerElemStyle.fontSize = documentData.finalSize+'px';
34459 innerElemStyle.lineHeight = documentData.finalSize+'px';
34460 if(fontData.fClass){
34461 this.innerElem.className = fontData.fClass;
34462 } else {
34463 innerElemStyle.fontFamily = fontData.fFamily;
34464 var fWeight = documentData.fWeight, fStyle = documentData.fStyle;
34465 innerElemStyle.fontStyle = fStyle;
34466 innerElemStyle.fontWeight = fWeight;
34467 }
34468 }
34469 var i, len;
34470
34471 var letters = documentData.l;
34472 len = letters.length;
34473 var tSpan,tParent,tCont;
34474 var matrixHelper = this.mHelper;
34475 var shapes, shapeStr = '';
34476 var cnt = 0;
34477 for (i = 0;i < len ;i += 1) {
34478 if(this.globalData.fontManager.chars){
34479 if(!this.textPaths[cnt]){
34480 tSpan = createNS('path');
34481 tSpan.setAttribute('stroke-linecap', 'butt');
34482 tSpan.setAttribute('stroke-linejoin','round');
34483 tSpan.setAttribute('stroke-miterlimit','4');
34484 } else {
34485 tSpan = this.textPaths[cnt];
34486 }
34487 if(!this.isMasked){
34488 if(this.textSpans[cnt]){
34489 tParent = this.textSpans[cnt];
34490 tCont = tParent.children[0];
34491 } else {
34492
34493 tParent = createTag('div');
34494 tCont = createNS('svg');
34495 tCont.appendChild(tSpan);
34496 styleDiv(tParent);
34497 }
34498 }
34499 }else{
34500 if(!this.isMasked){
34501 if(this.textSpans[cnt]){
34502 tParent = this.textSpans[cnt];
34503 tSpan = this.textPaths[cnt];
34504 } else {
34505 tParent = createTag('span');
34506 styleDiv(tParent);
34507 tSpan = createTag('span');
34508 styleDiv(tSpan);
34509 tParent.appendChild(tSpan);
34510 }
34511 } else {
34512 tSpan = this.textPaths[cnt] ? this.textPaths[cnt] : createNS('text');
34513 }
34514 }
34515 //tSpan.setAttribute('visibility', 'hidden');
34516 if(this.globalData.fontManager.chars){
34517 var charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);
34518 var shapeData;
34519 if(charData){
34520 shapeData = charData.data;
34521 } else {
34522 shapeData = null;
34523 }
34524 matrixHelper.reset();
34525 if(shapeData && shapeData.shapes){
34526 shapes = shapeData.shapes[0].it;
34527 matrixHelper.scale(documentData.finalSize/100,documentData.finalSize/100);
34528 shapeStr = this.createPathShape(matrixHelper,shapes);
34529 tSpan.setAttribute('d',shapeStr);
34530 }
34531 if(!this.isMasked){
34532 this.innerElem.appendChild(tParent);
34533 if(shapeData && shapeData.shapes){
34534
34535 //document.body.appendChild is needed to get exact measure of shape
34536 document.body.appendChild(tCont);
34537 var boundingBox = tCont.getBBox();
34538 tCont.setAttribute('width',boundingBox.width + 2);
34539 tCont.setAttribute('height',boundingBox.height + 2);
34540 tCont.setAttribute('viewBox',(boundingBox.x-1)+' '+ (boundingBox.y-1)+' '+ (boundingBox.width+2)+' '+ (boundingBox.height+2));
34541 tCont.style.transform = tCont.style.webkitTransform = 'translate(' + (boundingBox.x-1) + 'px,' + (boundingBox.y-1) + 'px)';
34542
34543 letters[i].yOffset = boundingBox.y-1;
34544
34545 } else{
34546 tCont.setAttribute('width',1);
34547 tCont.setAttribute('height',1);
34548 }
34549 tParent.appendChild(tCont);
34550 }else{
34551 this.innerElem.appendChild(tSpan);
34552 }
34553 }else{
34554 tSpan.textContent = letters[i].val;
34555 tSpan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space","preserve");
34556 if(!this.isMasked){
34557 this.innerElem.appendChild(tParent);
34558 //
34559 tSpan.style.transform = tSpan.style.webkitTransform = 'translate3d(0,'+ -documentData.finalSize/1.2+'px,0)';
34560 } else {
34561 this.innerElem.appendChild(tSpan);
34562 }
34563 }
34564 //
34565 if(!this.isMasked){
34566 this.textSpans[cnt] = tParent;
34567 }else{
34568 this.textSpans[cnt] = tSpan;
34569 }
34570 this.textSpans[cnt].style.display = 'block';
34571 this.textPaths[cnt] = tSpan;
34572 cnt += 1;
34573 }
34574 while(cnt < this.textSpans.length){
34575 this.textSpans[cnt].style.display = 'none';
34576 cnt += 1;
34577 }
34578};
34579
34580HTextElement.prototype.renderInnerContent = function() {
34581
34582 if(this.data.singleShape){
34583 if(!this._isFirstFrame && !this.lettersChangedFlag){
34584 return;
34585 } else {
34586 // Todo Benchmark if using this is better than getBBox
34587 if(this.isMasked && this.finalTransform._matMdf){
34588 this.svgElement.setAttribute('viewBox',-this.finalTransform.mProp.p.v[0]+' '+ -this.finalTransform.mProp.p.v[1]+' '+this.compW+' '+this.compH);
34589 this.svgElement.style.transform = this.svgElement.style.webkitTransform = 'translate(' + -this.finalTransform.mProp.p.v[0] + 'px,' + -this.finalTransform.mProp.p.v[1] + 'px)';
34590 }
34591 }
34592 }
34593
34594 this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);
34595 if(!this.lettersChangedFlag && !this.textAnimator.lettersChangedFlag){
34596 return;
34597 }
34598 var i,len, count = 0;
34599 var renderedLetters = this.textAnimator.renderedLetters;
34600
34601 var letters = this.textProperty.currentData.l;
34602
34603 len = letters.length;
34604 var renderedLetter, textSpan, textPath;
34605 for(i=0;i<len;i+=1){
34606 if(letters[i].n){
34607 count += 1;
34608 continue;
34609 }
34610 textSpan = this.textSpans[i];
34611 textPath = this.textPaths[i];
34612 renderedLetter = renderedLetters[count];
34613 count += 1;
34614 if(renderedLetter._mdf.m) {
34615 if(!this.isMasked){
34616 textSpan.style.transform = textSpan.style.webkitTransform = renderedLetter.m;
34617 }else{
34618 textSpan.setAttribute('transform',renderedLetter.m);
34619 }
34620 }
34621 ////textSpan.setAttribute('opacity',renderedLetter.o);
34622 textSpan.style.opacity = renderedLetter.o;
34623 if(renderedLetter.sw && renderedLetter._mdf.sw){
34624 textPath.setAttribute('stroke-width',renderedLetter.sw);
34625 }
34626 if(renderedLetter.sc && renderedLetter._mdf.sc){
34627 textPath.setAttribute('stroke',renderedLetter.sc);
34628 }
34629 if(renderedLetter.fc && renderedLetter._mdf.fc){
34630 textPath.setAttribute('fill',renderedLetter.fc);
34631 textPath.style.color = renderedLetter.fc;
34632 }
34633 }
34634
34635 if(this.innerElem.getBBox && !this.hidden && (this._isFirstFrame || this._mdf)){
34636 var boundingBox = this.innerElem.getBBox();
34637
34638 if(this.currentBBox.w !== boundingBox.width){
34639 this.currentBBox.w = boundingBox.width;
34640 this.svgElement.setAttribute('width',boundingBox.width);
34641 }
34642 if(this.currentBBox.h !== boundingBox.height){
34643 this.currentBBox.h = boundingBox.height;
34644 this.svgElement.setAttribute('height',boundingBox.height);
34645 }
34646
34647 var margin = 1;
34648 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)){
34649 this.currentBBox.w = boundingBox.width + margin*2;
34650 this.currentBBox.h = boundingBox.height + margin*2;
34651 this.currentBBox.x = boundingBox.x - margin;
34652 this.currentBBox.y = boundingBox.y - margin;
34653
34654 this.svgElement.setAttribute('viewBox',this.currentBBox.x+' '+this.currentBBox.y+' '+this.currentBBox.w+' '+this.currentBBox.h);
34655 this.svgElement.style.transform = this.svgElement.style.webkitTransform = 'translate(' + this.currentBBox.x + 'px,' + this.currentBBox.y + 'px)';
34656 }
34657 }
34658};
34659function HImageElement(data,globalData,comp){
34660 this.assetData = globalData.getAssetData(data.refId);
34661 this.initElement(data,globalData,comp);
34662}
34663
34664extendPrototype([BaseElement,TransformElement,HBaseElement,HSolidElement,HierarchyElement,FrameElement,RenderableElement], HImageElement);
34665
34666
34667HImageElement.prototype.createContent = function(){
34668 var assetPath = this.globalData.getAssetsPath(this.assetData);
34669 var img = new Image();
34670
34671 if(this.data.hasMask){
34672 this.imageElem = createNS('image');
34673 this.imageElem.setAttribute('width',this.assetData.w+"px");
34674 this.imageElem.setAttribute('height',this.assetData.h+"px");
34675 this.imageElem.setAttributeNS('http://www.w3.org/1999/xlink','href',assetPath);
34676 this.layerElement.appendChild(this.imageElem);
34677 this.baseElement.setAttribute('width',this.assetData.w);
34678 this.baseElement.setAttribute('height',this.assetData.h);
34679 } else {
34680 this.layerElement.appendChild(img);
34681 }
34682 img.src = assetPath;
34683 if(this.data.ln){
34684 this.baseElement.setAttribute('id',this.data.ln);
34685 }
34686};
34687function HCameraElement(data,globalData,comp){
34688 this.initFrame();
34689 this.initBaseData(data,globalData,comp);
34690 this.initHierarchy();
34691 var getProp = PropertyFactory.getProp;
34692 this.pe = getProp(this,data.pe,0,0,this);
34693 if(data.ks.p.s){
34694 this.px = getProp(this,data.ks.p.x,1,0,this);
34695 this.py = getProp(this,data.ks.p.y,1,0,this);
34696 this.pz = getProp(this,data.ks.p.z,1,0,this);
34697 }else{
34698 this.p = getProp(this,data.ks.p,1,0,this);
34699 }
34700 if(data.ks.a){
34701 this.a = getProp(this,data.ks.a,1,0,this);
34702 }
34703 if(data.ks.or.k.length && data.ks.or.k[0].to){
34704 var i,len = data.ks.or.k.length;
34705 for(i=0;i<len;i+=1){
34706 data.ks.or.k[i].to = null;
34707 data.ks.or.k[i].ti = null;
34708 }
34709 }
34710 this.or = getProp(this,data.ks.or,1,degToRads,this);
34711 this.or.sh = true;
34712 this.rx = getProp(this,data.ks.rx,0,degToRads,this);
34713 this.ry = getProp(this,data.ks.ry,0,degToRads,this);
34714 this.rz = getProp(this,data.ks.rz,0,degToRads,this);
34715 this.mat = new Matrix();
34716 this._prevMat = new Matrix();
34717 this._isFirstFrame = true;
34718
34719 // TODO: find a better way to make the HCamera element to be compatible with the LayerInterface and TransformInterface.
34720 this.finalTransform = {
34721 mProp: this
34722 };
34723}
34724extendPrototype([BaseElement, FrameElement, HierarchyElement], HCameraElement);
34725
34726HCameraElement.prototype.setup = function() {
34727 var i, len = this.comp.threeDElements.length, comp;
34728 for(i=0;i<len;i+=1){
34729 //[perspectiveElem,container]
34730 comp = this.comp.threeDElements[i];
34731 if(comp.type === '3d') {
34732 comp.perspectiveElem.style.perspective = comp.perspectiveElem.style.webkitPerspective = this.pe.v+'px';
34733 comp.container.style.transformOrigin = comp.container.style.mozTransformOrigin = comp.container.style.webkitTransformOrigin = "0px 0px 0px";
34734 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)';
34735 }
34736 }
34737};
34738
34739HCameraElement.prototype.createElements = function(){
34740};
34741
34742HCameraElement.prototype.hide = function(){
34743};
34744
34745HCameraElement.prototype.renderFrame = function(){
34746 var _mdf = this._isFirstFrame;
34747 var i, len;
34748 if(this.hierarchy){
34749 len = this.hierarchy.length;
34750 for(i=0;i<len;i+=1){
34751 _mdf = this.hierarchy[i].finalTransform.mProp._mdf || _mdf;
34752 }
34753 }
34754 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)) {
34755 this.mat.reset();
34756
34757 if(this.hierarchy){
34758 len = this.hierarchy.length - 1;
34759 for (i = len; i >= 0; i -= 1) {
34760 /*mat = this.hierarchy[i].finalTransform.mProp.v.props;
34761 console.log(mat)
34762 this.mat.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]);
34763 console.log(this.mat.props)*/
34764 var mTransf = this.hierarchy[i].finalTransform.mProp;
34765 this.mat.translate(-mTransf.p.v[0],-mTransf.p.v[1],mTransf.p.v[2]);
34766 this.mat.rotateX(-mTransf.or.v[0]).rotateY(-mTransf.or.v[1]).rotateZ(mTransf.or.v[2]);
34767 this.mat.rotateX(-mTransf.rx.v).rotateY(-mTransf.ry.v).rotateZ(mTransf.rz.v);
34768 this.mat.scale(1/mTransf.s.v[0],1/mTransf.s.v[1],1/mTransf.s.v[2]);
34769 this.mat.translate(mTransf.a.v[0],mTransf.a.v[1],mTransf.a.v[2]);
34770 }
34771 }
34772
34773 if(this.p){
34774 this.mat.translate(-this.p.v[0],-this.p.v[1],this.p.v[2]);
34775 }else{
34776 this.mat.translate(-this.px.v,-this.py.v,this.pz.v);
34777 }
34778 if(this.a){
34779 var 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]];
34780 var mag = Math.sqrt(Math.pow(diffVector[0],2)+Math.pow(diffVector[1],2)+Math.pow(diffVector[2],2));
34781 //var lookDir = getNormalizedPoint(getDiffVector(this.a.v,this.p.v));
34782 var lookDir = [diffVector[0]/mag,diffVector[1]/mag,diffVector[2]/mag];
34783 var lookLengthOnXZ = Math.sqrt( lookDir[2]*lookDir[2] + lookDir[0]*lookDir[0] );
34784 var m_rotationX = (Math.atan2( lookDir[1], lookLengthOnXZ ));
34785 var m_rotationY = (Math.atan2( lookDir[0], -lookDir[2]));
34786 this.mat.rotateY(m_rotationY).rotateX(-m_rotationX);
34787
34788 }
34789 this.mat.rotateX(-this.rx.v).rotateY(-this.ry.v).rotateZ(this.rz.v);
34790 this.mat.rotateX(-this.or.v[0]).rotateY(-this.or.v[1]).rotateZ(this.or.v[2]);
34791 this.mat.translate(this.globalData.compSize.w/2,this.globalData.compSize.h/2,0);
34792 this.mat.translate(0,0,this.pe.v);
34793
34794
34795
34796
34797 var hasMatrixChanged = !this._prevMat.equals(this.mat);
34798 if((hasMatrixChanged || this.pe._mdf) && this.comp.threeDElements) {
34799 len = this.comp.threeDElements.length;
34800 var comp;
34801 for(i=0;i<len;i+=1){
34802 comp = this.comp.threeDElements[i];
34803 if(comp.type === '3d') {
34804 if(hasMatrixChanged) {
34805 comp.container.style.transform = comp.container.style.webkitTransform = this.mat.toCSS();
34806 }
34807 if(this.pe._mdf) {
34808 comp.perspectiveElem.style.perspective = comp.perspectiveElem.style.webkitPerspective = this.pe.v+'px';
34809 }
34810 }
34811 }
34812 this.mat.clone(this._prevMat);
34813 }
34814 }
34815 this._isFirstFrame = false;
34816};
34817
34818HCameraElement.prototype.prepareFrame = function(num) {
34819 this.prepareProperties(num, true);
34820};
34821
34822HCameraElement.prototype.destroy = function(){
34823};
34824HCameraElement.prototype.getBaseElement = function(){return null;};
34825var animationManager = (function(){
34826 var moduleOb = {};
34827 var registeredAnimations = [];
34828 var initTime = 0;
34829 var len = 0;
34830 var playingAnimationsNum = 0;
34831 var _stopped = true;
34832 var _isFrozen = false;
34833
34834 function removeElement(ev){
34835 var i = 0;
34836 var animItem = ev.target;
34837 while(i<len) {
34838 if (registeredAnimations[i].animation === animItem) {
34839 registeredAnimations.splice(i, 1);
34840 i -= 1;
34841 len -= 1;
34842 if(!animItem.isPaused){
34843 subtractPlayingCount();
34844 }
34845 }
34846 i += 1;
34847 }
34848 }
34849
34850 function registerAnimation(element, animationData){
34851 if(!element){
34852 return null;
34853 }
34854 var i=0;
34855 while(i<len){
34856 if(registeredAnimations[i].elem == element && registeredAnimations[i].elem !== null ){
34857 return registeredAnimations[i].animation;
34858 }
34859 i+=1;
34860 }
34861 var animItem = new AnimationItem();
34862 setupAnimation(animItem, element);
34863 animItem.setData(element, animationData);
34864 return animItem;
34865 }
34866
34867 function getRegisteredAnimations() {
34868 var i, len = registeredAnimations.length;
34869 var animations = [];
34870 for(i = 0; i < len; i += 1) {
34871 animations.push(registeredAnimations[i].animation);
34872 }
34873 return animations;
34874 }
34875
34876 function addPlayingCount(){
34877 playingAnimationsNum += 1;
34878 activate();
34879 }
34880
34881 function subtractPlayingCount(){
34882 playingAnimationsNum -= 1;
34883 }
34884
34885 function setupAnimation(animItem, element){
34886 animItem.addEventListener('destroy',removeElement);
34887 animItem.addEventListener('_active',addPlayingCount);
34888 animItem.addEventListener('_idle',subtractPlayingCount);
34889 registeredAnimations.push({elem: element,animation:animItem});
34890 len += 1;
34891 }
34892
34893 function loadAnimation(params){
34894 var animItem = new AnimationItem();
34895 setupAnimation(animItem, null);
34896 animItem.setParams(params);
34897 return animItem;
34898 }
34899
34900
34901 function setSpeed(val,animation){
34902 var i;
34903 for(i=0;i<len;i+=1){
34904 registeredAnimations[i].animation.setSpeed(val, animation);
34905 }
34906 }
34907
34908 function setDirection(val, animation){
34909 var i;
34910 for(i=0;i<len;i+=1){
34911 registeredAnimations[i].animation.setDirection(val, animation);
34912 }
34913 }
34914
34915 function play(animation){
34916 var i;
34917 for(i=0;i<len;i+=1){
34918 registeredAnimations[i].animation.play(animation);
34919 }
34920 }
34921 function resume(nowTime) {
34922 var elapsedTime = nowTime - initTime;
34923 var i;
34924 for(i=0;i<len;i+=1){
34925 registeredAnimations[i].animation.advanceTime(elapsedTime);
34926 }
34927 initTime = nowTime;
34928 if(playingAnimationsNum && !_isFrozen) {
34929 window.requestAnimationFrame(resume);
34930 } else {
34931 _stopped = true;
34932 }
34933 }
34934
34935 function first(nowTime){
34936 initTime = nowTime;
34937 window.requestAnimationFrame(resume);
34938 }
34939
34940 function pause(animation) {
34941 var i;
34942 for(i=0;i<len;i+=1){
34943 registeredAnimations[i].animation.pause(animation);
34944 }
34945 }
34946
34947 function goToAndStop(value,isFrame,animation) {
34948 var i;
34949 for(i=0;i<len;i+=1){
34950 registeredAnimations[i].animation.goToAndStop(value,isFrame,animation);
34951 }
34952 }
34953
34954 function stop(animation) {
34955 var i;
34956 for(i=0;i<len;i+=1){
34957 registeredAnimations[i].animation.stop(animation);
34958 }
34959 }
34960
34961 function togglePause(animation) {
34962 var i;
34963 for(i=0;i<len;i+=1){
34964 registeredAnimations[i].animation.togglePause(animation);
34965 }
34966 }
34967
34968 function destroy(animation) {
34969 var i;
34970 for(i=(len-1);i>=0;i-=1){
34971 registeredAnimations[i].animation.destroy(animation);
34972 }
34973 }
34974
34975 function searchAnimations(animationData, standalone, renderer){
34976 var animElements = [].concat([].slice.call(document.getElementsByClassName('lottie')),
34977 [].slice.call(document.getElementsByClassName('bodymovin')));
34978 var i, len = animElements.length;
34979 for(i=0;i<len;i+=1){
34980 if(renderer){
34981 animElements[i].setAttribute('data-bm-type',renderer);
34982 }
34983 registerAnimation(animElements[i], animationData);
34984 }
34985 if(standalone && len === 0){
34986 if(!renderer){
34987 renderer = 'svg';
34988 }
34989 var body = document.getElementsByTagName('body')[0];
34990 body.innerHTML = '';
34991 var div = createTag('div');
34992 div.style.width = '100%';
34993 div.style.height = '100%';
34994 div.setAttribute('data-bm-type',renderer);
34995 body.appendChild(div);
34996 registerAnimation(div, animationData);
34997 }
34998 }
34999
35000 function resize(){
35001 var i;
35002 for(i=0;i<len;i+=1){
35003 registeredAnimations[i].animation.resize();
35004 }
35005 }
35006
35007 function activate(){
35008 if(!_isFrozen && playingAnimationsNum){
35009 if(_stopped) {
35010 window.requestAnimationFrame(first);
35011 _stopped = false;
35012 }
35013 }
35014 }
35015
35016 function freeze() {
35017 _isFrozen = true;
35018 }
35019
35020 function unfreeze() {
35021 _isFrozen = false;
35022 activate();
35023 }
35024
35025 moduleOb.registerAnimation = registerAnimation;
35026 moduleOb.loadAnimation = loadAnimation;
35027 moduleOb.setSpeed = setSpeed;
35028 moduleOb.setDirection = setDirection;
35029 moduleOb.play = play;
35030 moduleOb.pause = pause;
35031 moduleOb.stop = stop;
35032 moduleOb.togglePause = togglePause;
35033 moduleOb.searchAnimations = searchAnimations;
35034 moduleOb.resize = resize;
35035 //moduleOb.start = start;
35036 moduleOb.goToAndStop = goToAndStop;
35037 moduleOb.destroy = destroy;
35038 moduleOb.freeze = freeze;
35039 moduleOb.unfreeze = unfreeze;
35040 moduleOb.getRegisteredAnimations = getRegisteredAnimations;
35041 return moduleOb;
35042}());
35043
35044var AnimationItem = function () {
35045 this._cbs = [];
35046 this.name = '';
35047 this.path = '';
35048 this.isLoaded = false;
35049 this.currentFrame = 0;
35050 this.currentRawFrame = 0;
35051 this.totalFrames = 0;
35052 this.frameRate = 0;
35053 this.frameMult = 0;
35054 this.playSpeed = 1;
35055 this.playDirection = 1;
35056 this.playCount = 0;
35057 this.animationData = {};
35058 this.assets = [];
35059 this.isPaused = true;
35060 this.autoplay = false;
35061 this.loop = true;
35062 this.renderer = null;
35063 this.animationID = createElementID();
35064 this.assetsPath = '';
35065 this.timeCompleted = 0;
35066 this.segmentPos = 0;
35067 this.subframeEnabled = subframeEnabled;
35068 this.segments = [];
35069 this._idle = true;
35070 this._completedLoop = false;
35071 this.projectInterface = ProjectInterface();
35072 this.imagePreloader = new ImagePreloader();
35073};
35074
35075extendPrototype([BaseEvent], AnimationItem);
35076
35077AnimationItem.prototype.setParams = function(params) {
35078 if(params.context){
35079 this.context = params.context;
35080 }
35081 if(params.wrapper || params.container){
35082 this.wrapper = params.wrapper || params.container;
35083 }
35084 var animType = params.animType ? params.animType : params.renderer ? params.renderer : 'svg';
35085 switch(animType){
35086 case 'canvas':
35087 this.renderer = new CanvasRenderer(this, params.rendererSettings);
35088 break;
35089 case 'svg':
35090 this.renderer = new SVGRenderer(this, params.rendererSettings);
35091 break;
35092 default:
35093 this.renderer = new HybridRenderer(this, params.rendererSettings);
35094 break;
35095 }
35096 this.renderer.setProjectInterface(this.projectInterface);
35097 this.animType = animType;
35098
35099 if(params.loop === '' || params.loop === null);else if(params.loop === false){
35100 this.loop = false;
35101 }else if(params.loop === true){
35102 this.loop = true;
35103 }else{
35104 this.loop = parseInt(params.loop);
35105 }
35106 this.autoplay = 'autoplay' in params ? params.autoplay : true;
35107 this.name = params.name ? params.name : '';
35108 this.autoloadSegments = params.hasOwnProperty('autoloadSegments') ? params.autoloadSegments : true;
35109 this.assetsPath = params.assetsPath;
35110 if(params.animationData){
35111 this.configAnimation(params.animationData);
35112 }else if(params.path){
35113 if(params.path.substr(-4) != 'json'){
35114 if (params.path.substr(-1, 1) != '/') {
35115 params.path += '/';
35116 }
35117 params.path += 'data.json';
35118 }
35119
35120 if(params.path.lastIndexOf('\\') != -1){
35121 this.path = params.path.substr(0,params.path.lastIndexOf('\\')+1);
35122 }else{
35123 this.path = params.path.substr(0,params.path.lastIndexOf('/')+1);
35124 }
35125 this.fileName = params.path.substr(params.path.lastIndexOf('/')+1);
35126 this.fileName = this.fileName.substr(0,this.fileName.lastIndexOf('.json'));
35127
35128 assetLoader.load(params.path, this.configAnimation.bind(this), function() {
35129 this.trigger('data_failed');
35130 }.bind(this));
35131 }
35132};
35133
35134AnimationItem.prototype.setData = function (wrapper, animationData) {
35135 var params = {
35136 wrapper: wrapper,
35137 animationData: animationData ? (typeof animationData === "object") ? animationData : JSON.parse(animationData) : null
35138 };
35139 var wrapperAttributes = wrapper.attributes;
35140
35141 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 : '';
35142 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';
35143
35144 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 : '';
35145 if(loop === '');else if(loop === 'false'){
35146 params.loop = false;
35147 }else if(loop === 'true'){
35148 params.loop = true;
35149 }else{
35150 params.loop = parseInt(loop);
35151 }
35152 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;
35153 params.autoplay = autoplay !== "false";
35154
35155 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 : '';
35156 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 : '';
35157
35158 if(prerender === 'false'){
35159 params.prerender = false;
35160 }
35161 this.setParams(params);
35162};
35163
35164AnimationItem.prototype.includeLayers = function(data) {
35165 if(data.op > this.animationData.op){
35166 this.animationData.op = data.op;
35167 this.totalFrames = Math.floor(data.op - this.animationData.ip);
35168 }
35169 var layers = this.animationData.layers;
35170 var i, len = layers.length;
35171 var newLayers = data.layers;
35172 var j, jLen = newLayers.length;
35173 for(j=0;j<jLen;j+=1){
35174 i = 0;
35175 while(i<len){
35176 if(layers[i].id == newLayers[j].id){
35177 layers[i] = newLayers[j];
35178 break;
35179 }
35180 i += 1;
35181 }
35182 }
35183 if(data.chars || data.fonts){
35184 this.renderer.globalData.fontManager.addChars(data.chars);
35185 this.renderer.globalData.fontManager.addFonts(data.fonts, this.renderer.globalData.defs);
35186 }
35187 if(data.assets){
35188 len = data.assets.length;
35189 for(i = 0; i < len; i += 1){
35190 this.animationData.assets.push(data.assets[i]);
35191 }
35192 }
35193 this.animationData.__complete = false;
35194 dataManager.completeData(this.animationData,this.renderer.globalData.fontManager);
35195 this.renderer.includeLayers(data.layers);
35196 if(expressionsPlugin){
35197 expressionsPlugin.initExpressions(this);
35198 }
35199 this.loadNextSegment();
35200};
35201
35202AnimationItem.prototype.loadNextSegment = function() {
35203 var segments = this.animationData.segments;
35204 if(!segments || segments.length === 0 || !this.autoloadSegments){
35205 this.trigger('data_ready');
35206 this.timeCompleted = this.totalFrames;
35207 return;
35208 }
35209 var segment = segments.shift();
35210 this.timeCompleted = segment.time * this.frameRate;
35211 var segmentPath = this.path+this.fileName+'_' + this.segmentPos + '.json';
35212 this.segmentPos += 1;
35213 assetLoader.load(segmentPath, this.includeLayers.bind(this), function() {
35214 this.trigger('data_failed');
35215 }.bind(this));
35216};
35217
35218AnimationItem.prototype.loadSegments = function() {
35219 var segments = this.animationData.segments;
35220 if(!segments) {
35221 this.timeCompleted = this.totalFrames;
35222 }
35223 this.loadNextSegment();
35224};
35225
35226AnimationItem.prototype.imagesLoaded = function() {
35227 this.trigger('loaded_images');
35228 this.checkLoaded();
35229};
35230
35231AnimationItem.prototype.preloadImages = function() {
35232 this.imagePreloader.setAssetsPath(this.assetsPath);
35233 this.imagePreloader.setPath(this.path);
35234 this.imagePreloader.loadAssets(this.animationData.assets, this.imagesLoaded.bind(this));
35235};
35236
35237AnimationItem.prototype.configAnimation = function (animData) {
35238 if(!this.renderer){
35239 return;
35240 }
35241 this.animationData = animData;
35242 this.totalFrames = Math.floor(this.animationData.op - this.animationData.ip);
35243 this.renderer.configAnimation(animData);
35244 if(!animData.assets){
35245 animData.assets = [];
35246 }
35247 this.renderer.searchExtraCompositions(animData.assets);
35248
35249 this.assets = this.animationData.assets;
35250 this.frameRate = this.animationData.fr;
35251 this.firstFrame = Math.round(this.animationData.ip);
35252 this.frameMult = this.animationData.fr / 1000;
35253 this.trigger('config_ready');
35254 this.preloadImages();
35255 this.loadSegments();
35256 this.updaFrameModifier();
35257 this.waitForFontsLoaded();
35258};
35259
35260AnimationItem.prototype.waitForFontsLoaded = function(){
35261 if(!this.renderer) {
35262 return;
35263 }
35264 if(this.renderer.globalData.fontManager.loaded()){
35265 this.checkLoaded();
35266 }else{
35267 setTimeout(this.waitForFontsLoaded.bind(this),20);
35268 }
35269};
35270
35271AnimationItem.prototype.checkLoaded = function () {
35272 if (!this.isLoaded && this.renderer.globalData.fontManager.loaded() && (this.imagePreloader.loaded() || this.renderer.rendererType !== 'canvas')) {
35273 this.isLoaded = true;
35274 dataManager.completeData(this.animationData, this.renderer.globalData.fontManager);
35275 if(expressionsPlugin){
35276 expressionsPlugin.initExpressions(this);
35277 }
35278 this.renderer.initItems();
35279 setTimeout(function() {
35280 this.trigger('DOMLoaded');
35281 }.bind(this), 0);
35282 this.gotoFrame();
35283 if(this.autoplay){
35284 this.play();
35285 }
35286 }
35287};
35288
35289AnimationItem.prototype.resize = function () {
35290 this.renderer.updateContainerSize();
35291};
35292
35293AnimationItem.prototype.setSubframe = function(flag){
35294 this.subframeEnabled = flag ? true : false;
35295};
35296
35297AnimationItem.prototype.gotoFrame = function () {
35298 this.currentFrame = this.subframeEnabled ? this.currentRawFrame : ~~this.currentRawFrame;
35299
35300 if(this.timeCompleted !== this.totalFrames && this.currentFrame > this.timeCompleted){
35301 this.currentFrame = this.timeCompleted;
35302 }
35303 this.trigger('enterFrame');
35304 this.renderFrame();
35305};
35306
35307AnimationItem.prototype.renderFrame = function () {
35308 if(this.isLoaded === false){
35309 return;
35310 }
35311 this.renderer.renderFrame(this.currentFrame + this.firstFrame);
35312};
35313
35314AnimationItem.prototype.play = function (name) {
35315 if(name && this.name != name){
35316 return;
35317 }
35318 if(this.isPaused === true){
35319 this.isPaused = false;
35320 if(this._idle){
35321 this._idle = false;
35322 this.trigger('_active');
35323 }
35324 }
35325};
35326
35327AnimationItem.prototype.pause = function (name) {
35328 if(name && this.name != name){
35329 return;
35330 }
35331 if(this.isPaused === false){
35332 this.isPaused = true;
35333 this._idle = true;
35334 this.trigger('_idle');
35335 }
35336};
35337
35338AnimationItem.prototype.togglePause = function (name) {
35339 if(name && this.name != name){
35340 return;
35341 }
35342 if(this.isPaused === true){
35343 this.play();
35344 }else{
35345 this.pause();
35346 }
35347};
35348
35349AnimationItem.prototype.stop = function (name) {
35350 if(name && this.name != name){
35351 return;
35352 }
35353 this.pause();
35354 this.playCount = 0;
35355 this._completedLoop = false;
35356 this.setCurrentRawFrameValue(0);
35357};
35358
35359AnimationItem.prototype.goToAndStop = function (value, isFrame, name) {
35360 if(name && this.name != name){
35361 return;
35362 }
35363 if(isFrame){
35364 this.setCurrentRawFrameValue(value);
35365 }else{
35366 this.setCurrentRawFrameValue(value * this.frameModifier);
35367 }
35368 this.pause();
35369};
35370
35371AnimationItem.prototype.goToAndPlay = function (value, isFrame, name) {
35372 this.goToAndStop(value, isFrame, name);
35373 this.play();
35374};
35375
35376AnimationItem.prototype.advanceTime = function (value) {
35377 if (this.isPaused === true || this.isLoaded === false) {
35378 return;
35379 }
35380 var nextValue = this.currentRawFrame + value * this.frameModifier;
35381 var _isComplete = false;
35382 // Checking if nextValue > totalFrames - 1 for addressing non looping and looping animations.
35383 // If animation won't loop, it should stop at totalFrames - 1. If it will loop it should complete the last frame and then loop.
35384 if (nextValue >= this.totalFrames - 1 && this.frameModifier > 0) {
35385 if (!this.loop || this.playCount === this.loop) {
35386 if (!this.checkSegments(nextValue > this.totalFrames ? nextValue % this.totalFrames : 0)) {
35387 _isComplete = true;
35388 nextValue = this.totalFrames - 1;
35389 }
35390 } else if (nextValue >= this.totalFrames) {
35391 this.playCount += 1;
35392 if (!this.checkSegments(nextValue % this.totalFrames)) {
35393 this.setCurrentRawFrameValue(nextValue % this.totalFrames);
35394 this._completedLoop = true;
35395 this.trigger('loopComplete');
35396 }
35397 } else {
35398 this.setCurrentRawFrameValue(nextValue);
35399 }
35400 } else if(nextValue < 0) {
35401 if (!this.checkSegments(nextValue % this.totalFrames)) {
35402 if (this.loop && !(this.playCount-- <= 0 && this.loop !== true)) {
35403 this.setCurrentRawFrameValue(this.totalFrames + (nextValue % this.totalFrames));
35404 if(!this._completedLoop) {
35405 this._completedLoop = true;
35406 } else {
35407 this.trigger('loopComplete');
35408 }
35409 } else {
35410 _isComplete = true;
35411 nextValue = 0;
35412 }
35413 }
35414 } else {
35415 this.setCurrentRawFrameValue(nextValue);
35416 }
35417 if (_isComplete) {
35418 this.setCurrentRawFrameValue(nextValue);
35419 this.pause();
35420 this.trigger('complete');
35421 }
35422};
35423
35424AnimationItem.prototype.adjustSegment = function(arr, offset){
35425 this.playCount = 0;
35426 if(arr[1] < arr[0]){
35427 if(this.frameModifier > 0){
35428 if(this.playSpeed < 0){
35429 this.setSpeed(-this.playSpeed);
35430 } else {
35431 this.setDirection(-1);
35432 }
35433 }
35434 this.timeCompleted = this.totalFrames = arr[0] - arr[1];
35435 this.firstFrame = arr[1];
35436 this.setCurrentRawFrameValue(this.totalFrames - 0.001 - offset);
35437 } else if(arr[1] > arr[0]){
35438 if(this.frameModifier < 0){
35439 if(this.playSpeed < 0){
35440 this.setSpeed(-this.playSpeed);
35441 } else {
35442 this.setDirection(1);
35443 }
35444 }
35445 this.timeCompleted = this.totalFrames = arr[1] - arr[0];
35446 this.firstFrame = arr[0];
35447 this.setCurrentRawFrameValue(0.001 + offset);
35448 }
35449 this.trigger('segmentStart');
35450};
35451AnimationItem.prototype.setSegment = function (init,end) {
35452 var pendingFrame = -1;
35453 if(this.isPaused) {
35454 if (this.currentRawFrame + this.firstFrame < init) {
35455 pendingFrame = init;
35456 } else if (this.currentRawFrame + this.firstFrame > end) {
35457 pendingFrame = end - init;
35458 }
35459 }
35460
35461 this.firstFrame = init;
35462 this.timeCompleted = this.totalFrames = end - init;
35463 if(pendingFrame !== -1) {
35464 this.goToAndStop(pendingFrame,true);
35465 }
35466};
35467
35468AnimationItem.prototype.playSegments = function (arr, forceFlag) {
35469 if (forceFlag) {
35470 this.segments.length = 0;
35471 }
35472 if (typeof arr[0] === 'object') {
35473 var i, len = arr.length;
35474 for (i = 0; i < len; i += 1) {
35475 this.segments.push(arr[i]);
35476 }
35477 } else {
35478 this.segments.push(arr);
35479 }
35480 if (this.segments.length && forceFlag) {
35481 this.adjustSegment(this.segments.shift(), 0);
35482 }
35483 if (this.isPaused) {
35484 this.play();
35485 }
35486};
35487
35488AnimationItem.prototype.resetSegments = function (forceFlag) {
35489 this.segments.length = 0;
35490 this.segments.push([this.animationData.ip,this.animationData.op]);
35491 //this.segments.push([this.animationData.ip*this.frameRate,Math.floor(this.animationData.op - this.animationData.ip+this.animationData.ip*this.frameRate)]);
35492 if (forceFlag) {
35493 this.checkSegments(0);
35494 }
35495};
35496AnimationItem.prototype.checkSegments = function(offset) {
35497 if (this.segments.length) {
35498 this.adjustSegment(this.segments.shift(), offset);
35499 return true;
35500 }
35501 return false;
35502};
35503
35504AnimationItem.prototype.destroy = function (name) {
35505 if ((name && this.name != name) || !this.renderer) {
35506 return;
35507 }
35508 this.renderer.destroy();
35509 this.imagePreloader.destroy();
35510 this.trigger('destroy');
35511 this._cbs = null;
35512 this.onEnterFrame = this.onLoopComplete = this.onComplete = this.onSegmentStart = this.onDestroy = null;
35513 this.renderer = null;
35514};
35515
35516AnimationItem.prototype.setCurrentRawFrameValue = function(value){
35517 this.currentRawFrame = value;
35518 this.gotoFrame();
35519};
35520
35521AnimationItem.prototype.setSpeed = function (val) {
35522 this.playSpeed = val;
35523 this.updaFrameModifier();
35524};
35525
35526AnimationItem.prototype.setDirection = function (val) {
35527 this.playDirection = val < 0 ? -1 : 1;
35528 this.updaFrameModifier();
35529};
35530
35531AnimationItem.prototype.updaFrameModifier = function () {
35532 this.frameModifier = this.frameMult * this.playSpeed * this.playDirection;
35533};
35534
35535AnimationItem.prototype.getPath = function () {
35536 return this.path;
35537};
35538
35539AnimationItem.prototype.getAssetsPath = function (assetData) {
35540 var path = '';
35541 if(assetData.e) {
35542 path = assetData.p;
35543 } else if(this.assetsPath){
35544 var imagePath = assetData.p;
35545 if(imagePath.indexOf('images/') !== -1){
35546 imagePath = imagePath.split('/')[1];
35547 }
35548 path = this.assetsPath + imagePath;
35549 } else {
35550 path = this.path;
35551 path += assetData.u ? assetData.u : '';
35552 path += assetData.p;
35553 }
35554 return path;
35555};
35556
35557AnimationItem.prototype.getAssetData = function (id) {
35558 var i = 0, len = this.assets.length;
35559 while (i < len) {
35560 if(id == this.assets[i].id){
35561 return this.assets[i];
35562 }
35563 i += 1;
35564 }
35565};
35566
35567AnimationItem.prototype.hide = function () {
35568 this.renderer.hide();
35569};
35570
35571AnimationItem.prototype.show = function () {
35572 this.renderer.show();
35573};
35574
35575AnimationItem.prototype.getDuration = function (isFrame) {
35576 return isFrame ? this.totalFrames : this.totalFrames / this.frameRate;
35577};
35578
35579AnimationItem.prototype.trigger = function(name){
35580 if(this._cbs && this._cbs[name]){
35581 switch(name){
35582 case 'enterFrame':
35583 this.triggerEvent(name,new BMEnterFrameEvent(name,this.currentFrame,this.totalFrames,this.frameModifier));
35584 break;
35585 case 'loopComplete':
35586 this.triggerEvent(name,new BMCompleteLoopEvent(name,this.loop,this.playCount,this.frameMult));
35587 break;
35588 case 'complete':
35589 this.triggerEvent(name,new BMCompleteEvent(name,this.frameMult));
35590 break;
35591 case 'segmentStart':
35592 this.triggerEvent(name,new BMSegmentStartEvent(name,this.firstFrame,this.totalFrames));
35593 break;
35594 case 'destroy':
35595 this.triggerEvent(name,new BMDestroyEvent(name,this));
35596 break;
35597 default:
35598 this.triggerEvent(name);
35599 }
35600 }
35601 if(name === 'enterFrame' && this.onEnterFrame){
35602 this.onEnterFrame.call(this,new BMEnterFrameEvent(name,this.currentFrame,this.totalFrames,this.frameMult));
35603 }
35604 if(name === 'loopComplete' && this.onLoopComplete){
35605 this.onLoopComplete.call(this,new BMCompleteLoopEvent(name,this.loop,this.playCount,this.frameMult));
35606 }
35607 if(name === 'complete' && this.onComplete){
35608 this.onComplete.call(this,new BMCompleteEvent(name,this.frameMult));
35609 }
35610 if(name === 'segmentStart' && this.onSegmentStart){
35611 this.onSegmentStart.call(this,new BMSegmentStartEvent(name,this.firstFrame,this.totalFrames));
35612 }
35613 if(name === 'destroy' && this.onDestroy){
35614 this.onDestroy.call(this,new BMDestroyEvent(name,this));
35615 }
35616};
35617
35618var Expressions = (function(){
35619 var ob = {};
35620 ob.initExpressions = initExpressions;
35621
35622
35623 function initExpressions(animation){
35624
35625 var stackCount = 0;
35626 var registers = [];
35627
35628 function pushExpression() {
35629 stackCount += 1;
35630 }
35631
35632 function popExpression() {
35633 stackCount -= 1;
35634 if (stackCount === 0) {
35635 releaseInstances();
35636 }
35637 }
35638
35639 function registerExpressionProperty(expression) {
35640 if (registers.indexOf(expression) === -1) {
35641 registers.push(expression);
35642 }
35643 }
35644
35645 function releaseInstances() {
35646 var i, len = registers.length;
35647 for (i = 0; i < len; i += 1) {
35648 registers[i].release();
35649 }
35650 registers.length = 0;
35651 }
35652
35653 animation.renderer.compInterface = CompExpressionInterface(animation.renderer);
35654 animation.renderer.globalData.projectInterface.registerComposition(animation.renderer);
35655 animation.renderer.globalData.pushExpression = pushExpression;
35656 animation.renderer.globalData.popExpression = popExpression;
35657 animation.renderer.globalData.registerExpressionProperty = registerExpressionProperty;
35658 }
35659 return ob;
35660}());
35661
35662expressionsPlugin = Expressions;
35663
35664var ExpressionManager = (function(){
35665 var ob = {};
35666 var Math = BMMath;
35667
35668 var easeInBez = BezierFactory.getBezierEasing(0.333,0,.833,.833, 'easeIn').get;
35669 var easeOutBez = BezierFactory.getBezierEasing(0.167,0.167,.667,1, 'easeOut').get;
35670 var easeInOutBez = BezierFactory.getBezierEasing(.33,0,.667,1, 'easeInOut').get;
35671
35672 function initiateExpression(elem,data,property){
35673 var val = data.x;
35674 var needsVelocity = /velocity(?![\w\d])/.test(val);
35675 var _needsRandom = val.indexOf('random') !== -1;
35676 var elemType = elem.data.ty;
35677 var transform,content,effect;
35678 var thisProperty = property;
35679 thisProperty.valueAtTime = thisProperty.getValueAtTime;
35680 Object.defineProperty(thisProperty, 'value', {
35681 get: function() {
35682 return thisProperty.v
35683 }
35684 });
35685 elem.comp.frameDuration = 1/elem.comp.globalData.frameRate;
35686 elem.comp.displayStartTime = 0;
35687 var inPoint = elem.data.ip/elem.comp.globalData.frameRate;
35688 var outPoint = elem.data.op/elem.comp.globalData.frameRate;
35689 var width = elem.data.sw ? elem.data.sw : 0;
35690 var height = elem.data.sh ? elem.data.sh : 0;
35691 var name = elem.data.nm;
35692 var loopIn, loopOut, smooth;
35693 var toWorld,fromWorld,fromComp,toComp,anchorPoint, thisLayer,thisComp,mask,valueAtTime,velocityAtTime;
35694 var __expression_functions = [];
35695 if(data.xf) {
35696 var i, len = data.xf.length;
35697 for(i = 0; i < len; i += 1) {
35698 __expression_functions[i] = eval('(function(){ return ' + data.xf[i] + '}())');
35699 }
35700 }
35701
35702 var scoped_bm_rt;
35703 var expression_function = eval('[function _expression_function(){' + val+';scoped_bm_rt=$bm_rt}' + ']')[0];
35704 var numKeys = property.kf ? data.k.length : 0;
35705
35706 var active = !this.data || this.data.hd !== true;
35707
35708 var wiggle = function wiggle(freq,amp){
35709 var i,j, len = this.pv.length ? this.pv.length : 1;
35710 var addedAmps = createTypedArray('float32', len);
35711 freq = 5;
35712 var iterations = Math.floor(time*freq);
35713 i = 0;
35714 j = 0;
35715 while(i<iterations){
35716 //var rnd = BMMath.random();
35717 for(j=0;j<len;j+=1){
35718 addedAmps[j] += -amp + amp*2*BMMath.random();
35719 //addedAmps[j] += -amp + amp*2*rnd;
35720 }
35721 i += 1;
35722 }
35723 //var rnd2 = BMMath.random();
35724 var periods = time*freq;
35725 var perc = periods - Math.floor(periods);
35726 var arr = createTypedArray('float32', len);
35727 if(len>1){
35728 for(j=0;j<len;j+=1){
35729 arr[j] = this.pv[j] + addedAmps[j] + (-amp + amp*2*BMMath.random())*perc;
35730 //arr[j] = this.pv[j] + addedAmps[j] + (-amp + amp*2*rnd)*perc;
35731 //arr[i] = this.pv[i] + addedAmp + amp1*perc + amp2*(1-perc);
35732 }
35733 return arr;
35734 } else {
35735 return this.pv + addedAmps[0] + (-amp + amp*2*BMMath.random())*perc;
35736 }
35737 }.bind(this);
35738
35739 if(thisProperty.loopIn) {
35740 loopIn = thisProperty.loopIn.bind(thisProperty);
35741 }
35742
35743 if(thisProperty.loopOut) {
35744 loopOut = thisProperty.loopOut.bind(thisProperty);
35745 }
35746
35747 if(thisProperty.smooth) {
35748 smooth = thisProperty.smooth.bind(thisProperty);
35749 }
35750
35751 if(this.getValueAtTime) {
35752 valueAtTime = this.getValueAtTime.bind(this);
35753 }
35754
35755 if(this.getVelocityAtTime) {
35756 velocityAtTime = this.getVelocityAtTime.bind(this);
35757 }
35758
35759 var comp = elem.comp.globalData.projectInterface.bind(elem.comp.globalData.projectInterface);
35760
35761 function seedRandom(seed){
35762 BMMath.seedrandom(randSeed + seed);
35763 }
35764
35765 var time, velocity, value, text, textIndex, textTotal, selectorValue;
35766 var index = elem.data.ind;
35767 var hasParent = !!(elem.hierarchy && elem.hierarchy.length);
35768 var parent;
35769 var randSeed = Math.floor(Math.random()*1000000);
35770 var globalData = elem.globalData;
35771 function executeExpression(_value) {
35772 // globalData.pushExpression();
35773 value = _value;
35774 if (_needsRandom) {
35775 seedRandom(randSeed);
35776 }
35777 if (this.frameExpressionId === elem.globalData.frameId && this.propType !== 'textSelector') {
35778 return value;
35779 }
35780 if(this.propType === 'textSelector'){
35781 textIndex = this.textIndex;
35782 textTotal = this.textTotal;
35783 selectorValue = this.selectorValue;
35784 }
35785 if (!thisLayer) {
35786 text = elem.layerInterface.text;
35787 thisLayer = elem.layerInterface;
35788 thisComp = elem.comp.compInterface;
35789 toWorld = thisLayer.toWorld.bind(thisLayer);
35790 fromWorld = thisLayer.fromWorld.bind(thisLayer);
35791 fromComp = thisLayer.fromComp.bind(thisLayer);
35792 toComp = thisLayer.toComp.bind(thisLayer);
35793 mask = thisLayer.mask ? thisLayer.mask.bind(thisLayer) : null;
35794 }
35795 if (!transform) {
35796 transform = elem.layerInterface("ADBE Transform Group");
35797 if(transform) {
35798 anchorPoint = transform.anchorPoint;
35799 /*position = transform.position;
35800 rotation = transform.rotation;
35801 scale = transform.scale;*/
35802 }
35803 }
35804
35805 if (elemType === 4 && !content) {
35806 content = thisLayer("ADBE Root Vectors Group");
35807 }
35808 if (!effect) {
35809 effect = thisLayer(4);
35810 }
35811 hasParent = !!(elem.hierarchy && elem.hierarchy.length);
35812 if (hasParent && !parent) {
35813 parent = elem.hierarchy[0].layerInterface;
35814 }
35815 time = this.comp.renderedFrame/this.comp.globalData.frameRate;
35816 if (needsVelocity) {
35817 velocity = velocityAtTime(time);
35818 }
35819 expression_function();
35820 this.frameExpressionId = elem.globalData.frameId;
35821
35822
35823 //TODO: Check if it's possible to return on ShapeInterface the .v value
35824 if (scoped_bm_rt.propType === "shape") {
35825 scoped_bm_rt = scoped_bm_rt.v;
35826 }
35827 // globalData.popExpression();
35828 return scoped_bm_rt;
35829 }
35830 return executeExpression;
35831 }
35832
35833 ob.initiateExpression = initiateExpression;
35834 return ob;
35835}());
35836var expressionHelpers = (function(){
35837
35838 function searchExpressions(elem,data,prop){
35839 if(data.x){
35840 prop.k = true;
35841 prop.x = true;
35842 prop.initiateExpression = ExpressionManager.initiateExpression;
35843 prop.effectsSequence.push(prop.initiateExpression(elem,data,prop).bind(prop));
35844 }
35845 }
35846
35847 function getValueAtTime(frameNum) {
35848 frameNum *= this.elem.globalData.frameRate;
35849 frameNum -= this.offsetTime;
35850 if(frameNum !== this._cachingAtTime.lastFrame) {
35851 this._cachingAtTime.lastIndex = this._cachingAtTime.lastFrame < frameNum ? this._cachingAtTime.lastIndex : 0;
35852 this._cachingAtTime.value = this.interpolateValue(frameNum, this._cachingAtTime);
35853 this._cachingAtTime.lastFrame = frameNum;
35854 }
35855 return this._cachingAtTime.value;
35856
35857 }
35858
35859 function getSpeedAtTime(frameNum) {
35860 var delta = -0.01;
35861 var v1 = this.getValueAtTime(frameNum);
35862 var v2 = this.getValueAtTime(frameNum + delta);
35863 var speed = 0;
35864 if(v1.length){
35865 var i;
35866 for(i=0;i<v1.length;i+=1){
35867 speed += Math.pow(v2[i] - v1[i], 2);
35868 }
35869 speed = Math.sqrt(speed) * 100;
35870 } else {
35871 speed = 0;
35872 }
35873 return speed;
35874 }
35875
35876 function getVelocityAtTime(frameNum) {
35877 if(this.vel !== undefined){
35878 return this.vel;
35879 }
35880 var delta = -0.001;
35881 //frameNum += this.elem.data.st;
35882 var v1 = this.getValueAtTime(frameNum);
35883 var v2 = this.getValueAtTime(frameNum + delta);
35884 var velocity;
35885 if(v1.length){
35886 velocity = createTypedArray('float32', v1.length);
35887 var i;
35888 for(i=0;i<v1.length;i+=1){
35889 //removing frameRate
35890 //if needed, don't add it here
35891 //velocity[i] = this.elem.globalData.frameRate*((v2[i] - v1[i])/delta);
35892 velocity[i] = (v2[i] - v1[i])/delta;
35893 }
35894 } else {
35895 velocity = (v2 - v1)/delta;
35896 }
35897 return velocity;
35898 }
35899
35900 function getStaticValueAtTime() {
35901 return this.pv;
35902 }
35903
35904 function setGroupProperty(propertyGroup){
35905 this.propertyGroup = propertyGroup;
35906 }
35907
35908 return {
35909 searchExpressions: searchExpressions,
35910 getSpeedAtTime: getSpeedAtTime,
35911 getVelocityAtTime: getVelocityAtTime,
35912 getValueAtTime: getValueAtTime,
35913 getStaticValueAtTime: getStaticValueAtTime,
35914 setGroupProperty: setGroupProperty,
35915 }
35916}());
35917(function addPropertyDecorator() {
35918
35919 function loopOut(type,duration,durationFlag){
35920 if(!this.k || !this.keyframes){
35921 return this.pv;
35922 }
35923 type = type ? type.toLowerCase() : '';
35924 var currentFrame = this.comp.renderedFrame;
35925 var keyframes = this.keyframes;
35926 var lastKeyFrame = keyframes[keyframes.length - 1].t;
35927 if(currentFrame<=lastKeyFrame){
35928 return this.pv;
35929 }else{
35930 var cycleDuration, firstKeyFrame;
35931 if(!durationFlag){
35932 if(!duration || duration > keyframes.length - 1){
35933 duration = keyframes.length - 1;
35934 }
35935 firstKeyFrame = keyframes[keyframes.length - 1 - duration].t;
35936 cycleDuration = lastKeyFrame - firstKeyFrame;
35937 } else {
35938 if(!duration){
35939 cycleDuration = Math.max(0,lastKeyFrame - this.elem.data.ip);
35940 } else {
35941 cycleDuration = Math.abs(lastKeyFrame - elem.comp.globalData.frameRate*duration);
35942 }
35943 firstKeyFrame = lastKeyFrame - cycleDuration;
35944 }
35945 var i, len, ret;
35946 if(type === 'pingpong') {
35947 var iterations = Math.floor((currentFrame - firstKeyFrame)/cycleDuration);
35948 if(iterations % 2 !== 0){
35949 return this.getValueAtTime(((cycleDuration - (currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0);
35950 }
35951 } else if(type === 'offset'){
35952 var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);
35953 var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);
35954 var current = this.getValueAtTime(((currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0);
35955 var repeats = Math.floor((currentFrame - firstKeyFrame)/cycleDuration);
35956 if(this.pv.length){
35957 ret = new Array(initV.length);
35958 len = ret.length;
35959 for(i=0;i<len;i+=1){
35960 ret[i] = (endV[i]-initV[i])*repeats + current[i];
35961 }
35962 return ret;
35963 }
35964 return (endV-initV)*repeats + current;
35965 } else if(type === 'continue'){
35966 var lastValue = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);
35967 var nextLastValue = this.getValueAtTime((lastKeyFrame - 0.001) / this.comp.globalData.frameRate, 0);
35968 if(this.pv.length){
35969 ret = new Array(lastValue.length);
35970 len = ret.length;
35971 for(i=0;i<len;i+=1){
35972 ret[i] = lastValue[i] + (lastValue[i]-nextLastValue[i])*((currentFrame - lastKeyFrame)/ this.comp.globalData.frameRate)/0.0005;
35973 }
35974 return ret;
35975 }
35976 return lastValue + (lastValue-nextLastValue)*(((currentFrame - lastKeyFrame))/0.001);
35977 }
35978 return this.getValueAtTime((((currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0);
35979 }
35980 }
35981
35982 function loopIn(type,duration, durationFlag) {
35983 if(!this.k){
35984 return this.pv;
35985 }
35986 type = type ? type.toLowerCase() : '';
35987 var currentFrame = this.comp.renderedFrame;
35988 var keyframes = this.keyframes;
35989 var firstKeyFrame = keyframes[0].t;
35990 if(currentFrame>=firstKeyFrame){
35991 return this.pv;
35992 }else{
35993 var cycleDuration, lastKeyFrame;
35994 if(!durationFlag){
35995 if(!duration || duration > keyframes.length - 1){
35996 duration = keyframes.length - 1;
35997 }
35998 lastKeyFrame = keyframes[duration].t;
35999 cycleDuration = lastKeyFrame - firstKeyFrame;
36000 } else {
36001 if(!duration){
36002 cycleDuration = Math.max(0,this.elem.data.op - firstKeyFrame);
36003 } else {
36004 cycleDuration = Math.abs(elem.comp.globalData.frameRate*duration);
36005 }
36006 lastKeyFrame = firstKeyFrame + cycleDuration;
36007 }
36008 var i, len, ret;
36009 if(type === 'pingpong') {
36010 var iterations = Math.floor((firstKeyFrame - currentFrame)/cycleDuration);
36011 if(iterations % 2 === 0){
36012 return this.getValueAtTime((((firstKeyFrame - currentFrame)%cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0);
36013 }
36014 } else if(type === 'offset'){
36015 var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);
36016 var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);
36017 var current = this.getValueAtTime((cycleDuration - (firstKeyFrame - currentFrame)%cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0);
36018 var repeats = Math.floor((firstKeyFrame - currentFrame)/cycleDuration)+1;
36019 if(this.pv.length){
36020 ret = new Array(initV.length);
36021 len = ret.length;
36022 for(i=0;i<len;i+=1){
36023 ret[i] = current[i]-(endV[i]-initV[i])*repeats;
36024 }
36025 return ret;
36026 }
36027 return current-(endV-initV)*repeats;
36028 } else if(type === 'continue'){
36029 var firstValue = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);
36030 var nextFirstValue = this.getValueAtTime((firstKeyFrame + 0.001) / this.comp.globalData.frameRate, 0);
36031 if(this.pv.length){
36032 ret = new Array(firstValue.length);
36033 len = ret.length;
36034 for(i=0;i<len;i+=1){
36035 ret[i] = firstValue[i] + (firstValue[i]-nextFirstValue[i])*(firstKeyFrame - currentFrame)/0.001;
36036 }
36037 return ret;
36038 }
36039 return firstValue + (firstValue-nextFirstValue)*(firstKeyFrame - currentFrame)/0.001;
36040 }
36041 return this.getValueAtTime(((cycleDuration - (firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0);
36042 }
36043 }
36044
36045 function smooth(width, samples) {
36046 if (!this.k){
36047 return this.pv;
36048 }
36049 width = (width || 0.4) * 0.5;
36050 samples = Math.floor(samples || 5);
36051 if (samples <= 1) {
36052 return this.pv;
36053 }
36054 var currentTime = this.comp.renderedFrame / this.comp.globalData.frameRate;
36055 var initFrame = currentTime - width;
36056 var endFrame = currentTime + width;
36057 var sampleFrequency = samples > 1 ? (endFrame - initFrame) / (samples - 1) : 1;
36058 var i = 0, j = 0;
36059 var value;
36060 if (this.pv.length) {
36061 value = createTypedArray('float32', this.pv.length);
36062 } else {
36063 value = 0;
36064 }
36065 var sampleValue;
36066 while (i < samples) {
36067 sampleValue = this.getValueAtTime(initFrame + i * sampleFrequency);
36068 if(this.pv.length) {
36069 for (j = 0; j < this.pv.length; j += 1) {
36070 value[j] += sampleValue[j];
36071 }
36072 } else {
36073 value += sampleValue;
36074 }
36075 i += 1;
36076 }
36077 if(this.pv.length) {
36078 for (j = 0; j < this.pv.length; j += 1) {
36079 value[j] /= samples;
36080 }
36081 } else {
36082 value /= samples;
36083 }
36084 return value;
36085 }
36086
36087 function getTransformValueAtTime(time) {
36088 console.warn('Transform at time not supported');
36089 }
36090
36091 function getTransformStaticValueAtTime(time) {
36092
36093 }
36094
36095 var getTransformProperty = TransformPropertyFactory.getTransformProperty;
36096 TransformPropertyFactory.getTransformProperty = function(elem, data, container) {
36097 var prop = getTransformProperty(elem, data, container);
36098 if(prop.dynamicProperties.length) {
36099 prop.getValueAtTime = getTransformValueAtTime.bind(prop);
36100 } else {
36101 prop.getValueAtTime = getTransformStaticValueAtTime.bind(prop);
36102 }
36103 prop.setGroupProperty = expressionHelpers.setGroupProperty;
36104 return prop;
36105 };
36106
36107 var propertyGetProp = PropertyFactory.getProp;
36108 PropertyFactory.getProp = function(elem,data,type, mult, container){
36109 var prop = propertyGetProp(elem,data,type, mult, container);
36110 //prop.getVelocityAtTime = getVelocityAtTime;
36111 //prop.loopOut = loopOut;
36112 //prop.loopIn = loopIn;
36113 if(prop.kf){
36114 prop.getValueAtTime = expressionHelpers.getValueAtTime.bind(prop);
36115 } else {
36116 prop.getValueAtTime = expressionHelpers.getStaticValueAtTime.bind(prop);
36117 }
36118 prop.setGroupProperty = expressionHelpers.setGroupProperty;
36119 prop.loopOut = loopOut;
36120 prop.loopIn = loopIn;
36121 prop.smooth = smooth;
36122 prop.getVelocityAtTime = expressionHelpers.getVelocityAtTime.bind(prop);
36123 prop.getSpeedAtTime = expressionHelpers.getSpeedAtTime.bind(prop);
36124 prop.numKeys = data.a === 1 ? data.k.length : 0;
36125 prop.propertyIndex = data.ix;
36126 var value = 0;
36127 if(type !== 0) {
36128 value = createTypedArray('float32', data.a === 1 ? data.k[0].s.length : data.k.length);
36129 }
36130 prop._cachingAtTime = {
36131 lastFrame: initialDefaultFrame,
36132 lastIndex: 0,
36133 value: value
36134 };
36135 expressionHelpers.searchExpressions(elem,data,prop);
36136 if(prop.k){
36137 container.addDynamicProperty(prop);
36138 }
36139
36140 return prop;
36141 };
36142
36143 function getShapeValueAtTime(frameNum) {
36144 //For now this caching object is created only when needed instead of creating it when the shape is initialized.
36145 if (!this._cachingAtTime) {
36146 this._cachingAtTime = {
36147 shapeValue: shape_pool.clone(this.pv),
36148 lastIndex: 0,
36149 lastTime: initialDefaultFrame
36150 };
36151 }
36152
36153 frameNum *= this.elem.globalData.frameRate;
36154 frameNum -= this.offsetTime;
36155 if(frameNum !== this._cachingAtTime.lastTime) {
36156 this._cachingAtTime.lastIndex = this._cachingAtTime.lastTime < frameNum ? this._caching.lastIndex : 0;
36157 this._cachingAtTime.lastTime = frameNum;
36158 this.interpolateShape(frameNum, this._cachingAtTime.shapeValue, this._cachingAtTime);
36159 }
36160 return this._cachingAtTime.shapeValue;
36161 }
36162
36163 var ShapePropertyConstructorFunction = ShapePropertyFactory.getConstructorFunction();
36164 var KeyframedShapePropertyConstructorFunction = ShapePropertyFactory.getKeyframedConstructorFunction();
36165
36166 function ShapeExpressions(){}
36167 ShapeExpressions.prototype = {
36168 vertices: function(prop, time){
36169 if (this.k) {
36170 this.getValue();
36171 }
36172 var shapePath = this.v;
36173 if(time !== undefined) {
36174 shapePath = this.getValueAtTime(time, 0);
36175 }
36176 var i, len = shapePath._length;
36177 var vertices = shapePath[prop];
36178 var points = shapePath.v;
36179 var arr = createSizedArray(len);
36180 for(i = 0; i < len; i += 1) {
36181 if(prop === 'i' || prop === 'o') {
36182 arr[i] = [vertices[i][0] - points[i][0], vertices[i][1] - points[i][1]];
36183 } else {
36184 arr[i] = [vertices[i][0], vertices[i][1]];
36185 }
36186
36187 }
36188 return arr;
36189 },
36190 points: function(time){
36191 return this.vertices('v', time);
36192 },
36193 inTangents: function(time){
36194 return this.vertices('i', time);
36195 },
36196 outTangents: function(time){
36197 return this.vertices('o', time);
36198 },
36199 isClosed: function(){
36200 return this.v.c;
36201 },
36202 pointOnPath: function(perc, time){
36203 var shapePath = this.v;
36204 if(time !== undefined) {
36205 shapePath = this.getValueAtTime(time, 0);
36206 }
36207 if(!this._segmentsLength) {
36208 this._segmentsLength = bez.getSegmentsLength(shapePath);
36209 }
36210
36211 var segmentsLength = this._segmentsLength;
36212 var lengths = segmentsLength.lengths;
36213 var lengthPos = segmentsLength.totalLength * perc;
36214 var i = 0, len = lengths.length;
36215 var accumulatedLength = 0, pt;
36216 while(i < len) {
36217 if(accumulatedLength + lengths[i].addedLength > lengthPos) {
36218 var initIndex = i;
36219 var endIndex = (shapePath.c && i === len - 1) ? 0 : i + 1;
36220 var segmentPerc = (lengthPos - accumulatedLength)/lengths[i].addedLength;
36221 pt = bez.getPointInSegment(shapePath.v[initIndex], shapePath.v[endIndex], shapePath.o[initIndex], shapePath.i[endIndex], segmentPerc, lengths[i]);
36222 break;
36223 } else {
36224 accumulatedLength += lengths[i].addedLength;
36225 }
36226 i += 1;
36227 }
36228 if(!pt){
36229 pt = shapePath.c ? [shapePath.v[0][0],shapePath.v[0][1]]:[shapePath.v[shapePath._length-1][0],shapePath.v[shapePath._length-1][1]];
36230 }
36231 return pt;
36232 },
36233 vectorOnPath: function(perc, time, vectorType){
36234 //perc doesn't use triple equality because it can be a Number object as well as a primitive.
36235 perc = perc == 1 ? this.v.c ? 0 : 0.999 : perc;
36236 var pt1 = this.pointOnPath(perc, time);
36237 var pt2 = this.pointOnPath(perc + 0.001, time);
36238 var xLength = pt2[0] - pt1[0];
36239 var yLength = pt2[1] - pt1[1];
36240 var magnitude = Math.sqrt(Math.pow(xLength,2) + Math.pow(yLength,2));
36241 var unitVector = vectorType === 'tangent' ? [xLength/magnitude, yLength/magnitude] : [-yLength/magnitude, xLength/magnitude];
36242 return unitVector;
36243 },
36244 tangentOnPath: function(perc, time){
36245 return this.vectorOnPath(perc, time, 'tangent');
36246 },
36247 normalOnPath: function(perc, time){
36248 return this.vectorOnPath(perc, time, 'normal');
36249 },
36250 setGroupProperty: expressionHelpers.setGroupProperty,
36251 getValueAtTime: expressionHelpers.getStaticValueAtTime
36252 };
36253 extendPrototype([ShapeExpressions], ShapePropertyConstructorFunction);
36254 extendPrototype([ShapeExpressions], KeyframedShapePropertyConstructorFunction);
36255 KeyframedShapePropertyConstructorFunction.prototype.getValueAtTime = getShapeValueAtTime;
36256 KeyframedShapePropertyConstructorFunction.prototype.initiateExpression = ExpressionManager.initiateExpression;
36257
36258 var propertyGetShapeProp = ShapePropertyFactory.getShapeProp;
36259 ShapePropertyFactory.getShapeProp = function(elem,data,type, arr, trims){
36260 var prop = propertyGetShapeProp(elem,data,type, arr, trims);
36261 prop.propertyIndex = data.ix;
36262 prop.lock = false;
36263 if(type === 3){
36264 expressionHelpers.searchExpressions(elem,data.pt,prop);
36265 } else if(type === 4){
36266 expressionHelpers.searchExpressions(elem,data.ks,prop);
36267 }
36268 if(prop.k){
36269 elem.addDynamicProperty(prop);
36270 }
36271 return prop;
36272 };
36273}());
36274(function addDecorator() {
36275
36276 function searchExpressions(){
36277 if(this.data.d.x){
36278 this.calculateExpression = ExpressionManager.initiateExpression.bind(this)(this.elem,this.data.d,this);
36279 this.addEffect(this.getExpressionValue.bind(this));
36280 return true;
36281 }
36282 }
36283
36284 TextProperty.prototype.getExpressionValue = function(currentValue, text) {
36285 var newValue = this.calculateExpression(text);
36286 if(currentValue.t !== newValue) {
36287 var newData = {};
36288 this.copyData(newData, currentValue);
36289 newData.t = newValue.toString();
36290 newData.__complete = false;
36291 return newData;
36292 }
36293 return currentValue;
36294 };
36295
36296 TextProperty.prototype.searchProperty = function(){
36297
36298 var isKeyframed = this.searchKeyframes();
36299 var hasExpressions = this.searchExpressions();
36300 this.kf = isKeyframed || hasExpressions;
36301 return this.kf;
36302 };
36303
36304 TextProperty.prototype.searchExpressions = searchExpressions;
36305
36306}());
36307var ShapeExpressionInterface = (function(){
36308
36309 function iterateElements(shapes,view, propertyGroup){
36310 var arr = [];
36311 var i, len = shapes ? shapes.length : 0;
36312 for(i=0;i<len;i+=1){
36313 if(shapes[i].ty == 'gr'){
36314 arr.push(groupInterfaceFactory(shapes[i],view[i],propertyGroup));
36315 }else if(shapes[i].ty == 'fl'){
36316 arr.push(fillInterfaceFactory(shapes[i],view[i],propertyGroup));
36317 }else if(shapes[i].ty == 'st'){
36318 arr.push(strokeInterfaceFactory(shapes[i],view[i],propertyGroup));
36319 }else if(shapes[i].ty == 'tm'){
36320 arr.push(trimInterfaceFactory(shapes[i],view[i],propertyGroup));
36321 }else if(shapes[i].ty == 'tr');else if(shapes[i].ty == 'el'){
36322 arr.push(ellipseInterfaceFactory(shapes[i],view[i],propertyGroup));
36323 }else if(shapes[i].ty == 'sr'){
36324 arr.push(starInterfaceFactory(shapes[i],view[i],propertyGroup));
36325 } else if(shapes[i].ty == 'sh'){
36326 arr.push(pathInterfaceFactory(shapes[i],view[i],propertyGroup));
36327 } else if(shapes[i].ty == 'rc'){
36328 arr.push(rectInterfaceFactory(shapes[i],view[i],propertyGroup));
36329 } else if(shapes[i].ty == 'rd'){
36330 arr.push(roundedInterfaceFactory(shapes[i],view[i],propertyGroup));
36331 } else if(shapes[i].ty == 'rp'){
36332 arr.push(repeaterInterfaceFactory(shapes[i],view[i],propertyGroup));
36333 }
36334 }
36335 return arr;
36336 }
36337
36338 function contentsInterfaceFactory(shape,view, propertyGroup){
36339 var interfaces;
36340 var interfaceFunction = function _interfaceFunction(value){
36341 var i = 0, len = interfaces.length;
36342 while(i<len){
36343 if(interfaces[i]._name === value || interfaces[i].mn === value || interfaces[i].propertyIndex === value || interfaces[i].ix === value || interfaces[i].ind === value){
36344 return interfaces[i];
36345 }
36346 i+=1;
36347 }
36348 if(typeof value === 'number'){
36349 return interfaces[value-1];
36350 }
36351 };
36352 interfaceFunction.propertyGroup = function(val){
36353 if(val === 1){
36354 return interfaceFunction;
36355 } else{
36356 return propertyGroup(val-1);
36357 }
36358 };
36359 interfaces = iterateElements(shape.it, view.it, interfaceFunction.propertyGroup);
36360 interfaceFunction.numProperties = interfaces.length;
36361 interfaceFunction.propertyIndex = shape.cix;
36362 interfaceFunction._name = shape.nm;
36363
36364 return interfaceFunction;
36365 }
36366
36367 function groupInterfaceFactory(shape,view, propertyGroup){
36368 var interfaceFunction = function _interfaceFunction(value){
36369 switch(value){
36370 case 'ADBE Vectors Group':
36371 case 'Contents':
36372 case 2:
36373 return interfaceFunction.content;
36374 //Not necessary for now. Keeping them here in case a new case appears
36375 //case 'ADBE Vector Transform Group':
36376 //case 3:
36377 default:
36378 return interfaceFunction.transform;
36379 }
36380 };
36381 interfaceFunction.propertyGroup = function(val){
36382 if(val === 1){
36383 return interfaceFunction;
36384 } else{
36385 return propertyGroup(val-1);
36386 }
36387 };
36388 var content = contentsInterfaceFactory(shape,view,interfaceFunction.propertyGroup);
36389 var transformInterface = transformInterfaceFactory(shape.it[shape.it.length - 1],view.it[view.it.length - 1],interfaceFunction.propertyGroup);
36390 interfaceFunction.content = content;
36391 interfaceFunction.transform = transformInterface;
36392 Object.defineProperty(interfaceFunction, '_name', {
36393 get: function(){
36394 return shape.nm;
36395 }
36396 });
36397 //interfaceFunction.content = interfaceFunction;
36398 interfaceFunction.numProperties = shape.np;
36399 interfaceFunction.propertyIndex = shape.ix;
36400 interfaceFunction.nm = shape.nm;
36401 interfaceFunction.mn = shape.mn;
36402 return interfaceFunction;
36403 }
36404
36405 function fillInterfaceFactory(shape,view,propertyGroup){
36406 function interfaceFunction(val){
36407 if(val === 'Color' || val === 'color'){
36408 return interfaceFunction.color;
36409 } else if(val === 'Opacity' || val === 'opacity'){
36410 return interfaceFunction.opacity;
36411 }
36412 }
36413 Object.defineProperties(interfaceFunction, {
36414 'color': {
36415 get: ExpressionPropertyInterface(view.c)
36416 },
36417 'opacity': {
36418 get: ExpressionPropertyInterface(view.o)
36419 },
36420 '_name': { value: shape.nm },
36421 'mn': { value: shape.mn }
36422 });
36423
36424 view.c.setGroupProperty(propertyGroup);
36425 view.o.setGroupProperty(propertyGroup);
36426 return interfaceFunction;
36427 }
36428
36429 function strokeInterfaceFactory(shape,view,propertyGroup){
36430 function _propertyGroup(val){
36431 if(val === 1){
36432 return ob;
36433 } else{
36434 return propertyGroup(val-1);
36435 }
36436 }
36437 function _dashPropertyGroup(val){
36438 if(val === 1){
36439 return dashOb;
36440 } else{
36441 return _propertyGroup(val-1);
36442 }
36443 }
36444 function addPropertyToDashOb(i) {
36445 Object.defineProperty(dashOb, shape.d[i].nm, {
36446 get: ExpressionPropertyInterface(view.d.dataProps[i].p)
36447 });
36448 }
36449 var i, len = shape.d ? shape.d.length : 0;
36450 var dashOb = {};
36451 for (i = 0; i < len; i += 1) {
36452 addPropertyToDashOb(i);
36453 view.d.dataProps[i].p.setGroupProperty(_dashPropertyGroup);
36454 }
36455
36456 function interfaceFunction(val){
36457 if(val === 'Color' || val === 'color'){
36458 return interfaceFunction.color;
36459 } else if(val === 'Opacity' || val === 'opacity'){
36460 return interfaceFunction.opacity;
36461 } else if(val === 'Stroke Width' || val === 'stroke width'){
36462 return interfaceFunction.strokeWidth;
36463 }
36464 }
36465 Object.defineProperties(interfaceFunction, {
36466 'color': {
36467 get: ExpressionPropertyInterface(view.c)
36468 },
36469 'opacity': {
36470 get: ExpressionPropertyInterface(view.o)
36471 },
36472 'strokeWidth': {
36473 get: ExpressionPropertyInterface(view.w)
36474 },
36475 'dash': {
36476 get: function() {
36477 return dashOb;
36478 }
36479 },
36480 '_name': { value: shape.nm },
36481 'mn': { value: shape.mn }
36482 });
36483
36484 view.c.setGroupProperty(_propertyGroup);
36485 view.o.setGroupProperty(_propertyGroup);
36486 view.w.setGroupProperty(_propertyGroup);
36487 return interfaceFunction;
36488 }
36489
36490 function trimInterfaceFactory(shape,view,propertyGroup){
36491 function _propertyGroup(val){
36492 if(val == 1){
36493 return interfaceFunction;
36494 } else {
36495 return propertyGroup(--val);
36496 }
36497 }
36498 interfaceFunction.propertyIndex = shape.ix;
36499
36500 view.s.setGroupProperty(_propertyGroup);
36501 view.e.setGroupProperty(_propertyGroup);
36502 view.o.setGroupProperty(_propertyGroup);
36503
36504 function interfaceFunction(val){
36505 if(val === shape.e.ix || val === 'End' || val === 'end'){
36506 return interfaceFunction.end;
36507 }
36508 if(val === shape.s.ix){
36509 return interfaceFunction.start;
36510 }
36511 if(val === shape.o.ix){
36512 return interfaceFunction.offset;
36513 }
36514 }
36515 interfaceFunction.propertyIndex = shape.ix;
36516 interfaceFunction.propertyGroup = propertyGroup;
36517
36518 Object.defineProperties(interfaceFunction, {
36519 'start': {
36520 get: ExpressionPropertyInterface(view.s)
36521 },
36522 'end': {
36523 get: ExpressionPropertyInterface(view.e)
36524 },
36525 'offset': {
36526 get: ExpressionPropertyInterface(view.o)
36527 },
36528 '_name': { value: shape.nm }
36529 });
36530 interfaceFunction.mn = shape.mn;
36531 return interfaceFunction;
36532 }
36533
36534 function transformInterfaceFactory(shape,view,propertyGroup){
36535 function _propertyGroup(val){
36536 if(val == 1){
36537 return interfaceFunction;
36538 } else {
36539 return propertyGroup(--val);
36540 }
36541 }
36542 view.transform.mProps.o.setGroupProperty(_propertyGroup);
36543 view.transform.mProps.p.setGroupProperty(_propertyGroup);
36544 view.transform.mProps.a.setGroupProperty(_propertyGroup);
36545 view.transform.mProps.s.setGroupProperty(_propertyGroup);
36546 view.transform.mProps.r.setGroupProperty(_propertyGroup);
36547 if(view.transform.mProps.sk){
36548 view.transform.mProps.sk.setGroupProperty(_propertyGroup);
36549 view.transform.mProps.sa.setGroupProperty(_propertyGroup);
36550 }
36551 view.transform.op.setGroupProperty(_propertyGroup);
36552
36553 function interfaceFunction(value){
36554 if(shape.a.ix === value || value === 'Anchor Point'){
36555 return interfaceFunction.anchorPoint;
36556 }
36557 if(shape.o.ix === value || value === 'Opacity'){
36558 return interfaceFunction.opacity;
36559 }
36560 if(shape.p.ix === value || value === 'Position'){
36561 return interfaceFunction.position;
36562 }
36563 if(shape.r.ix === value || value === 'Rotation' || value === 'ADBE Vector Rotation'){
36564 return interfaceFunction.rotation;
36565 }
36566 if(shape.s.ix === value || value === 'Scale'){
36567 return interfaceFunction.scale;
36568 }
36569 if(shape.sk && shape.sk.ix === value || value === 'Skew'){
36570 return interfaceFunction.skew;
36571 }
36572 if(shape.sa && shape.sa.ix === value || value === 'Skew Axis'){
36573 return interfaceFunction.skewAxis;
36574 }
36575
36576 }
36577 Object.defineProperties(interfaceFunction, {
36578 'opacity': {
36579 get: ExpressionPropertyInterface(view.transform.mProps.o)
36580 },
36581 'position': {
36582 get: ExpressionPropertyInterface(view.transform.mProps.p)
36583 },
36584 'anchorPoint': {
36585 get: ExpressionPropertyInterface(view.transform.mProps.a)
36586 },
36587 'scale': {
36588 get: ExpressionPropertyInterface(view.transform.mProps.s)
36589 },
36590 'rotation': {
36591 get: ExpressionPropertyInterface(view.transform.mProps.r)
36592 },
36593 'skew': {
36594 get: ExpressionPropertyInterface(view.transform.mProps.sk)
36595 },
36596 'skewAxis': {
36597 get: ExpressionPropertyInterface(view.transform.mProps.sa)
36598 },
36599 '_name': { value: shape.nm }
36600 });
36601 interfaceFunction.ty = 'tr';
36602 interfaceFunction.mn = shape.mn;
36603 interfaceFunction.propertyGroup = propertyGroup;
36604 return interfaceFunction;
36605 }
36606
36607 function ellipseInterfaceFactory(shape,view,propertyGroup){
36608 function _propertyGroup(val){
36609 if(val == 1){
36610 return interfaceFunction;
36611 } else {
36612 return propertyGroup(--val);
36613 }
36614 }
36615 interfaceFunction.propertyIndex = shape.ix;
36616 var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;
36617 prop.s.setGroupProperty(_propertyGroup);
36618 prop.p.setGroupProperty(_propertyGroup);
36619 function interfaceFunction(value){
36620 if(shape.p.ix === value){
36621 return interfaceFunction.position;
36622 }
36623 if(shape.s.ix === value){
36624 return interfaceFunction.size;
36625 }
36626 }
36627
36628 Object.defineProperties(interfaceFunction, {
36629 'size': {
36630 get: ExpressionPropertyInterface(prop.s)
36631 },
36632 'position': {
36633 get: ExpressionPropertyInterface(prop.p)
36634 },
36635 '_name': { value: shape.nm }
36636 });
36637 interfaceFunction.mn = shape.mn;
36638 return interfaceFunction;
36639 }
36640
36641 function starInterfaceFactory(shape,view,propertyGroup){
36642 function _propertyGroup(val){
36643 if(val == 1){
36644 return interfaceFunction;
36645 } else {
36646 return propertyGroup(--val);
36647 }
36648 }
36649 var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;
36650 interfaceFunction.propertyIndex = shape.ix;
36651 prop.or.setGroupProperty(_propertyGroup);
36652 prop.os.setGroupProperty(_propertyGroup);
36653 prop.pt.setGroupProperty(_propertyGroup);
36654 prop.p.setGroupProperty(_propertyGroup);
36655 prop.r.setGroupProperty(_propertyGroup);
36656 if(shape.ir){
36657 prop.ir.setGroupProperty(_propertyGroup);
36658 prop.is.setGroupProperty(_propertyGroup);
36659 }
36660
36661 function interfaceFunction(value){
36662 if(shape.p.ix === value){
36663 return interfaceFunction.position;
36664 }
36665 if(shape.r.ix === value){
36666 return interfaceFunction.rotation;
36667 }
36668 if(shape.pt.ix === value){
36669 return interfaceFunction.points;
36670 }
36671 if(shape.or.ix === value || 'ADBE Vector Star Outer Radius' === value){
36672 return interfaceFunction.outerRadius;
36673 }
36674 if(shape.os.ix === value){
36675 return interfaceFunction.outerRoundness;
36676 }
36677 if(shape.ir && (shape.ir.ix === value || 'ADBE Vector Star Inner Radius' === value)){
36678 return interfaceFunction.innerRadius;
36679 }
36680 if(shape.is && shape.is.ix === value){
36681 return interfaceFunction.innerRoundness;
36682 }
36683
36684 }
36685
36686 Object.defineProperties(interfaceFunction, {
36687 'position': {
36688 get: ExpressionPropertyInterface(prop.p)
36689 },
36690 'rotation': {
36691 get: ExpressionPropertyInterface(prop.r)
36692 },
36693 'points': {
36694 get: ExpressionPropertyInterface(prop.pt)
36695 },
36696 'outerRadius': {
36697 get: ExpressionPropertyInterface(prop.or)
36698 },
36699 'outerRoundness': {
36700 get: ExpressionPropertyInterface(prop.os)
36701 },
36702 'innerRadius': {
36703 get: ExpressionPropertyInterface(prop.ir)
36704 },
36705 'innerRoundness': {
36706 get: ExpressionPropertyInterface(prop.is)
36707 },
36708 '_name': { value: shape.nm }
36709 });
36710 interfaceFunction.mn = shape.mn;
36711 return interfaceFunction;
36712 }
36713
36714 function rectInterfaceFactory(shape,view,propertyGroup){
36715 function _propertyGroup(val){
36716 if(val == 1){
36717 return interfaceFunction;
36718 } else {
36719 return propertyGroup(--val);
36720 }
36721 }
36722 var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;
36723 interfaceFunction.propertyIndex = shape.ix;
36724 prop.p.setGroupProperty(_propertyGroup);
36725 prop.s.setGroupProperty(_propertyGroup);
36726 prop.r.setGroupProperty(_propertyGroup);
36727
36728 function interfaceFunction(value){
36729 if(shape.p.ix === value){
36730 return interfaceFunction.position;
36731 }
36732 if(shape.r.ix === value){
36733 return interfaceFunction.roundness;
36734 }
36735 if(shape.s.ix === value || value === 'Size' || value === 'ADBE Vector Rect Size'){
36736 return interfaceFunction.size;
36737 }
36738
36739 }
36740 Object.defineProperties(interfaceFunction, {
36741 'position': {
36742 get: ExpressionPropertyInterface(prop.p)
36743 },
36744 'roundness': {
36745 get: ExpressionPropertyInterface(prop.r)
36746 },
36747 'size': {
36748 get: ExpressionPropertyInterface(prop.s)
36749 },
36750 '_name': { value: shape.nm }
36751 });
36752 interfaceFunction.mn = shape.mn;
36753 return interfaceFunction;
36754 }
36755
36756 function roundedInterfaceFactory(shape,view,propertyGroup){
36757 function _propertyGroup(val){
36758 if(val == 1){
36759 return interfaceFunction;
36760 } else {
36761 return propertyGroup(--val);
36762 }
36763 }
36764 var prop = view;
36765 interfaceFunction.propertyIndex = shape.ix;
36766 prop.rd.setGroupProperty(_propertyGroup);
36767
36768 function interfaceFunction(value){
36769 if(shape.r.ix === value || 'Round Corners 1' === value){
36770 return interfaceFunction.radius;
36771 }
36772
36773 }
36774 Object.defineProperties(interfaceFunction, {
36775 'radius': {
36776 get: ExpressionPropertyInterface(prop.rd)
36777 },
36778 '_name': { value: shape.nm }
36779 });
36780 interfaceFunction.mn = shape.mn;
36781 return interfaceFunction;
36782 }
36783
36784 function repeaterInterfaceFactory(shape,view,propertyGroup){
36785 function _propertyGroup(val){
36786 if(val == 1){
36787 return interfaceFunction;
36788 } else {
36789 return propertyGroup(--val);
36790 }
36791 }
36792 var prop = view;
36793 interfaceFunction.propertyIndex = shape.ix;
36794 prop.c.setGroupProperty(_propertyGroup);
36795 prop.o.setGroupProperty(_propertyGroup);
36796
36797 function interfaceFunction(value){
36798 if(shape.c.ix === value || 'Copies' === value){
36799 return interfaceFunction.copies;
36800 } else if(shape.o.ix === value || 'Offset' === value){
36801 return interfaceFunction.offset;
36802 }
36803
36804 }
36805 Object.defineProperties(interfaceFunction, {
36806 'copies': {
36807 get: ExpressionPropertyInterface(prop.c)
36808 },
36809 'offset': {
36810 get: ExpressionPropertyInterface(prop.o)
36811 },
36812 '_name': { value: shape.nm }
36813 });
36814 interfaceFunction.mn = shape.mn;
36815 return interfaceFunction;
36816 }
36817
36818 function pathInterfaceFactory(shape,view,propertyGroup){
36819 var prop = view.sh;
36820 function _propertyGroup(val){
36821 if(val == 1){
36822 return interfaceFunction;
36823 } else {
36824 return propertyGroup(--val);
36825 }
36826 }
36827 prop.setGroupProperty(_propertyGroup);
36828
36829 function interfaceFunction(val){
36830 if(val === 'Shape' || val === 'shape' || val === 'Path' || val === 'path' || val === 'ADBE Vector Shape' || val === 2){
36831 return interfaceFunction.path;
36832 }
36833 }
36834 Object.defineProperties(interfaceFunction, {
36835 'path': {
36836 get: function(){
36837 if(prop.k){
36838 prop.getValue();
36839 }
36840 return prop;
36841 }
36842 },
36843 'shape': {
36844 get: function(){
36845 if(prop.k){
36846 prop.getValue();
36847 }
36848 return prop;
36849 }
36850 },
36851 '_name': { value: shape.nm },
36852 'ix': { value: shape.ix },
36853 'mn': { value: shape.mn }
36854 });
36855 return interfaceFunction;
36856 }
36857
36858 return function(shapes,view,propertyGroup) {
36859 var interfaces;
36860 function _interfaceFunction(value){
36861 if(typeof value === 'number'){
36862 return interfaces[value-1];
36863 } else {
36864 var i = 0, len = interfaces.length;
36865 while(i<len){
36866 if(interfaces[i]._name === value){
36867 return interfaces[i];
36868 }
36869 i+=1;
36870 }
36871 }
36872 }
36873 _interfaceFunction.propertyGroup = propertyGroup;
36874 interfaces = iterateElements(shapes, view, _interfaceFunction);
36875 _interfaceFunction.numProperties = interfaces.length;
36876 return _interfaceFunction;
36877 };
36878}());
36879
36880var TextExpressionInterface = (function(){
36881 return function(elem){
36882 var _prevValue, _sourceText;
36883 function _thisLayerFunction(){
36884 }
36885 Object.defineProperty(_thisLayerFunction, "sourceText", {
36886 get: function(){
36887 elem.textProperty.getValue();
36888 var stringValue = elem.textProperty.currentData.t;
36889 if(stringValue !== _prevValue) {
36890 elem.textProperty.currentData.t = _prevValue;
36891 _sourceText = new String(stringValue);
36892 //If stringValue is an empty string, eval returns undefined, so it has to be returned as a String primitive
36893 _sourceText.value = stringValue ? stringValue : new String(stringValue);
36894 }
36895 return _sourceText;
36896 }
36897 });
36898 return _thisLayerFunction;
36899 };
36900}());
36901var LayerExpressionInterface = (function (){
36902 function toWorld(arr, time){
36903 var toWorldMat = new Matrix();
36904 toWorldMat.reset();
36905 var transformMat;
36906 if(time) {
36907 //Todo implement value at time on transform properties
36908 //transformMat = this._elem.finalTransform.mProp.getValueAtTime(time);
36909 transformMat = this._elem.finalTransform.mProp;
36910 } else {
36911 transformMat = this._elem.finalTransform.mProp;
36912 }
36913 transformMat.applyToMatrix(toWorldMat);
36914 if(this._elem.hierarchy && this._elem.hierarchy.length){
36915 var i, len = this._elem.hierarchy.length;
36916 for(i=0;i<len;i+=1){
36917 this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(toWorldMat);
36918 }
36919 return toWorldMat.applyToPointArray(arr[0],arr[1],arr[2]||0);
36920 }
36921 return toWorldMat.applyToPointArray(arr[0],arr[1],arr[2]||0);
36922 }
36923 function fromWorld(arr, time){
36924 var toWorldMat = new Matrix();
36925 toWorldMat.reset();
36926 var transformMat;
36927 if(time) {
36928 //Todo implement value at time on transform properties
36929 //transformMat = this._elem.finalTransform.mProp.getValueAtTime(time);
36930 transformMat = this._elem.finalTransform.mProp;
36931 } else {
36932 transformMat = this._elem.finalTransform.mProp;
36933 }
36934 transformMat.applyToMatrix(toWorldMat);
36935 if(this._elem.hierarchy && this._elem.hierarchy.length){
36936 var i, len = this._elem.hierarchy.length;
36937 for(i=0;i<len;i+=1){
36938 this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(toWorldMat);
36939 }
36940 return toWorldMat.inversePoint(arr);
36941 }
36942 return toWorldMat.inversePoint(arr);
36943 }
36944 function fromComp(arr){
36945 var toWorldMat = new Matrix();
36946 toWorldMat.reset();
36947 this._elem.finalTransform.mProp.applyToMatrix(toWorldMat);
36948 if(this._elem.hierarchy && this._elem.hierarchy.length){
36949 var i, len = this._elem.hierarchy.length;
36950 for(i=0;i<len;i+=1){
36951 this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(toWorldMat);
36952 }
36953 return toWorldMat.inversePoint(arr);
36954 }
36955 return toWorldMat.inversePoint(arr);
36956 }
36957
36958 function sampleImage() {
36959 return [1,1,1,1];
36960 }
36961
36962
36963 return function(elem){
36964
36965 var transformInterface;
36966
36967 function _registerMaskInterface(maskManager){
36968 _thisLayerFunction.mask = new MaskManagerInterface(maskManager, elem);
36969 }
36970 function _registerEffectsInterface(effects){
36971 _thisLayerFunction.effect = effects;
36972 }
36973
36974 function _thisLayerFunction(name){
36975 switch(name){
36976 case "ADBE Root Vectors Group":
36977 case "Contents":
36978 case 2:
36979 return _thisLayerFunction.shapeInterface;
36980 case 1:
36981 case 6:
36982 case "Transform":
36983 case "transform":
36984 case "ADBE Transform Group":
36985 return transformInterface;
36986 case 4:
36987 case "ADBE Effect Parade":
36988 case "effects":
36989 case "Effects":
36990 return _thisLayerFunction.effect;
36991 }
36992 }
36993 _thisLayerFunction.toWorld = toWorld;
36994 _thisLayerFunction.fromWorld = fromWorld;
36995 _thisLayerFunction.toComp = toWorld;
36996 _thisLayerFunction.fromComp = fromComp;
36997 _thisLayerFunction.sampleImage = sampleImage;
36998 _thisLayerFunction.sourceRectAtTime = elem.sourceRectAtTime.bind(elem);
36999 _thisLayerFunction._elem = elem;
37000 transformInterface = TransformExpressionInterface(elem.finalTransform.mProp);
37001 var anchorPointDescriptor = getDescriptor(transformInterface, 'anchorPoint');
37002 Object.defineProperties(_thisLayerFunction,{
37003 hasParent: {
37004 get: function(){
37005 return elem.hierarchy.length;
37006 }
37007 },
37008 parent: {
37009 get: function(){
37010 return elem.hierarchy[0].layerInterface;
37011 }
37012 },
37013 rotation: getDescriptor(transformInterface, 'rotation'),
37014 scale: getDescriptor(transformInterface, 'scale'),
37015 position: getDescriptor(transformInterface, 'position'),
37016 opacity: getDescriptor(transformInterface, 'opacity'),
37017 anchorPoint: anchorPointDescriptor,
37018 anchor_point: anchorPointDescriptor,
37019 transform: {
37020 get: function () {
37021 return transformInterface;
37022 }
37023 },
37024 active: {
37025 get: function(){
37026 return elem.isInRange;
37027 }
37028 }
37029 });
37030
37031 _thisLayerFunction.startTime = elem.data.st;
37032 _thisLayerFunction.index = elem.data.ind;
37033 _thisLayerFunction.source = elem.data.refId;
37034 _thisLayerFunction.height = elem.data.ty === 0 ? elem.data.h : 100;
37035 _thisLayerFunction.width = elem.data.ty === 0 ? elem.data.w : 100;
37036 _thisLayerFunction.inPoint = elem.data.ip/elem.comp.globalData.frameRate;
37037 _thisLayerFunction.outPoint = elem.data.op/elem.comp.globalData.frameRate;
37038 _thisLayerFunction._name = elem.data.nm;
37039
37040 _thisLayerFunction.registerMaskInterface = _registerMaskInterface;
37041 _thisLayerFunction.registerEffectsInterface = _registerEffectsInterface;
37042 return _thisLayerFunction;
37043 };
37044}());
37045
37046var CompExpressionInterface = (function (){
37047 return function(comp){
37048 function _thisLayerFunction(name){
37049 var i=0, len = comp.layers.length;
37050 while(i<len){
37051 if(comp.layers[i].nm === name || comp.layers[i].ind === name){
37052 return comp.elements[i].layerInterface;
37053 }
37054 i += 1;
37055 }
37056 return null;
37057 //return {active:false};
37058 }
37059 Object.defineProperty(_thisLayerFunction, "_name", { value:comp.data.nm });
37060 _thisLayerFunction.layer = _thisLayerFunction;
37061 _thisLayerFunction.pixelAspect = 1;
37062 _thisLayerFunction.height = comp.data.h || comp.globalData.compSize.h;
37063 _thisLayerFunction.width = comp.data.w || comp.globalData.compSize.w;
37064 _thisLayerFunction.pixelAspect = 1;
37065 _thisLayerFunction.frameDuration = 1/comp.globalData.frameRate;
37066 _thisLayerFunction.displayStartTime = 0;
37067 _thisLayerFunction.numLayers = comp.layers.length;
37068 return _thisLayerFunction;
37069 };
37070}());
37071var TransformExpressionInterface = (function (){
37072 return function(transform){
37073 function _thisFunction(name){
37074 switch(name){
37075 case "scale":
37076 case "Scale":
37077 case "ADBE Scale":
37078 case 6:
37079 return _thisFunction.scale;
37080 case "rotation":
37081 case "Rotation":
37082 case "ADBE Rotation":
37083 case "ADBE Rotate Z":
37084 case 10:
37085 return _thisFunction.rotation;
37086 case "ADBE Rotate X":
37087 return _thisFunction.xRotation;
37088 case "ADBE Rotate Y":
37089 return _thisFunction.yRotation;
37090 case "position":
37091 case "Position":
37092 case "ADBE Position":
37093 case 2:
37094 return _thisFunction.position;
37095 case 'ADBE Position_0':
37096 return _thisFunction.xPosition;
37097 case 'ADBE Position_1':
37098 return _thisFunction.yPosition;
37099 case 'ADBE Position_2':
37100 return _thisFunction.zPosition;
37101 case "anchorPoint":
37102 case "AnchorPoint":
37103 case "Anchor Point":
37104 case "ADBE AnchorPoint":
37105 case 1:
37106 return _thisFunction.anchorPoint;
37107 case "opacity":
37108 case "Opacity":
37109 case 11:
37110 return _thisFunction.opacity;
37111 }
37112 }
37113
37114 Object.defineProperty(_thisFunction, "rotation", {
37115 get: ExpressionPropertyInterface(transform.r || transform.rz)
37116 });
37117
37118 Object.defineProperty(_thisFunction, "zRotation", {
37119 get: ExpressionPropertyInterface(transform.rz || transform.r)
37120 });
37121
37122 Object.defineProperty(_thisFunction, "xRotation", {
37123 get: ExpressionPropertyInterface(transform.rx)
37124 });
37125
37126 Object.defineProperty(_thisFunction, "yRotation", {
37127 get: ExpressionPropertyInterface(transform.ry)
37128 });
37129 Object.defineProperty(_thisFunction, "scale", {
37130 get: ExpressionPropertyInterface(transform.s)
37131 });
37132
37133 if(transform.p) {
37134 var _transformFactory = ExpressionPropertyInterface(transform.p);
37135 }
37136 Object.defineProperty(_thisFunction, "position", {
37137 get: function () {
37138 if(transform.p) {
37139 return _transformFactory();
37140 } else {
37141 return [transform.px.v, transform.py.v, transform.pz ? transform.pz.v : 0];
37142 }
37143 }
37144 });
37145
37146 Object.defineProperty(_thisFunction, "xPosition", {
37147 get: ExpressionPropertyInterface(transform.px)
37148 });
37149
37150 Object.defineProperty(_thisFunction, "yPosition", {
37151 get: ExpressionPropertyInterface(transform.py)
37152 });
37153
37154 Object.defineProperty(_thisFunction, "zPosition", {
37155 get: ExpressionPropertyInterface(transform.pz)
37156 });
37157
37158 Object.defineProperty(_thisFunction, "anchorPoint", {
37159 get: ExpressionPropertyInterface(transform.a)
37160 });
37161
37162 Object.defineProperty(_thisFunction, "opacity", {
37163 get: ExpressionPropertyInterface(transform.o)
37164 });
37165
37166 Object.defineProperty(_thisFunction, "skew", {
37167 get: ExpressionPropertyInterface(transform.sk)
37168 });
37169
37170 Object.defineProperty(_thisFunction, "skewAxis", {
37171 get: ExpressionPropertyInterface(transform.sa)
37172 });
37173
37174 Object.defineProperty(_thisFunction, "orientation", {
37175 get: ExpressionPropertyInterface(transform.or)
37176 });
37177
37178 return _thisFunction;
37179 };
37180}());
37181var ProjectInterface = (function (){
37182
37183 function registerComposition(comp){
37184 this.compositions.push(comp);
37185 }
37186
37187 return function(){
37188 function _thisProjectFunction(name){
37189 var i = 0, len = this.compositions.length;
37190 while(i<len){
37191 if(this.compositions[i].data && this.compositions[i].data.nm === name){
37192 if(this.compositions[i].prepareFrame && this.compositions[i].data.xt) {
37193 this.compositions[i].prepareFrame(this.currentFrame);
37194 }
37195 return this.compositions[i].compInterface;
37196 }
37197 i+=1;
37198 }
37199 }
37200
37201 _thisProjectFunction.compositions = [];
37202 _thisProjectFunction.currentFrame = 0;
37203
37204 _thisProjectFunction.registerComposition = registerComposition;
37205
37206
37207
37208 return _thisProjectFunction;
37209 };
37210}());
37211var EffectsExpressionInterface = (function (){
37212 var ob = {
37213 createEffectsInterface: createEffectsInterface
37214 };
37215
37216 function createEffectsInterface(elem, propertyGroup){
37217 if(elem.effectsManager){
37218
37219 var effectElements = [];
37220 var effectsData = elem.data.ef;
37221 var i, len = elem.effectsManager.effectElements.length;
37222 for(i=0;i<len;i+=1){
37223 effectElements.push(createGroupInterface(effectsData[i],elem.effectsManager.effectElements[i],propertyGroup,elem));
37224 }
37225
37226 return function(name){
37227 var effects = elem.data.ef || [], i = 0, len = effects.length;
37228 while(i<len) {
37229 if(name === effects[i].nm || name === effects[i].mn || name === effects[i].ix){
37230 return effectElements[i];
37231 }
37232 i += 1;
37233 }
37234 };
37235 }
37236 }
37237
37238 function createGroupInterface(data,elements, propertyGroup, elem){
37239 var effectElements = [];
37240 var i, len = data.ef.length;
37241 for(i=0;i<len;i+=1){
37242 if(data.ef[i].ty === 5){
37243 effectElements.push(createGroupInterface(data.ef[i],elements.effectElements[i],elements.effectElements[i].propertyGroup, elem));
37244 } else {
37245 effectElements.push(createValueInterface(elements.effectElements[i],data.ef[i].ty, elem, _propertyGroup));
37246 }
37247 }
37248
37249 function _propertyGroup(val) {
37250 if(val === 1){
37251 return groupInterface;
37252 } else{
37253 return propertyGroup(val-1);
37254 }
37255 }
37256
37257 var groupInterface = function(name){
37258 var effects = data.ef, i = 0, len = effects.length;
37259 while(i<len) {
37260 if(name === effects[i].nm || name === effects[i].mn || name === effects[i].ix){
37261 if(effects[i].ty === 5){
37262 return effectElements[i];
37263 } else {
37264 return effectElements[i]();
37265 }
37266 }
37267 i += 1;
37268 }
37269 return effectElements[0]();
37270 };
37271
37272 groupInterface.propertyGroup = _propertyGroup;
37273
37274 if(data.mn === 'ADBE Color Control'){
37275 Object.defineProperty(groupInterface, 'color', {
37276 get: function(){
37277 return effectElements[0]();
37278 }
37279 });
37280 }
37281 Object.defineProperty(groupInterface, 'numProperties', {
37282 get: function(){
37283 return data.np;
37284 }
37285 });
37286 groupInterface.active = groupInterface.enabled = data.en !== 0;
37287 return groupInterface;
37288 }
37289
37290 function createValueInterface(element, type, elem, propertyGroup){
37291 var expressionProperty = ExpressionPropertyInterface(element.p);
37292 function interfaceFunction(){
37293 if(type === 10){
37294 return elem.comp.compInterface(element.p.v);
37295 }
37296 return expressionProperty();
37297 }
37298
37299 if(element.p.setGroupProperty) {
37300 element.p.setGroupProperty(propertyGroup);
37301 }
37302
37303 return interfaceFunction;
37304 }
37305
37306 return ob;
37307
37308}());
37309var MaskManagerInterface = (function(){
37310
37311 function MaskInterface(mask, data){
37312 this._mask = mask;
37313 this._data = data;
37314 }
37315 Object.defineProperty(MaskInterface.prototype, 'maskPath', {
37316 get: function(){
37317 if(this._mask.prop.k){
37318 this._mask.prop.getValue();
37319 }
37320 return this._mask.prop;
37321 }
37322 });
37323
37324 var MaskManager = function(maskManager, elem){
37325 var _masksInterfaces = createSizedArray(maskManager.viewData.length);
37326 var i, len = maskManager.viewData.length;
37327 for(i = 0; i < len; i += 1) {
37328 _masksInterfaces[i] = new MaskInterface(maskManager.viewData[i], maskManager.masksProperties[i]);
37329 }
37330
37331 var maskFunction = function(name){
37332 i = 0;
37333 while(i<len){
37334 if(maskManager.masksProperties[i].nm === name){
37335 return _masksInterfaces[i];
37336 }
37337 i += 1;
37338 }
37339 };
37340 return maskFunction;
37341 };
37342 return MaskManager;
37343}());
37344
37345var ExpressionPropertyInterface = (function() {
37346
37347 var defaultUnidimensionalValue = {pv:0, v:0, mult: 1};
37348 var defaultMultidimensionalValue = {pv:[0,0,0], v:[0,0,0], mult: 1};
37349
37350 function completeProperty(expressionValue, property, type) {
37351 Object.defineProperty(expressionValue, 'velocity', {
37352 get: function(){
37353 return property.getVelocityAtTime(property.comp.currentFrame);
37354 }
37355 });
37356 expressionValue.numKeys = property.keyframes ? property.keyframes.length : 0;
37357 expressionValue.key = function(pos) {
37358 if (!expressionValue.numKeys) {
37359 return 0;
37360 } else {
37361 var value = '';
37362 if ('s' in property.keyframes[pos-1]) {
37363 value = property.keyframes[pos-1].s;
37364 } else if ('e' in property.keyframes[pos-2]) {
37365 value = property.keyframes[pos-2].e;
37366 } else {
37367 value = property.keyframes[pos-2].s;
37368 }
37369 var valueProp = type === 'unidimensional' ? new Number(value) : Object.assign({}, value);
37370 valueProp.time = property.keyframes[pos-1].t / property.elem.comp.globalData.frameRate;
37371 return valueProp;
37372 }
37373 };
37374 expressionValue.valueAtTime = property.getValueAtTime;
37375 expressionValue.speedAtTime = property.getSpeedAtTime;
37376 expressionValue.velocityAtTime = property.getVelocityAtTime;
37377 expressionValue.propertyGroup = property.propertyGroup;
37378 }
37379
37380 function UnidimensionalPropertyInterface(property) {
37381 if(!property || !('pv' in property)) {
37382 property = defaultUnidimensionalValue;
37383 }
37384 var mult = 1 / property.mult;
37385 var val = property.pv * mult;
37386 var expressionValue = new Number(val);
37387 expressionValue.value = val;
37388 completeProperty(expressionValue, property, 'unidimensional');
37389
37390 return function() {
37391 if (property.k) {
37392 property.getValue();
37393 }
37394 val = property.v * mult;
37395 if(expressionValue.value !== val) {
37396 expressionValue = new Number(val);
37397 expressionValue.value = val;
37398 completeProperty(expressionValue, property, 'unidimensional');
37399 }
37400 return expressionValue;
37401 }
37402 }
37403
37404 function MultidimensionalPropertyInterface(property) {
37405 if(!property || !('pv' in property)) {
37406 property = defaultMultidimensionalValue;
37407 }
37408 var mult = 1 / property.mult;
37409 var len = property.pv.length;
37410 var expressionValue = createTypedArray('float32', len);
37411 var arrValue = createTypedArray('float32', len);
37412 expressionValue.value = arrValue;
37413 completeProperty(expressionValue, property, 'multidimensional');
37414
37415 return function() {
37416 if (property.k) {
37417 property.getValue();
37418 }
37419 for (var i = 0; i < len; i += 1) {
37420 expressionValue[i] = arrValue[i] = property.v[i] * mult;
37421 }
37422 return expressionValue;
37423 }
37424 }
37425
37426 //TODO: try to avoid using this getter
37427 function defaultGetter() {
37428 return defaultUnidimensionalValue;
37429 }
37430
37431 return function(property) {
37432 if(!property) {
37433 return defaultGetter;
37434 } else if (property.propType === 'unidimensional') {
37435 return UnidimensionalPropertyInterface(property);
37436 } else {
37437 return MultidimensionalPropertyInterface(property);
37438 }
37439 }
37440}());
37441
37442(function(){
37443
37444 var TextExpressionSelectorProp = (function(){
37445
37446 function getValueProxy(index,total){
37447 this.textIndex = index+1;
37448 this.textTotal = total;
37449 this.v = this.getValue() * this.mult;
37450 return this.v;
37451 }
37452
37453 return function TextExpressionSelectorProp(elem,data){
37454 this.pv = 1;
37455 this.comp = elem.comp;
37456 this.elem = elem;
37457 this.mult = 0.01;
37458 this.propType = 'textSelector';
37459 this.textTotal = data.totalChars;
37460 this.selectorValue = 100;
37461 this.lastValue = [1,1,1];
37462 this.k = true;
37463 this.x = true;
37464 this.getValue = ExpressionManager.initiateExpression.bind(this)(elem,data,this);
37465 this.getMult = getValueProxy;
37466 this.getVelocityAtTime = expressionHelpers.getVelocityAtTime;
37467 if(this.kf){
37468 this.getValueAtTime = expressionHelpers.getValueAtTime.bind(this);
37469 } else {
37470 this.getValueAtTime = expressionHelpers.getStaticValueAtTime.bind(this);
37471 }
37472 this.setGroupProperty = expressionHelpers.setGroupProperty;
37473 };
37474 }());
37475
37476 var propertyGetTextProp = TextSelectorProp.getTextSelectorProp;
37477 TextSelectorProp.getTextSelectorProp = function(elem, data,arr){
37478 if(data.t === 1){
37479 return new TextExpressionSelectorProp(elem, data,arr);
37480 } else {
37481 return propertyGetTextProp(elem,data,arr);
37482 }
37483 };
37484}());
37485function SliderEffect(data,elem, container){
37486 this.p = PropertyFactory.getProp(elem,data.v,0,0,container);
37487}
37488function AngleEffect(data,elem, container){
37489 this.p = PropertyFactory.getProp(elem,data.v,0,0,container);
37490}
37491function ColorEffect(data,elem, container){
37492 this.p = PropertyFactory.getProp(elem,data.v,1,0,container);
37493}
37494function PointEffect(data,elem, container){
37495 this.p = PropertyFactory.getProp(elem,data.v,1,0,container);
37496}
37497function LayerIndexEffect(data,elem, container){
37498 this.p = PropertyFactory.getProp(elem,data.v,0,0,container);
37499}
37500function MaskIndexEffect(data,elem, container){
37501 this.p = PropertyFactory.getProp(elem,data.v,0,0,container);
37502}
37503function CheckboxEffect(data,elem, container){
37504 this.p = PropertyFactory.getProp(elem,data.v,0,0,container);
37505}
37506function NoValueEffect(){
37507 this.p = {};
37508}
37509function EffectsManager(){}
37510function EffectsManager(data,element){
37511 var effects = data.ef || [];
37512 this.effectElements = [];
37513 var i,len = effects.length;
37514 var effectItem;
37515 for(i=0;i<len;i++) {
37516 effectItem = new GroupEffect(effects[i],element);
37517 this.effectElements.push(effectItem);
37518 }
37519}
37520
37521function GroupEffect(data,element){
37522 this.init(data,element);
37523}
37524
37525extendPrototype([DynamicPropertyContainer], GroupEffect);
37526
37527GroupEffect.prototype.getValue = GroupEffect.prototype.iterateDynamicProperties;
37528
37529GroupEffect.prototype.init = function(data,element){
37530 this.data = data;
37531 this.effectElements = [];
37532 this.initDynamicPropertyContainer(element);
37533 var i, len = this.data.ef.length;
37534 var eff, effects = this.data.ef;
37535 for(i=0;i<len;i+=1){
37536 eff = null;
37537 switch(effects[i].ty){
37538 case 0:
37539 eff = new SliderEffect(effects[i],element,this);
37540 break;
37541 case 1:
37542 eff = new AngleEffect(effects[i],element,this);
37543 break;
37544 case 2:
37545 eff = new ColorEffect(effects[i],element,this);
37546 break;
37547 case 3:
37548 eff = new PointEffect(effects[i],element,this);
37549 break;
37550 case 4:
37551 case 7:
37552 eff = new CheckboxEffect(effects[i],element,this);
37553 break;
37554 case 10:
37555 eff = new LayerIndexEffect(effects[i],element,this);
37556 break;
37557 case 11:
37558 eff = new MaskIndexEffect(effects[i],element,this);
37559 break;
37560 case 5:
37561 eff = new EffectsManager(effects[i],element,this);
37562 break;
37563 //case 6:
37564 default:
37565 eff = new NoValueEffect(effects[i],element,this);
37566 break;
37567 }
37568 if(eff) {
37569 this.effectElements.push(eff);
37570 }
37571 }
37572};
37573
37574 var lottiejs = {};
37575
37576 function setLocationHref (href) {
37577 locationHref = href;
37578 }
37579
37580 function searchAnimations() {
37581 {
37582 animationManager.searchAnimations();
37583 }
37584 }
37585
37586 function setSubframeRendering(flag) {
37587 subframeEnabled = flag;
37588 }
37589
37590 function loadAnimation(params) {
37591 return animationManager.loadAnimation(params);
37592 }
37593
37594 function setQuality(value) {
37595 if (typeof value === 'string') {
37596 switch (value) {
37597 case 'high':
37598 defaultCurveSegments = 200;
37599 break;
37600 case 'medium':
37601 defaultCurveSegments = 50;
37602 break;
37603 case 'low':
37604 defaultCurveSegments = 10;
37605 break;
37606 }
37607 } else if (!isNaN(value) && value > 1) {
37608 defaultCurveSegments = value;
37609 }
37610 }
37611
37612 function inBrowser() {
37613 return typeof navigator !== 'undefined';
37614 }
37615
37616 function installPlugin(type, plugin) {
37617 if (type === 'expressions') {
37618 expressionsPlugin = plugin;
37619 }
37620 }
37621
37622 function getFactory(name) {
37623 switch (name) {
37624 case "propertyFactory":
37625 return PropertyFactory;
37626 case "shapePropertyFactory":
37627 return ShapePropertyFactory;
37628 case "matrix":
37629 return Matrix;
37630 }
37631 }
37632
37633 lottiejs.play = animationManager.play;
37634 lottiejs.pause = animationManager.pause;
37635 lottiejs.setLocationHref = setLocationHref;
37636 lottiejs.togglePause = animationManager.togglePause;
37637 lottiejs.setSpeed = animationManager.setSpeed;
37638 lottiejs.setDirection = animationManager.setDirection;
37639 lottiejs.stop = animationManager.stop;
37640 lottiejs.searchAnimations = searchAnimations;
37641 lottiejs.registerAnimation = animationManager.registerAnimation;
37642 lottiejs.loadAnimation = loadAnimation;
37643 lottiejs.setSubframeRendering = setSubframeRendering;
37644 lottiejs.resize = animationManager.resize;
37645 //lottiejs.start = start;
37646 lottiejs.goToAndStop = animationManager.goToAndStop;
37647 lottiejs.destroy = animationManager.destroy;
37648 lottiejs.setQuality = setQuality;
37649 lottiejs.inBrowser = inBrowser;
37650 lottiejs.installPlugin = installPlugin;
37651 lottiejs.freeze = animationManager.freeze;
37652 lottiejs.unfreeze = animationManager.unfreeze;
37653 lottiejs.getRegisteredAnimations = animationManager.getRegisteredAnimations;
37654 lottiejs.__getFactory = getFactory;
37655 lottiejs.version = '5.5.1';
37656
37657 function checkReady() {
37658 if (document.readyState === "complete") {
37659 clearInterval(readyStateCheckInterval);
37660 searchAnimations();
37661 }
37662 }
37663
37664 function getQueryVariable(variable) {
37665 var vars = queryString.split('&');
37666 for (var i = 0; i < vars.length; i++) {
37667 var pair = vars[i].split('=');
37668 if (decodeURIComponent(pair[0]) == variable) {
37669 return decodeURIComponent(pair[1]);
37670 }
37671 }
37672 }
37673 var renderer = '';
37674 {
37675 var scripts = document.getElementsByTagName('script');
37676 var index = scripts.length - 1;
37677 var myScript = scripts[index] || {
37678 src: ''
37679 };
37680 var queryString = myScript.src.replace(/^[^\?]+\??/, '');
37681 renderer = getQueryVariable('renderer');
37682 }
37683 var readyStateCheckInterval = setInterval(checkReady, 100);
37684 return lottiejs;
37685}));
37686});
37687
37688var v = "5.3.4";
37689var fr = 60;
37690var ip = 0;
37691var op = 240;
37692var w = 500;
37693var h = 500;
37694var nm = "Composição 1";
37695var ddd = 1;
37696var assets = [
37697 {
37698 id: "image_0",
37699 w: 24,
37700 h: 39,
37701 u: "",
37702 p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAnCAYAAAAVW4iAAAABqElEQVRIS9WWPU7DQBCF37MDtKFBgoZwEjoERWD5CwRxCN+AHIHcwGkQSCk4QnID0iNZhH8q3IUoeNAGCWGySYy9LjIHmG/f5/HuEDmVu3GrQJ7Tev/NoORGnz7Idd3bHkAFxUIv8gQ4+31oKwB3K1CAnANY/WskG0DroPgAhjpMlQ6gdfS1DsZ0WAEMdRBGHdkAWocDHxyvIx1A6xjAE4lPR9LxnvgN3HKgIEysI3kCFZTcAX2ZMB3pEqig6ETwINOn498At9xVMuZnSdrMrEjriLSO77vDdtHZvhPbTWN3kbPTnXWAyjuBus9Z0W7ugId8E3Bv5gH7jzkryhXAkDzIJwHBRlRgjTx8sq2oI0IPzeXWcPGyCAhFUENzRb+AP0VWsicg0Ij6Hx6u195HFi9WnjMoko449HD5rcP44PAoFSAUSA1XcR1WACQaUa9n1GEGHL8kVdQennqCDvObPB0QAqI96yX330VUJyaoY2GhBn9xZDqSkojqq0GRtEHHw8XSTdJGY6cIJzFACFA3TqXD/A1+AKxjfi6TDjPg9K0FvS5a0GECfAGHQaT2XgdD9QAAAABJRU5ErkJggg==",
37703 e: 1
37704 },
37705 {
37706 id: "image_1",
37707 w: 49,
37708 h: 29,
37709 u: "",
37710 p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADEAAAAdCAYAAAAD8oRRAAACwUlEQVRYR8WYX44SQRDGv+oZcN/kBkJi1uCL6wGMk40xJK6RG8gN7BvY3mC4wXoDjMlmkzWGiRfwDV1MZvcG8obMnzI9K0RgYP7QA/NEQnd1/SbfV1U9hAqf2rNRD4DSRxBYzr49HlRxHFUR1HZGDsVQIDxfis/wLIHedNi+MXmuUYgjZ9QMY3aJ6M3WJIn7Af4oDJ/+NgFjBsLxGzamEqD3BZKaaIkFw/Z5gT2pS3eGqJ3+kMyJ7u+XTMYDswqH7WHJ/SgNYTk/u4LgMvCg7OH/7yPgY8B1iWGrsMQKQ9Sc6xMWsQvQsmlNkAATAG749VFS0fI+uSG0aSMSiglv8wYvu46AWxZxL/yST2LZENq09kyCSe6g+5I8/MmOYplVkrdC1E6ve0xw95/8CjPxhzCsu5v8kgphvxg7YHZBeFLyFRrfRuBbEKng6nitJC9BHHVGzTC09aIqTGsKzCNiGVwdf58HvINw/EatFrgMqty0pkgA6oeBpbTEyH45VocxrRGcCTGpBIJxiMpjBAJE6N/JqeM3LUQKXH0PMJM6AIYnOE68sWRsuzN2OCYFqqQbm8p/AmIZXT5cVKnUEmt1fvUAOnx/WG0XhH54TygMluerzc2u6zfsaSwZKDJem3rbK3HYE8KSwUVrUVZXhseMcxO/JI1v+0WnmvQnunJGl62td47s2elfcnbHd5hYBzMyemcxEzhVOmn7ckPMN4tXviTmXS5BWfl7ArRROkYgkiDaLzMoBt5lZVTgf32XkNHFdumYg5hH0n4ROF/7qlEgc72UGP2wjrWqkzdMYTmlBbZe+13ESUku5hfdsPTHgg1VZ68QC7+c+bpRSnDGRwNC8qUj+lxcOubllBax6zdEJFwwb5iIuR/b5aWzH4h5ST7TJZn0cJncTQjsRRFL7CidvUIsDuv6J8nvQXq3zav7bev+Ai2g8mv/19MmAAAAAElFTkSuQmCC",
37711 e: 1
37712 },
37713 {
37714 id: "image_2",
37715 w: 25,
37716 h: 114,
37717 u: "",
37718 p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAByCAYAAACm2nr6AAAC0ElEQVRoQ92aWVYTQRSGb4UmBkKwFSecCGqCURTECScIDu/uQHZg78B2B1mCrEA9iiBjx3kWnKcH2QF545x0+noqgBol3Z2h/oeu99SX77tdb1eQwhOLjQ4TkSlUMFpa7qQFhUwiGpT31xWi62PxQoFNYr7y95+vC0TXb+qOHTaY6NpaZWqGFLszZYhofbn0VUNWusvLe7zmWjGk2N12bqwO1QtQ0eBld9sOy8/xqp+LKx58a+tdg1nIT7Jsdzewa65Y7N5louJQOyr9954mUX20N8QiQ7z8mGo9JSbFoToks5Q8prpAio+JIgYzGdV2d51JTB+Tj8nkGru7Qlr0ca41h9fvBQayAWGy8T4gFwTShjBpmwDk2gSBTAJMNgMgUQhky5T6XFEIZCvCZNs0IBcE0o4waZ8B5NoOgcwCTHYAIM0QyE5Lfa5mCGQXwmR3FpALAul4ADCBQOIIk/hDQK5OAKQJAtnzSH2uJghkL8Jk32NALggk8QRgAoEkESbJp4BcXQBIBALZ/0x9rggEkkKYHHgOyAWBHHwBMIFAuhEm3S8BuQ4FBbLu8Cv1uTCQntcAk97AQI68AeSCQPoQJn1vAbmOBgUSPjanPhcGcnweYHIiMJCT7wC5IJB+hEn/e0CuU0GBNJ7+oD4XBnLmI8DkbGAg5z4BckEgAwiTgc+qc42IxkFFEKZsQ4iGl6zUTxWQeRZk2FbKWl01EVr6S71y5QSxkbdScver5NQDkiPijE2RDFmdi2vu3GlDX6s2EUQjDeyYsrvrmo92vhoIZ4UTMvJWcs5rxae4DlcJRBAtOIKMwnTXLT+X/xn8hW9+cuUECzM/k5BbaxUfoXlBBF+37XDZofohCu1iORO+rWmOsTTuPlSfkO//5srKzVh7KvH7Mfm5yP3rurQMkUMlYjM/mfzvMdUB8mORBGfsiYRc6FNyBKVnNbKGbCW3r1z6C7QGPOO8hs2vAAAAAElFTkSuQmCC",
37719 e: 1
37720 },
37721 {
37722 id: "image_3",
37723 w: 100,
37724 h: 71,
37725 u: "",
37726 p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABHCAYAAADx2uLMAAAIVklEQVR4Xu2czW7cVBTH/8cep9m1LEqpVJpECKSuKPvSjCqQIgQ0QiBVbDpvUL9BnTdw3yCRCqoEQglFEEQXGcEDkEU/1CJNhyJFYsXsosbjg66/Pf6647EzmYxnNZN4/HF/Pvd//uceD2nXHr8EKcbR71c20bymPgKkXXvMIBIn0mUmw/rjyt7Uz2qOT4C0a08YDo/gtaWqZBzuXXk5x+MytUsn7cMnHDu6C2dAIPO1cmhi74P/pnZ2c3jgOJAgUrw3hD4IxtFeoy/HdW+kAInMX/5bRpcVGNZeoy91gwmBJKMjfmxH+GlLhd3oS41URoCkRIc4OBEiQjOAwqZlL5rYW2n0pWI4LhCJ6Igpv7M9DYhJP9p7r/EvFUKJAAmEPDFVJWE4QNztCPtQbN161OhLFVxIu+6nvelA2DWN4cuNjpHPzp92WkNbb/zLZFg8IKWjI07K0X3esKyFRl9KcskBQuCR4HADIxte5BwGpEA/+q3Rl3G5kHb9qSsRicGPZVaR/6cBoZTvA2DaB0G3Hr3b1MckyWQAGYkOiSwsqTMRygp2WoqlH+429bEiLi6QKqMjDx5hw3rdavQlh0oKkCqiI8NgCvKEgU1k2L++YxbdLfP4f9JWPQ3xrz7uyj1tyB3gZAqcI/yBp2H0SeWOtdvoS8xVxICkwpDOrArhxbK2SOFyqKgd7K406y8it4oCkTaBDqM0w5gPL6X8EtwcpOCedUYxsD3f9bEQSJ3RIb/vARMM+5f51RcPyEQmUMqj5EVHPMtzhL9PTB1rd2Xu/IsLRP4Odh1knoMfNZmT7bs7ZJorfSFt9Rmniq1ciaTa6MjQJQLdsxYwF/pCWvsZF5TXkwXErOpvlQYziLRgp6I+Zlo/rRin2Z9Qq/0s5DFpiSQGxJ3aMrUjBV5u+SXcvg8F+vDhyvZpBJMCpAYTGNOVMYqT+dNmd2izjp9X/jxNYEIgpaIjH14QHbXum7Zs1dZPi38RGvKSgaXYWkeiHD+SWUkM8JhpbrnyS6gzAxBM+8elmdcXZ2hbN54aYNIBOpu1NpKc37OjY/KsTTLyRoVfQZ9s0ocPL8+svoRX3u6d0+i1ycDtmM+ouESSYgInjY7E9wncHSotHduXZk5fRnMdaO3nV1mxTYBW6zWBWfUwyeiQmDZB2LIxFP5lZgqXCSD+7db66GmbWNlk0FJYAQxq9O6bcdLcFAcvmeYG1YGSujQAsWnDNmdB+DOB+IOl3XihM7EQy7NFTQ6VGcwMeHJZW2Zpp09gY7h9+UQ39hUCccC0e+da6pEBwp30rpPaTOD40VGgeUToEsOwtt8+kYVLOSBeuCyuPV22rNYmCKvx6aaCDpW05jsnUtxTnDA6UhIH3rJZM7B98UTpy1hAQn150SbCpuNfvOpvDSWSyqMjRfMGAJu2bZ0YfSkFJNCXj593mBSRKrv+ZdQXZAh/pqeRKk5KlnaKziUeeX0GDPxwaer6MhGQQF8WLJ1Bd2W66DNhjJu1SRUnJVNo/9jOg0ls4Pvp6cvkQPwRXustqzwU/uVmPFoioRM9moSPKJnmFkdqqi6FJ0dEW3aLDDw4fn2pDog37q21F22bFZMI748Kf+nokIBXet85UxsBG7b1+lj1pXIg/sCoa391ABLNcGcTjl9igCuLjhTzmszacqe2AYN0fHfxWPSlNiAOmPXeudahrTPR3dJ3cC68Mdf3x8oIE/veZ5V0PLhYq3+pF0hUX1y3HylceoeepPwy2nAhCS/uacbM2hg7Hpha/MvxAAn0pdd2shincBlNk/33dZlATyiiS8qS8OLnGRF+BRv24WHl+nKsQAJ9+aTXgcj7SRjLeBYmrR1jLQuE089E0ZFcUhaNfWIaq0xfpgIk0BcLOjN0t3BZY3QUpLm5azRFBtOdNvcZXIm+TA9IVF9UxQDx7TqjQ3rfqbpUrDPe/nfggimtL9MH4uvLp702gwwGVsda3y+6g+uPjpHCpxhSuoczmoHNN8b+YYUTAyTQl8966+z4F29hrI4SSUFlOUvIs6a2DF0Sv3hh4Ju3xnow6cQB8QdD+bxvQOgLRQqXRX3FGfAqEfIgEvMywtSprQ9F6eD+eSn/cmKB+MKv2Iq4w247n2V/xMDdOL9zMjbA5QymtOMX503owhp2ivTlZAPxw2W9d1W1VZOjC2OSPqKS6Ji8/BJm94x7WMjWl9kA4l2Ouv73OrPQF5Zq7JNbNKszOlL27V7LACAD35xP6MtMAQn0Zb0v3H5GY19tJjD2bEzpyAtjRexP/GJfTF9mEkigL2iJ+tid3HYkyamtkswqY2qLMUj7ENGX2QUS6suySi2xvh809k1mAiNqX6V2FFLBPjStPftAfGO5/qptKyRqSkulpxNnNPJdeel9ZwKhPpgNfPumUw87NUCC6/3iH51E4XK0sS/DR1QyVSVGMlPMo1icjkq0Fsyooz99QMQlr/fOKapmMOhOfMD9T+UyqwqjYwvDYeqa/ekEEujLwTKponEcN4s7+qULiIW/WJE57wjxFulujms/3UB8MF++ahMpJlg0XowZHZMWJ51zEOmtreP+hcLnVuYDiA/mq4MOgb3GC++PEkIutiyerlJ1w9WJ+xekn+yaLyC+viws6Mxe40UUSLVp7hY0TR+3BD9/QPxouXWwTEM2QcWNfanRkWUCJYuIWVnw/AIJwbTJdtb3Ix39ZcovyTJIsRdMbtEACcF0xHMjwlgWlu7j0TEAoPvGrgyE6HcaINHREP5lcVE0jjuNF8VCjg0sxI1dA2TSEUj7/q2DZUAxAPYa+xIeZQe2PVEzQ6MhZcDdOmiDKNLYx12obOB+fe2kzZQlA+rrf0VjH6rSibxD/g+NG3LFW5dl+AAAAABJRU5ErkJggg==",
37727 e: 1
37728 },
37729 {
37730 id: "image_4",
37731 w: 99,
37732 h: 71,
37733 u: "",
37734 p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGMAAABHCAYAAAATBvm1AAAIb0lEQVR4Xu1d0WrbVhj+/2PHFiRpdLFBLzbiiw0KW9eErZCOljqMDXrVvUH0BtMbVH0D5w3WJ+jKaAsrI/XKFmjYnLaD7KIX8RissF3YtCPGtXTGOZLsI/lIlmRZkWPpKol0bHG+c77v//7/l4JQHKc+A0v1Iw2QGHjqd7LAN1CuH9UB0ACE6wAIBRinsBiU+lHNBDCA4g51EUAGR3FkNwP1llqxKjoFogPCGv9iRKDOHRRgZATF0rUjDYAySlof7gFn9inaPxRgzBiM8tUXdQRiAOL14VfxWRd4ydkdBRgzAkPZOqqZJWoA0J3hknd2gP27M/XC7ijASBsMpgv9sqMLdM2zAxyNGHGSV7ULMFIEY2nruYaIBkVcD6OkoHMFGCmAoWy9qFMAgwJcd9nHFWUZJbEIyrM7fBKSwi0t3kcoW62aBSUDKDi6INIOgughvHQlivcIiWJnJFlDGy21UiE6AOiAaPuFoSaPJnq4OyTnhrtDOFeAEROMpcstDZEYAMwvuCD4aEeY1TG6EmfcR1cFGBHBUD5r1SkQgwJ1dMHrEyZ5CGkE5YJRaEY0FJSNVs0qAcuo7nhXuW8GJ3gImWDbfxvtqmJnBGGy0VIVYnnzSAAQh3bE/EaUcQUYEjCUjZZGkblnWB+Gpr48UhTaESOoKGJegCGAoWwccF0A7hfkXoBdnsRDRBlXgAEAXBcs00BEIY80jDmdNJI3dRFMO3IP4ca+Yd5jocFQN1pqzxroFHBUX/BlU0d05BXsSGIe03ssLBjKxacaIDL3vB5FXP3aIaWdEA8RRcwXDgzl44M6L/IAjueRIjrlsfxTzHFidU8EeWHAUC7s16BUYuI80gWBkiLRznC2JCkPSY0ibhBw5sHgutDv64igUwprYxPkhqw+AxanDpEWzZ1pMJQL+7YuADp+QXC8McVVltiblq783uNMgqFc2K8D9wtCHkmIVOPSR9SyaZSUR1AzghjERUvU5PwqpgvEAoMiyyOF+ISQc0nHhUdX0bzHmdgZam1P7VdYPxLqALgmr7aFJfYSeIiJYh7wfSH0OPdgKB/+zOvOzC+M5ZFyIMqeZih/isVb92jPLRjKB0/sfqRh3Vle4ImSoJMl/TIc1wWERv+Xi/PX+KzU9mukZLLi/46/EWyq1EVS2pk4Tlwk3voFANzpK6YOjzc7YnyRc2kG4LpAWD8S0wXmF3ycHEJJvJc1hCKy9h4I2LRoSX978NGhOPFzQVPLtZ80yv2CP4+UQJRjpi5Spqs2AOr9p598J1v9uQZjpfakToE6/Uj2rY6vcr+Rk9OCdHdk5z26gNjoP73EFlTgkUswlNpejVi8WXhHLq7ZeoipvAchd/pvLR0ObV2YGzC4LlhOPxLXBd8qd2yqdHekWYeYKMoR6BGgaZVAf3uw6dGFuQBj+f09jVL2SJWQR5ojURYWTpsi6v1fN6W6kGswVt7bq1sADQC8JKOk8V5VMX2dlK4EdvZHZb5ephhNBV1E2uj99mmoLuQSDOX8Xq1MoEERbialnaTjeCAQQIH2gpDTY9A4ininz0LuCLqQKzCYLgz6rB8Jb3lXXcgqzxFdeRYAYBMJ0XqHm8eTxDnK+UyjqeXzP2pAoAF0lMxzATnVVR7fe7SRUK13ePlxlEmOek0mYKycf1SnSBpAwdGFqF4gqYdIOs73/O94Y3IXCBgnzy83ok5wnOtmCgbXBcvkuuDNIwVTUtKYftbjEGG3Wl4yOlPqQuaaoap76qDC+5FujSKkCLE5BjjsCB5ihjTXBNPUen9cSUUXMgVj9d0fNArItvFavNSFELKGCPZ4tDOzcW0gltb7/UqqupAJGCvvPKqDRRtAmC7YE2SDkdQLZD3OZmwEYPUF4+Roaya6MFMwVPVhbcDEmeBNGSXF2x0jKktKO0nH8XsnuFutVmeqCzMBg+sC6bPagqALQdW2GazydL1HkyJkogupg7GqPmT1Ba4L0ijJl2jz0JUkCXeKCcE2JchAyEwXUgNjRX1YBwoNQDGPlDSmP9VxXfaep5OXn2euC1ODwXTBtBgIbh4pPu3kRswBdqtm3+gcb0+sL8QxbGlcG2r6VPWuavH3Izl+Ycp6QlJxTWccNqlJtN7x7P1CUmACwVhdva+Bndp2XlLlfIXwsqoxrvekn9NIeaTiIdq0BFrv5bVc6EIsmlpZ+Z71IzEuldcXZB5CKspyKsuOrkiXvc/j5PhqrnQhEhhcFwYWu3HbL4iHP7/v/J6qh0i6qySpEkTcXYJBLnUhFAyuCwOmC45fkF0d4KKzW+XRqnuI0DTR0nrH2zPPIyXVhVAwVlfvH/M+1UnHWNOYJOURRlez9B6UtEnZ1N4cb+deFybujMGgwvo8v5mER5Bgx6arpDQ3Pq5LCTVO/tyeG12Ioxnf8kbioCNlupqG5gBhd6kMc6cLkcBwLxqLpiaJedbeA7FpmqD1Xs2nLsQCw72Y+wyW+uD5J+EY2x3eF+Wm4z2k5c82llB789d860IiMNigwEhrWjEfWpBIdQ9eX/jv7y/OhC4kBsMdyD2ISQ2g1O595ZOZhsMefY4sCEDE22WFNPKYR5oY7CS4IFZDgqMnoU8LTSPKblMBAtwbkJJ+FnVh6p3h/wAnb+W8p8/7xsqxcmss74HPsET1N6++nGu/kGBT2GSTdOBQT1B8kiicdrwPtntorsveYPD6n69YaL2wR2IwRnpyVzXNKhNXz7tdI9MV0tvlQaXR6eSvvpD1qpgaDPeGl5fvb5Aysq5B/l9SRnQV0ERM4V6ZWnqnc2Mu80izACo1MEb+5MHX7FFa9pyF+086fJHXM2C68O+NhdSF1AU8yqo4d+6Bzh6KpKMnU7sIVH/dubHQunAqYLimcWBVDSDYKYNS6MKEVfw/MM9906el5gwAAAAASUVORK5CYII=",
37735 e: 1
37736 },
37737 {
37738 id: "image_5",
37739 w: 25,
37740 h: 99,
37741 u: "",
37742 p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAABjCAYAAABuUKvEAAACn0lEQVRoQ93aSXLaUBAG4G5BhkUkwGCDReZ5TohtEmce7diYRW6QI3AE5QbKDcQNqHLZIbOVeXJVfANTFVIsJdsrV9BLmSEVTBSEpdeLpy3iffX3r7drlOW5ZQDQVldzBnB6UN41x1pnmwwcbW0tvxC09TfSPBuxGAqhZllTGwkDebqR1rEI8EgKr+uW9cDyK7kirYNtQCj47asX0g6xxMApbLUvr0gbM0Nh6WG/ffWLNDAG8DgcXte89oWy/OcT7rdfG5FpKyszeq8/oqzMt+9Jr3fdfq8A2/g4pktuL6DiH2ldLzARWcGyct83Y6hEfCfpPJNBUZI6LzMq0YCRJmkDMF2C5mVGJfbEbyf/67LCGGi8kWZfygDXJC0kToBE4mWenTSTRBIUyCAFMvSUYFwkSJIiSYoAiaae8e8kOkyBqBRImgR5TtDJbgIktkcYZO8L/p3E9lEg+4VBDrzk38nAQWGQQ68IxnWYAjkiChI/+pp/J/FjwiDHKZKcWCDo5KQoSOIUQZLEaZN/JzTIGYokZymQc2/4dzJIgpynSJIhQd4SdHKBAhmhQEbf8R/XEAkyRpEkS4K8J+jkIgVyiQBJjpMgH/h3krxMgVwRBrn6kaCTawRI6rowyI1P/DtJ3RQGufWZ/7iGb1Mgd4RB7n4h6OSeMMgE1yQmk1BDdfJr0J3YgKzkQF2rlccbaymo3g8MqQCAsX1nWF8uZTrWUAJAcAnB0avlrOuaEKpTW03CihJD40d5rOdaEKrT3/rpxEYAo+6E9Fo543kNyCtSYYj6jm2SsXneXrY3UM25J0GGJgsx/efsqOsmhyckPfMPBKEIdUevzme7Nje8HNq17ZHOL7Y7sRFB/yVJRq3kfd5eUEznFxubatXZEW6bar8B4RdHqI6Phb0AAAAASUVORK5CYII=",
37743 e: 1
37744 },
37745 {
37746 id: "image_6",
37747 w: 99,
37748 h: 68,
37749 u: "",
37750 p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGMAAABECAYAAACVkosbAAAIyElEQVR4Xu1cQW8bRRj9vnFCc0uOVVOoUxJoBSjJL6iPUdWqFggkKqRYiANIoK4QQhWXbgEJBBy2gkMPCDkCLkVI5R+QE1JLZdqKplJSed2Ke32DJN5Bs7szO7s76521147trC+pms2sPW/e9973ZrwIA3odrTbKU+DUANEAgKdI0Hjy6+rNAd1uIobFvD/FfLWxAkANBFh3x3bvgP5P2KQlMP75ZfWvvO87CePlBsb8+TuMBTVAOCPmno+O/j/4D4SN0j4Y9s3Vp5MwiXl9hr7AKFcbc3sdpwYEWCk6wZc/n/sIK/ivOVvahFDr8Y1VM68PM+7j9AQG04PSvmMAAmPCrFeOgtXPK1P0/+WyxS+nBFpIqfHkRqEnmcA4fu52BSgalOCFYGLDupAOhAecuDH/B8FNp+Mcaj3RAmP+LNMDypiwLImxVHZ6Y4VAJCzyG6UZx7Drh09PEsFgerC7u28wUUamB+EJi9b/AKME0eYTjxExTxi3jQTMxz8vW+OuA1nefwyMo2t/lAlOm4CBNfVwCDuiYFV7/68p2pHr1OMG96MtQkjN/umV37N8qHG9VoBxfO12hSKYFNC1plwTAg0QvcKgypMYN8oeRNjEqU7Nrq/a4zrROu8b59du1SggY8IJlfvxVrwKCNHRDYgV3BhIBoHANUL2zUnVEzy2dpv5fCbOs9FJHwVWRMshILQJRdP+8eWJ0xN3vl2x/m/PAiRShMF1oAsr+K9SRFtpZRUalKxN4ffg366FBGp2fXL0JCTg82dvrQCULIr0zLBZoWMSwjGLWAmbCKRm10+PvZ4ore2x839WkYIFgL6lVdRvTVZoWlnf4UoMiIeMXbUJkV4FZ98aZz3p2vQdP3fHpOjmTrPdrWyS9cWMVjYKelLMklg62whg2D+8VNdxL6N2TWoH7oaBDrUA6Hqv+VNCp51oZRWiLXrDkMkIDJ1odHwpugvoGPb346UnqWDw1ePuUzBQEM4MpsFTl8Is/U74fbms+g1KaNjXx0NPtMHgoByrNqoEXFCUfQlfwvGJUfcrak3JXJ5S4hh6FXZ3R15PMoPBQTn+6h0TgET0hHfuilS2Xyub2Hyq4hilhrXZFrB9/fTI6knPYPD+pINgURLeYtVhRe9WNl7OFOVJxDly1O+z8C5lIn/99MjlXX2BIfTk9caKZ4WZnqgCxbj7EWDI7yCy+tO1SZsV4HJVytwAYINSMEdJT3IBg4Py7GuNKiVoBZF7Wirbt5XVss5eqqxcJG0k1HKmZizbWjjw/fhcweCgPPdGg6W/yrwreWI0RDvZykZPoYRYoGBFdEugRQk17W8PVk8GAobQkxliAYX1eCSfXsp04hg9rVA1nnFnx+7nRvWUmjvfHYyeDAwMoScXGyvEIW5/0hcrQvXeq/8BYIpyKOa7+z5MuI/xbkIRNihxTNsabn8ycDCEnrx5r4puf4J+f8JtsHqVJm/z9iXaynKW4OzagGA58MzQ9GRoYAg9uXjX9I98xvIudSrbt5VV7teHGOFRVmGHGatoi+Vdj6wXB340dehguHpSa8w5eyVWutblrGnAVjYLK3xgQizcJBSMbeuFgR1NPRAwOEvKF/9eoSXHohA9Epq8oaUn2olWNuKyYmeBNfb3YaPTmTYGYYUPFAyhJ2/dqxKCft6lKhdBGUlnD5vP7KKdlCwn3K+NCNbON0u5Hk0dCTAEU2r3TUqJAUj9I6NB1iWXdVXEHsQe+lY27fiRhoa1mP49+moxFz0ZKTC4ngBMs02tS/IED9LKZmRFqJT59noTqWNsf92fnowcGAFLtsoUnXrQn8hWOClm6X54QtVTRPKq6CZV187eLYhS/4MIG3szJcM2e4tWRhYMAco79ytACYu9pf14ta7ohJTiA6cEmuna5G8ThMNHBibrT8ydL57PfJRo5MEQoLz9wABCmWDOqmq9WrSTGsr+TUKUFR7rQuO2oOTUdj5f0o7qxwYMoSfTRxggl6LlRZsVPEOJr2iOuzenAYWi0XvwlYakMeTSBbhZcrD28MuF1KNEYwWGYMm7W2VwKCtd/lfWBm5lY128Tr8Tjlnotb0pYnbTk7EEQwKlAg7UkfD9+LS8q3t50rCyLmViQCScRVaUzjZFNHc+W1DqyViDIUB574GB1D28HftKW7qDCljVh2jHcq1uGoYILYdAbcdcCOnJRIDh6onRmCP/HjEpwUvqA9xDEW0p2k8IHn1PwX4QApsIUHtoenoyMWDIeoJTWAcq5V1xpxPrH4bFiuAbXHK6QK/uArDt6sl8ld/fqiBg3duPHxFWhFxWLKRkR1Mn+3Xyg4cGeF8GUuZdgjT5WVmFFQ73OwELw4tk4sHw9KQ5R5w9E4BK/Yn30dPLkzeR2a1smrOLNKSTqBndeF42tsolwDoF4u7HZ7ayQmXVGZhOdJ/EiokUcJ2iu2hsVxxw6hjaj1c3jrxh5+CF6BTutHsuT/w9H4oylQTQyQ+3DQSWd6G0Hx8uL32XJ2nJd2PFoWWGDA7TkxJ2TCBU2j/xxGSYrCjAkFBx9WRqSuRdwxJteWEc6jKlKl+LH21XKPL+RC5ZvW9opZWnQjNSlH7x40cGMD3pM+9KdGyK+xfM6AKKqydHOiYCxvZPvElOj+51WVFoho4PBoBTl5vlffdoKhXP2dLZWcwCRAGGJhj8ssXL2xUoEQspLMfyLrmd5ymH6EMi2VjCfYsylREQdvnSJ032MDS2QRTpT1R7I3pAFMzoAQj+J2WzOffMvmNQwCuqE/NBjxJ56kOXexbM6AMQ9qenzGbZ6VCLAl5Q71XoJ4AFGH2CIfTEbFbQAXZeeLkXVhRlKicg5GGWzCZ7piN7CE54/0TjXgUzNCYp6yWunrgPVMMrWf62ACPLbGW81tUTJOwhOF5/kvIqwEiboRx+f8psVhxEZoWXuw1XgJHDZOsOsfRps4bUBcXTk8irAEN3JnO6ztUT94FqcT0pwMhpkrMOo9KTAoyss5jz9bKeFGDkPLm9Dsf05H+6Q8nQwzMmWgAAAABJRU5ErkJggg==",
37751 e: 1
37752 },
37753 {
37754 id: "image_7",
37755 w: 49,
37756 h: 53,
37757 u: "",
37758 p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADEAAAA1CAYAAADoDQMKAAAE2ElEQVRoQ9WZXWscVRjH/2c2aRbSmlGo1BuzxQtfbkwFwdKLbEBEvDEXXigWut8g8w2cfoPJN9hCEe9ML1oFhTYUqVc2wQuFIklA0dqbXRTcbGaeR87svO+8nJmdbSYDIbnYl/N7zv/5P/9zInCGnwsX7m0CbImzyLC8fHdNE7AArMv1nykIXf9ad5wlC8w3osU/MxAvnL9rMmAAWEmqp/EQvu7BWM2SfmMhdP2bjmNT39d9Xu82DkLq3qYlUxBvqZpOoyCWX/rWEAQJsAImgNUwGgFx/tJ3XWGjz8yrIIYEEPK3/FF4ThWifel+pyW4D+Z1uWBBNFk4y789CC4GORUIvXNfPyHNZOItd7FSOi5EZOFRqILdeO4Q7dd+6GnEFohW3KoTQchqewCZUDkgzw2i/cajrnBggentmHRkxQMIb0diUJ7EThOivfaoI8aaxcQfT6rsVd+XTtAD3mLToPz3ZYDMbyfWHutt2AYcfOFLJVU6spmjjZx0J79Xcix3LhDtdx73mFkGNVf3geskqpzZyDGohMRSdqNWiPZ7P3eJqA/iVWXppEnM64lU+BTLrQWi3f2l44ypL5hcvw+qn3SdNOmouFPBAJwNonugL+I/Ew62wiGV3qCZ0lF1p5wBWBli8f0nBhOZIF4JFxiJC2muM6s7ZQzA0hALHz7psiP6Al7OScSFcPJOu46rcRWJRbNT1J1iAzGMI+oQHx2stSCHlZdzPL8PeiAysFSlM/26yQyZsty0vpGv855iiM0DXUPLAvGNeL6JSycaF4LXqQy2su7khcTA/YouCrRP/pAhzRCe3yeTZkw6sQb1ZoOKdKq4U2IApu/EZ083BZGsvpvvJ9km4jq51QtfG81EmdJJwCtP9Qh8HOL6sy7A0nHWgy/NiwHJRpMfnJeJZpXO9PTfZwfGBOLTPztotUwA4X1O1iHF12QyaSpIpw538oo0FA6MfwYfyIsECFx/aoLF9H1OMPr95JmdgULJRaZ1UHX/sJMTs6PfVeBOgujmwnjBGgw2BqE7ff539vkvy6PTJKbSNwWxO8+aNfAd24Yx+mvjcPryLA/Cr1DaIaWgejVKZ19zHOPf3zceZF+e5UHId+UdUsr2TZrEkmeJ0HWGzDBGv11zdZ9/eVYEIcWmGgMS7lTOmqPBkbaXjo/NwWGo+9kg5LvzDin+blR1p/hNxy4cpzf69eqU7meH8GUVHXgqh/tk32RP9SMB6o323s3UfT0QsQUlbulUp/q0Ow0FsXn80xX5D5PKj0BRT0Q/ulTsDi/F0oIjE7ZPjm0Te1cCv69KUQ4ibwCq9M1kJ3ZbttYb/fhmKd3XIyf/U/IOKTnuJIiPhEPG+OFbO1UrXn1OJN8pLTcnPqdIZwgmy/7+dZnN5vKUk1N0N5TcCbeckTDw4PLMuq9XTu7cSBmAkewkiHc1YuPk3uW9uZQ+8aHVdmJqAAaWeySYDWfn1dp1X/9OxJrcjQtDwWyRPbawM1/ppMFU3wlvN0C4BZCJr16pzTLLSrA6hMAuIEzcvlgpKpRdaM1yEkdgNvHly4URuc6F1gch+CYWzlnovzhXyywLrygncQeObZym7mfZiX0IYTRB91UghmAYTdJ9OQjGNs4tmk3TvRqEtEzb6TVV9wUQzw4h0Gu67vMg/gcsd5WVtPOCsgAAAABJRU5ErkJggg==",
37759 e: 1
37760 }
37761];
37762var layers = [
37763 {
37764 ddd: 1,
37765 ind: 1,
37766 ty: 2,
37767 nm: "qube-icon-08.ai",
37768 cl: "ai",
37769 parent: 2,
37770 refId: "image_0",
37771 sr: 1,
37772 ks: {
37773 o: {
37774 a: 1,
37775 k: [
37776 {
37777 i: {
37778 x: [
37779 0.833
37780 ],
37781 y: [
37782 0.833
37783 ]
37784 },
37785 o: {
37786 x: [
37787 0.167
37788 ],
37789 y: [
37790 0.167
37791 ]
37792 },
37793 n: [
37794 "0p833_0p833_0p167_0p167"
37795 ],
37796 t: 105,
37797 s: [
37798 0
37799 ],
37800 e: [
37801 100
37802 ]
37803 },
37804 {
37805 i: {
37806 x: [
37807 0.833
37808 ],
37809 y: [
37810 0.833
37811 ]
37812 },
37813 o: {
37814 x: [
37815 0.167
37816 ],
37817 y: [
37818 0.167
37819 ]
37820 },
37821 n: [
37822 "0p833_0p833_0p167_0p167"
37823 ],
37824 t: 119,
37825 s: [
37826 100
37827 ],
37828 e: [
37829 100
37830 ]
37831 },
37832 {
37833 i: {
37834 x: [
37835 0.833
37836 ],
37837 y: [
37838 0.833
37839 ]
37840 },
37841 o: {
37842 x: [
37843 0.167
37844 ],
37845 y: [
37846 0.167
37847 ]
37848 },
37849 n: [
37850 "0p833_0p833_0p167_0p167"
37851 ],
37852 t: 120,
37853 s: [
37854 100
37855 ],
37856 e: [
37857 0
37858 ]
37859 },
37860 {
37861 t: 135
37862 }
37863 ],
37864 ix: 11
37865 },
37866 rx: {
37867 a: 1,
37868 k: [
37869 {
37870 i: {
37871 x: [
37872 0.833
37873 ],
37874 y: [
37875 0.833
37876 ]
37877 },
37878 o: {
37879 x: [
37880 0.167
37881 ],
37882 y: [
37883 0.167
37884 ]
37885 },
37886 n: [
37887 "0p833_0p833_0p167_0p167"
37888 ],
37889 t: 105,
37890 s: [
37891 161
37892 ],
37893 e: [
37894 0
37895 ]
37896 },
37897 {
37898 i: {
37899 x: [
37900 0.833
37901 ],
37902 y: [
37903 0.833
37904 ]
37905 },
37906 o: {
37907 x: [
37908 0.167
37909 ],
37910 y: [
37911 0.167
37912 ]
37913 },
37914 n: [
37915 "0p833_0p833_0p167_0p167"
37916 ],
37917 t: 119,
37918 s: [
37919 0
37920 ],
37921 e: [
37922 0
37923 ]
37924 },
37925 {
37926 i: {
37927 x: [
37928 0.833
37929 ],
37930 y: [
37931 0.833
37932 ]
37933 },
37934 o: {
37935 x: [
37936 0.167
37937 ],
37938 y: [
37939 0.167
37940 ]
37941 },
37942 n: [
37943 "0p833_0p833_0p167_0p167"
37944 ],
37945 t: 120,
37946 s: [
37947 0
37948 ],
37949 e: [
37950 161
37951 ]
37952 },
37953 {
37954 t: 135
37955 }
37956 ],
37957 ix: 8
37958 },
37959 ry: {
37960 a: 1,
37961 k: [
37962 {
37963 i: {
37964 x: [
37965 0.833
37966 ],
37967 y: [
37968 0.833
37969 ]
37970 },
37971 o: {
37972 x: [
37973 0.167
37974 ],
37975 y: [
37976 0.167
37977 ]
37978 },
37979 n: [
37980 "0p833_0p833_0p167_0p167"
37981 ],
37982 t: 105,
37983 s: [
37984 -30
37985 ],
37986 e: [
37987 0
37988 ]
37989 },
37990 {
37991 i: {
37992 x: [
37993 0.833
37994 ],
37995 y: [
37996 0.833
37997 ]
37998 },
37999 o: {
38000 x: [
38001 0.167
38002 ],
38003 y: [
38004 0.167
38005 ]
38006 },
38007 n: [
38008 "0p833_0p833_0p167_0p167"
38009 ],
38010 t: 119,
38011 s: [
38012 0
38013 ],
38014 e: [
38015 0
38016 ]
38017 },
38018 {
38019 i: {
38020 x: [
38021 0.833
38022 ],
38023 y: [
38024 0.833
38025 ]
38026 },
38027 o: {
38028 x: [
38029 0.167
38030 ],
38031 y: [
38032 0.167
38033 ]
38034 },
38035 n: [
38036 "0p833_0p833_0p167_0p167"
38037 ],
38038 t: 120,
38039 s: [
38040 0
38041 ],
38042 e: [
38043 -30
38044 ]
38045 },
38046 {
38047 t: 135
38048 }
38049 ],
38050 ix: 9
38051 },
38052 rz: {
38053 a: 1,
38054 k: [
38055 {
38056 i: {
38057 x: [
38058 0.833
38059 ],
38060 y: [
38061 0.833
38062 ]
38063 },
38064 o: {
38065 x: [
38066 0.167
38067 ],
38068 y: [
38069 0.167
38070 ]
38071 },
38072 n: [
38073 "0p833_0p833_0p167_0p167"
38074 ],
38075 t: 105,
38076 s: [
38077 55
38078 ],
38079 e: [
38080 0
38081 ]
38082 },
38083 {
38084 i: {
38085 x: [
38086 0.833
38087 ],
38088 y: [
38089 0.833
38090 ]
38091 },
38092 o: {
38093 x: [
38094 0.167
38095 ],
38096 y: [
38097 0.167
38098 ]
38099 },
38100 n: [
38101 "0p833_0p833_0p167_0p167"
38102 ],
38103 t: 119,
38104 s: [
38105 0
38106 ],
38107 e: [
38108 0
38109 ]
38110 },
38111 {
38112 i: {
38113 x: [
38114 0.833
38115 ],
38116 y: [
38117 0.833
38118 ]
38119 },
38120 o: {
38121 x: [
38122 0.167
38123 ],
38124 y: [
38125 0.167
38126 ]
38127 },
38128 n: [
38129 "0p833_0p833_0p167_0p167"
38130 ],
38131 t: 120,
38132 s: [
38133 0
38134 ],
38135 e: [
38136 55
38137 ]
38138 },
38139 {
38140 t: 135
38141 }
38142 ],
38143 ix: 10
38144 },
38145 or: {
38146 a: 0,
38147 k: [
38148 0,
38149 0,
38150 0
38151 ],
38152 ix: 7
38153 },
38154 p: {
38155 a: 0,
38156 k: [
38157 25.583,
38158 28.396,
38159 2.282
38160 ],
38161 ix: 2
38162 },
38163 a: {
38164 a: 0,
38165 k: [
38166 0,
38167 13.937,
38168 0
38169 ],
38170 ix: 1
38171 },
38172 s: {
38173 a: 0,
38174 k: [
38175 100,
38176 100,
38177 100
38178 ],
38179 ix: 6
38180 }
38181 },
38182 ao: 0,
38183 ip: 105,
38184 op: 135,
38185 st: 55,
38186 bm: 0
38187 },
38188 {
38189 ddd: 1,
38190 ind: 2,
38191 ty: 2,
38192 nm: "qube-icon-07.ai",
38193 cl: "ai",
38194 parent: 3,
38195 refId: "image_1",
38196 sr: 1,
38197 ks: {
38198 o: {
38199 a: 1,
38200 k: [
38201 {
38202 i: {
38203 x: [
38204 0.833
38205 ],
38206 y: [
38207 0.833
38208 ]
38209 },
38210 o: {
38211 x: [
38212 0.167
38213 ],
38214 y: [
38215 0.167
38216 ]
38217 },
38218 n: [
38219 "0p833_0p833_0p167_0p167"
38220 ],
38221 t: 89.999,
38222 s: [
38223 0
38224 ],
38225 e: [
38226 100
38227 ]
38228 },
38229 {
38230 i: {
38231 x: [
38232 0.833
38233 ],
38234 y: [
38235 0.833
38236 ]
38237 },
38238 o: {
38239 x: [
38240 0.167
38241 ],
38242 y: [
38243 0.167
38244 ]
38245 },
38246 n: [
38247 "0p833_0p833_0p167_0p167"
38248 ],
38249 t: 104.999,
38250 s: [
38251 100
38252 ],
38253 e: [
38254 100
38255 ]
38256 },
38257 {
38258 i: {
38259 x: [
38260 0.833
38261 ],
38262 y: [
38263 0.833
38264 ]
38265 },
38266 o: {
38267 x: [
38268 0.167
38269 ],
38270 y: [
38271 0.167
38272 ]
38273 },
38274 n: [
38275 "0p833_0p833_0p167_0p167"
38276 ],
38277 t: 134.999,
38278 s: [
38279 100
38280 ],
38281 e: [
38282 0
38283 ]
38284 },
38285 {
38286 t: 149.99921875
38287 }
38288 ],
38289 ix: 11
38290 },
38291 rx: {
38292 a: 1,
38293 k: [
38294 {
38295 i: {
38296 x: [
38297 0.833
38298 ],
38299 y: [
38300 0.833
38301 ]
38302 },
38303 o: {
38304 x: [
38305 0.167
38306 ],
38307 y: [
38308 0.167
38309 ]
38310 },
38311 n: [
38312 "0p833_0p833_0p167_0p167"
38313 ],
38314 t: 89.999,
38315 s: [
38316 174
38317 ],
38318 e: [
38319 0
38320 ]
38321 },
38322 {
38323 i: {
38324 x: [
38325 0.833
38326 ],
38327 y: [
38328 0.833
38329 ]
38330 },
38331 o: {
38332 x: [
38333 0.167
38334 ],
38335 y: [
38336 0.167
38337 ]
38338 },
38339 n: [
38340 "0p833_0p833_0p167_0p167"
38341 ],
38342 t: 104.999,
38343 s: [
38344 0
38345 ],
38346 e: [
38347 0
38348 ]
38349 },
38350 {
38351 i: {
38352 x: [
38353 0.833
38354 ],
38355 y: [
38356 0.833
38357 ]
38358 },
38359 o: {
38360 x: [
38361 0.167
38362 ],
38363 y: [
38364 0.167
38365 ]
38366 },
38367 n: [
38368 "0p833_0p833_0p167_0p167"
38369 ],
38370 t: 134.999,
38371 s: [
38372 0
38373 ],
38374 e: [
38375 174
38376 ]
38377 },
38378 {
38379 t: 149.99921875
38380 }
38381 ],
38382 ix: 8
38383 },
38384 ry: {
38385 a: 0,
38386 k: 0,
38387 ix: 9
38388 },
38389 rz: {
38390 a: 1,
38391 k: [
38392 {
38393 i: {
38394 x: [
38395 0.833
38396 ],
38397 y: [
38398 0.833
38399 ]
38400 },
38401 o: {
38402 x: [
38403 0.167
38404 ],
38405 y: [
38406 0.167
38407 ]
38408 },
38409 n: [
38410 "0p833_0p833_0p167_0p167"
38411 ],
38412 t: 89.999,
38413 s: [
38414 62
38415 ],
38416 e: [
38417 0
38418 ]
38419 },
38420 {
38421 i: {
38422 x: [
38423 0.833
38424 ],
38425 y: [
38426 0.833
38427 ]
38428 },
38429 o: {
38430 x: [
38431 0.167
38432 ],
38433 y: [
38434 0.167
38435 ]
38436 },
38437 n: [
38438 "0p833_0p833_0p167_0p167"
38439 ],
38440 t: 104.999,
38441 s: [
38442 0
38443 ],
38444 e: [
38445 0
38446 ]
38447 },
38448 {
38449 i: {
38450 x: [
38451 0.833
38452 ],
38453 y: [
38454 0.833
38455 ]
38456 },
38457 o: {
38458 x: [
38459 0.167
38460 ],
38461 y: [
38462 0.167
38463 ]
38464 },
38465 n: [
38466 "0p833_0p833_0p167_0p167"
38467 ],
38468 t: 134.999,
38469 s: [
38470 0
38471 ],
38472 e: [
38473 62
38474 ]
38475 },
38476 {
38477 t: 149.99921875
38478 }
38479 ],
38480 ix: 10
38481 },
38482 or: {
38483 a: 0,
38484 k: [
38485 0,
38486 0,
38487 0
38488 ],
38489 ix: 7
38490 },
38491 p: {
38492 a: 0,
38493 k: [
38494 12.625,
38495 106.25,
38496 0
38497 ],
38498 ix: 2
38499 },
38500 a: {
38501 a: 0,
38502 k: [
38503 12.75,
38504 6.938,
38505 0
38506 ],
38507 ix: 1
38508 },
38509 s: {
38510 a: 0,
38511 k: [
38512 100,
38513 100,
38514 100
38515 ],
38516 ix: 6
38517 }
38518 },
38519 ao: 0,
38520 ip: 90,
38521 op: 150,
38522 st: 100.8,
38523 bm: 0
38524 },
38525 {
38526 ddd: 1,
38527 ind: 3,
38528 ty: 2,
38529 nm: "qube-icon-06.ai",
38530 cl: "ai",
38531 parent: 4,
38532 refId: "image_2",
38533 sr: 1,
38534 ks: {
38535 o: {
38536 a: 1,
38537 k: [
38538 {
38539 i: {
38540 x: [
38541 0.833
38542 ],
38543 y: [
38544 0.833
38545 ]
38546 },
38547 o: {
38548 x: [
38549 0.167
38550 ],
38551 y: [
38552 0.167
38553 ]
38554 },
38555 n: [
38556 "0p833_0p833_0p167_0p167"
38557 ],
38558 t: 75,
38559 s: [
38560 0
38561 ],
38562 e: [
38563 100
38564 ]
38565 },
38566 {
38567 i: {
38568 x: [
38569 0.833
38570 ],
38571 y: [
38572 0.833
38573 ]
38574 },
38575 o: {
38576 x: [
38577 0.167
38578 ],
38579 y: [
38580 0.167
38581 ]
38582 },
38583 n: [
38584 "0p833_0p833_0p167_0p167"
38585 ],
38586 t: 90,
38587 s: [
38588 100
38589 ],
38590 e: [
38591 100
38592 ]
38593 },
38594 {
38595 i: {
38596 x: [
38597 0.833
38598 ],
38599 y: [
38600 0.833
38601 ]
38602 },
38603 o: {
38604 x: [
38605 0.167
38606 ],
38607 y: [
38608 0.167
38609 ]
38610 },
38611 n: [
38612 "0p833_0p833_0p167_0p167"
38613 ],
38614 t: 150,
38615 s: [
38616 100
38617 ],
38618 e: [
38619 0
38620 ]
38621 },
38622 {
38623 t: 166
38624 }
38625 ],
38626 ix: 11
38627 },
38628 rx: {
38629 a: 1,
38630 k: [
38631 {
38632 i: {
38633 x: [
38634 0.833
38635 ],
38636 y: [
38637 0.833
38638 ]
38639 },
38640 o: {
38641 x: [
38642 0.167
38643 ],
38644 y: [
38645 0.167
38646 ]
38647 },
38648 n: [
38649 "0p833_0p833_0p167_0p167"
38650 ],
38651 t: 75,
38652 s: [
38653 -170
38654 ],
38655 e: [
38656 0
38657 ]
38658 },
38659 {
38660 i: {
38661 x: [
38662 0.833
38663 ],
38664 y: [
38665 0.833
38666 ]
38667 },
38668 o: {
38669 x: [
38670 0.167
38671 ],
38672 y: [
38673 0.167
38674 ]
38675 },
38676 n: [
38677 "0p833_0p833_0p167_0p167"
38678 ],
38679 t: 90,
38680 s: [
38681 0
38682 ],
38683 e: [
38684 0
38685 ]
38686 },
38687 {
38688 i: {
38689 x: [
38690 0.833
38691 ],
38692 y: [
38693 0.833
38694 ]
38695 },
38696 o: {
38697 x: [
38698 0.167
38699 ],
38700 y: [
38701 0.167
38702 ]
38703 },
38704 n: [
38705 "0p833_0p833_0p167_0p167"
38706 ],
38707 t: 150,
38708 s: [
38709 0
38710 ],
38711 e: [
38712 -170
38713 ]
38714 },
38715 {
38716 t: 166
38717 }
38718 ],
38719 ix: 8
38720 },
38721 ry: {
38722 a: 0,
38723 k: 0,
38724 ix: 9
38725 },
38726 rz: {
38727 a: 1,
38728 k: [
38729 {
38730 i: {
38731 x: [
38732 0.833
38733 ],
38734 y: [
38735 0.833
38736 ]
38737 },
38738 o: {
38739 x: [
38740 0.167
38741 ],
38742 y: [
38743 0.167
38744 ]
38745 },
38746 n: [
38747 "0p833_0p833_0p167_0p167"
38748 ],
38749 t: 75,
38750 s: [
38751 59
38752 ],
38753 e: [
38754 0
38755 ]
38756 },
38757 {
38758 i: {
38759 x: [
38760 0.833
38761 ],
38762 y: [
38763 0.833
38764 ]
38765 },
38766 o: {
38767 x: [
38768 0.167
38769 ],
38770 y: [
38771 0.167
38772 ]
38773 },
38774 n: [
38775 "0p833_0p833_0p167_0p167"
38776 ],
38777 t: 90,
38778 s: [
38779 0
38780 ],
38781 e: [
38782 0
38783 ]
38784 },
38785 {
38786 i: {
38787 x: [
38788 0.833
38789 ],
38790 y: [
38791 0.833
38792 ]
38793 },
38794 o: {
38795 x: [
38796 0.167
38797 ],
38798 y: [
38799 0.167
38800 ]
38801 },
38802 n: [
38803 "0p833_0p833_0p167_0p167"
38804 ],
38805 t: 150,
38806 s: [
38807 0
38808 ],
38809 e: [
38810 59
38811 ]
38812 },
38813 {
38814 t: 166
38815 }
38816 ],
38817 ix: 10
38818 },
38819 or: {
38820 a: 0,
38821 k: [
38822 0,
38823 0,
38824 0
38825 ],
38826 ix: 7
38827 },
38828 p: {
38829 a: 0,
38830 k: [
38831 86,
38832 64.156,
38833 0
38834 ],
38835 ix: 2
38836 },
38837 a: {
38838 a: 0,
38839 k: [
38840 11.75,
38841 7.5,
38842 0
38843 ],
38844 ix: 1
38845 },
38846 s: {
38847 a: 0,
38848 k: [
38849 100,
38850 100,
38851 100
38852 ],
38853 ix: 6
38854 }
38855 },
38856 ao: 0,
38857 ip: 75,
38858 op: 165.6,
38859 st: 84,
38860 bm: 0
38861 },
38862 {
38863 ddd: 1,
38864 ind: 4,
38865 ty: 2,
38866 nm: "qube-icon-05.ai",
38867 cl: "ai",
38868 parent: 5,
38869 refId: "image_3",
38870 sr: 1,
38871 ks: {
38872 o: {
38873 a: 1,
38874 k: [
38875 {
38876 i: {
38877 x: [
38878 0.833
38879 ],
38880 y: [
38881 0.833
38882 ]
38883 },
38884 o: {
38885 x: [
38886 0.167
38887 ],
38888 y: [
38889 0.167
38890 ]
38891 },
38892 n: [
38893 "0p833_0p833_0p167_0p167"
38894 ],
38895 t: 60.001,
38896 s: [
38897 0
38898 ],
38899 e: [
38900 100
38901 ]
38902 },
38903 {
38904 i: {
38905 x: [
38906 0.833
38907 ],
38908 y: [
38909 0.833
38910 ]
38911 },
38912 o: {
38913 x: [
38914 0.167
38915 ],
38916 y: [
38917 0.167
38918 ]
38919 },
38920 n: [
38921 "0p833_0p833_0p167_0p167"
38922 ],
38923 t: 75.001,
38924 s: [
38925 100
38926 ],
38927 e: [
38928 100
38929 ]
38930 },
38931 {
38932 i: {
38933 x: [
38934 0.833
38935 ],
38936 y: [
38937 0.833
38938 ]
38939 },
38940 o: {
38941 x: [
38942 0.167
38943 ],
38944 y: [
38945 0.167
38946 ]
38947 },
38948 n: [
38949 "0p833_0p833_0p167_0p167"
38950 ],
38951 t: 166.001,
38952 s: [
38953 100
38954 ],
38955 e: [
38956 0
38957 ]
38958 },
38959 {
38960 t: 180.00078125
38961 }
38962 ],
38963 ix: 11
38964 },
38965 rx: {
38966 a: 0,
38967 k: 0,
38968 ix: 8
38969 },
38970 ry: {
38971 a: 1,
38972 k: [
38973 {
38974 i: {
38975 x: [
38976 0.833
38977 ],
38978 y: [
38979 0.833
38980 ]
38981 },
38982 o: {
38983 x: [
38984 0.167
38985 ],
38986 y: [
38987 0.167
38988 ]
38989 },
38990 n: [
38991 "0p833_0p833_0p167_0p167"
38992 ],
38993 t: 60.001,
38994 s: [
38995 178
38996 ],
38997 e: [
38998 0
38999 ]
39000 },
39001 {
39002 i: {
39003 x: [
39004 0.833
39005 ],
39006 y: [
39007 0.833
39008 ]
39009 },
39010 o: {
39011 x: [
39012 0.167
39013 ],
39014 y: [
39015 0.167
39016 ]
39017 },
39018 n: [
39019 "0p833_0p833_0p167_0p167"
39020 ],
39021 t: 75.001,
39022 s: [
39023 0
39024 ],
39025 e: [
39026 0
39027 ]
39028 },
39029 {
39030 i: {
39031 x: [
39032 0.833
39033 ],
39034 y: [
39035 0.833
39036 ]
39037 },
39038 o: {
39039 x: [
39040 0.167
39041 ],
39042 y: [
39043 0.167
39044 ]
39045 },
39046 n: [
39047 "0p833_0p833_0p167_0p167"
39048 ],
39049 t: 166.001,
39050 s: [
39051 0
39052 ],
39053 e: [
39054 178
39055 ]
39056 },
39057 {
39058 t: 180.00078125
39059 }
39060 ],
39061 ix: 9
39062 },
39063 rz: {
39064 a: 0,
39065 k: 0,
39066 ix: 10
39067 },
39068 or: {
39069 a: 0,
39070 k: [
39071 0,
39072 0,
39073 0
39074 ],
39075 ix: 7
39076 },
39077 p: {
39078 a: 0,
39079 k: [
39080 99,
39081 15,
39082 0
39083 ],
39084 ix: 2
39085 },
39086 a: {
39087 a: 0,
39088 k: [
39089 0,
39090 15.25,
39091 0
39092 ],
39093 ix: 1
39094 },
39095 s: {
39096 a: 0,
39097 k: [
39098 100,
39099 100,
39100 100
39101 ],
39102 ix: 6
39103 }
39104 },
39105 ao: 0,
39106 ip: 60,
39107 op: 180,
39108 st: 67.2,
39109 bm: 0
39110 },
39111 {
39112 ddd: 1,
39113 ind: 5,
39114 ty: 2,
39115 nm: "qube-icon-04.ai",
39116 cl: "ai",
39117 parent: 6,
39118 refId: "image_4",
39119 sr: 1,
39120 ks: {
39121 o: {
39122 a: 1,
39123 k: [
39124 {
39125 i: {
39126 x: [
39127 0.833
39128 ],
39129 y: [
39130 0.833
39131 ]
39132 },
39133 o: {
39134 x: [
39135 0.167
39136 ],
39137 y: [
39138 0.167
39139 ]
39140 },
39141 n: [
39142 "0p833_0p833_0p167_0p167"
39143 ],
39144 t: 46,
39145 s: [
39146 0
39147 ],
39148 e: [
39149 100
39150 ]
39151 },
39152 {
39153 i: {
39154 x: [
39155 0.833
39156 ],
39157 y: [
39158 0.833
39159 ]
39160 },
39161 o: {
39162 x: [
39163 0.167
39164 ],
39165 y: [
39166 0.167
39167 ]
39168 },
39169 n: [
39170 "0p833_0p833_0p167_0p167"
39171 ],
39172 t: 60,
39173 s: [
39174 100
39175 ],
39176 e: [
39177 100
39178 ]
39179 },
39180 {
39181 i: {
39182 x: [
39183 0.833
39184 ],
39185 y: [
39186 0.833
39187 ]
39188 },
39189 o: {
39190 x: [
39191 0.167
39192 ],
39193 y: [
39194 0.167
39195 ]
39196 },
39197 n: [
39198 "0p833_0p833_0p167_0p167"
39199 ],
39200 t: 180,
39201 s: [
39202 100
39203 ],
39204 e: [
39205 0
39206 ]
39207 },
39208 {
39209 t: 194.999609375
39210 }
39211 ],
39212 ix: 11
39213 },
39214 rx: {
39215 a: 1,
39216 k: [
39217 {
39218 i: {
39219 x: [
39220 0.833
39221 ],
39222 y: [
39223 0.833
39224 ]
39225 },
39226 o: {
39227 x: [
39228 0.167
39229 ],
39230 y: [
39231 0.167
39232 ]
39233 },
39234 n: [
39235 "0p833_0p833_0p167_0p167"
39236 ],
39237 t: 46,
39238 s: [
39239 189
39240 ],
39241 e: [
39242 0
39243 ]
39244 },
39245 {
39246 i: {
39247 x: [
39248 0.833
39249 ],
39250 y: [
39251 0.833
39252 ]
39253 },
39254 o: {
39255 x: [
39256 0.167
39257 ],
39258 y: [
39259 0.167
39260 ]
39261 },
39262 n: [
39263 "0p833_0p833_0p167_0p167"
39264 ],
39265 t: 60,
39266 s: [
39267 0
39268 ],
39269 e: [
39270 0
39271 ]
39272 },
39273 {
39274 i: {
39275 x: [
39276 0.833
39277 ],
39278 y: [
39279 0.833
39280 ]
39281 },
39282 o: {
39283 x: [
39284 0.167
39285 ],
39286 y: [
39287 0.167
39288 ]
39289 },
39290 n: [
39291 "0p833_0p833_0p167_0p167"
39292 ],
39293 t: 180,
39294 s: [
39295 0
39296 ],
39297 e: [
39298 189
39299 ]
39300 },
39301 {
39302 t: 194.999609375
39303 }
39304 ],
39305 ix: 8
39306 },
39307 ry: {
39308 a: 0,
39309 k: 0,
39310 ix: 9
39311 },
39312 rz: {
39313 a: 1,
39314 k: [
39315 {
39316 i: {
39317 x: [
39318 0.833
39319 ],
39320 y: [
39321 0.833
39322 ]
39323 },
39324 o: {
39325 x: [
39326 0.167
39327 ],
39328 y: [
39329 0.167
39330 ]
39331 },
39332 n: [
39333 "0p833_0p833_0p167_0p167"
39334 ],
39335 t: 46,
39336 s: [
39337 -61
39338 ],
39339 e: [
39340 0
39341 ]
39342 },
39343 {
39344 i: {
39345 x: [
39346 0.833
39347 ],
39348 y: [
39349 0.833
39350 ]
39351 },
39352 o: {
39353 x: [
39354 0.167
39355 ],
39356 y: [
39357 0.167
39358 ]
39359 },
39360 n: [
39361 "0p833_0p833_0p167_0p167"
39362 ],
39363 t: 60,
39364 s: [
39365 0
39366 ],
39367 e: [
39368 0
39369 ]
39370 },
39371 {
39372 i: {
39373 x: [
39374 0.833
39375 ],
39376 y: [
39377 0.833
39378 ]
39379 },
39380 o: {
39381 x: [
39382 0.167
39383 ],
39384 y: [
39385 0.167
39386 ]
39387 },
39388 n: [
39389 "0p833_0p833_0p167_0p167"
39390 ],
39391 t: 180,
39392 s: [
39393 0
39394 ],
39395 e: [
39396 -61
39397 ]
39398 },
39399 {
39400 t: 194.999609375
39401 }
39402 ],
39403 ix: 10
39404 },
39405 or: {
39406 a: 0,
39407 k: [
39408 0,
39409 0,
39410 0
39411 ],
39412 ix: 7
39413 },
39414 p: {
39415 a: 0,
39416 k: [
39417 12.125,
39418 7.938,
39419 0
39420 ],
39421 ix: 2
39422 },
39423 a: {
39424 a: 0,
39425 k: [
39426 12.5,
39427 64.5,
39428 0
39429 ],
39430 ix: 1
39431 },
39432 s: {
39433 a: 0,
39434 k: [
39435 100,
39436 100,
39437 100
39438 ],
39439 ix: 6
39440 }
39441 },
39442 ao: 0,
39443 ip: 46,
39444 op: 195,
39445 st: 50.4,
39446 bm: 0
39447 },
39448 {
39449 ddd: 1,
39450 ind: 6,
39451 ty: 2,
39452 nm: "qube-icon-03.ai",
39453 cl: "ai",
39454 parent: 7,
39455 refId: "image_5",
39456 sr: 1,
39457 ks: {
39458 o: {
39459 a: 1,
39460 k: [
39461 {
39462 i: {
39463 x: [
39464 0.833
39465 ],
39466 y: [
39467 0.833
39468 ]
39469 },
39470 o: {
39471 x: [
39472 0.167
39473 ],
39474 y: [
39475 0.167
39476 ]
39477 },
39478 n: [
39479 "0p833_0p833_0p167_0p167"
39480 ],
39481 t: 30,
39482 s: [
39483 0
39484 ],
39485 e: [
39486 100
39487 ]
39488 },
39489 {
39490 i: {
39491 x: [
39492 0.833
39493 ],
39494 y: [
39495 0.833
39496 ]
39497 },
39498 o: {
39499 x: [
39500 0.167
39501 ],
39502 y: [
39503 0.167
39504 ]
39505 },
39506 n: [
39507 "0p833_0p833_0p167_0p167"
39508 ],
39509 t: 46,
39510 s: [
39511 100
39512 ],
39513 e: [
39514 100
39515 ]
39516 },
39517 {
39518 i: {
39519 x: [
39520 0.833
39521 ],
39522 y: [
39523 0.833
39524 ]
39525 },
39526 o: {
39527 x: [
39528 0.167
39529 ],
39530 y: [
39531 0.167
39532 ]
39533 },
39534 n: [
39535 "0p833_0p833_0p167_0p167"
39536 ],
39537 t: 195,
39538 s: [
39539 100
39540 ],
39541 e: [
39542 0
39543 ]
39544 },
39545 {
39546 t: 211.000390625
39547 }
39548 ],
39549 ix: 11
39550 },
39551 rx: {
39552 a: 1,
39553 k: [
39554 {
39555 i: {
39556 x: [
39557 0.833
39558 ],
39559 y: [
39560 0.833
39561 ]
39562 },
39563 o: {
39564 x: [
39565 0.167
39566 ],
39567 y: [
39568 0.167
39569 ]
39570 },
39571 n: [
39572 "0p833_0p833_0p167_0p167"
39573 ],
39574 t: 30,
39575 s: [
39576 178
39577 ],
39578 e: [
39579 0
39580 ]
39581 },
39582 {
39583 i: {
39584 x: [
39585 0.833
39586 ],
39587 y: [
39588 0.833
39589 ]
39590 },
39591 o: {
39592 x: [
39593 0.167
39594 ],
39595 y: [
39596 0.167
39597 ]
39598 },
39599 n: [
39600 "0p833_0p833_0p167_0p167"
39601 ],
39602 t: 46,
39603 s: [
39604 0
39605 ],
39606 e: [
39607 0
39608 ]
39609 },
39610 {
39611 i: {
39612 x: [
39613 0.833
39614 ],
39615 y: [
39616 0.833
39617 ]
39618 },
39619 o: {
39620 x: [
39621 0.167
39622 ],
39623 y: [
39624 0.167
39625 ]
39626 },
39627 n: [
39628 "0p833_0p833_0p167_0p167"
39629 ],
39630 t: 195,
39631 s: [
39632 0
39633 ],
39634 e: [
39635 178
39636 ]
39637 },
39638 {
39639 t: 211.000390625
39640 }
39641 ],
39642 ix: 8
39643 },
39644 ry: {
39645 a: 0,
39646 k: 0,
39647 ix: 9
39648 },
39649 rz: {
39650 a: 1,
39651 k: [
39652 {
39653 i: {
39654 x: [
39655 0.833
39656 ],
39657 y: [
39658 0.833
39659 ]
39660 },
39661 o: {
39662 x: [
39663 0.167
39664 ],
39665 y: [
39666 0.167
39667 ]
39668 },
39669 n: [
39670 "0p833_0p833_0p167_0p167"
39671 ],
39672 t: 30,
39673 s: [
39674 59
39675 ],
39676 e: [
39677 0
39678 ]
39679 },
39680 {
39681 i: {
39682 x: [
39683 0.833
39684 ],
39685 y: [
39686 0.833
39687 ]
39688 },
39689 o: {
39690 x: [
39691 0.167
39692 ],
39693 y: [
39694 0.167
39695 ]
39696 },
39697 n: [
39698 "0p833_0p833_0p167_0p167"
39699 ],
39700 t: 46,
39701 s: [
39702 0
39703 ],
39704 e: [
39705 0
39706 ]
39707 },
39708 {
39709 i: {
39710 x: [
39711 0.833
39712 ],
39713 y: [
39714 0.833
39715 ]
39716 },
39717 o: {
39718 x: [
39719 0.167
39720 ],
39721 y: [
39722 0.167
39723 ]
39724 },
39725 n: [
39726 "0p833_0p833_0p167_0p167"
39727 ],
39728 t: 195,
39729 s: [
39730 0
39731 ],
39732 e: [
39733 59
39734 ]
39735 },
39736 {
39737 t: 211.000390625
39738 }
39739 ],
39740 ix: 10
39741 },
39742 or: {
39743 a: 0,
39744 k: [
39745 0,
39746 0,
39747 0
39748 ],
39749 ix: 7
39750 },
39751 p: {
39752 a: 0,
39753 k: [
39754 13,
39755 5.25,
39756 0
39757 ],
39758 ix: 2
39759 },
39760 a: {
39761 a: 0,
39762 k: [
39763 12.5,
39764 93.25,
39765 0
39766 ],
39767 ix: 1
39768 },
39769 s: {
39770 a: 0,
39771 k: [
39772 100,
39773 100,
39774 100
39775 ],
39776 ix: 6
39777 }
39778 },
39779 ao: 0,
39780 ip: 30,
39781 op: 211,
39782 st: 33.6,
39783 bm: 0
39784 },
39785 {
39786 ddd: 1,
39787 ind: 7,
39788 ty: 2,
39789 nm: "qube-icon-02.ai",
39790 cl: "ai",
39791 parent: 8,
39792 refId: "image_6",
39793 sr: 1,
39794 ks: {
39795 o: {
39796 a: 1,
39797 k: [
39798 {
39799 i: {
39800 x: [
39801 0.833
39802 ],
39803 y: [
39804 0.833
39805 ]
39806 },
39807 o: {
39808 x: [
39809 0.167
39810 ],
39811 y: [
39812 0.167
39813 ]
39814 },
39815 n: [
39816 "0p833_0p833_0p167_0p167"
39817 ],
39818 t: 14.999,
39819 s: [
39820 0
39821 ],
39822 e: [
39823 100
39824 ]
39825 },
39826 {
39827 i: {
39828 x: [
39829 0.833
39830 ],
39831 y: [
39832 0.833
39833 ]
39834 },
39835 o: {
39836 x: [
39837 0.167
39838 ],
39839 y: [
39840 0.167
39841 ]
39842 },
39843 n: [
39844 "0p833_0p833_0p167_0p167"
39845 ],
39846 t: 29.999,
39847 s: [
39848 100
39849 ],
39850 e: [
39851 100
39852 ]
39853 },
39854 {
39855 i: {
39856 x: [
39857 0.833
39858 ],
39859 y: [
39860 0.833
39861 ]
39862 },
39863 o: {
39864 x: [
39865 0.167
39866 ],
39867 y: [
39868 0.167
39869 ]
39870 },
39871 n: [
39872 "0p833_0p833_0p167_0p167"
39873 ],
39874 t: 210.999,
39875 s: [
39876 100
39877 ],
39878 e: [
39879 0
39880 ]
39881 },
39882 {
39883 t: 225.99921875
39884 }
39885 ],
39886 ix: 11
39887 },
39888 rx: {
39889 a: 0,
39890 k: 0,
39891 ix: 8
39892 },
39893 ry: {
39894 a: 1,
39895 k: [
39896 {
39897 i: {
39898 x: [
39899 0.833
39900 ],
39901 y: [
39902 0.833
39903 ]
39904 },
39905 o: {
39906 x: [
39907 0.167
39908 ],
39909 y: [
39910 0.167
39911 ]
39912 },
39913 n: [
39914 "0p833_0p833_0p167_0p167"
39915 ],
39916 t: 14.999,
39917 s: [
39918 -181
39919 ],
39920 e: [
39921 0
39922 ]
39923 },
39924 {
39925 i: {
39926 x: [
39927 0.833
39928 ],
39929 y: [
39930 0.833
39931 ]
39932 },
39933 o: {
39934 x: [
39935 0.167
39936 ],
39937 y: [
39938 0.167
39939 ]
39940 },
39941 n: [
39942 "0p833_0p833_0p167_0p167"
39943 ],
39944 t: 29.999,
39945 s: [
39946 0
39947 ],
39948 e: [
39949 0
39950 ]
39951 },
39952 {
39953 i: {
39954 x: [
39955 0.833
39956 ],
39957 y: [
39958 0.833
39959 ]
39960 },
39961 o: {
39962 x: [
39963 0.167
39964 ],
39965 y: [
39966 0.167
39967 ]
39968 },
39969 n: [
39970 "0p833_0p833_0p167_0p167"
39971 ],
39972 t: 210.999,
39973 s: [
39974 0
39975 ],
39976 e: [
39977 -181
39978 ]
39979 },
39980 {
39981 t: 225.99921875
39982 }
39983 ],
39984 ix: 9
39985 },
39986 rz: {
39987 a: 0,
39988 k: 0,
39989 ix: 10
39990 },
39991 or: {
39992 a: 0,
39993 k: [
39994 0,
39995 0,
39996 0
39997 ],
39998 ix: 7
39999 },
40000 p: {
40001 a: 0,
40002 k: [
40003 0.25,
40004 53.25,
40005 0
40006 ],
40007 ix: 2
40008 },
40009 a: {
40010 a: 0,
40011 k: [
40012 99,
40013 68,
40014 0
40015 ],
40016 ix: 1
40017 },
40018 s: {
40019 a: 0,
40020 k: [
40021 100,
40022 100,
40023 100
40024 ],
40025 ix: 6
40026 }
40027 },
40028 ao: 0,
40029 ip: 15,
40030 op: 226,
40031 st: 4.8,
40032 bm: 0
40033 },
40034 {
40035 ddd: 1,
40036 ind: 8,
40037 ty: 2,
40038 nm: "qube-icon-01.ai",
40039 cl: "ai",
40040 refId: "image_7",
40041 sr: 1,
40042 ks: {
40043 o: {
40044 a: 0,
40045 k: 100,
40046 ix: 11
40047 },
40048 rx: {
40049 a: 1,
40050 k: [
40051 {
40052 i: {
40053 x: [
40054 0.833
40055 ],
40056 y: [
40057 0.833
40058 ]
40059 },
40060 o: {
40061 x: [
40062 0.167
40063 ],
40064 y: [
40065 0.167
40066 ]
40067 },
40068 n: [
40069 "0p833_0p833_0p167_0p167"
40070 ],
40071 t: 0,
40072 s: [
40073 85
40074 ],
40075 e: [
40076 0
40077 ]
40078 },
40079 {
40080 i: {
40081 x: [
40082 0.833
40083 ],
40084 y: [
40085 0.833
40086 ]
40087 },
40088 o: {
40089 x: [
40090 0.167
40091 ],
40092 y: [
40093 0.167
40094 ]
40095 },
40096 n: [
40097 "0p833_0p833_0p167_0p167"
40098 ],
40099 t: 15,
40100 s: [
40101 0
40102 ],
40103 e: [
40104 0
40105 ]
40106 },
40107 {
40108 i: {
40109 x: [
40110 0.833
40111 ],
40112 y: [
40113 0.833
40114 ]
40115 },
40116 o: {
40117 x: [
40118 0.167
40119 ],
40120 y: [
40121 0.167
40122 ]
40123 },
40124 n: [
40125 "0p833_0p833_0p167_0p167"
40126 ],
40127 t: 226,
40128 s: [
40129 0
40130 ],
40131 e: [
40132 85
40133 ]
40134 },
40135 {
40136 t: 239
40137 }
40138 ],
40139 ix: 8,
40140 x: "var $bm_rt;\n$bm_rt = transform.xRotation;"
40141 },
40142 ry: {
40143 a: 0,
40144 k: 0,
40145 ix: 9
40146 },
40147 rz: {
40148 a: 0,
40149 k: 0,
40150 ix: 10
40151 },
40152 or: {
40153 a: 0,
40154 k: [
40155 0,
40156 0,
40157 0
40158 ],
40159 ix: 7
40160 },
40161 p: {
40162 a: 0,
40163 k: [
40164 296.75,
40165 309.25,
40166 0
40167 ],
40168 ix: 2
40169 },
40170 a: {
40171 a: 0,
40172 k: [
40173 49,
40174 -0.062,
40175 0
40176 ],
40177 ix: 1
40178 },
40179 s: {
40180 a: 0,
40181 k: [
40182 100,
40183 100,
40184 100
40185 ],
40186 ix: 6
40187 }
40188 },
40189 ao: 0,
40190 ip: 0,
40191 op: 240,
40192 st: 0,
40193 bm: 0
40194 }
40195];
40196var markers = [
40197];
40198var blueAnimation = {
40199 v: v,
40200 fr: fr,
40201 ip: ip,
40202 op: op,
40203 w: w,
40204 h: h,
40205 nm: nm,
40206 ddd: ddd,
40207 assets: assets,
40208 layers: layers,
40209 markers: markers
40210};
40211
40212var v$1 = "5.3.4";
40213var fr$1 = 60;
40214var ip$1 = 0;
40215var op$1 = 240;
40216var w$1 = 500;
40217var h$1 = 500;
40218var nm$1 = "Composição 1";
40219var ddd$1 = 1;
40220var assets$1 = [
40221 {
40222 id: "image_0",
40223 w: 24,
40224 h: 39,
40225 u: "",
40226 p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAnCAYAAAAVW4iAAAABnklEQVRIS7WW63GCQBSFz+Gxo//SQdJJWqAUOgglaAfaiXYQ+3BmA4KgPDazTMxEXc0q7P29cz/ux1m4hKPabrcRwBnH7i+lfGvbdgHyXfceDSClfOm6Lgb48fehRwFspYyo1AzA66WRQQCtQyksAPQ6TPUUoNcBxATOdIwCkFL26TDpGATQOgDe1fEUQOsAEIPn6bCN9913IGUWkeZ0DAJoHSQX/Lksts3+VaR1eJ53dVlGAWRZFinAOh22UGodvh88nA5rQLbbKdvDz5zjzjkgzx1P4BqQ54XbCfLCMaAo9m4nKPaOAXvngLJ0q6h0C0hZlpWjCbgEuoRVNTpgo5SKp9Ppql+8quow1gQpoJLJZKI/+b/F6jAcQGAphIhJfl0tXodhgI1eF086jL/Mw/H4jKJUAclEiDMdRsDxccAyDEOjjhuA2naCNYkkDMM+HbbFuv4XkOrYCSH0f/vhYl03dyZQ8yAIElM6bElsGiNgrdMhhPi0bXTr3CUg1XtoEPRrzCjFtm1Piuae5w3SYUxR0zQr3/d17AbrMAG+AZ94z7Y9sCJ6AAAAAElFTkSuQmCC",
40227 e: 1
40228 },
40229 {
40230 id: "image_1",
40231 w: 49,
40232 h: 29,
40233 u: "",
40234 p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADEAAAAdCAYAAAAD8oRRAAACnklEQVRYR82Y33HaQBDGv5UYwksG34CHMS/BFYQOQgehg9BBVILoQCW4hNBBqMTRjAfZyJoL5CUx1m3mhLExf2Q4nUj0rLvdn+7bb/dEKPGZTCZ9gIJlCPba7fa3MsJRGZve3Ey7jqt08p829h8TeHBxcfHDZlyrENfX8uxd7SEA+EtekgwePvyuBZeX4qcNGGsQURT5IPIA1A9MLGQir91qFZZYYYjJ3V2fGFo6Hw5MfuM1HoOLScwYYjqddpXSuqdN3RuxMGNYq1UDIY6X2NEQUsqzP4uFD8ZXo2xzF1FIUF7rSIkdBXF7G3tE7B+heyNOZoyZ04Nd7CCIKI57DnAFZkPdG7EAzMNq9W2J5UJEUdQht3JF235vmJXBMkIIRV6r1dzrYjshtO4XaeqDuQTdG4Asl4zTx8edEtuCiOPEA8rXvTEKeFipVF652DNEHMc9wNHd9qN5gJOtDIngNZtLiVEkZaeSprpZfT5ZCvYCjR9dd0D394kexk7rOvYg9E5hJqckSTwGSvd/u7ljxkBw3mj4zzWhHUkp5QP0PznSTm4ijIjIE0JkI/2WO0kpOynzv+0N+48sVESDcyG+r7+yt9lJKftcaDq1Kp6ZzqXREFryW8+bY0eSSF/bWdnzUg7ySMdfSccIQi/K6gUICMi9sVn99kvXGYgN6RhDrBZKKbtPF38rd4g90DOAdUfeKZ3CEGswfVD2F8NufyEaQalc6ViDeIGZ2aqXkFkdJB3rEE/10nEcx2ezeskalqjXD5ZOKRAvp/Krp299RFv/mvbV+0ip9GjplAqx2nw+nw+YsxFmX72EStFAiPevGlYRZ3uzT5hsri3ZcRxPjwZr/WXGzEG9oHROchLrQfQI47pupvc0Tf28hmXysVZr/gIhsf6oK5m1DgAAAABJRU5ErkJggg==",
40235 e: 1
40236 },
40237 {
40238 id: "image_2",
40239 w: 25,
40240 h: 114,
40241 u: "",
40242 p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAByCAYAAACm2nr6AAAC90lEQVRoQ92aS1ITURRA7+3ClDOlCpJqtUqzAt2BLsEdyA7sHdjsIEuAHThH6hES8v8Hwp+kIeRvlcwYmFzrUYKGgg6dzr2DZN7vvHNud0YXgfG3qdQKEdrIwdhQ6pNBhk1AH/X5M4Uopd4NCWwA/PL/5WcCUUq9/D0CCxG/PVTGN+Rv9wgAvHgs/dQQ3R0J9eHvJ83VM0R3H5GxdjvUSQBPg9fdhyOwAfHrUw72PPiNTWUjouXW3Q3smuuHUp8Rbrq/9Xr7iSZKqQ8jMPThNx+T39+YiR4qgWEDwtjHNBOIHuoIDP0xTd3ddSZKba8Q6r8Cf93dIdEY+c0x6XlUEpCt7Ti/iQgkGhMwicZ2+HNti0DiCX6TmAhkJylgIgGJJwRM4okUf66dpAgkzW+SSEpAUhl+k6QIJC1gkkpn+XOlMiKQHL9JOiMByeb5TTK5eYFkcwX+XNm8ACSXL/Kb5AoCkHyhxG+SL84LpFAs8+cqlAQgxVKF36RYFoCUylV+k1JFAFKu7PKbiEAqVQGTSnWPP1dlVwBSFYHs1fhz7cpA9vlN9moikAN+k9r+vED2Dw75c8lADo/4TQ5EIEfH/CaHcwM5Oj7hzyUCOT455TcRgZycnvGbzA/k9KzOn0sEclZv8JuIQOoNh99EBNJwzvlNRCCOhIlzfsGfSwRyftHkNxGBXDQv+U1EIE0Jk+Zliz/XZUsE0uY3abVYIQ4irGCr3eEwuSKgyGvT1KsqgO2ZQ3D9+jpghcOLv25XTbDdmZlJdGgY1ptgsHR/jwXbna7fXA4hWK9Coe+PrsN1ulNDrgggYoZCN91d13w63Z5nEwRYDwSeWYuL/7q7QroeIEQQ1Ruaprm8Nen2Y0tk3d4TTBAdJLKDweCal8Pv3q5er++W64oIIoHAQuSpaR66BPb6j0CI1ofDoW2aZmOa24/l6vcH902iAGQvL3vr7jr4/uAOol9JK7i0NFV3V8hg8JOIYHVhwfDV3RVSr9efh8Pha7/d3Z7/AxVi2rslfVoKAAAAAElFTkSuQmCC",
40243 e: 1
40244 },
40245 {
40246 id: "image_3",
40247 w: 100,
40248 h: 71,
40249 u: "",
40250 p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABHCAYAAADx2uLMAAAHBklEQVR4Xu2bbW7aWBSGz3shViKlTVEUqZGaD1Yw/TH/ww6mOyg7qHdQZwfuDpIdTHYw7GCygClhUilSP8SgVEqFwHd07ocxBAIBG9vYKFKQIYrt5577nvecY3xu39yApFev1y+ofKV+B/C5fSPNWbQMmL9SP6sCn0AUCAEgAl1SEHDE3BT4vqR26Y+B6FPpEcinIPDr9fp/qZ1dAf/xLCA6WggdAekdHx+X+rKmxTEHCCkwkqhVAXlHR0elviQMZiEgfA4cL0S4HA4rXr1+WOpLQmCeB0RtY9QDSX8wGJT6kgCUZYDoaIHoSQrc4zdvSn2JEcwKQMwmRnQtpXCPjg5LfYkBTBxAWPlZ+K+qAu7hYakvq3CJDYjaxVhjJJ33+79KfVmSSvxAdEbWA4ijpdSXZ4JJCojaxkjSNSAZTKkvC4JJFojaxpgLriCDUl8WgLIWILyJcU4mQefbjuPXarWyPjYDzlqBGAPTIwnv9esDf4EFU7ivpAFEcxHoBETNw4ODUl8iyy49INruM5zWcDholv5FU8kCEJUnC+BTpVLxiq4vmQGiYgXcGIN3sL9fWH3JGhAdtoSOlEHzoID6klUgugEj0apU0KzVaoXpv2QaiHYv/JKfhBCF0Jd8AFHygp6U5O/v17xNNid5AmLyQuqAyK3Van9uIpg8AtHuBdQiKRnM35sEJs9AFAcBXAZBwGA2oj7GQDiDOQkbTGa56bks03SyUyf2mP7ApKiR91OPhY7cjK4YqR45dXXcrHqb9o6O6T835cnIe6P31r+AyN/b28u9vqjL+qfd9kBwAezZ8M8ZEAusw42xly9f5lZfbF5J7Xb7FQnhk6T3Y5ExLyqi0ZJehExGUEsIuLu7u7nTlxCIjYx2u/2WAB8QZznasqZvaVJeDodbXq22kxtj+QjICMxtA4IuAKMvs3QjmxFidEedXI/MYF8ehH8mEAum0/niEqQHor2pQp59IBZOh4i83d3dTA9ezAXC95v1pVqtepLwwSQ9Wcuypm5ZYR6osjTb4JctKSveixc7mWyMLQRktI3dnVaqwwsQnWUs7V0ciG2Lkbzk+tjOTrb05VlALJjb29sGQXDon4Qrb5ZnmfAboaOI14c8H4huivWCgHwe7MuKviwFxIL598uXpiDhE0j5l9C7jOnKWozhUkAiWxrXxzhaUteXlYCE+uI4LggfcwzEPv/SIpIMJjV9WRmIjZa7u7vTQEqfCH+Mb2O5iBALREkjdH0sFX2JDUioL3d3jQqDgfhttHNNr19F9WTFWtaqW9YYEF1QU2d07jiOD2BthcvYgUQipimJHT/rS26B8OX0ALiO46xFXxIDovWl+2p7+5dLEB9NUhUmncYY2F+rVnuTihC9vnS0XDOYra2tRPUlUSBRfeGcXxIXLhMpv68DiF5MoKvBYOAm5V/WAiQCpgFUPICN5bjYZ1RDohFigdjLOa9Wq7Hry1qB2Cv5+vVrUwIeSWssV25QrTNCzGWoaOkRkVutVmPTl1SA8BV1u91X/f7A5YYSG8v8RYgCYiQG19xGjkNfUgMS1Ree6QXEezuGZeGEc1nzW7hpRYgFYn9fsfADWLr/kjoQC+bbt28NnuslorO8ArHlIyn1YN8y/iUzQCyY79+/vyMC18dO8hYh0XoeN8YAYijPGhzPHJAwYn788ATBJdUYmzt1koktawKI1RhujDUBLORfMgvECn8QBD4B7x9FixVUTSvLQOwaaxkwT+pLpoHYK+l2u295rpf1ZeEZLtslDIFFZ8ksRO2FzM+4z9Du/AkfMpZl2W+GLQhjIsPjkTefuJU8S19yASQC5p0k8kE4mZuRZRcIXw77l6n6kisgETAeQevLzIws20DspTzSl1wCsfpCnFpK+pATDZm2fT3Sl9wCiUTLKYALO9gX1ZhIi3Y0dWLrzdMiSBcPJ3QjrPZO1LKW1pBZYK6J6PfcAxmBuW8IIS9C/5KPLYtPX82L8aIyKcZTkZS/z3q9ngsIT9fHJrKocPY41SzL3lQWds4cxyrGGxMh0aXDhUse7COiD2NpbXaAXJqoeORJNhJIVF+4Z0GYGLyY8B5r9CFsDnl7munaNxqIBXN/f99QNSVAD16sHwjrBFeB5z63UgggFszPnz+b6lELgqmPJe7UlU5AV7EXehUKiPUvjuO4BOjBi4RKJ1LiUggVFc8aISocELtMHx4eTqUZ7ItZQ1oAuLq7VJOqsEAiYBqShZYLl6sZw04QBM1V27iFBxIB0yQCT8SoJ5LNLNaEa484+RG8WAcdSiARqe12pRrs4744AcZYzi6dEMnYR4FKIFNyH9YX7omTGuybCuRqMKi6OzvL6cRT6VYJ5Im78/DwwP7FgxBnJiNrcZ98VZ0ogSzkAGZ/qd/vv+VPHcdJ/Ln3/wFt/B5n/eJbVAAAAABJRU5ErkJggg==",
40251 e: 1
40252 },
40253 {
40254 id: "image_4",
40255 w: 99,
40256 h: 71,
40257 u: "",
40258 p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGMAAABHCAYAAAATBvm1AAAGiUlEQVR4Xu2c327TSBTGvzNuol6s1L5BUsG2W0TVtVAlIgRJn4B9g/oN1m9AeAP3DeB+L5brXdYk3coSFfJChSJRpGzeYCNxASXxrMb/mqRJmxbbmaHjC2RBOzbz8znfOd+MTdDHwmfgY7drMVCTFn4nN/gGTrrdBnEICHUigoaxgIeh2+1Wh5w3CbSXXF7DKBhEt9tdHQwCmxjZAFYEAA2jYAjich8+frQI1ARQSSBoGAWDODk5aXABgaiexIGGUTCETqdTZUapSYRIF0YEWsMoCIbQhdPTgQ2CDaKVVBU0jIIIxJfpfPhgEScRDZXJaNCRURCLTqfTIDKaINRHJ33WuU5TOYARugDGmuDYSyuj0eZtxrmGkSEM3++ulpc/2wRmE2El0udYHTSMDGf6kqHedzoWIh+pApDIRLE8aBiFUTjudBqMowlQXZhI0dRrGIUBEBcSuiB8JID2EgAaRqEIAN/3V5eWyjZjZHNg5awyisJCR0ZBQN69f28JaxugSurlpcKsYRSC4fj4uMHBwn5h8snXkVEIApGShI80jH2k6U++hpEzDKELYEs2I2aDeOwjaRg5T/v54f1370IfCYRKuOA5IsrTBFpHRg6IfP+4ARYuedbjVkF0CxpGDnM9c0jf96tgRugjRXOfdMzxuY6M/HEIXQgiD8kmUOgjaRj5z/u5K7zx/dhHospUAKNgdGTkQ+jI9xuMi36Bh7pwpgkTqUnDyAeAGFXowjDsnLGXANAw8pvvqSMLXRgEQbi+IPYjpSkpDYSkWtKRkSua12/ejPcLE6lHocjoKbu90zs6ahjRkmd9piaoERl9cDi3bq2pt/HZ8/zQRwLRXrrKljZt53sHmSODET0XJffa2tp/cUDnmkUyG1zowufTgc2IxJ6klbFVNtVggFqBQfb62to/oxOkRJryXr+OdYEq4Q3HfygYGT0Ct2/fvv37tKdUahiedzThI8Umhnow+hzkbPx4S5TdMw8pYXieVwXCTWETPpKCMDiel0pGqgvKwHBdf7W8fHqBj6QODA60GLi9vr4+pgtKwDj0PAtg0X6kaa5qqBUKwAD1CGRvbEzXBalhHHheg0AOAdupsa0mjD4HdzY3Ni7UBSlhuJ5XLQXcAbHH8UOfWHrTLW6ZI4PwfLlcnksXpILhuu7qUrlsA+xJVBTF+zCSCmnUzjh3LluaQovArc3NzX+zaKgKrabah57FOHd40rSpC6PHIgivsoCQjFEIDPfgoGEQcwDaHmva1IPRFy9J3rnzk5MlhEJguK5XZaXAAcfjKBtNpBmlYGD/65cvTdM0Qx8pjyOXyBC6IPYjEdGTsxdD1ITBCC3GKDNdKFTA3XbbIoiUNP4SiYKR0QNn1tZWtrpQCAzXPWiA4ICwnUx8lIWmV0tnKUu6aqrPiZrbd+/kogu5wnBdt8qZIZq2x+lG+TOVVgoGA/YHg6+56kIuMIQuRPuR6Mlo03b+XIXIYK1gyCzTzKZfuK64X0vAX7ptC+BO9HLh+GQrBqPHGSxzayvTfqEQGH+4boM4OUS0fXE0xK2zvJrRF6akuX23cF345jQldGHIRYXEYx/psmiQGAanfWCwMF24NgyhC4MAqS6kneJEhaSEZjC0KAgs0zQz8ZGum4quBeOl61qcU9ovjA4yWa5KDiP0kUzTlEIXrgQj0QWE6wvTD0Vg9EG8ec80pdKFuWBM6sKFvyR7mgL2DQYpdeHCeZ2lCyrCYKAWE6WqxLpw4bz++dcrIWjR95HmPCRMUz1wsnZ25NeFSyNjGEBsl/x1ThbnLI4FCnifCM2de/eU0YW5NSPg7BlH9IKJ7GmKiPZLBlNOF+aCkfyQ/NUUhT5SrSZvv3DZwzyzSp31DxL2GaGPVNvZkb5fyByGGFCSDrwvXp6/f3/nu9CFK6WpaT8c9SDhV2bCb7QWVk1x/vTzctnZzXHd+bpPcR6/dyULXehJ9BYpordIxxaRwr8J7zGDlb4XxAO7VqtJ6yMtHEZyA9F6BppEPPxOX4al7VuGEMJ3qwvfnKZmpK5kpS/+4v03RUafiNsParVneTxxqox5pTQ1CwqH4RAT3/y+epriwNPB6bKzu5vffqQbAyP5j7ru4c9ggah46vNoBgEvDEY3ThdySVOzBnXb7V/EFn/xfb9plReB3oLDfvjwZupCoTDSSGn/bVMo8tGXbIjQBzH70YObrQsLgRE3jT8YpZKFgD4Nh6e/7e7uflIlfy/iPv8HJr7qxcBYO7oAAAAASUVORK5CYII=",
40259 e: 1
40260 },
40261 {
40262 id: "image_5",
40263 w: 25,
40264 h: 100,
40265 u: "",
40266 p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAABkCAYAAABzVZt8AAAE9klEQVRoQ7WaS27cRhCGu0axMdfQwgIIZONlEMAAYeQSWeUIOgJzg8kNpE3W8t6WhvN+vzXaem4Q7QzDZgdV3Ww2H81nUwvDj5n6+P/1VzebJnx+7H8F4N5H171jLf3A58c+x9rAwA8g8P5w3b5tloJEhfn9FTDPdd2vtmAZEFGac/73Lx3Wc133v6YwI0QWfgXgt037VQQJRew58Nu6/SoLIRiGowPBX1X7VQmiesP5P1cdCkepftWCAJCuV8bA++h+6BUFozJEAoR9AnYBzm5d98ODCVYJkgFQdQGYz4KrW9f9fZeElYYUACgWQh6/Zz/feK77mxrmUpCyAO1zOF+94McPGuZCSA1A2CvUdmGcebmQJgAxV+IXI8QWgEY4XOr1RFgFoJgkxDYgZVcbgJhdbQGo92hXqwBM15cn3OPFtOqw5J9NFxLGlGzRc6vVgy9PvriRiD6RAjYBUG2EtApAyGMflcjFLaGosYJw4h/7A7LLZg/irQFUIiDGq9Z6VabJKYCwa2CMcAysfduUoiwATfyTj0rSEbYFoGg/+cN8uxooCGeHILZSlBzIMLPQH6CSDLssKAgjC/3BKG2XTQCmCyFWm6wNnbLLH6ISaZdlBcIuxsAfjuVJK9r5q86BaricarVIyUIEqTvJ4doeFZXLfcIRGKCSkGjYD0yTXKggtGswQrvMG05TANUejCYxu1KLpSEMRRbp7sBwNFF2tQGgdA3Hk0oTX0WBUjMcT0tPfC0ATgZCykx8XQDZNZqgkvyJbwKgPo8ms9yJbwzACCPENPE2AGTXGJVkTLwtANk1nqJd8Ym3CsDa4+k8bZdpNc2bfnlldLn671HJZDqP22UZQMzJbB7Z1QKASk5mC2FXWwDsyXS2EPfCkL3hGJOX04NYT9AugrQIoOufzpeaXSI+ucNZQUFYDWbzpbSrHQBVJYhp4lN/L3Um5iDZA+1yxS3RbIFK7Fuk7rmw9myxyl8ga/RAB5Cq+WJVYFdNiyIPGcyXqxy7mgOEkuXaYJclAPZksVxn2GUPQOlarNYJuywD0K7FaqPZZR9AFZerjbSrHQA1frnehP8TlNrRCidZi6macrUxRudQgmRtmbYABF+tt3G71D5utk/tPInVQLtFlI9RpL7VZhvZ1QKAIowQ05WlVtOSPZB7uViB0a71ZqftJ/Ys0u6MJKRgpa3aAx1AW/t6K5SYEtYYQHZtd8YI2wCQgM12nxlhWwDyaLPbpyJsE0D9QYhe1DoA7druDirCbQDILoLQ0Kgcy/sAMUmmpSIV0/B+Wv5D+D089MJ2fzBOvA0ApWu3P2ZOvC1ABCm5mlaxKDqNAIPdQSgJJ96qAvEUQkDaBBBkfzjJdEWbibwA+QBR7crxg1JGinSLorABg/3xJM8n0Z6c3A+EZu0kVgWAXz0cT4lHUVJRdFKuD+Dsgu/EwOH4rD2KsgbwO4zf3dzc0As3BLHXA/6Jdzo959272As2cDwJJeEaknncLugBMHYfBD89x3EyX6iREH2dKt3kVwas1337tnd9fZ37QgYcT2ctwqUAF8bB63bfPBQVV5E+Pp+zn0ikLOI+4507xxHNrPIDp+dz+omEDuDwCSDoOY5T+20pAckcNLgHFhibWU3J+SWyC194Ad77/q3be/8+v5mVIM/nF7TrwoB53791H2wWV40/vbz8+avj/Fvlyqp+9n+OccITzqkqWgAAAABJRU5ErkJggg==",
40267 e: 1
40268 },
40269 {
40270 id: "image_6",
40271 w: 99,
40272 h: 68,
40273 u: "",
40274 p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGMAAABECAYAAACVkosbAAAHwElEQVR4Xu2cf47TVhDHZ543aUCgTYQWCgU2USn9sxygErkBe4P1DfANSG+QvcHuDcoNmhMs/QNF2lKlAdTVFqQQQGQ3cTzV2H72c347sRPHibVaWYnzbL+PZ75vZp4fQkxbo9HIX3ZNQyAYQPAJNDR+fvTo95hOl4pmMeq7qNfrRSG0CiEeeo0jgrtfA7KMx48fv4r6vGloLzIY9fpfZRSWAYDPwO98COxzjyGfEk8yGhqlUulTGjoxqntYGEa9fqYjgg4IT+2LmgJCnhAR2wRU/enHHytR3cy6tzMXjNNGI5+77B0AUgUR971OmB2E2m9NEGg8KpU2Xk9CwTg9beRzua4BLMoAu2i7HHebDwTINgigpiGw69pYPZkJBosygaggwqHf99GBcLyb58BOEKyN1JOJMOr1epkIDUB8FjSCuEB4UNpAUC2V9jdKT0bCeF2v6wioA7AoozMA8rxR7CCUc4kmIRmlhw83Qk+8nj09Pc1nc7kDIGR35IryKkE4l8b/CbFGAo3S/fup1hO0IWRzrijjrm8FyQChmiUCnfT7/dTqCb6u118BwS9Bd5REEDJghDYCVR88eJA6PbF9gasRVR6urlYjfNcUtAgPhJNWccy3ya7r4b17qdETRTMa+Wyuy4m9F6sR61AgPD0BwBqAZdxPgZ4MjaY4pgAhKgjoxRQhUhyBjIQaFI7bV2MM5an3O9sVsYnfoW3PJ1dXl2utJ2PjDDvxh1QBgU9HZF+dTlei7kA0Hgji1IAuuB8VCGfMZf9vE0L1h7t311JPpkbgZ2dnOhEylP3AwckDIbWEodh6cu/OnbXSk6kw+InjQlHXNA0EtHNSCbQIFYRrKHaEUtOEMG7fvr0W8clMMKQQMJRen6oIZOtJQlzTGBDyY1tQjr7LZCqFQiHR9ZNQMCSUs7PGEyGo6tUwVqcR00G4UTwg6wlWvt/b4yF8Ire5YMg7efOmwTWNqlrTiHvUpIh1GBCuwNvBbBMA9L29vT+SRmQhGPJm/m40eNIBF5p2R8YoiuUsMnxdFIQsxLsV+Zq5o+l3C4V/kgIlEhhS5C0Ajk+ej9OSBIGwubpQjjRNJEJPIoOhiHwREI8B0K6JSzAJBSGNrY0gKrduFVaqJ5HDUKCUUdOqnIRMOAhpIQymKRD1QqGwEj2JDYaE8vbtW50A3SSkDAFmyEM5BMekRZTvho5zkwOOH/KEWzbkzeCa/F0NARjKUvUkdhhST4TYMZCTkDPmmlYIwgco8Agsa2l6shQYvus6L2pa35nYoNRyVTfmfLwyi/BB+JbTJoJKobAbu54sFYaE8u7duzIgVljkEw5C+jk732VZQi8UbsamJyuBIaG8f/9eBxScYd1PoEWoIBxrdf5q/X4/Fj1ZKQypJ9ls1kAUBvHEOGc8rAh37GI9yjWNA6FCOTJNM1I9WTkMaSXn5+dF9s2ATlHLlw4XTDyjpnlBSChtBKjcuHEjEj1JDAzfdf33RNMsNwmZaBC+9QI2iSz95s3F9CRxMCSUfy8uDpCg6szhGnRbbipj/jhiUYtQQUgtASKsaRrq165dmys+SSwMz31dXHC+y0C7qBVJQBcLCEXguf2jq6ur0HqSeBh8Z61WK9/r9SoE8NyOoBNmEQMg5NyANhFVrl+/PrOerAUMVeS1nZ1jngOspjVmTHEswyIG3tSyH5wmELHrmhqfrBUMCeXDhw9lADwGhP2Eg/DVDuElWZYxSU/WEoaE8vHjRx04CYk8E9KrT6i1iqBLG+ne3IG05/284M6LKQIJmpHHDbw+5weIalwiL/u3bDbL1dGhevxaw5B6YlqWIQCdmZB+0SiBIDzQbQAwstksu1xvW3sY8k5arVaRiKr227b+o+zUKhJhEUGLc5MMfzKUTCZj60lqYChQygTA+S5H5JMLwr1ke5LES03TePiezq3VaulOZjgo8l74uDSNGGkRKgh/P50onLvi+ARAcFGLXwZykpBjxVW1oknHhRHrECD806cZiQ2lKASn6vHQ91xxj5rCgUilZkx6rFpfvz7RLItF/ukglGiHr+FBbBwMCerz588HAJyEFPu+wK/GNclr4ilNqRXwWRzvly9fuH7iJCEnBWqBjhp2b34nzmkRajFtlgtP6zEs8plMhqE8Hxb4+MRatQhvP62dHPa+Op1Osd+nYxQcn8jRpuo64rMI52wb7qZGAet0OmUiOgZU39RaAohNGdqGtRI+/tu3bwY604nsotZIFzagM+qyHvaT7pvY+CU/lOM2WsCnQWq1KJ/LXTKUF0MFpIhBbOzQdhqEwe9ZT1CIKgI4ScgYQGxhhKTCeiKExvUTZ2b9wIpD87gm9RK2biokED682+3y8k/BJQHn0IjBU29hzAGDf0JEedM0+VVsXrF0ttWIhiwpePItjDlhyJ91OlTMZPqcqj8cdFvB1+mCKxWNOu0WxoIw5M97vV6Zh8KIwdfnvIBuhp6e4ZCIrnZDmjFN80AIwXOlRq5mN6kbtjBiekj6fX4pyC5sea9jTzvVFsa0HlrgexZ5TtU7ejJ928KY3kcLH0FERQCwZ0Ju3dTC3RlNA0RUdqH4S5YrTW8tI5p+DtUKEXF8wsPhgJ5sYYTqxugOdvWEofhrQkbX/LaleXrA1RMW+Wdby5inB2P4DRH9+j8BENYhBOw6xQAAAABJRU5ErkJggg==",
40275 e: 1
40276 },
40277 {
40278 id: "image_7",
40279 w: 49,
40280 h: 53,
40281 u: "",
40282 p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADEAAAA1CAYAAADoDQMKAAAEzUlEQVRoQ9WYS24bRxCGq2lAgKAAFBdCYG9EIvBCm8RceCEEsKQTxDcwb+C5QcY3GN2AvkG8zQMTJUG0ZGQttDHACF5oERg0AcG2xOn6g+ZMz6PnSXIoUtwMuCCnvq6//qpqQff486vrPicIR9xHhp9d98kDNBwQDlT89wrCdd1tCXKIxIv44d8biF9+c20hhEVETVM9aw+hdU9Eu3nSX1sI13XbjEZf676odtcOQumeqWEDeFnVdNYK4o+//raY2WbmJsAEVMNYC4g/T08PBVOfgV1mFTxIQTBXo1gpxOnpoE0Nrw/wgQpYB64gIphykJVADAaDbTmVDb1kderMlHgGWaiajTuHGLx924OEw+CmPn0wiFUNTJ8xqBCmOBt3BnF+fn4IEg4zvtMBT2WjA9XZMLKgpbVSi724uGgzhAPwD/4px09dn35RFvwCVzB33uyGw+H27a1ngfBjsmi1/rNhdMC6TuJulcexFDm9Gw57xHB8v/edRmvd/x4BmJJKfI/VhIbJykatEMP37w9Jch8xvw8LVVvogpLKklUtEFdXV21Pyj5AB/rEUk/tOnPAlDXAhSBGo9H255uJTSwTfh9vVLlQM0hKW29eA5wb4r8PHyyWbAPcTL0kqIEQIKuhhXViFHhQM2EDrGC5M0OMRqNDBvpg7E79Xr80owiLspAYMcJGV2C5qT4SWW5liOvr6yces0OMg6i7Zvh7aoTIcqfIZjWMPhCzjyS7enymiqbcUgil+42NDQfAi6TTZPl87CWGpEyrTc5M2f9VJintVIUQNzc3NgMWGM306cdSv1RJFXdz1QAzITzPe86sbhV4N+y2ieIsGR1S81CUoXid6DEkT1LmgKi7uWm5CQgAh0SkVsOY30dzfqTbaJ6pUh+m5Sa7d9EYUjqmn0lIawoBoK2CJ6LpfY5Kkb8eFo8MCYB5JDV/AxwTw3r27Pv+9PIMgAo+dZ+Ttk5jcSmbRitKynyP6VKmpKTkV97tF+fo6OijnqMURO6MG+k3vjrGYDRIbB7KnUJDny+y3KjvpHYOiTfgibW/v/9v6vKsCMJf2MumUL8+MhedKg2wXFJnkGQ9fdr9PXefKIJQP8reBYp3gnDNnFNSU7cCxpCwut1vp7ov3OzKIKJs5Eiq1Hpnb4AAH3uTid3tdkPdLwQRuFd4hRKvk0hCxZIyB8T8MZ1PBKG3t7eX0n0NEL7lzt74qg2IkvmSVfCPH+fqfmGIKBvzS8q8WwqyMQbB/qbTccp0XxNEVgM0oApcKr1z4JjZszudTiXd1wKRykbmopMzU8W7ucTJ5IHodR4+nEn3tUH4lpul82QD1DcWyd2ALlmy9ejR1z8tIp3M244yizV/lG6A+QNiMEKMwezs7Oyo8WYpn8KxI++N4TxjdHPzhk+CXzeIrFartbDua5WTro2SAfFEesJqtb76ZylHb/zpXJlIN8BQUpcAW1tbW7XrvvZM+BAJyx1LwPny6ZOzbOnUUtjxPwkk9XoyubU3Nzdrs8xZJTi3nIjoRG2DQoi5RoVZA61bTpdB8KUjcp2B1gnxiogcIcRSLXNW+KpyeqP2cCHEynS/SCbOguBXrvt5IMZB8Guj+1khjoPCXSvdV4VQltlbV92XQahiVcGvte6LIP4H6HIYxljTu58AAAAASUVORK5CYII=",
40283 e: 1
40284 }
40285];
40286var layers$1 = [
40287 {
40288 ddd: 1,
40289 ind: 1,
40290 ty: 2,
40291 nm: "qube-icon-08.ai",
40292 cl: "ai",
40293 parent: 2,
40294 refId: "image_0",
40295 sr: 1,
40296 ks: {
40297 o: {
40298 a: 1,
40299 k: [
40300 {
40301 i: {
40302 x: [
40303 0.833
40304 ],
40305 y: [
40306 0.833
40307 ]
40308 },
40309 o: {
40310 x: [
40311 0.167
40312 ],
40313 y: [
40314 0.167
40315 ]
40316 },
40317 n: [
40318 "0p833_0p833_0p167_0p167"
40319 ],
40320 t: 105,
40321 s: [
40322 0
40323 ],
40324 e: [
40325 100
40326 ]
40327 },
40328 {
40329 i: {
40330 x: [
40331 0.833
40332 ],
40333 y: [
40334 0.833
40335 ]
40336 },
40337 o: {
40338 x: [
40339 0.167
40340 ],
40341 y: [
40342 0.167
40343 ]
40344 },
40345 n: [
40346 "0p833_0p833_0p167_0p167"
40347 ],
40348 t: 115,
40349 s: [
40350 100
40351 ],
40352 e: [
40353 100
40354 ]
40355 },
40356 {
40357 i: {
40358 x: [
40359 0.833
40360 ],
40361 y: [
40362 0.833
40363 ]
40364 },
40365 o: {
40366 x: [
40367 0.167
40368 ],
40369 y: [
40370 0.167
40371 ]
40372 },
40373 n: [
40374 "0p833_0p833_0p167_0p167"
40375 ],
40376 t: 125,
40377 s: [
40378 100
40379 ],
40380 e: [
40381 100
40382 ]
40383 },
40384 {
40385 t: 135
40386 }
40387 ],
40388 ix: 11
40389 },
40390 rx: {
40391 a: 1,
40392 k: [
40393 {
40394 i: {
40395 x: [
40396 0.833
40397 ],
40398 y: [
40399 0.833
40400 ]
40401 },
40402 o: {
40403 x: [
40404 0.167
40405 ],
40406 y: [
40407 0.167
40408 ]
40409 },
40410 n: [
40411 "0p833_0p833_0p167_0p167"
40412 ],
40413 t: 105,
40414 s: [
40415 -186
40416 ],
40417 e: [
40418 0
40419 ]
40420 },
40421 {
40422 i: {
40423 x: [
40424 0.833
40425 ],
40426 y: [
40427 0.833
40428 ]
40429 },
40430 o: {
40431 x: [
40432 0.167
40433 ],
40434 y: [
40435 0.167
40436 ]
40437 },
40438 n: [
40439 "0p833_0p833_0p167_0p167"
40440 ],
40441 t: 115,
40442 s: [
40443 0
40444 ],
40445 e: [
40446 0
40447 ]
40448 },
40449 {
40450 i: {
40451 x: [
40452 0.833
40453 ],
40454 y: [
40455 0.833
40456 ]
40457 },
40458 o: {
40459 x: [
40460 0.167
40461 ],
40462 y: [
40463 0.167
40464 ]
40465 },
40466 n: [
40467 "0p833_0p833_0p167_0p167"
40468 ],
40469 t: 125,
40470 s: [
40471 0
40472 ],
40473 e: [
40474 -186
40475 ]
40476 },
40477 {
40478 t: 135
40479 }
40480 ],
40481 ix: 8
40482 },
40483 ry: {
40484 a: 0,
40485 k: 0,
40486 ix: 9
40487 },
40488 rz: {
40489 a: 1,
40490 k: [
40491 {
40492 i: {
40493 x: [
40494 0.833
40495 ],
40496 y: [
40497 0.833
40498 ]
40499 },
40500 o: {
40501 x: [
40502 0.167
40503 ],
40504 y: [
40505 0.167
40506 ]
40507 },
40508 n: [
40509 "0p833_0p833_0p167_0p167"
40510 ],
40511 t: 105,
40512 s: [
40513 61
40514 ],
40515 e: [
40516 0
40517 ]
40518 },
40519 {
40520 i: {
40521 x: [
40522 0.833
40523 ],
40524 y: [
40525 0.833
40526 ]
40527 },
40528 o: {
40529 x: [
40530 0.167
40531 ],
40532 y: [
40533 0.167
40534 ]
40535 },
40536 n: [
40537 "0p833_0p833_0p167_0p167"
40538 ],
40539 t: 115,
40540 s: [
40541 0
40542 ],
40543 e: [
40544 0
40545 ]
40546 },
40547 {
40548 i: {
40549 x: [
40550 0.833
40551 ],
40552 y: [
40553 0.833
40554 ]
40555 },
40556 o: {
40557 x: [
40558 0.167
40559 ],
40560 y: [
40561 0.167
40562 ]
40563 },
40564 n: [
40565 "0p833_0p833_0p167_0p167"
40566 ],
40567 t: 125,
40568 s: [
40569 0
40570 ],
40571 e: [
40572 60
40573 ]
40574 },
40575 {
40576 t: 135
40577 }
40578 ],
40579 ix: 10
40580 },
40581 or: {
40582 a: 0,
40583 k: [
40584 0,
40585 0,
40586 0
40587 ],
40588 ix: 7
40589 },
40590 p: {
40591 a: 0,
40592 k: [
40593 25.656,
40594 29.156,
40595 0
40596 ],
40597 ix: 2
40598 },
40599 a: {
40600 a: 0,
40601 k: [
40602 0.375,
40603 13.75,
40604 0
40605 ],
40606 ix: 1
40607 },
40608 s: {
40609 a: 0,
40610 k: [
40611 100,
40612 100,
40613 100
40614 ],
40615 ix: 6
40616 }
40617 },
40618 ao: 0,
40619 ip: 105,
40620 op: 135,
40621 st: 0,
40622 bm: 0
40623 },
40624 {
40625 ddd: 1,
40626 ind: 2,
40627 ty: 2,
40628 nm: "qube-icon-07.ai",
40629 cl: "ai",
40630 parent: 3,
40631 refId: "image_1",
40632 sr: 1,
40633 ks: {
40634 o: {
40635 a: 1,
40636 k: [
40637 {
40638 i: {
40639 x: [
40640 0.833
40641 ],
40642 y: [
40643 0.833
40644 ]
40645 },
40646 o: {
40647 x: [
40648 0.167
40649 ],
40650 y: [
40651 0.167
40652 ]
40653 },
40654 n: [
40655 "0p833_0p833_0p167_0p167"
40656 ],
40657 t: 90,
40658 s: [
40659 0
40660 ],
40661 e: [
40662 100
40663 ]
40664 },
40665 {
40666 i: {
40667 x: [
40668 0.833
40669 ],
40670 y: [
40671 0.833
40672 ]
40673 },
40674 o: {
40675 x: [
40676 0.167
40677 ],
40678 y: [
40679 0.167
40680 ]
40681 },
40682 n: [
40683 "0p833_0p833_0p167_0p167"
40684 ],
40685 t: 105,
40686 s: [
40687 100
40688 ],
40689 e: [
40690 100
40691 ]
40692 },
40693 {
40694 i: {
40695 x: [
40696 0.833
40697 ],
40698 y: [
40699 0.833
40700 ]
40701 },
40702 o: {
40703 x: [
40704 0.167
40705 ],
40706 y: [
40707 0.167
40708 ]
40709 },
40710 n: [
40711 "0p833_0p833_0p167_0p167"
40712 ],
40713 t: 135,
40714 s: [
40715 100
40716 ],
40717 e: [
40718 0
40719 ]
40720 },
40721 {
40722 t: 150
40723 }
40724 ],
40725 ix: 11
40726 },
40727 rx: {
40728 a: 1,
40729 k: [
40730 {
40731 i: {
40732 x: [
40733 0.833
40734 ],
40735 y: [
40736 0.833
40737 ]
40738 },
40739 o: {
40740 x: [
40741 0.167
40742 ],
40743 y: [
40744 0.167
40745 ]
40746 },
40747 n: [
40748 "0p833_0p833_0p167_0p167"
40749 ],
40750 t: 90,
40751 s: [
40752 -163
40753 ],
40754 e: [
40755 0
40756 ]
40757 },
40758 {
40759 i: {
40760 x: [
40761 0.833
40762 ],
40763 y: [
40764 0.833
40765 ]
40766 },
40767 o: {
40768 x: [
40769 0.167
40770 ],
40771 y: [
40772 0.167
40773 ]
40774 },
40775 n: [
40776 "0p833_0p833_0p167_0p167"
40777 ],
40778 t: 105,
40779 s: [
40780 0
40781 ],
40782 e: [
40783 0
40784 ]
40785 },
40786 {
40787 i: {
40788 x: [
40789 0.833
40790 ],
40791 y: [
40792 0.833
40793 ]
40794 },
40795 o: {
40796 x: [
40797 0.167
40798 ],
40799 y: [
40800 0.167
40801 ]
40802 },
40803 n: [
40804 "0p833_0p833_0p167_0p167"
40805 ],
40806 t: 135,
40807 s: [
40808 0
40809 ],
40810 e: [
40811 -163
40812 ]
40813 },
40814 {
40815 t: 150
40816 }
40817 ],
40818 ix: 8
40819 },
40820 ry: {
40821 a: 1,
40822 k: [
40823 {
40824 i: {
40825 x: [
40826 0.833
40827 ],
40828 y: [
40829 0.833
40830 ]
40831 },
40832 o: {
40833 x: [
40834 0.167
40835 ],
40836 y: [
40837 0.167
40838 ]
40839 },
40840 n: [
40841 "0p833_0p833_0p167_0p167"
40842 ],
40843 t: 90,
40844 s: [
40845 30
40846 ],
40847 e: [
40848 0
40849 ]
40850 },
40851 {
40852 i: {
40853 x: [
40854 0.833
40855 ],
40856 y: [
40857 0.833
40858 ]
40859 },
40860 o: {
40861 x: [
40862 0.167
40863 ],
40864 y: [
40865 0.167
40866 ]
40867 },
40868 n: [
40869 "0p833_0p833_0p167_0p167"
40870 ],
40871 t: 105,
40872 s: [
40873 0
40874 ],
40875 e: [
40876 0
40877 ]
40878 },
40879 {
40880 i: {
40881 x: [
40882 0.833
40883 ],
40884 y: [
40885 0.833
40886 ]
40887 },
40888 o: {
40889 x: [
40890 0.167
40891 ],
40892 y: [
40893 0.167
40894 ]
40895 },
40896 n: [
40897 "0p833_0p833_0p167_0p167"
40898 ],
40899 t: 135,
40900 s: [
40901 0
40902 ],
40903 e: [
40904 30
40905 ]
40906 },
40907 {
40908 t: 150
40909 }
40910 ],
40911 ix: 9
40912 },
40913 rz: {
40914 a: 1,
40915 k: [
40916 {
40917 i: {
40918 x: [
40919 0.833
40920 ],
40921 y: [
40922 0.833
40923 ]
40924 },
40925 o: {
40926 x: [
40927 0.167
40928 ],
40929 y: [
40930 0.167
40931 ]
40932 },
40933 n: [
40934 "0p833_0p833_0p167_0p167"
40935 ],
40936 t: 90,
40937 s: [
40938 53
40939 ],
40940 e: [
40941 0
40942 ]
40943 },
40944 {
40945 i: {
40946 x: [
40947 0.833
40948 ],
40949 y: [
40950 0.833
40951 ]
40952 },
40953 o: {
40954 x: [
40955 0.167
40956 ],
40957 y: [
40958 0.167
40959 ]
40960 },
40961 n: [
40962 "0p833_0p833_0p167_0p167"
40963 ],
40964 t: 105,
40965 s: [
40966 0
40967 ],
40968 e: [
40969 0
40970 ]
40971 },
40972 {
40973 i: {
40974 x: [
40975 0.833
40976 ],
40977 y: [
40978 0.833
40979 ]
40980 },
40981 o: {
40982 x: [
40983 0.167
40984 ],
40985 y: [
40986 0.167
40987 ]
40988 },
40989 n: [
40990 "0p833_0p833_0p167_0p167"
40991 ],
40992 t: 135,
40993 s: [
40994 0
40995 ],
40996 e: [
40997 53
40998 ]
40999 },
41000 {
41001 t: 150
41002 }
41003 ],
41004 ix: 10
41005 },
41006 or: {
41007 a: 0,
41008 k: [
41009 0,
41010 0,
41011 0
41012 ],
41013 ix: 7
41014 },
41015 p: {
41016 a: 0,
41017 k: [
41018 13.625,
41019 106.25,
41020 0
41021 ],
41022 ix: 2
41023 },
41024 a: {
41025 a: 0,
41026 k: [
41027 12.875,
41028 7,
41029 0
41030 ],
41031 ix: 1
41032 },
41033 s: {
41034 a: 0,
41035 k: [
41036 100,
41037 100,
41038 100
41039 ],
41040 ix: 6
41041 }
41042 },
41043 ao: 0,
41044 ip: 90,
41045 op: 150,
41046 st: 0,
41047 bm: 0
41048 },
41049 {
41050 ddd: 1,
41051 ind: 3,
41052 ty: 2,
41053 nm: "qube-icon-06.ai",
41054 cl: "ai",
41055 parent: 4,
41056 refId: "image_2",
41057 sr: 1,
41058 ks: {
41059 o: {
41060 a: 1,
41061 k: [
41062 {
41063 i: {
41064 x: [
41065 0.833
41066 ],
41067 y: [
41068 0.833
41069 ]
41070 },
41071 o: {
41072 x: [
41073 0.167
41074 ],
41075 y: [
41076 0.167
41077 ]
41078 },
41079 n: [
41080 "0p833_0p833_0p167_0p167"
41081 ],
41082 t: 75,
41083 s: [
41084 0
41085 ],
41086 e: [
41087 100
41088 ]
41089 },
41090 {
41091 i: {
41092 x: [
41093 0.833
41094 ],
41095 y: [
41096 0.833
41097 ]
41098 },
41099 o: {
41100 x: [
41101 0.167
41102 ],
41103 y: [
41104 0.167
41105 ]
41106 },
41107 n: [
41108 "0p833_0p833_0p167_0p167"
41109 ],
41110 t: 90,
41111 s: [
41112 100
41113 ],
41114 e: [
41115 100
41116 ]
41117 },
41118 {
41119 i: {
41120 x: [
41121 0.833
41122 ],
41123 y: [
41124 0.833
41125 ]
41126 },
41127 o: {
41128 x: [
41129 0.167
41130 ],
41131 y: [
41132 0.167
41133 ]
41134 },
41135 n: [
41136 "0p833_0p833_0p167_0p167"
41137 ],
41138 t: 150,
41139 s: [
41140 100
41141 ],
41142 e: [
41143 0
41144 ]
41145 },
41146 {
41147 t: 166
41148 }
41149 ],
41150 ix: 11
41151 },
41152 rx: {
41153 a: 1,
41154 k: [
41155 {
41156 i: {
41157 x: [
41158 0.833
41159 ],
41160 y: [
41161 0.833
41162 ]
41163 },
41164 o: {
41165 x: [
41166 0.167
41167 ],
41168 y: [
41169 0.167
41170 ]
41171 },
41172 n: [
41173 "0p833_0p833_0p167_0p167"
41174 ],
41175 t: 75,
41176 s: [
41177 170
41178 ],
41179 e: [
41180 0
41181 ]
41182 },
41183 {
41184 i: {
41185 x: [
41186 0.833
41187 ],
41188 y: [
41189 0.833
41190 ]
41191 },
41192 o: {
41193 x: [
41194 0.167
41195 ],
41196 y: [
41197 0.167
41198 ]
41199 },
41200 n: [
41201 "0p833_0p833_0p167_0p167"
41202 ],
41203 t: 90,
41204 s: [
41205 0
41206 ],
41207 e: [
41208 0
41209 ]
41210 },
41211 {
41212 i: {
41213 x: [
41214 0.833
41215 ],
41216 y: [
41217 0.833
41218 ]
41219 },
41220 o: {
41221 x: [
41222 0.167
41223 ],
41224 y: [
41225 0.167
41226 ]
41227 },
41228 n: [
41229 "0p833_0p833_0p167_0p167"
41230 ],
41231 t: 150,
41232 s: [
41233 0
41234 ],
41235 e: [
41236 170
41237 ]
41238 },
41239 {
41240 t: 166
41241 }
41242 ],
41243 ix: 8
41244 },
41245 ry: {
41246 a: 0,
41247 k: 0,
41248 ix: 9
41249 },
41250 rz: {
41251 a: 1,
41252 k: [
41253 {
41254 i: {
41255 x: [
41256 0.833
41257 ],
41258 y: [
41259 0.833
41260 ]
41261 },
41262 o: {
41263 x: [
41264 0.167
41265 ],
41266 y: [
41267 0.167
41268 ]
41269 },
41270 n: [
41271 "0p833_0p833_0p167_0p167"
41272 ],
41273 t: 75,
41274 s: [
41275 60
41276 ],
41277 e: [
41278 0
41279 ]
41280 },
41281 {
41282 i: {
41283 x: [
41284 0.833
41285 ],
41286 y: [
41287 0.833
41288 ]
41289 },
41290 o: {
41291 x: [
41292 0.167
41293 ],
41294 y: [
41295 0.167
41296 ]
41297 },
41298 n: [
41299 "0p833_0p833_0p167_0p167"
41300 ],
41301 t: 90,
41302 s: [
41303 0
41304 ],
41305 e: [
41306 0
41307 ]
41308 },
41309 {
41310 i: {
41311 x: [
41312 0.833
41313 ],
41314 y: [
41315 0.833
41316 ]
41317 },
41318 o: {
41319 x: [
41320 0.167
41321 ],
41322 y: [
41323 0.167
41324 ]
41325 },
41326 n: [
41327 "0p833_0p833_0p167_0p167"
41328 ],
41329 t: 150,
41330 s: [
41331 0
41332 ],
41333 e: [
41334 60
41335 ]
41336 },
41337 {
41338 t: 166
41339 }
41340 ],
41341 ix: 10
41342 },
41343 or: {
41344 a: 0,
41345 k: [
41346 0,
41347 0,
41348 0
41349 ],
41350 ix: 7
41351 },
41352 p: {
41353 a: 0,
41354 k: [
41355 85.719,
41356 65.781,
41357 0
41358 ],
41359 ix: 2
41360 },
41361 a: {
41362 a: 0,
41363 k: [
41364 11.5,
41365 9,
41366 0
41367 ],
41368 ix: 1
41369 },
41370 s: {
41371 a: 0,
41372 k: [
41373 100,
41374 100,
41375 100
41376 ],
41377 ix: 6
41378 }
41379 },
41380 ao: 0,
41381 ip: 75,
41382 op: 166,
41383 st: 0,
41384 bm: 0
41385 },
41386 {
41387 ddd: 1,
41388 ind: 4,
41389 ty: 2,
41390 nm: "qube-icon-05.ai",
41391 cl: "ai",
41392 parent: 5,
41393 refId: "image_3",
41394 sr: 1,
41395 ks: {
41396 o: {
41397 a: 1,
41398 k: [
41399 {
41400 i: {
41401 x: [
41402 0.833
41403 ],
41404 y: [
41405 0.833
41406 ]
41407 },
41408 o: {
41409 x: [
41410 0.167
41411 ],
41412 y: [
41413 0.167
41414 ]
41415 },
41416 n: [
41417 "0p833_0p833_0p167_0p167"
41418 ],
41419 t: 60,
41420 s: [
41421 0
41422 ],
41423 e: [
41424 100
41425 ]
41426 },
41427 {
41428 i: {
41429 x: [
41430 0.833
41431 ],
41432 y: [
41433 0.833
41434 ]
41435 },
41436 o: {
41437 x: [
41438 0.167
41439 ],
41440 y: [
41441 0.167
41442 ]
41443 },
41444 n: [
41445 "0p833_0p833_0p167_0p167"
41446 ],
41447 t: 75,
41448 s: [
41449 100
41450 ],
41451 e: [
41452 100
41453 ]
41454 },
41455 {
41456 i: {
41457 x: [
41458 0.833
41459 ],
41460 y: [
41461 0.833
41462 ]
41463 },
41464 o: {
41465 x: [
41466 0.167
41467 ],
41468 y: [
41469 0.167
41470 ]
41471 },
41472 n: [
41473 "0p833_0p833_0p167_0p167"
41474 ],
41475 t: 166,
41476 s: [
41477 100
41478 ],
41479 e: [
41480 0
41481 ]
41482 },
41483 {
41484 t: 180
41485 }
41486 ],
41487 ix: 11
41488 },
41489 rx: {
41490 a: 0,
41491 k: 0,
41492 ix: 8
41493 },
41494 ry: {
41495 a: 1,
41496 k: [
41497 {
41498 i: {
41499 x: [
41500 0.833
41501 ],
41502 y: [
41503 0.833
41504 ]
41505 },
41506 o: {
41507 x: [
41508 0.167
41509 ],
41510 y: [
41511 0.167
41512 ]
41513 },
41514 n: [
41515 "0p833_0p833_0p167_0p167"
41516 ],
41517 t: 60,
41518 s: [
41519 170
41520 ],
41521 e: [
41522 0
41523 ]
41524 },
41525 {
41526 i: {
41527 x: [
41528 0.833
41529 ],
41530 y: [
41531 0.833
41532 ]
41533 },
41534 o: {
41535 x: [
41536 0.167
41537 ],
41538 y: [
41539 0.167
41540 ]
41541 },
41542 n: [
41543 "0p833_0p833_0p167_0p167"
41544 ],
41545 t: 75,
41546 s: [
41547 0
41548 ],
41549 e: [
41550 0
41551 ]
41552 },
41553 {
41554 i: {
41555 x: [
41556 0.833
41557 ],
41558 y: [
41559 0.833
41560 ]
41561 },
41562 o: {
41563 x: [
41564 0.167
41565 ],
41566 y: [
41567 0.167
41568 ]
41569 },
41570 n: [
41571 "0p833_0p833_0p167_0p167"
41572 ],
41573 t: 166,
41574 s: [
41575 0
41576 ],
41577 e: [
41578 170
41579 ]
41580 },
41581 {
41582 t: 180
41583 }
41584 ],
41585 ix: 9
41586 },
41587 rz: {
41588 a: 0,
41589 k: 0,
41590 ix: 10
41591 },
41592 or: {
41593 a: 0,
41594 k: [
41595 0,
41596 0,
41597 0
41598 ],
41599 ix: 7
41600 },
41601 p: {
41602 a: 0,
41603 k: [
41604 99.25,
41605 15,
41606 0
41607 ],
41608 ix: 2
41609 },
41610 a: {
41611 a: 0,
41612 k: [
41613 0,
41614 15,
41615 0
41616 ],
41617 ix: 1
41618 },
41619 s: {
41620 a: 0,
41621 k: [
41622 100,
41623 100,
41624 100
41625 ],
41626 ix: 6
41627 }
41628 },
41629 ao: 0,
41630 ip: 60,
41631 op: 180,
41632 st: 0,
41633 bm: 0
41634 },
41635 {
41636 ddd: 1,
41637 ind: 5,
41638 ty: 2,
41639 nm: "qube-icon-04.ai",
41640 cl: "ai",
41641 parent: 6,
41642 refId: "image_4",
41643 sr: 1,
41644 ks: {
41645 o: {
41646 a: 1,
41647 k: [
41648 {
41649 i: {
41650 x: [
41651 0.833
41652 ],
41653 y: [
41654 0.833
41655 ]
41656 },
41657 o: {
41658 x: [
41659 0.167
41660 ],
41661 y: [
41662 0.167
41663 ]
41664 },
41665 n: [
41666 "0p833_0p833_0p167_0p167"
41667 ],
41668 t: 45,
41669 s: [
41670 0
41671 ],
41672 e: [
41673 100
41674 ]
41675 },
41676 {
41677 i: {
41678 x: [
41679 0.833
41680 ],
41681 y: [
41682 0.833
41683 ]
41684 },
41685 o: {
41686 x: [
41687 0.167
41688 ],
41689 y: [
41690 0.167
41691 ]
41692 },
41693 n: [
41694 "0p833_0p833_0p167_0p167"
41695 ],
41696 t: 60,
41697 s: [
41698 100
41699 ],
41700 e: [
41701 100
41702 ]
41703 },
41704 {
41705 i: {
41706 x: [
41707 0.833
41708 ],
41709 y: [
41710 0.833
41711 ]
41712 },
41713 o: {
41714 x: [
41715 0.167
41716 ],
41717 y: [
41718 0.167
41719 ]
41720 },
41721 n: [
41722 "0p833_0p833_0p167_0p167"
41723 ],
41724 t: 180,
41725 s: [
41726 100
41727 ],
41728 e: [
41729 0
41730 ]
41731 },
41732 {
41733 t: 195
41734 }
41735 ],
41736 ix: 11
41737 },
41738 rx: {
41739 a: 1,
41740 k: [
41741 {
41742 i: {
41743 x: [
41744 0.833
41745 ],
41746 y: [
41747 0.833
41748 ]
41749 },
41750 o: {
41751 x: [
41752 0.167
41753 ],
41754 y: [
41755 0.167
41756 ]
41757 },
41758 n: [
41759 "0p833_0p833_0p167_0p167"
41760 ],
41761 t: 45,
41762 s: [
41763 170
41764 ],
41765 e: [
41766 0
41767 ]
41768 },
41769 {
41770 i: {
41771 x: [
41772 0.833
41773 ],
41774 y: [
41775 0.833
41776 ]
41777 },
41778 o: {
41779 x: [
41780 0.167
41781 ],
41782 y: [
41783 0.167
41784 ]
41785 },
41786 n: [
41787 "0p833_0p833_0p167_0p167"
41788 ],
41789 t: 60,
41790 s: [
41791 0
41792 ],
41793 e: [
41794 0
41795 ]
41796 },
41797 {
41798 i: {
41799 x: [
41800 0.833
41801 ],
41802 y: [
41803 0.833
41804 ]
41805 },
41806 o: {
41807 x: [
41808 0.167
41809 ],
41810 y: [
41811 0.167
41812 ]
41813 },
41814 n: [
41815 "0p833_0p833_0p167_0p167"
41816 ],
41817 t: 180,
41818 s: [
41819 0
41820 ],
41821 e: [
41822 170
41823 ]
41824 },
41825 {
41826 t: 195
41827 }
41828 ],
41829 ix: 8
41830 },
41831 ry: {
41832 a: 0,
41833 k: 0,
41834 ix: 9
41835 },
41836 rz: {
41837 a: 1,
41838 k: [
41839 {
41840 i: {
41841 x: [
41842 0.833
41843 ],
41844 y: [
41845 0.833
41846 ]
41847 },
41848 o: {
41849 x: [
41850 0.167
41851 ],
41852 y: [
41853 0.167
41854 ]
41855 },
41856 n: [
41857 "0p833_0p833_0p167_0p167"
41858 ],
41859 t: 45,
41860 s: [
41861 -60
41862 ],
41863 e: [
41864 0
41865 ]
41866 },
41867 {
41868 i: {
41869 x: [
41870 0.833
41871 ],
41872 y: [
41873 0.833
41874 ]
41875 },
41876 o: {
41877 x: [
41878 0.167
41879 ],
41880 y: [
41881 0.167
41882 ]
41883 },
41884 n: [
41885 "0p833_0p833_0p167_0p167"
41886 ],
41887 t: 60,
41888 s: [
41889 0
41890 ],
41891 e: [
41892 0
41893 ]
41894 },
41895 {
41896 i: {
41897 x: [
41898 0.833
41899 ],
41900 y: [
41901 0.833
41902 ]
41903 },
41904 o: {
41905 x: [
41906 0.167
41907 ],
41908 y: [
41909 0.167
41910 ]
41911 },
41912 n: [
41913 "0p833_0p833_0p167_0p167"
41914 ],
41915 t: 180,
41916 s: [
41917 0
41918 ],
41919 e: [
41920 -60
41921 ]
41922 },
41923 {
41924 t: 195
41925 }
41926 ],
41927 ix: 10
41928 },
41929 or: {
41930 a: 0,
41931 k: [
41932 0,
41933 0,
41934 0
41935 ],
41936 ix: 7
41937 },
41938 p: {
41939 a: 0,
41940 k: [
41941 13.25,
41942 7.75,
41943 0
41944 ],
41945 ix: 2
41946 },
41947 a: {
41948 a: 0,
41949 k: [
41950 13.375,
41951 64.5,
41952 0
41953 ],
41954 ix: 1
41955 },
41956 s: {
41957 a: 0,
41958 k: [
41959 100,
41960 100,
41961 100
41962 ],
41963 ix: 6
41964 }
41965 },
41966 ao: 0,
41967 ip: 45,
41968 op: 195,
41969 st: 0,
41970 bm: 0
41971 },
41972 {
41973 ddd: 1,
41974 ind: 6,
41975 ty: 2,
41976 nm: "qube-icon-03.ai",
41977 cl: "ai",
41978 parent: 7,
41979 refId: "image_5",
41980 sr: 1,
41981 ks: {
41982 o: {
41983 a: 1,
41984 k: [
41985 {
41986 i: {
41987 x: [
41988 0.833
41989 ],
41990 y: [
41991 0.833
41992 ]
41993 },
41994 o: {
41995 x: [
41996 0.167
41997 ],
41998 y: [
41999 0.167
42000 ]
42001 },
42002 n: [
42003 "0p833_0p833_0p167_0p167"
42004 ],
42005 t: 30,
42006 s: [
42007 0
42008 ],
42009 e: [
42010 100
42011 ]
42012 },
42013 {
42014 i: {
42015 x: [
42016 0.833
42017 ],
42018 y: [
42019 0.833
42020 ]
42021 },
42022 o: {
42023 x: [
42024 0.167
42025 ],
42026 y: [
42027 0.167
42028 ]
42029 },
42030 n: [
42031 "0p833_0p833_0p167_0p167"
42032 ],
42033 t: 45,
42034 s: [
42035 100
42036 ],
42037 e: [
42038 100
42039 ]
42040 },
42041 {
42042 i: {
42043 x: [
42044 0.833
42045 ],
42046 y: [
42047 0.833
42048 ]
42049 },
42050 o: {
42051 x: [
42052 0.167
42053 ],
42054 y: [
42055 0.167
42056 ]
42057 },
42058 n: [
42059 "0p833_0p833_0p167_0p167"
42060 ],
42061 t: 195,
42062 s: [
42063 100
42064 ],
42065 e: [
42066 0
42067 ]
42068 },
42069 {
42070 t: 211
42071 }
42072 ],
42073 ix: 11
42074 },
42075 rx: {
42076 a: 1,
42077 k: [
42078 {
42079 i: {
42080 x: [
42081 0.833
42082 ],
42083 y: [
42084 0.833
42085 ]
42086 },
42087 o: {
42088 x: [
42089 0.167
42090 ],
42091 y: [
42092 0.167
42093 ]
42094 },
42095 n: [
42096 "0p833_0p833_0p167_0p167"
42097 ],
42098 t: 30,
42099 s: [
42100 170
42101 ],
42102 e: [
42103 0
42104 ]
42105 },
42106 {
42107 i: {
42108 x: [
42109 0.833
42110 ],
42111 y: [
42112 0.833
42113 ]
42114 },
42115 o: {
42116 x: [
42117 0.167
42118 ],
42119 y: [
42120 0.167
42121 ]
42122 },
42123 n: [
42124 "0p833_0p833_0p167_0p167"
42125 ],
42126 t: 45,
42127 s: [
42128 0
42129 ],
42130 e: [
42131 0
42132 ]
42133 },
42134 {
42135 i: {
42136 x: [
42137 0.833
42138 ],
42139 y: [
42140 0.833
42141 ]
42142 },
42143 o: {
42144 x: [
42145 0.167
42146 ],
42147 y: [
42148 0.167
42149 ]
42150 },
42151 n: [
42152 "0p833_0p833_0p167_0p167"
42153 ],
42154 t: 195,
42155 s: [
42156 0
42157 ],
42158 e: [
42159 170
42160 ]
42161 },
42162 {
42163 t: 211
42164 }
42165 ],
42166 ix: 8
42167 },
42168 ry: {
42169 a: 0,
42170 k: 0,
42171 ix: 9
42172 },
42173 rz: {
42174 a: 1,
42175 k: [
42176 {
42177 i: {
42178 x: [
42179 0.833
42180 ],
42181 y: [
42182 0.833
42183 ]
42184 },
42185 o: {
42186 x: [
42187 0.167
42188 ],
42189 y: [
42190 0.167
42191 ]
42192 },
42193 n: [
42194 "0p833_0p833_0p167_0p167"
42195 ],
42196 t: 30,
42197 s: [
42198 60
42199 ],
42200 e: [
42201 0
42202 ]
42203 },
42204 {
42205 i: {
42206 x: [
42207 0.833
42208 ],
42209 y: [
42210 0.833
42211 ]
42212 },
42213 o: {
42214 x: [
42215 0.167
42216 ],
42217 y: [
42218 0.167
42219 ]
42220 },
42221 n: [
42222 "0p833_0p833_0p167_0p167"
42223 ],
42224 t: 45,
42225 s: [
42226 0
42227 ],
42228 e: [
42229 0
42230 ]
42231 },
42232 {
42233 i: {
42234 x: [
42235 0.833
42236 ],
42237 y: [
42238 0.833
42239 ]
42240 },
42241 o: {
42242 x: [
42243 0.167
42244 ],
42245 y: [
42246 0.167
42247 ]
42248 },
42249 n: [
42250 "0p833_0p833_0p167_0p167"
42251 ],
42252 t: 195,
42253 s: [
42254 0
42255 ],
42256 e: [
42257 60
42258 ]
42259 },
42260 {
42261 t: 211
42262 }
42263 ],
42264 ix: 10
42265 },
42266 or: {
42267 a: 0,
42268 k: [
42269 0,
42270 0,
42271 0
42272 ],
42273 ix: 7
42274 },
42275 p: {
42276 a: 0,
42277 k: [
42278 12.625,
42279 5,
42280 0
42281 ],
42282 ix: 2
42283 },
42284 a: {
42285 a: 0,
42286 k: [
42287 13,
42288 93.5,
42289 0
42290 ],
42291 ix: 1
42292 },
42293 s: {
42294 a: 0,
42295 k: [
42296 100,
42297 100,
42298 100
42299 ],
42300 ix: 6
42301 }
42302 },
42303 ao: 0,
42304 ip: 30,
42305 op: 211,
42306 st: 0,
42307 bm: 0
42308 },
42309 {
42310 ddd: 1,
42311 ind: 7,
42312 ty: 2,
42313 nm: "qube-icon-02.ai",
42314 cl: "ai",
42315 parent: 8,
42316 refId: "image_6",
42317 sr: 1,
42318 ks: {
42319 o: {
42320 a: 1,
42321 k: [
42322 {
42323 i: {
42324 x: [
42325 0.833
42326 ],
42327 y: [
42328 0.833
42329 ]
42330 },
42331 o: {
42332 x: [
42333 0.167
42334 ],
42335 y: [
42336 0.167
42337 ]
42338 },
42339 n: [
42340 "0p833_0p833_0p167_0p167"
42341 ],
42342 t: 15,
42343 s: [
42344 0
42345 ],
42346 e: [
42347 100
42348 ]
42349 },
42350 {
42351 i: {
42352 x: [
42353 0.833
42354 ],
42355 y: [
42356 0.833
42357 ]
42358 },
42359 o: {
42360 x: [
42361 0.167
42362 ],
42363 y: [
42364 0.167
42365 ]
42366 },
42367 n: [
42368 "0p833_0p833_0p167_0p167"
42369 ],
42370 t: 30,
42371 s: [
42372 100
42373 ],
42374 e: [
42375 100
42376 ]
42377 },
42378 {
42379 i: {
42380 x: [
42381 0.833
42382 ],
42383 y: [
42384 0.833
42385 ]
42386 },
42387 o: {
42388 x: [
42389 0.167
42390 ],
42391 y: [
42392 0.167
42393 ]
42394 },
42395 n: [
42396 "0p833_0p833_0p167_0p167"
42397 ],
42398 t: 211,
42399 s: [
42400 100
42401 ],
42402 e: [
42403 0
42404 ]
42405 },
42406 {
42407 t: 225
42408 }
42409 ],
42410 ix: 11
42411 },
42412 rx: {
42413 a: 0,
42414 k: 0,
42415 ix: 8
42416 },
42417 ry: {
42418 a: 1,
42419 k: [
42420 {
42421 i: {
42422 x: [
42423 0.833
42424 ],
42425 y: [
42426 0.833
42427 ]
42428 },
42429 o: {
42430 x: [
42431 0.167
42432 ],
42433 y: [
42434 0.167
42435 ]
42436 },
42437 n: [
42438 "0p833_0p833_0p167_0p167"
42439 ],
42440 t: 15,
42441 s: [
42442 -180
42443 ],
42444 e: [
42445 0
42446 ]
42447 },
42448 {
42449 i: {
42450 x: [
42451 0.833
42452 ],
42453 y: [
42454 0.833
42455 ]
42456 },
42457 o: {
42458 x: [
42459 0.167
42460 ],
42461 y: [
42462 0.167
42463 ]
42464 },
42465 n: [
42466 "0p833_0p833_0p167_0p167"
42467 ],
42468 t: 30,
42469 s: [
42470 0
42471 ],
42472 e: [
42473 0
42474 ]
42475 },
42476 {
42477 i: {
42478 x: [
42479 0.833
42480 ],
42481 y: [
42482 0.833
42483 ]
42484 },
42485 o: {
42486 x: [
42487 0.167
42488 ],
42489 y: [
42490 0.167
42491 ]
42492 },
42493 n: [
42494 "0p833_0p833_0p167_0p167"
42495 ],
42496 t: 211,
42497 s: [
42498 0
42499 ],
42500 e: [
42501 180
42502 ]
42503 },
42504 {
42505 t: 225
42506 }
42507 ],
42508 ix: 9
42509 },
42510 rz: {
42511 a: 0,
42512 k: 0,
42513 ix: 10
42514 },
42515 or: {
42516 a: 0,
42517 k: [
42518 0,
42519 0,
42520 0
42521 ],
42522 ix: 7
42523 },
42524 p: {
42525 a: 0,
42526 k: [
42527 -0.375,
42528 39.875,
42529 0
42530 ],
42531 ix: 2
42532 },
42533 a: {
42534 a: 0,
42535 k: [
42536 99.375,
42537 54.625,
42538 0
42539 ],
42540 ix: 1
42541 },
42542 s: {
42543 a: 0,
42544 k: [
42545 100,
42546 100,
42547 100
42548 ],
42549 ix: 6
42550 }
42551 },
42552 ao: 0,
42553 ip: 15,
42554 op: 225,
42555 st: 0,
42556 bm: 0
42557 },
42558 {
42559 ddd: 1,
42560 ind: 8,
42561 ty: 2,
42562 nm: "qube-icon-01.ai",
42563 cl: "ai",
42564 refId: "image_7",
42565 sr: 1,
42566 ks: {
42567 o: {
42568 a: 1,
42569 k: [
42570 {
42571 i: {
42572 x: [
42573 0.833
42574 ],
42575 y: [
42576 0.833
42577 ]
42578 },
42579 o: {
42580 x: [
42581 0.167
42582 ],
42583 y: [
42584 0.167
42585 ]
42586 },
42587 n: [
42588 "0p833_0p833_0p167_0p167"
42589 ],
42590 t: 0,
42591 s: [
42592 0
42593 ],
42594 e: [
42595 100
42596 ]
42597 },
42598 {
42599 i: {
42600 x: [
42601 0.833
42602 ],
42603 y: [
42604 0.833
42605 ]
42606 },
42607 o: {
42608 x: [
42609 0.167
42610 ],
42611 y: [
42612 0.167
42613 ]
42614 },
42615 n: [
42616 "0p833_0p833_0p167_0p167"
42617 ],
42618 t: 15,
42619 s: [
42620 100
42621 ],
42622 e: [
42623 100
42624 ]
42625 },
42626 {
42627 i: {
42628 x: [
42629 0.833
42630 ],
42631 y: [
42632 0.833
42633 ]
42634 },
42635 o: {
42636 x: [
42637 0.167
42638 ],
42639 y: [
42640 0.167
42641 ]
42642 },
42643 n: [
42644 "0p833_0p833_0p167_0p167"
42645 ],
42646 t: 225,
42647 s: [
42648 100
42649 ],
42650 e: [
42651 0
42652 ]
42653 },
42654 {
42655 t: 239
42656 }
42657 ],
42658 ix: 11
42659 },
42660 rx: {
42661 a: 1,
42662 k: [
42663 {
42664 i: {
42665 x: [
42666 0.833
42667 ],
42668 y: [
42669 0.833
42670 ]
42671 },
42672 o: {
42673 x: [
42674 0.167
42675 ],
42676 y: [
42677 0.167
42678 ]
42679 },
42680 n: [
42681 "0p833_0p833_0p167_0p167"
42682 ],
42683 t: 0,
42684 s: [
42685 85
42686 ],
42687 e: [
42688 0
42689 ]
42690 },
42691 {
42692 i: {
42693 x: [
42694 0.833
42695 ],
42696 y: [
42697 0.833
42698 ]
42699 },
42700 o: {
42701 x: [
42702 0.167
42703 ],
42704 y: [
42705 0.167
42706 ]
42707 },
42708 n: [
42709 "0p833_0p833_0p167_0p167"
42710 ],
42711 t: 15,
42712 s: [
42713 0
42714 ],
42715 e: [
42716 0
42717 ]
42718 },
42719 {
42720 i: {
42721 x: [
42722 0.833
42723 ],
42724 y: [
42725 0.833
42726 ]
42727 },
42728 o: {
42729 x: [
42730 0.167
42731 ],
42732 y: [
42733 0.167
42734 ]
42735 },
42736 n: [
42737 "0p833_0p833_0p167_0p167"
42738 ],
42739 t: 225,
42740 s: [
42741 0
42742 ],
42743 e: [
42744 85
42745 ]
42746 },
42747 {
42748 t: 239
42749 }
42750 ],
42751 ix: 8
42752 },
42753 ry: {
42754 a: 0,
42755 k: 0,
42756 ix: 9
42757 },
42758 rz: {
42759 a: 0,
42760 k: 0,
42761 ix: 10
42762 },
42763 or: {
42764 a: 0,
42765 k: [
42766 0,
42767 0,
42768 0
42769 ],
42770 ix: 7
42771 },
42772 p: {
42773 a: 0,
42774 k: [
42775 282,
42776 330,
42777 0
42778 ],
42779 ix: 2
42780 },
42781 a: {
42782 a: 0,
42783 k: [
42784 48.75,
42785 0,
42786 0
42787 ],
42788 ix: 1
42789 },
42790 s: {
42791 a: 0,
42792 k: [
42793 100,
42794 100,
42795 100
42796 ],
42797 ix: 6
42798 }
42799 },
42800 ao: 0,
42801 ip: 0,
42802 op: 240,
42803 st: 0,
42804 bm: 0
42805 }
42806];
42807var markers$1 = [
42808];
42809var whiteAnimation = {
42810 v: v$1,
42811 fr: fr$1,
42812 ip: ip$1,
42813 op: op$1,
42814 w: w$1,
42815 h: h$1,
42816 nm: nm$1,
42817 ddd: ddd$1,
42818 assets: assets$1,
42819 layers: layers$1,
42820 markers: markers$1
42821};
42822
42823function _templateObject$14() {
42824 var data = taggedTemplateLiteralLoose(["\n\twidth: ", ";\n\theight: ", ";\n"]);
42825
42826 _templateObject$14 = function _templateObject() {
42827 return data;
42828 };
42829
42830 return data;
42831}
42832var LoadingDiv = styled__default.div(_templateObject$14(), function (_ref) {
42833 var size = _ref.size;
42834 return size || '200px';
42835}, function (_ref2) {
42836 var size = _ref2.size;
42837 return size || '200px';
42838});
42839
42840var Loading =
42841/*#__PURE__*/
42842function (_Component) {
42843 inheritsLoose(Loading, _Component);
42844
42845 function Loading() {
42846 return _Component.apply(this, arguments) || this;
42847 }
42848
42849 var _proto = Loading.prototype;
42850
42851 _proto.componentDidMount = function componentDidMount() {
42852 var color = this.props.color;
42853 lottie.loadAnimation({
42854 container: this.loadingContainer,
42855 renderer: 'svg',
42856 loop: true,
42857 autoplay: true,
42858 animationData: color === 'white' ? whiteAnimation : blueAnimation
42859 });
42860 };
42861
42862 _proto.render = function render() {
42863 var _this = this;
42864
42865 return React__default.createElement(LoadingDiv, _extends_1({
42866 className: "loading-animated-qube",
42867 ref: function ref(el) {
42868 return _this.loadingContainer = el;
42869 }
42870 }, this.props));
42871 };
42872
42873 return Loading;
42874}(React.Component);
42875
42876Loading.defaultProps = {
42877 color: 'blue'
42878};
42879Loading.displayName = 'Loading';
42880Loading.propTypes = {
42881 color: PropTypes.oneOf(['white', 'blue'])
42882};
42883
42884function _templateObject$15() {
42885 var data = taggedTemplateLiteralLoose(["\n\tposition: absolute;\n\tdisplay: ", ";\n\n\twidth: 100%;\n\theight: 100%;\n\tbackground: rgba(255, 255, 255, 0.8);\n"]);
42886
42887 _templateObject$15 = function _templateObject() {
42888 return data;
42889 };
42890
42891 return data;
42892}
42893var ModalLoading = styled__default.div(_templateObject$15(), function (_ref) {
42894 var active = _ref.active;
42895 return active ? 'block' : 'none';
42896});
42897
42898var LoadingModal = function LoadingModal(props) {
42899 return React__default.createElement(ModalLoading, props, React__default.createElement(CenteredGrid, {
42900 width: "100%",
42901 height: "100%"
42902 }, React__default.createElement(Loading, {
42903 style: {
42904 margin: 'auto'
42905 },
42906 size: "200px"
42907 })));
42908};
42909
42910LoadingModal.displayName = 'Loading';
42911LoadingModal.propTypes = {
42912 active: PropTypes.bool.isRequired
42913};
42914
42915function _templateObject$16() {
42916 var data = taggedTemplateLiteralLoose(["\n\tborder-top: 1px solid #ddd;\n"]);
42917
42918 _templateObject$16 = function _templateObject() {
42919 return data;
42920 };
42921
42922 return data;
42923}
42924var ListHeaderContainer = styled__default(semanticUiReact.Grid)(_templateObject$16());
42925
42926function _templateObject$17() {
42927 var data = taggedTemplateLiteralLoose(["\n\ttext-align: end;\n"]);
42928
42929 _templateObject$17 = function _templateObject() {
42930 return data;
42931 };
42932
42933 return data;
42934}
42935var ListHeaderPaginationContainer = styled__default(semanticUiReact.Grid.Column)(_templateObject$17());
42936
42937function _templateObject$18() {
42938 var data = taggedTemplateLiteralLoose(["\n\tdiv:first-child {\n\t\tmargin-right: 21px;\n\t}\n"]);
42939
42940 _templateObject$18 = function _templateObject() {
42941 return data;
42942 };
42943
42944 return data;
42945}
42946
42947var ListHeader = function ListHeader(_ref) {
42948 var checked = _ref.checked,
42949 handleSelectAll = _ref.handleSelectAll,
42950 pagination = _ref.pagination,
42951 children = _ref.children;
42952 return React__default.createElement(ListHeaderContainer, {
42953 padded: true,
42954 verticalAlign: "middle"
42955 }, React__default.createElement(ActionsListWrapper, {
42956 tablet: 8
42957 }, checked !== undefined && React__default.createElement(Checkbox, {
42958 onChange: handleSelectAll,
42959 checked: checked
42960 }), children), pagination && pagination.totalPages > 1 && React__default.createElement(ListHeaderPaginationContainer, {
42961 computer: 8,
42962 tablet: 8,
42963 mobile: 16,
42964 floated: "right"
42965 }, React__default.createElement(Pagination, {
42966 activePage: pagination.activePage,
42967 onPageChange: pagination.handlePageChange,
42968 totalPages: pagination.totalPages,
42969 siblingRange: 1
42970 })));
42971};
42972
42973var ActionsListWrapper = styled__default(semanticUiReact.Grid.Column)(_templateObject$18());
42974ListHeader.defaultProps = {
42975 children: undefined,
42976 checked: undefined,
42977 handleSelectAll: undefined,
42978 pagination: undefined,
42979 selectAllCheckboxColor: undefined
42980};
42981ListHeader.displayName = 'ListHeader';
42982ListHeader.propTypes = {
42983 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
42984 checked: PropTypes.bool,
42985 handleSelectAll: PropTypes.func,
42986 pagination: PropTypes.shape({
42987 activePage: PropTypes.number.isRequired,
42988 handlePageChange: PropTypes.func.isRequired,
42989 totalPages: PropTypes.number.isRequired
42990 }),
42991 selectAllCheckboxColor: PropTypes.string
42992};
42993
42994function _templateObject$19() {
42995 var data = taggedTemplateLiteralLoose(["\n\t&&&&.list-wrapper {\n\t\twidth: 100% !important;\n\t\tmargin: 0 !important;\n\t}\n\n\t@media only screen and (max-width: 767px) {\n\t\t&&&&.list-wrapper {\n\t\t\twidth: 100% !important;\n\t\t\tmargin-right: 0 !important;\n\t\t\tmargin-left: 0 !important;\n\t\t}\n\t}\n"]);
42996
42997 _templateObject$19 = function _templateObject() {
42998 return data;
42999 };
43000
43001 return data;
43002}
43003var ListCardContainerWrapper = styled__default(semanticUiReact.Grid)(_templateObject$19());
43004
43005var ListCardWrapper = function ListCardWrapper(props) {
43006 return React__default.createElement(ListCardContainerWrapper, _extends_1({
43007 className: "list-wrapper",
43008 stackable: true,
43009 columns: 4
43010 }, props));
43011};
43012
43013ListCardWrapper.displayName = 'ListCardWrapper';
43014
43015function _templateObject$1a() {
43016 var data = taggedTemplateLiteralLoose(["\n\tmin-width: ", ";\n"]);
43017
43018 _templateObject$1a = function _templateObject() {
43019 return data;
43020 };
43021
43022 return data;
43023}
43024
43025var List = function List(_ref) {
43026 var checked = _ref.checked,
43027 _handleSelectAll = _ref.handleSelectAll,
43028 pagination = _ref.pagination,
43029 extra = _ref.extra,
43030 selectAllCheckboxColor = _ref.selectAllCheckboxColor,
43031 children = _ref.children,
43032 cards = _ref.cards,
43033 props = objectWithoutPropertiesLoose(_ref, ["checked", "handleSelectAll", "pagination", "extra", "selectAllCheckboxColor", "children", "cards"]);
43034
43035 return React__default.createElement(ListContainer, _extends_1({
43036 pagination: pagination
43037 }, props), (checked !== undefined || pagination) && React__default.createElement(ListHeader, {
43038 checked: checked,
43039 handleSelectAll: function handleSelectAll() {
43040 return _handleSelectAll(!checked);
43041 },
43042 pagination: pagination,
43043 selectAllCheckboxColor: selectAllCheckboxColor
43044 }, extra && children[0]), cards ? React__default.createElement(ListCardWrapper, null, !extra ? children : children[1]) : React__default.createElement(React__default.Fragment, null, !extra ? children : children[1]));
43045};
43046
43047var ListContainer = styled__default(function (_ref2) {
43048 var pagination = _ref2.pagination,
43049 props = objectWithoutPropertiesLoose(_ref2, ["pagination"]);
43050
43051 return React__default.createElement(semanticUiReact.Grid.Row, props);
43052})(_templateObject$1a(), function (_ref3) {
43053 var pagination = _ref3.pagination;
43054 return pagination && pagination.totalPages > 1 ? '410px' : 'min-content';
43055});
43056ListContainer.displayName = 'ListContainer';
43057List.defaultProps = {
43058 checked: undefined,
43059 extra: undefined,
43060 cards: undefined,
43061 handleSelectAll: undefined,
43062 pagination: undefined,
43063 selectAllCheckboxColor: theme.colors.activeBlue
43064};
43065List.displayName = 'List';
43066List.propTypes = {
43067 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
43068
43069 /** state of the select all checkbox */
43070 checked: PropTypes.bool,
43071
43072 /** activate extra actions in header, must use ListHeaderAction container */
43073 extra: PropTypes.bool,
43074
43075 /** activate card display in body, must use ListCard container for each item */
43076 cards: PropTypes.bool,
43077
43078 /** select all handler function, return checkbox state */
43079 handleSelectAll: PropTypes.func,
43080
43081 /** set pagination options to show the pagination wrapper */
43082 pagination: PropTypes.shape({
43083 activePage: PropTypes.number.isRequired,
43084 handlePageChange: PropTypes.func.isRequired,
43085 totalPages: PropTypes.number.isRequired
43086 }),
43087 selectAllCheckboxColor: PropTypes.string
43088};
43089
43090function _templateObject$1b() {
43091 var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-flex !important;\n\tmargin-left: 18px !important;\n\tcursor: pointer !important;\n"]);
43092
43093 _templateObject$1b = function _templateObject() {
43094 return data;
43095 };
43096
43097 return data;
43098}
43099var ListHeaderAction = styled__default(Icon)(_templateObject$1b());
43100ListHeaderAction.displayName = 'ListHeaderAction';
43101
43102function _templateObject$1c() {
43103 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\talign-items: center;\n\tjustify-content: space-between;\n\tpadding: 0 1rem;\n\tbackground-color: ", ";\n\tcursor: pointer;\n\n\t&&&&.active {\n\t\tbackground-color: ", ";\n\t}\n\n\t", "\n"]);
43104
43105 _templateObject$1c = function _templateObject() {
43106 return data;
43107 };
43108
43109 return data;
43110}
43111var ListRowWrapper = styled__default(function (_ref) {
43112 var index = _ref.index,
43113 props = objectWithoutPropertiesLoose(_ref, ["index"]);
43114
43115 return React__default.createElement("div", props);
43116})(_templateObject$1c(), function (_ref2) {
43117 var theme = _ref2.theme,
43118 index = _ref2.index;
43119 return index % 2 === 0 ? theme.list.pairCell : theme.list.unPairCell;
43120}, function (_ref3) {
43121 var theme = _ref3.theme;
43122 return theme.colors.lightBlue;
43123}, function (_ref4) {
43124 var removehover = _ref4.removehover,
43125 theme = _ref4.theme;
43126 return !removehover && "\n\t&&&&:hover {\n\t\tposition: relative;\n\t\tbackground-color: " + theme.colors.lightBlue + ";\n\t\tbox-shadow: " + theme.list.boxShadow + ";\n\t\ttransition: all 0.2s ease-in-out;\n\n\t\t.onHoverShow {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t}\n\t}";
43127});
43128ListRowWrapper.displayName = 'ListRowWrapper';
43129
43130function _templateObject2$r() {
43131 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tcursor: ", ";\n"]);
43132
43133 _templateObject2$r = function _templateObject2() {
43134 return data;
43135 };
43136
43137 return data;
43138}
43139
43140function _templateObject$1d() {
43141 var data = taggedTemplateLiteralLoose(["\n\t&&&& {\n\t\theight: 100%;\n\t}\n"]);
43142
43143 _templateObject$1d = function _templateObject() {
43144 return data;
43145 };
43146
43147 return data;
43148}
43149
43150var ListRowActionWrapper = function ListRowActionWrapper(_ref) {
43151 var color = _ref.color,
43152 typeAction = _ref.typeAction,
43153 isActive = _ref.isActive,
43154 handleAction = _ref.handleAction,
43155 props = objectWithoutPropertiesLoose(_ref, ["color", "typeAction", "isActive", "handleAction"]);
43156
43157 return React__default.createElement(ListBlockContainer, _extends_1({
43158 onClick: function onClick(e) {
43159 return e.stopPropagation();
43160 },
43161 typeAction: typeAction
43162 }, props), typeAction === 'checkbox' && React__default.createElement(Checkbox, {
43163 onChange: function onChange() {
43164 return handleAction(!isActive);
43165 },
43166 checked: isActive
43167 }), typeAction === 'radio' && React__default.createElement(Radio, {
43168 onChange: function onChange() {
43169 return handleAction(!isActive);
43170 },
43171 checked: isActive
43172 }), typeAction === 'icon' && React__default.createElement(IconWrapper, {
43173 icon: "lock",
43174 color: theme.colors.red
43175 }));
43176};
43177
43178var IconWrapper = styled__default(Icon)(_templateObject$1d());
43179var ListBlockContainer = styled__default.div(_templateObject2$r(), function (_ref2) {
43180 var typeAction = _ref2.typeAction;
43181 return typeAction === 'icon' ? 'default' : 'pointer';
43182});
43183ListRowActionWrapper.defaultProps = {
43184 color: theme.colors.activeBlue
43185};
43186ListBlockContainer.displayName = 'ListBlockContainer';
43187ListRowActionWrapper.displayName = 'ListRowActionWrapper';
43188ListRowActionWrapper.propTypes = {
43189 /** string with type of the row action */
43190 typeAction: PropTypes.oneOf(['checkbox', 'radio', 'icon']).isRequired,
43191
43192 /** bool to control the state of the action */
43193 isActive: PropTypes.bool.isRequired,
43194
43195 /** function handler to the row action */
43196 handleAction: PropTypes.func.isRequired,
43197
43198 /** string with action color */
43199 color: PropTypes.string
43200};
43201
43202function _templateObject$1e() {
43203 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n"]);
43204
43205 _templateObject$1e = function _templateObject() {
43206 return data;
43207 };
43208
43209 return data;
43210}
43211
43212var ListRowLeft = function ListRowLeft(_ref) {
43213 var children = _ref.children,
43214 color = _ref.color,
43215 typeAction = _ref.typeAction,
43216 handleAction = _ref.handleAction,
43217 isActive = _ref.isActive,
43218 props = objectWithoutPropertiesLoose(_ref, ["children", "color", "typeAction", "handleAction", "isActive"]);
43219
43220 return React__default.createElement(Wrapper$1, props, typeAction !== undefined && React__default.createElement(ListRowActionWrapper, {
43221 color: color,
43222 typeAction: typeAction,
43223 isActive: isActive,
43224 handleAction: handleAction
43225 }), children);
43226};
43227
43228var Wrapper$1 = styled__default.div(_templateObject$1e());
43229ListRowLeft.defaultProps = {
43230 typeAction: undefined,
43231 isActive: undefined,
43232 handleAction: undefined,
43233 color: theme.colors.activeBlue
43234};
43235ListRowLeft.propTypes = {
43236 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
43237
43238 /** string with type of the row action */
43239 typeAction: PropTypes.oneOf(['checkbox', 'radio', 'icon']),
43240
43241 /** bool to control the state of the action */
43242 isActive: PropTypes.bool,
43243
43244 /** function handler to the row action */
43245 handleAction: PropTypes.func,
43246
43247 /** string with action color */
43248 color: PropTypes.string
43249};
43250ListRowLeft.displayName = 'ListRowLeft';
43251
43252function _templateObject4$c() {
43253 var data = taggedTemplateLiteralLoose(["\n\tdisplay: none;\n"]);
43254
43255 _templateObject4$c = function _templateObject4() {
43256 return data;
43257 };
43258
43259 return data;
43260}
43261
43262function _templateObject3$h() {
43263 var data = taggedTemplateLiteralLoose(["\n\tmargin-right: 18px;\n\n\t:last-child {\n\t\tmargin-right: 0;\n\t}\n"]);
43264
43265 _templateObject3$h = function _templateObject3() {
43266 return data;
43267 };
43268
43269 return data;
43270}
43271
43272function _templateObject2$s() {
43273 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n"]);
43274
43275 _templateObject2$s = function _templateObject2() {
43276 return data;
43277 };
43278
43279 return data;
43280}
43281
43282function _templateObject$1f() {
43283 var data = taggedTemplateLiteralLoose(["\n\toutline: none;\n"]);
43284
43285 _templateObject$1f = function _templateObject() {
43286 return data;
43287 };
43288
43289 return data;
43290}
43291
43292var renderElements = function renderElements(element) {
43293 return Array.isArray(element) ? element.map(function (child, i) {
43294 return React__default.createElement(Div, {
43295 key: i
43296 }, child);
43297 }) : React__default.createElement(Div, null, element);
43298};
43299
43300var ListRowRight = function ListRowRight(_ref) {
43301 var children = _ref.children,
43302 showOnHover = _ref.showOnHover;
43303 return React__default.createElement(ListRowRightStyled, {
43304 role: "row",
43305 tabIndex: "0",
43306 onClick: function onClick(e) {
43307 return e.stopPropagation();
43308 }
43309 }, showOnHover && React__default.createElement(OnHoverShow, {
43310 className: "onHoverShow"
43311 }, renderElements(showOnHover)), React__default.createElement(Flex$2, null, renderElements(children)));
43312};
43313
43314var ListRowRightStyled = styled__default.div(_templateObject$1f());
43315var Flex$2 = styled__default.div(_templateObject2$s());
43316var Div = styled__default.div(_templateObject3$h());
43317var OnHoverShow = styled__default.span(_templateObject4$c());
43318OnHoverShow.displayName = 'OnHoverShow';
43319ListRowRight.defaultProps = {
43320 showOnHover: null,
43321 children: null
43322};
43323ListRowRight.propTypes = {
43324 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
43325
43326 /** components shown when hovered */
43327 showOnHover: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])
43328};
43329ListRowRight.displayName = 'ListRowRight';
43330
43331var ListRow = function ListRow(_ref) {
43332 var index = _ref.index,
43333 isActive = _ref.isActive,
43334 handleAction = _ref.handleAction,
43335 children = _ref.children,
43336 props = objectWithoutPropertiesLoose(_ref, ["index", "isActive", "handleAction", "children"]);
43337
43338 var renderChildrenWithProps = function renderChildrenWithProps() {
43339 return React__default.Children.map(children, function (child) {
43340 return React__default.cloneElement(child, {
43341 handleAction: handleAction,
43342 isActive: isActive
43343 });
43344 });
43345 };
43346
43347 return React__default.createElement(ListRowWrapper, _extends_1({
43348 index: index,
43349 className: isActive && 'active'
43350 }, props), renderChildrenWithProps(children));
43351};
43352
43353ListRow.Left = function (_ref2) {
43354 var props = _extends_1({}, _ref2);
43355
43356 return React__default.createElement(ListRowLeft, props);
43357};
43358
43359ListRow.Left.displayName = 'ListRow.Left';
43360
43361ListRow.Right = function (_ref3) {
43362 var props = _extends_1({}, _ref3);
43363
43364 return React__default.createElement(ListRowRight, props);
43365};
43366
43367ListRow.Right.displayName = 'ListRow.Right';
43368ListRow.defaultProps = {
43369 isActive: false,
43370 handleAction: undefined
43371};
43372ListRow.displayName = 'ListRow';
43373ListRow.propTypes = {
43374 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
43375
43376 /** array index for striping css */
43377 index: PropTypes.number.isRequired,
43378
43379 /** bool that control the action state */
43380 isActive: PropTypes.bool,
43381
43382 /** handle action function */
43383 handleAction: PropTypes.func
43384};
43385
43386function _templateObject$1g() {
43387 var data = taggedTemplateLiteralLoose(["\n\tdisplay: block;\n\tmargin-right: 12px;\n\tmargin-left: auto;\n\tcursor: pointer;\n\tfloat: right;\n\tline-height: 34px;\n\n\t& > div > i {\n\t\tline-height: 34px;\n\t}\n"]);
43388
43389 _templateObject$1g = function _templateObject() {
43390 return data;
43391 };
43392
43393 return data;
43394}
43395var ListRowRight$1 = styled__default.div(_templateObject$1g());
43396
43397var ListAddInfoWrapper = function ListAddInfoWrapper(props) {
43398 return React__default.createElement(ListRowRight$1, _extends_1({
43399 className: "additional-info-wrapper"
43400 }, props));
43401};
43402
43403ListAddInfoWrapper.propTypes = {
43404 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
43405};
43406ListAddInfoWrapper.displayName = 'ListAddInfoWrapper';
43407
43408function _templateObject$1h() {
43409 var data = taggedTemplateLiteralLoose(["\n\tdisplay: block;\n\tmargin-right: 12px;\n\tmargin-left: auto;\n\tcursor: pointer;\n\tfloat: right;\n\tline-height: 34px;\n\n\t& > div > i {\n\t\tline-height: 34px;\n\t}\n"]);
43410
43411 _templateObject$1h = function _templateObject() {
43412 return data;
43413 };
43414
43415 return data;
43416}
43417var ListRowRight$2 = styled__default.div(_templateObject$1h());
43418
43419var ListActionsWrapper = function ListActionsWrapper(props) {
43420 return React__default.createElement(ListRowRight$2, _extends_1({
43421 className: "actions-wrapper",
43422 onClick: function onClick(e) {
43423 return e.stopPropagation();
43424 }
43425 }, props));
43426};
43427
43428ListActionsWrapper.propTypes = {
43429 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
43430};
43431ListActionsWrapper.displayName = 'ListActionsWrapper';
43432
43433function _templateObject$1i() {
43434 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: ", ";\n\tmin-height: 68px;\n\tflex-wrap: wrap;\n\tjustify-content: space-between;\n\tpadding: 14px 12px 16px;\n\tmargin-right: ", ";\n\tmargin-bottom: 20px;\n\tborder: 1px solid ", " !important;\n\tborder-radius: 4px;\n\tcursor: pointer;\n\n\t@media only screen and (max-width: 767px) {\n\t\twidth: 100% !important;\n\t\tmargin-right: 0 !important;\n\t\tmargin-bottom: 20px !important;\n\t}\n\n\t:hover {\n\t\tposition: relative;\n\t\tbackground-color: #daedff !important;\n\t\tbox-shadow: 0 3px 3px rgba(0, 0, 0, 0.25) !important;\n\t\ttransition: all 0.2s ease-in-out;\n\t}\n\n\t:hover > .additional-info-wrapper {\n\t\tdisplay: ", ";\n\t}\n\n\t> .actions-wrapper {\n\t\tdisplay: ", ";\n\t}\n\n\t:hover > .actions-wrapper {\n\t\tdisplay: ", ";\n\t\ttransition: all 0.1s ease-in;\n\t}\n\n\t.active {\n\t\tbackground-color: #daedff !important;\n\t}\n"]);
43435
43436 _templateObject$1i = function _templateObject() {
43437 return data;
43438 };
43439
43440 return data;
43441}
43442var CardWrapper = styled__default(function (_ref) {
43443 var numCols = _ref.numCols,
43444 last = _ref.last,
43445 actions = _ref.actions,
43446 addInfo = _ref.addInfo,
43447 error = _ref.error,
43448 props = objectWithoutPropertiesLoose(_ref, ["numCols", "last", "actions", "addInfo", "error"]);
43449
43450 return React__default.createElement(semanticUiReact.Grid.Column, props);
43451})(_templateObject$1i(), function (_ref2) {
43452 var numCols = _ref2.numCols;
43453 return (100 - (numCols - 1) * 2) / numCols + "% !important";
43454}, function (_ref3) {
43455 var last = _ref3.last,
43456 numCols = _ref3.numCols;
43457 return last || numCols === 1 ? '0' : '2%';
43458}, function (_ref4) {
43459 var error = _ref4.error;
43460 return error ? theme.listCard.errorBorder : theme.listCard.defaultBorder;
43461}, function (_ref5) {
43462 var actions = _ref5.actions;
43463 return actions && 'none';
43464}, function (_ref6) {
43465 var actions = _ref6.actions,
43466 addInfo = _ref6.addInfo;
43467 return !addInfo && actions ? 'block' : 'none';
43468}, function (_ref7) {
43469 var actions = _ref7.actions;
43470 return actions && 'block';
43471});
43472
43473var ListCard = function ListCard(_ref8) {
43474 var checked = _ref8.checked,
43475 props = objectWithoutPropertiesLoose(_ref8, ["checked"]);
43476
43477 return React__default.createElement(CardWrapper, _extends_1({
43478 className: "" + (checked && 'active')
43479 }, props));
43480};
43481
43482ListCard.defaultProps = {
43483 checked: undefined,
43484 last: false,
43485 numCols: 4,
43486 error: false
43487};
43488ListCard.displayName = 'ListCard';
43489ListCard.propTypes = {
43490 checked: PropTypes.bool,
43491 last: PropTypes.bool,
43492 numCols: PropTypes.number,
43493 error: PropTypes.bool
43494};
43495
43496function _templateObject6$4() {
43497 var data = taggedTemplateLiteralLoose(["\n\tdisplay: ", ";\n\tpadding: 16px 0;\n\tborder-bottom: 1px solid ", ";\n"]);
43498
43499 _templateObject6$4 = function _templateObject6() {
43500 return data;
43501 };
43502
43503 return data;
43504}
43505
43506function _templateObject5$5() {
43507 var data = taggedTemplateLiteralLoose(["\n\ttransform: ", ";\n\ttransition: 0.33s;\n"]);
43508
43509 _templateObject5$5 = function _templateObject5() {
43510 return data;
43511 };
43512
43513 return data;
43514}
43515
43516function _templateObject4$d() {
43517 var data = taggedTemplateLiteralLoose(["\n\tdisplay: none;\n"]);
43518
43519 _templateObject4$d = function _templateObject4() {
43520 return data;
43521 };
43522
43523 return data;
43524}
43525
43526function _templateObject3$i() {
43527 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n"]);
43528
43529 _templateObject3$i = function _templateObject3() {
43530 return data;
43531 };
43532
43533 return data;
43534}
43535
43536function _templateObject2$t() {
43537 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n\tmargin-right: 18px;\n"]);
43538
43539 _templateObject2$t = function _templateObject2() {
43540 return data;
43541 };
43542
43543 return data;
43544}
43545
43546function _templateObject$1j() {
43547 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\talign-items: center;\n\tjustify-content: space-between;\n\tpadding: 10px 12px 10px 10px;\n\tmargin-bottom: 1px;\n\n\tbackground: ", ";\n\n\tcursor: pointer;\n\n\t:hover {\n\t\tposition: relative;\n\t\tbackground-color: ", " !important;\n\t\tbox-shadow: 0 3px 3px rgba(0, 0, 0, 0.25);\n\t\ttransition: all 0.2s ease-in-out;\n\n\t\t.onHoverShow {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t}\n\n\t\t.OnHoverHide {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n"]);
43548
43549 _templateObject$1j = function _templateObject() {
43550 return data;
43551 };
43552
43553 return data;
43554}
43555
43556var ListExpandableRow = function ListExpandableRow(_ref) {
43557 var children = _ref.children,
43558 activeIndex = _ref.activeIndex,
43559 index = _ref.index,
43560 _onClick = _ref.onClick,
43561 componentsLeft = _ref.componentsLeft,
43562 componentsRightShowOnHover = _ref.componentsRightShowOnHover,
43563 componentsRight = _ref.componentsRight,
43564 componentsRightHideOnHover = _ref.componentsRightHideOnHover,
43565 props = objectWithoutPropertiesLoose(_ref, ["children", "activeIndex", "index", "onClick", "componentsLeft", "componentsRightShowOnHover", "componentsRight", "componentsRightHideOnHover"]);
43566
43567 var renderElements = function renderElements(element) {
43568 return element.map(function (child, i) {
43569 return React__default.createElement(FlexCenter, {
43570 key: i
43571 }, child);
43572 });
43573 };
43574
43575 return React__default.createElement(React.Fragment, null, React__default.createElement(Row, _extends_1({
43576 expanded: index === activeIndex,
43577 index: index,
43578 onClick: function onClick() {
43579 return _onClick(index);
43580 }
43581 }, props), React__default.createElement(Flex$3, null, renderElements(componentsLeft)), React__default.createElement(Flex$3, null, componentsRightHideOnHover && React__default.createElement(Flex$3, {
43582 className: "OnHoverHide"
43583 }, renderElements(componentsRightHideOnHover)), componentsRightShowOnHover && React__default.createElement(OnHoverShow$1, {
43584 className: "onHoverShow"
43585 }, renderElements(componentsRightShowOnHover)), componentsRight && renderElements(componentsRight), React__default.createElement(IconAnimated$1, {
43586 expanded: index === activeIndex,
43587 icon: "select-down"
43588 }))), React__default.createElement(Body, {
43589 expanded: index === activeIndex,
43590 index: index
43591 }, children));
43592};
43593
43594var Row = styled__default.div(_templateObject$1j(), function (_ref2) {
43595 var index = _ref2.index,
43596 expanded = _ref2.expanded,
43597 theme = _ref2.theme;
43598 return expanded ? theme.colors.lightBlue : index % 2 ? 'white' : theme.colors.lightGray;
43599}, function (_ref3) {
43600 var theme = _ref3.theme;
43601 return theme.colors.lightBlue;
43602});
43603Row.displayName = 'Row';
43604var FlexCenter = styled__default.div(_templateObject2$t());
43605var Flex$3 = styled__default.div(_templateObject3$i());
43606Flex$3.displayName = 'Flex';
43607var OnHoverShow$1 = styled__default.span(_templateObject4$d());
43608OnHoverShow$1.displayName = 'OnHoverShow';
43609var IconAnimated$1 = styled__default(function (_ref4) {
43610 var expanded = _ref4.expanded,
43611 props = objectWithoutPropertiesLoose(_ref4, ["expanded"]);
43612
43613 return React__default.createElement(Icon, props);
43614})(_templateObject5$5(), function (_ref5) {
43615 var expanded = _ref5.expanded;
43616 return expanded && 'rotate(180deg)';
43617});
43618IconAnimated$1.displayName = 'IconAnimated';
43619var Body = styled__default.div(_templateObject6$4(), function (_ref6) {
43620 var expanded = _ref6.expanded;
43621 return expanded ? 'block' : 'none';
43622}, function (_ref7) {
43623 var theme = _ref7.theme;
43624 return theme.colors.strokeGray;
43625});
43626Body.displayName = 'Body';
43627ListExpandableRow.defaultProps = {
43628 activeIndex: null,
43629 componentsRightHideOnHover: []
43630};
43631ListExpandableRow.propTypes = {
43632 activeIndex: PropTypes.number,
43633 index: PropTypes.number.isRequired,
43634 onClick: PropTypes.func.isRequired,
43635 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
43636 componentsRight: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
43637 componentsLeft: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
43638 componentsRightShowOnHover: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
43639 componentsRightHideOnHover: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])
43640};
43641ListExpandableRow.displayName = 'ListExpandableRow';
43642
43643function _templateObject6$5() {
43644 var data = taggedTemplateLiteralLoose(["\n\tdisplay: ", ";\n\tborder-bottom: ", ";\n"]);
43645
43646 _templateObject6$5 = function _templateObject6() {
43647 return data;
43648 };
43649
43650 return data;
43651}
43652
43653function _templateObject5$6() {
43654 var data = taggedTemplateLiteralLoose(["\n\ttransform: ", ";\n\ttransition: 0.33s;\n"]);
43655
43656 _templateObject5$6 = function _templateObject5() {
43657 return data;
43658 };
43659
43660 return data;
43661}
43662
43663function _templateObject4$e() {
43664 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n"]);
43665
43666 _templateObject4$e = function _templateObject4() {
43667 return data;
43668 };
43669
43670 return data;
43671}
43672
43673function _templateObject3$j() {
43674 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\talign-items: center;\n\n\tcursor: pointer;\n"]);
43675
43676 _templateObject3$j = function _templateObject3() {
43677 return data;
43678 };
43679
43680 return data;
43681}
43682
43683function _templateObject2$u() {
43684 var data = taggedTemplateLiteralLoose(["\n\twidth: 40px;\n\theight: 40px;\n\tmargin-right: 12px;\n"]);
43685
43686 _templateObject2$u = function _templateObject2() {
43687 return data;
43688 };
43689
43690 return data;
43691}
43692
43693function _templateObject$1k() {
43694 var data = taggedTemplateLiteralLoose(["\n\tmargin-right: 5px;\n\tcolor: ", ";\n\tfont-size: 15px;\n\tline-height: 16px;\n\n\t:hover {\n\t\tcolor: ", ";\n\t}\n"]);
43695
43696 _templateObject$1k = function _templateObject() {
43697 return data;
43698 };
43699
43700 return data;
43701}
43702
43703var ListExpandableCustomRow = function ListExpandableCustomRow(_ref) {
43704 var children = _ref.children,
43705 activeIndex = _ref.activeIndex,
43706 index = _ref.index,
43707 _onClick = _ref.onClick,
43708 image = _ref.image,
43709 title = _ref.title,
43710 arrow = _ref.arrow,
43711 divider = _ref.divider,
43712 props = objectWithoutPropertiesLoose(_ref, ["children", "activeIndex", "index", "onClick", "image", "title", "arrow", "divider"]);
43713
43714 var expanded = index === activeIndex;
43715 return React__default.createElement(React.Fragment, null, React__default.createElement(Row$1, _extends_1({
43716 expanded: expanded,
43717 index: index,
43718 onClick: function onClick() {
43719 return _onClick(index);
43720 }
43721 }, props), React__default.createElement(Flex$4, null, React__default.createElement(Flex$4, null, image && React__default.createElement(Image$1, {
43722 src: image,
43723 alt: "qube standard",
43724 draggable: "false"
43725 }), title && React__default.createElement(Title$2, {
43726 expanded: expanded
43727 }, title)), arrow && React__default.createElement(IconAnimated$2, {
43728 expanded: expanded,
43729 icon: "select-down"
43730 }))), React__default.createElement(Body$1, {
43731 expanded: expanded,
43732 index: index,
43733 divider: divider
43734 }, children));
43735};
43736
43737var Title$2 = styled__default.div(_templateObject$1k(), function (_ref2) {
43738 var theme = _ref2.theme,
43739 expanded = _ref2.expanded;
43740 return expanded ? theme.colors.deepBlue : theme.colors.activeBlue;
43741}, function (_ref3) {
43742 var theme = _ref3.theme;
43743 return theme.colors.deepBlue;
43744});
43745Title$2.displayName = 'Title';
43746var Image$1 = styled__default.img(_templateObject2$u());
43747Image$1.displayName = 'Image';
43748var Row$1 = styled__default.div(_templateObject3$j());
43749Row$1.displayName = 'Row';
43750var Flex$4 = styled__default.div(_templateObject4$e());
43751Flex$4.displayName = 'Flex';
43752var IconAnimated$2 = styled__default(function (_ref4) {
43753 var expanded = _ref4.expanded,
43754 props = objectWithoutPropertiesLoose(_ref4, ["expanded"]);
43755
43756 return React__default.createElement(Icon, props);
43757})(_templateObject5$6(), function (_ref5) {
43758 var expanded = _ref5.expanded;
43759 return expanded && 'rotate(180deg)';
43760});
43761IconAnimated$2.displayName = 'IconAnimated';
43762var Body$1 = styled__default.div(_templateObject6$5(), function (_ref6) {
43763 var expanded = _ref6.expanded;
43764 return expanded ? 'block' : 'none';
43765}, function (_ref7) {
43766 var theme = _ref7.theme,
43767 divider = _ref7.divider;
43768 return divider ? "thin solid " + theme.colors.strokeGray : 'none';
43769});
43770Body$1.displayName = 'Body';
43771ListExpandableCustomRow.defaultProps = {
43772 activeIndex: null,
43773 image: null,
43774 title: null,
43775 arrow: true,
43776 divider: false
43777};
43778ListExpandableCustomRow.propTypes = {
43779 activeIndex: PropTypes.number,
43780 index: PropTypes.number.isRequired,
43781 onClick: PropTypes.func.isRequired,
43782 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
43783 image: PropTypes.string,
43784 title: PropTypes.string,
43785 arrow: PropTypes.bool,
43786 divider: PropTypes.bool
43787};
43788ListExpandableCustomRow.displayName = 'ListExpandableCustomRow';
43789
43790var ListExpandable = function ListExpandable(_ref) {
43791 var children = _ref.children,
43792 expandedIndex = _ref.expandedIndex,
43793 props = objectWithoutPropertiesLoose(_ref, ["children", "expandedIndex"]);
43794
43795 var _useState = React.useState(expandedIndex),
43796 activeIndex = _useState[0],
43797 setActiveIndex = _useState[1];
43798
43799 React.useEffect(function () {
43800 setActiveIndex(expandedIndex);
43801 }, [expandedIndex]);
43802
43803 var onClick = function onClick(index) {
43804 return index === activeIndex ? setActiveIndex(null) : setActiveIndex(index);
43805 };
43806
43807 var renderChildrenWithProps = function renderChildrenWithProps() {
43808 return React__default.Children.map(children, function (child) {
43809 return React__default.cloneElement(child, {
43810 onClick: onClick,
43811 activeIndex: activeIndex
43812 });
43813 });
43814 };
43815
43816 return React__default.createElement("div", props, renderChildrenWithProps());
43817};
43818
43819ListExpandable.Row = function (_ref2) {
43820 var props = _extends_1({}, _ref2);
43821
43822 return React__default.createElement(ListExpandableRow, props);
43823};
43824
43825ListExpandable.CustomRow = function (_ref3) {
43826 var props = _extends_1({}, _ref3);
43827
43828 return React__default.createElement(ListExpandableCustomRow, props);
43829};
43830
43831ListExpandable.Row.displayName = 'ListExpandable.Row';
43832ListExpandable.CustomRow.displayName = 'ListExpandable.CustomRow';
43833ListExpandable.Row.propTypes = {
43834 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
43835};
43836ListExpandable.CustomRow.propTypes = {
43837 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
43838};
43839ListExpandable.defaultProps = {
43840 expandedIndex: null
43841};
43842ListExpandable.propTypes = {
43843 /** index of the initial expanded element */
43844 expandedIndex: PropTypes.number,
43845 children: PropTypes.node.isRequired
43846};
43847ListExpandable.displayName = 'ListExpandable';
43848
43849/**
43850 * Copyright (c) 2013-present, Facebook, Inc.
43851 *
43852 * This source code is licensed under the MIT license found in the
43853 * LICENSE file in the root directory of this source tree.
43854 */
43855
43856/**
43857 * Use invariant() to assert state which your program assumes to be true.
43858 *
43859 * Provide sprintf-style format (only %s is supported) and arguments
43860 * to provide information about what broke and what you were
43861 * expecting.
43862 *
43863 * The invariant message will be stripped in production, but the invariant
43864 * will remain to ensure logic does not differ in production.
43865 */
43866
43867var NODE_ENV = process.env.NODE_ENV;
43868
43869var invariant = function(condition, format, a, b, c, d, e, f) {
43870 if (NODE_ENV !== 'production') {
43871 if (format === undefined) {
43872 throw new Error('invariant requires an error message argument');
43873 }
43874 }
43875
43876 if (!condition) {
43877 var error;
43878 if (format === undefined) {
43879 error = new Error(
43880 'Minified exception occurred; use the non-minified dev environment ' +
43881 'for the full error message and additional helpful warnings.'
43882 );
43883 } else {
43884 var args = [a, b, c, d, e, f];
43885 var argIndex = 0;
43886 error = new Error(
43887 format.replace(/%s/g, function() { return args[argIndex++]; })
43888 );
43889 error.name = 'Invariant Violation';
43890 }
43891
43892 error.framesToPop = 1; // we don't care about invariant's own frame
43893 throw error;
43894 }
43895};
43896
43897var invariant_1 = invariant;
43898
43899//
43900
43901var shallowequal = function shallowEqual(objA, objB, compare, compareContext) {
43902 var ret = compare ? compare.call(compareContext, objA, objB) : void 0;
43903
43904 if (ret !== void 0) {
43905 return !!ret;
43906 }
43907
43908 if (objA === objB) {
43909 return true;
43910 }
43911
43912 if (typeof objA !== "object" || !objA || typeof objB !== "object" || !objB) {
43913 return false;
43914 }
43915
43916 var keysA = Object.keys(objA);
43917 var keysB = Object.keys(objB);
43918
43919 if (keysA.length !== keysB.length) {
43920 return false;
43921 }
43922
43923 var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
43924
43925 // Test for A's keys different from B.
43926 for (var idx = 0; idx < keysA.length; idx++) {
43927 var key = keysA[idx];
43928
43929 if (!bHasOwnProperty(key)) {
43930 return false;
43931 }
43932
43933 var valueA = objA[key];
43934 var valueB = objB[key];
43935
43936 ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;
43937
43938 if (ret === false || (ret === void 0 && valueA !== valueB)) {
43939 return false;
43940 }
43941 }
43942
43943 return true;
43944};
43945
43946var useCollector_1 = createCommonjsModule(function (module, exports) {
43947var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
43948 return (mod && mod.__esModule) ? mod : { "default": mod };
43949};
43950Object.defineProperty(exports, "__esModule", { value: true });
43951var shallowequal_1 = __importDefault(shallowequal);
43952
43953/**
43954 *
43955 * @param monitor The monitor to collect state from
43956 * @param collect The collecting function
43957 * @param onUpdate A method to invoke when updates occur
43958 */
43959function useCollector(monitor, collect, onUpdate) {
43960 var _a = React__default.useState(function () { return collect(monitor); }), collected = _a[0], setCollected = _a[1];
43961 var updateCollected = React__default.useCallback(function () {
43962 var nextValue = collect(monitor);
43963 if (!shallowequal_1.default(collected, nextValue)) {
43964 setCollected(nextValue);
43965 if (onUpdate) {
43966 onUpdate();
43967 }
43968 }
43969 }, [collected, monitor, onUpdate]);
43970 // update the collected properties after the first render
43971 // and the components are attached to dnd-core
43972 React__default.useLayoutEffect(updateCollected, []);
43973 return [collected, updateCollected];
43974}
43975exports.useCollector = useCollector;
43976});
43977
43978unwrapExports(useCollector_1);
43979var useCollector_2 = useCollector_1.useCollector;
43980
43981var useMonitorOutput_1 = createCommonjsModule(function (module, exports) {
43982Object.defineProperty(exports, "__esModule", { value: true });
43983
43984
43985function useMonitorOutput(monitor, collect, onCollect) {
43986 var _a = useCollector_1.useCollector(monitor, collect, onCollect), collected = _a[0], updateCollected = _a[1];
43987 React__default.useLayoutEffect(function subscribeToMonitorStateChange() {
43988 var handlerId = monitor.getHandlerId();
43989 if (handlerId == null) {
43990 return undefined;
43991 }
43992 return monitor.subscribeToStateChange(updateCollected, {
43993 handlerIds: [handlerId],
43994 });
43995 }, [monitor, updateCollected]);
43996 return collected;
43997}
43998exports.useMonitorOutput = useMonitorOutput;
43999});
44000
44001unwrapExports(useMonitorOutput_1);
44002var useMonitorOutput_2 = useMonitorOutput_1.useMonitorOutput;
44003
44004var registration = createCommonjsModule(function (module, exports) {
44005Object.defineProperty(exports, "__esModule", { value: true });
44006function registerTarget(type, target, manager) {
44007 var registry = manager.getRegistry();
44008 var targetId = registry.addTarget(type, target);
44009 return [targetId, function () { return registry.removeTarget(targetId); }];
44010}
44011exports.registerTarget = registerTarget;
44012function registerSource(type, source, manager) {
44013 var registry = manager.getRegistry();
44014 var sourceId = registry.addSource(type, source);
44015 return [sourceId, function () { return registry.removeSource(sourceId); }];
44016}
44017exports.registerSource = registerSource;
44018});
44019
44020unwrapExports(registration);
44021var registration_1 = registration.registerTarget;
44022var registration_2 = registration.registerSource;
44023
44024var interfaces = createCommonjsModule(function (module, exports) {
44025Object.defineProperty(exports, "__esModule", { value: true });
44026var HandlerRole;
44027(function (HandlerRole) {
44028 HandlerRole["SOURCE"] = "SOURCE";
44029 HandlerRole["TARGET"] = "TARGET";
44030})(HandlerRole = exports.HandlerRole || (exports.HandlerRole = {}));
44031});
44032
44033unwrapExports(interfaces);
44034var interfaces_1 = interfaces.HandlerRole;
44035
44036function symbolObservablePonyfill(root) {
44037 var result;
44038 var Symbol = root.Symbol;
44039
44040 if (typeof Symbol === 'function') {
44041 if (Symbol.observable) {
44042 result = Symbol.observable;
44043 } else {
44044 result = Symbol('observable');
44045 Symbol.observable = result;
44046 }
44047 } else {
44048 result = '@@observable';
44049 }
44050
44051 return result;
44052}
44053
44054/* global window */
44055
44056var root$1;
44057
44058if (typeof self !== 'undefined') {
44059 root$1 = self;
44060} else if (typeof window !== 'undefined') {
44061 root$1 = window;
44062} else if (typeof global !== 'undefined') {
44063 root$1 = global;
44064} else if (typeof module !== 'undefined') {
44065 root$1 = module;
44066} else {
44067 root$1 = Function('return this')();
44068}
44069
44070var result = symbolObservablePonyfill(root$1);
44071
44072/**
44073 * These are private action types reserved by Redux.
44074 * For any unknown actions, you must return the current state.
44075 * If the current state is undefined, you must return the initial state.
44076 * Do not reference these action types directly in your code.
44077 */
44078var randomString = function randomString() {
44079 return Math.random().toString(36).substring(7).split('').join('.');
44080};
44081
44082var ActionTypes = {
44083 INIT: "@@redux/INIT" + randomString(),
44084 REPLACE: "@@redux/REPLACE" + randomString(),
44085 PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
44086 return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
44087 }
44088};
44089
44090/**
44091 * @param {any} obj The object to inspect.
44092 * @returns {boolean} True if the argument appears to be a plain object.
44093 */
44094function isPlainObject(obj) {
44095 if (typeof obj !== 'object' || obj === null) return false;
44096 var proto = obj;
44097
44098 while (Object.getPrototypeOf(proto) !== null) {
44099 proto = Object.getPrototypeOf(proto);
44100 }
44101
44102 return Object.getPrototypeOf(obj) === proto;
44103}
44104
44105/**
44106 * Creates a Redux store that holds the state tree.
44107 * The only way to change the data in the store is to call `dispatch()` on it.
44108 *
44109 * There should only be a single store in your app. To specify how different
44110 * parts of the state tree respond to actions, you may combine several reducers
44111 * into a single reducer function by using `combineReducers`.
44112 *
44113 * @param {Function} reducer A function that returns the next state tree, given
44114 * the current state tree and the action to handle.
44115 *
44116 * @param {any} [preloadedState] The initial state. You may optionally specify it
44117 * to hydrate the state from the server in universal apps, or to restore a
44118 * previously serialized user session.
44119 * If you use `combineReducers` to produce the root reducer function, this must be
44120 * an object with the same shape as `combineReducers` keys.
44121 *
44122 * @param {Function} [enhancer] The store enhancer. You may optionally specify it
44123 * to enhance the store with third-party capabilities such as middleware,
44124 * time travel, persistence, etc. The only store enhancer that ships with Redux
44125 * is `applyMiddleware()`.
44126 *
44127 * @returns {Store} A Redux store that lets you read the state, dispatch actions
44128 * and subscribe to changes.
44129 */
44130
44131function createStore(reducer, preloadedState, enhancer) {
44132 var _ref2;
44133
44134 if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {
44135 throw new Error('It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function');
44136 }
44137
44138 if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
44139 enhancer = preloadedState;
44140 preloadedState = undefined;
44141 }
44142
44143 if (typeof enhancer !== 'undefined') {
44144 if (typeof enhancer !== 'function') {
44145 throw new Error('Expected the enhancer to be a function.');
44146 }
44147
44148 return enhancer(createStore)(reducer, preloadedState);
44149 }
44150
44151 if (typeof reducer !== 'function') {
44152 throw new Error('Expected the reducer to be a function.');
44153 }
44154
44155 var currentReducer = reducer;
44156 var currentState = preloadedState;
44157 var currentListeners = [];
44158 var nextListeners = currentListeners;
44159 var isDispatching = false;
44160
44161 function ensureCanMutateNextListeners() {
44162 if (nextListeners === currentListeners) {
44163 nextListeners = currentListeners.slice();
44164 }
44165 }
44166 /**
44167 * Reads the state tree managed by the store.
44168 *
44169 * @returns {any} The current state tree of your application.
44170 */
44171
44172
44173 function getState() {
44174 if (isDispatching) {
44175 throw new Error('You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');
44176 }
44177
44178 return currentState;
44179 }
44180 /**
44181 * Adds a change listener. It will be called any time an action is dispatched,
44182 * and some part of the state tree may potentially have changed. You may then
44183 * call `getState()` to read the current state tree inside the callback.
44184 *
44185 * You may call `dispatch()` from a change listener, with the following
44186 * caveats:
44187 *
44188 * 1. The subscriptions are snapshotted just before every `dispatch()` call.
44189 * If you subscribe or unsubscribe while the listeners are being invoked, this
44190 * will not have any effect on the `dispatch()` that is currently in progress.
44191 * However, the next `dispatch()` call, whether nested or not, will use a more
44192 * recent snapshot of the subscription list.
44193 *
44194 * 2. The listener should not expect to see all state changes, as the state
44195 * might have been updated multiple times during a nested `dispatch()` before
44196 * the listener is called. It is, however, guaranteed that all subscribers
44197 * registered before the `dispatch()` started will be called with the latest
44198 * state by the time it exits.
44199 *
44200 * @param {Function} listener A callback to be invoked on every dispatch.
44201 * @returns {Function} A function to remove this change listener.
44202 */
44203
44204
44205 function subscribe(listener) {
44206 if (typeof listener !== 'function') {
44207 throw new Error('Expected the listener to be a function.');
44208 }
44209
44210 if (isDispatching) {
44211 throw new Error('You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.');
44212 }
44213
44214 var isSubscribed = true;
44215 ensureCanMutateNextListeners();
44216 nextListeners.push(listener);
44217 return function unsubscribe() {
44218 if (!isSubscribed) {
44219 return;
44220 }
44221
44222 if (isDispatching) {
44223 throw new Error('You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.');
44224 }
44225
44226 isSubscribed = false;
44227 ensureCanMutateNextListeners();
44228 var index = nextListeners.indexOf(listener);
44229 nextListeners.splice(index, 1);
44230 };
44231 }
44232 /**
44233 * Dispatches an action. It is the only way to trigger a state change.
44234 *
44235 * The `reducer` function, used to create the store, will be called with the
44236 * current state tree and the given `action`. Its return value will
44237 * be considered the **next** state of the tree, and the change listeners
44238 * will be notified.
44239 *
44240 * The base implementation only supports plain object actions. If you want to
44241 * dispatch a Promise, an Observable, a thunk, or something else, you need to
44242 * wrap your store creating function into the corresponding middleware. For
44243 * example, see the documentation for the `redux-thunk` package. Even the
44244 * middleware will eventually dispatch plain object actions using this method.
44245 *
44246 * @param {Object} action A plain object representing “what changed”. It is
44247 * a good idea to keep actions serializable so you can record and replay user
44248 * sessions, or use the time travelling `redux-devtools`. An action must have
44249 * a `type` property which may not be `undefined`. It is a good idea to use
44250 * string constants for action types.
44251 *
44252 * @returns {Object} For convenience, the same action object you dispatched.
44253 *
44254 * Note that, if you use a custom middleware, it may wrap `dispatch()` to
44255 * return something else (for example, a Promise you can await).
44256 */
44257
44258
44259 function dispatch(action) {
44260 if (!isPlainObject(action)) {
44261 throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');
44262 }
44263
44264 if (typeof action.type === 'undefined') {
44265 throw new Error('Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?');
44266 }
44267
44268 if (isDispatching) {
44269 throw new Error('Reducers may not dispatch actions.');
44270 }
44271
44272 try {
44273 isDispatching = true;
44274 currentState = currentReducer(currentState, action);
44275 } finally {
44276 isDispatching = false;
44277 }
44278
44279 var listeners = currentListeners = nextListeners;
44280
44281 for (var i = 0; i < listeners.length; i++) {
44282 var listener = listeners[i];
44283 listener();
44284 }
44285
44286 return action;
44287 }
44288 /**
44289 * Replaces the reducer currently used by the store to calculate the state.
44290 *
44291 * You might need this if your app implements code splitting and you want to
44292 * load some of the reducers dynamically. You might also need this if you
44293 * implement a hot reloading mechanism for Redux.
44294 *
44295 * @param {Function} nextReducer The reducer for the store to use instead.
44296 * @returns {void}
44297 */
44298
44299
44300 function replaceReducer(nextReducer) {
44301 if (typeof nextReducer !== 'function') {
44302 throw new Error('Expected the nextReducer to be a function.');
44303 }
44304
44305 currentReducer = nextReducer;
44306 dispatch({
44307 type: ActionTypes.REPLACE
44308 });
44309 }
44310 /**
44311 * Interoperability point for observable/reactive libraries.
44312 * @returns {observable} A minimal observable of state changes.
44313 * For more information, see the observable proposal:
44314 * https://github.com/tc39/proposal-observable
44315 */
44316
44317
44318 function observable() {
44319 var _ref;
44320
44321 var outerSubscribe = subscribe;
44322 return _ref = {
44323 /**
44324 * The minimal observable subscription method.
44325 * @param {Object} observer Any object that can be used as an observer.
44326 * The observer object should have a `next` method.
44327 * @returns {subscription} An object with an `unsubscribe` method that can
44328 * be used to unsubscribe the observable from the store, and prevent further
44329 * emission of values from the observable.
44330 */
44331 subscribe: function subscribe(observer) {
44332 if (typeof observer !== 'object' || observer === null) {
44333 throw new TypeError('Expected the observer to be an object.');
44334 }
44335
44336 function observeState() {
44337 if (observer.next) {
44338 observer.next(getState());
44339 }
44340 }
44341
44342 observeState();
44343 var unsubscribe = outerSubscribe(observeState);
44344 return {
44345 unsubscribe: unsubscribe
44346 };
44347 }
44348 }, _ref[result] = function () {
44349 return this;
44350 }, _ref;
44351 } // When a store is created, an "INIT" action is dispatched so that every
44352 // reducer returns their initial state. This effectively populates
44353 // the initial state tree.
44354
44355
44356 dispatch({
44357 type: ActionTypes.INIT
44358 });
44359 return _ref2 = {
44360 dispatch: dispatch,
44361 subscribe: subscribe,
44362 getState: getState,
44363 replaceReducer: replaceReducer
44364 }, _ref2[result] = observable, _ref2;
44365}
44366
44367/**
44368 * Prints a warning in the console if it exists.
44369 *
44370 * @param {String} message The warning message.
44371 * @returns {void}
44372 */
44373function warning(message) {
44374 /* eslint-disable no-console */
44375 if (typeof console !== 'undefined' && typeof console.error === 'function') {
44376 console.error(message);
44377 }
44378 /* eslint-enable no-console */
44379
44380
44381 try {
44382 // This error was thrown as a convenience so that if you enable
44383 // "break on all exceptions" in your console,
44384 // it would pause the execution at this line.
44385 throw new Error(message);
44386 } catch (e) {} // eslint-disable-line no-empty
44387
44388}
44389
44390function getUndefinedStateErrorMessage(key, action) {
44391 var actionType = action && action.type;
44392 var actionDescription = actionType && "action \"" + String(actionType) + "\"" || 'an action';
44393 return "Given " + actionDescription + ", reducer \"" + key + "\" returned undefined. " + "To ignore an action, you must explicitly return the previous state. " + "If you want this reducer to hold no value, you can return null instead of undefined.";
44394}
44395
44396function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
44397 var reducerKeys = Object.keys(reducers);
44398 var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';
44399
44400 if (reducerKeys.length === 0) {
44401 return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
44402 }
44403
44404 if (!isPlainObject(inputState)) {
44405 return "The " + argumentName + " has unexpected type of \"" + {}.toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] + "\". Expected argument to be an object with the following " + ("keys: \"" + reducerKeys.join('", "') + "\"");
44406 }
44407
44408 var unexpectedKeys = Object.keys(inputState).filter(function (key) {
44409 return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
44410 });
44411 unexpectedKeys.forEach(function (key) {
44412 unexpectedKeyCache[key] = true;
44413 });
44414 if (action && action.type === ActionTypes.REPLACE) return;
44415
44416 if (unexpectedKeys.length > 0) {
44417 return "Unexpected " + (unexpectedKeys.length > 1 ? 'keys' : 'key') + " " + ("\"" + unexpectedKeys.join('", "') + "\" found in " + argumentName + ". ") + "Expected to find one of the known reducer keys instead: " + ("\"" + reducerKeys.join('", "') + "\". Unexpected keys will be ignored.");
44418 }
44419}
44420
44421function assertReducerShape(reducers) {
44422 Object.keys(reducers).forEach(function (key) {
44423 var reducer = reducers[key];
44424 var initialState = reducer(undefined, {
44425 type: ActionTypes.INIT
44426 });
44427
44428 if (typeof initialState === 'undefined') {
44429 throw new Error("Reducer \"" + key + "\" returned undefined during initialization. " + "If the state passed to the reducer is undefined, you must " + "explicitly return the initial state. The initial state may " + "not be undefined. If you don't want to set a value for this reducer, " + "you can use null instead of undefined.");
44430 }
44431
44432 if (typeof reducer(undefined, {
44433 type: ActionTypes.PROBE_UNKNOWN_ACTION()
44434 }) === 'undefined') {
44435 throw new Error("Reducer \"" + key + "\" returned undefined when probed with a random type. " + ("Don't try to handle " + ActionTypes.INIT + " or other actions in \"redux/*\" ") + "namespace. They are considered private. Instead, you must return the " + "current state for any unknown actions, unless it is undefined, " + "in which case you must return the initial state, regardless of the " + "action type. The initial state may not be undefined, but can be null.");
44436 }
44437 });
44438}
44439/**
44440 * Turns an object whose values are different reducer functions, into a single
44441 * reducer function. It will call every child reducer, and gather their results
44442 * into a single state object, whose keys correspond to the keys of the passed
44443 * reducer functions.
44444 *
44445 * @param {Object} reducers An object whose values correspond to different
44446 * reducer functions that need to be combined into one. One handy way to obtain
44447 * it is to use ES6 `import * as reducers` syntax. The reducers may never return
44448 * undefined for any action. Instead, they should return their initial state
44449 * if the state passed to them was undefined, and the current state for any
44450 * unrecognized action.
44451 *
44452 * @returns {Function} A reducer function that invokes every reducer inside the
44453 * passed object, and builds a state object with the same shape.
44454 */
44455
44456
44457function combineReducers(reducers) {
44458 var reducerKeys = Object.keys(reducers);
44459 var finalReducers = {};
44460
44461 for (var i = 0; i < reducerKeys.length; i++) {
44462 var key = reducerKeys[i];
44463
44464 if (process.env.NODE_ENV !== 'production') {
44465 if (typeof reducers[key] === 'undefined') {
44466 warning("No reducer provided for key \"" + key + "\"");
44467 }
44468 }
44469
44470 if (typeof reducers[key] === 'function') {
44471 finalReducers[key] = reducers[key];
44472 }
44473 }
44474
44475 var finalReducerKeys = Object.keys(finalReducers);
44476 var unexpectedKeyCache;
44477
44478 if (process.env.NODE_ENV !== 'production') {
44479 unexpectedKeyCache = {};
44480 }
44481
44482 var shapeAssertionError;
44483
44484 try {
44485 assertReducerShape(finalReducers);
44486 } catch (e) {
44487 shapeAssertionError = e;
44488 }
44489
44490 return function combination(state, action) {
44491 if (state === void 0) {
44492 state = {};
44493 }
44494
44495 if (shapeAssertionError) {
44496 throw shapeAssertionError;
44497 }
44498
44499 if (process.env.NODE_ENV !== 'production') {
44500 var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
44501
44502 if (warningMessage) {
44503 warning(warningMessage);
44504 }
44505 }
44506
44507 var hasChanged = false;
44508 var nextState = {};
44509
44510 for (var _i = 0; _i < finalReducerKeys.length; _i++) {
44511 var _key = finalReducerKeys[_i];
44512 var reducer = finalReducers[_key];
44513 var previousStateForKey = state[_key];
44514 var nextStateForKey = reducer(previousStateForKey, action);
44515
44516 if (typeof nextStateForKey === 'undefined') {
44517 var errorMessage = getUndefinedStateErrorMessage(_key, action);
44518 throw new Error(errorMessage);
44519 }
44520
44521 nextState[_key] = nextStateForKey;
44522 hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
44523 }
44524
44525 return hasChanged ? nextState : state;
44526 };
44527}
44528
44529function bindActionCreator(actionCreator, dispatch) {
44530 return function () {
44531 return dispatch(actionCreator.apply(this, arguments));
44532 };
44533}
44534/**
44535 * Turns an object whose values are action creators, into an object with the
44536 * same keys, but with every function wrapped into a `dispatch` call so they
44537 * may be invoked directly. This is just a convenience method, as you can call
44538 * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.
44539 *
44540 * For convenience, you can also pass a single function as the first argument,
44541 * and get a function in return.
44542 *
44543 * @param {Function|Object} actionCreators An object whose values are action
44544 * creator functions. One handy way to obtain it is to use ES6 `import * as`
44545 * syntax. You may also pass a single function.
44546 *
44547 * @param {Function} dispatch The `dispatch` function available on your Redux
44548 * store.
44549 *
44550 * @returns {Function|Object} The object mimicking the original object, but with
44551 * every action creator wrapped into the `dispatch` call. If you passed a
44552 * function as `actionCreators`, the return value will also be a single
44553 * function.
44554 */
44555
44556
44557function bindActionCreators(actionCreators, dispatch) {
44558 if (typeof actionCreators === 'function') {
44559 return bindActionCreator(actionCreators, dispatch);
44560 }
44561
44562 if (typeof actionCreators !== 'object' || actionCreators === null) {
44563 throw new Error("bindActionCreators expected an object or a function, instead received " + (actionCreators === null ? 'null' : typeof actionCreators) + ". " + "Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?");
44564 }
44565
44566 var keys = Object.keys(actionCreators);
44567 var boundActionCreators = {};
44568
44569 for (var i = 0; i < keys.length; i++) {
44570 var key = keys[i];
44571 var actionCreator = actionCreators[key];
44572
44573 if (typeof actionCreator === 'function') {
44574 boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);
44575 }
44576 }
44577
44578 return boundActionCreators;
44579}
44580
44581function _defineProperty$2(obj, key, value) {
44582 if (key in obj) {
44583 Object.defineProperty(obj, key, {
44584 value: value,
44585 enumerable: true,
44586 configurable: true,
44587 writable: true
44588 });
44589 } else {
44590 obj[key] = value;
44591 }
44592
44593 return obj;
44594}
44595
44596function _objectSpread$1(target) {
44597 for (var i = 1; i < arguments.length; i++) {
44598 var source = arguments[i] != null ? arguments[i] : {};
44599 var ownKeys = Object.keys(source);
44600
44601 if (typeof Object.getOwnPropertySymbols === 'function') {
44602 ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
44603 return Object.getOwnPropertyDescriptor(source, sym).enumerable;
44604 }));
44605 }
44606
44607 ownKeys.forEach(function (key) {
44608 _defineProperty$2(target, key, source[key]);
44609 });
44610 }
44611
44612 return target;
44613}
44614
44615/**
44616 * Composes single-argument functions from right to left. The rightmost
44617 * function can take multiple arguments as it provides the signature for
44618 * the resulting composite function.
44619 *
44620 * @param {...Function} funcs The functions to compose.
44621 * @returns {Function} A function obtained by composing the argument functions
44622 * from right to left. For example, compose(f, g, h) is identical to doing
44623 * (...args) => f(g(h(...args))).
44624 */
44625function compose() {
44626 for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
44627 funcs[_key] = arguments[_key];
44628 }
44629
44630 if (funcs.length === 0) {
44631 return function (arg) {
44632 return arg;
44633 };
44634 }
44635
44636 if (funcs.length === 1) {
44637 return funcs[0];
44638 }
44639
44640 return funcs.reduce(function (a, b) {
44641 return function () {
44642 return a(b.apply(void 0, arguments));
44643 };
44644 });
44645}
44646
44647/**
44648 * Creates a store enhancer that applies middleware to the dispatch method
44649 * of the Redux store. This is handy for a variety of tasks, such as expressing
44650 * asynchronous actions in a concise manner, or logging every action payload.
44651 *
44652 * See `redux-thunk` package as an example of the Redux middleware.
44653 *
44654 * Because middleware is potentially asynchronous, this should be the first
44655 * store enhancer in the composition chain.
44656 *
44657 * Note that each middleware will be given the `dispatch` and `getState` functions
44658 * as named arguments.
44659 *
44660 * @param {...Function} middlewares The middleware chain to be applied.
44661 * @returns {Function} A store enhancer applying the middleware.
44662 */
44663
44664function applyMiddleware() {
44665 for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {
44666 middlewares[_key] = arguments[_key];
44667 }
44668
44669 return function (createStore) {
44670 return function () {
44671 var store = createStore.apply(void 0, arguments);
44672
44673 var _dispatch = function dispatch() {
44674 throw new Error("Dispatching while constructing your middleware is not allowed. " + "Other middleware would not be applied to this dispatch.");
44675 };
44676
44677 var middlewareAPI = {
44678 getState: store.getState,
44679 dispatch: function dispatch() {
44680 return _dispatch.apply(void 0, arguments);
44681 }
44682 };
44683 var chain = middlewares.map(function (middleware) {
44684 return middleware(middlewareAPI);
44685 });
44686 _dispatch = compose.apply(void 0, chain)(store.dispatch);
44687 return _objectSpread$1({}, store, {
44688 dispatch: _dispatch
44689 });
44690 };
44691 };
44692}
44693
44694/*
44695 * This is a dummy function to check if the function name has been altered by minification.
44696 * If the function has been minified and NODE_ENV !== 'production', warn the user.
44697 */
44698
44699function isCrushed() {}
44700
44701if (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {
44702 warning('You are currently using minified code outside of NODE_ENV === "production". ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + 'to ensure you have the correct code for your production build.');
44703}
44704
44705var redux = /*#__PURE__*/Object.freeze({
44706 createStore: createStore,
44707 combineReducers: combineReducers,
44708 bindActionCreators: bindActionCreators,
44709 applyMiddleware: applyMiddleware,
44710 compose: compose,
44711 __DO_NOT_USE__ActionTypes: ActionTypes
44712});
44713
44714var types = createCommonjsModule(function (module, exports) {
44715Object.defineProperty(exports, "__esModule", { value: true });
44716exports.INIT_COORDS = 'dnd-core/INIT_COORDS';
44717exports.BEGIN_DRAG = 'dnd-core/BEGIN_DRAG';
44718exports.PUBLISH_DRAG_SOURCE = 'dnd-core/PUBLISH_DRAG_SOURCE';
44719exports.HOVER = 'dnd-core/HOVER';
44720exports.DROP = 'dnd-core/DROP';
44721exports.END_DRAG = 'dnd-core/END_DRAG';
44722});
44723
44724unwrapExports(types);
44725var types_1 = types.INIT_COORDS;
44726var types_2 = types.BEGIN_DRAG;
44727var types_3 = types.PUBLISH_DRAG_SOURCE;
44728var types_4 = types.HOVER;
44729var types_5 = types.DROP;
44730var types_6 = types.END_DRAG;
44731
44732var setClientOffset_1 = createCommonjsModule(function (module, exports) {
44733Object.defineProperty(exports, "__esModule", { value: true });
44734
44735function setClientOffset(clientOffset, sourceClientOffset) {
44736 return {
44737 type: types.INIT_COORDS,
44738 payload: {
44739 sourceClientOffset: sourceClientOffset || null,
44740 clientOffset: clientOffset || null,
44741 },
44742 };
44743}
44744exports.setClientOffset = setClientOffset;
44745});
44746
44747unwrapExports(setClientOffset_1);
44748var setClientOffset_2 = setClientOffset_1.setClientOffset;
44749
44750var js_utils = createCommonjsModule(function (module, exports) {
44751// cheap lodash replacements
44752Object.defineProperty(exports, "__esModule", { value: true });
44753/**
44754 * drop-in replacement for _.get
44755 * @param obj
44756 * @param path
44757 * @param defaultValue
44758 */
44759function get(obj, path, defaultValue) {
44760 return path
44761 .split('.')
44762 .reduce(function (a, c) { return (a && a[c] ? a[c] : defaultValue || null); }, obj);
44763}
44764exports.get = get;
44765/**
44766 * drop-in replacement for _.without
44767 */
44768function without(items, item) {
44769 return items.filter(function (i) { return i !== item; });
44770}
44771exports.without = without;
44772/**
44773 * drop-in replacement for _.isString
44774 * @param input
44775 */
44776function isString(input) {
44777 return typeof input === 'string';
44778}
44779exports.isString = isString;
44780/**
44781 * drop-in replacement for _.isString
44782 * @param input
44783 */
44784function isObject(input) {
44785 return typeof input === 'object';
44786}
44787exports.isObject = isObject;
44788/**
44789 * repalcement for _.xor
44790 * @param itemsA
44791 * @param itemsB
44792 */
44793function xor(itemsA, itemsB) {
44794 var map = new Map();
44795 var insertItem = function (item) {
44796 return map.set(item, map.has(item) ? map.get(item) + 1 : 1);
44797 };
44798 itemsA.forEach(insertItem);
44799 itemsB.forEach(insertItem);
44800 var result = [];
44801 map.forEach(function (count, key) {
44802 if (count === 1) {
44803 result.push(key);
44804 }
44805 });
44806 return result;
44807}
44808exports.xor = xor;
44809/**
44810 * replacement for _.intersection
44811 * @param itemsA
44812 * @param itemsB
44813 */
44814function intersection(itemsA, itemsB) {
44815 return itemsA.filter(function (t) { return itemsB.indexOf(t) > -1; });
44816}
44817exports.intersection = intersection;
44818});
44819
44820unwrapExports(js_utils);
44821var js_utils_1 = js_utils.get;
44822var js_utils_2 = js_utils.without;
44823var js_utils_3 = js_utils.isString;
44824var js_utils_4 = js_utils.isObject;
44825var js_utils_5 = js_utils.xor;
44826var js_utils_6 = js_utils.intersection;
44827
44828var beginDrag = createCommonjsModule(function (module, exports) {
44829var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
44830 return (mod && mod.__esModule) ? mod : { "default": mod };
44831};
44832Object.defineProperty(exports, "__esModule", { value: true });
44833var invariant_1$$1 = __importDefault(invariant_1);
44834
44835
44836
44837var ResetCoordinatesAction = {
44838 type: types.INIT_COORDS,
44839 payload: {
44840 clientOffset: null,
44841 sourceClientOffset: null,
44842 },
44843};
44844function createBeginDrag(manager) {
44845 return function beginDrag(sourceIds, options) {
44846 if (sourceIds === void 0) { sourceIds = []; }
44847 if (options === void 0) { options = {
44848 publishSource: true,
44849 }; }
44850 var _a = options.publishSource, publishSource = _a === void 0 ? true : _a, clientOffset = options.clientOffset, getSourceClientOffset = options.getSourceClientOffset;
44851 var monitor = manager.getMonitor();
44852 var registry = manager.getRegistry();
44853 // Initialize the coordinates using the client offset
44854 manager.dispatch(setClientOffset_1.setClientOffset(clientOffset));
44855 verifyInvariants(sourceIds, monitor, registry);
44856 // Get the draggable source
44857 var sourceId = getDraggableSource(sourceIds, monitor);
44858 if (sourceId === null) {
44859 manager.dispatch(ResetCoordinatesAction);
44860 return;
44861 }
44862 // Get the source client offset
44863 var sourceClientOffset = null;
44864 if (clientOffset) {
44865 verifyGetSourceClientOffsetIsFunction(getSourceClientOffset);
44866 sourceClientOffset = getSourceClientOffset(sourceId);
44867 }
44868 // Initialize the full coordinates
44869 manager.dispatch(setClientOffset_1.setClientOffset(clientOffset, sourceClientOffset));
44870 var source = registry.getSource(sourceId);
44871 var item = source.beginDrag(monitor, sourceId);
44872 verifyItemIsObject(item);
44873 registry.pinSource(sourceId);
44874 var itemType = registry.getSourceType(sourceId);
44875 return {
44876 type: types.BEGIN_DRAG,
44877 payload: {
44878 itemType: itemType,
44879 item: item,
44880 sourceId: sourceId,
44881 clientOffset: clientOffset || null,
44882 sourceClientOffset: sourceClientOffset || null,
44883 isSourcePublic: !!publishSource,
44884 },
44885 };
44886 };
44887}
44888exports.default = createBeginDrag;
44889function verifyInvariants(sourceIds, monitor, registry) {
44890 invariant_1$$1.default(!monitor.isDragging(), 'Cannot call beginDrag while dragging.');
44891 for (var _i = 0, sourceIds_1 = sourceIds; _i < sourceIds_1.length; _i++) {
44892 var s = sourceIds_1[_i];
44893 invariant_1$$1.default(registry.getSource(s), 'Expected sourceIds to be registered.');
44894 }
44895}
44896function verifyGetSourceClientOffsetIsFunction(getSourceClientOffset) {
44897 invariant_1$$1.default(typeof getSourceClientOffset === 'function', 'When clientOffset is provided, getSourceClientOffset must be a function.');
44898}
44899function verifyItemIsObject(item) {
44900 invariant_1$$1.default(js_utils.isObject(item), 'Item must be an object.');
44901}
44902function getDraggableSource(sourceIds, monitor) {
44903 var sourceId = null;
44904 for (var i = sourceIds.length - 1; i >= 0; i--) {
44905 if (monitor.canDragSource(sourceIds[i])) {
44906 sourceId = sourceIds[i];
44907 break;
44908 }
44909 }
44910 return sourceId;
44911}
44912});
44913
44914unwrapExports(beginDrag);
44915
44916var publishDragSource = createCommonjsModule(function (module, exports) {
44917Object.defineProperty(exports, "__esModule", { value: true });
44918
44919function createPublishDragSource(manager) {
44920 return function publishDragSource() {
44921 var monitor = manager.getMonitor();
44922 if (monitor.isDragging()) {
44923 return { type: types.PUBLISH_DRAG_SOURCE };
44924 }
44925 };
44926}
44927exports.default = createPublishDragSource;
44928});
44929
44930unwrapExports(publishDragSource);
44931
44932var matchesType_1 = createCommonjsModule(function (module, exports) {
44933Object.defineProperty(exports, "__esModule", { value: true });
44934function matchesType(targetType, draggedItemType) {
44935 if (draggedItemType === null) {
44936 return targetType === null;
44937 }
44938 return Array.isArray(targetType)
44939 ? targetType.some(function (t) { return t === draggedItemType; })
44940 : targetType === draggedItemType;
44941}
44942exports.default = matchesType;
44943});
44944
44945unwrapExports(matchesType_1);
44946
44947var hover = createCommonjsModule(function (module, exports) {
44948var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
44949 return (mod && mod.__esModule) ? mod : { "default": mod };
44950};
44951Object.defineProperty(exports, "__esModule", { value: true });
44952var invariant_1$$1 = __importDefault(invariant_1);
44953var matchesType_1$$1 = __importDefault(matchesType_1);
44954
44955function createHover(manager) {
44956 return function hover(targetIdsArg, _a) {
44957 var clientOffset = (_a === void 0 ? {} : _a).clientOffset;
44958 verifyTargetIdsIsArray(targetIdsArg);
44959 var targetIds = targetIdsArg.slice(0);
44960 var monitor = manager.getMonitor();
44961 var registry = manager.getRegistry();
44962 checkInvariants(targetIds, monitor, registry);
44963 var draggedItemType = monitor.getItemType();
44964 removeNonMatchingTargetIds(targetIds, registry, draggedItemType);
44965 hoverAllTargets(targetIds, monitor, registry);
44966 return {
44967 type: types.HOVER,
44968 payload: {
44969 targetIds: targetIds,
44970 clientOffset: clientOffset || null,
44971 },
44972 };
44973 };
44974}
44975exports.default = createHover;
44976function verifyTargetIdsIsArray(targetIdsArg) {
44977 invariant_1$$1.default(Array.isArray(targetIdsArg), 'Expected targetIds to be an array.');
44978}
44979function checkInvariants(targetIds, monitor, registry) {
44980 invariant_1$$1.default(monitor.isDragging(), 'Cannot call hover while not dragging.');
44981 invariant_1$$1.default(!monitor.didDrop(), 'Cannot call hover after drop.');
44982 for (var i = 0; i < targetIds.length; i++) {
44983 var targetId = targetIds[i];
44984 invariant_1$$1.default(targetIds.lastIndexOf(targetId) === i, 'Expected targetIds to be unique in the passed array.');
44985 var target = registry.getTarget(targetId);
44986 invariant_1$$1.default(target, 'Expected targetIds to be registered.');
44987 }
44988}
44989function removeNonMatchingTargetIds(targetIds, registry, draggedItemType) {
44990 // Remove those targetIds that don't match the targetType. This
44991 // fixes shallow isOver which would only be non-shallow because of
44992 // non-matching targets.
44993 for (var i = targetIds.length - 1; i >= 0; i--) {
44994 var targetId = targetIds[i];
44995 var targetType = registry.getTargetType(targetId);
44996 if (!matchesType_1$$1.default(targetType, draggedItemType)) {
44997 targetIds.splice(i, 1);
44998 }
44999 }
45000}
45001function hoverAllTargets(targetIds, monitor, registry) {
45002 // Finally call hover on all matching targets.
45003 for (var _i = 0, targetIds_1 = targetIds; _i < targetIds_1.length; _i++) {
45004 var targetId = targetIds_1[_i];
45005 var target = registry.getTarget(targetId);
45006 target.hover(monitor, targetId);
45007 }
45008}
45009});
45010
45011unwrapExports(hover);
45012
45013var drop = createCommonjsModule(function (module, exports) {
45014var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
45015 __assign = Object.assign || function(t) {
45016 for (var s, i = 1, n = arguments.length; i < n; i++) {
45017 s = arguments[i];
45018 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
45019 t[p] = s[p];
45020 }
45021 return t;
45022 };
45023 return __assign.apply(this, arguments);
45024};
45025var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
45026 return (mod && mod.__esModule) ? mod : { "default": mod };
45027};
45028Object.defineProperty(exports, "__esModule", { value: true });
45029var invariant_1$$1 = __importDefault(invariant_1);
45030
45031
45032function createDrop(manager) {
45033 return function drop(options) {
45034 if (options === void 0) { options = {}; }
45035 var monitor = manager.getMonitor();
45036 var registry = manager.getRegistry();
45037 verifyInvariants(monitor);
45038 var targetIds = getDroppableTargets(monitor);
45039 // Multiple actions are dispatched here, which is why this doesn't return an action
45040 targetIds.forEach(function (targetId, index) {
45041 var dropResult = determineDropResult(targetId, index, registry, monitor);
45042 var action = {
45043 type: types.DROP,
45044 payload: {
45045 dropResult: __assign({}, options, dropResult),
45046 },
45047 };
45048 manager.dispatch(action);
45049 });
45050 };
45051}
45052exports.default = createDrop;
45053function verifyInvariants(monitor) {
45054 invariant_1$$1.default(monitor.isDragging(), 'Cannot call drop while not dragging.');
45055 invariant_1$$1.default(!monitor.didDrop(), 'Cannot call drop twice during one drag operation.');
45056}
45057function determineDropResult(targetId, index, registry, monitor) {
45058 var target = registry.getTarget(targetId);
45059 var dropResult = target ? target.drop(monitor, targetId) : undefined;
45060 verifyDropResultType(dropResult);
45061 if (typeof dropResult === 'undefined') {
45062 dropResult = index === 0 ? {} : monitor.getDropResult();
45063 }
45064 return dropResult;
45065}
45066function verifyDropResultType(dropResult) {
45067 invariant_1$$1.default(typeof dropResult === 'undefined' || js_utils.isObject(dropResult), 'Drop result must either be an object or undefined.');
45068}
45069function getDroppableTargets(monitor) {
45070 var targetIds = monitor
45071 .getTargetIds()
45072 .filter(monitor.canDropOnTarget, monitor);
45073 targetIds.reverse();
45074 return targetIds;
45075}
45076});
45077
45078unwrapExports(drop);
45079
45080var endDrag = createCommonjsModule(function (module, exports) {
45081var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
45082 return (mod && mod.__esModule) ? mod : { "default": mod };
45083};
45084Object.defineProperty(exports, "__esModule", { value: true });
45085var invariant_1$$1 = __importDefault(invariant_1);
45086
45087function createEndDrag(manager) {
45088 return function endDrag() {
45089 var monitor = manager.getMonitor();
45090 var registry = manager.getRegistry();
45091 verifyIsDragging(monitor);
45092 var sourceId = monitor.getSourceId();
45093 var source = registry.getSource(sourceId, true);
45094 source.endDrag(monitor, sourceId);
45095 registry.unpinSource();
45096 return { type: types.END_DRAG };
45097 };
45098}
45099exports.default = createEndDrag;
45100function verifyIsDragging(monitor) {
45101 invariant_1$$1.default(monitor.isDragging(), 'Cannot call endDrag while not dragging.');
45102}
45103});
45104
45105unwrapExports(endDrag);
45106
45107var dragDrop = createCommonjsModule(function (module, exports) {
45108function __export(m) {
45109 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
45110}
45111var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
45112 return (mod && mod.__esModule) ? mod : { "default": mod };
45113};
45114Object.defineProperty(exports, "__esModule", { value: true });
45115var beginDrag_1 = __importDefault(beginDrag);
45116var publishDragSource_1 = __importDefault(publishDragSource);
45117var hover_1 = __importDefault(hover);
45118var drop_1 = __importDefault(drop);
45119var endDrag_1 = __importDefault(endDrag);
45120__export(types);
45121function createDragDropActions(manager) {
45122 return {
45123 beginDrag: beginDrag_1.default(manager),
45124 publishDragSource: publishDragSource_1.default(manager),
45125 hover: hover_1.default(manager),
45126 drop: drop_1.default(manager),
45127 endDrag: endDrag_1.default(manager),
45128 };
45129}
45130exports.default = createDragDropActions;
45131});
45132
45133unwrapExports(dragDrop);
45134
45135var equality = createCommonjsModule(function (module, exports) {
45136Object.defineProperty(exports, "__esModule", { value: true });
45137exports.strictEquality = function (a, b) { return a === b; };
45138/**
45139 * Determine if two cartesian coordinate offsets are equal
45140 * @param offsetA
45141 * @param offsetB
45142 */
45143function areCoordsEqual(offsetA, offsetB) {
45144 if (!offsetA && !offsetB) {
45145 return true;
45146 }
45147 else if (!offsetA || !offsetB) {
45148 return false;
45149 }
45150 else {
45151 return offsetA.x === offsetB.x && offsetA.y === offsetB.y;
45152 }
45153}
45154exports.areCoordsEqual = areCoordsEqual;
45155/**
45156 * Determines if two arrays of items are equal
45157 * @param a The first array of items
45158 * @param b The second array of items
45159 */
45160function areArraysEqual(a, b, isEqual) {
45161 if (isEqual === void 0) { isEqual = exports.strictEquality; }
45162 if (a.length !== b.length) {
45163 return false;
45164 }
45165 for (var i = 0; i < a.length; ++i) {
45166 if (!isEqual(a[i], b[i])) {
45167 return false;
45168 }
45169 }
45170 return true;
45171}
45172exports.areArraysEqual = areArraysEqual;
45173});
45174
45175unwrapExports(equality);
45176var equality_1 = equality.strictEquality;
45177var equality_2 = equality.areCoordsEqual;
45178var equality_3 = equality.areArraysEqual;
45179
45180var dragOffset_1 = createCommonjsModule(function (module, exports) {
45181var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
45182 __assign = Object.assign || function(t) {
45183 for (var s, i = 1, n = arguments.length; i < n; i++) {
45184 s = arguments[i];
45185 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
45186 t[p] = s[p];
45187 }
45188 return t;
45189 };
45190 return __assign.apply(this, arguments);
45191};
45192Object.defineProperty(exports, "__esModule", { value: true });
45193
45194
45195var initialState = {
45196 initialSourceClientOffset: null,
45197 initialClientOffset: null,
45198 clientOffset: null,
45199};
45200function dragOffset(state, action) {
45201 if (state === void 0) { state = initialState; }
45202 var payload = action.payload;
45203 switch (action.type) {
45204 case dragDrop.INIT_COORDS:
45205 case dragDrop.BEGIN_DRAG:
45206 return {
45207 initialSourceClientOffset: payload.sourceClientOffset,
45208 initialClientOffset: payload.clientOffset,
45209 clientOffset: payload.clientOffset,
45210 };
45211 case dragDrop.HOVER:
45212 if (equality.areCoordsEqual(state.clientOffset, payload.clientOffset)) {
45213 return state;
45214 }
45215 return __assign({}, state, { clientOffset: payload.clientOffset });
45216 case dragDrop.END_DRAG:
45217 case dragDrop.DROP:
45218 return initialState;
45219 default:
45220 return state;
45221 }
45222}
45223exports.default = dragOffset;
45224});
45225
45226unwrapExports(dragOffset_1);
45227
45228var registry = createCommonjsModule(function (module, exports) {
45229Object.defineProperty(exports, "__esModule", { value: true });
45230exports.ADD_SOURCE = 'dnd-core/ADD_SOURCE';
45231exports.ADD_TARGET = 'dnd-core/ADD_TARGET';
45232exports.REMOVE_SOURCE = 'dnd-core/REMOVE_SOURCE';
45233exports.REMOVE_TARGET = 'dnd-core/REMOVE_TARGET';
45234function addSource(sourceId) {
45235 return {
45236 type: exports.ADD_SOURCE,
45237 payload: {
45238 sourceId: sourceId,
45239 },
45240 };
45241}
45242exports.addSource = addSource;
45243function addTarget(targetId) {
45244 return {
45245 type: exports.ADD_TARGET,
45246 payload: {
45247 targetId: targetId,
45248 },
45249 };
45250}
45251exports.addTarget = addTarget;
45252function removeSource(sourceId) {
45253 return {
45254 type: exports.REMOVE_SOURCE,
45255 payload: {
45256 sourceId: sourceId,
45257 },
45258 };
45259}
45260exports.removeSource = removeSource;
45261function removeTarget(targetId) {
45262 return {
45263 type: exports.REMOVE_TARGET,
45264 payload: {
45265 targetId: targetId,
45266 },
45267 };
45268}
45269exports.removeTarget = removeTarget;
45270});
45271
45272unwrapExports(registry);
45273var registry_1 = registry.ADD_SOURCE;
45274var registry_2 = registry.ADD_TARGET;
45275var registry_3 = registry.REMOVE_SOURCE;
45276var registry_4 = registry.REMOVE_TARGET;
45277var registry_5 = registry.addSource;
45278var registry_6 = registry.addTarget;
45279var registry_7 = registry.removeSource;
45280var registry_8 = registry.removeTarget;
45281
45282var dragOperation_1 = createCommonjsModule(function (module, exports) {
45283var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
45284 __assign = Object.assign || function(t) {
45285 for (var s, i = 1, n = arguments.length; i < n; i++) {
45286 s = arguments[i];
45287 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
45288 t[p] = s[p];
45289 }
45290 return t;
45291 };
45292 return __assign.apply(this, arguments);
45293};
45294Object.defineProperty(exports, "__esModule", { value: true });
45295
45296
45297
45298var initialState = {
45299 itemType: null,
45300 item: null,
45301 sourceId: null,
45302 targetIds: [],
45303 dropResult: null,
45304 didDrop: false,
45305 isSourcePublic: null,
45306};
45307function dragOperation(state, action) {
45308 if (state === void 0) { state = initialState; }
45309 var payload = action.payload;
45310 switch (action.type) {
45311 case dragDrop.BEGIN_DRAG:
45312 return __assign({}, state, { itemType: payload.itemType, item: payload.item, sourceId: payload.sourceId, isSourcePublic: payload.isSourcePublic, dropResult: null, didDrop: false });
45313 case dragDrop.PUBLISH_DRAG_SOURCE:
45314 return __assign({}, state, { isSourcePublic: true });
45315 case dragDrop.HOVER:
45316 return __assign({}, state, { targetIds: payload.targetIds });
45317 case registry.REMOVE_TARGET:
45318 if (state.targetIds.indexOf(payload.targetId) === -1) {
45319 return state;
45320 }
45321 return __assign({}, state, { targetIds: js_utils.without(state.targetIds, payload.targetId) });
45322 case dragDrop.DROP:
45323 return __assign({}, state, { dropResult: payload.dropResult, didDrop: true, targetIds: [] });
45324 case dragDrop.END_DRAG:
45325 return __assign({}, state, { itemType: null, item: null, sourceId: null, dropResult: null, didDrop: false, isSourcePublic: null, targetIds: [] });
45326 default:
45327 return state;
45328 }
45329}
45330exports.default = dragOperation;
45331});
45332
45333unwrapExports(dragOperation_1);
45334
45335var refCount_1 = createCommonjsModule(function (module, exports) {
45336Object.defineProperty(exports, "__esModule", { value: true });
45337
45338function refCount(state, action) {
45339 if (state === void 0) { state = 0; }
45340 switch (action.type) {
45341 case registry.ADD_SOURCE:
45342 case registry.ADD_TARGET:
45343 return state + 1;
45344 case registry.REMOVE_SOURCE:
45345 case registry.REMOVE_TARGET:
45346 return state - 1;
45347 default:
45348 return state;
45349 }
45350}
45351exports.default = refCount;
45352});
45353
45354unwrapExports(refCount_1);
45355
45356var dirtiness = createCommonjsModule(function (module, exports) {
45357Object.defineProperty(exports, "__esModule", { value: true });
45358
45359exports.NONE = [];
45360exports.ALL = [];
45361exports.NONE.__IS_NONE__ = true;
45362exports.ALL.__IS_ALL__ = true;
45363/**
45364 * Determines if the given handler IDs are dirty or not.
45365 *
45366 * @param dirtyIds The set of dirty handler ids
45367 * @param handlerIds The set of handler ids to check
45368 */
45369function areDirty(dirtyIds, handlerIds) {
45370 if (dirtyIds === exports.NONE) {
45371 return false;
45372 }
45373 if (dirtyIds === exports.ALL || typeof handlerIds === 'undefined') {
45374 return true;
45375 }
45376 var commonIds = js_utils.intersection(handlerIds, dirtyIds);
45377 return commonIds.length > 0;
45378}
45379exports.areDirty = areDirty;
45380});
45381
45382unwrapExports(dirtiness);
45383var dirtiness_1 = dirtiness.NONE;
45384var dirtiness_2 = dirtiness.ALL;
45385var dirtiness_3 = dirtiness.areDirty;
45386
45387var dirtyHandlerIds_1 = createCommonjsModule(function (module, exports) {
45388Object.defineProperty(exports, "__esModule", { value: true });
45389
45390
45391
45392
45393
45394function dirtyHandlerIds(state, action) {
45395 if (state === void 0) { state = dirtiness.NONE; }
45396 switch (action.type) {
45397 case dragDrop.HOVER:
45398 break;
45399 case registry.ADD_SOURCE:
45400 case registry.ADD_TARGET:
45401 case registry.REMOVE_TARGET:
45402 case registry.REMOVE_SOURCE:
45403 return dirtiness.NONE;
45404 case dragDrop.BEGIN_DRAG:
45405 case dragDrop.PUBLISH_DRAG_SOURCE:
45406 case dragDrop.END_DRAG:
45407 case dragDrop.DROP:
45408 default:
45409 return dirtiness.ALL;
45410 }
45411 var _a = action.payload, _b = _a.targetIds, targetIds = _b === void 0 ? [] : _b, _c = _a.prevTargetIds, prevTargetIds = _c === void 0 ? [] : _c;
45412 var result = js_utils.xor(targetIds, prevTargetIds);
45413 var didChange = result.length > 0 || !equality.areArraysEqual(targetIds, prevTargetIds);
45414 if (!didChange) {
45415 return dirtiness.NONE;
45416 }
45417 // Check the target ids at the innermost position. If they are valid, add them
45418 // to the result
45419 var prevInnermostTargetId = prevTargetIds[prevTargetIds.length - 1];
45420 var innermostTargetId = targetIds[targetIds.length - 1];
45421 if (prevInnermostTargetId !== innermostTargetId) {
45422 if (prevInnermostTargetId) {
45423 result.push(prevInnermostTargetId);
45424 }
45425 if (innermostTargetId) {
45426 result.push(innermostTargetId);
45427 }
45428 }
45429 return result;
45430}
45431exports.default = dirtyHandlerIds;
45432});
45433
45434unwrapExports(dirtyHandlerIds_1);
45435
45436var stateId_1 = createCommonjsModule(function (module, exports) {
45437Object.defineProperty(exports, "__esModule", { value: true });
45438function stateId(state) {
45439 if (state === void 0) { state = 0; }
45440 return state + 1;
45441}
45442exports.default = stateId;
45443});
45444
45445unwrapExports(stateId_1);
45446
45447var reducers = createCommonjsModule(function (module, exports) {
45448var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
45449 __assign = Object.assign || function(t) {
45450 for (var s, i = 1, n = arguments.length; i < n; i++) {
45451 s = arguments[i];
45452 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
45453 t[p] = s[p];
45454 }
45455 return t;
45456 };
45457 return __assign.apply(this, arguments);
45458};
45459var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
45460 return (mod && mod.__esModule) ? mod : { "default": mod };
45461};
45462Object.defineProperty(exports, "__esModule", { value: true });
45463var dragOffset_1$$1 = __importDefault(dragOffset_1);
45464var dragOperation_1$$1 = __importDefault(dragOperation_1);
45465var refCount_1$$1 = __importDefault(refCount_1);
45466var dirtyHandlerIds_1$$1 = __importDefault(dirtyHandlerIds_1);
45467var stateId_1$$1 = __importDefault(stateId_1);
45468
45469function reduce(state, action) {
45470 if (state === void 0) { state = {}; }
45471 return {
45472 dirtyHandlerIds: dirtyHandlerIds_1$$1.default(state.dirtyHandlerIds, {
45473 type: action.type,
45474 payload: __assign({}, action.payload, { prevTargetIds: js_utils.get(state, 'dragOperation.targetIds', []) }),
45475 }),
45476 dragOffset: dragOffset_1$$1.default(state.dragOffset, action),
45477 refCount: refCount_1$$1.default(state.refCount, action),
45478 dragOperation: dragOperation_1$$1.default(state.dragOperation, action),
45479 stateId: stateId_1$$1.default(state.stateId),
45480 };
45481}
45482exports.default = reduce;
45483});
45484
45485unwrapExports(reducers);
45486
45487var coords = createCommonjsModule(function (module, exports) {
45488Object.defineProperty(exports, "__esModule", { value: true });
45489/**
45490 * Coordinate addition
45491 * @param a The first coordinate
45492 * @param b The second coordinate
45493 */
45494function add(a, b) {
45495 return {
45496 x: a.x + b.x,
45497 y: a.y + b.y,
45498 };
45499}
45500exports.add = add;
45501/**
45502 * Coordinate subtraction
45503 * @param a The first coordinate
45504 * @param b The second coordinate
45505 */
45506function subtract(a, b) {
45507 return {
45508 x: a.x - b.x,
45509 y: a.y - b.y,
45510 };
45511}
45512exports.subtract = subtract;
45513/**
45514 * Returns the cartesian distance of the drag source component's position, based on its position
45515 * at the time when the current drag operation has started, and the movement difference.
45516 *
45517 * Returns null if no item is being dragged.
45518 *
45519 * @param state The offset state to compute from
45520 */
45521function getSourceClientOffset(state) {
45522 var clientOffset = state.clientOffset, initialClientOffset = state.initialClientOffset, initialSourceClientOffset = state.initialSourceClientOffset;
45523 if (!clientOffset || !initialClientOffset || !initialSourceClientOffset) {
45524 return null;
45525 }
45526 return subtract(add(clientOffset, initialSourceClientOffset), initialClientOffset);
45527}
45528exports.getSourceClientOffset = getSourceClientOffset;
45529/**
45530 * Determines the x,y offset between the client offset and the initial client offset
45531 *
45532 * @param state The offset state to compute from
45533 */
45534function getDifferenceFromInitialOffset(state) {
45535 var clientOffset = state.clientOffset, initialClientOffset = state.initialClientOffset;
45536 if (!clientOffset || !initialClientOffset) {
45537 return null;
45538 }
45539 return subtract(clientOffset, initialClientOffset);
45540}
45541exports.getDifferenceFromInitialOffset = getDifferenceFromInitialOffset;
45542});
45543
45544unwrapExports(coords);
45545var coords_1 = coords.add;
45546var coords_2 = coords.subtract;
45547var coords_3 = coords.getSourceClientOffset;
45548var coords_4 = coords.getDifferenceFromInitialOffset;
45549
45550var DragDropMonitorImpl_1 = createCommonjsModule(function (module, exports) {
45551var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
45552 return (mod && mod.__esModule) ? mod : { "default": mod };
45553};
45554Object.defineProperty(exports, "__esModule", { value: true });
45555var invariant_1$$1 = __importDefault(invariant_1);
45556var matchesType_1$$1 = __importDefault(matchesType_1);
45557
45558
45559var DragDropMonitorImpl = /** @class */ (function () {
45560 function DragDropMonitorImpl(store, registry) {
45561 this.store = store;
45562 this.registry = registry;
45563 }
45564 DragDropMonitorImpl.prototype.subscribeToStateChange = function (listener, options) {
45565 var _this = this;
45566 if (options === void 0) { options = { handlerIds: undefined }; }
45567 var handlerIds = options.handlerIds;
45568 invariant_1$$1.default(typeof listener === 'function', 'listener must be a function.');
45569 invariant_1$$1.default(typeof handlerIds === 'undefined' || Array.isArray(handlerIds), 'handlerIds, when specified, must be an array of strings.');
45570 var prevStateId = this.store.getState().stateId;
45571 var handleChange = function () {
45572 var state = _this.store.getState();
45573 var currentStateId = state.stateId;
45574 try {
45575 var canSkipListener = currentStateId === prevStateId ||
45576 (currentStateId === prevStateId + 1 &&
45577 !dirtiness.areDirty(state.dirtyHandlerIds, handlerIds));
45578 if (!canSkipListener) {
45579 listener();
45580 }
45581 }
45582 finally {
45583 prevStateId = currentStateId;
45584 }
45585 };
45586 return this.store.subscribe(handleChange);
45587 };
45588 DragDropMonitorImpl.prototype.subscribeToOffsetChange = function (listener) {
45589 var _this = this;
45590 invariant_1$$1.default(typeof listener === 'function', 'listener must be a function.');
45591 var previousState = this.store.getState().dragOffset;
45592 var handleChange = function () {
45593 var nextState = _this.store.getState().dragOffset;
45594 if (nextState === previousState) {
45595 return;
45596 }
45597 previousState = nextState;
45598 listener();
45599 };
45600 return this.store.subscribe(handleChange);
45601 };
45602 DragDropMonitorImpl.prototype.canDragSource = function (sourceId) {
45603 if (!sourceId) {
45604 return false;
45605 }
45606 var source = this.registry.getSource(sourceId);
45607 invariant_1$$1.default(source, 'Expected to find a valid source.');
45608 if (this.isDragging()) {
45609 return false;
45610 }
45611 return source.canDrag(this, sourceId);
45612 };
45613 DragDropMonitorImpl.prototype.canDropOnTarget = function (targetId) {
45614 // undefined on initial render
45615 if (!targetId) {
45616 return false;
45617 }
45618 var target = this.registry.getTarget(targetId);
45619 invariant_1$$1.default(target, 'Expected to find a valid target.');
45620 if (!this.isDragging() || this.didDrop()) {
45621 return false;
45622 }
45623 var targetType = this.registry.getTargetType(targetId);
45624 var draggedItemType = this.getItemType();
45625 return (matchesType_1$$1.default(targetType, draggedItemType) && target.canDrop(this, targetId));
45626 };
45627 DragDropMonitorImpl.prototype.isDragging = function () {
45628 return Boolean(this.getItemType());
45629 };
45630 DragDropMonitorImpl.prototype.isDraggingSource = function (sourceId) {
45631 // undefined on initial render
45632 if (!sourceId) {
45633 return false;
45634 }
45635 var source = this.registry.getSource(sourceId, true);
45636 invariant_1$$1.default(source, 'Expected to find a valid source.');
45637 if (!this.isDragging() || !this.isSourcePublic()) {
45638 return false;
45639 }
45640 var sourceType = this.registry.getSourceType(sourceId);
45641 var draggedItemType = this.getItemType();
45642 if (sourceType !== draggedItemType) {
45643 return false;
45644 }
45645 return source.isDragging(this, sourceId);
45646 };
45647 DragDropMonitorImpl.prototype.isOverTarget = function (targetId, options) {
45648 if (options === void 0) { options = { shallow: false }; }
45649 // undefined on initial render
45650 if (!targetId) {
45651 return false;
45652 }
45653 var shallow = options.shallow;
45654 if (!this.isDragging()) {
45655 return false;
45656 }
45657 var targetType = this.registry.getTargetType(targetId);
45658 var draggedItemType = this.getItemType();
45659 if (draggedItemType && !matchesType_1$$1.default(targetType, draggedItemType)) {
45660 return false;
45661 }
45662 var targetIds = this.getTargetIds();
45663 if (!targetIds.length) {
45664 return false;
45665 }
45666 var index = targetIds.indexOf(targetId);
45667 if (shallow) {
45668 return index === targetIds.length - 1;
45669 }
45670 else {
45671 return index > -1;
45672 }
45673 };
45674 DragDropMonitorImpl.prototype.getItemType = function () {
45675 return this.store.getState().dragOperation.itemType;
45676 };
45677 DragDropMonitorImpl.prototype.getItem = function () {
45678 return this.store.getState().dragOperation.item;
45679 };
45680 DragDropMonitorImpl.prototype.getSourceId = function () {
45681 return this.store.getState().dragOperation.sourceId;
45682 };
45683 DragDropMonitorImpl.prototype.getTargetIds = function () {
45684 return this.store.getState().dragOperation.targetIds;
45685 };
45686 DragDropMonitorImpl.prototype.getDropResult = function () {
45687 return this.store.getState().dragOperation.dropResult;
45688 };
45689 DragDropMonitorImpl.prototype.didDrop = function () {
45690 return this.store.getState().dragOperation.didDrop;
45691 };
45692 DragDropMonitorImpl.prototype.isSourcePublic = function () {
45693 return this.store.getState().dragOperation.isSourcePublic;
45694 };
45695 DragDropMonitorImpl.prototype.getInitialClientOffset = function () {
45696 return this.store.getState().dragOffset.initialClientOffset;
45697 };
45698 DragDropMonitorImpl.prototype.getInitialSourceClientOffset = function () {
45699 return this.store.getState().dragOffset.initialSourceClientOffset;
45700 };
45701 DragDropMonitorImpl.prototype.getClientOffset = function () {
45702 return this.store.getState().dragOffset.clientOffset;
45703 };
45704 DragDropMonitorImpl.prototype.getSourceClientOffset = function () {
45705 return coords.getSourceClientOffset(this.store.getState().dragOffset);
45706 };
45707 DragDropMonitorImpl.prototype.getDifferenceFromInitialOffset = function () {
45708 return coords.getDifferenceFromInitialOffset(this.store.getState().dragOffset);
45709 };
45710 return DragDropMonitorImpl;
45711}());
45712exports.default = DragDropMonitorImpl;
45713});
45714
45715unwrapExports(DragDropMonitorImpl_1);
45716
45717var domain$1; // The domain module is executed on demand
45718var hasSetImmediate = typeof setImmediate === "function";
45719
45720// Use the fastest means possible to execute a task in its own turn, with
45721// priority over other events including network IO events in Node.js.
45722//
45723// An exception thrown by a task will permanently interrupt the processing of
45724// subsequent tasks. The higher level `asap` function ensures that if an
45725// exception is thrown by a task, that the task queue will continue flushing as
45726// soon as possible, but if you use `rawAsap` directly, you are responsible to
45727// either ensure that no exceptions are thrown from your task, or to manually
45728// call `rawAsap.requestFlush` if an exception is thrown.
45729var raw = rawAsap;
45730function rawAsap(task) {
45731 if (!queue$1.length) {
45732 requestFlush();
45733 flushing = true;
45734 }
45735 // Avoids a function call
45736 queue$1[queue$1.length] = task;
45737}
45738
45739var queue$1 = [];
45740// Once a flush has been requested, no further calls to `requestFlush` are
45741// necessary until the next `flush` completes.
45742var flushing = false;
45743// The position of the next task to execute in the task queue. This is
45744// preserved between calls to `flush` so that it can be resumed if
45745// a task throws an exception.
45746var index$8 = 0;
45747// If a task schedules additional tasks recursively, the task queue can grow
45748// unbounded. To prevent memory excaustion, the task queue will periodically
45749// truncate already-completed tasks.
45750var capacity = 1024;
45751
45752// The flush function processes all tasks that have been scheduled with
45753// `rawAsap` unless and until one of those tasks throws an exception.
45754// If a task throws an exception, `flush` ensures that its state will remain
45755// consistent and will resume where it left off when called again.
45756// However, `flush` does not make any arrangements to be called again if an
45757// exception is thrown.
45758function flush$1() {
45759 while (index$8 < queue$1.length) {
45760 var currentIndex = index$8;
45761 // Advance the index before calling the task. This ensures that we will
45762 // begin flushing on the next task the task throws an error.
45763 index$8 = index$8 + 1;
45764 queue$1[currentIndex].call();
45765 // Prevent leaking memory for long chains of recursive calls to `asap`.
45766 // If we call `asap` within tasks scheduled by `asap`, the queue will
45767 // grow, but to avoid an O(n) walk for every task we execute, we don't
45768 // shift tasks off the queue after they have been executed.
45769 // Instead, we periodically shift 1024 tasks off the queue.
45770 if (index$8 > capacity) {
45771 // Manually shift all values starting at the index back to the
45772 // beginning of the queue.
45773 for (var scan = 0, newLength = queue$1.length - index$8; scan < newLength; scan++) {
45774 queue$1[scan] = queue$1[scan + index$8];
45775 }
45776 queue$1.length -= index$8;
45777 index$8 = 0;
45778 }
45779 }
45780 queue$1.length = 0;
45781 index$8 = 0;
45782 flushing = false;
45783}
45784
45785rawAsap.requestFlush = requestFlush;
45786function requestFlush() {
45787 // Ensure flushing is not bound to any domain.
45788 // It is not sufficient to exit the domain, because domains exist on a stack.
45789 // To execute code outside of any domain, the following dance is necessary.
45790 var parentDomain = process.domain;
45791 if (parentDomain) {
45792 if (!domain$1) {
45793 // Lazy execute the domain module.
45794 // Only employed if the user elects to use domains.
45795 domain$1 = domain;
45796 }
45797 domain$1.active = process.domain = null;
45798 }
45799
45800 // `setImmediate` is slower that `process.nextTick`, but `process.nextTick`
45801 // cannot handle recursion.
45802 // `requestFlush` will only be called recursively from `asap.js`, to resume
45803 // flushing after an error is thrown into a domain.
45804 // Conveniently, `setImmediate` was introduced in the same version
45805 // `process.nextTick` started throwing recursion errors.
45806 if (flushing && hasSetImmediate) {
45807 setImmediate(flush$1);
45808 } else {
45809 process.nextTick(flush$1);
45810 }
45811
45812 if (parentDomain) {
45813 domain$1.active = process.domain = parentDomain;
45814 }
45815}
45816
45817var freeTasks = [];
45818
45819/**
45820 * Calls a task as soon as possible after returning, in its own event, with
45821 * priority over IO events. An exception thrown in a task can be handled by
45822 * `process.on("uncaughtException") or `domain.on("error")`, but will otherwise
45823 * crash the process. If the error is handled, all subsequent tasks will
45824 * resume.
45825 *
45826 * @param {{call}} task A callable object, typically a function that takes no
45827 * arguments.
45828 */
45829var asap_1 = asap;
45830function asap(task) {
45831 var rawTask;
45832 if (freeTasks.length) {
45833 rawTask = freeTasks.pop();
45834 } else {
45835 rawTask = new RawTask();
45836 }
45837 rawTask.task = task;
45838 rawTask.domain = process.domain;
45839 raw(rawTask);
45840}
45841
45842function RawTask() {
45843 this.task = null;
45844 this.domain = null;
45845}
45846
45847RawTask.prototype.call = function () {
45848 if (this.domain) {
45849 this.domain.enter();
45850 }
45851 var threw = true;
45852 try {
45853 this.task.call();
45854 threw = false;
45855 // If the task throws an exception (presumably) Node.js restores the
45856 // domain stack for the next event.
45857 if (this.domain) {
45858 this.domain.exit();
45859 }
45860 } finally {
45861 // We use try/finally and a threw flag to avoid messing up stack traces
45862 // when we catch and release errors.
45863 if (threw) {
45864 // In Node.js, uncaught exceptions are considered fatal errors.
45865 // Re-throw them to interrupt flushing!
45866 // Ensure that flushing continues if an uncaught exception is
45867 // suppressed listening process.on("uncaughtException") or
45868 // domain.on("error").
45869 raw.requestFlush();
45870 }
45871 // If the task threw an error, we do not want to exit the domain here.
45872 // Exiting the domain would prevent the domain from catching the error.
45873 this.task = null;
45874 this.domain = null;
45875 freeTasks.push(this);
45876 }
45877};
45878
45879var getNextUniqueId_1 = createCommonjsModule(function (module, exports) {
45880Object.defineProperty(exports, "__esModule", { value: true });
45881var nextUniqueId = 0;
45882function getNextUniqueId() {
45883 return nextUniqueId++;
45884}
45885exports.default = getNextUniqueId;
45886});
45887
45888unwrapExports(getNextUniqueId_1);
45889
45890var contracts = createCommonjsModule(function (module, exports) {
45891var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
45892 return (mod && mod.__esModule) ? mod : { "default": mod };
45893};
45894Object.defineProperty(exports, "__esModule", { value: true });
45895var invariant_1$$1 = __importDefault(invariant_1);
45896function validateSourceContract(source) {
45897 invariant_1$$1.default(typeof source.canDrag === 'function', 'Expected canDrag to be a function.');
45898 invariant_1$$1.default(typeof source.beginDrag === 'function', 'Expected beginDrag to be a function.');
45899 invariant_1$$1.default(typeof source.endDrag === 'function', 'Expected endDrag to be a function.');
45900}
45901exports.validateSourceContract = validateSourceContract;
45902function validateTargetContract(target) {
45903 invariant_1$$1.default(typeof target.canDrop === 'function', 'Expected canDrop to be a function.');
45904 invariant_1$$1.default(typeof target.hover === 'function', 'Expected hover to be a function.');
45905 invariant_1$$1.default(typeof target.drop === 'function', 'Expected beginDrag to be a function.');
45906}
45907exports.validateTargetContract = validateTargetContract;
45908function validateType(type, allowArray) {
45909 if (allowArray && Array.isArray(type)) {
45910 type.forEach(function (t) { return validateType(t, false); });
45911 return;
45912 }
45913 invariant_1$$1.default(typeof type === 'string' || typeof type === 'symbol', allowArray
45914 ? 'Type can only be a string, a symbol, or an array of either.'
45915 : 'Type can only be a string or a symbol.');
45916}
45917exports.validateType = validateType;
45918});
45919
45920unwrapExports(contracts);
45921var contracts_1 = contracts.validateSourceContract;
45922var contracts_2 = contracts.validateTargetContract;
45923var contracts_3 = contracts.validateType;
45924
45925var HandlerRegistryImpl_1 = createCommonjsModule(function (module, exports) {
45926var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
45927 return (mod && mod.__esModule) ? mod : { "default": mod };
45928};
45929Object.defineProperty(exports, "__esModule", { value: true });
45930var asap_1$$1 = __importDefault(asap_1);
45931var invariant_1$$1 = __importDefault(invariant_1);
45932
45933var getNextUniqueId_1$$1 = __importDefault(getNextUniqueId_1);
45934
45935
45936function getNextHandlerId(role) {
45937 var id = getNextUniqueId_1$$1.default().toString();
45938 switch (role) {
45939 case interfaces.HandlerRole.SOURCE:
45940 return "S" + id;
45941 case interfaces.HandlerRole.TARGET:
45942 return "T" + id;
45943 default:
45944 throw new Error("Unknown Handler Role: " + role);
45945 }
45946}
45947function parseRoleFromHandlerId(handlerId) {
45948 switch (handlerId[0]) {
45949 case 'S':
45950 return interfaces.HandlerRole.SOURCE;
45951 case 'T':
45952 return interfaces.HandlerRole.TARGET;
45953 default:
45954 invariant_1$$1.default(false, "Cannot parse handler ID: " + handlerId);
45955 }
45956}
45957function mapContainsValue(map, searchValue) {
45958 var entries = map.entries();
45959 var isDone = false;
45960 do {
45961 var _a = entries.next(), done = _a.done, _b = _a.value, value = _b[1];
45962 if (value === searchValue) {
45963 return true;
45964 }
45965 isDone = done;
45966 } while (!isDone);
45967 return false;
45968}
45969var HandlerRegistryImpl = /** @class */ (function () {
45970 function HandlerRegistryImpl(store) {
45971 this.store = store;
45972 this.types = new Map();
45973 this.dragSources = new Map();
45974 this.dropTargets = new Map();
45975 this.pinnedSourceId = null;
45976 this.pinnedSource = null;
45977 }
45978 HandlerRegistryImpl.prototype.addSource = function (type, source) {
45979 contracts.validateType(type);
45980 contracts.validateSourceContract(source);
45981 var sourceId = this.addHandler(interfaces.HandlerRole.SOURCE, type, source);
45982 this.store.dispatch(registry.addSource(sourceId));
45983 return sourceId;
45984 };
45985 HandlerRegistryImpl.prototype.addTarget = function (type, target) {
45986 contracts.validateType(type, true);
45987 contracts.validateTargetContract(target);
45988 var targetId = this.addHandler(interfaces.HandlerRole.TARGET, type, target);
45989 this.store.dispatch(registry.addTarget(targetId));
45990 return targetId;
45991 };
45992 HandlerRegistryImpl.prototype.containsHandler = function (handler) {
45993 return (mapContainsValue(this.dragSources, handler) ||
45994 mapContainsValue(this.dropTargets, handler));
45995 };
45996 HandlerRegistryImpl.prototype.getSource = function (sourceId, includePinned) {
45997 if (includePinned === void 0) { includePinned = false; }
45998 invariant_1$$1.default(this.isSourceId(sourceId), 'Expected a valid source ID.');
45999 var isPinned = includePinned && sourceId === this.pinnedSourceId;
46000 var source = isPinned ? this.pinnedSource : this.dragSources.get(sourceId);
46001 return source;
46002 };
46003 HandlerRegistryImpl.prototype.getTarget = function (targetId) {
46004 invariant_1$$1.default(this.isTargetId(targetId), 'Expected a valid target ID.');
46005 return this.dropTargets.get(targetId);
46006 };
46007 HandlerRegistryImpl.prototype.getSourceType = function (sourceId) {
46008 invariant_1$$1.default(this.isSourceId(sourceId), 'Expected a valid source ID.');
46009 return this.types.get(sourceId);
46010 };
46011 HandlerRegistryImpl.prototype.getTargetType = function (targetId) {
46012 invariant_1$$1.default(this.isTargetId(targetId), 'Expected a valid target ID.');
46013 return this.types.get(targetId);
46014 };
46015 HandlerRegistryImpl.prototype.isSourceId = function (handlerId) {
46016 var role = parseRoleFromHandlerId(handlerId);
46017 return role === interfaces.HandlerRole.SOURCE;
46018 };
46019 HandlerRegistryImpl.prototype.isTargetId = function (handlerId) {
46020 var role = parseRoleFromHandlerId(handlerId);
46021 return role === interfaces.HandlerRole.TARGET;
46022 };
46023 HandlerRegistryImpl.prototype.removeSource = function (sourceId) {
46024 var _this = this;
46025 invariant_1$$1.default(this.getSource(sourceId), 'Expected an existing source.');
46026 this.store.dispatch(registry.removeSource(sourceId));
46027 asap_1$$1.default(function () {
46028 _this.dragSources.delete(sourceId);
46029 _this.types.delete(sourceId);
46030 });
46031 };
46032 HandlerRegistryImpl.prototype.removeTarget = function (targetId) {
46033 invariant_1$$1.default(this.getTarget(targetId), 'Expected an existing target.');
46034 this.store.dispatch(registry.removeTarget(targetId));
46035 this.dropTargets.delete(targetId);
46036 this.types.delete(targetId);
46037 };
46038 HandlerRegistryImpl.prototype.pinSource = function (sourceId) {
46039 var source = this.getSource(sourceId);
46040 invariant_1$$1.default(source, 'Expected an existing source.');
46041 this.pinnedSourceId = sourceId;
46042 this.pinnedSource = source;
46043 };
46044 HandlerRegistryImpl.prototype.unpinSource = function () {
46045 invariant_1$$1.default(this.pinnedSource, 'No source is pinned at the time.');
46046 this.pinnedSourceId = null;
46047 this.pinnedSource = null;
46048 };
46049 HandlerRegistryImpl.prototype.addHandler = function (role, type, handler) {
46050 var id = getNextHandlerId(role);
46051 this.types.set(id, type);
46052 if (role === interfaces.HandlerRole.SOURCE) {
46053 this.dragSources.set(id, handler);
46054 }
46055 else if (role === interfaces.HandlerRole.TARGET) {
46056 this.dropTargets.set(id, handler);
46057 }
46058 return id;
46059 };
46060 return HandlerRegistryImpl;
46061}());
46062exports.default = HandlerRegistryImpl;
46063});
46064
46065unwrapExports(HandlerRegistryImpl_1);
46066
46067var DragDropManagerImpl_1 = createCommonjsModule(function (module, exports) {
46068var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
46069 return (mod && mod.__esModule) ? mod : { "default": mod };
46070};
46071Object.defineProperty(exports, "__esModule", { value: true });
46072
46073var reducers_1 = __importDefault(reducers);
46074var dragDrop_1 = __importDefault(dragDrop);
46075var DragDropMonitorImpl_1$$1 = __importDefault(DragDropMonitorImpl_1);
46076var HandlerRegistryImpl_1$$1 = __importDefault(HandlerRegistryImpl_1);
46077function makeStoreInstance(debugMode) {
46078 // TODO: if we ever make a react-native version of this,
46079 // we'll need to consider how to pull off dev-tooling
46080 var reduxDevTools = typeof window !== 'undefined' &&
46081 window.__REDUX_DEVTOOLS_EXTENSION__;
46082 return redux.createStore(reducers_1.default, debugMode &&
46083 reduxDevTools &&
46084 reduxDevTools({
46085 name: 'dnd-core',
46086 instanceId: 'dnd-core',
46087 }));
46088}
46089var DragDropManagerImpl = /** @class */ (function () {
46090 function DragDropManagerImpl(debugMode) {
46091 var _this = this;
46092 if (debugMode === void 0) { debugMode = false; }
46093 this.isSetUp = false;
46094 this.handleRefCountChange = function () {
46095 var shouldSetUp = _this.store.getState().refCount > 0;
46096 if (_this.backend) {
46097 if (shouldSetUp && !_this.isSetUp) {
46098 _this.backend.setup();
46099 _this.isSetUp = true;
46100 }
46101 else if (!shouldSetUp && _this.isSetUp) {
46102 _this.backend.teardown();
46103 _this.isSetUp = false;
46104 }
46105 }
46106 };
46107 var store = makeStoreInstance(debugMode);
46108 this.store = store;
46109 this.monitor = new DragDropMonitorImpl_1$$1.default(store, new HandlerRegistryImpl_1$$1.default(store));
46110 store.subscribe(this.handleRefCountChange);
46111 }
46112 DragDropManagerImpl.prototype.receiveBackend = function (backend) {
46113 this.backend = backend;
46114 };
46115 DragDropManagerImpl.prototype.getMonitor = function () {
46116 return this.monitor;
46117 };
46118 DragDropManagerImpl.prototype.getBackend = function () {
46119 return this.backend;
46120 };
46121 DragDropManagerImpl.prototype.getRegistry = function () {
46122 return this.monitor.registry;
46123 };
46124 DragDropManagerImpl.prototype.getActions = function () {
46125 var manager = this;
46126 var dispatch = this.store.dispatch;
46127 function bindActionCreator(actionCreator) {
46128 return function () {
46129 var args = [];
46130 for (var _i = 0; _i < arguments.length; _i++) {
46131 args[_i] = arguments[_i];
46132 }
46133 var action = actionCreator.apply(manager, args);
46134 if (typeof action !== 'undefined') {
46135 dispatch(action);
46136 }
46137 };
46138 }
46139 var actions = dragDrop_1.default(this);
46140 return Object.keys(actions).reduce(function (boundActions, key) {
46141 var action = actions[key];
46142 boundActions[key] = bindActionCreator(action);
46143 return boundActions;
46144 }, {});
46145 };
46146 DragDropManagerImpl.prototype.dispatch = function (action) {
46147 this.store.dispatch(action);
46148 };
46149 return DragDropManagerImpl;
46150}());
46151exports.default = DragDropManagerImpl;
46152});
46153
46154unwrapExports(DragDropManagerImpl_1);
46155
46156var factories = createCommonjsModule(function (module, exports) {
46157var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
46158 return (mod && mod.__esModule) ? mod : { "default": mod };
46159};
46160Object.defineProperty(exports, "__esModule", { value: true });
46161var DragDropManagerImpl_1$$1 = __importDefault(DragDropManagerImpl_1);
46162function createDragDropManager(backendFactory, globalContext, backendOptions, debugMode) {
46163 var manager = new DragDropManagerImpl_1$$1.default(debugMode);
46164 var backend = backendFactory(manager, globalContext, backendOptions);
46165 manager.receiveBackend(backend);
46166 return manager;
46167}
46168exports.createDragDropManager = createDragDropManager;
46169});
46170
46171unwrapExports(factories);
46172var factories_1 = factories.createDragDropManager;
46173
46174var lib$1 = createCommonjsModule(function (module, exports) {
46175function __export(m) {
46176 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
46177}
46178Object.defineProperty(exports, "__esModule", { value: true });
46179__export(interfaces);
46180__export(factories);
46181});
46182
46183unwrapExports(lib$1);
46184
46185var DndContext = createCommonjsModule(function (module, exports) {
46186var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
46187 if (mod && mod.__esModule) return mod;
46188 var result = {};
46189 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
46190 result["default"] = mod;
46191 return result;
46192};
46193Object.defineProperty(exports, "__esModule", { value: true });
46194var React$$1 = __importStar(React__default);
46195
46196/**
46197 * Create the React Context
46198 */
46199exports.DndContext = React$$1.createContext({
46200 dragDropManager: undefined,
46201});
46202/**
46203 * Creates the context object we're providing
46204 * @param backend
46205 * @param context
46206 */
46207function createDndContext(backend, context, options, debugMode) {
46208 return {
46209 dragDropManager: lib$1.createDragDropManager(backend, context, options, debugMode),
46210 };
46211}
46212exports.createDndContext = createDndContext;
46213});
46214
46215unwrapExports(DndContext);
46216var DndContext_1 = DndContext.DndContext;
46217var DndContext_2 = DndContext.createDndContext;
46218
46219var useDragDropManager_1 = createCommonjsModule(function (module, exports) {
46220var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
46221 return (mod && mod.__esModule) ? mod : { "default": mod };
46222};
46223Object.defineProperty(exports, "__esModule", { value: true });
46224
46225var invariant_1$$1 = __importDefault(invariant_1);
46226
46227/**
46228 * A hook to retrieve the DragDropManager from Context
46229 */
46230function useDragDropManager() {
46231 var dragDropManager = React__default.useContext(DndContext.DndContext).dragDropManager;
46232 invariant_1$$1.default(dragDropManager != null, 'Expected drag drop context');
46233 return dragDropManager;
46234}
46235exports.useDragDropManager = useDragDropManager;
46236});
46237
46238unwrapExports(useDragDropManager_1);
46239var useDragDropManager_2 = useDragDropManager_1.useDragDropManager;
46240
46241var DragSourceMonitorImpl_1 = createCommonjsModule(function (module, exports) {
46242var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
46243 return (mod && mod.__esModule) ? mod : { "default": mod };
46244};
46245Object.defineProperty(exports, "__esModule", { value: true });
46246var invariant_1$$1 = __importDefault(invariant_1);
46247var isCallingCanDrag = false;
46248var isCallingIsDragging = false;
46249var DragSourceMonitorImpl = /** @class */ (function () {
46250 function DragSourceMonitorImpl(manager) {
46251 this.sourceId = null;
46252 this.internalMonitor = manager.getMonitor();
46253 }
46254 DragSourceMonitorImpl.prototype.receiveHandlerId = function (sourceId) {
46255 this.sourceId = sourceId;
46256 };
46257 DragSourceMonitorImpl.prototype.getHandlerId = function () {
46258 return this.sourceId;
46259 };
46260 DragSourceMonitorImpl.prototype.canDrag = function () {
46261 invariant_1$$1.default(!isCallingCanDrag, 'You may not call monitor.canDrag() inside your canDrag() implementation. ' +
46262 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor');
46263 try {
46264 isCallingCanDrag = true;
46265 return this.internalMonitor.canDragSource(this.sourceId);
46266 }
46267 finally {
46268 isCallingCanDrag = false;
46269 }
46270 };
46271 DragSourceMonitorImpl.prototype.isDragging = function () {
46272 if (!this.sourceId) {
46273 return false;
46274 }
46275 invariant_1$$1.default(!isCallingIsDragging, 'You may not call monitor.isDragging() inside your isDragging() implementation. ' +
46276 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor');
46277 try {
46278 isCallingIsDragging = true;
46279 return this.internalMonitor.isDraggingSource(this.sourceId);
46280 }
46281 finally {
46282 isCallingIsDragging = false;
46283 }
46284 };
46285 DragSourceMonitorImpl.prototype.subscribeToStateChange = function (listener, options) {
46286 return this.internalMonitor.subscribeToStateChange(listener, options);
46287 };
46288 DragSourceMonitorImpl.prototype.isDraggingSource = function (sourceId) {
46289 return this.internalMonitor.isDraggingSource(sourceId);
46290 };
46291 DragSourceMonitorImpl.prototype.isOverTarget = function (targetId, options) {
46292 return this.internalMonitor.isOverTarget(targetId, options);
46293 };
46294 DragSourceMonitorImpl.prototype.getTargetIds = function () {
46295 return this.internalMonitor.getTargetIds();
46296 };
46297 DragSourceMonitorImpl.prototype.isSourcePublic = function () {
46298 return this.internalMonitor.isSourcePublic();
46299 };
46300 DragSourceMonitorImpl.prototype.getSourceId = function () {
46301 return this.internalMonitor.getSourceId();
46302 };
46303 DragSourceMonitorImpl.prototype.subscribeToOffsetChange = function (listener) {
46304 return this.internalMonitor.subscribeToOffsetChange(listener);
46305 };
46306 DragSourceMonitorImpl.prototype.canDragSource = function (sourceId) {
46307 return this.internalMonitor.canDragSource(sourceId);
46308 };
46309 DragSourceMonitorImpl.prototype.canDropOnTarget = function (targetId) {
46310 return this.internalMonitor.canDropOnTarget(targetId);
46311 };
46312 DragSourceMonitorImpl.prototype.getItemType = function () {
46313 return this.internalMonitor.getItemType();
46314 };
46315 DragSourceMonitorImpl.prototype.getItem = function () {
46316 return this.internalMonitor.getItem();
46317 };
46318 DragSourceMonitorImpl.prototype.getDropResult = function () {
46319 return this.internalMonitor.getDropResult();
46320 };
46321 DragSourceMonitorImpl.prototype.didDrop = function () {
46322 return this.internalMonitor.didDrop();
46323 };
46324 DragSourceMonitorImpl.prototype.getInitialClientOffset = function () {
46325 return this.internalMonitor.getInitialClientOffset();
46326 };
46327 DragSourceMonitorImpl.prototype.getInitialSourceClientOffset = function () {
46328 return this.internalMonitor.getInitialSourceClientOffset();
46329 };
46330 DragSourceMonitorImpl.prototype.getSourceClientOffset = function () {
46331 return this.internalMonitor.getSourceClientOffset();
46332 };
46333 DragSourceMonitorImpl.prototype.getClientOffset = function () {
46334 return this.internalMonitor.getClientOffset();
46335 };
46336 DragSourceMonitorImpl.prototype.getDifferenceFromInitialOffset = function () {
46337 return this.internalMonitor.getDifferenceFromInitialOffset();
46338 };
46339 return DragSourceMonitorImpl;
46340}());
46341exports.DragSourceMonitorImpl = DragSourceMonitorImpl;
46342});
46343
46344unwrapExports(DragSourceMonitorImpl_1);
46345var DragSourceMonitorImpl_2 = DragSourceMonitorImpl_1.DragSourceMonitorImpl;
46346
46347var cloneWithRef_1 = createCommonjsModule(function (module, exports) {
46348var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
46349 return (mod && mod.__esModule) ? mod : { "default": mod };
46350};
46351Object.defineProperty(exports, "__esModule", { value: true });
46352
46353var invariant_1$$1 = __importDefault(invariant_1);
46354function setRef(ref, node) {
46355 if (typeof ref === 'function') {
46356 ref(node);
46357 }
46358 else {
46359 ref.current = node;
46360 }
46361}
46362function cloneWithRef(element, newRef) {
46363 var previousRef = element.ref;
46364 invariant_1$$1.default(typeof previousRef !== 'string', 'Cannot connect React DnD to an element with an existing string ref. ' +
46365 'Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. ' +
46366 'Read more: https://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute');
46367 if (!previousRef) {
46368 // When there is no ref on the element, use the new ref directly
46369 return React__default.cloneElement(element, {
46370 ref: newRef,
46371 });
46372 }
46373 return React__default.cloneElement(element, {
46374 ref: function (node) {
46375 setRef(newRef, node);
46376 if (previousRef) {
46377 setRef(previousRef, node);
46378 }
46379 },
46380 });
46381}
46382exports.cloneWithRef = cloneWithRef;
46383});
46384
46385unwrapExports(cloneWithRef_1);
46386var cloneWithRef_2 = cloneWithRef_1.cloneWithRef;
46387
46388var wrapConnectorHooks_1 = createCommonjsModule(function (module, exports) {
46389Object.defineProperty(exports, "__esModule", { value: true });
46390
46391
46392function throwIfCompositeComponentElement(element) {
46393 // Custom components can no longer be wrapped directly in React DnD 2.0
46394 // so that we don't need to depend on findDOMNode() from react-dom.
46395 if (typeof element.type === 'string') {
46396 return;
46397 }
46398 var displayName = element.type.displayName || element.type.name || 'the component';
46399 throw new Error('Only native element nodes can now be passed to React DnD connectors.' +
46400 ("You can either wrap " + displayName + " into a <div>, or turn it into a ") +
46401 'drag source or a drop target itself.');
46402}
46403function wrapHookToRecognizeElement(hook) {
46404 return function (elementOrNode, options) {
46405 if (elementOrNode === void 0) { elementOrNode = null; }
46406 if (options === void 0) { options = null; }
46407 // When passed a node, call the hook straight away.
46408 if (!React__default.isValidElement(elementOrNode)) {
46409 var node = elementOrNode;
46410 hook(node, options);
46411 // return the node so it can be chained (e.g. when within callback refs
46412 // <div ref={node => connectDragSource(connectDropTarget(node))}/>
46413 return node;
46414 }
46415 // If passed a ReactElement, clone it and attach this function as a ref.
46416 // This helps us achieve a neat API where user doesn't even know that refs
46417 // are being used under the hood.
46418 var element = elementOrNode;
46419 throwIfCompositeComponentElement(element);
46420 // When no options are passed, use the hook directly
46421 var ref = options ? function (node) { return hook(node, options); } : hook;
46422 return cloneWithRef_1.cloneWithRef(element, ref);
46423 };
46424}
46425function wrapConnectorHooks(hooks) {
46426 var wrappedHooks = {};
46427 Object.keys(hooks).forEach(function (key) {
46428 var hook = hooks[key];
46429 // ref objects should be passed straight through without wrapping
46430 if (key.endsWith('Ref')) {
46431 wrappedHooks[key] = hooks[key];
46432 }
46433 else {
46434 var wrappedHook_1 = wrapHookToRecognizeElement(hook);
46435 wrappedHooks[key] = function () { return wrappedHook_1; };
46436 }
46437 });
46438 return wrappedHooks;
46439}
46440exports.default = wrapConnectorHooks;
46441});
46442
46443unwrapExports(wrapConnectorHooks_1);
46444
46445var isRef_1 = createCommonjsModule(function (module, exports) {
46446Object.defineProperty(exports, "__esModule", { value: true });
46447function isRef(obj) {
46448 return (
46449 // eslint-disable-next-line no-prototype-builtins
46450 obj !== null && typeof obj === 'object' && obj.hasOwnProperty('current'));
46451}
46452exports.isRef = isRef;
46453});
46454
46455unwrapExports(isRef_1);
46456var isRef_2 = isRef_1.isRef;
46457
46458var SourceConnector_1 = createCommonjsModule(function (module, exports) {
46459var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
46460 return (mod && mod.__esModule) ? mod : { "default": mod };
46461};
46462Object.defineProperty(exports, "__esModule", { value: true });
46463var wrapConnectorHooks_1$$1 = __importDefault(wrapConnectorHooks_1);
46464
46465var shallowequal_1 = __importDefault(shallowequal);
46466var SourceConnector = /** @class */ (function () {
46467 function SourceConnector(backend) {
46468 var _this = this;
46469 this.backend = backend;
46470 this.hooks = wrapConnectorHooks_1$$1.default({
46471 dragSource: function (node, options) {
46472 _this.dragSourceOptions = options || null;
46473 if (isRef_1.isRef(node)) {
46474 _this.dragSourceRef = node;
46475 }
46476 else {
46477 _this.dragSourceNode = node;
46478 }
46479 _this.reconnectDragSource();
46480 },
46481 dragPreview: function (node, options) {
46482 _this.dragPreviewOptions = options || null;
46483 if (isRef_1.isRef(node)) {
46484 _this.dragPreviewRef = node;
46485 }
46486 else {
46487 _this.dragPreviewNode = node;
46488 }
46489 _this.reconnectDragPreview();
46490 },
46491 });
46492 this.handlerId = null;
46493 // The drop target may either be attached via ref or connect function
46494 this.dragSourceRef = null;
46495 this.dragSourceOptionsInternal = null;
46496 // The drag preview may either be attached via ref or connect function
46497 this.dragPreviewRef = null;
46498 this.dragPreviewOptionsInternal = null;
46499 this.lastConnectedHandlerId = null;
46500 this.lastConnectedDragSource = null;
46501 this.lastConnectedDragSourceOptions = null;
46502 this.lastConnectedDragPreview = null;
46503 this.lastConnectedDragPreviewOptions = null;
46504 }
46505 SourceConnector.prototype.receiveHandlerId = function (newHandlerId) {
46506 if (this.handlerId === newHandlerId) {
46507 return;
46508 }
46509 this.handlerId = newHandlerId;
46510 this.reconnect();
46511 };
46512 Object.defineProperty(SourceConnector.prototype, "connectTarget", {
46513 get: function () {
46514 return this.dragSource;
46515 },
46516 enumerable: true,
46517 configurable: true
46518 });
46519 Object.defineProperty(SourceConnector.prototype, "dragSourceOptions", {
46520 get: function () {
46521 return this.dragSourceOptionsInternal;
46522 },
46523 set: function (options) {
46524 this.dragSourceOptionsInternal = options;
46525 },
46526 enumerable: true,
46527 configurable: true
46528 });
46529 Object.defineProperty(SourceConnector.prototype, "dragPreviewOptions", {
46530 get: function () {
46531 return this.dragPreviewOptionsInternal;
46532 },
46533 set: function (options) {
46534 this.dragPreviewOptionsInternal = options;
46535 },
46536 enumerable: true,
46537 configurable: true
46538 });
46539 SourceConnector.prototype.reconnect = function () {
46540 this.reconnectDragSource();
46541 this.reconnectDragPreview();
46542 };
46543 SourceConnector.prototype.reconnectDragSource = function () {
46544 // if nothing has changed then don't resubscribe
46545 var didChange = this.didHandlerIdChange() ||
46546 this.didConnectedDragSourceChange() ||
46547 this.didDragSourceOptionsChange();
46548 if (didChange) {
46549 this.disconnectDragSource();
46550 }
46551 var dragSource = this.dragSource;
46552 if (!this.handlerId) {
46553 return;
46554 }
46555 if (!dragSource) {
46556 this.lastConnectedDragSource = dragSource;
46557 return;
46558 }
46559 if (didChange) {
46560 this.lastConnectedHandlerId = this.handlerId;
46561 this.lastConnectedDragSource = dragSource;
46562 this.lastConnectedDragSourceOptions = this.dragSourceOptions;
46563 this.dragSourceUnsubscribe = this.backend.connectDragSource(this.handlerId, dragSource, this.dragSourceOptions);
46564 }
46565 };
46566 SourceConnector.prototype.reconnectDragPreview = function () {
46567 // if nothing has changed then don't resubscribe
46568 var didChange = this.didHandlerIdChange() ||
46569 this.didConnectedDragPreviewChange() ||
46570 this.didDragPreviewOptionsChange();
46571 if (didChange) {
46572 this.disconnectDragPreview();
46573 }
46574 var dragPreview = this.dragPreview;
46575 if (!this.handlerId || !dragPreview) {
46576 return;
46577 }
46578 if (didChange) {
46579 this.lastConnectedHandlerId = this.handlerId;
46580 this.lastConnectedDragPreview = dragPreview;
46581 this.lastConnectedDragPreviewOptions = this.dragPreviewOptions;
46582 this.dragPreviewUnsubscribe = this.backend.connectDragPreview(this.handlerId, dragPreview, this.dragPreviewOptions);
46583 }
46584 };
46585 SourceConnector.prototype.didHandlerIdChange = function () {
46586 return this.lastConnectedHandlerId !== this.handlerId;
46587 };
46588 SourceConnector.prototype.didConnectedDragSourceChange = function () {
46589 return this.lastConnectedDragSource !== this.dragSource;
46590 };
46591 SourceConnector.prototype.didConnectedDragPreviewChange = function () {
46592 return this.lastConnectedDragPreview !== this.dragPreview;
46593 };
46594 SourceConnector.prototype.didDragSourceOptionsChange = function () {
46595 return !shallowequal_1.default(this.lastConnectedDragSourceOptions, this.dragSourceOptions);
46596 };
46597 SourceConnector.prototype.didDragPreviewOptionsChange = function () {
46598 return !shallowequal_1.default(this.lastConnectedDragPreviewOptions, this.dragPreviewOptions);
46599 };
46600 SourceConnector.prototype.disconnectDragSource = function () {
46601 if (this.dragSourceUnsubscribe) {
46602 this.dragSourceUnsubscribe();
46603 this.dragSourceUnsubscribe = undefined;
46604 }
46605 };
46606 SourceConnector.prototype.disconnectDragPreview = function () {
46607 if (this.dragPreviewUnsubscribe) {
46608 this.dragPreviewUnsubscribe();
46609 this.dragPreviewUnsubscribe = undefined;
46610 this.dragPreviewNode = null;
46611 this.dragPreviewRef = null;
46612 }
46613 };
46614 Object.defineProperty(SourceConnector.prototype, "dragSource", {
46615 get: function () {
46616 return (this.dragSourceNode || (this.dragSourceRef && this.dragSourceRef.current));
46617 },
46618 enumerable: true,
46619 configurable: true
46620 });
46621 Object.defineProperty(SourceConnector.prototype, "dragPreview", {
46622 get: function () {
46623 return (this.dragPreviewNode ||
46624 (this.dragPreviewRef && this.dragPreviewRef.current));
46625 },
46626 enumerable: true,
46627 configurable: true
46628 });
46629 return SourceConnector;
46630}());
46631exports.SourceConnector = SourceConnector;
46632});
46633
46634unwrapExports(SourceConnector_1);
46635var SourceConnector_2 = SourceConnector_1.SourceConnector;
46636
46637var drag = createCommonjsModule(function (module, exports) {
46638var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
46639 return (mod && mod.__esModule) ? mod : { "default": mod };
46640};
46641Object.defineProperty(exports, "__esModule", { value: true });
46642
46643var invariant_1$$1 = __importDefault(invariant_1);
46644
46645
46646
46647
46648function useDragSourceMonitor() {
46649 var manager = useDragDropManager_1.useDragDropManager();
46650 var monitor = React__default.useMemo(function () { return new DragSourceMonitorImpl_1.DragSourceMonitorImpl(manager); }, [manager]);
46651 var connector = React__default.useMemo(function () { return new SourceConnector_1.SourceConnector(manager.getBackend()); }, [
46652 manager,
46653 ]);
46654 return [monitor, connector];
46655}
46656exports.useDragSourceMonitor = useDragSourceMonitor;
46657function useDragHandler(spec, monitor, connector) {
46658 var manager = useDragDropManager_1.useDragDropManager();
46659 var handler = React__default.useMemo(function () {
46660 return {
46661 beginDrag: function () {
46662 var _a = spec.current, begin = _a.begin, item = _a.item;
46663 if (begin) {
46664 var beginResult = begin(monitor);
46665 invariant_1$$1.default(beginResult == null || typeof beginResult === 'object', 'dragSpec.begin() must either return an object, undefined, or null');
46666 return beginResult || item || {};
46667 }
46668 return item || {};
46669 },
46670 canDrag: function () {
46671 if (typeof spec.current.canDrag === 'boolean') {
46672 return spec.current.canDrag;
46673 }
46674 else if (typeof spec.current.canDrag === 'function') {
46675 return spec.current.canDrag(monitor);
46676 }
46677 else {
46678 return true;
46679 }
46680 },
46681 isDragging: function (globalMonitor, target) {
46682 var isDragging = spec.current.isDragging;
46683 return isDragging
46684 ? isDragging(monitor)
46685 : target === globalMonitor.getSourceId();
46686 },
46687 endDrag: function () {
46688 var end = spec.current.end;
46689 if (end) {
46690 end(monitor.getItem(), monitor);
46691 }
46692 connector.reconnect();
46693 },
46694 };
46695 }, []);
46696 React__default.useLayoutEffect(function registerHandler() {
46697 var _a = registration.registerSource(spec.current.item.type, handler, manager), handlerId = _a[0], unregister = _a[1];
46698 monitor.receiveHandlerId(handlerId);
46699 connector.receiveHandlerId(handlerId);
46700 return unregister;
46701 }, []);
46702}
46703exports.useDragHandler = useDragHandler;
46704});
46705
46706unwrapExports(drag);
46707var drag_1 = drag.useDragSourceMonitor;
46708var drag_2 = drag.useDragHandler;
46709
46710var useDrag_1 = createCommonjsModule(function (module, exports) {
46711var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
46712 return (mod && mod.__esModule) ? mod : { "default": mod };
46713};
46714Object.defineProperty(exports, "__esModule", { value: true });
46715
46716var invariant_1$$1 = __importDefault(invariant_1);
46717
46718
46719/**
46720 * useDragSource hook
46721 * @param sourceSpec The drag source specification *
46722 */
46723function useDrag(spec) {
46724 var specRef = React__default.useRef(spec);
46725 specRef.current = spec;
46726 // TODO: wire options into createSourceConnector
46727 invariant_1$$1.default(spec.item != null, 'item must be defined');
46728 invariant_1$$1.default(spec.item.type != null, 'item type must be defined');
46729 var _a = drag.useDragSourceMonitor(), monitor = _a[0], connector = _a[1];
46730 drag.useDragHandler(specRef, monitor, connector);
46731 var result = useMonitorOutput_1.useMonitorOutput(monitor, specRef.current.collect || (function () { return ({}); }), function () { return connector.reconnect(); });
46732 var connectDragSource = React__default.useMemo(function () { return connector.hooks.dragSource(); }, [
46733 connector,
46734 ]);
46735 var connectDragPreview = React__default.useMemo(function () { return connector.hooks.dragPreview(); }, [
46736 connector,
46737 ]);
46738 React__default.useLayoutEffect(function () {
46739 connector.dragSourceOptions = specRef.current.options || null;
46740 connector.reconnect();
46741 }, [connector]);
46742 React__default.useLayoutEffect(function () {
46743 connector.dragPreviewOptions = specRef.current.previewOptions || null;
46744 connector.reconnect();
46745 }, [connector]);
46746 return [result, connectDragSource, connectDragPreview];
46747}
46748exports.useDrag = useDrag;
46749});
46750
46751unwrapExports(useDrag_1);
46752var useDrag_2 = useDrag_1.useDrag;
46753
46754var TargetConnector_1 = createCommonjsModule(function (module, exports) {
46755var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
46756 return (mod && mod.__esModule) ? mod : { "default": mod };
46757};
46758Object.defineProperty(exports, "__esModule", { value: true });
46759var shallowequal_1 = __importDefault(shallowequal);
46760var wrapConnectorHooks_1$$1 = __importDefault(wrapConnectorHooks_1);
46761
46762var TargetConnector = /** @class */ (function () {
46763 function TargetConnector(backend) {
46764 var _this = this;
46765 this.backend = backend;
46766 this.hooks = wrapConnectorHooks_1$$1.default({
46767 dropTarget: function (node, options) {
46768 _this.dropTargetOptions = options;
46769 if (isRef_1.isRef(node)) {
46770 _this.dropTargetRef = node;
46771 }
46772 else {
46773 _this.dropTargetNode = node;
46774 }
46775 _this.reconnect();
46776 },
46777 });
46778 this.handlerId = null;
46779 // The drop target may either be attached via ref or connect function
46780 this.dropTargetRef = null;
46781 this.dropTargetOptionsInternal = null;
46782 this.lastConnectedHandlerId = null;
46783 this.lastConnectedDropTarget = null;
46784 this.lastConnectedDropTargetOptions = null;
46785 }
46786 Object.defineProperty(TargetConnector.prototype, "connectTarget", {
46787 get: function () {
46788 return this.dropTarget;
46789 },
46790 enumerable: true,
46791 configurable: true
46792 });
46793 TargetConnector.prototype.reconnect = function () {
46794 // if nothing has changed then don't resubscribe
46795 var didChange = this.didHandlerIdChange() ||
46796 this.didDropTargetChange() ||
46797 this.didOptionsChange();
46798 if (didChange) {
46799 this.disconnectDropTarget();
46800 }
46801 var dropTarget = this.dropTarget;
46802 if (!this.handlerId) {
46803 return;
46804 }
46805 if (!dropTarget) {
46806 this.lastConnectedDropTarget = dropTarget;
46807 return;
46808 }
46809 if (didChange) {
46810 this.lastConnectedHandlerId = this.handlerId;
46811 this.lastConnectedDropTarget = dropTarget;
46812 this.lastConnectedDropTargetOptions = this.dropTargetOptions;
46813 this.unsubscribeDropTarget = this.backend.connectDropTarget(this.handlerId, dropTarget, this.dropTargetOptions);
46814 }
46815 };
46816 TargetConnector.prototype.receiveHandlerId = function (newHandlerId) {
46817 if (newHandlerId === this.handlerId) {
46818 return;
46819 }
46820 this.handlerId = newHandlerId;
46821 this.reconnect();
46822 };
46823 Object.defineProperty(TargetConnector.prototype, "dropTargetOptions", {
46824 get: function () {
46825 return this.dropTargetOptionsInternal;
46826 },
46827 set: function (options) {
46828 this.dropTargetOptionsInternal = options;
46829 },
46830 enumerable: true,
46831 configurable: true
46832 });
46833 TargetConnector.prototype.didHandlerIdChange = function () {
46834 return this.lastConnectedHandlerId !== this.handlerId;
46835 };
46836 TargetConnector.prototype.didDropTargetChange = function () {
46837 return this.lastConnectedDropTarget !== this.dropTarget;
46838 };
46839 TargetConnector.prototype.didOptionsChange = function () {
46840 return !shallowequal_1.default(this.lastConnectedDropTargetOptions, this.dropTargetOptions);
46841 };
46842 TargetConnector.prototype.disconnectDropTarget = function () {
46843 if (this.unsubscribeDropTarget) {
46844 this.unsubscribeDropTarget();
46845 this.unsubscribeDropTarget = undefined;
46846 }
46847 };
46848 Object.defineProperty(TargetConnector.prototype, "dropTarget", {
46849 get: function () {
46850 return (this.dropTargetNode || (this.dropTargetRef && this.dropTargetRef.current));
46851 },
46852 enumerable: true,
46853 configurable: true
46854 });
46855 return TargetConnector;
46856}());
46857exports.TargetConnector = TargetConnector;
46858});
46859
46860unwrapExports(TargetConnector_1);
46861var TargetConnector_2 = TargetConnector_1.TargetConnector;
46862
46863var DropTargetMonitorImpl_1 = createCommonjsModule(function (module, exports) {
46864var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
46865 return (mod && mod.__esModule) ? mod : { "default": mod };
46866};
46867Object.defineProperty(exports, "__esModule", { value: true });
46868var invariant_1$$1 = __importDefault(invariant_1);
46869var isCallingCanDrop = false;
46870var DropTargetMonitorImpl = /** @class */ (function () {
46871 function DropTargetMonitorImpl(manager) {
46872 this.targetId = null;
46873 this.internalMonitor = manager.getMonitor();
46874 }
46875 DropTargetMonitorImpl.prototype.receiveHandlerId = function (targetId) {
46876 this.targetId = targetId;
46877 };
46878 DropTargetMonitorImpl.prototype.getHandlerId = function () {
46879 return this.targetId;
46880 };
46881 DropTargetMonitorImpl.prototype.subscribeToStateChange = function (listener, options) {
46882 return this.internalMonitor.subscribeToStateChange(listener, options);
46883 };
46884 DropTargetMonitorImpl.prototype.canDrop = function () {
46885 // Cut out early if the target id has not been set. This should prevent errors
46886 // where the user has an older version of dnd-core like in
46887 // https://github.com/react-dnd/react-dnd/issues/1310
46888 if (!this.targetId) {
46889 return false;
46890 }
46891 invariant_1$$1.default(!isCallingCanDrop, 'You may not call monitor.canDrop() inside your canDrop() implementation. ' +
46892 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor');
46893 try {
46894 isCallingCanDrop = true;
46895 return this.internalMonitor.canDropOnTarget(this.targetId);
46896 }
46897 finally {
46898 isCallingCanDrop = false;
46899 }
46900 };
46901 DropTargetMonitorImpl.prototype.isOver = function (options) {
46902 if (!this.targetId) {
46903 return false;
46904 }
46905 return this.internalMonitor.isOverTarget(this.targetId, options);
46906 };
46907 DropTargetMonitorImpl.prototype.getItemType = function () {
46908 return this.internalMonitor.getItemType();
46909 };
46910 DropTargetMonitorImpl.prototype.getItem = function () {
46911 return this.internalMonitor.getItem();
46912 };
46913 DropTargetMonitorImpl.prototype.getDropResult = function () {
46914 return this.internalMonitor.getDropResult();
46915 };
46916 DropTargetMonitorImpl.prototype.didDrop = function () {
46917 return this.internalMonitor.didDrop();
46918 };
46919 DropTargetMonitorImpl.prototype.getInitialClientOffset = function () {
46920 return this.internalMonitor.getInitialClientOffset();
46921 };
46922 DropTargetMonitorImpl.prototype.getInitialSourceClientOffset = function () {
46923 return this.internalMonitor.getInitialSourceClientOffset();
46924 };
46925 DropTargetMonitorImpl.prototype.getSourceClientOffset = function () {
46926 return this.internalMonitor.getSourceClientOffset();
46927 };
46928 DropTargetMonitorImpl.prototype.getClientOffset = function () {
46929 return this.internalMonitor.getClientOffset();
46930 };
46931 DropTargetMonitorImpl.prototype.getDifferenceFromInitialOffset = function () {
46932 return this.internalMonitor.getDifferenceFromInitialOffset();
46933 };
46934 return DropTargetMonitorImpl;
46935}());
46936exports.DropTargetMonitorImpl = DropTargetMonitorImpl;
46937});
46938
46939unwrapExports(DropTargetMonitorImpl_1);
46940var DropTargetMonitorImpl_2 = DropTargetMonitorImpl_1.DropTargetMonitorImpl;
46941
46942var drop$2 = createCommonjsModule(function (module, exports) {
46943Object.defineProperty(exports, "__esModule", { value: true });
46944
46945
46946
46947
46948
46949function useDropTargetMonitor() {
46950 var manager = useDragDropManager_1.useDragDropManager();
46951 var monitor = React__default.useMemo(function () { return new DropTargetMonitorImpl_1.DropTargetMonitorImpl(manager); }, [manager]);
46952 var connector = React__default.useMemo(function () { return new TargetConnector_1.TargetConnector(manager.getBackend()); }, [
46953 manager,
46954 ]);
46955 return [monitor, connector];
46956}
46957exports.useDropTargetMonitor = useDropTargetMonitor;
46958function useDropHandler(spec, monitor, connector) {
46959 var manager = useDragDropManager_1.useDragDropManager();
46960 var handler = React__default.useMemo(function () {
46961 return {
46962 canDrop: function () {
46963 var canDrop = spec.current.canDrop;
46964 return canDrop ? canDrop(monitor.getItem(), monitor) : true;
46965 },
46966 hover: function () {
46967 var hover = spec.current.hover;
46968 if (hover) {
46969 hover(monitor.getItem(), monitor);
46970 }
46971 },
46972 drop: function () {
46973 var drop = spec.current.drop;
46974 if (drop) {
46975 return drop(monitor.getItem(), monitor);
46976 }
46977 },
46978 };
46979 }, [monitor]);
46980 React__default.useLayoutEffect(function registerHandler() {
46981 var _a = registration.registerTarget(spec.current.accept, handler, manager), handlerId = _a[0], unregister = _a[1];
46982 monitor.receiveHandlerId(handlerId);
46983 connector.receiveHandlerId(handlerId);
46984 return unregister;
46985 }, [monitor, connector]);
46986}
46987exports.useDropHandler = useDropHandler;
46988});
46989
46990unwrapExports(drop$2);
46991var drop_1 = drop$2.useDropTargetMonitor;
46992var drop_2 = drop$2.useDropHandler;
46993
46994var useDrop_1 = createCommonjsModule(function (module, exports) {
46995var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
46996 return (mod && mod.__esModule) ? mod : { "default": mod };
46997};
46998Object.defineProperty(exports, "__esModule", { value: true });
46999
47000var invariant_1$$1 = __importDefault(invariant_1);
47001
47002
47003/**
47004 * useDropTarget Hook
47005 * @param spec The drop target specification
47006 */
47007function useDrop(spec) {
47008 var specRef = React__default.useRef(spec);
47009 specRef.current = spec;
47010 invariant_1$$1.default(spec.accept != null, 'accept must be defined');
47011 var _a = drop$2.useDropTargetMonitor(), monitor = _a[0], connector = _a[1];
47012 drop$2.useDropHandler(specRef, monitor, connector);
47013 var result = useMonitorOutput_1.useMonitorOutput(monitor, specRef.current.collect || (function () { return ({}); }), function () { return connector.reconnect(); });
47014 var connectDropTarget = React__default.useMemo(function () { return connector.hooks.dropTarget(); }, [
47015 connector,
47016 ]);
47017 React__default.useLayoutEffect(function () {
47018 connector.dropTargetOptions = spec.options || null;
47019 connector.reconnect();
47020 }, [spec.options]);
47021 return [result, connectDropTarget];
47022}
47023exports.useDrop = useDrop;
47024});
47025
47026unwrapExports(useDrop_1);
47027var useDrop_2 = useDrop_1.useDrop;
47028
47029var ItemTypes = {
47030 ROW: 'ROW',
47031 CARD: 'CARD'
47032};
47033
47034var _ref$2 =
47035/*#__PURE__*/
47036React__default.createElement("path", {
47037 d: "M2.781.151H.755A.755.755 0 0 0 0 .906v2.026c0 .416.339.755.755.755H2.78a.755.755 0 0 0 .755-.755V.906A.755.755 0 0 0 2.78.15zM9.013.151H6.987a.756.756 0 0 0-.755.755v2.026c0 .416.338.755.755.755h2.026a.756.756 0 0 0 .755-.755V.906A.756.756 0 0 0 9.013.15zM15.245.151H13.22a.755.755 0 0 0-.755.755v2.026c0 .416.339.755.755.755h2.027A.755.755 0 0 0 16 2.932V.906a.755.755 0 0 0-.755-.755zM2.781 6.232H.755A.756.756 0 0 0 0 6.987v2.026c0 .417.339.755.755.755H2.78a.756.756 0 0 0 .755-.755V6.987a.755.755 0 0 0-.755-.755zM9.013 6.232H6.987a.756.756 0 0 0-.755.755v2.026c0 .417.338.755.755.755h2.026a.756.756 0 0 0 .755-.755V6.987a.756.756 0 0 0-.755-.755zM15.245 6.232H13.22a.756.756 0 0 0-.755.755v2.026c0 .417.339.755.755.755h2.027A.756.756 0 0 0 16 9.013V6.987a.756.756 0 0 0-.755-.755zM2.781 12.313H.755a.756.756 0 0 0-.755.755v2.026c0 .416.339.755.755.755H2.78a.756.756 0 0 0 .755-.755v-2.026a.755.755 0 0 0-.755-.755zM9.013 12.313H6.987a.756.756 0 0 0-.755.755v2.026c0 .416.338.755.755.755h2.026a.756.756 0 0 0 .755-.755v-2.026a.756.756 0 0 0-.755-.755zM15.245 12.313H13.22a.755.755 0 0 0-.755.755v2.026c0 .416.339.755.755.755h2.027a.755.755 0 0 0 .754-.755v-2.026a.755.755 0 0 0-.755-.755z",
47038 fill: "#424242"
47039});
47040
47041var dragIconBlack = 'data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%20%20%3Cpath%20d%3D%22M2.78144%200.151001H0.75456C0.33856%200.151001%200%200.489561%200%200.905561V2.93212C0%203.34812%200.33856%203.68668%200.75456%203.68668H2.78112C3.19712%203.68668%203.53568%203.34812%203.53568%202.93212V0.905561C3.536%200.489561%203.19744%200.151001%202.78144%200.151001Z%22%20fill%3D%22%23424242%22%2F%3E%20%20%3Cpath%20d%3D%22M9.01337%200.151001H6.98681C6.57049%200.151001%206.23193%200.489561%206.23193%200.905561V2.93212C6.23193%203.34812%206.57049%203.68668%206.98681%203.68668H9.01337C9.42969%203.68668%209.76825%203.34812%209.76825%202.93212V0.905561C9.76793%200.489561%209.42937%200.151001%209.01337%200.151001Z%22%20fill%3D%22%23424242%22%2F%3E%20%20%3Cpath%20d%3D%22M15.2455%200.151001H13.2189C12.8029%200.151001%2012.4644%200.489561%2012.4644%200.905561V2.93212C12.4644%203.34812%2012.8029%203.68668%2013.2189%203.68668H15.2455C15.6615%203.68668%2016%203.34812%2016%202.93212V0.905561C16%200.489561%2015.6615%200.151001%2015.2455%200.151001Z%22%20fill%3D%22%23424242%22%2F%3E%20%20%3Cpath%20d%3D%22M2.78144%206.23193H0.75456C0.33856%206.23193%200%206.57049%200%206.98681V9.01337C0%209.42969%200.33856%209.76825%200.75456%209.76825H2.78112C3.19712%209.76825%203.53568%209.42969%203.53568%209.01337V6.98681C3.536%206.57049%203.19744%206.23193%202.78144%206.23193Z%22%20fill%3D%22%23424242%22%2F%3E%20%20%3Cpath%20d%3D%22M9.01337%206.23193H6.98681C6.57049%206.23193%206.23193%206.57049%206.23193%206.98681V9.01337C6.23193%209.42969%206.57049%209.76825%206.98681%209.76825H9.01337C9.42969%209.76825%209.76825%209.42969%209.76825%209.01337V6.98681C9.76793%206.57049%209.42937%206.23193%209.01337%206.23193Z%22%20fill%3D%22%23424242%22%2F%3E%20%20%3Cpath%20d%3D%22M15.2455%206.23193H13.2189C12.8029%206.23193%2012.4644%206.57049%2012.4644%206.98681V9.01337C12.4644%209.42969%2012.8029%209.76825%2013.2189%209.76825H15.2455C15.6615%209.76825%2016%209.42969%2016%209.01337V6.98681C16%206.57049%2015.6615%206.23193%2015.2455%206.23193Z%22%20fill%3D%22%23424242%22%2F%3E%20%20%3Cpath%20d%3D%22M2.78144%2012.3129H0.75456C0.33856%2012.3129%200%2012.6515%200%2013.0675V15.094C0%2015.5104%200.33856%2015.8486%200.75456%2015.8486H2.78112C3.19712%2015.8486%203.53568%2015.51%203.53568%2015.094V13.0675C3.536%2012.6515%203.19744%2012.3129%202.78144%2012.3129Z%22%20fill%3D%22%23424242%22%2F%3E%20%20%3Cpath%20d%3D%22M9.01337%2012.3129H6.98681C6.57049%2012.3129%206.23193%2012.6515%206.23193%2013.0675V15.094C6.23193%2015.5104%206.57049%2015.8486%206.98681%2015.8486H9.01337C9.42969%2015.8486%209.76825%2015.51%209.76825%2015.094V13.0675C9.76793%2012.6515%209.42937%2012.3129%209.01337%2012.3129Z%22%20fill%3D%22%23424242%22%2F%3E%20%20%3Cpath%20d%3D%22M15.2455%2012.3129H13.2189C12.8029%2012.3129%2012.4644%2012.6515%2012.4644%2013.0675V15.094C12.4644%2015.5104%2012.8029%2015.8486%2013.2189%2015.8486H15.2455C15.6615%2015.8486%2016%2015.51%2016%2015.094V13.0675C16%2012.6515%2015.6615%2012.3129%2015.2455%2012.3129Z%22%20fill%3D%22%23424242%22%2F%3E%3C%2Fsvg%3E';
47042
47043function _templateObject4$f() {
47044 var data = taggedTemplateLiteralLoose(["\n\tcursor: grab;\n"]);
47045
47046 _templateObject4$f = function _templateObject4() {
47047 return data;
47048 };
47049
47050 return data;
47051}
47052
47053function _templateObject3$k() {
47054 var data = taggedTemplateLiteralLoose(["\n\tbackground-color: ", ";\n"]);
47055
47056 _templateObject3$k = function _templateObject3() {
47057 return data;
47058 };
47059
47060 return data;
47061}
47062
47063function _templateObject2$v() {
47064 var data = taggedTemplateLiteralLoose(["\n\topacity: ", ";\n"]);
47065
47066 _templateObject2$v = function _templateObject2() {
47067 return data;
47068 };
47069
47070 return data;
47071}
47072
47073function _templateObject$1l() {
47074 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-grow: 2;\n\talign-items: center;\n\tjustify-content: space-between;\n"]);
47075
47076 _templateObject$1l = function _templateObject() {
47077 return data;
47078 };
47079
47080 return data;
47081}
47082var dragEndHandler = function dragEndHandler(index, callback) {
47083 return function (item) {
47084 return callback(index, item);
47085 };
47086};
47087var dropHandler = function dropHandler(index, callback) {
47088 return function (item) {
47089 item.type === ItemTypes.CARD && callback(index, item);
47090 return item;
47091 };
47092};
47093var hoverHandler = function hoverHandler(ref, index, newItemCallback, moveCallback) {
47094 return function (item) {
47095 if (!ref.current) return;
47096 var dragIndex = item.index;
47097 var hoverIndex = index;
47098 if (dragIndex === hoverIndex) return;
47099 item.type === ItemTypes.CARD ? newItemCallback(hoverIndex, item) : moveCallback(dragIndex, hoverIndex);
47100 item.index = hoverIndex;
47101 };
47102};
47103
47104var DndListRow = function DndListRow(_ref) {
47105 var id = _ref.id,
47106 index = _ref.index,
47107 moveItem = _ref.moveItem,
47108 changedNewItem = _ref.changedNewItem,
47109 isNewItem = _ref.isNewItem,
47110 children = _ref.children,
47111 dragComplete = _ref.dragComplete,
47112 props = objectWithoutPropertiesLoose(_ref, ["id", "index", "moveItem", "changedNewItem", "isNewItem", "children", "dragComplete"]);
47113
47114 var ref = React.useRef(null);
47115
47116 var _useDrag = useDrag_2({
47117 item: {
47118 type: ItemTypes.ROW,
47119 id: id,
47120 index: index
47121 },
47122 end: dragEndHandler(index, dragComplete),
47123 collect: function collect(monitor) {
47124 return {
47125 isDragging: monitor.isDragging()
47126 };
47127 }
47128 }),
47129 isDragging = _useDrag[0].isDragging,
47130 drag = _useDrag[1],
47131 preview = _useDrag[2];
47132
47133 var _useDrop = useDrop_2({
47134 accept: [ItemTypes.ROW, ItemTypes.CARD],
47135 drop: dropHandler(index, dragComplete),
47136 hover: hoverHandler(ref, index, changedNewItem, moveItem),
47137 collect: function collect(monitor) {
47138 return {
47139 canDrop: monitor.canDrop(),
47140 isUserDragging: !!monitor.getItem()
47141 };
47142 }
47143 }),
47144 _useDrop$ = _useDrop[0],
47145 canDrop = _useDrop$.canDrop,
47146 isUserDragging = _useDrop$.isUserDragging,
47147 drop = _useDrop[1];
47148
47149 if (!isUserDragging && isNewItem) changedNewItem(-1);
47150 preview(drop(ref));
47151 return React__default.createElement(DivStyled, {
47152 ref: ref,
47153 drawBackground: isDragging && canDrop || isNewItem
47154 }, React__default.createElement(ListRowStyled, _extends_1({
47155 removehover: canDrop ? 'removeHover' : undefined,
47156 transparent: isDragging || isNewItem ? 'transparent' : undefined,
47157 index: index,
47158 key: id
47159 }, props), React__default.createElement(FlexGrow, null, children), React__default.createElement(DragIcon, {
47160 ref: drag,
47161 src: dragIconBlack,
47162 alt: "drag"
47163 })));
47164};
47165
47166var FlexGrow = styled__default.div(_templateObject$1l());
47167DndListRow.displayName = 'DndListRow';
47168var ListRowStyled = styled__default(ListRow)(_templateObject2$v(), function (_ref2) {
47169 var transparent = _ref2.transparent;
47170 return transparent ? 0 : 1;
47171});
47172ListRowStyled.displayName = 'ListRowStyled';
47173var DivStyled = styled__default.div(_templateObject3$k(), function (_ref3) {
47174 var drawBackground = _ref3.drawBackground,
47175 theme = _ref3.theme;
47176 return drawBackground && theme.dndList.dragOver;
47177});
47178DivStyled.displayName = 'DivStyled';
47179var DragIcon = styled__default.img(_templateObject4$f());
47180DragIcon.displayName = 'DragIcon';
47181DndListRow.defaultProps = {
47182 changedNewItem: function changedNewItem() {},
47183 isNewItem: false
47184};
47185DndListRow.propTypes = {
47186 id: PropTypes.number.isRequired,
47187 index: PropTypes.number.isRequired,
47188 moveItem: PropTypes.func.isRequired,
47189 dragComplete: PropTypes.func.isRequired,
47190 changedNewItem: PropTypes.func,
47191 isNewItem: PropTypes.bool,
47192 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
47193};
47194
47195function _templateObject$1m() {
47196 var data = taggedTemplateLiteralLoose(["\n\theight: 50px;\n\tbackground-color: ", ";\n"]);
47197
47198 _templateObject$1m = function _templateObject() {
47199 return data;
47200 };
47201
47202 return data;
47203}
47204
47205var DndEmptyList = function DndEmptyList(_ref) {
47206 var addFirstItem = _ref.addFirstItem;
47207
47208 var _useDrop = useDrop_2({
47209 accept: [ItemTypes.CARD],
47210 drop: addFirstItem,
47211 collect: function collect(monitor) {
47212 return {
47213 isOver: monitor.isOver(),
47214 canDrop: monitor.canDrop()
47215 };
47216 }
47217 }),
47218 _useDrop$ = _useDrop[0],
47219 canDrop = _useDrop$.canDrop,
47220 isOver = _useDrop$.isOver,
47221 drop = _useDrop[1];
47222
47223 return React__default.createElement(EmptyList, {
47224 ref: drop,
47225 hover: canDrop && isOver
47226 });
47227};
47228
47229DndEmptyList.displayName = 'DndEmptyList';
47230DndEmptyList.propTypes = {
47231 addFirstItem: PropTypes.func.isRequired
47232};
47233var EmptyList = styled__default.div(_templateObject$1m(), function (_ref2) {
47234 var hover = _ref2.hover,
47235 theme = _ref2.theme;
47236 return hover && theme.dndList.dragOver;
47237});
47238EmptyList.displayName = 'EmptyList';
47239
47240var DndListContainer = function DndListContainer(_ref) {
47241 var items = _ref.items,
47242 Component = _ref.container,
47243 onItemChange = _ref.onItemChange,
47244 onNewItem = _ref.onNewItem,
47245 props = objectWithoutPropertiesLoose(_ref, ["items", "container", "onItemChange", "onNewItem"]);
47246
47247 var _useState = React.useState(items),
47248 itemsArr = _useState[0],
47249 setItemsArr = _useState[1];
47250
47251 var _useState2 = React.useState(-1),
47252 newItemIndex = _useState2[0],
47253 setNewItemIndex = _useState2[1];
47254
47255 React.useEffect(function () {
47256 setItemsArr([].concat(items));
47257 setNewItemIndex(-1);
47258 }, [JSON.stringify(items)]);
47259
47260 var moveItem = function moveItem(index, atIndex) {
47261 itemsArr.splice(atIndex, 0, itemsArr.splice(index, 1)[0]);
47262 setItemsArr([].concat(itemsArr));
47263 };
47264
47265 var dragComplete = function dragComplete(index, item) {
47266 newItemIndex !== -1 ? setTimeout(function () {
47267 return onNewItem(item, index);
47268 }, 10) : onItemChange(item, index);
47269 };
47270
47271 var changedNewItemHandler = function changedNewItemHandler(index, item) {
47272 if (index === -1) itemsArr.splice(newItemIndex, 1);else if (newItemIndex === -1) itemsArr.splice(index, 0, _extends_1({}, item, {
47273 id: -1,
47274 index: index
47275 }));else itemsArr.splice(index, 0, itemsArr.splice(newItemIndex, 1)[0]);
47276 setItemsArr([].concat(itemsArr));
47277 setNewItemIndex(index);
47278 };
47279
47280 var addFirstItem = function addFirstItem(item) {
47281 setItemsArr([item]);
47282 onNewItem(item, 0);
47283 };
47284
47285 return items.length ? itemsArr.map(function (item, index) {
47286 return React__default.createElement(DndListRow, _extends_1({
47287 isNewItem: index === newItemIndex,
47288 changedNewItem: changedNewItemHandler,
47289 key: item.id,
47290 index: index,
47291 id: item.id,
47292 moveItem: moveItem,
47293 dragComplete: dragComplete
47294 }, props), React__default.createElement(Component, {
47295 item: item,
47296 index: index
47297 }));
47298 }) : React__default.createElement(DndEmptyList, {
47299 addFirstItem: addFirstItem
47300 });
47301};
47302
47303DndListContainer.propTypes = {
47304 items: PropTypes.arrayOf(PropTypes.shape({
47305 id: PropTypes.number.isRequired
47306 })).isRequired,
47307 container: PropTypes.func.isRequired,
47308 onItemChange: PropTypes.func.isRequired,
47309 onNewItem: PropTypes.func.isRequired
47310};
47311
47312var DndProvider = createCommonjsModule(function (module, exports) {
47313var __rest = (commonjsGlobal && commonjsGlobal.__rest) || function (s, e) {
47314 var t = {};
47315 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
47316 t[p] = s[p];
47317 if (s != null && typeof Object.getOwnPropertySymbols === "function")
47318 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
47319 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
47320 t[p[i]] = s[p[i]];
47321 }
47322 return t;
47323};
47324var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
47325 if (mod && mod.__esModule) return mod;
47326 var result = {};
47327 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
47328 result["default"] = mod;
47329 return result;
47330};
47331Object.defineProperty(exports, "__esModule", { value: true });
47332var React$$1 = __importStar(React__default);
47333var react_1 = React__default;
47334
47335/**
47336 * A React component that provides the React-DnD context
47337 */
47338exports.DndProvider = react_1.memo(function (_a) {
47339 var children = _a.children, props = __rest(_a, ["children"]);
47340 var context = 'manager' in props
47341 ? { dragDropManager: props.manager }
47342 : createSingletonDndContext(props.backend, props.context, props.options, props.debugMode);
47343 return React$$1.createElement(DndContext.DndContext.Provider, { value: context }, children);
47344});
47345var instanceSymbol = Symbol.for('__REACT_DND_CONTEXT_INSTANCE__');
47346function createSingletonDndContext(backend, context, options, debugMode) {
47347 if (context === void 0) { context = getGlobalContext(); }
47348 var ctx = context;
47349 if (!ctx[instanceSymbol]) {
47350 ctx[instanceSymbol] = DndContext.createDndContext(backend, context, options, debugMode);
47351 }
47352 return ctx[instanceSymbol];
47353}
47354function getGlobalContext() {
47355 return typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : window;
47356}
47357});
47358
47359unwrapExports(DndProvider);
47360var DndProvider_1 = DndProvider.DndProvider;
47361
47362var js_utils$2 = createCommonjsModule(function (module, exports) {
47363// cheap lodash replacements
47364Object.defineProperty(exports, "__esModule", { value: true });
47365function memoize(fn) {
47366 var result = null;
47367 var memoized = function () {
47368 if (result == null) {
47369 result = fn();
47370 }
47371 return result;
47372 };
47373 return memoized;
47374}
47375exports.memoize = memoize;
47376/**
47377 * drop-in replacement for _.without
47378 */
47379function without(items, item) {
47380 return items.filter(function (i) { return i !== item; });
47381}
47382exports.without = without;
47383function union(itemsA, itemsB) {
47384 var set = new Set();
47385 var insertItem = function (item) { return set.add(item); };
47386 itemsA.forEach(insertItem);
47387 itemsB.forEach(insertItem);
47388 var result = [];
47389 set.forEach(function (key) { return result.push(key); });
47390 return result;
47391}
47392exports.union = union;
47393});
47394
47395unwrapExports(js_utils$2);
47396var js_utils_1$1 = js_utils$2.memoize;
47397var js_utils_2$1 = js_utils$2.without;
47398var js_utils_3$1 = js_utils$2.union;
47399
47400var EnterLeaveCounter_1 = createCommonjsModule(function (module, exports) {
47401Object.defineProperty(exports, "__esModule", { value: true });
47402
47403var EnterLeaveCounter = /** @class */ (function () {
47404 function EnterLeaveCounter(isNodeInDocument) {
47405 this.entered = [];
47406 this.isNodeInDocument = isNodeInDocument;
47407 }
47408 EnterLeaveCounter.prototype.enter = function (enteringNode) {
47409 var _this = this;
47410 var previousLength = this.entered.length;
47411 var isNodeEntered = function (node) {
47412 return _this.isNodeInDocument(node) &&
47413 (!node.contains || node.contains(enteringNode));
47414 };
47415 this.entered = js_utils$2.union(this.entered.filter(isNodeEntered), [enteringNode]);
47416 return previousLength === 0 && this.entered.length > 0;
47417 };
47418 EnterLeaveCounter.prototype.leave = function (leavingNode) {
47419 var previousLength = this.entered.length;
47420 this.entered = js_utils$2.without(this.entered.filter(this.isNodeInDocument), leavingNode);
47421 return previousLength > 0 && this.entered.length === 0;
47422 };
47423 EnterLeaveCounter.prototype.reset = function () {
47424 this.entered = [];
47425 };
47426 return EnterLeaveCounter;
47427}());
47428exports.default = EnterLeaveCounter;
47429});
47430
47431unwrapExports(EnterLeaveCounter_1);
47432
47433var BrowserDetector = createCommonjsModule(function (module, exports) {
47434Object.defineProperty(exports, "__esModule", { value: true });
47435
47436exports.isFirefox = js_utils$2.memoize(function () {
47437 return /firefox/i.test(navigator.userAgent);
47438});
47439exports.isSafari = js_utils$2.memoize(function () { return Boolean(window.safari); });
47440});
47441
47442unwrapExports(BrowserDetector);
47443var BrowserDetector_1 = BrowserDetector.isFirefox;
47444var BrowserDetector_2 = BrowserDetector.isSafari;
47445
47446var MonotonicInterpolant_1 = createCommonjsModule(function (module, exports) {
47447Object.defineProperty(exports, "__esModule", { value: true });
47448var MonotonicInterpolant = /** @class */ (function () {
47449 function MonotonicInterpolant(xs, ys) {
47450 var length = xs.length;
47451 // Rearrange xs and ys so that xs is sorted
47452 var indexes = [];
47453 for (var i = 0; i < length; i++) {
47454 indexes.push(i);
47455 }
47456 indexes.sort(function (a, b) { return (xs[a] < xs[b] ? -1 : 1); });
47457 var dxs = [];
47458 var ms = [];
47459 var dx;
47460 var dy;
47461 for (var i = 0; i < length - 1; i++) {
47462 dx = xs[i + 1] - xs[i];
47463 dy = ys[i + 1] - ys[i];
47464 dxs.push(dx);
47465 ms.push(dy / dx);
47466 }
47467 // Get degree-1 coefficients
47468 var c1s = [ms[0]];
47469 for (var i = 0; i < dxs.length - 1; i++) {
47470 var m2 = ms[i];
47471 var mNext = ms[i + 1];
47472 if (m2 * mNext <= 0) {
47473 c1s.push(0);
47474 }
47475 else {
47476 dx = dxs[i];
47477 var dxNext = dxs[i + 1];
47478 var common$$1 = dx + dxNext;
47479 c1s.push((3 * common$$1) / ((common$$1 + dxNext) / m2 + (common$$1 + dx) / mNext));
47480 }
47481 }
47482 c1s.push(ms[ms.length - 1]);
47483 // Get degree-2 and degree-3 coefficients
47484 var c2s = [];
47485 var c3s = [];
47486 var m;
47487 for (var i = 0; i < c1s.length - 1; i++) {
47488 m = ms[i];
47489 var c1 = c1s[i];
47490 var invDx = 1 / dxs[i];
47491 var common$$1 = c1 + c1s[i + 1] - m - m;
47492 c2s.push((m - c1 - common$$1) * invDx);
47493 c3s.push(common$$1 * invDx * invDx);
47494 }
47495 this.xs = xs;
47496 this.ys = ys;
47497 this.c1s = c1s;
47498 this.c2s = c2s;
47499 this.c3s = c3s;
47500 }
47501 MonotonicInterpolant.prototype.interpolate = function (x) {
47502 var _a = this, xs = _a.xs, ys = _a.ys, c1s = _a.c1s, c2s = _a.c2s, c3s = _a.c3s;
47503 // The rightmost point in the dataset should give an exact result
47504 var i = xs.length - 1;
47505 if (x === xs[i]) {
47506 return ys[i];
47507 }
47508 // Search for the interval x is in, returning the corresponding y if x is one of the original xs
47509 var low = 0;
47510 var high = c3s.length - 1;
47511 var mid;
47512 while (low <= high) {
47513 mid = Math.floor(0.5 * (low + high));
47514 var xHere = xs[mid];
47515 if (xHere < x) {
47516 low = mid + 1;
47517 }
47518 else if (xHere > x) {
47519 high = mid - 1;
47520 }
47521 else {
47522 return ys[mid];
47523 }
47524 }
47525 i = Math.max(0, high);
47526 // Interpolate
47527 var diff = x - xs[i];
47528 var diffSq = diff * diff;
47529 return ys[i] + c1s[i] * diff + c2s[i] * diffSq + c3s[i] * diff * diffSq;
47530 };
47531 return MonotonicInterpolant;
47532}());
47533exports.default = MonotonicInterpolant;
47534});
47535
47536unwrapExports(MonotonicInterpolant_1);
47537
47538var OffsetUtils = createCommonjsModule(function (module, exports) {
47539var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
47540 return (mod && mod.__esModule) ? mod : { "default": mod };
47541};
47542Object.defineProperty(exports, "__esModule", { value: true });
47543
47544var MonotonicInterpolant_1$$1 = __importDefault(MonotonicInterpolant_1);
47545var ELEMENT_NODE = 1;
47546function getNodeClientOffset(node) {
47547 var el = node.nodeType === ELEMENT_NODE ? node : node.parentElement;
47548 if (!el) {
47549 return null;
47550 }
47551 var _a = el.getBoundingClientRect(), top = _a.top, left = _a.left;
47552 return { x: left, y: top };
47553}
47554exports.getNodeClientOffset = getNodeClientOffset;
47555function getEventClientOffset(e) {
47556 return {
47557 x: e.clientX,
47558 y: e.clientY,
47559 };
47560}
47561exports.getEventClientOffset = getEventClientOffset;
47562function isImageNode(node) {
47563 return (node.nodeName === 'IMG' &&
47564 (BrowserDetector.isFirefox() || !document.documentElement.contains(node)));
47565}
47566function getDragPreviewSize(isImage, dragPreview, sourceWidth, sourceHeight) {
47567 var dragPreviewWidth = isImage ? dragPreview.width : sourceWidth;
47568 var dragPreviewHeight = isImage ? dragPreview.height : sourceHeight;
47569 // Work around @2x coordinate discrepancies in browsers
47570 if (BrowserDetector.isSafari() && isImage) {
47571 dragPreviewHeight /= window.devicePixelRatio;
47572 dragPreviewWidth /= window.devicePixelRatio;
47573 }
47574 return { dragPreviewWidth: dragPreviewWidth, dragPreviewHeight: dragPreviewHeight };
47575}
47576function getDragPreviewOffset(sourceNode, dragPreview, clientOffset, anchorPoint, offsetPoint) {
47577 // The browsers will use the image intrinsic size under different conditions.
47578 // Firefox only cares if it's an image, but WebKit also wants it to be detached.
47579 var isImage = isImageNode(dragPreview);
47580 var dragPreviewNode = isImage ? sourceNode : dragPreview;
47581 var dragPreviewNodeOffsetFromClient = getNodeClientOffset(dragPreviewNode);
47582 var offsetFromDragPreview = {
47583 x: clientOffset.x - dragPreviewNodeOffsetFromClient.x,
47584 y: clientOffset.y - dragPreviewNodeOffsetFromClient.y,
47585 };
47586 var sourceWidth = sourceNode.offsetWidth, sourceHeight = sourceNode.offsetHeight;
47587 var anchorX = anchorPoint.anchorX, anchorY = anchorPoint.anchorY;
47588 var _a = getDragPreviewSize(isImage, dragPreview, sourceWidth, sourceHeight), dragPreviewWidth = _a.dragPreviewWidth, dragPreviewHeight = _a.dragPreviewHeight;
47589 var calculateYOffset = function () {
47590 var interpolantY = new MonotonicInterpolant_1$$1.default([0, 0.5, 1], [
47591 // Dock to the top
47592 offsetFromDragPreview.y,
47593 // Align at the center
47594 (offsetFromDragPreview.y / sourceHeight) * dragPreviewHeight,
47595 // Dock to the bottom
47596 offsetFromDragPreview.y + dragPreviewHeight - sourceHeight,
47597 ]);
47598 var y = interpolantY.interpolate(anchorY);
47599 // Work around Safari 8 positioning bug
47600 if (BrowserDetector.isSafari() && isImage) {
47601 // We'll have to wait for @3x to see if this is entirely correct
47602 y += (window.devicePixelRatio - 1) * dragPreviewHeight;
47603 }
47604 return y;
47605 };
47606 var calculateXOffset = function () {
47607 // Interpolate coordinates depending on anchor point
47608 // If you know a simpler way to do this, let me know
47609 var interpolantX = new MonotonicInterpolant_1$$1.default([0, 0.5, 1], [
47610 // Dock to the left
47611 offsetFromDragPreview.x,
47612 // Align at the center
47613 (offsetFromDragPreview.x / sourceWidth) * dragPreviewWidth,
47614 // Dock to the right
47615 offsetFromDragPreview.x + dragPreviewWidth - sourceWidth,
47616 ]);
47617 return interpolantX.interpolate(anchorX);
47618 };
47619 // Force offsets if specified in the options.
47620 var offsetX = offsetPoint.offsetX, offsetY = offsetPoint.offsetY;
47621 var isManualOffsetX = offsetX === 0 || offsetX;
47622 var isManualOffsetY = offsetY === 0 || offsetY;
47623 return {
47624 x: isManualOffsetX ? offsetX : calculateXOffset(),
47625 y: isManualOffsetY ? offsetY : calculateYOffset(),
47626 };
47627}
47628exports.getDragPreviewOffset = getDragPreviewOffset;
47629});
47630
47631unwrapExports(OffsetUtils);
47632var OffsetUtils_1 = OffsetUtils.getNodeClientOffset;
47633var OffsetUtils_2 = OffsetUtils.getEventClientOffset;
47634var OffsetUtils_3 = OffsetUtils.getDragPreviewOffset;
47635
47636var NativeTypes = createCommonjsModule(function (module, exports) {
47637Object.defineProperty(exports, "__esModule", { value: true });
47638exports.FILE = '__NATIVE_FILE__';
47639exports.URL = '__NATIVE_URL__';
47640exports.TEXT = '__NATIVE_TEXT__';
47641});
47642
47643unwrapExports(NativeTypes);
47644var NativeTypes_1 = NativeTypes.FILE;
47645var NativeTypes_2 = NativeTypes.URL;
47646var NativeTypes_3 = NativeTypes.TEXT;
47647
47648var getDataFromDataTransfer_1 = createCommonjsModule(function (module, exports) {
47649Object.defineProperty(exports, "__esModule", { value: true });
47650function getDataFromDataTransfer(dataTransfer, typesToTry, defaultValue) {
47651 var result = typesToTry.reduce(function (resultSoFar, typeToTry) { return resultSoFar || dataTransfer.getData(typeToTry); }, '');
47652 return result != null ? result : defaultValue;
47653}
47654exports.getDataFromDataTransfer = getDataFromDataTransfer;
47655});
47656
47657unwrapExports(getDataFromDataTransfer_1);
47658var getDataFromDataTransfer_2 = getDataFromDataTransfer_1.getDataFromDataTransfer;
47659
47660var nativeTypesConfig = createCommonjsModule(function (module, exports) {
47661var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
47662 if (mod && mod.__esModule) return mod;
47663 var result = {};
47664 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
47665 result["default"] = mod;
47666 return result;
47667};
47668var _a;
47669Object.defineProperty(exports, "__esModule", { value: true });
47670var NativeTypes$$1 = __importStar(NativeTypes);
47671
47672exports.nativeTypesConfig = (_a = {},
47673 _a[NativeTypes$$1.FILE] = {
47674 exposeProperties: {
47675 files: function (dataTransfer) {
47676 return Array.prototype.slice.call(dataTransfer.files);
47677 },
47678 items: function (dataTransfer) { return dataTransfer.items; },
47679 },
47680 matchesTypes: ['Files'],
47681 },
47682 _a[NativeTypes$$1.URL] = {
47683 exposeProperties: {
47684 urls: function (dataTransfer, matchesTypes) {
47685 return getDataFromDataTransfer_1.getDataFromDataTransfer(dataTransfer, matchesTypes, '').split('\n');
47686 },
47687 },
47688 matchesTypes: ['Url', 'text/uri-list'],
47689 },
47690 _a[NativeTypes$$1.TEXT] = {
47691 exposeProperties: {
47692 text: function (dataTransfer, matchesTypes) {
47693 return getDataFromDataTransfer_1.getDataFromDataTransfer(dataTransfer, matchesTypes, '');
47694 },
47695 },
47696 matchesTypes: ['Text', 'text/plain'],
47697 },
47698 _a);
47699});
47700
47701unwrapExports(nativeTypesConfig);
47702var nativeTypesConfig_1 = nativeTypesConfig.nativeTypesConfig;
47703
47704var NativeDragSource_1 = createCommonjsModule(function (module, exports) {
47705Object.defineProperty(exports, "__esModule", { value: true });
47706var NativeDragSource = /** @class */ (function () {
47707 function NativeDragSource(config) {
47708 var _this = this;
47709 this.config = config;
47710 this.item = {};
47711 Object.keys(this.config.exposeProperties).forEach(function (property) {
47712 Object.defineProperty(_this.item, property, {
47713 configurable: true,
47714 enumerable: true,
47715 get: function () {
47716 // eslint-disable-next-line no-console
47717 console.warn("Browser doesn't allow reading \"" + property + "\" until the drop event.");
47718 return null;
47719 },
47720 });
47721 });
47722 }
47723 NativeDragSource.prototype.mutateItemByReadingDataTransfer = function (dataTransfer) {
47724 var _this = this;
47725 var newProperties = {};
47726 if (dataTransfer) {
47727 Object.keys(this.config.exposeProperties).forEach(function (property) {
47728 newProperties[property] = {
47729 value: _this.config.exposeProperties[property](dataTransfer, _this.config.matchesTypes),
47730 };
47731 });
47732 }
47733 Object.defineProperties(this.item, newProperties);
47734 };
47735 NativeDragSource.prototype.canDrag = function () {
47736 return true;
47737 };
47738 NativeDragSource.prototype.beginDrag = function () {
47739 return this.item;
47740 };
47741 NativeDragSource.prototype.isDragging = function (monitor, handle) {
47742 return handle === monitor.getSourceId();
47743 };
47744 NativeDragSource.prototype.endDrag = function () {
47745 // empty
47746 };
47747 return NativeDragSource;
47748}());
47749exports.NativeDragSource = NativeDragSource;
47750});
47751
47752unwrapExports(NativeDragSource_1);
47753var NativeDragSource_2 = NativeDragSource_1.NativeDragSource;
47754
47755var NativeDragSources = createCommonjsModule(function (module, exports) {
47756Object.defineProperty(exports, "__esModule", { value: true });
47757
47758
47759function createNativeDragSource(type) {
47760 return new NativeDragSource_1.NativeDragSource(nativeTypesConfig.nativeTypesConfig[type]);
47761}
47762exports.createNativeDragSource = createNativeDragSource;
47763function matchNativeItemType(dataTransfer) {
47764 if (!dataTransfer) {
47765 return null;
47766 }
47767 var dataTransferTypes = Array.prototype.slice.call(dataTransfer.types || []);
47768 return (Object.keys(nativeTypesConfig.nativeTypesConfig).filter(function (nativeItemType) {
47769 var matchesTypes = nativeTypesConfig.nativeTypesConfig[nativeItemType].matchesTypes;
47770 return matchesTypes.some(function (t) { return dataTransferTypes.indexOf(t) > -1; });
47771 })[0] || null);
47772}
47773exports.matchNativeItemType = matchNativeItemType;
47774});
47775
47776unwrapExports(NativeDragSources);
47777var NativeDragSources_1 = NativeDragSources.createNativeDragSource;
47778var NativeDragSources_2 = NativeDragSources.matchNativeItemType;
47779
47780var OptionsReader_1 = createCommonjsModule(function (module, exports) {
47781Object.defineProperty(exports, "__esModule", { value: true });
47782var OptionsReader = /** @class */ (function () {
47783 function OptionsReader(globalContext) {
47784 this.globalContext = globalContext;
47785 }
47786 Object.defineProperty(OptionsReader.prototype, "window", {
47787 get: function () {
47788 if (this.globalContext) {
47789 return this.globalContext;
47790 }
47791 else if (typeof window !== 'undefined') {
47792 return window;
47793 }
47794 return undefined;
47795 },
47796 enumerable: true,
47797 configurable: true
47798 });
47799 Object.defineProperty(OptionsReader.prototype, "document", {
47800 get: function () {
47801 if (this.window) {
47802 return this.window.document;
47803 }
47804 return undefined;
47805 },
47806 enumerable: true,
47807 configurable: true
47808 });
47809 return OptionsReader;
47810}());
47811exports.OptionsReader = OptionsReader;
47812});
47813
47814unwrapExports(OptionsReader_1);
47815var OptionsReader_2 = OptionsReader_1.OptionsReader;
47816
47817var HTML5Backend_1 = createCommonjsModule(function (module, exports) {
47818var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
47819 __assign = Object.assign || function(t) {
47820 for (var s, i = 1, n = arguments.length; i < n; i++) {
47821 s = arguments[i];
47822 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
47823 t[p] = s[p];
47824 }
47825 return t;
47826 };
47827 return __assign.apply(this, arguments);
47828};
47829var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
47830 return (mod && mod.__esModule) ? mod : { "default": mod };
47831};
47832var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
47833 if (mod && mod.__esModule) return mod;
47834 var result = {};
47835 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
47836 result["default"] = mod;
47837 return result;
47838};
47839Object.defineProperty(exports, "__esModule", { value: true });
47840var EnterLeaveCounter_1$$1 = __importDefault(EnterLeaveCounter_1);
47841
47842
47843
47844var NativeTypes$$1 = __importStar(NativeTypes);
47845
47846var HTML5Backend = /** @class */ (function () {
47847 function HTML5Backend(manager, globalContext) {
47848 var _this = this;
47849 this.sourcePreviewNodes = new Map();
47850 this.sourcePreviewNodeOptions = new Map();
47851 this.sourceNodes = new Map();
47852 this.sourceNodeOptions = new Map();
47853 this.dragStartSourceIds = null;
47854 this.dropTargetIds = [];
47855 this.dragEnterTargetIds = [];
47856 this.currentNativeSource = null;
47857 this.currentNativeHandle = null;
47858 this.currentDragSourceNode = null;
47859 this.altKeyPressed = false;
47860 this.mouseMoveTimeoutTimer = null;
47861 this.asyncEndDragFrameId = null;
47862 this.dragOverTargetIds = null;
47863 this.getSourceClientOffset = function (sourceId) {
47864 return OffsetUtils.getNodeClientOffset(_this.sourceNodes.get(sourceId));
47865 };
47866 this.endDragNativeItem = function () {
47867 if (!_this.isDraggingNativeItem()) {
47868 return;
47869 }
47870 _this.actions.endDrag();
47871 _this.registry.removeSource(_this.currentNativeHandle);
47872 _this.currentNativeHandle = null;
47873 _this.currentNativeSource = null;
47874 };
47875 this.isNodeInDocument = function (node) {
47876 // Check the node either in the main document or in the current context
47877 return _this.document && _this.document.body && document.body.contains(node);
47878 };
47879 this.endDragIfSourceWasRemovedFromDOM = function () {
47880 var node = _this.currentDragSourceNode;
47881 if (_this.isNodeInDocument(node)) {
47882 return;
47883 }
47884 if (_this.clearCurrentDragSourceNode()) {
47885 _this.actions.endDrag();
47886 }
47887 };
47888 this.handleTopDragStartCapture = function () {
47889 _this.clearCurrentDragSourceNode();
47890 _this.dragStartSourceIds = [];
47891 };
47892 this.handleTopDragStart = function (e) {
47893 if (e.defaultPrevented) {
47894 return;
47895 }
47896 var dragStartSourceIds = _this.dragStartSourceIds;
47897 _this.dragStartSourceIds = null;
47898 var clientOffset = OffsetUtils.getEventClientOffset(e);
47899 // Avoid crashing if we missed a drop event or our previous drag died
47900 if (_this.monitor.isDragging()) {
47901 _this.actions.endDrag();
47902 }
47903 // Don't publish the source just yet (see why below)
47904 _this.actions.beginDrag(dragStartSourceIds || [], {
47905 publishSource: false,
47906 getSourceClientOffset: _this.getSourceClientOffset,
47907 clientOffset: clientOffset,
47908 });
47909 var dataTransfer = e.dataTransfer;
47910 var nativeType = NativeDragSources.matchNativeItemType(dataTransfer);
47911 if (_this.monitor.isDragging()) {
47912 if (dataTransfer && typeof dataTransfer.setDragImage === 'function') {
47913 // Use custom drag image if user specifies it.
47914 // If child drag source refuses drag but parent agrees,
47915 // use parent's node as drag image. Neither works in IE though.
47916 var sourceId = _this.monitor.getSourceId();
47917 var sourceNode = _this.sourceNodes.get(sourceId);
47918 var dragPreview = _this.sourcePreviewNodes.get(sourceId) || sourceNode;
47919 if (dragPreview) {
47920 var _a = _this.getCurrentSourcePreviewNodeOptions(), anchorX = _a.anchorX, anchorY = _a.anchorY, offsetX = _a.offsetX, offsetY = _a.offsetY;
47921 var anchorPoint = { anchorX: anchorX, anchorY: anchorY };
47922 var offsetPoint = { offsetX: offsetX, offsetY: offsetY };
47923 var dragPreviewOffset = OffsetUtils.getDragPreviewOffset(sourceNode, dragPreview, clientOffset, anchorPoint, offsetPoint);
47924 dataTransfer.setDragImage(dragPreview, dragPreviewOffset.x, dragPreviewOffset.y);
47925 }
47926 }
47927 try {
47928 // Firefox won't drag without setting data
47929 dataTransfer.setData('application/json', {});
47930 }
47931 catch (err) {
47932 // IE doesn't support MIME types in setData
47933 }
47934 // Store drag source node so we can check whether
47935 // it is removed from DOM and trigger endDrag manually.
47936 _this.setCurrentDragSourceNode(e.target);
47937 // Now we are ready to publish the drag source.. or are we not?
47938 var captureDraggingState = _this.getCurrentSourcePreviewNodeOptions().captureDraggingState;
47939 if (!captureDraggingState) {
47940 // Usually we want to publish it in the next tick so that browser
47941 // is able to screenshot the current (not yet dragging) state.
47942 //
47943 // It also neatly avoids a situation where render() returns null
47944 // in the same tick for the source element, and browser freaks out.
47945 setTimeout(function () { return _this.actions.publishDragSource(); }, 0);
47946 }
47947 else {
47948 // In some cases the user may want to override this behavior, e.g.
47949 // to work around IE not supporting custom drag previews.
47950 //
47951 // When using a custom drag layer, the only way to prevent
47952 // the default drag preview from drawing in IE is to screenshot
47953 // the dragging state in which the node itself has zero opacity
47954 // and height. In this case, though, returning null from render()
47955 // will abruptly end the dragging, which is not obvious.
47956 //
47957 // This is the reason such behavior is strictly opt-in.
47958 _this.actions.publishDragSource();
47959 }
47960 }
47961 else if (nativeType) {
47962 // A native item (such as URL) dragged from inside the document
47963 _this.beginDragNativeItem(nativeType);
47964 }
47965 else if (dataTransfer &&
47966 !dataTransfer.types &&
47967 ((e.target && !e.target.hasAttribute) ||
47968 !e.target.hasAttribute('draggable'))) {
47969 // Looks like a Safari bug: dataTransfer.types is null, but there was no draggable.
47970 // Just let it drag. It's a native type (URL or text) and will be picked up in
47971 // dragenter handler.
47972 return;
47973 }
47974 else {
47975 // If by this time no drag source reacted, tell browser not to drag.
47976 e.preventDefault();
47977 }
47978 };
47979 this.handleTopDragEndCapture = function () {
47980 if (_this.clearCurrentDragSourceNode()) {
47981 // Firefox can dispatch this event in an infinite loop
47982 // if dragend handler does something like showing an alert.
47983 // Only proceed if we have not handled it already.
47984 _this.actions.endDrag();
47985 }
47986 };
47987 this.handleTopDragEnterCapture = function (e) {
47988 _this.dragEnterTargetIds = [];
47989 var isFirstEnter = _this.enterLeaveCounter.enter(e.target);
47990 if (!isFirstEnter || _this.monitor.isDragging()) {
47991 return;
47992 }
47993 var dataTransfer = e.dataTransfer;
47994 var nativeType = NativeDragSources.matchNativeItemType(dataTransfer);
47995 if (nativeType) {
47996 // A native item (such as file or URL) dragged from outside the document
47997 _this.beginDragNativeItem(nativeType);
47998 }
47999 };
48000 this.handleTopDragEnter = function (e) {
48001 var dragEnterTargetIds = _this.dragEnterTargetIds;
48002 _this.dragEnterTargetIds = [];
48003 if (!_this.monitor.isDragging()) {
48004 // This is probably a native item type we don't understand.
48005 return;
48006 }
48007 _this.altKeyPressed = e.altKey;
48008 if (!BrowserDetector.isFirefox()) {
48009 // Don't emit hover in `dragenter` on Firefox due to an edge case.
48010 // If the target changes position as the result of `dragenter`, Firefox
48011 // will still happily dispatch `dragover` despite target being no longer
48012 // there. The easy solution is to only fire `hover` in `dragover` on FF.
48013 _this.actions.hover(dragEnterTargetIds, {
48014 clientOffset: OffsetUtils.getEventClientOffset(e),
48015 });
48016 }
48017 var canDrop = dragEnterTargetIds.some(function (targetId) {
48018 return _this.monitor.canDropOnTarget(targetId);
48019 });
48020 if (canDrop) {
48021 // IE requires this to fire dragover events
48022 e.preventDefault();
48023 if (e.dataTransfer) {
48024 e.dataTransfer.dropEffect = _this.getCurrentDropEffect();
48025 }
48026 }
48027 };
48028 this.handleTopDragOverCapture = function () {
48029 _this.dragOverTargetIds = [];
48030 };
48031 this.handleTopDragOver = function (e) {
48032 var dragOverTargetIds = _this.dragOverTargetIds;
48033 _this.dragOverTargetIds = [];
48034 if (!_this.monitor.isDragging()) {
48035 // This is probably a native item type we don't understand.
48036 // Prevent default "drop and blow away the whole document" action.
48037 e.preventDefault();
48038 if (e.dataTransfer) {
48039 e.dataTransfer.dropEffect = 'none';
48040 }
48041 return;
48042 }
48043 _this.altKeyPressed = e.altKey;
48044 _this.actions.hover(dragOverTargetIds || [], {
48045 clientOffset: OffsetUtils.getEventClientOffset(e),
48046 });
48047 var canDrop = (dragOverTargetIds || []).some(function (targetId) {
48048 return _this.monitor.canDropOnTarget(targetId);
48049 });
48050 if (canDrop) {
48051 // Show user-specified drop effect.
48052 e.preventDefault();
48053 if (e.dataTransfer) {
48054 e.dataTransfer.dropEffect = _this.getCurrentDropEffect();
48055 }
48056 }
48057 else if (_this.isDraggingNativeItem()) {
48058 // Don't show a nice cursor but still prevent default
48059 // "drop and blow away the whole document" action.
48060 e.preventDefault();
48061 }
48062 else {
48063 e.preventDefault();
48064 if (e.dataTransfer) {
48065 e.dataTransfer.dropEffect = 'none';
48066 }
48067 }
48068 };
48069 this.handleTopDragLeaveCapture = function (e) {
48070 if (_this.isDraggingNativeItem()) {
48071 e.preventDefault();
48072 }
48073 var isLastLeave = _this.enterLeaveCounter.leave(e.target);
48074 if (!isLastLeave) {
48075 return;
48076 }
48077 if (_this.isDraggingNativeItem()) {
48078 _this.endDragNativeItem();
48079 }
48080 };
48081 this.handleTopDropCapture = function (e) {
48082 _this.dropTargetIds = [];
48083 e.preventDefault();
48084 if (_this.isDraggingNativeItem()) {
48085 _this.currentNativeSource.mutateItemByReadingDataTransfer(e.dataTransfer);
48086 }
48087 _this.enterLeaveCounter.reset();
48088 };
48089 this.handleTopDrop = function (e) {
48090 var dropTargetIds = _this.dropTargetIds;
48091 _this.dropTargetIds = [];
48092 _this.actions.hover(dropTargetIds, {
48093 clientOffset: OffsetUtils.getEventClientOffset(e),
48094 });
48095 _this.actions.drop({ dropEffect: _this.getCurrentDropEffect() });
48096 if (_this.isDraggingNativeItem()) {
48097 _this.endDragNativeItem();
48098 }
48099 else {
48100 _this.endDragIfSourceWasRemovedFromDOM();
48101 }
48102 };
48103 this.handleSelectStart = function (e) {
48104 var target = e.target;
48105 // Only IE requires us to explicitly say
48106 // we want drag drop operation to start
48107 if (typeof target.dragDrop !== 'function') {
48108 return;
48109 }
48110 // Inputs and textareas should be selectable
48111 if (target.tagName === 'INPUT' ||
48112 target.tagName === 'SELECT' ||
48113 target.tagName === 'TEXTAREA' ||
48114 target.isContentEditable) {
48115 return;
48116 }
48117 // For other targets, ask IE
48118 // to enable drag and drop
48119 e.preventDefault();
48120 target.dragDrop();
48121 };
48122 this.options = new OptionsReader_1.OptionsReader(globalContext);
48123 this.actions = manager.getActions();
48124 this.monitor = manager.getMonitor();
48125 this.registry = manager.getRegistry();
48126 this.enterLeaveCounter = new EnterLeaveCounter_1$$1.default(this.isNodeInDocument);
48127 }
48128 Object.defineProperty(HTML5Backend.prototype, "window", {
48129 // public for test
48130 get: function () {
48131 return this.options.window;
48132 },
48133 enumerable: true,
48134 configurable: true
48135 });
48136 Object.defineProperty(HTML5Backend.prototype, "document", {
48137 get: function () {
48138 return this.options.document;
48139 },
48140 enumerable: true,
48141 configurable: true
48142 });
48143 HTML5Backend.prototype.setup = function () {
48144 if (this.window === undefined) {
48145 return;
48146 }
48147 if (this.window.__isReactDndBackendSetUp) {
48148 throw new Error('Cannot have two HTML5 backends at the same time.');
48149 }
48150 this.window.__isReactDndBackendSetUp = true;
48151 this.addEventListeners(this.window);
48152 };
48153 HTML5Backend.prototype.teardown = function () {
48154 if (this.window === undefined) {
48155 return;
48156 }
48157 this.window.__isReactDndBackendSetUp = false;
48158 this.removeEventListeners(this.window);
48159 this.clearCurrentDragSourceNode();
48160 if (this.asyncEndDragFrameId) {
48161 this.window.cancelAnimationFrame(this.asyncEndDragFrameId);
48162 }
48163 };
48164 HTML5Backend.prototype.connectDragPreview = function (sourceId, node, options) {
48165 var _this = this;
48166 this.sourcePreviewNodeOptions.set(sourceId, options);
48167 this.sourcePreviewNodes.set(sourceId, node);
48168 return function () {
48169 _this.sourcePreviewNodes.delete(sourceId);
48170 _this.sourcePreviewNodeOptions.delete(sourceId);
48171 };
48172 };
48173 HTML5Backend.prototype.connectDragSource = function (sourceId, node, options) {
48174 var _this = this;
48175 this.sourceNodes.set(sourceId, node);
48176 this.sourceNodeOptions.set(sourceId, options);
48177 var handleDragStart = function (e) { return _this.handleDragStart(e, sourceId); };
48178 var handleSelectStart = function (e) { return _this.handleSelectStart(e); };
48179 node.setAttribute('draggable', 'true');
48180 node.addEventListener('dragstart', handleDragStart);
48181 node.addEventListener('selectstart', handleSelectStart);
48182 return function () {
48183 _this.sourceNodes.delete(sourceId);
48184 _this.sourceNodeOptions.delete(sourceId);
48185 node.removeEventListener('dragstart', handleDragStart);
48186 node.removeEventListener('selectstart', handleSelectStart);
48187 node.setAttribute('draggable', 'false');
48188 };
48189 };
48190 HTML5Backend.prototype.connectDropTarget = function (targetId, node) {
48191 var _this = this;
48192 var handleDragEnter = function (e) { return _this.handleDragEnter(e, targetId); };
48193 var handleDragOver = function (e) { return _this.handleDragOver(e, targetId); };
48194 var handleDrop = function (e) { return _this.handleDrop(e, targetId); };
48195 node.addEventListener('dragenter', handleDragEnter);
48196 node.addEventListener('dragover', handleDragOver);
48197 node.addEventListener('drop', handleDrop);
48198 return function () {
48199 node.removeEventListener('dragenter', handleDragEnter);
48200 node.removeEventListener('dragover', handleDragOver);
48201 node.removeEventListener('drop', handleDrop);
48202 };
48203 };
48204 HTML5Backend.prototype.addEventListeners = function (target) {
48205 // SSR Fix (https://github.com/react-dnd/react-dnd/pull/813
48206 if (!target.addEventListener) {
48207 return;
48208 }
48209 target.addEventListener('dragstart', this
48210 .handleTopDragStart);
48211 target.addEventListener('dragstart', this.handleTopDragStartCapture, true);
48212 target.addEventListener('dragend', this.handleTopDragEndCapture, true);
48213 target.addEventListener('dragenter', this
48214 .handleTopDragEnter);
48215 target.addEventListener('dragenter', this.handleTopDragEnterCapture, true);
48216 target.addEventListener('dragleave', this.handleTopDragLeaveCapture, true);
48217 target.addEventListener('dragover', this.handleTopDragOver);
48218 target.addEventListener('dragover', this.handleTopDragOverCapture, true);
48219 target.addEventListener('drop', this.handleTopDrop);
48220 target.addEventListener('drop', this.handleTopDropCapture, true);
48221 };
48222 HTML5Backend.prototype.removeEventListeners = function (target) {
48223 // SSR Fix (https://github.com/react-dnd/react-dnd/pull/813
48224 if (!target.removeEventListener) {
48225 return;
48226 }
48227 target.removeEventListener('dragstart', this.handleTopDragStart);
48228 target.removeEventListener('dragstart', this.handleTopDragStartCapture, true);
48229 target.removeEventListener('dragend', this.handleTopDragEndCapture, true);
48230 target.removeEventListener('dragenter', this
48231 .handleTopDragEnter);
48232 target.removeEventListener('dragenter', this.handleTopDragEnterCapture, true);
48233 target.removeEventListener('dragleave', this.handleTopDragLeaveCapture, true);
48234 target.removeEventListener('dragover', this
48235 .handleTopDragOver);
48236 target.removeEventListener('dragover', this.handleTopDragOverCapture, true);
48237 target.removeEventListener('drop', this.handleTopDrop);
48238 target.removeEventListener('drop', this.handleTopDropCapture, true);
48239 };
48240 HTML5Backend.prototype.getCurrentSourceNodeOptions = function () {
48241 var sourceId = this.monitor.getSourceId();
48242 var sourceNodeOptions = this.sourceNodeOptions.get(sourceId);
48243 return __assign({ dropEffect: this.altKeyPressed ? 'copy' : 'move' }, (sourceNodeOptions || {}));
48244 };
48245 HTML5Backend.prototype.getCurrentDropEffect = function () {
48246 if (this.isDraggingNativeItem()) {
48247 // It makes more sense to default to 'copy' for native resources
48248 return 'copy';
48249 }
48250 return this.getCurrentSourceNodeOptions().dropEffect;
48251 };
48252 HTML5Backend.prototype.getCurrentSourcePreviewNodeOptions = function () {
48253 var sourceId = this.monitor.getSourceId();
48254 var sourcePreviewNodeOptions = this.sourcePreviewNodeOptions.get(sourceId);
48255 return __assign({ anchorX: 0.5, anchorY: 0.5, captureDraggingState: false }, (sourcePreviewNodeOptions || {}));
48256 };
48257 HTML5Backend.prototype.isDraggingNativeItem = function () {
48258 var itemType = this.monitor.getItemType();
48259 return Object.keys(NativeTypes$$1).some(function (key) { return NativeTypes$$1[key] === itemType; });
48260 };
48261 HTML5Backend.prototype.beginDragNativeItem = function (type) {
48262 this.clearCurrentDragSourceNode();
48263 this.currentNativeSource = NativeDragSources.createNativeDragSource(type);
48264 this.currentNativeHandle = this.registry.addSource(type, this.currentNativeSource);
48265 this.actions.beginDrag([this.currentNativeHandle]);
48266 };
48267 HTML5Backend.prototype.setCurrentDragSourceNode = function (node) {
48268 var _this = this;
48269 this.clearCurrentDragSourceNode();
48270 this.currentDragSourceNode = node;
48271 // A timeout of > 0 is necessary to resolve Firefox issue referenced
48272 // See:
48273 // * https://github.com/react-dnd/react-dnd/pull/928
48274 // * https://github.com/react-dnd/react-dnd/issues/869
48275 var MOUSE_MOVE_TIMEOUT = 1000;
48276 // Receiving a mouse event in the middle of a dragging operation
48277 // means it has ended and the drag source node disappeared from DOM,
48278 // so the browser didn't dispatch the dragend event.
48279 //
48280 // We need to wait before we start listening for mousemove events.
48281 // This is needed because the drag preview needs to be drawn or else it fires an 'mousemove' event
48282 // immediately in some browsers.
48283 //
48284 // See:
48285 // * https://github.com/react-dnd/react-dnd/pull/928
48286 // * https://github.com/react-dnd/react-dnd/issues/869
48287 //
48288 this.mouseMoveTimeoutTimer = setTimeout(function () {
48289 return (_this.window &&
48290 _this.window.addEventListener('mousemove', _this.endDragIfSourceWasRemovedFromDOM, true));
48291 }, MOUSE_MOVE_TIMEOUT);
48292 };
48293 HTML5Backend.prototype.clearCurrentDragSourceNode = function () {
48294 if (this.currentDragSourceNode) {
48295 this.currentDragSourceNode = null;
48296 if (this.window) {
48297 this.window.clearTimeout(this.mouseMoveTimeoutTimer || undefined);
48298 this.window.removeEventListener('mousemove', this.endDragIfSourceWasRemovedFromDOM, true);
48299 }
48300 this.mouseMoveTimeoutTimer = null;
48301 return true;
48302 }
48303 return false;
48304 };
48305 HTML5Backend.prototype.handleDragStart = function (e, sourceId) {
48306 if (e.defaultPrevented) {
48307 return;
48308 }
48309 if (!this.dragStartSourceIds) {
48310 this.dragStartSourceIds = [];
48311 }
48312 this.dragStartSourceIds.unshift(sourceId);
48313 };
48314 HTML5Backend.prototype.handleDragEnter = function (e, targetId) {
48315 this.dragEnterTargetIds.unshift(targetId);
48316 };
48317 HTML5Backend.prototype.handleDragOver = function (e, targetId) {
48318 if (this.dragOverTargetIds === null) {
48319 this.dragOverTargetIds = [];
48320 }
48321 this.dragOverTargetIds.unshift(targetId);
48322 };
48323 HTML5Backend.prototype.handleDrop = function (e, targetId) {
48324 this.dropTargetIds.unshift(targetId);
48325 };
48326 return HTML5Backend;
48327}());
48328exports.default = HTML5Backend;
48329});
48330
48331unwrapExports(HTML5Backend_1);
48332
48333var getEmptyImage_1 = createCommonjsModule(function (module, exports) {
48334Object.defineProperty(exports, "__esModule", { value: true });
48335var emptyImage;
48336function getEmptyImage() {
48337 if (!emptyImage) {
48338 emptyImage = new Image();
48339 emptyImage.src =
48340 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
48341 }
48342 return emptyImage;
48343}
48344exports.getEmptyImage = getEmptyImage;
48345});
48346
48347unwrapExports(getEmptyImage_1);
48348var getEmptyImage_2 = getEmptyImage_1.getEmptyImage;
48349
48350var lib$2 = createCommonjsModule(function (module, exports) {
48351var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
48352 return (mod && mod.__esModule) ? mod : { "default": mod };
48353};
48354var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
48355 if (mod && mod.__esModule) return mod;
48356 var result = {};
48357 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
48358 result["default"] = mod;
48359 return result;
48360};
48361Object.defineProperty(exports, "__esModule", { value: true });
48362var HTML5Backend_1$$1 = __importDefault(HTML5Backend_1);
48363var NativeTypes$$1 = __importStar(NativeTypes);
48364exports.NativeTypes = NativeTypes$$1;
48365
48366exports.getEmptyImage = getEmptyImage_1.getEmptyImage;
48367var createHTML5Backend = function (manager, context) { return new HTML5Backend_1$$1.default(manager, context); };
48368exports.default = createHTML5Backend;
48369});
48370
48371var HTML5Backend$1 = unwrapExports(lib$2);
48372var lib_1$1 = lib$2.NativeTypes;
48373var lib_2$1 = lib$2.getEmptyImage;
48374
48375var DndHTML5Provider = function DndHTML5Provider(_ref) {
48376 var children = _ref.children;
48377 return React__default.createElement(DndProvider_1, {
48378 backend: HTML5Backend$1
48379 }, children);
48380};
48381
48382DndHTML5Provider.defaultProps = {
48383 children: null
48384};
48385DndHTML5Provider.propTypes = {
48386 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])
48387};
48388
48389var _ref$3 =
48390/*#__PURE__*/
48391React__default.createElement("g", {
48392 clipPath: "url(#clip0)"
48393}, React__default.createElement("path", {
48394 d: "M29.83 121.665L96.144 160V83.33L29.829 44.991v76.673z",
48395 fill: "url(#paint0_linear)"
48396}), React__default.createElement("path", {
48397 d: "M96.144 83.33l66.31-38.338-66.31-38.339V83.33z",
48398 fill: "#1A00BB"
48399}), React__default.createElement("path", {
48400 d: "M29.83 44.992l66.315 38.337V6.653L29.829 44.992z",
48401 fill: "#0B009A"
48402}), React__default.createElement("path", {
48403 d: "M162.454 121.665L96.144 160V83.33l66.31-38.338v76.673z",
48404 fill: "url(#paint1_linear)"
48405}), React__default.createElement("path", {
48406 d: "M64.15 111.361L0 70.586l29.84-25.59 66.305 38.33L64.15 111.36zM129.299 0l64.075 38.08-30.933 6.912L96.144 6.659 129.3 0zM67.12 0L.15 38.08l29.69 6.916L96.144 6.665 67.12 0zM128.648 111.361l64.577-40.775-30.784-25.594L96.144 83.32l32.504 28.04z",
48407 fill: "#DDD"
48408}), React__default.createElement("mask", {
48409 id: "a",
48410 maskUnits: "userSpaceOnUse",
48411 x: 96,
48412 y: 6,
48413 width: 67,
48414 height: 78
48415}, React__default.createElement("path", {
48416 d: "M96.144 83.303l66.31-38.336-66.31-38.336v76.672z",
48417 fill: "url(#paint2_linear)"
48418})), React__default.createElement("g", {
48419 mask: "url(#a)"
48420}, React__default.createElement("path", {
48421 d: "M96.144 83.303l66.31-38.336-66.31-38.336v76.672z",
48422 fill: "#0C00A9"
48423})), React__default.createElement("path", {
48424 d: "M113.812 73.113L96.144 83.329V6.608l17.668 66.506z",
48425 fill: "#14008C"
48426}));
48427
48428var _ref2$2 =
48429/*#__PURE__*/
48430React__default.createElement("defs", null, React__default.createElement("linearGradient", {
48431 id: "paint0_linear",
48432 x1: 80.904,
48433 y1: 90.909,
48434 x2: 34.389,
48435 y2: 120.908,
48436 gradientUnits: "userSpaceOnUse"
48437}, React__default.createElement("stop", {
48438 offset: 0,
48439 stopColor: "#0D0CB5"
48440}), React__default.createElement("stop", {
48441 offset: 0.996,
48442 stopColor: "#005BEA"
48443})), React__default.createElement("linearGradient", {
48444 id: "paint1_linear",
48445 x1: 129.3,
48446 y1: 83.82,
48447 x2: 129.3,
48448 y2: 171.142,
48449 gradientUnits: "userSpaceOnUse"
48450}, React__default.createElement("stop", {
48451 offset: 0,
48452 stopColor: "#0D0CB5"
48453}), React__default.createElement("stop", {
48454 offset: 0.996,
48455 stopColor: "#005BEA"
48456})), React__default.createElement("linearGradient", {
48457 id: "paint2_linear",
48458 x1: 54.966,
48459 y1: 115.656,
48460 x2: 129.024,
48461 y2: 26.37,
48462 gradientUnits: "userSpaceOnUse"
48463}, React__default.createElement("stop", {
48464 stopColor: "#fff"
48465}), React__default.createElement("stop", {
48466 offset: 1
48467})), React__default.createElement("clipPath", {
48468 id: "clip0"
48469}, React__default.createElement("path", {
48470 fill: "#fff",
48471 d: "M0 0h193.374v160H0z"
48472})));
48473
48474var boxImage = 'data:image/svg+xml,%3Csvg%20width%3D%22194%22%20height%3D%22160%22%20viewBox%3D%220%200%20194%20160%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%20%20%3Cg%20clip-path%3D%22url%28%23clip0%29%22%3E%20%20%3Cpath%20d%3D%22M29.8291%20121.665L96.1446%20160V83.3294L29.8291%2044.9919V121.665Z%22%20fill%3D%22url%28%23paint0_linear%29%22%2F%3E%20%20%3Cpath%20d%3D%22M96.1445%2083.3294L162.454%2044.992L96.1445%206.65308V83.3294Z%22%20fill%3D%22%231A00BB%22%2F%3E%20%20%3Cpath%20d%3D%22M29.8291%2044.992L96.1446%2083.3294V6.65308L29.8291%2044.992Z%22%20fill%3D%22%230B009A%22%2F%3E%20%20%3Cpath%20d%3D%22M162.454%20121.665L96.1445%20160V83.3294L162.454%2044.9919V121.665Z%22%20fill%3D%22url%28%23paint1_linear%29%22%2F%3E%20%20%3Cpath%20d%3D%22M64.1496%20111.361L0%2070.5862L29.8407%2044.9963L96.1446%2083.3251L64.1496%20111.361Z%22%20fill%3D%22%23DDDDDD%22%2F%3E%20%20%3Cpath%20d%3D%22M129.299%200L193.374%2038.08L162.441%2044.992L96.1445%206.65891L129.299%200Z%22%20fill%3D%22%23DDDDDD%22%2F%3E%20%20%3Cpath%20d%3D%22M67.12%200L0.150879%2038.08L29.8405%2044.9964L96.1444%206.66473L67.12%200Z%22%20fill%3D%22%23DDDDDD%22%2F%3E%20%20%3Cpath%20d%3D%22M128.648%20111.361L193.225%2070.5861L162.441%2044.9919L96.1445%2083.3207L128.648%20111.361Z%22%20fill%3D%22%23DDDDDD%22%2F%3E%20%20%3Cmask%20id%3D%22mask0%22%20mask-type%3D%22alpha%22%20maskUnits%3D%22userSpaceOnUse%22%20x%3D%2296%22%20y%3D%226%22%20width%3D%2267%22%20height%3D%2278%22%3E%20%20%3Cpath%20d%3D%22M96.1445%2083.3034L162.454%2044.9674L96.1445%206.63135V83.3034Z%22%20fill%3D%22url%28%23paint2_linear%29%22%2F%3E%20%20%3C%2Fmask%3E%20%20%3Cg%20mask%3D%22url%28%23mask0%29%22%3E%20%20%3Cpath%20d%3D%22M96.1445%2083.3034L162.454%2044.9674L96.1445%206.63135V83.3034Z%22%20fill%3D%22%230C00A9%22%2F%3E%20%20%3C%2Fg%3E%20%20%3Cpath%20d%3D%22M113.812%2073.1127L96.1445%2083.3295V6.60657L113.812%2073.1127Z%22%20fill%3D%22%2314008C%22%2F%3E%20%20%3C%2Fg%3E%20%20%3Cdefs%3E%20%20%3ClinearGradient%20id%3D%22paint0_linear%22%20x1%3D%2280.9043%22%20y1%3D%2290.909%22%20x2%3D%2234.3888%22%20y2%3D%22120.908%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%20%20%3Cstop%20offset%3D%220.00027743%22%20stop-color%3D%22%230D0CB5%22%2F%3E%20%20%3Cstop%20offset%3D%220.9964%22%20stop-color%3D%22%23005BEA%22%2F%3E%20%20%3C%2FlinearGradient%3E%20%20%3ClinearGradient%20id%3D%22paint1_linear%22%20x1%3D%22129.3%22%20y1%3D%2283.8196%22%20x2%3D%22129.3%22%20y2%3D%22171.142%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%20%20%3Cstop%20offset%3D%220.00027743%22%20stop-color%3D%22%230D0CB5%22%2F%3E%20%20%3Cstop%20offset%3D%220.9964%22%20stop-color%3D%22%23005BEA%22%2F%3E%20%20%3C%2FlinearGradient%3E%20%20%3ClinearGradient%20id%3D%22paint2_linear%22%20x1%3D%2254.966%22%20y1%3D%22115.656%22%20x2%3D%22129.024%22%20y2%3D%2226.3697%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%20%20%3Cstop%20stop-color%3D%22white%22%2F%3E%20%20%3Cstop%20offset%3D%221%22%2F%3E%20%20%3C%2FlinearGradient%3E%20%20%3CclipPath%20id%3D%22clip0%22%3E%20%20%3Crect%20width%3D%22193.374%22%20height%3D%22160%22%20fill%3D%22white%22%2F%3E%20%20%3C%2FclipPath%3E%20%20%3C%2Fdefs%3E%3C%2Fsvg%3E';
48475
48476function _templateObject4$g() {
48477 var data = taggedTemplateLiteralLoose(["\n\tmax-width: 350px;\n\tmargin: 16px 0 20px 0;\n\tcolor: ", ";\n\tfont-size: 13px;\n\ttext-align: center;\n"]);
48478
48479 _templateObject4$g = function _templateObject4() {
48480 return data;
48481 };
48482
48483 return data;
48484}
48485
48486function _templateObject3$l() {
48487 var data = taggedTemplateLiteralLoose(["\n\tcolor: ", ";\n\tfont-size: 18px;\n\tfont-weight: bold;\n\ttext-align: center;\n"]);
48488
48489 _templateObject3$l = function _templateObject3() {
48490 return data;
48491 };
48492
48493 return data;
48494}
48495
48496function _templateObject2$w() {
48497 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n"]);
48498
48499 _templateObject2$w = function _templateObject2() {
48500 return data;
48501 };
48502
48503 return data;
48504}
48505
48506function _templateObject$1n() {
48507 var data = taggedTemplateLiteralLoose(["\n\tmargin: 40px 0;\n"]);
48508
48509 _templateObject$1n = function _templateObject() {
48510 return data;
48511 };
48512
48513 return data;
48514}
48515
48516var EmptyState = function EmptyState(_ref) {
48517 var image = _ref.image,
48518 hasImage = _ref.hasImage,
48519 title = _ref.title,
48520 description = _ref.description,
48521 component = _ref.component;
48522 return React__default.createElement(Center, null, hasImage && React__default.createElement(ImageStyled, {
48523 src: image,
48524 alt: "box"
48525 }), React__default.createElement(Title$3, null, title), React__default.createElement(Description, null, description), component && component());
48526};
48527
48528var ImageStyled = styled__default.img(_templateObject$1n());
48529var Center = styled__default.div(_templateObject2$w());
48530var Title$3 = styled__default.div(_templateObject3$l(), function (_ref2) {
48531 var theme = _ref2.theme;
48532 return theme.colors.darkGray;
48533});
48534var Description = styled__default.div(_templateObject4$g(), function (_ref3) {
48535 var theme = _ref3.theme;
48536 return theme.colors.mediumGray;
48537});
48538EmptyState.defaultProps = {
48539 title: 'No results found',
48540 description: 'We could not find any matching results, try search for another service, queue or product',
48541 image: boxImage,
48542 hasImage: true,
48543 component: null
48544};
48545EmptyState.displayName = 'EmptyState';
48546EmptyState.propTypes = {
48547 /** Component element */
48548 component: PropTypes.func,
48549
48550 /** Title of the emptyState */
48551 title: PropTypes.string,
48552
48553 /** Description of the emptyState */
48554 description: PropTypes.string,
48555
48556 /** The main image of the emptyState */
48557 image: PropTypes.string,
48558
48559 /** Bool to render image */
48560 hasImage: PropTypes.bool
48561 /** @component * */
48562
48563};
48564
48565function _templateObject$1o() {
48566 var data = taggedTemplateLiteralLoose(["\n\tdisplay: ", ";\n\twidth: 100%;\n\tpadding: 6px 15px;\n\n\tbackground: ", ";\n\tfont-weight: ", ";\n\tborder-radius: 4px;\n\tcolor: ", ";\n\tfont-size: 12px;\n"]);
48567
48568 _templateObject$1o = function _templateObject() {
48569 return data;
48570 };
48571
48572 return data;
48573}
48574var StatusMessage = styled__default.div(_templateObject$1o(), function (_ref) {
48575 var show = _ref.show;
48576 return show ? 'block' : 'none';
48577}, function (_ref2) {
48578 var theme = _ref2.theme,
48579 type = _ref2.type;
48580 return theme.status.bg[type];
48581}, function (_ref3) {
48582 var type = _ref3.type;
48583 return type === 'blocked' && 'bold';
48584}, function (_ref4) {
48585 var theme = _ref4.theme,
48586 type = _ref4.type;
48587 return theme.status.color[type];
48588});
48589StatusMessage.defaultProps = {
48590 show: false,
48591 children: 'Saving changes...',
48592 type: 'info'
48593};
48594StatusMessage.propTypes = {
48595 /** display status */
48596 show: PropTypes.bool,
48597
48598 /** message display on status */
48599 type: PropTypes.oneOf(['success', 'error', 'info', 'blocked']),
48600
48601 /** type of status */
48602 children: PropTypes.string
48603};
48604StatusMessage.displayName = 'StatusMessage';
48605
48606function _templateObject$1p() {
48607 var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-block;\n\twidth: 6px;\n\theight: 6px;\n\tbackground-color: ", ";\n\tborder-radius: 50%;\n"]);
48608
48609 _templateObject$1p = function _templateObject() {
48610 return data;
48611 };
48612
48613 return data;
48614}
48615var states = ['on', 'off', 'away'];
48616var BulletState = styled__default.span(_templateObject$1p(), function (_ref) {
48617 var theme = _ref.theme,
48618 state = _ref.state;
48619 return theme.bulletState.colors[state];
48620});
48621BulletState.propTypes = {
48622 state: PropTypes.oneOf(states).isRequired
48623};
48624BulletState.displayName = 'BulletState';
48625
48626function _templateObject$1q() {
48627 var data = taggedTemplateLiteralLoose(["\n\t:after {\n\t\tcontent: ", ";\n\t}\n"]);
48628
48629 _templateObject$1q = function _templateObject() {
48630 return data;
48631 };
48632
48633 return data;
48634}
48635
48636var getArrowContent = function getArrowContent(sortable, direction, isSorted) {
48637 if (sortable === 'true') {
48638 if (isSorted) {
48639 if (direction === 'ascending') {
48640 return '"\\F0D8"';
48641 }
48642
48643 return '"\\F0D7"';
48644 }
48645
48646 return '"\\F0DA"';
48647 }
48648
48649 return 'none';
48650};
48651
48652var getDirection = function getDirection(direction, isSorted) {
48653 return isSorted && direction === 'ascending' ? 'descending' : 'ascending';
48654};
48655
48656var HeaderCell = function HeaderCell(_ref) {
48657 var cell = _ref.cell,
48658 sortable = _ref.sortable,
48659 direction = _ref.direction,
48660 sortHandler = _ref.sortHandler,
48661 isSorted = _ref.isSorted,
48662 children = _ref.children,
48663 props = objectWithoutPropertiesLoose(_ref, ["cell", "sortable", "direction", "sortHandler", "isSorted", "children"]);
48664
48665 return React__default.createElement(HeaderCellStyled, _extends_1({
48666 sorted: sortable ? direction || 'ascending' : null,
48667 sortable: sortable.toString(),
48668 direction: direction,
48669 onClick: function onClick() {
48670 return sortable && sortHandler(_extends_1({}, cell, {
48671 direction: getDirection(direction, isSorted)
48672 }));
48673 },
48674 isSorted: isSorted
48675 }, props), children);
48676};
48677
48678var HeaderCellStyled = styled__default(function (_ref2) {
48679 var sortable = _ref2.sortable,
48680 direction = _ref2.direction,
48681 isSorted = _ref2.isSorted,
48682 props = objectWithoutPropertiesLoose(_ref2, ["sortable", "direction", "isSorted"]);
48683
48684 return React__default.createElement(semanticUiReact.Table.HeaderCell, props);
48685})(_templateObject$1q(), function (_ref3) {
48686 var sortable = _ref3.sortable,
48687 direction = _ref3.direction,
48688 isSorted = _ref3.isSorted;
48689 return getArrowContent(sortable, direction, isSorted) + " !important";
48690});
48691HeaderCell.displayName = 'HeaderCell';
48692HeaderCell.defaultProps = {
48693 sortable: true,
48694 direction: null,
48695 isSorted: false
48696};
48697HeaderCell.propTypes = {
48698 cell: PropTypes.shape({
48699 value: PropTypes.string,
48700 sortable: PropTypes.bool,
48701 width: PropTypes.number
48702 }).isRequired,
48703 sortable: PropTypes.bool,
48704 isSorted: PropTypes.bool,
48705 direction: PropTypes.string,
48706 sortHandler: PropTypes.func.isRequired,
48707 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
48708};
48709
48710function _templateObject$1r() {
48711 var data = taggedTemplateLiteralLoose(["\n\tbackground: linear-gradient(90deg, #6a11cb 0%, rgba(255, 255, 255, 0) 100%), #0d0cb5 !important;\n\n\t& th {\n\t\theight: 22px;\n\t\tpadding: 0 11px !important;\n\t\tborder-bottom: none !important;\n\t\tbackground: rgba(0, 0, 0, 0.05) !important;\n\t\tcolor: white !important;\n\t\tfont-size: 13px;\n\t}\n\n\tth:first-child {\n\t\tborder-bottom-left-radius: 4px !important;\n\t\tborder-top-left-radius: 4px !important;\n\t}\n\n\tth:last-child {\n\t\tborder-bottom-right-radius: 4px !important;\n\t\tborder-top-right-radius: 4px !important;\n\t}\n\n\tth:not(:first-child) {\n\t\tborder-left-color: white !important;\n\t}\n"]);
48712
48713 _templateObject$1r = function _templateObject() {
48714 return data;
48715 };
48716
48717 return data;
48718}
48719
48720var TableHeader = function TableHeader(_ref) {
48721 var headers = _ref.headers,
48722 columnSorted = _ref.columnSorted,
48723 direction = _ref.direction,
48724 sortHandler = _ref.sortHandler,
48725 props = objectWithoutPropertiesLoose(_ref, ["headers", "columnSorted", "direction", "sortHandler"]);
48726
48727 return React__default.createElement(Header$2, props, React__default.createElement(semanticUiReact.Table.Row, null, headers.map(function (obj) {
48728 var value = obj.value,
48729 sortable = obj.sortable,
48730 style = obj.style;
48731 return React__default.createElement(HeaderCell, {
48732 key: value,
48733 cell: obj,
48734 sortable: sortable,
48735 sortHandler: sortHandler,
48736 isSorted: columnSorted === value,
48737 direction: direction,
48738 style: style
48739 }, value);
48740 })));
48741};
48742
48743TableHeader.defaultProps = {
48744 columnSorted: '',
48745 direction: null
48746};
48747TableHeader.displayName = 'TableHeader';
48748TableHeader.propTypes = {
48749 headers: PropTypes.arrayOf(PropTypes.shape({
48750 value: PropTypes.string,
48751 sortable: PropTypes.bool,
48752 style: PropTypes.shape({})
48753 })).isRequired,
48754 columnSorted: PropTypes.string,
48755 direction: PropTypes.string,
48756 sortHandler: PropTypes.func.isRequired
48757};
48758var Header$2 = styled__default(semanticUiReact.Table.Header)(_templateObject$1r());
48759
48760function _templateObject$1s() {
48761 var data = taggedTemplateLiteralLoose(["\n\ttr:first-child {\n\t\theight: 8px;\n\t\tborder: none;\n\t\toutline: thin solid transparent;\n\t}\n\n\ttd {\n\t\tborder-top: none !important;\n\t\tborder-bottom: none !important;\n\t}\n"]);
48762
48763 _templateObject$1s = function _templateObject() {
48764 return data;
48765 };
48766
48767 return data;
48768}
48769
48770var TableBody = function TableBody(_ref) {
48771 var children = _ref.children,
48772 props = objectWithoutPropertiesLoose(_ref, ["children"]);
48773
48774 return React__default.createElement(TableBodyStyled, props, React__default.createElement(semanticUiReact.Table.Row, null), children);
48775};
48776
48777TableBody.displayName = 'TableBody';
48778TableBody.propTypes = {
48779 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
48780};
48781var TableBodyStyled = styled__default(semanticUiReact.Table.Body)(_templateObject$1s());
48782
48783var Table = function Table(_ref) {
48784 var props = _extends_1({}, _ref);
48785
48786 return React__default.createElement(semanticUiReact.Table, _extends_1({
48787 sortable: true,
48788 celled: true,
48789 striped: true,
48790 basic: "very"
48791 }, props));
48792};
48793
48794Table.Header = function (_ref2) {
48795 var props = _extends_1({}, _ref2);
48796
48797 return React__default.createElement(TableHeader, props);
48798};
48799
48800Table.Body = function (_ref3) {
48801 var props = _extends_1({}, _ref3);
48802
48803 return React__default.createElement(TableBody, props);
48804};
48805
48806Table.Row = function (_ref4) {
48807 var props = _extends_1({}, _ref4);
48808
48809 return React__default.createElement(semanticUiReact.Table.Row, props);
48810};
48811
48812Table.Cell = function (_ref5) {
48813 var props = _extends_1({}, _ref5);
48814
48815 return React__default.createElement(semanticUiReact.Table.Cell, props);
48816};
48817
48818Table.defaultProps = {};
48819Table.displayName = 'Table';
48820Table.Header.displayName = 'Table.Header';
48821Table.Body.displayName = 'Table.Body';
48822Table.Row.displayName = 'Table.Row';
48823Table.Cell.displayName = 'Table.Cell';
48824Table.propTypes = {};
48825
48826function _templateObject$1t() {
48827 var data = taggedTemplateLiteralLoose(["\n\tpadding-right: 16px !important;\n\tpadding-left: 16px !important;\n\tbackground-color: ", " !important;\n\tborder-radius: ", " !important;\n\tcolor: ", " !important;\n\n\tcursor: ", " !important;\n\n\t&&&.disabled {\n\t\tbackground-color: ", " !important;\n\t\tcolor: ", " !important;\n\t}\n\n\t&&&.visible {\n\t\tbackground-color: ", " !important;\n\t}\n\n\t&:active {\n\t\tbackground-color: ", " !important;\n\t}\n\n\ti.icon {\n\t\tmargin: 0 !important;\n\t\tmargin-left: 6px !important;\n\t}\n\n\t.visible.menu {\n\t\tmin-width: 90% !important;\n\t\tmargin-top: 2px;\n\t}\n\n\tdiv.item {\n\t\tborder-top: solid 1px ", " !important;\n\t\ttext-align: right !important;\n\t}\n\n\tdiv.item.active {\n\t\tbackground-color: ", " !important;\n\t\tfont-weight: normal !important;\n\t}\n"]);
48828
48829 _templateObject$1t = function _templateObject() {
48830 return data;
48831 };
48832
48833 return data;
48834}
48835/**
48836 * extends react semantic ui default dropdown
48837 * https://react.semantic-ui.com/modules/dropdown/
48838 * dropdown module
48839 */
48840
48841var Dropdown = function Dropdown(_ref) {
48842 var icon = _ref.icon,
48843 text = _ref.text,
48844 options = _ref.options,
48845 props = objectWithoutPropertiesLoose(_ref, ["icon", "text", "options"]);
48846
48847 return React__default.createElement(DropdownStyled, _extends_1({
48848 button: true,
48849 direction: "left",
48850 text: text,
48851 options: options,
48852 icon: React__default.createElement(Icon, {
48853 icon: icon
48854 })
48855 }, props));
48856};
48857
48858Dropdown.defaultProps = {
48859 icon: 'select-down',
48860 text: '',
48861 options: []
48862};
48863Dropdown.propTypes = {
48864 /** icon of type iconName to be displayed (examples: success, add) */
48865 icon: PropTypes.oneOf(IconName),
48866
48867 /** text visible on the button */
48868 text: PropTypes.string,
48869
48870 /** options to show when expanded */
48871 options: PropTypes.arrayOf(PropTypes.shape({
48872 key: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
48873 text: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
48874 value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
48875 }))
48876};
48877Dropdown.displayName = 'Dropdown';
48878var DropdownStyled = styled__default(semanticUiReact.Dropdown)(_templateObject$1t(), function (_ref2) {
48879 var theme = _ref2.theme;
48880 return theme.buttons.bg;
48881}, function (_ref3) {
48882 var theme = _ref3.theme;
48883 return theme.buttons.borderRadius;
48884}, function (_ref4) {
48885 var theme = _ref4.theme;
48886 return theme.buttons.text;
48887}, function (_ref5) {
48888 var disabled = _ref5.disabled;
48889 return disabled ? 'not-allowed' : 'pointer';
48890}, function (_ref6) {
48891 var theme = _ref6.theme;
48892 return theme.colors.strokeGray;
48893}, function (_ref7) {
48894 var theme = _ref7.theme;
48895 return theme.colors.gray;
48896}, function (_ref8) {
48897 var theme = _ref8.theme;
48898 return theme.buttons.activeBg;
48899}, function (_ref9) {
48900 var theme = _ref9.theme;
48901 return theme.buttons.activeBg;
48902}, function (_ref10) {
48903 var theme = _ref10.theme;
48904 return theme.buttons.dropdown.separatorColor;
48905}, function (_ref11) {
48906 var theme = _ref11.theme;
48907 return theme.buttons.dropdown.activeBackgroundColor;
48908});
48909DropdownStyled.displayName = 'DropdownStyled';
48910
48911function _templateObject5$7() {
48912 var data = taggedTemplateLiteralLoose(["\n\tcolor: ", ";\n"]);
48913
48914 _templateObject5$7 = function _templateObject5() {
48915 return data;
48916 };
48917
48918 return data;
48919}
48920
48921function _templateObject4$h() {
48922 var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-block;\n\twidth: 18px;\n\theight: 18px;\n\tmargin-right: 6px;\n\tbackground-color: ", ";\n"]);
48923
48924 _templateObject4$h = function _templateObject4() {
48925 return data;
48926 };
48927
48928 return data;
48929}
48930
48931function _templateObject3$m() {
48932 var data = taggedTemplateLiteralLoose(["\n\t&&&& {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tpadding: 6px 8px !important;\n\t}\n\n\t&&&&:hover {\n\t\tbackground-color: ", " !important;\n\t\tborder-radius: 4px;\n\t}\n"]);
48933
48934 _templateObject3$m = function _templateObject3() {
48935 return data;
48936 };
48937
48938 return data;
48939}
48940
48941function _templateObject2$x() {
48942 var data = taggedTemplateLiteralLoose(["\n\t&&&& {\n\t\tpadding: 0;\n\t\tmargin-top: 0;\n\t\tmargin-bottom: 10px;\n\t\tfont-size: 12px;\n\t\tfont-weight: bold;\n\t\tline-height: 14px;\n\t\ttext-transform: none;\n\t}\n"]);
48943
48944 _templateObject2$x = function _templateObject2() {
48945 return data;
48946 };
48947
48948 return data;
48949}
48950
48951function _templateObject$1u() {
48952 var data = taggedTemplateLiteralLoose(["\n\t&&& {\n\t\twidth: 220px;\n\t\tpadding: 12px 8px 8px 8px;\n\t\tborder: 1px solid #ffffff;\n\t\tborder-radius: 4px;\n\t\tbox-shadow: 0px 2px 4px rgba(0, 0, 0, 0.25);\n\t}\n\n\t&&& .selected.item {\n\t\tbackground-color: ", ";\n\t\tborder-radius: 4px;\n\t}\n"]);
48953
48954 _templateObject$1u = function _templateObject() {
48955 return data;
48956 };
48957
48958 return data;
48959}
48960
48961var GradeDropdown = function GradeDropdown(_ref) {
48962 var options = _ref.options,
48963 header = _ref.header,
48964 children = _ref.children,
48965 onChange = _ref.onChange,
48966 value = _ref.value,
48967 props = objectWithoutPropertiesLoose(_ref, ["options", "header", "children", "onChange", "value"]);
48968
48969 return React__default.createElement(semanticUiReact.Dropdown, _extends_1({
48970 trigger: children,
48971 icon: null
48972 }, props), React__default.createElement(DropdownMenu, null, header && React__default.createElement(DropdownHeader, {
48973 content: header
48974 }), options.map(function (_ref2) {
48975 var val = _ref2.value,
48976 color = _ref2.color,
48977 name = _ref2.name;
48978 return React__default.createElement(DropdownItem, {
48979 onClick: function onClick() {
48980 return onChange({
48981 value: val,
48982 name: name
48983 });
48984 },
48985 selected: value === val,
48986 key: val
48987 }, React__default.createElement(Square, {
48988 color: color
48989 }), React__default.createElement(Name, {
48990 color: color
48991 }, name));
48992 })));
48993};
48994
48995var DropdownMenu = styled__default(semanticUiReact.Dropdown.Menu)(_templateObject$1u(), function (_ref3) {
48996 var theme = _ref3.theme;
48997 return theme.colors.lightBlue;
48998});
48999var DropdownHeader = styled__default(semanticUiReact.Dropdown.Header)(_templateObject2$x());
49000var DropdownItem = styled__default(semanticUiReact.Dropdown.Item)(_templateObject3$m(), function (_ref4) {
49001 var theme = _ref4.theme;
49002 return theme.colors.lightBlue;
49003});
49004var Square = styled__default.div(_templateObject4$h(), function (_ref5) {
49005 var color = _ref5.color;
49006 return color || 'black';
49007});
49008var Name = styled__default.div(_templateObject5$7(), function (_ref6) {
49009 var color = _ref6.color;
49010 return color || 'black';
49011});
49012GradeDropdown.displayName = 'GradeDropdown';
49013DropdownMenu.displayName = 'DropdownMenu';
49014DropdownHeader.displayName = 'DropdownHeader';
49015DropdownItem.displayName = 'DropdownItem';
49016Square.displayName = 'Square';
49017Name.displayName = 'Name';
49018GradeDropdown.defaultProps = {
49019 header: null
49020};
49021GradeDropdown.propTypes = {
49022 /** dropdown options */
49023 options: PropTypes.arrayOf(PropTypes.shape({
49024 value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
49025 name: PropTypes.string.isRequired,
49026 color: PropTypes.string
49027 })).isRequired,
49028
49029 /** value controlled by the parent */
49030 value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
49031
49032 /** dropdown header */
49033 header: PropTypes.string,
49034
49035 /** component that will trigger the dropdown */
49036 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
49037
49038 /** function called when an option is clicked */
49039 onChange: PropTypes.func.isRequired
49040};
49041
49042function _templateObject3$n() {
49043 var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-flex;\n\twidth: 50%;\n\theight: calc(100% - 20px);\n\tflex-flow: column;\n\talign-items: center;\n\tjustify-content: flex-start;\n\tpadding: 0 6px;\n\tcolor: ", ";\n\tfont-size: 10px;\n"]);
49044
49045 _templateObject3$n = function _templateObject3() {
49046 return data;
49047 };
49048
49049 return data;
49050}
49051
49052function _templateObject2$y() {
49053 var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tdisplay: block;\n\twidth: 100%;\n\theight: 20px;\n\tfont-size: 10px;\n"]);
49054
49055 _templateObject2$y = function _templateObject2() {
49056 return data;
49057 };
49058
49059 return data;
49060}
49061
49062function _templateObject$1v() {
49063 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\theight: ", ";\n\tflex-flow: column;\n\talign-items: baseline;\n\tjustify-content: space-evenly;\n\tpadding: 0 6px;\n\tcolor: ", ";\n\tfont-size: 28px;\n"]);
49064
49065 _templateObject$1v = function _templateObject() {
49066 return data;
49067 };
49068
49069 return data;
49070}
49071
49072var WidgetWeather = function WidgetWeather(_ref) {
49073 var selected = _ref.selected,
49074 temperature = _ref.temperature,
49075 temperatureColor = _ref.temperatureColor,
49076 temperatureMin = _ref.temperatureMin,
49077 temperatureMinColor = _ref.temperatureMinColor,
49078 temperatureMax = _ref.temperatureMax,
49079 temperatureMaxColor = _ref.temperatureMaxColor,
49080 props = objectWithoutPropertiesLoose(_ref, ["selected", "temperature", "temperatureColor", "temperatureMin", "temperatureMinColor", "temperatureMax", "temperatureMaxColor"]);
49081
49082 return React__default.createElement(WidgetCardContainer, _extends_1({
49083 selected: selected
49084 }, props), React__default.createElement(TemperatureContainer, {
49085 expand: temperatureMax !== undefined && temperatureMin !== undefined,
49086 color: temperatureColor
49087 }, temperature, "\xBA"), (temperatureMax !== undefined || temperatureMin !== undefined) && React__default.createElement(ContainerMinMax, null, temperatureMin && React__default.createElement(TemperatureMinMaxContainer, {
49088 color: temperatureMinColor
49089 }, temperatureMin, "\xBA"), temperatureMax && React__default.createElement(TemperatureMinMaxContainer, {
49090 color: temperatureMaxColor
49091 }, temperatureMax, "\xBA")));
49092};
49093
49094var TemperatureContainer = styled__default.div(_templateObject$1v(), function (_ref2) {
49095 var expand = _ref2.expand;
49096 return expand ? 'calc(100% - 20px)' : '100%';
49097}, function (_ref3) {
49098 var color = _ref3.color;
49099 return color;
49100});
49101TemperatureContainer.displayName = 'TemperatureContainer';
49102var ContainerMinMax = styled__default.div(_templateObject2$y());
49103var TemperatureMinMaxContainer = styled__default.div(_templateObject3$n(), function (_ref4) {
49104 var color = _ref4.color;
49105 return color;
49106});
49107TemperatureMinMaxContainer.displayName = 'TemperatureMinMaxContainer';
49108WidgetWeather.defaultProps = {
49109 selected: false,
49110 temperature: 24,
49111 temperatureColor: 'black',
49112 temperatureMin: undefined,
49113 temperatureMinColor: 'black',
49114 temperatureMax: undefined,
49115 temperatureMaxColor: 'black'
49116};
49117WidgetWeather.propTypes = {
49118 /** is selected */
49119 selected: PropTypes.bool,
49120
49121 /** temperature */
49122 temperature: PropTypes.number,
49123
49124 /** temperature color */
49125 temperatureColor: PropTypes.string,
49126
49127 /** temperature min */
49128 temperatureMin: PropTypes.number,
49129
49130 /** temperature min color */
49131 temperatureMinColor: PropTypes.string,
49132
49133 /** temperature max */
49134 temperatureMax: PropTypes.number,
49135
49136 /** temperature max color */
49137 temperatureMaxColor: PropTypes.string
49138};
49139WidgetWeather.displayName = 'WidgetWeather';
49140
49141var _ref$4 =
49142/*#__PURE__*/
49143React__default.createElement("path", {
49144 d: "M22.847 11.513H19.93a.486.486 0 1 0 0 .973h2.917a.487.487 0 0 0 0-.973zM3.403 11.513H.487a.486.486 0 1 0 0 .973h2.916a.486.486 0 0 0 0-.973zM19.917 3.75a.488.488 0 0 0-.688 0l-2.062 2.062a.485.485 0 1 0 .687.688v-.001l2.061-2.061h.001a.487.487 0 0 0 .001-.688zM6.167 17.5a.484.484 0 0 0-.687 0l-2.063 2.06v.001a.486.486 0 1 0 .688.688l2.061-2.062a.484.484 0 0 0 0-.688zM11.667.333a.486.486 0 0 0-.487.487v2.916a.486.486 0 0 0 .973 0V.82a.487.487 0 0 0-.486-.487zM11.667 19.777a.486.486 0 0 0-.487.486v2.916a.487.487 0 1 0 .973 0v-2.916a.486.486 0 0 0-.486-.486zM6.167 5.813L4.105 3.75a.487.487 0 0 0-.688.688l2.062 2.06V6.5a.485.485 0 1 0 .688-.687zM19.917 19.561L17.853 17.5v-.001a.486.486 0 1 0-.687.687l2.062 2.063a.487.487 0 0 0 .688-.688zM11.667 5.195a6.805 6.805 0 1 0 0 13.61 6.805 6.805 0 1 0 0-13.61zm4.124 10.93a5.794 5.794 0 0 1-4.124 1.708 5.797 5.797 0 0 1-4.125-1.709A5.794 5.794 0 0 1 5.833 12c0-1.559.607-3.023 1.71-4.125a5.796 5.796 0 0 1 4.124-1.709c1.558 0 3.023.607 4.124 1.709A5.794 5.794 0 0 1 17.5 12a5.794 5.794 0 0 1-1.71 4.124z",
49145 fill: "#1A1A1A"
49146});
49147
49148var icon = 'data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M22.8473%2011.5132H19.9304C19.6616%2011.5132%2019.4441%2011.731%2019.4441%2011.9995C19.4441%2012.2682%2019.6616%2012.4862%2019.9304%2012.4862H22.8466C22.8466%2012.4862%2022.8466%2012.4862%2022.8473%2012.4862C23.1154%2012.4862%2023.3333%2012.2682%2023.3333%2011.9995C23.3333%2011.731%2023.1154%2011.5132%2022.8473%2011.5132Z%22%20fill%3D%22%231A1A1A%22%2F%3E%3Cpath%20d%3D%22M3.40317%2011.5132H0.487H0.486333C0.217667%2011.5132%200%2011.731%200%2011.9995C0%2012.2677%200.217667%2012.4862%200.486333%2012.4862H3.40267H3.40317C3.67117%2012.4862%203.88883%2012.2682%203.88883%2011.9998C3.88883%2011.7317%203.67117%2011.5132%203.40317%2011.5132Z%22%20fill%3D%22%231A1A1A%22%2F%3E%3Cpath%20d%3D%22M19.9171%203.74955C19.7261%203.56005%2019.4186%203.56005%2019.2287%203.74955L17.1666%205.81238V5.81288C16.9764%206.00221%2016.9764%206.31005%2017.1666%206.49955C17.3561%206.68938%2017.6641%206.68938%2017.8537%206.49955L17.8544%206.49888L19.9154%204.43805C19.9162%204.43805%2019.9162%204.43738%2019.9162%204.43738C20.1064%204.24755%2020.1064%203.94005%2019.9171%203.74955Z%22%20fill%3D%22%231A1A1A%22%2F%3E%3Cpath%20d%3D%22M6.16679%2017.4994C5.97712%2017.3088%205.66896%2017.3088%205.47996%2017.4994C5.47996%2017.4994%205.47996%2017.4994%205.47912%2017.4994L3.41729%2019.5604C3.41729%2019.5604%203.41729%2019.561%203.41679%2019.561C3.22696%2019.7513%203.22696%2020.0588%203.41679%2020.2485C3.60729%2020.4386%203.91446%2020.4386%204.10479%2020.2485L6.16596%2018.1866L6.16679%2018.1861C6.35712%2017.9968%206.35712%2017.6889%206.16679%2017.4994Z%22%20fill%3D%22%231A1A1A%22%2F%3E%3Cpath%20d%3D%22M11.6666%200.333008C11.3981%200.333008%2011.1804%200.550841%2011.1804%200.819674V3.73551C11.1804%203.73601%2011.1804%203.73601%2011.1804%203.73601C11.1804%204.00468%2011.3981%204.22201%2011.6666%204.22201C11.9349%204.22201%2012.1526%204.00468%2012.1526%203.73651V0.819674C12.1526%200.550841%2011.9349%200.333674%2011.6666%200.333008Z%22%20fill%3D%22%231A1A1A%22%2F%3E%3Cpath%20d%3D%22M11.6666%2019.7773C11.3981%2019.7773%2011.1804%2019.9952%2011.1804%2020.2627V20.264V23.1792C11.1804%2023.4487%2011.3981%2023.6657%2011.6666%2023.6663C11.9349%2023.6663%2012.1526%2023.4487%2012.1526%2023.1792V20.2627C12.1526%2019.9952%2011.9349%2019.7773%2011.6666%2019.7773Z%22%20fill%3D%22%231A1A1A%22%2F%3E%3Cpath%20d%3D%22M6.16678%205.81288L4.10478%203.74955C3.91445%203.56005%203.60728%203.56005%203.41678%203.74955C3.22695%203.94005%203.22762%204.24788%203.41678%204.43738C3.41728%204.43738%203.41728%204.43738%203.41728%204.43805L5.47912%206.49871C5.47912%206.49871%205.47912%206.49938%205.47995%206.49955C5.66895%206.68938%205.97712%206.68938%206.16678%206.49955C6.35712%206.31005%206.35712%206.00221%206.16678%205.81288Z%22%20fill%3D%22%231A1A1A%22%2F%3E%3Cpath%20d%3D%22M19.917%2019.5612L19.9162%2019.5607L17.8544%2017.4997L17.8537%2017.4988C17.6641%2017.309%2017.3561%2017.309%2017.1666%2017.4988C16.9764%2017.6887%2016.9764%2017.997%2017.1666%2018.1863C17.1666%2018.1863%2017.1666%2018.1863%2017.1666%2018.1868L19.2287%2020.2487C19.4185%2020.4388%2019.7259%2020.4388%2019.917%2020.2487C20.1064%2020.059%2020.1064%2019.7515%2019.917%2019.5612Z%22%20fill%3D%22%231A1A1A%22%2F%3E%3Cpath%20d%3D%22M11.6667%205.19482C7.90841%205.19482%204.86157%208.24116%204.86157%2011.9998C4.86157%2015.7583%207.90841%2018.8042%2011.6667%2018.8042C15.4247%2018.8042%2018.4726%2015.7583%2018.4726%2011.9998C18.4726%208.24149%2015.4247%205.19482%2011.6667%205.19482ZM15.7909%2016.1243C14.6901%2017.2258%2013.2247%2017.8333%2011.6667%2017.8333C10.1089%2017.8333%208.64407%2017.2258%207.54224%2016.1243C6.44024%2015.0218%205.83341%2013.5583%205.83341%2011.9998C5.83341%2010.4412%206.44024%208.97699%207.54224%207.87482C8.64407%206.77332%2010.1089%206.16649%2011.6667%206.16649C13.2247%206.16649%2014.6901%206.77332%2015.7909%207.87482C16.8932%208.97699%2017.5002%2010.4412%2017.5002%2011.9998C17.5002%2013.5583%2016.8932%2015.0218%2015.7909%2016.1243Z%22%20fill%3D%22%231A1A1A%22%2F%3E%3C%2Fsvg%3E';
49149
49150function _templateObject8$1() {
49151 var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\ttop: -7px;\n\tleft: -1px;\n\tdisplay: inline-flex;\n\twidth: 50%;\n\theight: calc(100% - 20px);\n\tflex-flow: column;\n\talign-items: center;\n\tjustify-content: flex-start;\n\tpadding: 0 6px;\n\tcolor: ", ";\n\tfont-size: 6px;\n"]);
49152
49153 _templateObject8$1 = function _templateObject8() {
49154 return data;
49155 };
49156
49157 return data;
49158}
49159
49160function _templateObject7$2() {
49161 var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\ttop: -7px;\n\tleft: 2px;\n\tdisplay: inline-flex;\n\twidth: 50%;\n\theight: calc(100% - 20px);\n\tflex-flow: column;\n\talign-items: center;\n\tjustify-content: flex-start;\n\tpadding: 0 6px;\n\tcolor: ", ";\n\tfont-size: 6px;\n"]);
49162
49163 _templateObject7$2 = function _templateObject7() {
49164 return data;
49165 };
49166
49167 return data;
49168}
49169
49170function _templateObject6$6() {
49171 var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-flex;\n\twidth: 100%;\n\theight: 20px;\n"]);
49172
49173 _templateObject6$6 = function _templateObject6() {
49174 return data;
49175 };
49176
49177 return data;
49178}
49179
49180function _templateObject5$8() {
49181 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\theight: ", ";\n\tflex-flow: column;\n\talign-items: baseline;\n\tjustify-content: ", ";\n\tpadding: 0 3px;\n\tcolor: ", ";\n\tfont-size: 14px;\n"]);
49182
49183 _templateObject5$8 = function _templateObject5() {
49184 return data;
49185 };
49186
49187 return data;
49188}
49189
49190function _templateObject4$i() {
49191 var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tdisplay: inline-flex;\n\twidth: 50%;\n\theight: 100%;\n\tflex-flow: column;\n\tjustify-content: space-around;\n\tfloat: right;\n"]);
49192
49193 _templateObject4$i = function _templateObject4() {
49194 return data;
49195 };
49196
49197 return data;
49198}
49199
49200function _templateObject3$o() {
49201 var data = taggedTemplateLiteralLoose(["\n\twidth: 23px;\n\theight: 23px;\n"]);
49202
49203 _templateObject3$o = function _templateObject3() {
49204 return data;
49205 };
49206
49207 return data;
49208}
49209
49210function _templateObject2$z() {
49211 var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-flex;\n\twidth: 50%;\n\theight: 100%;\n\tflex-flow: column;\n\tjustify-content: space-around;\n\tpadding-left: 4px;\n"]);
49212
49213 _templateObject2$z = function _templateObject2() {
49214 return data;
49215 };
49216
49217 return data;
49218}
49219
49220function _templateObject$1w() {
49221 var data = taggedTemplateLiteralLoose(["\n\t&&&& {\n\t\tflex-flow: row;\n\t}\n"]);
49222
49223 _templateObject$1w = function _templateObject() {
49224 return data;
49225 };
49226
49227 return data;
49228}
49229
49230var WidgetWeatherIcon = function WidgetWeatherIcon(_ref) {
49231 var selected = _ref.selected,
49232 temperature = _ref.temperature,
49233 temperatureColor = _ref.temperatureColor,
49234 temperatureMin = _ref.temperatureMin,
49235 temperatureMinColor = _ref.temperatureMinColor,
49236 temperatureMax = _ref.temperatureMax,
49237 temperatureMaxColor = _ref.temperatureMaxColor,
49238 props = objectWithoutPropertiesLoose(_ref, ["selected", "temperature", "temperatureColor", "temperatureMin", "temperatureMinColor", "temperatureMax", "temperatureMaxColor"]);
49239
49240 return React__default.createElement(WidgetWrapperCustom, _extends_1({
49241 selected: selected
49242 }, props), React__default.createElement(IconWrapper$1, null, React__default.createElement(IconImage, {
49243 alt: "iconSun",
49244 src: icon
49245 })), React__default.createElement(TemperatureWrapper, null, React__default.createElement(TemperatureContainer$1, {
49246 expand: temperatureMax !== undefined && temperatureMin !== undefined,
49247 color: temperatureColor
49248 }, temperature, "\xBA"), (temperatureMax !== undefined || temperatureMin !== undefined) && React__default.createElement(ContainerMinMax$1, null, temperatureMin && React__default.createElement(TemperatureMinContainer, {
49249 color: temperatureMinColor
49250 }, temperatureMin, "\xBA"), temperatureMax && React__default.createElement(TemperatureMaxContainer, {
49251 color: temperatureMaxColor
49252 }, temperatureMax, "\xBA"))));
49253};
49254
49255var WidgetWrapperCustom = styled__default(WidgetCardContainer)(_templateObject$1w());
49256var IconWrapper$1 = styled__default.div(_templateObject2$z());
49257var IconImage = styled__default.img(_templateObject3$o());
49258var TemperatureWrapper = styled__default.div(_templateObject4$i());
49259var TemperatureContainer$1 = styled__default.div(_templateObject5$8(), function (_ref2) {
49260 var expand = _ref2.expand;
49261 return expand ? 'calc(100% - 26px)' : '100%';
49262}, function (_ref3) {
49263 var expand = _ref3.expand;
49264 return expand ? 'flex-end' : 'space-around';
49265}, function (_ref4) {
49266 var color = _ref4.color;
49267 return color;
49268});
49269TemperatureContainer$1.displayName = 'TemperatureContainer';
49270var ContainerMinMax$1 = styled__default.div(_templateObject6$6());
49271var TemperatureMinContainer = styled__default.div(_templateObject7$2(), function (_ref5) {
49272 var color = _ref5.color;
49273 return color;
49274});
49275TemperatureMinContainer.displayName = 'TemperatureMinContainer';
49276var TemperatureMaxContainer = styled__default.div(_templateObject8$1(), function (_ref6) {
49277 var color = _ref6.color;
49278 return color;
49279});
49280TemperatureMaxContainer.displayName = 'TemperatureMaxContainer';
49281WidgetWeatherIcon.defaultProps = {
49282 selected: false,
49283 temperature: 24,
49284 temperatureColor: 'black',
49285 temperatureMin: undefined,
49286 temperatureMinColor: 'black',
49287 temperatureMax: undefined,
49288 temperatureMaxColor: 'black'
49289};
49290WidgetWeatherIcon.propTypes = {
49291 /** is selected */
49292 selected: PropTypes.bool,
49293
49294 /** temperature */
49295 temperature: PropTypes.number,
49296
49297 /** temperature color */
49298 temperatureColor: PropTypes.string,
49299
49300 /** temperature min */
49301 temperatureMin: PropTypes.number,
49302
49303 /** temperature min color */
49304 temperatureMinColor: PropTypes.string,
49305
49306 /** temperature max */
49307 temperatureMax: PropTypes.number,
49308
49309 /** temperature max color */
49310 temperatureMaxColor: PropTypes.string
49311};
49312WidgetWeatherIcon.displayName = 'WidgetWrapper';
49313
49314function _templateObject$1x() {
49315 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\theight: 100%;\n\tflex-flow: column;\n\talign-items: center;\n\tjustify-content: space-evenly;\n\tpadding: 0 6px;\n\tcolor: ", ";\n\tfont-size: ", ";\n\tfont-weight: bold;\n"]);
49316
49317 _templateObject$1x = function _templateObject() {
49318 return data;
49319 };
49320
49321 return data;
49322}
49323
49324var WidgetDate = function WidgetDate(_ref) {
49325 var selected = _ref.selected,
49326 format = _ref.format,
49327 color = _ref.color,
49328 font = _ref.font,
49329 day = _ref.day,
49330 month = _ref.month,
49331 year = _ref.year,
49332 props = objectWithoutPropertiesLoose(_ref, ["selected", "format", "color", "font", "day", "month", "year"]);
49333
49334 var getFormat = function getFormat() {
49335 switch (format) {
49336 case 'mm/dd/yyyy':
49337 return month + "/" + day + "/" + year;
49338
49339 case 'dd/mm':
49340 return day + "/" + month;
49341
49342 case 'yyyy/mm/dd':
49343 return year + "/" + month + "/" + day;
49344
49345 case 'dd/mm/yyyy':
49346 default:
49347 return day + "/" + month + "/" + year;
49348 }
49349 };
49350
49351 return React__default.createElement(WidgetCardContainer, _extends_1({
49352 selected: selected
49353 }, props), React__default.createElement(DateContainer, {
49354 color: color,
49355 font: font
49356 }, getFormat()));
49357};
49358
49359var DateContainer = styled__default.div(_templateObject$1x(), function (_ref2) {
49360 var color = _ref2.color;
49361 return color;
49362}, function (_ref3) {
49363 var font = _ref3.font;
49364 return font + "px";
49365});
49366DateContainer.displayName = 'DateContainer';
49367WidgetDate.defaultProps = {
49368 format: 'dd/mm/yyyy',
49369 font: 10
49370};
49371WidgetDate.propTypes = {
49372 /** is selected */
49373 selected: PropTypes.bool.isRequired,
49374
49375 /** date format */
49376 format: PropTypes.oneOf(['dd/mm/yyyy', 'mm/dd/yyyy', 'dd/mm', 'yyyy/mm/dd']),
49377
49378 /** color */
49379 color: PropTypes.string.isRequired,
49380
49381 /** date font */
49382 font: PropTypes.number,
49383
49384 /** day */
49385 day: PropTypes.number.isRequired,
49386
49387 /** month */
49388 month: PropTypes.number.isRequired,
49389
49390 /** year */
49391 year: PropTypes.number.isRequired
49392};
49393WidgetDate.displayName = 'WidgetDate';
49394
49395function _templateObject3$p() {
49396 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\theight: calc(100% - 19px);\n\tflex-flow: column;\n\talign-items: center;\n\tjustify-content: start;\n\tpadding: 3px 0 0;\n\tcolor: ", ";\n\tfont-size: ", ";\n"]);
49397
49398 _templateObject3$p = function _templateObject3() {
49399 return data;
49400 };
49401
49402 return data;
49403}
49404
49405function _templateObject2$A() {
49406 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\theight: 19px;\n\tflex-flow: column;\n\talign-items: center;\n\tjustify-content: space-around;\n\tpadding: 0 3px;\n\tcolor: ", ";\n\tfont-size: ", ";\n\ttext-transform: uppercase;\n"]);
49407
49408 _templateObject2$A = function _templateObject2() {
49409 return data;
49410 };
49411
49412 return data;
49413}
49414
49415function _templateObject$1y() {
49416 var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-flex;\n\twidth: 100%;\n\theight: 100%;\n\tflex-flow: column;\n\tjustify-content: space-around;\n"]);
49417
49418 _templateObject$1y = function _templateObject() {
49419 return data;
49420 };
49421
49422 return data;
49423}
49424
49425var WidgetDateShort = function WidgetDateShort(_ref) {
49426 var selected = _ref.selected,
49427 colorDay = _ref.colorDay,
49428 colorWeek = _ref.colorWeek,
49429 fontDay = _ref.fontDay,
49430 fontWeek = _ref.fontWeek,
49431 dd = _ref.dd,
49432 weekDay = _ref.weekDay,
49433 props = objectWithoutPropertiesLoose(_ref, ["selected", "colorDay", "colorWeek", "fontDay", "fontWeek", "dd", "weekDay"]);
49434
49435 return React__default.createElement(WidgetCardContainer, _extends_1({
49436 selected: selected
49437 }, props), React__default.createElement(DateWrapper, null, React__default.createElement(WeekContainer, {
49438 color: colorWeek,
49439 font: fontWeek
49440 }, weekDay), React__default.createElement(DayContainer, {
49441 color: colorDay,
49442 font: fontDay
49443 }, dd)));
49444};
49445
49446var DateWrapper = styled__default.div(_templateObject$1y());
49447var WeekContainer = styled__default.div(_templateObject2$A(), function (_ref2) {
49448 var color = _ref2.color;
49449 return color;
49450}, function (_ref3) {
49451 var font = _ref3.font;
49452 return font + "px";
49453});
49454WeekContainer.displayName = 'WeekContainer';
49455var DayContainer = styled__default.div(_templateObject3$p(), function (_ref4) {
49456 var color = _ref4.color;
49457 return color;
49458}, function (_ref5) {
49459 var font = _ref5.font;
49460 return font + "px";
49461});
49462DayContainer.displayName = 'DayContainer';
49463WidgetDateShort.defaultProps = {
49464 selected: false,
49465 colorWeek: 'black',
49466 colorDay: 'black',
49467 fontWeek: 16,
49468 fontDay: 34,
49469 dd: 1,
49470 weekDay: 'Mon'
49471};
49472WidgetDateShort.propTypes = {
49473 /** is selected */
49474 selected: PropTypes.bool,
49475
49476 /** color week */
49477 colorWeek: PropTypes.string,
49478
49479 /** color day */
49480 colorDay: PropTypes.string,
49481
49482 /** font week */
49483 fontWeek: PropTypes.number,
49484
49485 /** font day */
49486 fontDay: PropTypes.number,
49487
49488 /** day */
49489 dd: PropTypes.number,
49490
49491 /** week day */
49492 weekDay: PropTypes.string
49493};
49494WidgetDateShort.displayName = 'WidgetWrapper';
49495
49496function _templateObject$1z() {
49497 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\theight: 100%;\n\tflex-flow: column;\n\talign-items: center;\n\tjustify-content: space-evenly;\n\tfont-size: 13px;\n\tfont-weight: bold;\n"]);
49498
49499 _templateObject$1z = function _templateObject() {
49500 return data;
49501 };
49502
49503 return data;
49504}
49505
49506var WidgetCard = function WidgetCard(_ref) {
49507 var image = _ref.image,
49508 text = _ref.text,
49509 place = _ref.place,
49510 props = objectWithoutPropertiesLoose(_ref, ["image", "text", "place"]);
49511
49512 return React__default.createElement(WidgetCardContainer, _extends_1({
49513 width: 93,
49514 height: 93
49515 }, props), React__default.createElement(WidgetContainer, null, React__default.createElement("img", {
49516 src: image,
49517 alt: "box",
49518 draggable: false
49519 }), React__default.createElement(TextTruncate, {
49520 text: text,
49521 place: place,
49522 length: 13
49523 })));
49524};
49525
49526var WidgetContainer = styled__default.div(_templateObject$1z());
49527WidgetCard.displayName = 'WidgetCard';
49528WidgetCard.defaultProps = {
49529 place: 'bottom'
49530};
49531WidgetCard.propTypes = {
49532 /** Image to be displayed */
49533 image: PropTypes.string.isRequired,
49534
49535 /** Text to be displayed */
49536 text: PropTypes.string.isRequired,
49537
49538 /** Tooltip position */
49539 place: PropTypes.oneOf(['top', 'right', 'left', 'bottom'])
49540};
49541
49542function _templateObject$1A() {
49543 var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-block;\n\twidth: fit-content;\n\tcolor: ", ";\n\tfont-family: ", ", sans-serif;\n\tfont-size: ", "px;\n\tfont-weight: ", ";\n\tline-height: 100%;\n\n\tspan {\n\t\tpadding-left: 7%;\n\t\tfont-family: Roboto, sans-serif;\n\t\tfont-size: 25%;\n\t\tline-height: 100%;\n\t\tvertical-align: ", ";\n\t}\n"]);
49544
49545 _templateObject$1A = function _templateObject() {
49546 return data;
49547 };
49548
49549 return data;
49550}
49551
49552var DigitalClock = function DigitalClock(_ref) {
49553 var color = _ref.color,
49554 font = _ref.font,
49555 hour = _ref.hour,
49556 minute = _ref.minute,
49557 period = _ref.period,
49558 size = _ref.size,
49559 props = objectWithoutPropertiesLoose(_ref, ["color", "font", "hour", "minute", "period", "size"]);
49560
49561 var fontSize = size || (font === 'Roboto' ? 20 : 30);
49562 return React__default.createElement(DigitalClockContainer, _extends_1({
49563 color: color,
49564 font: font,
49565 size: fontSize
49566 }, props), hour + ":" + minute, period && React__default.createElement("span", null, period));
49567};
49568
49569var DigitalClockContainer = styled__default.div(_templateObject$1A(), function (_ref2) {
49570 var theme = _ref2.theme,
49571 color = _ref2.color;
49572 return color || theme.colors.black;
49573}, function (_ref3) {
49574 var font = _ref3.font;
49575 return font;
49576}, function (_ref4) {
49577 var size = _ref4.size;
49578 return size;
49579}, function (_ref5) {
49580 var font = _ref5.font;
49581 return font === 'Roboto' ? 'bold' : 'normal';
49582}, function (_ref6) {
49583 var font = _ref6.font;
49584 return font === 'Roboto' ? 'top' : 'bottom';
49585});
49586DigitalClockContainer.displayName = 'DigitalClockContainer';
49587DigitalClock.displayName = 'DigitalClock';
49588DigitalClock.defaultProps = {
49589 period: undefined,
49590 size: undefined,
49591 color: undefined,
49592 font: 'Roboto',
49593 hour: 10,
49594 minute: 10
49595};
49596DigitalClock.propTypes = {
49597 /** Text color */
49598 color: PropTypes.string,
49599
49600 /** Text font-family */
49601 font: PropTypes.oneOf(['Roboto', 'DS-Digital']),
49602
49603 /** Hour to be displayed */
49604 hour: PropTypes.number,
49605
49606 /** Minutes to be displayed */
49607 minute: PropTypes.number,
49608
49609 /** Hour period */
49610 period: PropTypes.oneOf(['AM', 'PM']),
49611
49612 /** Text font-size */
49613 size: PropTypes.number
49614};
49615
49616function _templateObject$1B() {
49617 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\theight: 100%;\n\talign-items: center;\n\tjustify-content: center;\n"]);
49618
49619 _templateObject$1B = function _templateObject() {
49620 return data;
49621 };
49622
49623 return data;
49624}
49625
49626var TimeWidget = function TimeWidget(_ref) {
49627 var color = _ref.color,
49628 font = _ref.font,
49629 hour = _ref.hour,
49630 minute = _ref.minute,
49631 period = _ref.period,
49632 size = _ref.size,
49633 props = objectWithoutPropertiesLoose(_ref, ["color", "font", "hour", "minute", "period", "size"]);
49634
49635 return React__default.createElement(WidgetCardContainer, props, React__default.createElement(TimeWidgetContainer, null, React__default.createElement(DigitalClock, {
49636 color: color,
49637 font: font,
49638 hour: hour,
49639 minute: minute,
49640 period: period,
49641 size: size
49642 })));
49643};
49644
49645var TimeWidgetContainer = styled__default.div(_templateObject$1B());
49646TimeWidgetContainer.displayName = 'TimeWidgetContainer';
49647TimeWidget.displayName = 'TimeWidget';
49648TimeWidget.defaultProps = {
49649 period: undefined,
49650 size: undefined,
49651 font: undefined,
49652 color: undefined,
49653 hour: undefined,
49654 minute: undefined
49655};
49656TimeWidget.propTypes = {
49657 /** Text color */
49658 color: PropTypes.string,
49659
49660 /** Text font-family */
49661 font: PropTypes.oneOf(['Roboto', 'DS-Digital']),
49662
49663 /** Hour to be displayed */
49664 hour: PropTypes.number,
49665
49666 /** Minutes to be displayed */
49667 minute: PropTypes.number,
49668
49669 /** Hour period */
49670 period: PropTypes.oneOf(['AM', 'PM']),
49671
49672 /** Text font-size */
49673 size: PropTypes.number
49674};
49675
49676function _templateObject4$j() {
49677 var data = taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\theight: 100%;\n\tbackground-color: ", ";\n\tbackground-image: url(", ");\n\tbackground-position: center;\n\tbackground-repeat: no-repeat;\n\tbackground-size: 100% auto;\n\n\tborder-radius: 4px;\n\n\t&:hover,\n\t&focus {\n\t\tborder-radius: 0;\n\t}\n"]);
49678
49679 _templateObject4$j = function _templateObject4() {
49680 return data;
49681 };
49682
49683 return data;
49684}
49685
49686function _templateObject3$q() {
49687 var data = taggedTemplateLiteralLoose(["\n\tposition: absolute;\n\tz-index: 2;\n\n\t:before {\n\t\tdisplay: inline-block;\n\t\tborder-radius: 2px;\n\t\tline-height: 0.9em;\n\t}\n\n\ttop: 3px;\n\tright: 8px;\n"]);
49688
49689 _templateObject3$q = function _templateObject3() {
49690 return data;
49691 };
49692
49693 return data;
49694}
49695
49696function _templateObject2$B() {
49697 var data = taggedTemplateLiteralLoose(["\n\tposition: absolute;\n\tz-index: 2;\n\ttop: 8px;\n\tleft: 8px;\n"]);
49698
49699 _templateObject2$B = function _templateObject2() {
49700 return data;
49701 };
49702
49703 return data;
49704}
49705
49706function _templateObject$1C() {
49707 var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\twidth: ", ";\n\theight: ", ";\n\tborder: 2px solid transparent;\n\n\tcursor: pointer;\n\n\t&:after {\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tleft: 0;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tborder-radius: 4px;\n\t\tbox-shadow: ", ";\n\t\tcontent: '';\n\t}\n\n\t&:hover,\n\t&:focus {\n\t\t&:after {\n\t\t\tbox-shadow: 0 0 0 2px ", ";\n\t\t}\n\t}\n"]);
49708
49709 _templateObject$1C = function _templateObject() {
49710 return data;
49711 };
49712
49713 return data;
49714}
49715
49716var ImageCard = function ImageCard(_ref) {
49717 var checkboxId = _ref.checkboxId,
49718 handleSelect = _ref.handleSelect,
49719 image = _ref.image,
49720 video = _ref.video,
49721 checked = _ref.checked,
49722 width = _ref.width,
49723 height = _ref.height,
49724 props = objectWithoutPropertiesLoose(_ref, ["checkboxId", "handleSelect", "image", "video", "checked", "width", "height"]);
49725
49726 return React__default.createElement(ImageCardStyled, _extends_1({
49727 checked: checked,
49728 width: width,
49729 height: height
49730 }, props), checked !== undefined && React__default.createElement(CheckboxWrapper$1, null, React__default.createElement(Checkbox, {
49731 checked: checked,
49732 onChange: function onChange(e) {
49733 e.stopPropagation();
49734 handleSelect(e.target.checked);
49735 }
49736 })), video && React__default.createElement(IconStyled$2, {
49737 size: "big",
49738 checked: checked,
49739 color: theme.colors.gray,
49740 icon: "multimedia"
49741 }), React__default.createElement(ImgCover, {
49742 src: image,
49743 alt: "image"
49744 }));
49745};
49746
49747var ImageCardStyled = styled__default.div(_templateObject$1C(), function (_ref2) {
49748 var width = _ref2.width;
49749 return width ? width + "px" : '100%';
49750}, function (_ref3) {
49751 var height = _ref3.height;
49752 return height ? height + "px" : '100%';
49753}, function (_ref4) {
49754 var theme$$1 = _ref4.theme,
49755 checked = _ref4.checked;
49756 return checked ? "0 0 0 2px " + theme$$1.colors.activeBlue : "0 0 0 1px " + theme$$1.colors.strokeGray;
49757}, function (_ref5) {
49758 var theme$$1 = _ref5.theme;
49759 return theme$$1.colors.activeBlue;
49760});
49761ImageCardStyled.displayName = 'ImageCardStyled';
49762var CheckboxWrapper$1 = styled__default.div(_templateObject2$B());
49763CheckboxWrapper$1.displayName = 'CheckboxWrapper';
49764var IconStyled$2 = styled__default(Icon)(_templateObject3$q());
49765IconStyled$2.displayName = 'IconStyled';
49766var ImgCover = styled__default.div(_templateObject4$j(), function (_ref6) {
49767 var theme$$1 = _ref6.theme;
49768 return theme$$1.colors.lightGray;
49769}, function (_ref7) {
49770 var src = _ref7.src;
49771 return src;
49772});
49773ImageCard.defaultProps = {
49774 checked: undefined,
49775 handleSelect: undefined,
49776 checkboxId: undefined,
49777 width: null,
49778 height: null,
49779 video: false
49780};
49781ImageCard.propTypes = {
49782 /** checkbox is checked and the ImageCard is selected */
49783 checked: PropTypes.bool,
49784
49785 /** func to handle when element is selected */
49786 handleSelect: PropTypes.func,
49787
49788 /** background image url */
49789 image: PropTypes.string.isRequired,
49790
49791 /** button id to use in functional tests */
49792 checkboxId: PropTypes.string,
49793
49794 /** ImageCard's witdh */
49795 width: PropTypes.number,
49796
49797 /** ImageCard's height */
49798 height: PropTypes.number,
49799
49800 /** if is a video */
49801 video: PropTypes.bool
49802};
49803ImageCard.displayName = 'ImageCard';
49804
49805function _templateObject$1D() {
49806 var data = taggedTemplateLiteralLoose(["\n\tdisplay: grid;\n\tgrid-column-gap: ", "px;\n\tgrid-row-gap: ", "px;\n\tgrid-template-columns: ", ";\n\n\t@media screen and (min-width: 768px) and (max-width: 991px) {\n\t\tgrid-template-columns: ", ";\n\t}\n\n\t@media screen and (min-width: 992px) and (max-width: 1200px) {\n\t\tgrid-template-columns: ", ";\n\t}\n\n\t@media screen and (min-width: 1200px) {\n\t\tgrid-template-columns: ", ";\n\t}\n\n\t", ";\n\n\t", "\n"]);
49807
49808 _templateObject$1D = function _templateObject() {
49809 return data;
49810 };
49811
49812 return data;
49813}
49814
49815var CustomGrid = function CustomGrid(_ref) {
49816 var minWidth = _ref.minWidth,
49817 rowGap = _ref.rowGap,
49818 columnGap = _ref.columnGap,
49819 children = _ref.children,
49820 squared = _ref.squared,
49821 mobile = _ref.mobile,
49822 tablet = _ref.tablet,
49823 desktop = _ref.desktop,
49824 bigDesktop = _ref.bigDesktop;
49825 return React__default.createElement(GridStyled, {
49826 minWidth: minWidth,
49827 squared: squared,
49828 rowGap: rowGap,
49829 columnGap: columnGap,
49830 mobile: mobile,
49831 tablet: tablet,
49832 desktop: desktop,
49833 bigDesktop: bigDesktop
49834 }, children);
49835};
49836
49837var GridStyled = styled__default.div(_templateObject$1D(), function (_ref2) {
49838 var columnGap = _ref2.columnGap;
49839 return columnGap;
49840}, function (_ref3) {
49841 var rowGap = _ref3.rowGap;
49842 return rowGap;
49843}, function (_ref4) {
49844 var mobile = _ref4.mobile,
49845 minWidth = _ref4.minWidth;
49846 return "repeat(" + (mobile || 'auto-fit') + ", minmax(" + minWidth + "px, 1fr))";
49847}, function (_ref5) {
49848 var tablet = _ref5.tablet,
49849 minWidth = _ref5.minWidth;
49850 return "repeat(" + (tablet || 'auto-fit') + ", minmax(" + minWidth + "px, 1fr))";
49851}, function (_ref6) {
49852 var desktop = _ref6.desktop,
49853 minWidth = _ref6.minWidth;
49854 return "repeat(" + (desktop || 'auto-fit') + ", minmax(" + minWidth + "px, 1fr))";
49855}, function (_ref7) {
49856 var bigDesktop = _ref7.bigDesktop,
49857 minWidth = _ref7.minWidth;
49858 return "repeat(" + (bigDesktop || 'auto-fit') + ", minmax(" + minWidth + "px, 1fr))";
49859}, function (_ref8) {
49860 var squared = _ref8.squared;
49861 return squared && 'grid-auto-rows: 1fr';
49862}, function (_ref9) {
49863 var squared = _ref9.squared;
49864 return squared && " \n\t\t&:before {\n\t\t\twidth: 0;\n\t\t\tpadding-bottom: 100%;\n\t\t\tcontent: '';\n\t\t\tgrid-column: 1 / 1;\n\t\t\tgrid-row: 1 / 1;\n\t\t}\n\t\t*:first-child {\n\t\t\tgrid-column: 1 / 1;\n\t\t\tgrid-row: 1 / 1;\n\t\t}\n \t";
49865});
49866GridStyled.displayName = 'GridStyled';
49867CustomGrid.defaultProps = {
49868 minWidth: 40,
49869 rowGap: 20,
49870 columnGap: 20,
49871 squared: false,
49872 mobile: undefined,
49873 tablet: undefined,
49874 desktop: undefined,
49875 bigDesktop: undefined
49876};
49877CustomGrid.displayName = 'CustomGrid';
49878CustomGrid.propTypes = {
49879 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
49880
49881 /** min width of grid column */
49882 minWidth: PropTypes.number,
49883
49884 /** space between rows */
49885 rowGap: PropTypes.number,
49886
49887 /** space between columns */
49888 columnGap: PropTypes.number,
49889
49890 /** grid elements in squared shape */
49891 squared: PropTypes.bool,
49892
49893 /** number of columns on mobile size */
49894 mobile: PropTypes.number,
49895
49896 /** number of columns on tablet size */
49897 tablet: PropTypes.number,
49898
49899 /** number of columns on desktop size */
49900 desktop: PropTypes.number,
49901
49902 /** number of columns on bigDesktop size */
49903 bigDesktop: PropTypes.number
49904};
49905
49906function _templateObject8$2() {
49907 var data = taggedTemplateLiteralLoose(["\n\tcolor: ", ";\n"]);
49908
49909 _templateObject8$2 = function _templateObject8() {
49910 return data;
49911 };
49912
49913 return data;
49914}
49915
49916function _templateObject7$3() {
49917 var data = taggedTemplateLiteralLoose(["\n\toverflow: hidden;\n\tpadding-right: 2px;\n\tcolor: ", ";\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n"]);
49918
49919 _templateObject7$3 = function _templateObject7() {
49920 return data;
49921 };
49922
49923 return data;
49924}
49925
49926function _templateObject6$7() {
49927 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n"]);
49928
49929 _templateObject6$7 = function _templateObject6() {
49930 return data;
49931 };
49932
49933 return data;
49934}
49935
49936function _templateObject5$9() {
49937 var data = taggedTemplateLiteralLoose(["\n\tmargin-bottom: 6px;\n\tcolor: ", ";\n\tfont-size: 13px;\n"]);
49938
49939 _templateObject5$9 = function _templateObject5() {
49940 return data;
49941 };
49942
49943 return data;
49944}
49945
49946function _templateObject4$k() {
49947 var data = taggedTemplateLiteralLoose(["\n\tpadding: 10px 12px 12px 12px;\n"]);
49948
49949 _templateObject4$k = function _templateObject4() {
49950 return data;
49951 };
49952
49953 return data;
49954}
49955
49956function _templateObject3$r() {
49957 var data = taggedTemplateLiteralLoose(["\n\tposition: absolute;\n\tz-index: 2;\n\ttop: 8px;\n\tleft: 8px;\n"]);
49958
49959 _templateObject3$r = function _templateObject3() {
49960 return data;
49961 };
49962
49963 return data;
49964}
49965
49966function _templateObject2$C() {
49967 var data = taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\theight: ", ";\n\tbackground-color: ", ";\n\tbackground-image: url(", ");\n\tbackground-size: cover;\n\n\t&:first-child {\n\t\tborder-top-left-radius: 4px;\n\t}\n\t&:last-child {\n\t\tborder-top-right-radius: 4px;\n\t}\n"]);
49968
49969 _templateObject2$C = function _templateObject2() {
49970 return data;
49971 };
49972
49973 return data;
49974}
49975
49976function _templateObject$1E() {
49977 var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tdisplay: inline-block;\n\twidth: ", ";\n\theight: 100%;\n\tborder: 2px solid transparent;\n\tuser-select: none;\n\n\t&:after {\n\t\tposition: absolute;\n\t\ttop: 0%;\n\t\tleft: 0%;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tborder-radius: 4px;\n\t\tbox-shadow: ", ";\n\t\tcontent: '';\n\t}\n\n\t&:hover,\n\t&:focus {\n\t\t&:after {\n\t\t\tbox-shadow: 0 0 0 2px ", ";\n\t\t}\n\t}\n"]);
49978
49979 _templateObject$1E = function _templateObject() {
49980 return data;
49981 };
49982
49983 return data;
49984}
49985
49986var PlaylistCard = function PlaylistCard(_ref) {
49987 var buttonId = _ref.buttonId,
49988 handleSelect = _ref.handleSelect,
49989 images = _ref.images,
49990 checked = _ref.checked,
49991 selected = _ref.selected,
49992 width = _ref.width,
49993 imageHeight = _ref.imageHeight,
49994 title = _ref.title,
49995 leftText = _ref.leftText,
49996 rightText = _ref.rightText,
49997 props = objectWithoutPropertiesLoose(_ref, ["buttonId", "handleSelect", "images", "checked", "selected", "width", "imageHeight", "title", "leftText", "rightText"]);
49998
49999 return React__default.createElement(PlaylistCardStyled, _extends_1({
50000 checked: checked,
50001 width: width
50002 }, props, {
50003 selected: selected
50004 }), checked !== undefined && React__default.createElement(CheckboxWrapper$2, null, React__default.createElement(Checkbox, {
50005 checked: checked,
50006 onChange: function onChange(e) {
50007 e.stopPropagation();
50008 handleSelect(e.target.checked);
50009 }
50010 })), React__default.createElement(CustomGrid, {
50011 rowGap: 0,
50012 columnGap: 0,
50013 minWidth: 30
50014 }, images.slice(0, 3).map(function (image, index) {
50015 return React__default.createElement(ImgCover$1, {
50016 key: index,
50017 src: image,
50018 alt: "logo",
50019 height: imageHeight
50020 });
50021 })), React__default.createElement(Content$2, null, React__default.createElement(Title$4, null, title), React__default.createElement(Flex$5, null, React__default.createElement(InfoLeft, null, leftText), React__default.createElement(InfoRight, null, rightText))));
50022};
50023
50024var PlaylistCardStyled = styled__default.div(_templateObject$1E(), function (_ref2) {
50025 var width = _ref2.width;
50026 return width && width + "px";
50027}, function (_ref3) {
50028 var theme = _ref3.theme,
50029 checked = _ref3.checked;
50030 return checked ? " 0 0 0 2px " + theme.colors.activeBlue : " 0 0 0 1px " + theme.colors.strokeGray;
50031}, function (_ref4) {
50032 var theme = _ref4.theme;
50033 return theme.colors.activeBlue;
50034});
50035var ImgCover$1 = styled__default.div(_templateObject2$C(), function (_ref5) {
50036 var height = _ref5.height;
50037 return height && height + "px";
50038}, function (_ref6) {
50039 var theme = _ref6.theme;
50040 return theme.colors.strokeGray;
50041}, function (_ref7) {
50042 var src = _ref7.src;
50043 return src;
50044});
50045var CheckboxWrapper$2 = styled__default.div(_templateObject3$r());
50046CheckboxWrapper$2.displayName = 'CheckboxWrapper';
50047var Content$2 = styled__default.div(_templateObject4$k());
50048var Title$4 = styled__default.div(_templateObject5$9(), function (_ref8) {
50049 var theme = _ref8.theme;
50050 return theme.colors.activeBlue;
50051});
50052var Flex$5 = styled__default.div(_templateObject6$7());
50053var InfoLeft = styled__default.div(_templateObject7$3(), function (_ref9) {
50054 var theme = _ref9.theme;
50055 return theme.colors.mediumGray;
50056});
50057var InfoRight = styled__default.div(_templateObject8$2(), function (_ref10) {
50058 var theme = _ref10.theme;
50059 return theme.colors.mediumGray;
50060});
50061PlaylistCard.defaultProps = {
50062 checked: undefined,
50063 handleSelect: undefined,
50064 buttonId: undefined,
50065 width: undefined,
50066 imageHeight: 74,
50067 selected: false,
50068 rightText: undefined,
50069 leftText: undefined
50070};
50071PlaylistCard.propTypes = {
50072 /** if is checked */
50073 checked: PropTypes.bool,
50074
50075 /** func to handle when element is selected */
50076 handleSelect: PropTypes.func,
50077
50078 /** array of images */
50079 images: PropTypes.arrayOf(PropTypes.string).isRequired,
50080
50081 /** button id to use in functional tests */
50082 buttonId: PropTypes.string,
50083
50084 /** card's width */
50085 width: PropTypes.number,
50086
50087 /** card's images height */
50088 imageHeight: PropTypes.number,
50089
50090 /** if the card is selected */
50091 selected: PropTypes.bool,
50092
50093 /** card's title */
50094 title: PropTypes.string.isRequired,
50095
50096 /** card's leftText */
50097 leftText: PropTypes.string,
50098
50099 /** card's rightText */
50100 rightText: PropTypes.string
50101};
50102PlaylistCard.displayName = 'PlaylistCard';
50103
50104function _templateObject4$l() {
50105 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tmargin-left: auto;\n\tflex-direction: column;\n\ttext-align: end;\n"]);
50106
50107 _templateObject4$l = function _templateObject4() {
50108 return data;
50109 };
50110
50111 return data;
50112}
50113
50114function _templateObject3$s() {
50115 var data = taggedTemplateLiteralLoose(["\n\tfont-weight: bold;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n\tmargin-right: 20px;\n"]);
50116
50117 _templateObject3$s = function _templateObject3() {
50118 return data;
50119 };
50120
50121 return data;
50122}
50123
50124function _templateObject2$D() {
50125 var data = taggedTemplateLiteralLoose(["\n\tmargin-right: 20px;\n\tcolor: ", ";\n\tfont-size: 35px;\n\tline-height: 39px;\n\twhite-space: nowrap;\n"]);
50126
50127 _templateObject2$D = function _templateObject2() {
50128 return data;
50129 };
50130
50131 return data;
50132}
50133
50134function _templateObject$1F() {
50135 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tmin-width: 260px;\n\talign-items: center;\n\tpadding: 16px 16px 16px 20px;\n\tbackground-color: ", ";\n\tborder-radius: 4px;\n\tbox-shadow: 0 0 8px rgba(0, 0, 0, 0.15);\n\tborder: ", ";\n\n\tspan,\n\ti {\n\t\tcolor: ", "};\n\t}\n"]);
50136
50137 _templateObject$1F = function _templateObject() {
50138 return data;
50139 };
50140
50141 return data;
50142}
50143
50144var TicketCard = function TicketCard(_ref) {
50145 var queueTag = _ref.queueTag,
50146 ticketNumber = _ref.ticketNumber,
50147 hour = _ref.hour,
50148 language = _ref.language,
50149 priority = _ref.priority,
50150 props = objectWithoutPropertiesLoose(_ref, ["queueTag", "ticketNumber", "hour", "language", "priority"]);
50151
50152 return React__default.createElement(TicketCardWrapper, _extends_1({
50153 priority: priority,
50154 color: theme.colors.strokeGray
50155 }, props), React__default.createElement(TicketNumber$1, null, React__default.createElement(TicketLabel, {
50156 queueTag: queueTag,
50157 ticketNumber: ticketNumber
50158 })), priority && React__default.createElement(PriorityWrapper, null, priority), React__default.createElement(InfoWrapper, null, React__default.createElement(Text, {
50159 color: theme.colors.gray
50160 }, hour), language && React__default.createElement(Text, {
50161 color: theme.colors.mediumGray
50162 }, language)));
50163};
50164
50165var TicketCardWrapper = styled__default(Ripple)(_templateObject$1F(), function (_ref2) {
50166 var theme$$1 = _ref2.theme;
50167 return theme$$1.colors.white;
50168}, function (_ref3) {
50169 var priority = _ref3.priority,
50170 theme$$1 = _ref3.theme;
50171 return priority && "1px solid " + theme$$1.colors.activeBlue;
50172}, function (_ref4) {
50173 var priority = _ref4.priority,
50174 theme$$1 = _ref4.theme;
50175 return priority && theme$$1.colors.activeBlue + " !important";
50176});
50177var TicketNumber$1 = styled__default.span(_templateObject2$D(), function (_ref5) {
50178 var theme$$1 = _ref5.theme;
50179 return theme$$1.colors.darkGray;
50180});
50181var PriorityWrapper = styled__default.span(_templateObject3$s());
50182var InfoWrapper = styled__default.div(_templateObject4$l());
50183PriorityWrapper.displayName = 'PriorityWrapper';
50184TicketCard.displayName = 'TicketCard';
50185TicketCard.defaultProps = {
50186 priority: undefined,
50187 language: undefined
50188};
50189TicketCard.propTypes = {
50190 /** Queue Tag displayed in the ticket card */
50191 queueTag: PropTypes.string.isRequired,
50192
50193 /** Ticker Number displayed in the ticket card */
50194 ticketNumber: PropTypes.string.isRequired,
50195
50196 /** Hour displayed in the ticket card */
50197 hour: PropTypes.string.isRequired,
50198
50199 /** Language displayed in the ticket card */
50200 language: PropTypes.string,
50201
50202 /** Define ticket's priority */
50203 priority: PropTypes.string,
50204
50205 /** Number to be displayed in the ticket card */
50206 onClick: PropTypes.func.isRequired
50207};
50208
50209function _templateObject$1G() {
50210 var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tdisplay: block;\n\twidth: ", "%;\n\theight: ", "%;\n\tbox-sizing: border-box;\n\tfloat: left;\n"]);
50211
50212 _templateObject$1G = function _templateObject() {
50213 return data;
50214 };
50215
50216 return data;
50217}
50218
50219var Row$2 = function Row(_ref) {
50220 var children = _ref.children,
50221 width = _ref.width,
50222 height = _ref.height,
50223 props = objectWithoutPropertiesLoose(_ref, ["children", "width", "height"]);
50224
50225 return React__default.createElement(RowWrapper, _extends_1({
50226 width: width,
50227 height: height
50228 }, props), children);
50229};
50230
50231var RowWrapper = styled__default.div(_templateObject$1G(), function (_ref2) {
50232 var width = _ref2.width;
50233 return width;
50234}, function (_ref3) {
50235 var height = _ref3.height;
50236 return height;
50237});
50238RowWrapper.displayName = 'RowWrapper';
50239Row$2.displayName = 'Row';
50240Row$2.defaultProps = {
50241 children: undefined,
50242 width: 100,
50243 height: 100
50244};
50245Row$2.propTypes = {
50246 children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
50247 width: PropTypes.number,
50248 height: PropTypes.number
50249};
50250
50251var build = createCommonjsModule(function (module) {
50252module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r});},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0});},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t){e.exports=React__default;},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r={alignItems:"center",display:"flex",userSelect:"none"};t.defaultMenuStyle=r;var i={overflow:"hidden",userSelect:"none"};t.defaultWrapperStyle=i;var s={alignCenter:!0,alignOnResize:!0,arrowClass:"scroll-menu-arrow",arrowDisabledClass:"scroll-menu-arrow--disabled",arrowLeft:null,arrowRight:null,clickWhenDrag:!1,data:[],dragging:!0,hideArrows:!1,hideSingleArrow:!1,inertiaScrolling:!1,inertiaScrollingSlowdown:.25,innerWrapperClass:"menu-wrapper--inner",innerWrapperStyle:{textAlign:"left",userSelect:"none",whiteSpace:"nowrap"},itemClass:"menu-item-wrapper",itemClassActive:"active",itemStyle:{display:"inline-block"},menuClass:"horizontal-menu",menuStyle:r,onSelect:function(){return !1},onUpdate:function(){return !1},scrollBy:0,scrollToSelected:!1,selected:"",transition:.4,translate:0,useButtonRole:!0,wrapperClass:"menu-wrapper",wrapperStyle:i,wheel:!0,xPoint:0,rtl:!1};t.defaultProps=s;},function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=r(n(3));t.default=i.default;},function(e,t,n){var r=this&&this.__extends||function(){var e=function(t,n){return (e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t;}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);})(t,n)};return function(t,n){function r(){this.constructor=t;}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r);}}(),i=this&&this.__assign||function(){return (i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var a=s(n(0)),o=n(1),l=n(4),u=n(5),d=function(e){function t(t){var n=e.call(this,t)||this;return n.state={dragging:!1,firstItemVisible:!0,lastItemVisible:!1,leftArrowVisible:!1,rightArrowVisible:!0,startDragTranslate:0,translate:n.props.translate,xDraggedDistance:0,xPoint:0},n.setRef=function(e){var t=Object.entries(e)[0],r=t[0],i=t[1];i.elem&&(n.ref[r]=i);},n.setMenuInnerRef=function(e){n.menuInner=e;},n.setWrapperRef=function(e){n.menuWrapper=e;},n.checkFirstLastItemVisibility=function(e){var t=e.translate,r=void 0===t?n.state.translate:t,i=n.menuItems,s=!0,a=!1;if(i){var o=n.getVisibleItems({offset:r});s=o.includes(i[0]),a=o.includes(i.slice(-1)[0]);}return {firstItemVisible:s,lastItemVisible:a}},n.setFirstLastItemVisibility=function(){var e=n.state,t=e.firstItemVisible,r=e.lastItemVisible,i=n.checkFirstLastItemVisibility({}),s=i.firstItemVisible,a=i.lastItemVisible;if(t!==s||r!==a){var o=!s,l=!a;n.setState({firstItemVisible:s,lastItemVisible:a,leftArrowVisible:o,rightArrowVisible:l});}},n.onLoad=function(){n.setInitial(),n.mounted=!0;},n.resizeHandler=function(){if(!n.props.alignOnResize)return !1;clearTimeout(n.resizeTimer),n.resizeTimer=setTimeout(function(){return n.resize()},250);},n.resize=function(){var e=n.props.alignCenter;n.updateWidth({});var t=n.getVisibleItems({}),r=n.getOffsetToItemByIndex({index:t[0]&&t[0][1].index||0}),i=e?n.getCenterOffset({items:t}):0;n.setState({translate:-r+i}),n.setFirstLastItemVisibility();},n.setInitial=function(){var e=n.props,t=e.selected,r=e.data,s=e.translate,a=e.scrollToSelected,u=e.alignCenter,d=n.state.translate;if(!r||!r.length)return !1;n.menuItems.length&&r===n.data||(n.menuItems=n.getMenuItems(),n.data=r),n.updateWidth({});var f=i({},n.state);(!n.mounted&&s===o.defaultProps.translate||!l.translateIsValid(s)&&!l.translateIsValid(d))&&(f.translate=u?n.firstPageOffset:o.defaultProps.translate);var c=n.checkFirstLastItemVisibility({translate:s}),m=c.firstItemVisible,p=c.lastItemVisible;(f.firstItemVisible=m,f.lastItemVisible=p,f.leftArrowVisible=!m,f.rightArrowVisible=!p,a)&&(n.isScrollNeeded({itemId:t,translate:f.translate})&&(f.translate=n.getOffsetToItemByKey(t)));n.setState(i({},f));},n.isScrollNeeded=function(e){var t=e.itemId,r=e.translate,i=void 0===r?n.state.translate:r,s=n.getItemByKey(t);return !n.getVisibleItems({offset:i}).includes(s)},n.scrollTo=function(e){var t=n.state.translate,r=n.getOffsetToItemByKey(e);if(n.selected=e,t===r)return !1;n.setState({translate:r});},n.getMenuItems=function(){return Object.entries(n.ref).slice(0,n.props.data.length||0)},n.getItemsWidth=function(e){var t=e.items;return (void 0===t?n.menuItems:t).map(function(e){return e[1].elem}).filter(Boolean).reduce(function(e,t){return e+l.getClientRect(t).width},0)},n.getWidth=function(e){var t=e.items,r=window&&window.innerWidth,i=l.getClientRect(n.menuWrapper);return {wWidth:r,menuPos:i.x,menuWidth:i.width,allItemsWidth:n.getItemsWidth({items:t})}},n.updateWidth=function(e){var t=e.items,r=void 0===t?n.menuItems:t,i=n.getWidth({items:r}),s=i.wWidth,a=i.menuPos,o=i.menuWidth,l=i.allItemsWidth,u=n.getPagesOffsets({allItemsWidth:l,items:r,menuWidth:o}),d=u.firstPageOffset,f=u.lastPageOffset;n.menuPos=a,n.wWidth=s,n.allItemsWidth=l,n.menuWidth=o,n.firstPageOffset=d,n.lastPageOffset=f;},n.getFirstPageOffset=function(e){var t=e.items,r=void 0===t?n.menuItems:t,i=e.offset,s=void 0===i?n.state.translate:i,a=e.menuWidth,o=void 0===a?n.menuWidth:a,l=n.getVisibleItems({items:r,menuWidth:o,offset:s});return n.getCenterOffset({items:l,menuWidth:o})},n.getLastPageOffset=function(e){var t=e.items,r=void 0===t?n.menuItems:t,i=e.allItemsWidth,s=void 0===i?n.allItemsWidth:i,a=e.menuWidth,o=void 0===a?n.menuWidth:a,l=n.props.rtl,u=n.getVisibleItems({items:r,menuWidth:o,offset:l?s-o:-s+o});return n.getCenterOffset({items:u,menuWidth:o})},n.getPagesOffsets=function(e){var t=e.items,r=void 0===t?n.menuItems:t,i=e.allItemsWidth,s=void 0===i?n.allItemsWidth:i,a=e.menuWidth,o=void 0===a?n.menuWidth:a,l=e.offset,u=void 0===l?n.state.translate:l;return {firstPageOffset:n.getFirstPageOffset({items:r,menuWidth:o,offset:u}),lastPageOffset:n.getLastPageOffset({allItemsWidth:s,items:r,menuWidth:o})}},n.onItemClick=function(e){var t=n.props,r=t.clickWhenDrag,i=t.onSelect;if(n.state.xDraggedDistance>5&&!r)return !1;n.selected=e,i&&i(e);},n.getVisibleItems=function(e){var t=e.items,r=void 0===t?n.menuItems:t,i=e.menuWidth,s=void 0===i?n.menuWidth:i,a=e.offset,u=void 0===a?n.state.translate:a,d=e.translate,f=void 0===d?n.state.translate||o.defaultProps.translate:d;return r.filter(function(e){var t=l.getClientRect(e[1].elem).width,i=n.getItemInd(r,e),a=n.getOffsetToItemByIndex({index:i,menuItems:r,translate:f});return n.elemVisible({elWidth:t,menuWidth:s,offset:u,x:a})})},n.elemVisible=function(e){var t=e.x,r=e.offset,i=void 0===r?0:r,s=e.elWidth,a=e.menuWidth,o=void 0===a?n.menuWidth:a,l=n.props.rtl,u=l?-(o+1):-1,d=l?1:o+1,f=l?-(t+i):t+i,c=l?f-s:f+s;return l?c>=u&&f<=d:f>=u&&c<=d},n.getItemInd=function(e,t){return void 0===e&&(e=n.menuItems),e&&t?e.findIndex(function(e){return e[0]===t[0]}):0},n.getNextItemInd=function(e,t){var r=n.menuItems;if(e){if(!t.length)return 0}else if(!t.length)return r.length;var i=e?n.getItemInd(r,t[0])-1:n.getItemInd(r,t.slice(-1)[0])+1;return i<0?0:i},n.getOffsetToItemByKey=function(e){var t=n.state.translate,r=n.getItemIndexByKey(e);if(-1===r)return t;var i=n.props,s=i.alignCenter,a=i.rtl;t=n.getOffsetToItemByIndex({index:r});var l=n.getVisibleItems({offset:-t}),u=s?n.getCenterOffset({items:l}):o.defaultProps.translate;return t=-(t-(a?-u:u)),n.itBeforeStart(t)?t=n.getOffsetAtStart():n.itAfterEnd(t)&&(t=n.getOffsetAtEnd()),t},n.getItemByKey=function(e){return n.menuItems.find(function(t){return t[1].key===e})||["",{key:"n",elem:null,index:-1}]},n.getItemIndexByKey=function(e){return e?n.menuItems.findIndex(function(t){return t[1].key===e}):-1},n.getOffsetToItemByIndex=function(e){var t=e.index,r=e.menuItems,i=void 0===r?n.menuItems:r,s=e.translate,a=void 0===s?n.state.translate:s;if(!i.length)return 0;var o=t>=i.length?i.length-1:t,u=l.getClientRect(i[o][1].elem),d=u.x,f=u.x2;return n.props.rtl?n.menuPos+n.menuWidth-a-f:+d-a-n.menuPos},n.getScrollRightOffset=function(e,t){void 0===t&&(t=n.menuItems);var r=n.props,i=r.scrollBy,s=r.rtl,a=i?e[0][1].index+i:s?n.getPrevItem((e[0]&&e[0][1]||t[0][1]).key)[1].index:n.getNextItem((e.slice(-1)[0]&&e.slice(-1)||t.slice(-1))[0][1].key)[1].index,o=-n.getOffsetToItemByIndex({index:a,menuItems:t});return s?-o:o},n.getScrollLeftOffset=function(e,t){void 0===t&&(t=n.menuItems);var r=n.props,i=r.scrollBy,s=(r.rtl?n.getNextItem((e.slice(-1)[0]&&e.slice(-1)||t.slice(-1))[0][1].key):n.getPrevItem((e[0]&&e[0][1]||t[0][1]).key))[1].index-(i?i-1:e.length);return -n.getOffsetToItemByIndex({index:s<0?0:s,menuItems:t})},n.getNextItem=function(e){var t=n.menuItems;return t[t.findIndex(function(t){return t[1].key===e})+1]||t.slice(-1)[0]},n.getPrevItem=function(e){var t=n.menuItems;return t[t.findIndex(function(t){return t[1].key===e})-1]||t[0]},n.getOffset=function(e,t){void 0===t&&(t=n.menuItems),e=n.props.rtl?!e:e;var r=n.getVisibleItems({items:t});return e?n.getScrollLeftOffset(r,t):n.getScrollRightOffset(r,t)},n.getCenterOffset=function(e){var t=e.items,r=void 0===t?n.menuItems:t,i=e.menuWidth,s=void 0===i?n.menuWidth:i;return r.length?(s-n.getItemsWidth({items:r}))/2:0},n.handleWheel=function(e){if(!n.props.wheel)return !1;e.deltaY<0?n.handleArrowClick():n.handleArrowClick(!1);},n.getOffsetAtStart=function(){var e=n.firstPageOffset;return n.props.alignCenter?e:o.defaultProps.translate},n.getOffsetAtEnd=function(){var e=n.props.alignCenter,t=n,r=t.allItemsWidth,i=t.menuWidth,s=t.lastPageOffset,a=r-i;return e?-a-s:-a},n.handleArrowClickRight=function(){n.handleArrowClick(!1);},n.handleArrowClick=function(e){void 0===e&&(e=!0);var t=n.props,r=t.alignCenter,i=t.rtl,s=n,a=s.allItemsWidth,l=s.menuWidth;if(!r&&!e&&a<l)return !1;var u=0,d=n.getVisibleItems({}),f=d[0]&&0===d[0][1].index,c=d.slice(-1)[0]&&d.slice(-1)[0][1].index===n.menuItems.length-1,m=n.getOffset(e);if(e&&(f||n.itBeforeStart(m)))u=n.getOffsetAtStart();else if(e||!c&&!n.itAfterEnd(m)){var p=r?n.getCenterOffset({items:n.getVisibleItems({offset:m})}):0;u=m+(i?e?p+n.menuWidth:-p-n.menuWidth:p);}else u=n.getOffsetAtEnd();n.setState({startDragTranslate:0,translate:u,xDraggedDistance:0,xPoint:o.defaultProps.xPoint});},n.itBeforeStart=function(e){var t=n.props.alignCenter,r=n,i=r.menuWidth,s=r.allItemsWidth,a=r.firstPageOffset;return s<i||(t?e>a:e>o.defaultProps.translate)},n.itAfterEnd=function(e){var t=n.props.alignCenter,r=n,i=r.menuWidth,s=r.allItemsWidth,a=r.lastPageOffset;return s<i||(t?e<o.defaultProps.translate&&Math.abs(e)>s-i+a:e<o.defaultProps.translate&&Math.abs(e)>s-i)},n.getPoint=function(e){return "touches"in e?e.touches[0].clientX:"clientX"in e?e.clientX:0},n.handleDragStart=function(e){if(e&&"buttons"in e&&2===e.buttons)return !1;if(!n.props.dragging)return !1;var t=n.state.translate;n.dragHistory=[{time:Date.now(),position:t}],n.setState({dragging:!0,startDragTranslate:t,xDraggedDistance:0,xPoint:0});},n.handleDrag=function(e){var t=n.props,r=t.dragging,i=t.rtl,s=n.state,a=s.translate,l=s.dragging,u=s.xPoint,d=s.xDraggedDistance;if(!r||!l)return !1;var f=n.getPoint(e),c=u===o.defaultProps.xPoint?o.defaultProps.xPoint:u-f,m=a-(i?-c:c);n.itBeforeStart(m)?m-=Math.abs(c)/2:n.itAfterEnd(m)&&(m+=Math.abs(c)/2),0!==c&&n.dragHistory.push({time:Date.now(),position:m});var p=m;n.setState({translate:p,xDraggedDistance:d+Math.abs(c),xPoint:f});},n.handleDragStop=function(e){var t=n,r=t.allItemsWidth,i=t.menuWidth,s=n.state,a=s.translate,l=s.xPoint,u=void 0===l?n.getPoint(e):l,d=n.state,f=d.dragging,c=d.startDragTranslate,m=n.props,p=m.dragging,g=m.alignCenter;if(!p||!f)return !1;if(n.props.inertiaScrolling){var h=Date.now(),v=n.dragHistory.filter(function(e){return h-e.time<150});if(v.length>2){var I=v[0],y=v[v.length-1],b=(y.position-I.position)/(y.time-I.time);a+=(b*=n.props.inertiaScrollingSlowdown)*(1e3*n.props.transition);}}var w=a;n.itBeforeStart(a)?(w=n.getOffsetAtStart(),u=o.defaultProps.xPoint):n.itAfterEnd(a)&&(w=n.getOffsetAtEnd(),u=o.defaultProps.xPoint),!g&&r<=i&&(w=o.defaultProps.translate,u=o.defaultProps.xPoint),n.setState({dragging:!1,translate:w,xPoint:u},function(){return n.onUpdate({translate:w,translateOld:c})});},n.isArrowsVisible=function(){var e=n,t=e.allItemsWidth,r=e.menuWidth,i=e.props.hideArrows;return !Boolean(i&&t<=r)},n.onUpdate=function(e){var t=e.translate,r=void 0===t?n.state.translate:t,i=e.translateOld,s=void 0===i?n.state.translate:i,a=n.props.onUpdate,o=n.lastTranslateUpdate;r!==s&&r!==o&&(n.lastTranslateUpdate=r,"function"==typeof a&&a({translate:r}));},n.ref={},n.menuWrapper=null,n.menuInner=null,n.mounted=!1,n.needUpdate=!1,n.allItemsWidth=0,n.menuPos=0,n.menuWidth=0,n.wWidth=0,n.firstPageOffset=0,n.lastPageOffset=0,n.lastTranslateUpdate=0,n.menuItems=[],n.selected=String(t.selected)||"",n.onLoadTimer=0,n.rafTimer=0,n.resizeTimer=0,n.frameId=0,n.data=null,n.dragHistory=[],n}return r(t,e),t.prototype.componentDidCatch=function(e,t){console.log("ScrollMenu catched error: ",e,t);},t.prototype.componentDidMount=function(){var e=this;this.setInitial(),window.requestAnimationFrame=window.requestAnimationFrame||function(){return !1};var t=l.testPassiveEventSupport(),n=!t||{passive:!0,capture:!0},r=!!t&&{passive:!0,capture:!1};window.addEventListener("load",this.onLoad,r),window.addEventListener("resize",this.resizeHandler,r),document.addEventListener("mousemove",this.handleDrag,n),document.addEventListener("mouseup",this.handleDragStop,n),this.onLoadTimer=setTimeout(function(){return e.onLoad(),e.forceUpdate()},0);},t.prototype.shouldComponentUpdate=function(e,t){var n=this.state,r=n.translate,i=n.dragging,s=n.firstItemVisible,a=n.lastItemVisible,o=t.translate,u=t.dragging,d=t.firstItemVisible,f=t.lastItemVisible,c=this.props,m=c.translate,p=c.selected,g=c.scrollToSelected,h=e.translate,v=e.selected,I=l.notUndefOrNull(h)&&m!==h,y=h!==o||r!==o||I,b=l.notUndefOrNull(v)&&p!==v,w=b||this.selected!==v,P=y||w,S=s!==d,W=a!==f,O=o,x=this.props.data!==e.data||this.props.data.length!==e.data.length,C=l.translateIsValid(h)&&I&&!x;return (x||g&&b)&&(this.needUpdate=!0),P&&(b&&(this.selected=v),C&&(O=h)),C&&this.setState({translate:+O}),x||y||i!==u||P||S||W},t.prototype.componentDidUpdate=function(e,t){var n=this;this.needUpdate&&(this.needUpdate=!1,this.onLoad());var r=t.translate,i=this.state,s=i.translate;i.dragging||r===s||this.onUpdate({translate:s,translateOld:r});var a=this.props,o=a.hideSingleArrow,l=a.transition;o&&(cancelAnimationFrame(this.frameId),clearTimeout(this.rafTimer),this.frameId=requestAnimationFrame(this.setFirstLastItemVisibility),this.rafTimer=setTimeout(function(){cancelAnimationFrame(n.frameId),n.frameId=requestAnimationFrame(n.setFirstLastItemVisibility);},1e3*l+10));},t.prototype.componentWillUnmount=function(){window.removeEventListener("resize",this.resizeHandler),document.removeEventListener("mousemove",this.handleDrag),document.removeEventListener("mouseup",this.handleDragStop),clearTimeout(this.rafTimer),clearTimeout(this.onLoadTimer),clearTimeout(this.resizeTimer),cancelAnimationFrame(this.frameId);},t.prototype.render=function(){var e=this.props,t=e.arrowClass,n=e.arrowDisabledClass,r=e.arrowLeft,s=e.arrowRight,l=e.data,d=e.inertiaScrolling,f=e.innerWrapperStyle,c=e.innerWrapperClass,m=e.itemStyle,p=e.itemClass,g=e.itemClassActive,h=e.menuStyle,v=e.menuClass,I=e.transition,y=e.useButtonRole,b=e.wrapperClass,w=e.wrapperStyle,P=e.rtl,S=this.state,W=S.translate,O=S.dragging,x=S.leftArrowVisible,C=S.rightArrowVisible,A=this.selected,_=this.mounted;if(!l||!l.length)return null;var V=!_||this.isArrowsVisible(),D=i({},o.defaultMenuStyle,h),T=i({},o.defaultWrapperStyle,w),k=i({},o.defaultProps.itemStyle,m),E={className:t,disabledClass:n};return a.createElement("div",{className:v,style:D,onWheel:this.handleWheel},r&&a.createElement(u.ArrowWrapper,i({},E,{isDisabled:!V||!x,onClick:this.handleArrowClick}),r),a.createElement("div",{className:b,style:T,ref:this.setWrapperRef,onMouseDown:this.handleDragStart,onTouchStart:this.handleDragStart,onTouchEnd:this.handleDragStop,onMouseMove:this.handleDrag,onTouchMove:this.handleDrag},a.createElement(u.InnerWrapper,{data:l,translate:W,dragging:O,mounted:_,transition:_?I:0,selected:A,setRef:this.setRef,setMenuInnerRef:this.setMenuInnerRef,onClick:this.onItemClick,innerWrapperStyle:f,innerWrapperClass:c,itemStyle:k,itemClass:p,itemClassActive:g,inertiaScrolling:d,useButtonRole:y,rtl:P})),s&&a.createElement(u.ArrowWrapper,i({},E,{isDisabled:!V||!C,onClick:this.handleArrowClickRight}),s))},t.defaultProps=o.defaultProps,t}(a.Component);t.ScrollMenu=d,t.default=d;},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});t.notUndefOrNull=function(e){return void 0!==e&&null!==e};t.getClientRect=function(e){if(!e||!e.getBoundingClientRect||"function"!=typeof e.getBoundingClientRect)return {width:0,x:0,x2:0};var t=e.getBoundingClientRect(),n=t.left,r=void 0===n?0:n,i=t.width,s=void 0===i?0:i,a=t.right;return {width:s,x:+r,x2:+(void 0===a?0:a)}};t.formatTranslate=function(e){return +e.toFixed(0)};var r=function(e){return "number"==typeof e&&!isNaN(+e)};t.translateIsValid=r;t.validateTranslate=function(e,t){return r(e)?+e:t};t.testPassiveEventSupport=function(){var e=!1;try{var t={get passive(){return e=!0,!1}};window.addEventListener("testPassiveEventSupport",t,t),window.removeEventListener("testPassiveEventSupport",t,t);}catch(t){e=!1;}return e};},function(e,t,n){var r=this&&this.__extends||function(){var e=function(t,n){return (e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t;}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);})(t,n)};return function(t,n){function r(){this.constructor=t;}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r);}}(),i=this&&this.__assign||function(){return (i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=s(n(0)),o=n(1),l={disabledClass:o.defaultProps.arrowDisabledClass},u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.render=function(){var e=this.props,t=e.isDisabled,n=e.className,r=e.disabledClass,i=e.onClick,s=e.children,o=n+" "+(t?r:"");return a.default.createElement("div",{className:o,onClick:function(){return i()}},a.default.cloneElement(s,s.props))},t.defaultProps=l,t}(a.default.PureComponent);t.ArrowWrapper=u,t.innerStyle=function(e){var t=e.translate,n=e.dragging,r=e.mounted,i=e.transition,s=e.inertiaScrolling;return {transform:"translate3d("+(e.rtl?-t:t)+"px, 0, 0)",transition:"transform "+(n||!r?"0":i)+"s"+(s?" ease-out":""),width:"9900px"}};var d=function(e){function n(t){var n=e.call(this,t)||this;return n.setMenuInnerRef=function(e){(0, n.props.setMenuInnerRef)({menuInner:{key:"menuInner",elem:e}});},n.setRef=function(e,t,r,i){var s;(0, n.props.setRef)(((s={})[e]={index:r,key:t,elem:i},s));},n.state={data:[],items:[],selected:""},n}return r(n,e),n.getDerivedStateFromProps=function(e,t){return t.data!==e.data||t.selected!==e.selected?{data:e.data,items:n.setItems(e.data,e.selected,e.onClick),selected:e.selected}:null},n.prototype.render=function(){var e=this,n=this.props,r=n.translate,s=n.dragging,o=n.mounted,l=n.transition,u=n.innerWrapperStyle,d=n.innerWrapperClass,f=n.itemStyle,c=n.itemClass,m=n.itemClassActive,p=n.inertiaScrolling,g=n.useButtonRole,h=n.rtl,v=t.innerStyle({dragging:s,inertiaScrolling:p,mounted:o,rtl:h,transition:l,translate:r}),I=i({},v,u);return a.default.createElement("div",{className:d,style:I,ref:function(t){return e.setMenuInnerRef(t)}},this.state.items.map(function(t,n){return a.default.createElement("div",{ref:function(r){return e.setRef("menuitem-"+n,String(t.key||""),n,r)},className:c+" "+(t.props.selected?m:""),key:"menuItem-"+t.key,style:f,onClick:t.props.onClick(),tabIndex:0,role:g?"button":""},t)}))},n.defaultProps={data:[],dragging:!0,mounted:!1,selected:o.defaultProps.selected,transition:o.defaultProps.transition,translate:o.defaultProps.translate},n.isElementActive=function(e,t){return String(e)===String(t)},n.setItems=function(e,t,r){return e.map(function(e){var i=e.props.onClick,s=void 0===i?function(){return !1}:i,o={onClick:function(){return n.forwardClickHandler(e.key,s,r)},selected:n.isElementActive(e.key,t)};return a.default.cloneElement(e,o)})},n.forwardClickHandler=function(e,t,n){return void 0===t&&(t=function(){return !1}),function(){t(),n(e);}},n}(a.default.PureComponent);t.InnerWrapper=d;}]);
50253});
50254
50255var ScrollMenu = unwrapExports(build);
50256
50257function _templateObject2$E() {
50258 var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 13px;\n\theight: 26px;\n\n\talign-items: center;\n\tjustify-content: center;\n\n\tmargin-right: ", ";\n\tmargin-left: ", ";\n\n\tcursor: pointer;\n\ttext-align: center;\n\ttext-transform: uppercase;\n"]);
50259
50260 _templateObject2$E = function _templateObject2() {
50261 return data;
50262 };
50263
50264 return data;
50265}
50266
50267function _templateObject$1H() {
50268 var data = taggedTemplateLiteralLoose(["\n\t", "\n\t.menu-item-wrapper:focus {\n\t\toutline: none !important;\n\t}\n\n\t.scroll-menu-arrow--disabled i {\n\t\tcolor: ", ";\n\t\tcursor: default;\n\t}\n"]);
50269
50270 _templateObject$1H = function _templateObject() {
50271 return data;
50272 };
50273
50274 return data;
50275}
50276
50277var Arrow = function Arrow(_ref) {
50278 var side = _ref.side,
50279 iconColor = _ref.iconColor;
50280 return React__default.createElement(ArrowWrapper, {
50281 side: side
50282 }, React__default.createElement(Icon, {
50283 icon: side === 'left' ? 'select-left' : 'select-right',
50284 color: iconColor
50285 }));
50286};
50287
50288var Carousel = function Carousel(_ref2) {
50289 var data = _ref2.data,
50290 arrowsColor = _ref2.arrowsColor,
50291 arrowsColorDisabled = _ref2.arrowsColorDisabled,
50292 borderColor = _ref2.borderColor,
50293 props = objectWithoutPropertiesLoose(_ref2, ["data", "arrowsColor", "arrowsColorDisabled", "borderColor"]);
50294
50295 return React__default.createElement("div", null, React__default.createElement(ScrollMenuContainer, {
50296 arrowsColorDisabled: arrowsColorDisabled,
50297 borderColor: borderColor
50298 }, React__default.createElement(ScrollMenu, _extends_1({
50299 data: data,
50300 alignCenter: false,
50301 arrowLeft: React__default.createElement(Arrow, {
50302 side: "left",
50303 iconColor: arrowsColor
50304 }),
50305 arrowRight: React__default.createElement(Arrow, {
50306 side: "right",
50307 iconColor: arrowsColor
50308 }),
50309 scrollBy: 1,
50310 hideSingleArrow: true,
50311 wheel: false
50312 }, props))));
50313};
50314
50315var ScrollMenuContainer = styled__default.div(_templateObject$1H(), function (_ref3) {
50316 var borderColor = _ref3.borderColor;
50317 return borderColor && "\n\tborder: 2px solid " + borderColor + ";\n\tbox-sizing: border-box;\n\tborder-radius: 4px;\n\t\tpadding: 0 14px;\n\t";
50318}, function (_ref4) {
50319 var arrowsColorDisabled = _ref4.arrowsColorDisabled;
50320 return arrowsColorDisabled + " !important";
50321});
50322var ArrowWrapper = styled__default.div(_templateObject2$E(), function (_ref5) {
50323 var side = _ref5.side;
50324 return side === 'left' ? '6px' : '0';
50325}, function (_ref6) {
50326 var side = _ref6.side;
50327 return side === 'right' ? '6px' : '0';
50328});
50329ArrowWrapper.displayName = 'ArrowWrapper';
50330Arrow.defaultProps = {
50331 iconColor: theme.colors.mediumGray
50332};
50333Arrow.propTypes = {
50334 side: PropTypes.string.isRequired,
50335 iconColor: PropTypes.string
50336};
50337Carousel.defaultProps = {
50338 data: undefined,
50339 arrowsColor: theme.colors.mediumGray,
50340 arrowsColorDisabled: theme.colors.strokeGray,
50341 borderColor: undefined
50342};
50343Carousel.propTypes = {
50344 /** children components that will be inside carousel */
50345 data: PropTypes.arrayOf(PropTypes.node),
50346
50347 /** carousel arrows color */
50348 arrowsColor: PropTypes.string,
50349
50350 /** carousel arrows color when disabled*/
50351 arrowsColorDisabled: PropTypes.string,
50352
50353 /** carousel border color */
50354 borderColor: PropTypes.string
50355};
50356
50357exports.Button = Button;
50358exports.IconButton = IconButton;
50359exports.ButtonLink = ButtonLink;
50360exports.TopButton = TopButton;
50361exports.SelectButton = SelectButton;
50362exports.SelectGroupButton = SelectGroupButton;
50363exports.GenerateButton = GenerateButton;
50364exports.SquareButton = SquareButton;
50365exports.Navbar = Navbar;
50366exports.Tabs = Tabs;
50367exports.SideNav = SideNav;
50368exports.AnchorMenu = AnchorMenu;
50369exports.Block = Block;
50370exports.BlockWrapper = BlockWrapper;
50371exports.BlockBar = BlockBar;
50372exports.Span = Span;
50373exports.Modal = Modal;
50374exports.FullScreenModal = FullScreenModal;
50375exports.ErrorModal = ErrorModal;
50376exports.ConfirmationModal = ConfirmationModal;
50377exports.HelpTooltip = HelpTooltip;
50378exports.StyledTooltip = StyledTooltip;
50379exports.Tooltip = Tooltip;
50380exports.TooltipExample = TooltipExample;
50381exports.Pagination = Pagination;
50382exports.Input = Input;
50383exports.InputField = InputField;
50384exports.InputFile = InputFile;
50385exports.TextArea = TextArea;
50386exports.Toggle = Toggle;
50387exports.Checkbox = Checkbox;
50388exports.Radio = Radio;
50389exports.Tag = Tag;
50390exports.InputGroup = InputGroup;
50391exports.InputPassword = InputPassword;
50392exports.InputRange = InputRange;
50393exports.NumberSpinner = NumberSpinner;
50394exports.Error = Error$1;
50395exports.Select = Select$1;
50396exports.Collapse = Collapse$1;
50397exports.ExpandableSection = ExpandableSection;
50398exports.DatePicker = DatePicker;
50399exports.ColorPicker = ColorPicker;
50400exports.ColorDisplayer = ColorDisplayer;
50401exports.TimePicker = TimePicker;
50402exports.TimePickerGroup = TimePickerGroup;
50403exports.Rating = Rating;
50404exports.RatingBox = RatingBox;
50405exports.Icon = Icon;
50406exports.IconName = IconName;
50407exports.Toast = Toast$1;
50408exports.ToastWrapper = ToastWrapper;
50409exports.notify = notify;
50410exports.notifySuccess = notifySuccess;
50411exports.notifyError = notifyError;
50412exports.notifyWarning = notifyWarning;
50413exports.CenteredGrid = CenteredGrid;
50414exports.Section = Section;
50415exports.Text = Text;
50416exports.BigHeader = BigHeader;
50417exports.Header = Header$1;
50418exports.SubHeader = SubHeader;
50419exports.ButtonText = ButtonText;
50420exports.LabelText = LabelText;
50421exports.ErrorText = ErrorText;
50422exports.TextTruncate = TextTruncate;
50423exports.BreadCrumbs = BreadCrumbs;
50424exports.Loading = Loading;
50425exports.LoadingModal = LoadingModal;
50426exports.List = List;
50427exports.ListHeader = ListHeader;
50428exports.ListHeaderAction = ListHeaderAction;
50429exports.ListRow = ListRow;
50430exports.ListAddInfoWrapper = ListAddInfoWrapper;
50431exports.ListActionsWrapper = ListActionsWrapper;
50432exports.ListCard = ListCard;
50433exports.ListExpandable = ListExpandable;
50434exports.DndListRow = DndListRow;
50435exports.DndListContainer = DndListContainer;
50436exports.DndHTML5Provider = DndHTML5Provider;
50437exports.EmptyState = EmptyState;
50438exports.StatusMessage = StatusMessage;
50439exports.BulletState = BulletState;
50440exports.Table = Table;
50441exports.TableHeader = TableHeader;
50442exports.TableBody = TableBody;
50443exports.PasswordStrengthMeter = PasswordStrengthMeter;
50444exports.Dropdown = Dropdown;
50445exports.GradeDropdown = GradeDropdown;
50446exports.ColorLabel = ColorLabel;
50447exports.Label = Label;
50448exports.BottomLabel = BottomLabel;
50449exports.TicketLabel = TicketLabel;
50450exports.WidgetWeather = WidgetWeather;
50451exports.WidgetWeatherIcon = WidgetWeatherIcon;
50452exports.WidgetDate = WidgetDate;
50453exports.WidgetDateShort = WidgetDateShort;
50454exports.WidgetCardContainer = WidgetCardContainer;
50455exports.WidgetCard = WidgetCard;
50456exports.DigitalClock = DigitalClock;
50457exports.TimeWidget = TimeWidget;
50458exports.ImageCard = ImageCard;
50459exports.PlaylistCard = PlaylistCard;
50460exports.TicketCard = TicketCard;
50461exports.CustomGrid = CustomGrid;
50462exports.Row = Row$2;
50463exports.Carousel = Carousel;
50464exports.Ripple = Ripple;
50465exports.DefaultTheme = theme;
50466exports.SecondaryTheme = secondary;
50467//# sourceMappingURL=index.js.map