UNPKG

77.6 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': extra.attributes.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.2\"";
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 toHex(unicode) {
1128 var result = '';
1129
1130 for (var i = 0; i < unicode.length; i++) {
1131 var hex = unicode.charCodeAt(i).toString(16);
1132 result += ('000' + hex).slice(-4);
1133 }
1134
1135 return result;
1136 }
1137
1138 function defineIcons(prefix, icons) {
1139 var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1140 var _params$skipHooks = params.skipHooks,
1141 skipHooks = _params$skipHooks === void 0 ? false : _params$skipHooks;
1142 var normalized = Object.keys(icons).reduce(function (acc, iconName) {
1143 var icon = icons[iconName];
1144 var expanded = !!icon.icon;
1145
1146 if (expanded) {
1147 acc[icon.iconName] = icon.icon;
1148 } else {
1149 acc[iconName] = icon;
1150 }
1151
1152 return acc;
1153 }, {});
1154
1155 if (typeof namespace.hooks.addPack === 'function' && !skipHooks) {
1156 namespace.hooks.addPack(prefix, normalized);
1157 } else {
1158 namespace.styles[prefix] = _objectSpread({}, namespace.styles[prefix] || {}, normalized);
1159 }
1160 /**
1161 * Font Awesome 4 used the prefix of `fa` for all icons. With the introduction
1162 * of new styles we needed to differentiate between them. Prefix `fa` is now an alias
1163 * for `fas` so we'll easy the upgrade process for our users by automatically defining
1164 * this as well.
1165 */
1166
1167
1168 if (prefix === 'fas') {
1169 defineIcons('fa', icons);
1170 }
1171 }
1172
1173 var styles = namespace.styles,
1174 shims = namespace.shims;
1175 var _byUnicode = {};
1176 var _byLigature = {};
1177 var _byOldName = {};
1178 var build = function build() {
1179 var lookup = function lookup(reducer) {
1180 return reduce(styles, function (o, style, prefix) {
1181 o[prefix] = reduce(style, reducer, {});
1182 return o;
1183 }, {});
1184 };
1185
1186 _byUnicode = lookup(function (acc, icon, iconName) {
1187 if (icon[3]) {
1188 acc[icon[3]] = iconName;
1189 }
1190
1191 return acc;
1192 });
1193 _byLigature = lookup(function (acc, icon, iconName) {
1194 var ligatures = icon[2];
1195 acc[iconName] = iconName;
1196 ligatures.forEach(function (ligature) {
1197 acc[ligature] = iconName;
1198 });
1199 return acc;
1200 });
1201 var hasRegular = 'far' in styles;
1202 _byOldName = reduce(shims, function (acc, shim) {
1203 var oldName = shim[0];
1204 var prefix = shim[1];
1205 var iconName = shim[2];
1206
1207 if (prefix === 'far' && !hasRegular) {
1208 prefix = 'fas';
1209 }
1210
1211 acc[oldName] = {
1212 prefix: prefix,
1213 iconName: iconName
1214 };
1215 return acc;
1216 }, {});
1217 };
1218 build();
1219 function byUnicode(prefix, unicode) {
1220 return (_byUnicode[prefix] || {})[unicode];
1221 }
1222 function byLigature(prefix, ligature) {
1223 return (_byLigature[prefix] || {})[ligature];
1224 }
1225 function byOldName(name) {
1226 return _byOldName[name] || {
1227 prefix: null,
1228 iconName: null
1229 };
1230 }
1231
1232 var styles$1 = namespace.styles;
1233 var emptyCanonicalIcon = function emptyCanonicalIcon() {
1234 return {
1235 prefix: null,
1236 iconName: null,
1237 rest: []
1238 };
1239 };
1240 function getCanonicalIcon(values) {
1241 return values.reduce(function (acc, cls) {
1242 var iconName = getIconName(config.familyPrefix, cls);
1243
1244 if (styles$1[cls]) {
1245 acc.prefix = cls;
1246 } else if (config.autoFetchSvg && ['fas', 'far', 'fal', 'fab', 'fa'].indexOf(cls) > -1) {
1247 acc.prefix = cls;
1248 } else if (iconName) {
1249 var shim = acc.prefix === 'fa' ? byOldName(iconName) : {};
1250 acc.iconName = shim.iconName || iconName;
1251 acc.prefix = shim.prefix || acc.prefix;
1252 } else if (cls !== config.replacementClass && cls.indexOf('fa-w-') !== 0) {
1253 acc.rest.push(cls);
1254 }
1255
1256 return acc;
1257 }, emptyCanonicalIcon());
1258 }
1259 function iconFromMapping(mapping, prefix, iconName) {
1260 if (mapping && mapping[prefix] && mapping[prefix][iconName]) {
1261 return {
1262 prefix: prefix,
1263 iconName: iconName,
1264 icon: mapping[prefix][iconName]
1265 };
1266 }
1267 }
1268
1269 function toHtml(abstractNodes) {
1270 var tag = abstractNodes.tag,
1271 _abstractNodes$attrib = abstractNodes.attributes,
1272 attributes = _abstractNodes$attrib === void 0 ? {} : _abstractNodes$attrib,
1273 _abstractNodes$childr = abstractNodes.children,
1274 children = _abstractNodes$childr === void 0 ? [] : _abstractNodes$childr;
1275
1276 if (typeof abstractNodes === 'string') {
1277 return htmlEscape(abstractNodes);
1278 } else {
1279 return "<".concat(tag, " ").concat(joinAttributes(attributes), ">").concat(children.map(toHtml).join(''), "</").concat(tag, ">");
1280 }
1281 }
1282
1283 var noop$2 = function noop() {};
1284
1285 function isWatched(node) {
1286 var i2svg = node.getAttribute ? node.getAttribute(DATA_FA_I2SVG) : null;
1287 return typeof i2svg === 'string';
1288 }
1289
1290 function getMutator() {
1291 if (config.autoReplaceSvg === true) {
1292 return mutators.replace;
1293 }
1294
1295 var mutator = mutators[config.autoReplaceSvg];
1296 return mutator || mutators.replace;
1297 }
1298
1299 var mutators = {
1300 replace: function replace(mutation) {
1301 var node = mutation[0];
1302 var abstract = mutation[1];
1303 var newOuterHTML = abstract.map(function (a) {
1304 return toHtml(a);
1305 }).join('\n');
1306
1307 if (node.parentNode && node.outerHTML) {
1308 node.outerHTML = newOuterHTML + (config.keepOriginalSource && node.tagName.toLowerCase() !== 'svg' ? "<!-- ".concat(node.outerHTML, " -->") : '');
1309 } else if (node.parentNode) {
1310 var newNode = document.createElement('span');
1311 node.parentNode.replaceChild(newNode, node);
1312 newNode.outerHTML = newOuterHTML;
1313 }
1314 },
1315 nest: function nest(mutation) {
1316 var node = mutation[0];
1317 var abstract = mutation[1]; // If we already have a replaced node we do not want to continue nesting within it.
1318 // Short-circuit to the standard replacement
1319
1320 if (~classArray(node).indexOf(config.replacementClass)) {
1321 return mutators.replace(mutation);
1322 }
1323
1324 var forSvg = new RegExp("".concat(config.familyPrefix, "-.*"));
1325 delete abstract[0].attributes.style;
1326 var splitClasses = abstract[0].attributes.class.split(' ').reduce(function (acc, cls) {
1327 if (cls === config.replacementClass || cls.match(forSvg)) {
1328 acc.toSvg.push(cls);
1329 } else {
1330 acc.toNode.push(cls);
1331 }
1332
1333 return acc;
1334 }, {
1335 toNode: [],
1336 toSvg: []
1337 });
1338 abstract[0].attributes.class = splitClasses.toSvg.join(' ');
1339 var newInnerHTML = abstract.map(function (a) {
1340 return toHtml(a);
1341 }).join('\n');
1342 node.setAttribute('class', splitClasses.toNode.join(' '));
1343 node.setAttribute(DATA_FA_I2SVG, '');
1344 node.innerHTML = newInnerHTML;
1345 }
1346 };
1347
1348 function performOperationSync(op) {
1349 op();
1350 }
1351
1352 function perform(mutations, callback) {
1353 var callbackFunction = typeof callback === 'function' ? callback : noop$2;
1354
1355 if (mutations.length === 0) {
1356 callbackFunction();
1357 } else {
1358 var frame = performOperationSync;
1359
1360 if (config.mutateApproach === MUTATION_APPROACH_ASYNC) {
1361 frame = WINDOW.requestAnimationFrame || performOperationSync;
1362 }
1363
1364 frame(function () {
1365 var mutator = getMutator();
1366 var mark = perf.begin('mutate');
1367 mutations.map(mutator);
1368 mark();
1369 callbackFunction();
1370 });
1371 }
1372 }
1373 var disabled = false;
1374 function disableObservation() {
1375 disabled = true;
1376 }
1377 function enableObservation() {
1378 disabled = false;
1379 }
1380 var mo = null;
1381 function observe(options) {
1382 if (!MUTATION_OBSERVER) {
1383 return;
1384 }
1385
1386 if (!config.observeMutations) {
1387 return;
1388 }
1389
1390 var treeCallback = options.treeCallback,
1391 nodeCallback = options.nodeCallback,
1392 pseudoElementsCallback = options.pseudoElementsCallback,
1393 _options$observeMutat = options.observeMutationsRoot,
1394 observeMutationsRoot = _options$observeMutat === void 0 ? DOCUMENT : _options$observeMutat;
1395 mo = new MUTATION_OBSERVER(function (objects) {
1396 if (disabled) return;
1397 toArray(objects).forEach(function (mutationRecord) {
1398 if (mutationRecord.type === 'childList' && mutationRecord.addedNodes.length > 0 && !isWatched(mutationRecord.addedNodes[0])) {
1399 if (config.searchPseudoElements) {
1400 pseudoElementsCallback(mutationRecord.target);
1401 }
1402
1403 treeCallback(mutationRecord.target);
1404 }
1405
1406 if (mutationRecord.type === 'attributes' && mutationRecord.target.parentNode && config.searchPseudoElements) {
1407 pseudoElementsCallback(mutationRecord.target.parentNode);
1408 }
1409
1410 if (mutationRecord.type === 'attributes' && isWatched(mutationRecord.target) && ~ATTRIBUTES_WATCHED_FOR_MUTATION.indexOf(mutationRecord.attributeName)) {
1411 if (mutationRecord.attributeName === 'class') {
1412 var _getCanonicalIcon = getCanonicalIcon(classArray(mutationRecord.target)),
1413 prefix = _getCanonicalIcon.prefix,
1414 iconName = _getCanonicalIcon.iconName;
1415
1416 if (prefix) mutationRecord.target.setAttribute('data-prefix', prefix);
1417 if (iconName) mutationRecord.target.setAttribute('data-icon', iconName);
1418 } else {
1419 nodeCallback(mutationRecord.target);
1420 }
1421 }
1422 });
1423 });
1424 if (!IS_DOM) return;
1425 mo.observe(observeMutationsRoot, {
1426 childList: true,
1427 attributes: true,
1428 characterData: true,
1429 subtree: true
1430 });
1431 }
1432 function disconnect() {
1433 if (!mo) return;
1434 mo.disconnect();
1435 }
1436
1437 function styleParser (node) {
1438 var style = node.getAttribute('style');
1439 var val = [];
1440
1441 if (style) {
1442 val = style.split(';').reduce(function (acc, style) {
1443 var styles = style.split(':');
1444 var prop = styles[0];
1445 var value = styles.slice(1);
1446
1447 if (prop && value.length > 0) {
1448 acc[prop] = value.join(':').trim();
1449 }
1450
1451 return acc;
1452 }, {});
1453 }
1454
1455 return val;
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 = [];
1842
1843 try {
1844 candidates = toArray(root.querySelectorAll(prefixesDomQuery));
1845 } catch (e) {// noop
1846 }
1847
1848 if (candidates.length > 0) {
1849 hclAdd('pending');
1850 hclRemove('complete');
1851 } else {
1852 return;
1853 }
1854
1855 var mark = perf.begin('onTree');
1856 var mutations = candidates.reduce(function (acc, node) {
1857 try {
1858 var mutation = generateMutation(node);
1859
1860 if (mutation) {
1861 acc.push(mutation);
1862 }
1863 } catch (e) {
1864 if (!PRODUCTION) {
1865 if (e instanceof MissingIcon) {
1866 console.error(e);
1867 }
1868 }
1869 }
1870
1871 return acc;
1872 }, []);
1873 return new picked(function (resolve, reject) {
1874 picked.all(mutations).then(function (resolvedMutations) {
1875 perform(resolvedMutations, function () {
1876 hclAdd('active');
1877 hclAdd('complete');
1878 hclRemove('pending');
1879 if (typeof callback === 'function') callback();
1880 mark();
1881 resolve();
1882 });
1883 }).catch(function () {
1884 mark();
1885 reject();
1886 });
1887 });
1888 }
1889 function onNode(node) {
1890 var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1891 generateMutation(node).then(function (mutation) {
1892 if (mutation) {
1893 perform([mutation], callback);
1894 }
1895 });
1896 }
1897
1898 function replaceForPosition(node, position) {
1899 var pendingAttribute = "".concat(DATA_FA_PSEUDO_ELEMENT_PENDING).concat(position.replace(':', '-'));
1900 return new picked(function (resolve, reject) {
1901 if (node.getAttribute(pendingAttribute) !== null) {
1902 // This node is already being processed
1903 return resolve();
1904 }
1905
1906 var children = toArray(node.children);
1907 var alreadyProcessedPseudoElement = children.filter(function (c) {
1908 return c.getAttribute(DATA_FA_PSEUDO_ELEMENT) === position;
1909 })[0];
1910 var styles = WINDOW.getComputedStyle(node, position);
1911 var fontFamily = styles.getPropertyValue('font-family').match(FONT_FAMILY_PATTERN);
1912 var fontWeight = styles.getPropertyValue('font-weight');
1913
1914 if (alreadyProcessedPseudoElement && !fontFamily) {
1915 // If we've already processed it but the current computed style does not result in a font-family,
1916 // that probably means that a class name that was previously present to make the icon has been
1917 // removed. So we now should delete the icon.
1918 node.removeChild(alreadyProcessedPseudoElement);
1919 return resolve();
1920 } else if (fontFamily) {
1921 var content = styles.getPropertyValue('content');
1922 var prefix = ~['Light', 'Regular', 'Solid', 'Brands'].indexOf(fontFamily[1]) ? STYLE_TO_PREFIX[fontFamily[1].toLowerCase()] : FONT_WEIGHT_TO_PREFIX[fontWeight];
1923 var hexValue = toHex(content.length === 3 ? content.substr(1, 1) : content);
1924 var iconName = byUnicode(prefix, hexValue);
1925 var iconIdentifier = iconName; // Only convert the pseudo element in this :before/:after position into an icon if we haven't
1926 // already done so with the same prefix and iconName
1927
1928 if (iconName && (!alreadyProcessedPseudoElement || alreadyProcessedPseudoElement.getAttribute(DATA_PREFIX) !== prefix || alreadyProcessedPseudoElement.getAttribute(DATA_ICON) !== iconIdentifier)) {
1929 node.setAttribute(pendingAttribute, iconIdentifier);
1930
1931 if (alreadyProcessedPseudoElement) {
1932 // Delete the old one, since we're replacing it with a new one
1933 node.removeChild(alreadyProcessedPseudoElement);
1934 }
1935
1936 var meta = blankMeta();
1937 var extra = meta.extra;
1938 extra.attributes[DATA_FA_PSEUDO_ELEMENT] = position;
1939 findIcon(iconName, prefix).then(function (main) {
1940 var abstract = makeInlineSvgAbstract(_objectSpread({}, meta, {
1941 icons: {
1942 main: main,
1943 mask: emptyCanonicalIcon()
1944 },
1945 prefix: prefix,
1946 iconName: iconIdentifier,
1947 extra: extra,
1948 watchable: true
1949 }));
1950 var element = DOCUMENT.createElement('svg');
1951
1952 if (position === ':before') {
1953 node.insertBefore(element, node.firstChild);
1954 } else {
1955 node.appendChild(element);
1956 }
1957
1958 element.outerHTML = abstract.map(function (a) {
1959 return toHtml(a);
1960 }).join('\n');
1961 node.removeAttribute(pendingAttribute);
1962 resolve();
1963 }).catch(reject);
1964 } else {
1965 resolve();
1966 }
1967 } else {
1968 resolve();
1969 }
1970 });
1971 }
1972
1973 function replace(node) {
1974 return picked.all([replaceForPosition(node, ':before'), replaceForPosition(node, ':after')]);
1975 }
1976
1977 function processable(node) {
1978 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');
1979 }
1980
1981 function searchPseudoElements (root) {
1982 if (!IS_DOM) return;
1983 return new picked(function (resolve, reject) {
1984 var operations = toArray(root.querySelectorAll('*')).filter(processable).map(replace);
1985 var end = perf.begin('searchPseudoElements');
1986 disableObservation();
1987 picked.all(operations).then(function () {
1988 end();
1989 enableObservation();
1990 resolve();
1991 }).catch(function () {
1992 end();
1993 enableObservation();
1994 reject();
1995 });
1996 });
1997 }
1998
1999 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}";
2000
2001 function css () {
2002 var dfp = DEFAULT_FAMILY_PREFIX;
2003 var drc = DEFAULT_REPLACEMENT_CLASS;
2004 var fp = config.familyPrefix;
2005 var rc = config.replacementClass;
2006 var s = baseStyles;
2007
2008 if (fp !== dfp || rc !== drc) {
2009 var dPatt = new RegExp("\\.".concat(dfp, "\\-"), 'g');
2010 var rPatt = new RegExp("\\.".concat(drc), 'g');
2011 s = s.replace(dPatt, ".".concat(fp, "-")).replace(rPatt, ".".concat(rc));
2012 }
2013
2014 return s;
2015 }
2016
2017 var Library =
2018 /*#__PURE__*/
2019 function () {
2020 function Library() {
2021 _classCallCheck(this, Library);
2022
2023 this.definitions = {};
2024 }
2025
2026 _createClass(Library, [{
2027 key: "add",
2028 value: function add() {
2029 var _this = this;
2030
2031 for (var _len = arguments.length, definitions = new Array(_len), _key = 0; _key < _len; _key++) {
2032 definitions[_key] = arguments[_key];
2033 }
2034
2035 var additions = definitions.reduce(this._pullDefinitions, {});
2036 Object.keys(additions).forEach(function (key) {
2037 _this.definitions[key] = _objectSpread({}, _this.definitions[key] || {}, additions[key]);
2038 defineIcons(key, additions[key]);
2039 build();
2040 });
2041 }
2042 }, {
2043 key: "reset",
2044 value: function reset() {
2045 this.definitions = {};
2046 }
2047 }, {
2048 key: "_pullDefinitions",
2049 value: function _pullDefinitions(additions, definition) {
2050 var normalized = definition.prefix && definition.iconName && definition.icon ? {
2051 0: definition
2052 } : definition;
2053 Object.keys(normalized).map(function (key) {
2054 var _normalized$key = normalized[key],
2055 prefix = _normalized$key.prefix,
2056 iconName = _normalized$key.iconName,
2057 icon = _normalized$key.icon;
2058 if (!additions[prefix]) additions[prefix] = {};
2059 additions[prefix][iconName] = icon;
2060 });
2061 return additions;
2062 }
2063 }]);
2064
2065 return Library;
2066 }();
2067
2068 function prepIcon(icon) {
2069 var width = icon[0];
2070 var height = icon[1];
2071 var vectorData = icon.slice(4);
2072 return {
2073 found: true,
2074 width: width,
2075 height: height,
2076 icon: {
2077 tag: 'path',
2078 attributes: {
2079 fill: 'currentColor',
2080 d: vectorData[0]
2081 }
2082 }
2083 };
2084 }
2085
2086 function ensureCss() {
2087 if (config.autoAddCss && !_cssInserted) {
2088 insertCss(css());
2089
2090 _cssInserted = true;
2091 }
2092 }
2093
2094 function apiObject(val, abstractCreator) {
2095 Object.defineProperty(val, 'abstract', {
2096 get: abstractCreator
2097 });
2098 Object.defineProperty(val, 'html', {
2099 get: function get() {
2100 return val.abstract.map(function (a) {
2101 return toHtml(a);
2102 });
2103 }
2104 });
2105 Object.defineProperty(val, 'node', {
2106 get: function get() {
2107 if (!IS_DOM) return;
2108 var container = DOCUMENT.createElement('div');
2109 container.innerHTML = val.html;
2110 return container.children;
2111 }
2112 });
2113 return val;
2114 }
2115
2116 function findIconDefinition(iconLookup) {
2117 var _iconLookup$prefix = iconLookup.prefix,
2118 prefix = _iconLookup$prefix === void 0 ? 'fa' : _iconLookup$prefix,
2119 iconName = iconLookup.iconName;
2120 if (!iconName) return;
2121 return iconFromMapping(library.definitions, prefix, iconName) || iconFromMapping(namespace.styles, prefix, iconName);
2122 }
2123
2124 function resolveIcons(next) {
2125 return function (maybeIconDefinition) {
2126 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2127 var iconDefinition = (maybeIconDefinition || {}).icon ? maybeIconDefinition : findIconDefinition(maybeIconDefinition || {});
2128 var mask = params.mask;
2129
2130 if (mask) {
2131 mask = (mask || {}).icon ? mask : findIconDefinition(mask || {});
2132 }
2133
2134 return next(iconDefinition, _objectSpread({}, params, {
2135 mask: mask
2136 }));
2137 };
2138 }
2139
2140 var library = new Library();
2141 var noAuto = function noAuto() {
2142 config.autoReplaceSvg = false;
2143 config.observeMutations = false;
2144 disconnect();
2145 };
2146 var _cssInserted = false;
2147 var dom = {
2148 i2svg: function i2svg() {
2149 var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2150
2151 if (IS_DOM) {
2152 ensureCss();
2153 var _params$node = params.node,
2154 node = _params$node === void 0 ? DOCUMENT : _params$node,
2155 _params$callback = params.callback,
2156 callback = _params$callback === void 0 ? function () {} : _params$callback;
2157
2158 if (config.searchPseudoElements) {
2159 searchPseudoElements(node);
2160 }
2161
2162 return onTree(node, callback);
2163 } else {
2164 return picked.reject('Operation requires a DOM of some kind.');
2165 }
2166 },
2167 css: css,
2168 insertCss: function insertCss$$1() {
2169 if (!_cssInserted) {
2170 insertCss(css());
2171
2172 _cssInserted = true;
2173 }
2174 },
2175 watch: function watch() {
2176 var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2177 var autoReplaceSvgRoot = params.autoReplaceSvgRoot,
2178 observeMutationsRoot = params.observeMutationsRoot;
2179
2180 if (config.autoReplaceSvg === false) {
2181 config.autoReplaceSvg = true;
2182 }
2183
2184 config.observeMutations = true;
2185 domready(function () {
2186 autoReplace({
2187 autoReplaceSvgRoot: autoReplaceSvgRoot
2188 });
2189 observe({
2190 treeCallback: onTree,
2191 nodeCallback: onNode,
2192 pseudoElementsCallback: searchPseudoElements,
2193 observeMutationsRoot: observeMutationsRoot
2194 });
2195 });
2196 }
2197 };
2198 var parse = {
2199 transform: function transform(transformString) {
2200 return parseTransformString(transformString);
2201 }
2202 };
2203 var icon = resolveIcons(function (iconDefinition) {
2204 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2205 var _params$transform = params.transform,
2206 transform = _params$transform === void 0 ? meaninglessTransform : _params$transform,
2207 _params$symbol = params.symbol,
2208 symbol = _params$symbol === void 0 ? false : _params$symbol,
2209 _params$mask = params.mask,
2210 mask = _params$mask === void 0 ? null : _params$mask,
2211 _params$title = params.title,
2212 title = _params$title === void 0 ? null : _params$title,
2213 _params$classes = params.classes,
2214 classes = _params$classes === void 0 ? [] : _params$classes,
2215 _params$attributes = params.attributes,
2216 attributes = _params$attributes === void 0 ? {} : _params$attributes,
2217 _params$styles = params.styles,
2218 styles = _params$styles === void 0 ? {} : _params$styles;
2219 if (!iconDefinition) return;
2220 var prefix = iconDefinition.prefix,
2221 iconName = iconDefinition.iconName,
2222 icon = iconDefinition.icon;
2223 return apiObject(_objectSpread({
2224 type: 'icon'
2225 }, iconDefinition), function () {
2226 ensureCss();
2227
2228 if (config.autoA11y) {
2229 if (title) {
2230 attributes['aria-labelledby'] = "".concat(config.replacementClass, "-title-").concat(nextUniqueId());
2231 } else {
2232 attributes['aria-hidden'] = 'true';
2233 attributes['focusable'] = 'false';
2234 }
2235 }
2236
2237 return makeInlineSvgAbstract({
2238 icons: {
2239 main: prepIcon(icon),
2240 mask: mask ? prepIcon(mask.icon) : {
2241 found: false,
2242 width: null,
2243 height: null,
2244 icon: {}
2245 }
2246 },
2247 prefix: prefix,
2248 iconName: iconName,
2249 transform: _objectSpread({}, meaninglessTransform, transform),
2250 symbol: symbol,
2251 title: title,
2252 extra: {
2253 attributes: attributes,
2254 styles: styles,
2255 classes: classes
2256 }
2257 });
2258 });
2259 });
2260 var text = function text(content) {
2261 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2262 var _params$transform2 = params.transform,
2263 transform = _params$transform2 === void 0 ? meaninglessTransform : _params$transform2,
2264 _params$title2 = params.title,
2265 title = _params$title2 === void 0 ? null : _params$title2,
2266 _params$classes2 = params.classes,
2267 classes = _params$classes2 === void 0 ? [] : _params$classes2,
2268 _params$attributes2 = params.attributes,
2269 attributes = _params$attributes2 === void 0 ? {} : _params$attributes2,
2270 _params$styles2 = params.styles,
2271 styles = _params$styles2 === void 0 ? {} : _params$styles2;
2272 return apiObject({
2273 type: 'text',
2274 content: content
2275 }, function () {
2276 ensureCss();
2277 return makeLayersTextAbstract({
2278 content: content,
2279 transform: _objectSpread({}, meaninglessTransform, transform),
2280 title: title,
2281 extra: {
2282 attributes: attributes,
2283 styles: styles,
2284 classes: ["".concat(config.familyPrefix, "-layers-text")].concat(_toConsumableArray(classes))
2285 }
2286 });
2287 });
2288 };
2289 var counter = function counter(content) {
2290 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2291 var _params$title3 = params.title,
2292 title = _params$title3 === void 0 ? null : _params$title3,
2293 _params$classes3 = params.classes,
2294 classes = _params$classes3 === void 0 ? [] : _params$classes3,
2295 _params$attributes3 = params.attributes,
2296 attributes = _params$attributes3 === void 0 ? {} : _params$attributes3,
2297 _params$styles3 = params.styles,
2298 styles = _params$styles3 === void 0 ? {} : _params$styles3;
2299 return apiObject({
2300 type: 'counter',
2301 content: content
2302 }, function () {
2303 ensureCss();
2304 return makeLayersCounterAbstract({
2305 content: content.toString(),
2306 title: title,
2307 extra: {
2308 attributes: attributes,
2309 styles: styles,
2310 classes: ["".concat(config.familyPrefix, "-layers-counter")].concat(_toConsumableArray(classes))
2311 }
2312 });
2313 });
2314 };
2315 var layer = function layer(assembler) {
2316 return apiObject({
2317 type: 'layer'
2318 }, function () {
2319 ensureCss();
2320 var children = [];
2321 assembler(function (args) {
2322 Array.isArray(args) ? args.map(function (a) {
2323 children = children.concat(a.abstract);
2324 }) : children = children.concat(args.abstract);
2325 });
2326 return [{
2327 tag: 'span',
2328 attributes: {
2329 class: "".concat(config.familyPrefix, "-layers")
2330 },
2331 children: children
2332 }];
2333 });
2334 };
2335 var api = {
2336 noAuto: noAuto,
2337 config: config,
2338 dom: dom,
2339 library: library,
2340 parse: parse,
2341 findIconDefinition: findIconDefinition,
2342 icon: icon,
2343 text: text,
2344 counter: counter,
2345 layer: layer,
2346 toHtml: toHtml
2347 };
2348
2349 var autoReplace = function autoReplace() {
2350 var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2351 var _params$autoReplaceSv = params.autoReplaceSvgRoot,
2352 autoReplaceSvgRoot = _params$autoReplaceSv === void 0 ? DOCUMENT : _params$autoReplaceSv;
2353 if ((Object.keys(namespace.styles).length > 0 || config.autoFetchSvg) && IS_DOM && config.autoReplaceSvg) api.dom.i2svg({
2354 node: autoReplaceSvgRoot
2355 });
2356 };
2357
2358 exports.icon = icon;
2359 exports.noAuto = noAuto;
2360 exports.config = config;
2361 exports.toHtml = toHtml;
2362 exports.layer = layer;
2363 exports.text = text;
2364 exports.counter = counter;
2365 exports.library = library;
2366 exports.dom = dom;
2367 exports.parse = parse;
2368 exports.findIconDefinition = findIconDefinition;
2369
2370 Object.defineProperty(exports, '__esModule', { value: true });
2371
2372})));