Debian Codegraph @

src/assets/fontawesome/js/fontawesome.js

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