UNPKG

77.4 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3 typeof define === 'function' && define.amd ? define(['exports'], factory) :
4 (factory((global['fontawesome-svg-core'] = {})));
5}(this, (function (exports) { 'use strict';
6
7 function _typeof(obj) {
8 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
9 _typeof = function (obj) {
10 return typeof obj;
11 };
12 } else {
13 _typeof = function (obj) {
14 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
15 };
16 }
17
18 return _typeof(obj);
19 }
20
21 function _classCallCheck(instance, Constructor) {
22 if (!(instance instanceof Constructor)) {
23 throw new TypeError("Cannot call a class as a function");
24 }
25 }
26
27 function _defineProperties(target, props) {
28 for (var i = 0; i < props.length; i++) {
29 var descriptor = props[i];
30 descriptor.enumerable = descriptor.enumerable || false;
31 descriptor.configurable = true;
32 if ("value" in descriptor) descriptor.writable = true;
33 Object.defineProperty(target, descriptor.key, descriptor);
34 }
35 }
36
37 function _createClass(Constructor, protoProps, staticProps) {
38 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
39 if (staticProps) _defineProperties(Constructor, staticProps);
40 return Constructor;
41 }
42
43 function _defineProperty(obj, key, value) {
44 if (key in obj) {
45 Object.defineProperty(obj, key, {
46 value: value,
47 enumerable: true,
48 configurable: true,
49 writable: true
50 });
51 } else {
52 obj[key] = value;
53 }
54
55 return obj;
56 }
57
58 function _objectSpread(target) {
59 for (var i = 1; i < arguments.length; i++) {
60 var source = arguments[i] != null ? arguments[i] : {};
61 var ownKeys = Object.keys(source);
62
63 if (typeof Object.getOwnPropertySymbols === 'function') {
64 ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
65 return Object.getOwnPropertyDescriptor(source, sym).enumerable;
66 }));
67 }
68
69 ownKeys.forEach(function (key) {
70 _defineProperty(target, key, source[key]);
71 });
72 }
73
74 return target;
75 }
76
77 function _slicedToArray(arr, i) {
78 return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
79 }
80
81 function _toConsumableArray(arr) {
82 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
83 }
84
85 function _arrayWithoutHoles(arr) {
86 if (Array.isArray(arr)) {
87 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
88
89 return arr2;
90 }
91 }
92
93 function _arrayWithHoles(arr) {
94 if (Array.isArray(arr)) return arr;
95 }
96
97 function _iterableToArray(iter) {
98 if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
99 }
100
101 function _iterableToArrayLimit(arr, i) {
102 var _arr = [];
103 var _n = true;
104 var _d = false;
105 var _e = undefined;
106
107 try {
108 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
109 _arr.push(_s.value);
110
111 if (i && _arr.length === i) break;
112 }
113 } catch (err) {
114 _d = true;
115 _e = err;
116 } finally {
117 try {
118 if (!_n && _i["return"] != null) _i["return"]();
119 } finally {
120 if (_d) throw _e;
121 }
122 }
123
124 return _arr;
125 }
126
127 function _nonIterableSpread() {
128 throw new TypeError("Invalid attempt to spread non-iterable instance");
129 }
130
131 function _nonIterableRest() {
132 throw new TypeError("Invalid attempt to destructure non-iterable instance");
133 }
134
135 var noop = function noop() {};
136
137 var _WINDOW = {};
138 var _DOCUMENT = {};
139 var _MUTATION_OBSERVER = null;
140 var _PERFORMANCE = {
141 mark: noop,
142 measure: noop
143 };
144
145 try {
146 if (typeof window !== 'undefined') _WINDOW = window;
147 if (typeof document !== 'undefined') _DOCUMENT = document;
148 if (typeof MutationObserver !== 'undefined') _MUTATION_OBSERVER = MutationObserver;
149 if (typeof performance !== 'undefined') _PERFORMANCE = performance;
150 } catch (e) {}
151
152 var _ref = _WINDOW.navigator || {},
153 _ref$userAgent = _ref.userAgent,
154 userAgent = _ref$userAgent === void 0 ? '' : _ref$userAgent;
155
156 var WINDOW = _WINDOW;
157 var DOCUMENT = _DOCUMENT;
158 var MUTATION_OBSERVER = _MUTATION_OBSERVER;
159 var PERFORMANCE = _PERFORMANCE;
160 var IS_BROWSER = !!WINDOW.document;
161 var IS_DOM = !!DOCUMENT.documentElement && !!DOCUMENT.head && typeof DOCUMENT.addEventListener === 'function' && typeof DOCUMENT.createElement === 'function';
162 var IS_IE = ~userAgent.indexOf('MSIE') || ~userAgent.indexOf('Trident/');
163
164 var NAMESPACE_IDENTIFIER = '___FONT_AWESOME___';
165 var UNITS_IN_GRID = 16;
166 var DEFAULT_FAMILY_PREFIX = 'fa';
167 var DEFAULT_REPLACEMENT_CLASS = 'svg-inline--fa';
168 var DATA_FA_I2SVG = 'data-fa-i2svg';
169 var DATA_FA_PSEUDO_ELEMENT = 'data-fa-pseudo-element';
170 var DATA_FA_PSEUDO_ELEMENT_PENDING = 'data-fa-pseudo-element-pending';
171 var DATA_PREFIX = 'data-prefix';
172 var DATA_ICON = 'data-icon';
173 var HTML_CLASS_I2SVG_BASE_CLASS = 'fontawesome-i2svg';
174 var MUTATION_APPROACH_ASYNC = 'async';
175 var TAGNAMES_TO_SKIP_FOR_PSEUDOELEMENTS = ['HTML', 'HEAD', 'STYLE', 'SCRIPT'];
176 var PRODUCTION = function () {
177 try {
178 return process.env.NODE_ENV === 'production';
179 } catch (e) {
180 return false;
181 }
182 }();
183 var PREFIX_TO_STYLE = {
184 'fas': 'solid',
185 'far': 'regular',
186 'fal': 'light',
187 'fab': 'brands',
188 'fa': 'solid'
189 };
190 var STYLE_TO_PREFIX = {
191 'solid': 'fas',
192 'regular': 'far',
193 'light': 'fal',
194 'brands': 'fab'
195 };
196 var LAYERS_TEXT_CLASSNAME = 'fa-layers-text';
197 var FONT_FAMILY_PATTERN = /Font Awesome 5 (Solid|Regular|Light|Brands|Free|Pro)/;
198 var FONT_WEIGHT_TO_PREFIX = {
199 '900': 'fas',
200 '400': 'far',
201 'normal': 'far',
202 '300': 'fal'
203 };
204 var oneToTen = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
205 var oneToTwenty = oneToTen.concat([11, 12, 13, 14, 15, 16, 17, 18, 19, 20]);
206 var ATTRIBUTES_WATCHED_FOR_MUTATION = ['class', 'data-prefix', 'data-icon', 'data-fa-transform', 'data-fa-mask'];
207 var RESERVED_CLASSES = ['xs', 'sm', 'lg', 'fw', 'ul', 'li', 'border', 'pull-left', 'pull-right', 'spin', 'pulse', 'rotate-90', 'rotate-180', 'rotate-270', 'flip-horizontal', 'flip-vertical', 'flip-both', 'stack', 'stack-1x', 'stack-2x', 'inverse', 'layers', 'layers-text', 'layers-counter'].concat(oneToTen.map(function (n) {
208 return "".concat(n, "x");
209 })).concat(oneToTwenty.map(function (n) {
210 return "w-".concat(n);
211 }));
212
213 var initial = WINDOW.FontAwesomeConfig || {};
214
215 function getAttrConfig(attr) {
216 var element = DOCUMENT.querySelector('script[' + attr + ']');
217
218 if (element) {
219 return element.getAttribute(attr);
220 }
221 }
222
223 function coerce(val) {
224 // Getting an empty string will occur if the attribute is set on the HTML tag but without a value
225 // We'll assume that this is an indication that it should be toggled to true
226 // For example <script data-search-pseudo-elements src="..."></script>
227 if (val === '') return true;
228 if (val === 'false') return false;
229 if (val === 'true') return true;
230 return val;
231 }
232
233 if (DOCUMENT && typeof DOCUMENT.querySelector === 'function') {
234 var attrs = [['data-family-prefix', 'familyPrefix'], ['data-replacement-class', 'replacementClass'], ['data-auto-replace-svg', 'autoReplaceSvg'], ['data-auto-add-css', 'autoAddCss'], ['data-auto-a11y', 'autoA11y'], ['data-search-pseudo-elements', 'searchPseudoElements'], ['data-observe-mutations', 'observeMutations'], ['data-mutate-approach', 'mutateApproach'], ['data-keep-original-source', 'keepOriginalSource'], ['data-measure-performance', 'measurePerformance'], ['data-show-missing-icons', 'showMissingIcons']];
235 attrs.forEach(function (_ref) {
236 var _ref2 = _slicedToArray(_ref, 2),
237 attr = _ref2[0],
238 key = _ref2[1];
239
240 var val = coerce(getAttrConfig(attr));
241
242 if (val !== undefined && val !== null) {
243 initial[key] = val;
244 }
245 });
246 }
247
248 var _default = {
249 familyPrefix: DEFAULT_FAMILY_PREFIX,
250 replacementClass: DEFAULT_REPLACEMENT_CLASS,
251 autoReplaceSvg: true,
252 autoAddCss: true,
253 autoA11y: true,
254 searchPseudoElements: false,
255 observeMutations: true,
256 mutateApproach: 'async',
257 keepOriginalSource: true,
258 measurePerformance: false,
259 showMissingIcons: true
260 };
261
262 var _config = _objectSpread({}, _default, initial);
263
264 if (!_config.autoReplaceSvg) _config.observeMutations = false;
265
266 var config = _objectSpread({}, _config);
267
268 WINDOW.FontAwesomeConfig = config;
269
270 var w = WINDOW || {};
271 if (!w[NAMESPACE_IDENTIFIER]) w[NAMESPACE_IDENTIFIER] = {};
272 if (!w[NAMESPACE_IDENTIFIER].styles) w[NAMESPACE_IDENTIFIER].styles = {};
273 if (!w[NAMESPACE_IDENTIFIER].hooks) w[NAMESPACE_IDENTIFIER].hooks = {};
274 if (!w[NAMESPACE_IDENTIFIER].shims) w[NAMESPACE_IDENTIFIER].shims = [];
275 var namespace = w[NAMESPACE_IDENTIFIER];
276
277 var functions = [];
278
279 var listener = function listener() {
280 DOCUMENT.removeEventListener('DOMContentLoaded', listener);
281 loaded = 1;
282 functions.map(function (fn) {
283 return fn();
284 });
285 };
286
287 var loaded = false;
288
289 if (IS_DOM) {
290 loaded = (DOCUMENT.documentElement.doScroll ? /^loaded|^c/ : /^loaded|^i|^c/).test(DOCUMENT.readyState);
291 if (!loaded) DOCUMENT.addEventListener('DOMContentLoaded', listener);
292 }
293
294 function domready (fn) {
295 if (!IS_DOM) return;
296 loaded ? setTimeout(fn, 0) : functions.push(fn);
297 }
298
299 var PENDING = 'pending';
300 var SETTLED = 'settled';
301 var FULFILLED = 'fulfilled';
302 var REJECTED = 'rejected';
303
304 var NOOP = function NOOP() {};
305
306 var isNode = typeof global !== 'undefined' && typeof global.process !== 'undefined' && typeof global.process.emit === 'function';
307 var asyncSetTimer = typeof setImmediate === 'undefined' ? setTimeout : setImmediate;
308 var asyncQueue = [];
309 var asyncTimer;
310
311 function asyncFlush() {
312 // run promise callbacks
313 for (var i = 0; i < asyncQueue.length; i++) {
314 asyncQueue[i][0](asyncQueue[i][1]);
315 } // reset async asyncQueue
316
317
318 asyncQueue = [];
319 asyncTimer = false;
320 }
321
322 function asyncCall(callback, arg) {
323 asyncQueue.push([callback, arg]);
324
325 if (!asyncTimer) {
326 asyncTimer = true;
327 asyncSetTimer(asyncFlush, 0);
328 }
329 }
330
331 function invokeResolver(resolver, promise) {
332 function resolvePromise(value) {
333 resolve(promise, value);
334 }
335
336 function rejectPromise(reason) {
337 reject(promise, reason);
338 }
339
340 try {
341 resolver(resolvePromise, rejectPromise);
342 } catch (e) {
343 rejectPromise(e);
344 }
345 }
346
347 function invokeCallback(subscriber) {
348 var owner = subscriber.owner;
349 var settled = owner._state;
350 var value = owner._data;
351 var callback = subscriber[settled];
352 var promise = subscriber.then;
353
354 if (typeof callback === 'function') {
355 settled = FULFILLED;
356
357 try {
358 value = callback(value);
359 } catch (e) {
360 reject(promise, e);
361 }
362 }
363
364 if (!handleThenable(promise, value)) {
365 if (settled === FULFILLED) {
366 resolve(promise, value);
367 }
368
369 if (settled === REJECTED) {
370 reject(promise, value);
371 }
372 }
373 }
374
375 function handleThenable(promise, value) {
376 var resolved;
377
378 try {
379 if (promise === value) {
380 throw new TypeError('A promises callback cannot return that same promise.');
381 }
382
383 if (value && (typeof value === 'function' || _typeof(value) === 'object')) {
384 // then should be retrieved only once
385 var then = value.then;
386
387 if (typeof then === 'function') {
388 then.call(value, function (val) {
389 if (!resolved) {
390 resolved = true;
391
392 if (value === val) {
393 fulfill(promise, val);
394 } else {
395 resolve(promise, val);
396 }
397 }
398 }, function (reason) {
399 if (!resolved) {
400 resolved = true;
401 reject(promise, reason);
402 }
403 });
404 return true;
405 }
406 }
407 } catch (e) {
408 if (!resolved) {
409 reject(promise, e);
410 }
411
412 return true;
413 }
414
415 return false;
416 }
417
418 function resolve(promise, value) {
419 if (promise === value || !handleThenable(promise, value)) {
420 fulfill(promise, value);
421 }
422 }
423
424 function fulfill(promise, value) {
425 if (promise._state === PENDING) {
426 promise._state = SETTLED;
427 promise._data = value;
428 asyncCall(publishFulfillment, promise);
429 }
430 }
431
432 function reject(promise, reason) {
433 if (promise._state === PENDING) {
434 promise._state = SETTLED;
435 promise._data = reason;
436 asyncCall(publishRejection, promise);
437 }
438 }
439
440 function publish(promise) {
441 promise._then = promise._then.forEach(invokeCallback);
442 }
443
444 function publishFulfillment(promise) {
445 promise._state = FULFILLED;
446 publish(promise);
447 }
448
449 function publishRejection(promise) {
450 promise._state = REJECTED;
451 publish(promise);
452
453 if (!promise._handled && isNode) {
454 global.process.emit('unhandledRejection', promise._data, promise);
455 }
456 }
457
458 function notifyRejectionHandled(promise) {
459 global.process.emit('rejectionHandled', promise);
460 }
461 /**
462 * @class
463 */
464
465
466 function P(resolver) {
467 if (typeof resolver !== 'function') {
468 throw new TypeError('Promise resolver ' + resolver + ' is not a function');
469 }
470
471 if (this instanceof P === false) {
472 throw new TypeError('Failed to construct \'Promise\': Please use the \'new\' operator, this object constructor cannot be called as a function.');
473 }
474
475 this._then = [];
476 invokeResolver(resolver, this);
477 }
478
479 P.prototype = {
480 constructor: P,
481 _state: PENDING,
482 _then: null,
483 _data: undefined,
484 _handled: false,
485 then: function then(onFulfillment, onRejection) {
486 var subscriber = {
487 owner: this,
488 then: new this.constructor(NOOP),
489 fulfilled: onFulfillment,
490 rejected: onRejection
491 };
492
493 if ((onRejection || onFulfillment) && !this._handled) {
494 this._handled = true;
495
496 if (this._state === REJECTED && isNode) {
497 asyncCall(notifyRejectionHandled, this);
498 }
499 }
500
501 if (this._state === FULFILLED || this._state === REJECTED) {
502 // already resolved, call callback async
503 asyncCall(invokeCallback, subscriber);
504 } else {
505 // subscribe
506 this._then.push(subscriber);
507 }
508
509 return subscriber.then;
510 },
511 catch: function _catch(onRejection) {
512 return this.then(null, onRejection);
513 }
514 };
515
516 P.all = function (promises) {
517 if (!Array.isArray(promises)) {
518 throw new TypeError('You must pass an array to Promise.all().');
519 }
520
521 return new P(function (resolve, reject) {
522 var results = [];
523 var remaining = 0;
524
525 function resolver(index) {
526 remaining++;
527 return function (value) {
528 results[index] = value;
529
530 if (! --remaining) {
531 resolve(results);
532 }
533 };
534 }
535
536 for (var i = 0, promise; i < promises.length; i++) {
537 promise = promises[i];
538
539 if (promise && typeof promise.then === 'function') {
540 promise.then(resolver(i), reject);
541 } else {
542 results[i] = promise;
543 }
544 }
545
546 if (!remaining) {
547 resolve(results);
548 }
549 });
550 };
551
552 P.race = function (promises) {
553 if (!Array.isArray(promises)) {
554 throw new TypeError('You must pass an array to Promise.race().');
555 }
556
557 return new P(function (resolve, reject) {
558 for (var i = 0, promise; i < promises.length; i++) {
559 promise = promises[i];
560
561 if (promise && typeof promise.then === 'function') {
562 promise.then(resolve, reject);
563 } else {
564 resolve(promise);
565 }
566 }
567 });
568 };
569
570 P.resolve = function (value) {
571 if (value && _typeof(value) === 'object' && value.constructor === P) {
572 return value;
573 }
574
575 return new P(function (resolve) {
576 resolve(value);
577 });
578 };
579
580 P.reject = function (reason) {
581 return new P(function (resolve, reject) {
582 reject(reason);
583 });
584 };
585
586 var picked = typeof Promise === 'function' ? Promise : P;
587
588 var d = UNITS_IN_GRID;
589 var meaninglessTransform = {
590 size: 16,
591 x: 0,
592 y: 0,
593 rotate: 0,
594 flipX: false,
595 flipY: false
596 };
597
598 function isReserved(name) {
599 return ~RESERVED_CLASSES.indexOf(name);
600 }
601 function insertCss(css) {
602 if (!css || !IS_DOM) {
603 return;
604 }
605
606 var style = DOCUMENT.createElement('style');
607 style.setAttribute('type', 'text/css');
608 style.innerHTML = css;
609 var headChildren = DOCUMENT.head.childNodes;
610 var beforeChild = null;
611
612 for (var i = headChildren.length - 1; i > -1; i--) {
613 var child = headChildren[i];
614 var tagName = (child.tagName || '').toUpperCase();
615
616 if (['STYLE', 'LINK'].indexOf(tagName) > -1) {
617 beforeChild = child;
618 }
619 }
620
621 DOCUMENT.head.insertBefore(style, beforeChild);
622 return css;
623 }
624 var idPool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
625 function nextUniqueId() {
626 var size = 12;
627 var id = '';
628
629 while (size-- > 0) {
630 id += idPool[Math.random() * 62 | 0];
631 }
632
633 return id;
634 }
635 function toArray(obj) {
636 var array = [];
637
638 for (var i = (obj || []).length >>> 0; i--;) {
639 array[i] = obj[i];
640 }
641
642 return array;
643 }
644 function classArray(node) {
645 if (node.classList) {
646 return toArray(node.classList);
647 } else {
648 return (node.getAttribute('class') || '').split(' ').filter(function (i) {
649 return i;
650 });
651 }
652 }
653 function getIconName(familyPrefix, cls) {
654 var parts = cls.split('-');
655 var prefix = parts[0];
656 var iconName = parts.slice(1).join('-');
657
658 if (prefix === familyPrefix && iconName !== '' && !isReserved(iconName)) {
659 return iconName;
660 } else {
661 return null;
662 }
663 }
664 function htmlEscape(str) {
665 return "".concat(str).replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
666 }
667 function joinAttributes(attributes) {
668 return Object.keys(attributes || {}).reduce(function (acc, attributeName) {
669 return acc + "".concat(attributeName, "=\"").concat(htmlEscape(attributes[attributeName]), "\" ");
670 }, '').trim();
671 }
672 function joinStyles(styles) {
673 return Object.keys(styles || {}).reduce(function (acc, styleName) {
674 return acc + "".concat(styleName, ": ").concat(styles[styleName], ";");
675 }, '');
676 }
677 function transformIsMeaningful(transform) {
678 return transform.size !== meaninglessTransform.size || transform.x !== meaninglessTransform.x || transform.y !== meaninglessTransform.y || transform.rotate !== meaninglessTransform.rotate || transform.flipX || transform.flipY;
679 }
680 function transformForSvg(_ref) {
681 var transform = _ref.transform,
682 containerWidth = _ref.containerWidth,
683 iconWidth = _ref.iconWidth;
684 var outer = {
685 transform: "translate(".concat(containerWidth / 2, " 256)")
686 };
687 var innerTranslate = "translate(".concat(transform.x * 32, ", ").concat(transform.y * 32, ") ");
688 var innerScale = "scale(".concat(transform.size / 16 * (transform.flipX ? -1 : 1), ", ").concat(transform.size / 16 * (transform.flipY ? -1 : 1), ") ");
689 var innerRotate = "rotate(".concat(transform.rotate, " 0 0)");
690 var inner = {
691 transform: "".concat(innerTranslate, " ").concat(innerScale, " ").concat(innerRotate)
692 };
693 var path = {
694 transform: "translate(".concat(iconWidth / 2 * -1, " -256)")
695 };
696 return {
697 outer: outer,
698 inner: inner,
699 path: path
700 };
701 }
702 function transformForCss(_ref2) {
703 var transform = _ref2.transform,
704 _ref2$width = _ref2.width,
705 width = _ref2$width === void 0 ? UNITS_IN_GRID : _ref2$width,
706 _ref2$height = _ref2.height,
707 height = _ref2$height === void 0 ? UNITS_IN_GRID : _ref2$height,
708 _ref2$startCentered = _ref2.startCentered,
709 startCentered = _ref2$startCentered === void 0 ? false : _ref2$startCentered;
710 var val = '';
711
712 if (startCentered && IS_IE) {
713 val += "translate(".concat(transform.x / d - width / 2, "em, ").concat(transform.y / d - height / 2, "em) ");
714 } else if (startCentered) {
715 val += "translate(calc(-50% + ".concat(transform.x / d, "em), calc(-50% + ").concat(transform.y / d, "em)) ");
716 } else {
717 val += "translate(".concat(transform.x / d, "em, ").concat(transform.y / d, "em) ");
718 }
719
720 val += "scale(".concat(transform.size / d * (transform.flipX ? -1 : 1), ", ").concat(transform.size / d * (transform.flipY ? -1 : 1), ") ");
721 val += "rotate(".concat(transform.rotate, "deg) ");
722 return val;
723 }
724
725 var ALL_SPACE = {
726 x: 0,
727 y: 0,
728 width: '100%',
729 height: '100%'
730 };
731 function makeIconMasking (_ref) {
732 var children = _ref.children,
733 attributes = _ref.attributes,
734 main = _ref.main,
735 mask = _ref.mask,
736 transform = _ref.transform;
737 var mainWidth = main.width,
738 mainPath = main.icon;
739 var maskWidth = mask.width,
740 maskPath = mask.icon;
741 var trans = transformForSvg({
742 transform: transform,
743 containerWidth: maskWidth,
744 iconWidth: mainWidth
745 });
746 var maskRect = {
747 tag: 'rect',
748 attributes: _objectSpread({}, ALL_SPACE, {
749 fill: 'white'
750 })
751 };
752 var maskInnerGroup = {
753 tag: 'g',
754 attributes: _objectSpread({}, trans.inner),
755 children: [{
756 tag: 'path',
757 attributes: _objectSpread({}, mainPath.attributes, trans.path, {
758 fill: 'black'
759 })
760 }]
761 };
762 var maskOuterGroup = {
763 tag: 'g',
764 attributes: _objectSpread({}, trans.outer),
765 children: [maskInnerGroup]
766 };
767 var maskId = "mask-".concat(nextUniqueId());
768 var clipId = "clip-".concat(nextUniqueId());
769 var maskTag = {
770 tag: 'mask',
771 attributes: _objectSpread({}, ALL_SPACE, {
772 id: maskId,
773 maskUnits: 'userSpaceOnUse',
774 maskContentUnits: 'userSpaceOnUse'
775 }),
776 children: [maskRect, maskOuterGroup]
777 };
778 var defs = {
779 tag: 'defs',
780 children: [{
781 tag: 'clipPath',
782 attributes: {
783 id: clipId
784 },
785 children: [maskPath]
786 }, maskTag]
787 };
788 children.push(defs, {
789 tag: 'rect',
790 attributes: _objectSpread({
791 fill: 'currentColor',
792 'clip-path': "url(#".concat(clipId, ")"),
793 mask: "url(#".concat(maskId, ")")
794 }, ALL_SPACE)
795 });
796 return {
797 children: children,
798 attributes: attributes
799 };
800 }
801
802 function makeIconStandard (_ref) {
803 var children = _ref.children,
804 attributes = _ref.attributes,
805 main = _ref.main,
806 transform = _ref.transform,
807 styles = _ref.styles;
808 var styleString = joinStyles(styles);
809
810 if (styleString.length > 0) {
811 attributes['style'] = styleString;
812 }
813
814 if (transformIsMeaningful(transform)) {
815 var trans = transformForSvg({
816 transform: transform,
817 containerWidth: main.width,
818 iconWidth: main.width
819 });
820 children.push({
821 tag: 'g',
822 attributes: _objectSpread({}, trans.outer),
823 children: [{
824 tag: 'g',
825 attributes: _objectSpread({}, trans.inner),
826 children: [{
827 tag: main.icon.tag,
828 children: main.icon.children,
829 attributes: _objectSpread({}, main.icon.attributes, trans.path)
830 }]
831 }]
832 });
833 } else {
834 children.push(main.icon);
835 }
836
837 return {
838 children: children,
839 attributes: attributes
840 };
841 }
842
843 function asIcon (_ref) {
844 var children = _ref.children,
845 main = _ref.main,
846 mask = _ref.mask,
847 attributes = _ref.attributes,
848 styles = _ref.styles,
849 transform = _ref.transform;
850
851 if (transformIsMeaningful(transform) && main.found && !mask.found) {
852 var width = main.width,
853 height = main.height;
854 var offset = {
855 x: width / height / 2,
856 y: 0.5
857 };
858 attributes['style'] = joinStyles(_objectSpread({}, styles, {
859 'transform-origin': "".concat(offset.x + transform.x / 16, "em ").concat(offset.y + transform.y / 16, "em")
860 }));
861 }
862
863 return [{
864 tag: 'svg',
865 attributes: attributes,
866 children: children
867 }];
868 }
869
870 function asSymbol (_ref) {
871 var prefix = _ref.prefix,
872 iconName = _ref.iconName,
873 children = _ref.children,
874 attributes = _ref.attributes,
875 symbol = _ref.symbol;
876 var id = symbol === true ? "".concat(prefix, "-").concat(config.familyPrefix, "-").concat(iconName) : symbol;
877 return [{
878 tag: 'svg',
879 attributes: {
880 style: 'display: none;'
881 },
882 children: [{
883 tag: 'symbol',
884 attributes: _objectSpread({}, attributes, {
885 id: id
886 }),
887 children: children
888 }]
889 }];
890 }
891
892 function makeInlineSvgAbstract(params) {
893 var _params$icons = params.icons,
894 main = _params$icons.main,
895 mask = _params$icons.mask,
896 prefix = params.prefix,
897 iconName = params.iconName,
898 transform = params.transform,
899 symbol = params.symbol,
900 title = params.title,
901 extra = params.extra,
902 _params$watchable = params.watchable,
903 watchable = _params$watchable === void 0 ? false : _params$watchable;
904
905 var _ref = mask.found ? mask : main,
906 width = _ref.width,
907 height = _ref.height;
908
909 var widthClass = "fa-w-".concat(Math.ceil(width / height * 16));
910 var attrClass = [config.replacementClass, iconName ? "".concat(config.familyPrefix, "-").concat(iconName) : '', widthClass].filter(function (c) {
911 return extra.classes.indexOf(c) === -1;
912 }).concat(extra.classes).join(' ');
913 var content = {
914 children: [],
915 attributes: _objectSpread({}, extra.attributes, {
916 'data-prefix': prefix,
917 'data-icon': iconName,
918 'class': attrClass,
919 'role': 'img',
920 'xmlns': 'http://www.w3.org/2000/svg',
921 'viewBox': "0 0 ".concat(width, " ").concat(height)
922 })
923 };
924
925 if (watchable) {
926 content.attributes[DATA_FA_I2SVG] = '';
927 }
928
929 if (title) content.children.push({
930 tag: 'title',
931 attributes: {
932 id: content.attributes['aria-labelledby'] || "title-".concat(nextUniqueId())
933 },
934 children: [title]
935 });
936
937 var args = _objectSpread({}, content, {
938 prefix: prefix,
939 iconName: iconName,
940 main: main,
941 mask: mask,
942 transform: transform,
943 symbol: symbol,
944 styles: extra.styles
945 });
946
947 var _ref2 = mask.found && main.found ? makeIconMasking(args) : makeIconStandard(args),
948 children = _ref2.children,
949 attributes = _ref2.attributes;
950
951 args.children = children;
952 args.attributes = attributes;
953
954 if (symbol) {
955 return asSymbol(args);
956 } else {
957 return asIcon(args);
958 }
959 }
960 function makeLayersTextAbstract(params) {
961 var content = params.content,
962 width = params.width,
963 height = params.height,
964 transform = params.transform,
965 title = params.title,
966 extra = params.extra,
967 _params$watchable2 = params.watchable,
968 watchable = _params$watchable2 === void 0 ? false : _params$watchable2;
969
970 var attributes = _objectSpread({}, extra.attributes, title ? {
971 'title': title
972 } : {}, {
973 'class': extra.classes.join(' ')
974 });
975
976 if (watchable) {
977 attributes[DATA_FA_I2SVG] = '';
978 }
979
980 var styles = _objectSpread({}, extra.styles);
981
982 if (transformIsMeaningful(transform)) {
983 styles['transform'] = transformForCss({
984 transform: transform,
985 startCentered: true,
986 width: width,
987 height: height
988 });
989 styles['-webkit-transform'] = styles['transform'];
990 }
991
992 var styleString = joinStyles(styles);
993
994 if (styleString.length > 0) {
995 attributes['style'] = styleString;
996 }
997
998 var val = [];
999 val.push({
1000 tag: 'span',
1001 attributes: attributes,
1002 children: [content]
1003 });
1004
1005 if (title) {
1006 val.push({
1007 tag: 'span',
1008 attributes: {
1009 class: 'sr-only'
1010 },
1011 children: [title]
1012 });
1013 }
1014
1015 return val;
1016 }
1017 function makeLayersCounterAbstract(params) {
1018 var content = params.content,
1019 title = params.title,
1020 extra = params.extra;
1021
1022 var attributes = _objectSpread({}, extra.attributes, title ? {
1023 'title': title
1024 } : {}, {
1025 'class': extra.classes.join(' ')
1026 });
1027
1028 var styleString = joinStyles(extra.styles);
1029
1030 if (styleString.length > 0) {
1031 attributes['style'] = styleString;
1032 }
1033
1034 var val = [];
1035 val.push({
1036 tag: 'span',
1037 attributes: attributes,
1038 children: [content]
1039 });
1040
1041 if (title) {
1042 val.push({
1043 tag: 'span',
1044 attributes: {
1045 class: 'sr-only'
1046 },
1047 children: [title]
1048 });
1049 }
1050
1051 return val;
1052 }
1053
1054 var noop$1 = function noop() {};
1055
1056 var p = config.measurePerformance && PERFORMANCE && PERFORMANCE.mark && PERFORMANCE.measure ? PERFORMANCE : {
1057 mark: noop$1,
1058 measure: noop$1
1059 };
1060 var preamble = "FA \"5.8.0\"";
1061
1062 var begin = function begin(name) {
1063 p.mark("".concat(preamble, " ").concat(name, " begins"));
1064 return function () {
1065 return end(name);
1066 };
1067 };
1068
1069 var end = function end(name) {
1070 p.mark("".concat(preamble, " ").concat(name, " ends"));
1071 p.measure("".concat(preamble, " ").concat(name), "".concat(preamble, " ").concat(name, " begins"), "".concat(preamble, " ").concat(name, " ends"));
1072 };
1073
1074 var perf = {
1075 begin: begin,
1076 end: end
1077 };
1078
1079 /**
1080 * Internal helper to bind a function known to have 4 arguments
1081 * to a given context.
1082 */
1083
1084 var bindInternal4 = function bindInternal4(func, thisContext) {
1085 return function (a, b, c, d) {
1086 return func.call(thisContext, a, b, c, d);
1087 };
1088 };
1089
1090 /**
1091 * # Reduce
1092 *
1093 * A fast object `.reduce()` implementation.
1094 *
1095 * @param {Object} subject The object to reduce over.
1096 * @param {Function} fn The reducer function.
1097 * @param {mixed} initialValue The initial value for the reducer, defaults to subject[0].
1098 * @param {Object} thisContext The context for the reducer.
1099 * @return {mixed} The final result.
1100 */
1101
1102
1103 var reduce = function fastReduceObject(subject, fn, initialValue, thisContext) {
1104 var keys = Object.keys(subject),
1105 length = keys.length,
1106 iterator = thisContext !== undefined ? bindInternal4(fn, thisContext) : fn,
1107 i,
1108 key,
1109 result;
1110
1111 if (initialValue === undefined) {
1112 i = 1;
1113 result = subject[keys[0]];
1114 } else {
1115 i = 0;
1116 result = initialValue;
1117 }
1118
1119 for (; i < length; i++) {
1120 key = keys[i];
1121 result = iterator(result, subject[key], key, subject);
1122 }
1123
1124 return result;
1125 };
1126
1127 function defineIcons(prefix, icons) {
1128 var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1129 var _params$skipHooks = params.skipHooks,
1130 skipHooks = _params$skipHooks === void 0 ? false : _params$skipHooks;
1131 var normalized = Object.keys(icons).reduce(function (acc, iconName) {
1132 var icon = icons[iconName];
1133 var expanded = !!icon.icon;
1134
1135 if (expanded) {
1136 acc[icon.iconName] = icon.icon;
1137 } else {
1138 acc[iconName] = icon;
1139 }
1140
1141 return acc;
1142 }, {});
1143
1144 if (typeof namespace.hooks.addPack === 'function' && !skipHooks) {
1145 namespace.hooks.addPack(prefix, normalized);
1146 } else {
1147 namespace.styles[prefix] = _objectSpread({}, namespace.styles[prefix] || {}, normalized);
1148 }
1149 /**
1150 * Font Awesome 4 used the prefix of `fa` for all icons. With the introduction
1151 * of new styles we needed to differentiate between them. Prefix `fa` is now an alias
1152 * for `fas` so we'll easy the upgrade process for our users by automatically defining
1153 * this as well.
1154 */
1155
1156
1157 if (prefix === 'fas') {
1158 defineIcons('fa', icons);
1159 }
1160 }
1161
1162 var styles = namespace.styles,
1163 shims = namespace.shims;
1164 var _byUnicode = {};
1165 var _byLigature = {};
1166 var _byOldName = {};
1167 var build = function build() {
1168 var lookup = function lookup(reducer) {
1169 return reduce(styles, function (o, style, prefix) {
1170 o[prefix] = reduce(style, reducer, {});
1171 return o;
1172 }, {});
1173 };
1174
1175 _byUnicode = lookup(function (acc, icon, iconName) {
1176 if (icon[3]) {
1177 acc[icon[3]] = iconName;
1178 }
1179
1180 return acc;
1181 });
1182 _byLigature = lookup(function (acc, icon, iconName) {
1183 var ligatures = icon[2];
1184 acc[iconName] = iconName;
1185 ligatures.forEach(function (ligature) {
1186 acc[ligature] = iconName;
1187 });
1188 return acc;
1189 });
1190 var hasRegular = 'far' in styles;
1191 _byOldName = reduce(shims, function (acc, shim) {
1192 var oldName = shim[0];
1193 var prefix = shim[1];
1194 var iconName = shim[2];
1195
1196 if (prefix === 'far' && !hasRegular) {
1197 prefix = 'fas';
1198 }
1199
1200 acc[oldName] = {
1201 prefix: prefix,
1202 iconName: iconName
1203 };
1204 return acc;
1205 }, {});
1206 };
1207 build();
1208 function byUnicode(prefix, unicode) {
1209 return _byUnicode[prefix][unicode];
1210 }
1211 function byLigature(prefix, ligature) {
1212 return _byLigature[prefix][ligature];
1213 }
1214 function byOldName(name) {
1215 return _byOldName[name] || {
1216 prefix: null,
1217 iconName: null
1218 };
1219 }
1220
1221 var styles$1 = namespace.styles;
1222 var emptyCanonicalIcon = function emptyCanonicalIcon() {
1223 return {
1224 prefix: null,
1225 iconName: null,
1226 rest: []
1227 };
1228 };
1229 function getCanonicalIcon(values) {
1230 return values.reduce(function (acc, cls) {
1231 var iconName = getIconName(config.familyPrefix, cls);
1232
1233 if (styles$1[cls]) {
1234 acc.prefix = cls;
1235 } else if (config.autoFetchSvg && ['fas', 'far', 'fal', 'fab', 'fa'].indexOf(cls) > -1) {
1236 acc.prefix = cls;
1237 } else if (iconName) {
1238 var shim = acc.prefix === 'fa' ? byOldName(iconName) : {};
1239 acc.iconName = shim.iconName || iconName;
1240 acc.prefix = shim.prefix || acc.prefix;
1241 } else if (cls !== config.replacementClass && cls.indexOf('fa-w-') !== 0) {
1242 acc.rest.push(cls);
1243 }
1244
1245 return acc;
1246 }, emptyCanonicalIcon());
1247 }
1248 function iconFromMapping(mapping, prefix, iconName) {
1249 if (mapping && mapping[prefix] && mapping[prefix][iconName]) {
1250 return {
1251 prefix: prefix,
1252 iconName: iconName,
1253 icon: mapping[prefix][iconName]
1254 };
1255 }
1256 }
1257
1258 function toHtml(abstractNodes) {
1259 var tag = abstractNodes.tag,
1260 _abstractNodes$attrib = abstractNodes.attributes,
1261 attributes = _abstractNodes$attrib === void 0 ? {} : _abstractNodes$attrib,
1262 _abstractNodes$childr = abstractNodes.children,
1263 children = _abstractNodes$childr === void 0 ? [] : _abstractNodes$childr;
1264
1265 if (typeof abstractNodes === 'string') {
1266 return htmlEscape(abstractNodes);
1267 } else {
1268 return "<".concat(tag, " ").concat(joinAttributes(attributes), ">").concat(children.map(toHtml).join(''), "</").concat(tag, ">");
1269 }
1270 }
1271
1272 var noop$2 = function noop() {};
1273
1274 function isWatched(node) {
1275 var i2svg = node.getAttribute ? node.getAttribute(DATA_FA_I2SVG) : null;
1276 return typeof i2svg === 'string';
1277 }
1278
1279 function getMutator() {
1280 if (config.autoReplaceSvg === true) {
1281 return mutators.replace;
1282 }
1283
1284 var mutator = mutators[config.autoReplaceSvg];
1285 return mutator || mutators.replace;
1286 }
1287
1288 var mutators = {
1289 replace: function replace(mutation) {
1290 var node = mutation[0];
1291 var abstract = mutation[1];
1292 var newOuterHTML = abstract.map(function (a) {
1293 return toHtml(a);
1294 }).join('\n');
1295
1296 if (node.parentNode && node.outerHTML) {
1297 node.outerHTML = newOuterHTML + (config.keepOriginalSource && node.tagName.toLowerCase() !== 'svg' ? "<!-- ".concat(node.outerHTML, " -->") : '');
1298 } else if (node.parentNode) {
1299 var newNode = document.createElement('span');
1300 node.parentNode.replaceChild(newNode, node);
1301 newNode.outerHTML = newOuterHTML;
1302 }
1303 },
1304 nest: function nest(mutation) {
1305 var node = mutation[0];
1306 var abstract = mutation[1]; // If we already have a replaced node we do not want to continue nesting within it.
1307 // Short-circuit to the standard replacement
1308
1309 if (~classArray(node).indexOf(config.replacementClass)) {
1310 return mutators.replace(mutation);
1311 }
1312
1313 var forSvg = new RegExp("".concat(config.familyPrefix, "-.*"));
1314 delete abstract[0].attributes.style;
1315 var splitClasses = abstract[0].attributes.class.split(' ').reduce(function (acc, cls) {
1316 if (cls === config.replacementClass || cls.match(forSvg)) {
1317 acc.toSvg.push(cls);
1318 } else {
1319 acc.toNode.push(cls);
1320 }
1321
1322 return acc;
1323 }, {
1324 toNode: [],
1325 toSvg: []
1326 });
1327 abstract[0].attributes.class = splitClasses.toSvg.join(' ');
1328 var newInnerHTML = abstract.map(function (a) {
1329 return toHtml(a);
1330 }).join('\n');
1331 node.setAttribute('class', splitClasses.toNode.join(' '));
1332 node.setAttribute(DATA_FA_I2SVG, '');
1333 node.innerHTML = newInnerHTML;
1334 }
1335 };
1336
1337 function performOperationSync(op) {
1338 op();
1339 }
1340
1341 function perform(mutations, callback) {
1342 var callbackFunction = typeof callback === 'function' ? callback : noop$2;
1343
1344 if (mutations.length === 0) {
1345 callbackFunction();
1346 } else {
1347 var frame = performOperationSync;
1348
1349 if (config.mutateApproach === MUTATION_APPROACH_ASYNC) {
1350 frame = WINDOW.requestAnimationFrame || performOperationSync;
1351 }
1352
1353 frame(function () {
1354 var mutator = getMutator();
1355 var mark = perf.begin('mutate');
1356 mutations.map(mutator);
1357 mark();
1358 callbackFunction();
1359 });
1360 }
1361 }
1362 var disabled = false;
1363 function disableObservation() {
1364 disabled = true;
1365 }
1366 function enableObservation() {
1367 disabled = false;
1368 }
1369 var mo = null;
1370 function observe(options) {
1371 if (!MUTATION_OBSERVER) {
1372 return;
1373 }
1374
1375 if (!config.observeMutations) {
1376 return;
1377 }
1378
1379 var treeCallback = options.treeCallback,
1380 nodeCallback = options.nodeCallback,
1381 pseudoElementsCallback = options.pseudoElementsCallback,
1382 _options$observeMutat = options.observeMutationsRoot,
1383 observeMutationsRoot = _options$observeMutat === void 0 ? DOCUMENT : _options$observeMutat;
1384 mo = new MUTATION_OBSERVER(function (objects) {
1385 if (disabled) return;
1386 toArray(objects).forEach(function (mutationRecord) {
1387 if (mutationRecord.type === 'childList' && mutationRecord.addedNodes.length > 0 && !isWatched(mutationRecord.addedNodes[0])) {
1388 if (config.searchPseudoElements) {
1389 pseudoElementsCallback(mutationRecord.target);
1390 }
1391
1392 treeCallback(mutationRecord.target);
1393 }
1394
1395 if (mutationRecord.type === 'attributes' && mutationRecord.target.parentNode && config.searchPseudoElements) {
1396 pseudoElementsCallback(mutationRecord.target.parentNode);
1397 }
1398
1399 if (mutationRecord.type === 'attributes' && isWatched(mutationRecord.target) && ~ATTRIBUTES_WATCHED_FOR_MUTATION.indexOf(mutationRecord.attributeName)) {
1400 if (mutationRecord.attributeName === 'class') {
1401 var _getCanonicalIcon = getCanonicalIcon(classArray(mutationRecord.target)),
1402 prefix = _getCanonicalIcon.prefix,
1403 iconName = _getCanonicalIcon.iconName;
1404
1405 if (prefix) mutationRecord.target.setAttribute('data-prefix', prefix);
1406 if (iconName) mutationRecord.target.setAttribute('data-icon', iconName);
1407 } else {
1408 nodeCallback(mutationRecord.target);
1409 }
1410 }
1411 });
1412 });
1413 if (!IS_DOM) return;
1414 mo.observe(observeMutationsRoot, {
1415 childList: true,
1416 attributes: true,
1417 characterData: true,
1418 subtree: true
1419 });
1420 }
1421 function disconnect() {
1422 if (!mo) return;
1423 mo.disconnect();
1424 }
1425
1426 function styleParser (node) {
1427 var style = node.getAttribute('style');
1428 var val = [];
1429
1430 if (style) {
1431 val = style.split(';').reduce(function (acc, style) {
1432 var styles = style.split(':');
1433 var prop = styles[0];
1434 var value = styles.slice(1);
1435
1436 if (prop && value.length > 0) {
1437 acc[prop] = value.join(':').trim();
1438 }
1439
1440 return acc;
1441 }, {});
1442 }
1443
1444 return val;
1445 }
1446
1447 function toHex(unicode) {
1448 var result = '';
1449
1450 for (var i = 0; i < unicode.length; i++) {
1451 var hex = unicode.charCodeAt(i).toString(16);
1452 result += ('000' + hex).slice(-4);
1453 }
1454
1455 return result;
1456 }
1457
1458 function classParser (node) {
1459 var existingPrefix = node.getAttribute('data-prefix');
1460 var existingIconName = node.getAttribute('data-icon');
1461 var innerText = node.innerText !== undefined ? node.innerText.trim() : '';
1462 var val = getCanonicalIcon(classArray(node));
1463
1464 if (existingPrefix && existingIconName) {
1465 val.prefix = existingPrefix;
1466 val.iconName = existingIconName;
1467 }
1468
1469 if (val.prefix && innerText.length > 1) {
1470 val.iconName = byLigature(val.prefix, node.innerText);
1471 } else if (val.prefix && innerText.length === 1) {
1472 val.iconName = byUnicode(val.prefix, toHex(node.innerText));
1473 }
1474
1475 return val;
1476 }
1477
1478 var parseTransformString = function parseTransformString(transformString) {
1479 var transform = {
1480 size: 16,
1481 x: 0,
1482 y: 0,
1483 flipX: false,
1484 flipY: false,
1485 rotate: 0
1486 };
1487
1488 if (!transformString) {
1489 return transform;
1490 } else {
1491 return transformString.toLowerCase().split(' ').reduce(function (acc, n) {
1492 var parts = n.toLowerCase().split('-');
1493 var first = parts[0];
1494 var rest = parts.slice(1).join('-');
1495
1496 if (first && rest === 'h') {
1497 acc.flipX = true;
1498 return acc;
1499 }
1500
1501 if (first && rest === 'v') {
1502 acc.flipY = true;
1503 return acc;
1504 }
1505
1506 rest = parseFloat(rest);
1507
1508 if (isNaN(rest)) {
1509 return acc;
1510 }
1511
1512 switch (first) {
1513 case 'grow':
1514 acc.size = acc.size + rest;
1515 break;
1516
1517 case 'shrink':
1518 acc.size = acc.size - rest;
1519 break;
1520
1521 case 'left':
1522 acc.x = acc.x - rest;
1523 break;
1524
1525 case 'right':
1526 acc.x = acc.x + rest;
1527 break;
1528
1529 case 'up':
1530 acc.y = acc.y - rest;
1531 break;
1532
1533 case 'down':
1534 acc.y = acc.y + rest;
1535 break;
1536
1537 case 'rotate':
1538 acc.rotate = acc.rotate + rest;
1539 break;
1540 }
1541
1542 return acc;
1543 }, transform);
1544 }
1545 };
1546 function transformParser (node) {
1547 return parseTransformString(node.getAttribute('data-fa-transform'));
1548 }
1549
1550 function symbolParser (node) {
1551 var symbol = node.getAttribute('data-fa-symbol');
1552 return symbol === null ? false : symbol === '' ? true : symbol;
1553 }
1554
1555 function attributesParser (node) {
1556 var extraAttributes = toArray(node.attributes).reduce(function (acc, attr) {
1557 if (acc.name !== 'class' && acc.name !== 'style') {
1558 acc[attr.name] = attr.value;
1559 }
1560
1561 return acc;
1562 }, {});
1563 var title = node.getAttribute('title');
1564
1565 if (config.autoA11y) {
1566 if (title) {
1567 extraAttributes['aria-labelledby'] = "".concat(config.replacementClass, "-title-").concat(nextUniqueId());
1568 } else {
1569 extraAttributes['aria-hidden'] = 'true';
1570 extraAttributes['focusable'] = 'false';
1571 }
1572 }
1573
1574 return extraAttributes;
1575 }
1576
1577 function maskParser (node) {
1578 var mask = node.getAttribute('data-fa-mask');
1579
1580 if (!mask) {
1581 return emptyCanonicalIcon();
1582 } else {
1583 return getCanonicalIcon(mask.split(' ').map(function (i) {
1584 return i.trim();
1585 }));
1586 }
1587 }
1588
1589 function blankMeta() {
1590 return {
1591 iconName: null,
1592 title: null,
1593 prefix: null,
1594 transform: meaninglessTransform,
1595 symbol: false,
1596 mask: null,
1597 extra: {
1598 classes: [],
1599 styles: {},
1600 attributes: {}
1601 }
1602 };
1603 }
1604 function parseMeta(node) {
1605 var _classParser = classParser(node),
1606 iconName = _classParser.iconName,
1607 prefix = _classParser.prefix,
1608 extraClasses = _classParser.rest;
1609
1610 var extraStyles = styleParser(node);
1611 var transform = transformParser(node);
1612 var symbol = symbolParser(node);
1613 var extraAttributes = attributesParser(node);
1614 var mask = maskParser(node);
1615 return {
1616 iconName: iconName,
1617 title: node.getAttribute('title'),
1618 prefix: prefix,
1619 transform: transform,
1620 symbol: symbol,
1621 mask: mask,
1622 extra: {
1623 classes: extraClasses,
1624 styles: extraStyles,
1625 attributes: extraAttributes
1626 }
1627 };
1628 }
1629
1630 function MissingIcon(error) {
1631 this.name = 'MissingIcon';
1632 this.message = error || 'Icon unavailable';
1633 this.stack = new Error().stack;
1634 }
1635 MissingIcon.prototype = Object.create(Error.prototype);
1636 MissingIcon.prototype.constructor = MissingIcon;
1637
1638 var FILL = {
1639 fill: 'currentColor'
1640 };
1641 var ANIMATION_BASE = {
1642 attributeType: 'XML',
1643 repeatCount: 'indefinite',
1644 dur: '2s'
1645 };
1646 var RING = {
1647 tag: 'path',
1648 attributes: _objectSpread({}, FILL, {
1649 d: 'M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z'
1650 })
1651 };
1652
1653 var OPACITY_ANIMATE = _objectSpread({}, ANIMATION_BASE, {
1654 attributeName: 'opacity'
1655 });
1656
1657 var DOT = {
1658 tag: 'circle',
1659 attributes: _objectSpread({}, FILL, {
1660 cx: '256',
1661 cy: '364',
1662 r: '28'
1663 }),
1664 children: [{
1665 tag: 'animate',
1666 attributes: _objectSpread({}, ANIMATION_BASE, {
1667 attributeName: 'r',
1668 values: '28;14;28;28;14;28;'
1669 })
1670 }, {
1671 tag: 'animate',
1672 attributes: _objectSpread({}, OPACITY_ANIMATE, {
1673 values: '1;0;1;1;0;1;'
1674 })
1675 }]
1676 };
1677 var QUESTION = {
1678 tag: 'path',
1679 attributes: _objectSpread({}, FILL, {
1680 opacity: '1',
1681 d: 'M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z'
1682 }),
1683 children: [{
1684 tag: 'animate',
1685 attributes: _objectSpread({}, OPACITY_ANIMATE, {
1686 values: '1;0;0;0;0;1;'
1687 })
1688 }]
1689 };
1690 var EXCLAMATION = {
1691 tag: 'path',
1692 attributes: _objectSpread({}, FILL, {
1693 opacity: '0',
1694 d: 'M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z'
1695 }),
1696 children: [{
1697 tag: 'animate',
1698 attributes: _objectSpread({}, OPACITY_ANIMATE, {
1699 values: '0;0;1;1;0;0;'
1700 })
1701 }]
1702 };
1703 var missing = {
1704 tag: 'g',
1705 children: [RING, DOT, QUESTION, EXCLAMATION]
1706 };
1707
1708 var styles$2 = namespace.styles;
1709 function findIcon(iconName, prefix) {
1710 return new picked(function (resolve, reject) {
1711 var val = {
1712 found: false,
1713 width: 512,
1714 height: 512,
1715 icon: missing
1716 };
1717
1718 if (iconName && prefix && styles$2[prefix] && styles$2[prefix][iconName]) {
1719 var icon = styles$2[prefix][iconName];
1720 var width = icon[0];
1721 var height = icon[1];
1722 var vectorData = icon.slice(4);
1723 val = {
1724 found: true,
1725 width: width,
1726 height: height,
1727 icon: {
1728 tag: 'path',
1729 attributes: {
1730 fill: 'currentColor',
1731 d: vectorData[0]
1732 }
1733 }
1734 };
1735 return resolve(val);
1736 }
1737
1738 if (iconName && prefix && !config.showMissingIcons) {
1739 reject(new MissingIcon("Icon is missing for prefix ".concat(prefix, " with icon name ").concat(iconName)));
1740 } else {
1741 resolve(val);
1742 }
1743 });
1744 }
1745
1746 var styles$3 = namespace.styles;
1747
1748 function generateSvgReplacementMutation(node, nodeMeta) {
1749 var iconName = nodeMeta.iconName,
1750 title = nodeMeta.title,
1751 prefix = nodeMeta.prefix,
1752 transform = nodeMeta.transform,
1753 symbol = nodeMeta.symbol,
1754 mask = nodeMeta.mask,
1755 extra = nodeMeta.extra;
1756 return new picked(function (resolve, reject) {
1757 picked.all([findIcon(iconName, prefix), findIcon(mask.iconName, mask.prefix)]).then(function (_ref) {
1758 var _ref2 = _slicedToArray(_ref, 2),
1759 main = _ref2[0],
1760 mask = _ref2[1];
1761
1762 resolve([node, makeInlineSvgAbstract({
1763 icons: {
1764 main: main,
1765 mask: mask
1766 },
1767 prefix: prefix,
1768 iconName: iconName,
1769 transform: transform,
1770 symbol: symbol,
1771 mask: mask,
1772 title: title,
1773 extra: extra,
1774 watchable: true
1775 })]);
1776 });
1777 });
1778 }
1779
1780 function generateLayersText(node, nodeMeta) {
1781 var title = nodeMeta.title,
1782 transform = nodeMeta.transform,
1783 extra = nodeMeta.extra;
1784 var width = null;
1785 var height = null;
1786
1787 if (IS_IE) {
1788 var computedFontSize = parseInt(getComputedStyle(node).fontSize, 10);
1789 var boundingClientRect = node.getBoundingClientRect();
1790 width = boundingClientRect.width / computedFontSize;
1791 height = boundingClientRect.height / computedFontSize;
1792 }
1793
1794 if (config.autoA11y && !title) {
1795 extra.attributes['aria-hidden'] = 'true';
1796 }
1797
1798 return picked.resolve([node, makeLayersTextAbstract({
1799 content: node.innerHTML,
1800 width: width,
1801 height: height,
1802 transform: transform,
1803 title: title,
1804 extra: extra,
1805 watchable: true
1806 })]);
1807 }
1808
1809 function generateMutation(node) {
1810 var nodeMeta = parseMeta(node);
1811
1812 if (~nodeMeta.extra.classes.indexOf(LAYERS_TEXT_CLASSNAME)) {
1813 return generateLayersText(node, nodeMeta);
1814 } else {
1815 return generateSvgReplacementMutation(node, nodeMeta);
1816 }
1817 }
1818
1819 function onTree(root) {
1820 var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1821 if (!IS_DOM) return;
1822 var htmlClassList = DOCUMENT.documentElement.classList;
1823
1824 var hclAdd = function hclAdd(suffix) {
1825 return htmlClassList.add("".concat(HTML_CLASS_I2SVG_BASE_CLASS, "-").concat(suffix));
1826 };
1827
1828 var hclRemove = function hclRemove(suffix) {
1829 return htmlClassList.remove("".concat(HTML_CLASS_I2SVG_BASE_CLASS, "-").concat(suffix));
1830 };
1831
1832 var prefixes = config.autoFetchSvg ? Object.keys(PREFIX_TO_STYLE) : Object.keys(styles$3);
1833 var prefixesDomQuery = [".".concat(LAYERS_TEXT_CLASSNAME, ":not([").concat(DATA_FA_I2SVG, "])")].concat(prefixes.map(function (p) {
1834 return ".".concat(p, ":not([").concat(DATA_FA_I2SVG, "])");
1835 })).join(', ');
1836
1837 if (prefixesDomQuery.length === 0) {
1838 return;
1839 }
1840
1841 var candidates = toArray(root.querySelectorAll(prefixesDomQuery));
1842
1843 if (candidates.length > 0) {
1844 hclAdd('pending');
1845 hclRemove('complete');
1846 } else {
1847 return;
1848 }
1849
1850 var mark = perf.begin('onTree');
1851 var mutations = candidates.reduce(function (acc, node) {
1852 try {
1853 var mutation = generateMutation(node);
1854
1855 if (mutation) {
1856 acc.push(mutation);
1857 }
1858 } catch (e) {
1859 if (!PRODUCTION) {
1860 if (e instanceof MissingIcon) {
1861 console.error(e);
1862 }
1863 }
1864 }
1865
1866 return acc;
1867 }, []);
1868 return new picked(function (resolve, reject) {
1869 picked.all(mutations).then(function (resolvedMutations) {
1870 perform(resolvedMutations, function () {
1871 hclAdd('active');
1872 hclAdd('complete');
1873 hclRemove('pending');
1874 if (typeof callback === 'function') callback();
1875 mark();
1876 resolve();
1877 });
1878 }).catch(function () {
1879 mark();
1880 reject();
1881 });
1882 });
1883 }
1884 function onNode(node) {
1885 var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1886 generateMutation(node).then(function (mutation) {
1887 if (mutation) {
1888 perform([mutation], callback);
1889 }
1890 });
1891 }
1892
1893 function replaceForPosition(node, position) {
1894 var pendingAttribute = "".concat(DATA_FA_PSEUDO_ELEMENT_PENDING).concat(position.replace(':', '-'));
1895 return new picked(function (resolve, reject) {
1896 if (node.getAttribute(pendingAttribute) !== null) {
1897 // This node is already being processed
1898 return resolve();
1899 }
1900
1901 var children = toArray(node.children);
1902 var alreadyProcessedPseudoElement = children.filter(function (c) {
1903 return c.getAttribute(DATA_FA_PSEUDO_ELEMENT) === position;
1904 })[0];
1905 var styles = WINDOW.getComputedStyle(node, position);
1906 var fontFamily = styles.getPropertyValue('font-family').match(FONT_FAMILY_PATTERN);
1907 var fontWeight = styles.getPropertyValue('font-weight');
1908
1909 if (alreadyProcessedPseudoElement && !fontFamily) {
1910 // If we've already processed it but the current computed style does not result in a font-family,
1911 // that probably means that a class name that was previously present to make the icon has been
1912 // removed. So we now should delete the icon.
1913 node.removeChild(alreadyProcessedPseudoElement);
1914 return resolve();
1915 } else if (fontFamily) {
1916 var content = styles.getPropertyValue('content');
1917 var prefix = ~['Light', 'Regular', 'Solid', 'Brands'].indexOf(fontFamily[1]) ? STYLE_TO_PREFIX[fontFamily[1].toLowerCase()] : FONT_WEIGHT_TO_PREFIX[fontWeight];
1918 var iconName = byUnicode(prefix, toHex(content.length === 3 ? content.substr(1, 1) : content)); // Only convert the pseudo element in this :before/:after position into an icon if we haven't
1919 // already done so with the same prefix and iconName
1920
1921 if (!alreadyProcessedPseudoElement || alreadyProcessedPseudoElement.getAttribute(DATA_PREFIX) !== prefix || alreadyProcessedPseudoElement.getAttribute(DATA_ICON) !== iconName) {
1922 node.setAttribute(pendingAttribute, iconName);
1923
1924 if (alreadyProcessedPseudoElement) {
1925 // Delete the old one, since we're replacing it with a new one
1926 node.removeChild(alreadyProcessedPseudoElement);
1927 }
1928
1929 var meta = blankMeta();
1930 var extra = meta.extra;
1931 extra.attributes[DATA_FA_PSEUDO_ELEMENT] = position;
1932 findIcon(iconName, prefix).then(function (main) {
1933 var abstract = makeInlineSvgAbstract(_objectSpread({}, meta, {
1934 icons: {
1935 main: main,
1936 mask: emptyCanonicalIcon()
1937 },
1938 prefix: prefix,
1939 iconName: iconName,
1940 extra: extra,
1941 watchable: true
1942 }));
1943 var element = DOCUMENT.createElement('svg');
1944
1945 if (position === ':before') {
1946 node.insertBefore(element, node.firstChild);
1947 } else {
1948 node.appendChild(element);
1949 }
1950
1951 element.outerHTML = abstract.map(function (a) {
1952 return toHtml(a);
1953 }).join('\n');
1954 node.removeAttribute(pendingAttribute);
1955 resolve();
1956 }).catch(reject);
1957 } else {
1958 resolve();
1959 }
1960 } else {
1961 resolve();
1962 }
1963 });
1964 }
1965
1966 function replace(node) {
1967 return picked.all([replaceForPosition(node, ':before'), replaceForPosition(node, ':after')]);
1968 }
1969
1970 function processable(node) {
1971 return node.parentNode !== document.head && !~TAGNAMES_TO_SKIP_FOR_PSEUDOELEMENTS.indexOf(node.tagName.toUpperCase()) && !node.getAttribute(DATA_FA_PSEUDO_ELEMENT) && (!node.parentNode || node.parentNode.tagName !== 'svg');
1972 }
1973
1974 function searchPseudoElements (root) {
1975 if (!IS_DOM) return;
1976 return new picked(function (resolve, reject) {
1977 var operations = toArray(root.querySelectorAll('*')).filter(processable).map(replace);
1978 var end = perf.begin('searchPseudoElements');
1979 disableObservation();
1980 picked.all(operations).then(function () {
1981 end();
1982 enableObservation();
1983 resolve();
1984 }).catch(function () {
1985 end();
1986 enableObservation();
1987 reject();
1988 });
1989 });
1990 }
1991
1992 var baseStyles = "svg:not(:root).svg-inline--fa {\n overflow: visible;\n}\n\n.svg-inline--fa {\n display: inline-block;\n font-size: inherit;\n height: 1em;\n overflow: visible;\n vertical-align: -0.125em;\n}\n.svg-inline--fa.fa-lg {\n vertical-align: -0.225em;\n}\n.svg-inline--fa.fa-w-1 {\n width: 0.0625em;\n}\n.svg-inline--fa.fa-w-2 {\n width: 0.125em;\n}\n.svg-inline--fa.fa-w-3 {\n width: 0.1875em;\n}\n.svg-inline--fa.fa-w-4 {\n width: 0.25em;\n}\n.svg-inline--fa.fa-w-5 {\n width: 0.3125em;\n}\n.svg-inline--fa.fa-w-6 {\n width: 0.375em;\n}\n.svg-inline--fa.fa-w-7 {\n width: 0.4375em;\n}\n.svg-inline--fa.fa-w-8 {\n width: 0.5em;\n}\n.svg-inline--fa.fa-w-9 {\n width: 0.5625em;\n}\n.svg-inline--fa.fa-w-10 {\n width: 0.625em;\n}\n.svg-inline--fa.fa-w-11 {\n width: 0.6875em;\n}\n.svg-inline--fa.fa-w-12 {\n width: 0.75em;\n}\n.svg-inline--fa.fa-w-13 {\n width: 0.8125em;\n}\n.svg-inline--fa.fa-w-14 {\n width: 0.875em;\n}\n.svg-inline--fa.fa-w-15 {\n width: 0.9375em;\n}\n.svg-inline--fa.fa-w-16 {\n width: 1em;\n}\n.svg-inline--fa.fa-w-17 {\n width: 1.0625em;\n}\n.svg-inline--fa.fa-w-18 {\n width: 1.125em;\n}\n.svg-inline--fa.fa-w-19 {\n width: 1.1875em;\n}\n.svg-inline--fa.fa-w-20 {\n width: 1.25em;\n}\n.svg-inline--fa.fa-pull-left {\n margin-right: 0.3em;\n width: auto;\n}\n.svg-inline--fa.fa-pull-right {\n margin-left: 0.3em;\n width: auto;\n}\n.svg-inline--fa.fa-border {\n height: 1.5em;\n}\n.svg-inline--fa.fa-li {\n width: 2em;\n}\n.svg-inline--fa.fa-fw {\n width: 1.25em;\n}\n\n.fa-layers svg.svg-inline--fa {\n bottom: 0;\n left: 0;\n margin: auto;\n position: absolute;\n right: 0;\n top: 0;\n}\n\n.fa-layers {\n display: inline-block;\n height: 1em;\n position: relative;\n text-align: center;\n vertical-align: -0.125em;\n width: 1em;\n}\n.fa-layers svg.svg-inline--fa {\n -webkit-transform-origin: center center;\n transform-origin: center center;\n}\n\n.fa-layers-counter, .fa-layers-text {\n display: inline-block;\n position: absolute;\n text-align: center;\n}\n\n.fa-layers-text {\n left: 50%;\n top: 50%;\n -webkit-transform: translate(-50%, -50%);\n transform: translate(-50%, -50%);\n -webkit-transform-origin: center center;\n transform-origin: center center;\n}\n\n.fa-layers-counter {\n background-color: #ff253a;\n border-radius: 1em;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n color: #fff;\n height: 1.5em;\n line-height: 1;\n max-width: 5em;\n min-width: 1.5em;\n overflow: hidden;\n padding: 0.25em;\n right: 0;\n text-overflow: ellipsis;\n top: 0;\n -webkit-transform: scale(0.25);\n transform: scale(0.25);\n -webkit-transform-origin: top right;\n transform-origin: top right;\n}\n\n.fa-layers-bottom-right {\n bottom: 0;\n right: 0;\n top: auto;\n -webkit-transform: scale(0.25);\n transform: scale(0.25);\n -webkit-transform-origin: bottom right;\n transform-origin: bottom right;\n}\n\n.fa-layers-bottom-left {\n bottom: 0;\n left: 0;\n right: auto;\n top: auto;\n -webkit-transform: scale(0.25);\n transform: scale(0.25);\n -webkit-transform-origin: bottom left;\n transform-origin: bottom left;\n}\n\n.fa-layers-top-right {\n right: 0;\n top: 0;\n -webkit-transform: scale(0.25);\n transform: scale(0.25);\n -webkit-transform-origin: top right;\n transform-origin: top right;\n}\n\n.fa-layers-top-left {\n left: 0;\n right: auto;\n top: 0;\n -webkit-transform: scale(0.25);\n transform: scale(0.25);\n -webkit-transform-origin: top left;\n transform-origin: top left;\n}\n\n.fa-lg {\n font-size: 1.3333333333em;\n line-height: 0.75em;\n vertical-align: -0.0667em;\n}\n\n.fa-xs {\n font-size: 0.75em;\n}\n\n.fa-sm {\n font-size: 0.875em;\n}\n\n.fa-1x {\n font-size: 1em;\n}\n\n.fa-2x {\n font-size: 2em;\n}\n\n.fa-3x {\n font-size: 3em;\n}\n\n.fa-4x {\n font-size: 4em;\n}\n\n.fa-5x {\n font-size: 5em;\n}\n\n.fa-6x {\n font-size: 6em;\n}\n\n.fa-7x {\n font-size: 7em;\n}\n\n.fa-8x {\n font-size: 8em;\n}\n\n.fa-9x {\n font-size: 9em;\n}\n\n.fa-10x {\n font-size: 10em;\n}\n\n.fa-fw {\n text-align: center;\n width: 1.25em;\n}\n\n.fa-ul {\n list-style-type: none;\n margin-left: 2.5em;\n padding-left: 0;\n}\n.fa-ul > li {\n position: relative;\n}\n\n.fa-li {\n left: -2em;\n position: absolute;\n text-align: center;\n width: 2em;\n line-height: inherit;\n}\n\n.fa-border {\n border: solid 0.08em #eee;\n border-radius: 0.1em;\n padding: 0.2em 0.25em 0.15em;\n}\n\n.fa-pull-left {\n float: left;\n}\n\n.fa-pull-right {\n float: right;\n}\n\n.fa.fa-pull-left,\n.fas.fa-pull-left,\n.far.fa-pull-left,\n.fal.fa-pull-left,\n.fab.fa-pull-left {\n margin-right: 0.3em;\n}\n.fa.fa-pull-right,\n.fas.fa-pull-right,\n.far.fa-pull-right,\n.fal.fa-pull-right,\n.fab.fa-pull-right {\n margin-left: 0.3em;\n}\n\n.fa-spin {\n -webkit-animation: fa-spin 2s infinite linear;\n animation: fa-spin 2s infinite linear;\n}\n\n.fa-pulse {\n -webkit-animation: fa-spin 1s infinite steps(8);\n animation: fa-spin 1s infinite steps(8);\n}\n\n@-webkit-keyframes fa-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes fa-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n.fa-rotate-90 {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)\";\n -webkit-transform: rotate(90deg);\n transform: rotate(90deg);\n}\n\n.fa-rotate-180 {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)\";\n -webkit-transform: rotate(180deg);\n transform: rotate(180deg);\n}\n\n.fa-rotate-270 {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)\";\n -webkit-transform: rotate(270deg);\n transform: rotate(270deg);\n}\n\n.fa-flip-horizontal {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)\";\n -webkit-transform: scale(-1, 1);\n transform: scale(-1, 1);\n}\n\n.fa-flip-vertical {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)\";\n -webkit-transform: scale(1, -1);\n transform: scale(1, -1);\n}\n\n.fa-flip-both, .fa-flip-horizontal.fa-flip-vertical {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)\";\n -webkit-transform: scale(-1, -1);\n transform: scale(-1, -1);\n}\n\n:root .fa-rotate-90,\n:root .fa-rotate-180,\n:root .fa-rotate-270,\n:root .fa-flip-horizontal,\n:root .fa-flip-vertical,\n:root .fa-flip-both {\n -webkit-filter: none;\n filter: none;\n}\n\n.fa-stack {\n display: inline-block;\n height: 2em;\n position: relative;\n width: 2.5em;\n}\n\n.fa-stack-1x,\n.fa-stack-2x {\n bottom: 0;\n left: 0;\n margin: auto;\n position: absolute;\n right: 0;\n top: 0;\n}\n\n.svg-inline--fa.fa-stack-1x {\n height: 1em;\n width: 1.25em;\n}\n.svg-inline--fa.fa-stack-2x {\n height: 2em;\n width: 2.5em;\n}\n\n.fa-inverse {\n color: #fff;\n}\n\n.sr-only {\n border: 0;\n clip: rect(0, 0, 0, 0);\n height: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n width: 1px;\n}\n\n.sr-only-focusable:active, .sr-only-focusable:focus {\n clip: auto;\n height: auto;\n margin: 0;\n overflow: visible;\n position: static;\n width: auto;\n}";
1993
1994 function css () {
1995 var dfp = DEFAULT_FAMILY_PREFIX;
1996 var drc = DEFAULT_REPLACEMENT_CLASS;
1997 var fp = config.familyPrefix;
1998 var rc = config.replacementClass;
1999 var s = baseStyles;
2000
2001 if (fp !== dfp || rc !== drc) {
2002 var dPatt = new RegExp("\\.".concat(dfp, "\\-"), 'g');
2003 var rPatt = new RegExp("\\.".concat(drc), 'g');
2004 s = s.replace(dPatt, ".".concat(fp, "-")).replace(rPatt, ".".concat(rc));
2005 }
2006
2007 return s;
2008 }
2009
2010 var Library =
2011 /*#__PURE__*/
2012 function () {
2013 function Library() {
2014 _classCallCheck(this, Library);
2015
2016 this.definitions = {};
2017 }
2018
2019 _createClass(Library, [{
2020 key: "add",
2021 value: function add() {
2022 var _this = this;
2023
2024 for (var _len = arguments.length, definitions = new Array(_len), _key = 0; _key < _len; _key++) {
2025 definitions[_key] = arguments[_key];
2026 }
2027
2028 var additions = definitions.reduce(this._pullDefinitions, {});
2029 Object.keys(additions).forEach(function (key) {
2030 _this.definitions[key] = _objectSpread({}, _this.definitions[key] || {}, additions[key]);
2031 defineIcons(key, additions[key]);
2032 build();
2033 });
2034 }
2035 }, {
2036 key: "reset",
2037 value: function reset() {
2038 this.definitions = {};
2039 }
2040 }, {
2041 key: "_pullDefinitions",
2042 value: function _pullDefinitions(additions, definition) {
2043 var normalized = definition.prefix && definition.iconName && definition.icon ? {
2044 0: definition
2045 } : definition;
2046 Object.keys(normalized).map(function (key) {
2047 var _normalized$key = normalized[key],
2048 prefix = _normalized$key.prefix,
2049 iconName = _normalized$key.iconName,
2050 icon = _normalized$key.icon;
2051 if (!additions[prefix]) additions[prefix] = {};
2052 additions[prefix][iconName] = icon;
2053 });
2054 return additions;
2055 }
2056 }]);
2057
2058 return Library;
2059 }();
2060
2061 function prepIcon(icon) {
2062 var width = icon[0];
2063 var height = icon[1];
2064 var vectorData = icon.slice(4);
2065 return {
2066 found: true,
2067 width: width,
2068 height: height,
2069 icon: {
2070 tag: 'path',
2071 attributes: {
2072 fill: 'currentColor',
2073 d: vectorData[0]
2074 }
2075 }
2076 };
2077 }
2078
2079 function ensureCss() {
2080 if (config.autoAddCss && !_cssInserted) {
2081 insertCss(css());
2082
2083 _cssInserted = true;
2084 }
2085 }
2086
2087 function apiObject(val, abstractCreator) {
2088 Object.defineProperty(val, 'abstract', {
2089 get: abstractCreator
2090 });
2091 Object.defineProperty(val, 'html', {
2092 get: function get() {
2093 return val.abstract.map(function (a) {
2094 return toHtml(a);
2095 });
2096 }
2097 });
2098 Object.defineProperty(val, 'node', {
2099 get: function get() {
2100 if (!IS_DOM) return;
2101 var container = DOCUMENT.createElement('div');
2102 container.innerHTML = val.html;
2103 return container.children;
2104 }
2105 });
2106 return val;
2107 }
2108
2109 function findIconDefinition(iconLookup) {
2110 var _iconLookup$prefix = iconLookup.prefix,
2111 prefix = _iconLookup$prefix === void 0 ? 'fa' : _iconLookup$prefix,
2112 iconName = iconLookup.iconName;
2113 if (!iconName) return;
2114 return iconFromMapping(library.definitions, prefix, iconName) || iconFromMapping(namespace.styles, prefix, iconName);
2115 }
2116
2117 function resolveIcons(next) {
2118 return function (maybeIconDefinition) {
2119 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2120 var iconDefinition = (maybeIconDefinition || {}).icon ? maybeIconDefinition : findIconDefinition(maybeIconDefinition || {});
2121 var mask = params.mask;
2122
2123 if (mask) {
2124 mask = (mask || {}).icon ? mask : findIconDefinition(mask || {});
2125 }
2126
2127 return next(iconDefinition, _objectSpread({}, params, {
2128 mask: mask
2129 }));
2130 };
2131 }
2132
2133 var library = new Library();
2134 var noAuto = function noAuto() {
2135 config.autoReplaceSvg = false;
2136 config.observeMutations = false;
2137 disconnect();
2138 };
2139 var _cssInserted = false;
2140 var dom = {
2141 i2svg: function i2svg() {
2142 var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2143
2144 if (IS_DOM) {
2145 ensureCss();
2146 var _params$node = params.node,
2147 node = _params$node === void 0 ? DOCUMENT : _params$node,
2148 _params$callback = params.callback,
2149 callback = _params$callback === void 0 ? function () {} : _params$callback;
2150
2151 if (config.searchPseudoElements) {
2152 searchPseudoElements(node);
2153 }
2154
2155 return onTree(node, callback);
2156 } else {
2157 return picked.reject('Operation requires a DOM of some kind.');
2158 }
2159 },
2160 css: css,
2161 insertCss: function insertCss$$1() {
2162 if (!_cssInserted) {
2163 insertCss(css());
2164
2165 _cssInserted = true;
2166 }
2167 },
2168 watch: function watch() {
2169 var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2170 var autoReplaceSvgRoot = params.autoReplaceSvgRoot,
2171 observeMutationsRoot = params.observeMutationsRoot;
2172
2173 if (config.autoReplaceSvg === false) {
2174 config.autoReplaceSvg = true;
2175 }
2176
2177 config.observeMutations = true;
2178 domready(function () {
2179 autoReplace({
2180 autoReplaceSvgRoot: autoReplaceSvgRoot
2181 });
2182 observe({
2183 treeCallback: onTree,
2184 nodeCallback: onNode,
2185 pseudoElementsCallback: searchPseudoElements,
2186 observeMutationsRoot: observeMutationsRoot
2187 });
2188 });
2189 }
2190 };
2191 var parse = {
2192 transform: function transform(transformString) {
2193 return parseTransformString(transformString);
2194 }
2195 };
2196 var icon = resolveIcons(function (iconDefinition) {
2197 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2198 var _params$transform = params.transform,
2199 transform = _params$transform === void 0 ? meaninglessTransform : _params$transform,
2200 _params$symbol = params.symbol,
2201 symbol = _params$symbol === void 0 ? false : _params$symbol,
2202 _params$mask = params.mask,
2203 mask = _params$mask === void 0 ? null : _params$mask,
2204 _params$title = params.title,
2205 title = _params$title === void 0 ? null : _params$title,
2206 _params$classes = params.classes,
2207 classes = _params$classes === void 0 ? [] : _params$classes,
2208 _params$attributes = params.attributes,
2209 attributes = _params$attributes === void 0 ? {} : _params$attributes,
2210 _params$styles = params.styles,
2211 styles = _params$styles === void 0 ? {} : _params$styles;
2212 if (!iconDefinition) return;
2213 var prefix = iconDefinition.prefix,
2214 iconName = iconDefinition.iconName,
2215 icon = iconDefinition.icon;
2216 return apiObject(_objectSpread({
2217 type: 'icon'
2218 }, iconDefinition), function () {
2219 ensureCss();
2220
2221 if (config.autoA11y) {
2222 if (title) {
2223 attributes['aria-labelledby'] = "".concat(config.replacementClass, "-title-").concat(nextUniqueId());
2224 } else {
2225 attributes['aria-hidden'] = 'true';
2226 attributes['focusable'] = 'false';
2227 }
2228 }
2229
2230 return makeInlineSvgAbstract({
2231 icons: {
2232 main: prepIcon(icon),
2233 mask: mask ? prepIcon(mask.icon) : {
2234 found: false,
2235 width: null,
2236 height: null,
2237 icon: {}
2238 }
2239 },
2240 prefix: prefix,
2241 iconName: iconName,
2242 transform: _objectSpread({}, meaninglessTransform, transform),
2243 symbol: symbol,
2244 title: title,
2245 extra: {
2246 attributes: attributes,
2247 styles: styles,
2248 classes: classes
2249 }
2250 });
2251 });
2252 });
2253 var text = function text(content) {
2254 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2255 var _params$transform2 = params.transform,
2256 transform = _params$transform2 === void 0 ? meaninglessTransform : _params$transform2,
2257 _params$title2 = params.title,
2258 title = _params$title2 === void 0 ? null : _params$title2,
2259 _params$classes2 = params.classes,
2260 classes = _params$classes2 === void 0 ? [] : _params$classes2,
2261 _params$attributes2 = params.attributes,
2262 attributes = _params$attributes2 === void 0 ? {} : _params$attributes2,
2263 _params$styles2 = params.styles,
2264 styles = _params$styles2 === void 0 ? {} : _params$styles2;
2265 return apiObject({
2266 type: 'text',
2267 content: content
2268 }, function () {
2269 ensureCss();
2270 return makeLayersTextAbstract({
2271 content: content,
2272 transform: _objectSpread({}, meaninglessTransform, transform),
2273 title: title,
2274 extra: {
2275 attributes: attributes,
2276 styles: styles,
2277 classes: ["".concat(config.familyPrefix, "-layers-text")].concat(_toConsumableArray(classes))
2278 }
2279 });
2280 });
2281 };
2282 var counter = function counter(content) {
2283 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2284 var _params$title3 = params.title,
2285 title = _params$title3 === void 0 ? null : _params$title3,
2286 _params$classes3 = params.classes,
2287 classes = _params$classes3 === void 0 ? [] : _params$classes3,
2288 _params$attributes3 = params.attributes,
2289 attributes = _params$attributes3 === void 0 ? {} : _params$attributes3,
2290 _params$styles3 = params.styles,
2291 styles = _params$styles3 === void 0 ? {} : _params$styles3;
2292 return apiObject({
2293 type: 'counter',
2294 content: content
2295 }, function () {
2296 ensureCss();
2297 return makeLayersCounterAbstract({
2298 content: content.toString(),
2299 title: title,
2300 extra: {
2301 attributes: attributes,
2302 styles: styles,
2303 classes: ["".concat(config.familyPrefix, "-layers-counter")].concat(_toConsumableArray(classes))
2304 }
2305 });
2306 });
2307 };
2308 var layer = function layer(assembler) {
2309 return apiObject({
2310 type: 'layer'
2311 }, function () {
2312 ensureCss();
2313 var children = [];
2314 assembler(function (args) {
2315 Array.isArray(args) ? args.map(function (a) {
2316 children = children.concat(a.abstract);
2317 }) : children = children.concat(args.abstract);
2318 });
2319 return [{
2320 tag: 'span',
2321 attributes: {
2322 class: "".concat(config.familyPrefix, "-layers")
2323 },
2324 children: children
2325 }];
2326 });
2327 };
2328 var api = {
2329 noAuto: noAuto,
2330 config: config,
2331 dom: dom,
2332 library: library,
2333 parse: parse,
2334 findIconDefinition: findIconDefinition,
2335 icon: icon,
2336 text: text,
2337 counter: counter,
2338 layer: layer,
2339 toHtml: toHtml
2340 };
2341
2342 var autoReplace = function autoReplace() {
2343 var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2344 var _params$autoReplaceSv = params.autoReplaceSvgRoot,
2345 autoReplaceSvgRoot = _params$autoReplaceSv === void 0 ? DOCUMENT : _params$autoReplaceSv;
2346 if ((Object.keys(namespace.styles).length > 0 || config.autoFetchSvg) && IS_DOM && config.autoReplaceSvg) api.dom.i2svg({
2347 node: autoReplaceSvgRoot
2348 });
2349 };
2350
2351 exports.icon = icon;
2352 exports.noAuto = noAuto;
2353 exports.config = config;
2354 exports.toHtml = toHtml;
2355 exports.layer = layer;
2356 exports.text = text;
2357 exports.counter = counter;
2358 exports.library = library;
2359 exports.dom = dom;
2360 exports.parse = parse;
2361 exports.findIconDefinition = findIconDefinition;
2362
2363 Object.defineProperty(exports, '__esModule', { value: true });
2364
2365})));