Heuzef - Les notes excentriques d'un bidouilleur.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

3127 line
115 KiB

  1. /*!
  2. * Font Awesome Free 6.4.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. * Copyright 2023 Fonticons, Inc.
  5. */
  6. (function () {
  7. 'use strict';
  8. function ownKeys(object, enumerableOnly) {
  9. var keys = Object.keys(object);
  10. if (Object.getOwnPropertySymbols) {
  11. var symbols = Object.getOwnPropertySymbols(object);
  12. enumerableOnly && (symbols = symbols.filter(function (sym) {
  13. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  14. })), keys.push.apply(keys, symbols);
  15. }
  16. return keys;
  17. }
  18. function _objectSpread2(target) {
  19. for (var i = 1; i < arguments.length; i++) {
  20. var source = null != arguments[i] ? arguments[i] : {};
  21. i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
  22. _defineProperty(target, key, source[key]);
  23. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
  24. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  25. });
  26. }
  27. return target;
  28. }
  29. function _typeof(obj) {
  30. "@babel/helpers - typeof";
  31. return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
  32. return typeof obj;
  33. } : function (obj) {
  34. return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  35. }, _typeof(obj);
  36. }
  37. function _wrapRegExp() {
  38. _wrapRegExp = function (re, groups) {
  39. return new BabelRegExp(re, void 0, groups);
  40. };
  41. var _super = RegExp.prototype,
  42. _groups = new WeakMap();
  43. function BabelRegExp(re, flags, groups) {
  44. var _this = new RegExp(re, flags);
  45. return _groups.set(_this, groups || _groups.get(re)), _setPrototypeOf(_this, BabelRegExp.prototype);
  46. }
  47. function buildGroups(result, re) {
  48. var g = _groups.get(re);
  49. return Object.keys(g).reduce(function (groups, name) {
  50. return groups[name] = result[g[name]], groups;
  51. }, Object.create(null));
  52. }
  53. return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) {
  54. var result = _super.exec.call(this, str);
  55. return result && (result.groups = buildGroups(result, this)), result;
  56. }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
  57. if ("string" == typeof substitution) {
  58. var groups = _groups.get(this);
  59. return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
  60. return "$" + groups[name];
  61. }));
  62. }
  63. if ("function" == typeof substitution) {
  64. var _this = this;
  65. return _super[Symbol.replace].call(this, str, function () {
  66. var args = arguments;
  67. return "object" != typeof args[args.length - 1] && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args);
  68. });
  69. }
  70. return _super[Symbol.replace].call(this, str, substitution);
  71. }, _wrapRegExp.apply(this, arguments);
  72. }
  73. function _classCallCheck(instance, Constructor) {
  74. if (!(instance instanceof Constructor)) {
  75. throw new TypeError("Cannot call a class as a function");
  76. }
  77. }
  78. function _defineProperties(target, props) {
  79. for (var i = 0; i < props.length; i++) {
  80. var descriptor = props[i];
  81. descriptor.enumerable = descriptor.enumerable || false;
  82. descriptor.configurable = true;
  83. if ("value" in descriptor) descriptor.writable = true;
  84. Object.defineProperty(target, descriptor.key, descriptor);
  85. }
  86. }
  87. function _createClass(Constructor, protoProps, staticProps) {
  88. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  89. if (staticProps) _defineProperties(Constructor, staticProps);
  90. Object.defineProperty(Constructor, "prototype", {
  91. writable: false
  92. });
  93. return Constructor;
  94. }
  95. function _defineProperty(obj, key, value) {
  96. if (key in obj) {
  97. Object.defineProperty(obj, key, {
  98. value: value,
  99. enumerable: true,
  100. configurable: true,
  101. writable: true
  102. });
  103. } else {
  104. obj[key] = value;
  105. }
  106. return obj;
  107. }
  108. function _inherits(subClass, superClass) {
  109. if (typeof superClass !== "function" && superClass !== null) {
  110. throw new TypeError("Super expression must either be null or a function");
  111. }
  112. subClass.prototype = Object.create(superClass && superClass.prototype, {
  113. constructor: {
  114. value: subClass,
  115. writable: true,
  116. configurable: true
  117. }
  118. });
  119. Object.defineProperty(subClass, "prototype", {
  120. writable: false
  121. });
  122. if (superClass) _setPrototypeOf(subClass, superClass);
  123. }
  124. function _setPrototypeOf(o, p) {
  125. _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
  126. o.__proto__ = p;
  127. return o;
  128. };
  129. return _setPrototypeOf(o, p);
  130. }
  131. function _slicedToArray(arr, i) {
  132. return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
  133. }
  134. function _toConsumableArray(arr) {
  135. return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
  136. }
  137. function _arrayWithoutHoles(arr) {
  138. if (Array.isArray(arr)) return _arrayLikeToArray(arr);
  139. }
  140. function _arrayWithHoles(arr) {
  141. if (Array.isArray(arr)) return arr;
  142. }
  143. function _iterableToArray(iter) {
  144. if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
  145. }
  146. function _iterableToArrayLimit(arr, i) {
  147. var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
  148. if (_i == null) return;
  149. var _arr = [];
  150. var _n = true;
  151. var _d = false;
  152. var _s, _e;
  153. try {
  154. for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
  155. _arr.push(_s.value);
  156. if (i && _arr.length === i) break;
  157. }
  158. } catch (err) {
  159. _d = true;
  160. _e = err;
  161. } finally {
  162. try {
  163. if (!_n && _i["return"] != null) _i["return"]();
  164. } finally {
  165. if (_d) throw _e;
  166. }
  167. }
  168. return _arr;
  169. }
  170. function _unsupportedIterableToArray(o, minLen) {
  171. if (!o) return;
  172. if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  173. var n = Object.prototype.toString.call(o).slice(8, -1);
  174. if (n === "Object" && o.constructor) n = o.constructor.name;
  175. if (n === "Map" || n === "Set") return Array.from(o);
  176. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  177. }
  178. function _arrayLikeToArray(arr, len) {
  179. if (len == null || len > arr.length) len = arr.length;
  180. for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
  181. return arr2;
  182. }
  183. function _nonIterableSpread() {
  184. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  185. }
  186. function _nonIterableRest() {
  187. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  188. }
  189. var noop = function noop() {};
  190. var _WINDOW = {};
  191. var _DOCUMENT = {};
  192. var _MUTATION_OBSERVER = null;
  193. var _PERFORMANCE = {
  194. mark: noop,
  195. measure: noop
  196. };
  197. try {
  198. if (typeof window !== 'undefined') _WINDOW = window;
  199. if (typeof document !== 'undefined') _DOCUMENT = document;
  200. if (typeof MutationObserver !== 'undefined') _MUTATION_OBSERVER = MutationObserver;
  201. if (typeof performance !== 'undefined') _PERFORMANCE = performance;
  202. } catch (e) {}
  203. var _ref = _WINDOW.navigator || {},
  204. _ref$userAgent = _ref.userAgent,
  205. userAgent = _ref$userAgent === void 0 ? '' : _ref$userAgent;
  206. var WINDOW = _WINDOW;
  207. var DOCUMENT = _DOCUMENT;
  208. var MUTATION_OBSERVER = _MUTATION_OBSERVER;
  209. var PERFORMANCE = _PERFORMANCE;
  210. var IS_BROWSER = !!WINDOW.document;
  211. var IS_DOM = !!DOCUMENT.documentElement && !!DOCUMENT.head && typeof DOCUMENT.addEventListener === 'function' && typeof DOCUMENT.createElement === 'function';
  212. var IS_IE = ~userAgent.indexOf('MSIE') || ~userAgent.indexOf('Trident/');
  213. var _familyProxy, _familyProxy2, _familyProxy3, _familyProxy4, _familyProxy5;
  214. var NAMESPACE_IDENTIFIER = '___FONT_AWESOME___';
  215. var UNITS_IN_GRID = 16;
  216. var DEFAULT_CSS_PREFIX = 'fa';
  217. var DEFAULT_REPLACEMENT_CLASS = 'svg-inline--fa';
  218. var DATA_FA_I2SVG = 'data-fa-i2svg';
  219. var DATA_FA_PSEUDO_ELEMENT = 'data-fa-pseudo-element';
  220. var DATA_FA_PSEUDO_ELEMENT_PENDING = 'data-fa-pseudo-element-pending';
  221. var DATA_PREFIX = 'data-prefix';
  222. var DATA_ICON = 'data-icon';
  223. var HTML_CLASS_I2SVG_BASE_CLASS = 'fontawesome-i2svg';
  224. var MUTATION_APPROACH_ASYNC = 'async';
  225. var TAGNAMES_TO_SKIP_FOR_PSEUDOELEMENTS = ['HTML', 'HEAD', 'STYLE', 'SCRIPT'];
  226. var PRODUCTION = function () {
  227. try {
  228. return "production" === 'production';
  229. } catch (e) {
  230. return false;
  231. }
  232. }();
  233. var FAMILY_CLASSIC = 'classic';
  234. var FAMILY_SHARP = 'sharp';
  235. var FAMILIES = [FAMILY_CLASSIC, FAMILY_SHARP];
  236. function familyProxy(obj) {
  237. // Defaults to the classic family if family is not available
  238. return new Proxy(obj, {
  239. get: function get(target, prop) {
  240. return prop in target ? target[prop] : target[FAMILY_CLASSIC];
  241. }
  242. });
  243. }
  244. var PREFIX_TO_STYLE = familyProxy((_familyProxy = {}, _defineProperty(_familyProxy, FAMILY_CLASSIC, {
  245. 'fa': 'solid',
  246. 'fas': 'solid',
  247. 'fa-solid': 'solid',
  248. 'far': 'regular',
  249. 'fa-regular': 'regular',
  250. 'fal': 'light',
  251. 'fa-light': 'light',
  252. 'fat': 'thin',
  253. 'fa-thin': 'thin',
  254. 'fad': 'duotone',
  255. 'fa-duotone': 'duotone',
  256. 'fab': 'brands',
  257. 'fa-brands': 'brands',
  258. 'fak': 'kit',
  259. 'fa-kit': 'kit'
  260. }), _defineProperty(_familyProxy, FAMILY_SHARP, {
  261. 'fa': 'solid',
  262. 'fass': 'solid',
  263. 'fa-solid': 'solid',
  264. 'fasr': 'regular',
  265. 'fa-regular': 'regular',
  266. 'fasl': 'light',
  267. 'fa-light': 'light'
  268. }), _familyProxy));
  269. var STYLE_TO_PREFIX = familyProxy((_familyProxy2 = {}, _defineProperty(_familyProxy2, FAMILY_CLASSIC, {
  270. 'solid': 'fas',
  271. 'regular': 'far',
  272. 'light': 'fal',
  273. 'thin': 'fat',
  274. 'duotone': 'fad',
  275. 'brands': 'fab',
  276. 'kit': 'fak'
  277. }), _defineProperty(_familyProxy2, FAMILY_SHARP, {
  278. 'solid': 'fass',
  279. 'regular': 'fasr',
  280. 'light': 'fasl'
  281. }), _familyProxy2));
  282. var PREFIX_TO_LONG_STYLE = familyProxy((_familyProxy3 = {}, _defineProperty(_familyProxy3, FAMILY_CLASSIC, {
  283. 'fab': 'fa-brands',
  284. 'fad': 'fa-duotone',
  285. 'fak': 'fa-kit',
  286. 'fal': 'fa-light',
  287. 'far': 'fa-regular',
  288. 'fas': 'fa-solid',
  289. 'fat': 'fa-thin'
  290. }), _defineProperty(_familyProxy3, FAMILY_SHARP, {
  291. 'fass': 'fa-solid',
  292. 'fasr': 'fa-regular',
  293. 'fasl': 'fa-light'
  294. }), _familyProxy3));
  295. var LONG_STYLE_TO_PREFIX = familyProxy((_familyProxy4 = {}, _defineProperty(_familyProxy4, FAMILY_CLASSIC, {
  296. 'fa-brands': 'fab',
  297. 'fa-duotone': 'fad',
  298. 'fa-kit': 'fak',
  299. 'fa-light': 'fal',
  300. 'fa-regular': 'far',
  301. 'fa-solid': 'fas',
  302. 'fa-thin': 'fat'
  303. }), _defineProperty(_familyProxy4, FAMILY_SHARP, {
  304. 'fa-solid': 'fass',
  305. 'fa-regular': 'fasr',
  306. 'fa-light': 'fasl'
  307. }), _familyProxy4));
  308. var ICON_SELECTION_SYNTAX_PATTERN = /fa(s|r|l|t|d|b|k|ss|sr|sl)?[\-\ ]/; // eslint-disable-line no-useless-escape
  309. var LAYERS_TEXT_CLASSNAME = 'fa-layers-text';
  310. var FONT_FAMILY_PATTERN = /Font ?Awesome ?([56 ]*)(Solid|Regular|Light|Thin|Duotone|Brands|Free|Pro|Sharp|Kit)?.*/i;
  311. var FONT_WEIGHT_TO_PREFIX = familyProxy((_familyProxy5 = {}, _defineProperty(_familyProxy5, FAMILY_CLASSIC, {
  312. '900': 'fas',
  313. '400': 'far',
  314. 'normal': 'far',
  315. '300': 'fal',
  316. '100': 'fat'
  317. }), _defineProperty(_familyProxy5, FAMILY_SHARP, {
  318. '900': 'fass',
  319. '400': 'fasr',
  320. '300': 'fasl'
  321. }), _familyProxy5));
  322. var oneToTen = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
  323. var oneToTwenty = oneToTen.concat([11, 12, 13, 14, 15, 16, 17, 18, 19, 20]);
  324. var ATTRIBUTES_WATCHED_FOR_MUTATION = ['class', 'data-prefix', 'data-icon', 'data-fa-transform', 'data-fa-mask'];
  325. var DUOTONE_CLASSES = {
  326. GROUP: 'duotone-group',
  327. SWAP_OPACITY: 'swap-opacity',
  328. PRIMARY: 'primary',
  329. SECONDARY: 'secondary'
  330. };
  331. var prefixes = new Set();
  332. Object.keys(STYLE_TO_PREFIX[FAMILY_CLASSIC]).map(prefixes.add.bind(prefixes));
  333. Object.keys(STYLE_TO_PREFIX[FAMILY_SHARP]).map(prefixes.add.bind(prefixes));
  334. var RESERVED_CLASSES = [].concat(FAMILIES, _toConsumableArray(prefixes), ['2xs', 'xs', 'sm', 'lg', 'xl', '2xl', 'beat', 'border', 'fade', 'beat-fade', 'bounce', 'flip-both', 'flip-horizontal', 'flip-vertical', 'flip', 'fw', 'inverse', 'layers-counter', 'layers-text', 'layers', 'li', 'pull-left', 'pull-right', 'pulse', 'rotate-180', 'rotate-270', 'rotate-90', 'rotate-by', 'shake', 'spin-pulse', 'spin-reverse', 'spin', 'stack-1x', 'stack-2x', 'stack', 'ul', DUOTONE_CLASSES.GROUP, DUOTONE_CLASSES.SWAP_OPACITY, DUOTONE_CLASSES.PRIMARY, DUOTONE_CLASSES.SECONDARY]).concat(oneToTen.map(function (n) {
  335. return "".concat(n, "x");
  336. })).concat(oneToTwenty.map(function (n) {
  337. return "w-".concat(n);
  338. }));
  339. var initial = WINDOW.FontAwesomeConfig || {};
  340. function getAttrConfig(attr) {
  341. var element = DOCUMENT.querySelector('script[' + attr + ']');
  342. if (element) {
  343. return element.getAttribute(attr);
  344. }
  345. }
  346. function coerce(val) {
  347. // Getting an empty string will occur if the attribute is set on the HTML tag but without a value
  348. // We'll assume that this is an indication that it should be toggled to true
  349. if (val === '') return true;
  350. if (val === 'false') return false;
  351. if (val === 'true') return true;
  352. return val;
  353. }
  354. if (DOCUMENT && typeof DOCUMENT.querySelector === 'function') {
  355. var attrs = [['data-family-prefix', 'familyPrefix'], ['data-css-prefix', 'cssPrefix'], ['data-family-default', 'familyDefault'], ['data-style-default', 'styleDefault'], ['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']];
  356. attrs.forEach(function (_ref) {
  357. var _ref2 = _slicedToArray(_ref, 2),
  358. attr = _ref2[0],
  359. key = _ref2[1];
  360. var val = coerce(getAttrConfig(attr));
  361. if (val !== undefined && val !== null) {
  362. initial[key] = val;
  363. }
  364. });
  365. }
  366. var _default = {
  367. styleDefault: 'solid',
  368. familyDefault: 'classic',
  369. cssPrefix: DEFAULT_CSS_PREFIX,
  370. replacementClass: DEFAULT_REPLACEMENT_CLASS,
  371. autoReplaceSvg: true,
  372. autoAddCss: true,
  373. autoA11y: true,
  374. searchPseudoElements: false,
  375. observeMutations: true,
  376. mutateApproach: 'async',
  377. keepOriginalSource: true,
  378. measurePerformance: false,
  379. showMissingIcons: true
  380. }; // familyPrefix is deprecated but we must still support it if present
  381. if (initial.familyPrefix) {
  382. initial.cssPrefix = initial.familyPrefix;
  383. }
  384. var _config = _objectSpread2(_objectSpread2({}, _default), initial);
  385. if (!_config.autoReplaceSvg) _config.observeMutations = false;
  386. var config = {};
  387. Object.keys(_default).forEach(function (key) {
  388. Object.defineProperty(config, key, {
  389. enumerable: true,
  390. set: function set(val) {
  391. _config[key] = val;
  392. _onChangeCb.forEach(function (cb) {
  393. return cb(config);
  394. });
  395. },
  396. get: function get() {
  397. return _config[key];
  398. }
  399. });
  400. }); // familyPrefix is deprecated as of 6.2.0 and should be removed in 7.0.0
  401. Object.defineProperty(config, 'familyPrefix', {
  402. enumerable: true,
  403. set: function set(val) {
  404. _config.cssPrefix = val;
  405. _onChangeCb.forEach(function (cb) {
  406. return cb(config);
  407. });
  408. },
  409. get: function get() {
  410. return _config.cssPrefix;
  411. }
  412. });
  413. WINDOW.FontAwesomeConfig = config;
  414. var _onChangeCb = [];
  415. function onChange(cb) {
  416. _onChangeCb.push(cb);
  417. return function () {
  418. _onChangeCb.splice(_onChangeCb.indexOf(cb), 1);
  419. };
  420. }
  421. var d = UNITS_IN_GRID;
  422. var meaninglessTransform = {
  423. size: 16,
  424. x: 0,
  425. y: 0,
  426. rotate: 0,
  427. flipX: false,
  428. flipY: false
  429. };
  430. function bunker(fn) {
  431. try {
  432. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  433. args[_key - 1] = arguments[_key];
  434. }
  435. fn.apply(void 0, args);
  436. } catch (e) {
  437. if (!PRODUCTION) {
  438. throw e;
  439. }
  440. }
  441. }
  442. function insertCss(css) {
  443. if (!css || !IS_DOM) {
  444. return;
  445. }
  446. var style = DOCUMENT.createElement('style');
  447. style.setAttribute('type', 'text/css');
  448. style.innerHTML = css;
  449. var headChildren = DOCUMENT.head.childNodes;
  450. var beforeChild = null;
  451. for (var i = headChildren.length - 1; i > -1; i--) {
  452. var child = headChildren[i];
  453. var tagName = (child.tagName || '').toUpperCase();
  454. if (['STYLE', 'LINK'].indexOf(tagName) > -1) {
  455. beforeChild = child;
  456. }
  457. }
  458. DOCUMENT.head.insertBefore(style, beforeChild);
  459. return css;
  460. }
  461. var idPool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  462. function nextUniqueId() {
  463. var size = 12;
  464. var id = '';
  465. while (size-- > 0) {
  466. id += idPool[Math.random() * 62 | 0];
  467. }
  468. return id;
  469. }
  470. function toArray(obj) {
  471. var array = [];
  472. for (var i = (obj || []).length >>> 0; i--;) {
  473. array[i] = obj[i];
  474. }
  475. return array;
  476. }
  477. function classArray(node) {
  478. if (node.classList) {
  479. return toArray(node.classList);
  480. } else {
  481. return (node.getAttribute('class') || '').split(' ').filter(function (i) {
  482. return i;
  483. });
  484. }
  485. }
  486. function htmlEscape(str) {
  487. return "".concat(str).replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
  488. }
  489. function joinAttributes(attributes) {
  490. return Object.keys(attributes || {}).reduce(function (acc, attributeName) {
  491. return acc + "".concat(attributeName, "=\"").concat(htmlEscape(attributes[attributeName]), "\" ");
  492. }, '').trim();
  493. }
  494. function joinStyles(styles) {
  495. return Object.keys(styles || {}).reduce(function (acc, styleName) {
  496. return acc + "".concat(styleName, ": ").concat(styles[styleName].trim(), ";");
  497. }, '');
  498. }
  499. function transformIsMeaningful(transform) {
  500. return transform.size !== meaninglessTransform.size || transform.x !== meaninglessTransform.x || transform.y !== meaninglessTransform.y || transform.rotate !== meaninglessTransform.rotate || transform.flipX || transform.flipY;
  501. }
  502. function transformForSvg(_ref) {
  503. var transform = _ref.transform,
  504. containerWidth = _ref.containerWidth,
  505. iconWidth = _ref.iconWidth;
  506. var outer = {
  507. transform: "translate(".concat(containerWidth / 2, " 256)")
  508. };
  509. var innerTranslate = "translate(".concat(transform.x * 32, ", ").concat(transform.y * 32, ") ");
  510. var innerScale = "scale(".concat(transform.size / 16 * (transform.flipX ? -1 : 1), ", ").concat(transform.size / 16 * (transform.flipY ? -1 : 1), ") ");
  511. var innerRotate = "rotate(".concat(transform.rotate, " 0 0)");
  512. var inner = {
  513. transform: "".concat(innerTranslate, " ").concat(innerScale, " ").concat(innerRotate)
  514. };
  515. var path = {
  516. transform: "translate(".concat(iconWidth / 2 * -1, " -256)")
  517. };
  518. return {
  519. outer: outer,
  520. inner: inner,
  521. path: path
  522. };
  523. }
  524. function transformForCss(_ref2) {
  525. var transform = _ref2.transform,
  526. _ref2$width = _ref2.width,
  527. width = _ref2$width === void 0 ? UNITS_IN_GRID : _ref2$width,
  528. _ref2$height = _ref2.height,
  529. height = _ref2$height === void 0 ? UNITS_IN_GRID : _ref2$height,
  530. _ref2$startCentered = _ref2.startCentered,
  531. startCentered = _ref2$startCentered === void 0 ? false : _ref2$startCentered;
  532. var val = '';
  533. if (startCentered && IS_IE) {
  534. val += "translate(".concat(transform.x / d - width / 2, "em, ").concat(transform.y / d - height / 2, "em) ");
  535. } else if (startCentered) {
  536. val += "translate(calc(-50% + ".concat(transform.x / d, "em), calc(-50% + ").concat(transform.y / d, "em)) ");
  537. } else {
  538. val += "translate(".concat(transform.x / d, "em, ").concat(transform.y / d, "em) ");
  539. }
  540. val += "scale(".concat(transform.size / d * (transform.flipX ? -1 : 1), ", ").concat(transform.size / d * (transform.flipY ? -1 : 1), ") ");
  541. val += "rotate(".concat(transform.rotate, "deg) ");
  542. return val;
  543. }
  544. var baseStyles = ":host,:root{--fa-font-solid:normal 900 1em/1 \"Font Awesome 6 Solid\";--fa-font-regular:normal 400 1em/1 \"Font Awesome 6 Regular\";--fa-font-light:normal 300 1em/1 \"Font Awesome 6 Light\";--fa-font-thin:normal 100 1em/1 \"Font Awesome 6 Thin\";--fa-font-duotone:normal 900 1em/1 \"Font Awesome 6 Duotone\";--fa-font-sharp-solid:normal 900 1em/1 \"Font Awesome 6 Sharp\";--fa-font-sharp-regular:normal 400 1em/1 \"Font Awesome 6 Sharp\";--fa-font-sharp-light:normal 300 1em/1 \"Font Awesome 6 Sharp\";--fa-font-brands:normal 400 1em/1 \"Font Awesome 6 Brands\"}svg:not(:host).svg-inline--fa,svg:not(:root).svg-inline--fa{overflow:visible;box-sizing:content-box}.svg-inline--fa{display:var(--fa-display,inline-block);height:1em;overflow:visible;vertical-align:-.125em}.svg-inline--fa.fa-2xs{vertical-align:.1em}.svg-inline--fa.fa-xs{vertical-align:0}.svg-inline--fa.fa-sm{vertical-align:-.0714285705em}.svg-inline--fa.fa-lg{vertical-align:-.2em}.svg-inline--fa.fa-xl{vertical-align:-.25em}.svg-inline--fa.fa-2xl{vertical-align:-.3125em}.svg-inline--fa.fa-pull-left{margin-right:var(--fa-pull-margin,.3em);width:auto}.svg-inline--fa.fa-pull-right{margin-left:var(--fa-pull-margin,.3em);width:auto}.svg-inline--fa.fa-li{width:var(--fa-li-width,2em);top:.25em}.svg-inline--fa.fa-fw{width:var(--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-counter,.fa-layers-text{display:inline-block;position:absolute;text-align:center}.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-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:var(--fa-counter-background-color,#ff253a);border-radius:var(--fa-counter-border-radius,1em);box-sizing:border-box;color:var(--fa-inverse,#fff);line-height:var(--fa-counter-line-height,1);max-width:var(--fa-counter-max-width,5em);min-width:var(--fa-counter-min-width,1.5em);overflow:hidden;padding:var(--fa-counter-padding,.25em .5em);right:var(--fa-right,0);text-overflow:ellipsis;top:var(--fa-top,0);-webkit-transform:scale(var(--fa-counter-scale,.25));transform:scale(var(--fa-counter-scale,.25));-webkit-transform-origin:top right;transform-origin:top right}.fa-layers-bottom-right{bottom:var(--fa-bottom,0);right:var(--fa-right,0);top:auto;-webkit-transform:scale(var(--fa-layers-scale,.25));transform:scale(var(--fa-layers-scale,.25));-webkit-transform-origin:bottom right;transform-origin:bottom right}.fa-layers-bottom-left{bottom:var(--fa-bottom,0);left:var(--fa-left,0);right:auto;top:auto;-webkit-transform:scale(var(--fa-layers-scale,.25));transform:scale(var(--fa-layers-scale,.25));-webkit-transform-origin:bottom left;transform-origin:bottom left}.fa-layers-top-right{top:var(--fa-top,0);right:var(--fa-right,0);-webkit-transform:scale(var(--fa-layers-scale,.25));transform:scale(var(--fa-layers-scale,.25));-webkit-transform-origin:top right;transform-origin:top right}.fa-layers-top-left{left:var(--fa-left,0);right:auto;top:var(--fa-top,0);-webkit-transform:scale(var(--fa-layers-scale,.25));transform:scale(var(--fa-layers-scale,.25));-webkit-transform-origin:top left;transform-origin:top left}.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-2xs{font-size:.625em;line-height:.1em;vertical-align:.225em}.fa-xs{font-size:.75em;line-height:.0833333337em;vertical-align:.125em}.fa-sm{font-size:.875em;line-height:.0714285718em;vertical-align:.0535714295em}.fa-lg{font-size:1.25em;line-height:.05em;vertical-align:-.075em}.fa-xl{font-size:1.5em;line-height:.0416666682em;vertical-align:-.125em}.fa-2xl{font-size:2em;line-height:.03125em;vertical-align:-.1875em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:var(--fa-li-margin,2.5em);padding-left:0}.fa-ul>li{position:relative}.fa-li{left:calc(var(--fa-li-width,2em) * -1);position:absolute;text-align:center;width:var(--fa-li-width,2em);line-height:inherit}.fa-border{border-color:var(--fa-border-color,#eee);border-radius:var(--fa-border-radius,.1em);border-style:var(--fa-border-style,solid);border-width:var(--fa-border-width,.08em);padding:var(--fa-border-padding,.2em .25em .15em)}.fa-pull-left{float:left;margin-right:var(--fa-pull-margin,.3em)}.fa-pull-right{float:right;margin-left:var(--fa-pull-margin,.3em)}.fa-beat{-webkit-animation-name:fa-beat;animation-name:fa-beat;-webkit-animation-delay:var(--fa-animation-delay,0s);animation-delay:var(--fa-animation-delay,0s);-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s);-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,ease-in-out);animation-timing-function:var(--fa-animation-timing,ease-in-out)}.fa-bounce{-webkit-animation-name:fa-bounce;animation-name:fa-bounce;-webkit-animation-delay:var(--fa-animation-delay,0s);animation-delay:var(--fa-animation-delay,0s);-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s);-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,cubic-bezier(.28,.84,.42,1));animation-timing-function:var(--fa-animation-timing,cubic-bezier(.28,.84,.42,1))}.fa-fade{-webkit-animation-name:fa-fade;animation-name:fa-fade;-webkit-animation-delay:var(--fa-animation-delay,0s);animation-delay:var(--fa-animation-delay,0s);-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s);-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,cubic-bezier(.4,0,.6,1));animation-timing-function:var(--fa-animation-timing,cubic-bezier(.4,0,.6,1))}.fa-beat-fade{-webkit-animation-name:fa-beat-fade;animation-name:fa-beat-fade;-webkit-animation-delay:var(--fa-animation-delay,0s);animation-delay:var(--fa-animation-delay,0s);-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s);-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,cubic-bezier(.4,0,.6,1));animation-timing-function:var(--fa-animation-timing,cubic-bezier(.4,0,.6,1))}.fa-flip{-webkit-animation-name:fa-flip;animation-name:fa-flip;-webkit-animation-delay:var(--fa-animation-delay,0s);animation-delay:var(--fa-animation-delay,0s);-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s);-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,ease-in-out);animation-timing-function:var(--fa-animation-timing,ease-in-out)}.fa-shake{-webkit-animation-name:fa-shake;animation-name:fa-shake;-webkit-animation-delay:var(--fa-animation-delay,0s);animation-delay:var(--fa-animation-delay,0s);-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s);-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,linear);animation-timing-function:var(--fa-animation-timing,linear)}.fa-spin{-webkit-animation-name:fa-spin;animation-name:fa-spin;-webkit-animation-delay:var(--fa-animation-delay,0s);animation-delay:var(--fa-animation-delay,0s);-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:var(--fa-animation-duration,2s);animation-duration:var(--fa-animation-duration,2s);-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,linear);animation-timing-function:var(--fa-animation-timing,linear)}.fa-spin-reverse{--fa-animation-direction:reverse}.fa-pulse,.fa-spin-pulse{-webkit-animation-name:fa-spin;animation-name:fa-spin;-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s);-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,steps(8));animation-timing-function:var(--fa-animation-timing,steps(8))}@media (prefers-reduced-motion:reduce){.fa-beat,.fa-beat-fade,.fa-bounce,.fa-fade,.fa-flip,.fa-pulse,.fa-shake,.fa-spin,.fa-spin-pulse{-webkit-animation-delay:-1ms;animation-delay:-1ms;-webkit-animation-duration:1ms;animation-duration:1ms;-webkit-animation-iteration-count:1;animation-iteration-count:1;-webkit-transition-delay:0s;transition-delay:0s;-webkit-transition-duration:0s;transition-duration:0s}}@-webkit-keyframes fa-beat{0%,90%{-webkit-transform:scale(1);transform:scale(1)}45%{-webkit-transform:scale(var(--fa-beat-scale,1.25));transform:scale(var(--fa-beat-scale,1.25))}}@keyframes fa-beat{0%,90%{-webkit-transform:scale(1);transform:scale(1)}45%{-webkit-transform:scale(var(--fa-beat-scale,1.25));transform:scale(var(--fa-beat-scale,1.25))}}@-webkit-keyframes fa-bounce{0%{-webkit-transform:scale(1,1) translateY(0);transform:scale(1,1) translateY(0)}10%{-webkit-transform:scale(var(--fa-bounce-start-scale-x,1.1),var(--fa-bounce-start-scale-y,.9)) translateY(0);transform:scale(var(--fa-bounce-start-scale-x,1.1),var(--fa-bounce-start-scale-y,.9)) translateY(0)}30%{-webkit-transform:scale(var(--fa-bounce-jump-scale-x,.9),var(--fa-bounce-jump-scale-y,1.1)) translateY(var(--fa-bounce-height,-.5em));transform:scale(var(--fa-bounce-jump-scale-x,.9),var(--fa-bounce-jump-scale-y,1.1)) translateY(var(--fa-bounce-height,-.5em))}50%{-webkit-transform:scale(var(--fa-bounce-land-scale-x,1.05),var(--fa-bounce-land-scale-y,.95)) translateY(0);transform:scale(var(--fa-bounce-land-scale-x,1.05),var(--fa-bounce-land-scale-y,.95)) translateY(0)}57%{-webkit-transform:scale(1,1) translateY(var(--fa-bounce-rebound,-.125em));transform:scale(1,1) translateY(var(--fa-bounce-rebound,-.125em))}64%{-webkit-transform:scale(1,1) translateY(0);transform:scale(1,1) translateY(0)}100%{-webkit-transform:scale(1,1) translateY(0);transform:scale(1,1) translateY(0)}}@keyframes fa-bounce{0%{-webkit-transform:scale(1,1) translateY(0);transform:scale(1,1) translateY(0)}10%{-webkit-transform:scale(var(--fa-bounce-start-scale-x,1.1),var(--fa-bounce-start-scale-y,.9)) translateY(0);transform:scale(var(--fa-bounce-start-scale-x,1.1),var(--fa-bounce-start-scale-y,.9)) translateY(0)}30%{-webkit-transform:scale(var(--fa-bounce-jump-scale-x,.9),var(--fa-bounce-jump-scale-y,1.1)) translateY(var(--fa-bounce-height,-.5em));transform:scale(var(--fa-bounce-jump-scale-x,.9),var(--fa-bounce-jump-scale-y,1.1)) translateY(var(--fa-bounce-height,-.5em))}50%{-webkit-transform:scale(var(--fa-bounce-land-scale-x,1.05),var(--fa-bounce-land-scale-y,.95)) translateY(0);transform:scale(var(--fa-bounce-land-scale-x,1.05),var(--fa-bounce-land-scale-y,.95)) translateY(0)}57%{-webkit-transform:scale(1,1) translateY(var(--fa-bounce-rebound,-.125em));transform:scale(1,1) translateY(var(--fa-bounce-rebound,-.125em))}64%{-webkit-transform:scale(1,1) translateY(0);transform:scale(1,1) translateY(0)}100%{-webkit-transform:scale(1,1) translateY(0);transform:scale(1,1) translateY(0)}}@-webkit-keyframes fa-fade{50%{opacity:var(--fa-fade-opacity,.4)}}@keyframes fa-fade{50%{opacity:var(--fa-fade-opacity,.4)}}@-webkit-keyframes fa-beat-fade{0%,100%{opacity:var(--fa-beat-fade-opacity,.4);-webkit-transform:scale(1);transform:scale(1)}50%{opacity:1;-webkit-transform:scale(var(--fa-beat-fade-scale,1.125));transform:scale(var(--fa-beat-fade-scale,1.125))}}@keyframes fa-beat-fade{0%,100%{opacity:var(--fa-beat-fade-opacity,.4);-webkit-transform:scale(1);transform:scale(1)}50%{opacity:1;-webkit-transform:scale(var(--fa-beat-fade-scale,1.125));transform:scale(var(--fa-beat-fade-scale,1.125))}}@-webkit-keyframes fa-flip{50%{-webkit-transform:rotate3d(var(--fa-flip-x,0),var(--fa-flip-y,1),var(--fa-flip-z,0),var(--fa-flip-angle,-180deg));transform:rotate3d(var(--fa-flip-x,0),var(--fa-flip-y,1),var(--fa-flip-z,0),var(--fa-flip-angle,-180deg))}}@keyframes fa-flip{50%{-webkit-transform:rotate3d(var(--fa-flip-x,0),var(--fa-flip-y,1),var(--fa-flip-z,0),var(--fa-flip-angle,-180deg));transform:rotate3d(var(--fa-flip-x,0),var(--fa-flip-y,1),var(--fa-flip-z,0),var(--fa-flip-angle,-180deg))}}@-webkit-keyframes fa-shake{0%{-webkit-transform:rotate(-15deg);transform:rotate(-15deg)}4%{-webkit-transform:rotate(15deg);transform:rotate(15deg)}24%,8%{-webkit-transform:rotate(-18deg);transform:rotate(-18deg)}12%,28%{-webkit-transform:rotate(18deg);transform:rotate(18deg)}16%{-webkit-transform:rotate(-22deg);transform:rotate(-22deg)}20%{-webkit-transform:rotate(22deg);transform:rotate(22deg)}32%{-webkit-transform:rotate(-12deg);transform:rotate(-12deg)}36%{-webkit-transform:rotate(12deg);transform:rotate(12deg)}100%,40%{-webkit-transform:rotate(0);transform:rotate(0)}}@keyframes fa-shake{0%{-webkit-transform:rotate(-15deg);transform:rotate(-15deg)}4%{-webkit-transform:rotate(15deg);transform:rotate(15deg)}24%,8%{-webkit-transform:rotate(-18deg);transform:rotate(-18deg)}12%,28%{-webkit-transform:rotate(18deg);transform:rotate(18deg)}16%{-webkit-transform:rotate(-22deg);transform:rotate(-22deg)}20%{-webkit-transform:rotate(22deg);transform:rotate(22deg)}32%{-webkit-transform:rotate(-12deg);transform:rotate(-12deg)}36%{-webkit-transform:rotate(12deg);transform:rotate(12deg)}100%,40%{-webkit-transform:rotate(0);transform:rotate(0)}}@-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)}.fa-rotate-by{-webkit-transform:rotate(var(--fa-rotate-angle,none));transform:rotate(var(--fa-rotate-angle,none))}.fa-stack{display:inline-block;vertical-align:middle;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;z-index:var(--fa-stack-z-index,auto)}.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:var(--fa-inverse,#fff)}.fa-sr-only,.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.fa-sr-only-focusable:not(:focus),.sr-only-focusable:not(:focus){position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.svg-inline--fa .fa-primary{fill:var(--fa-primary-color,currentColor);opacity:var(--fa-primary-opacity,1)}.svg-inline--fa .fa-secondary{fill:var(--fa-secondary-color,currentColor);opacity:var(--fa-secondary-opacity,.4)}.svg-inline--fa.fa-swap-opacity .fa-primary{opacity:var(--fa-secondary-opacity,.4)}.svg-inline--fa.fa-swap-opacity .fa-secondary{opacity:var(--fa-primary-opacity,1)}.svg-inline--fa mask .fa-primary,.svg-inline--fa mask .fa-secondary{fill:#000}.fa-duotone.fa-inverse,.fad.fa-inverse{color:var(--fa-inverse,#fff)}";
  545. function css() {
  546. var dcp = DEFAULT_CSS_PREFIX;
  547. var drc = DEFAULT_REPLACEMENT_CLASS;
  548. var fp = config.cssPrefix;
  549. var rc = config.replacementClass;
  550. var s = baseStyles;
  551. if (fp !== dcp || rc !== drc) {
  552. var dPatt = new RegExp("\\.".concat(dcp, "\\-"), 'g');
  553. var customPropPatt = new RegExp("\\--".concat(dcp, "\\-"), 'g');
  554. var rPatt = new RegExp("\\.".concat(drc), 'g');
  555. s = s.replace(dPatt, ".".concat(fp, "-")).replace(customPropPatt, "--".concat(fp, "-")).replace(rPatt, ".".concat(rc));
  556. }
  557. return s;
  558. }
  559. var _cssInserted = false;
  560. function ensureCss() {
  561. if (config.autoAddCss && !_cssInserted) {
  562. insertCss(css());
  563. _cssInserted = true;
  564. }
  565. }
  566. var InjectCSS = {
  567. mixout: function mixout() {
  568. return {
  569. dom: {
  570. css: css,
  571. insertCss: ensureCss
  572. }
  573. };
  574. },
  575. hooks: function hooks() {
  576. return {
  577. beforeDOMElementCreation: function beforeDOMElementCreation() {
  578. ensureCss();
  579. },
  580. beforeI2svg: function beforeI2svg() {
  581. ensureCss();
  582. }
  583. };
  584. }
  585. };
  586. var w = WINDOW || {};
  587. if (!w[NAMESPACE_IDENTIFIER]) w[NAMESPACE_IDENTIFIER] = {};
  588. if (!w[NAMESPACE_IDENTIFIER].styles) w[NAMESPACE_IDENTIFIER].styles = {};
  589. if (!w[NAMESPACE_IDENTIFIER].hooks) w[NAMESPACE_IDENTIFIER].hooks = {};
  590. if (!w[NAMESPACE_IDENTIFIER].shims) w[NAMESPACE_IDENTIFIER].shims = [];
  591. var namespace = w[NAMESPACE_IDENTIFIER];
  592. var functions = [];
  593. var listener = function listener() {
  594. DOCUMENT.removeEventListener('DOMContentLoaded', listener);
  595. loaded = 1;
  596. functions.map(function (fn) {
  597. return fn();
  598. });
  599. };
  600. var loaded = false;
  601. if (IS_DOM) {
  602. loaded = (DOCUMENT.documentElement.doScroll ? /^loaded|^c/ : /^loaded|^i|^c/).test(DOCUMENT.readyState);
  603. if (!loaded) DOCUMENT.addEventListener('DOMContentLoaded', listener);
  604. }
  605. function domready (fn) {
  606. if (!IS_DOM) return;
  607. loaded ? setTimeout(fn, 0) : functions.push(fn);
  608. }
  609. function toHtml(abstractNodes) {
  610. var tag = abstractNodes.tag,
  611. _abstractNodes$attrib = abstractNodes.attributes,
  612. attributes = _abstractNodes$attrib === void 0 ? {} : _abstractNodes$attrib,
  613. _abstractNodes$childr = abstractNodes.children,
  614. children = _abstractNodes$childr === void 0 ? [] : _abstractNodes$childr;
  615. if (typeof abstractNodes === 'string') {
  616. return htmlEscape(abstractNodes);
  617. } else {
  618. return "<".concat(tag, " ").concat(joinAttributes(attributes), ">").concat(children.map(toHtml).join(''), "</").concat(tag, ">");
  619. }
  620. }
  621. function iconFromMapping(mapping, prefix, iconName) {
  622. if (mapping && mapping[prefix] && mapping[prefix][iconName]) {
  623. return {
  624. prefix: prefix,
  625. iconName: iconName,
  626. icon: mapping[prefix][iconName]
  627. };
  628. }
  629. }
  630. /**
  631. * Internal helper to bind a function known to have 4 arguments
  632. * to a given context.
  633. */
  634. var bindInternal4 = function bindInternal4(func, thisContext) {
  635. return function (a, b, c, d) {
  636. return func.call(thisContext, a, b, c, d);
  637. };
  638. };
  639. /**
  640. * # Reduce
  641. *
  642. * A fast object `.reduce()` implementation.
  643. *
  644. * @param {Object} subject The object to reduce over.
  645. * @param {Function} fn The reducer function.
  646. * @param {mixed} initialValue The initial value for the reducer, defaults to subject[0].
  647. * @param {Object} thisContext The context for the reducer.
  648. * @return {mixed} The final result.
  649. */
  650. var reduce = function fastReduceObject(subject, fn, initialValue, thisContext) {
  651. var keys = Object.keys(subject),
  652. length = keys.length,
  653. iterator = thisContext !== undefined ? bindInternal4(fn, thisContext) : fn,
  654. i,
  655. key,
  656. result;
  657. if (initialValue === undefined) {
  658. i = 1;
  659. result = subject[keys[0]];
  660. } else {
  661. i = 0;
  662. result = initialValue;
  663. }
  664. for (; i < length; i++) {
  665. key = keys[i];
  666. result = iterator(result, subject[key], key, subject);
  667. }
  668. return result;
  669. };
  670. /**
  671. * ucs2decode() and codePointAt() are both works of Mathias Bynens and licensed under MIT
  672. *
  673. * Copyright Mathias Bynens <https://mathiasbynens.be/>
  674. * Permission is hereby granted, free of charge, to any person obtaining
  675. * a copy of this software and associated documentation files (the
  676. * "Software"), to deal in the Software without restriction, including
  677. * without limitation the rights to use, copy, modify, merge, publish,
  678. * distribute, sublicense, and/or sell copies of the Software, and to
  679. * permit persons to whom the Software is furnished to do so, subject to
  680. * the following conditions:
  681. * The above copyright notice and this permission notice shall be
  682. * included in all copies or substantial portions of the Software.
  683. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  684. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  685. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  686. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  687. * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  688. * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  689. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  690. */
  691. function ucs2decode(string) {
  692. var output = [];
  693. var counter = 0;
  694. var length = string.length;
  695. while (counter < length) {
  696. var value = string.charCodeAt(counter++);
  697. if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
  698. var extra = string.charCodeAt(counter++);
  699. if ((extra & 0xFC00) == 0xDC00) {
  700. // eslint-disable-line eqeqeq
  701. output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
  702. } else {
  703. output.push(value);
  704. counter--;
  705. }
  706. } else {
  707. output.push(value);
  708. }
  709. }
  710. return output;
  711. }
  712. function toHex(unicode) {
  713. var decoded = ucs2decode(unicode);
  714. return decoded.length === 1 ? decoded[0].toString(16) : null;
  715. }
  716. function codePointAt(string, index) {
  717. var size = string.length;
  718. var first = string.charCodeAt(index);
  719. var second;
  720. if (first >= 0xD800 && first <= 0xDBFF && size > index + 1) {
  721. second = string.charCodeAt(index + 1);
  722. if (second >= 0xDC00 && second <= 0xDFFF) {
  723. return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
  724. }
  725. }
  726. return first;
  727. }
  728. function normalizeIcons(icons) {
  729. return Object.keys(icons).reduce(function (acc, iconName) {
  730. var icon = icons[iconName];
  731. var expanded = !!icon.icon;
  732. if (expanded) {
  733. acc[icon.iconName] = icon.icon;
  734. } else {
  735. acc[iconName] = icon;
  736. }
  737. return acc;
  738. }, {});
  739. }
  740. function defineIcons(prefix, icons) {
  741. var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  742. var _params$skipHooks = params.skipHooks,
  743. skipHooks = _params$skipHooks === void 0 ? false : _params$skipHooks;
  744. var normalized = normalizeIcons(icons);
  745. if (typeof namespace.hooks.addPack === 'function' && !skipHooks) {
  746. namespace.hooks.addPack(prefix, normalizeIcons(icons));
  747. } else {
  748. namespace.styles[prefix] = _objectSpread2(_objectSpread2({}, namespace.styles[prefix] || {}), normalized);
  749. }
  750. /**
  751. * Font Awesome 4 used the prefix of `fa` for all icons. With the introduction
  752. * of new styles we needed to differentiate between them. Prefix `fa` is now an alias
  753. * for `fas` so we'll ease the upgrade process for our users by automatically defining
  754. * this as well.
  755. */
  756. if (prefix === 'fas') {
  757. defineIcons('fa', icons);
  758. }
  759. }
  760. var duotonePathRe = [/*#__PURE__*/_wrapRegExp(/path d="((?:(?!")[\s\S])+)".*path d="((?:(?!")[\s\S])+)"/, {
  761. d1: 1,
  762. d2: 2
  763. }), /*#__PURE__*/_wrapRegExp(/path class="((?:(?!")[\s\S])+)".*d="((?:(?!")[\s\S])+)".*path class="((?:(?!")[\s\S])+)".*d="((?:(?!")[\s\S])+)"/, {
  764. cls1: 1,
  765. d1: 2,
  766. cls2: 3,
  767. d2: 4
  768. }), /*#__PURE__*/_wrapRegExp(/path class="((?:(?!")[\s\S])+)".*d="((?:(?!")[\s\S])+)"/, {
  769. cls1: 1,
  770. d1: 2
  771. })];
  772. var _LONG_STYLE, _PREFIXES, _PREFIXES_FOR_FAMILY;
  773. var styles = namespace.styles,
  774. shims = namespace.shims;
  775. var LONG_STYLE = (_LONG_STYLE = {}, _defineProperty(_LONG_STYLE, FAMILY_CLASSIC, Object.values(PREFIX_TO_LONG_STYLE[FAMILY_CLASSIC])), _defineProperty(_LONG_STYLE, FAMILY_SHARP, Object.values(PREFIX_TO_LONG_STYLE[FAMILY_SHARP])), _LONG_STYLE);
  776. var _defaultUsablePrefix = null;
  777. var _byUnicode = {};
  778. var _byLigature = {};
  779. var _byOldName = {};
  780. var _byOldUnicode = {};
  781. var _byAlias = {};
  782. var PREFIXES = (_PREFIXES = {}, _defineProperty(_PREFIXES, FAMILY_CLASSIC, Object.keys(PREFIX_TO_STYLE[FAMILY_CLASSIC])), _defineProperty(_PREFIXES, FAMILY_SHARP, Object.keys(PREFIX_TO_STYLE[FAMILY_SHARP])), _PREFIXES);
  783. function isReserved(name) {
  784. return ~RESERVED_CLASSES.indexOf(name);
  785. }
  786. function getIconName(cssPrefix, cls) {
  787. var parts = cls.split('-');
  788. var prefix = parts[0];
  789. var iconName = parts.slice(1).join('-');
  790. if (prefix === cssPrefix && iconName !== '' && !isReserved(iconName)) {
  791. return iconName;
  792. } else {
  793. return null;
  794. }
  795. }
  796. var build = function build() {
  797. var lookup = function lookup(reducer) {
  798. return reduce(styles, function (o, style, prefix) {
  799. o[prefix] = reduce(style, reducer, {});
  800. return o;
  801. }, {});
  802. };
  803. _byUnicode = lookup(function (acc, icon, iconName) {
  804. if (icon[3]) {
  805. acc[icon[3]] = iconName;
  806. }
  807. if (icon[2]) {
  808. var aliases = icon[2].filter(function (a) {
  809. return typeof a === 'number';
  810. });
  811. aliases.forEach(function (alias) {
  812. acc[alias.toString(16)] = iconName;
  813. });
  814. }
  815. return acc;
  816. });
  817. _byLigature = lookup(function (acc, icon, iconName) {
  818. acc[iconName] = iconName;
  819. if (icon[2]) {
  820. var aliases = icon[2].filter(function (a) {
  821. return typeof a === 'string';
  822. });
  823. aliases.forEach(function (alias) {
  824. acc[alias] = iconName;
  825. });
  826. }
  827. return acc;
  828. });
  829. _byAlias = lookup(function (acc, icon, iconName) {
  830. var aliases = icon[2];
  831. acc[iconName] = iconName;
  832. aliases.forEach(function (alias) {
  833. acc[alias] = iconName;
  834. });
  835. return acc;
  836. }); // If we have a Kit, we can't determine if regular is available since we
  837. // could be auto-fetching it. We'll have to assume that it is available.
  838. var hasRegular = 'far' in styles || config.autoFetchSvg;
  839. var shimLookups = reduce(shims, function (acc, shim) {
  840. var maybeNameMaybeUnicode = shim[0];
  841. var prefix = shim[1];
  842. var iconName = shim[2];
  843. if (prefix === 'far' && !hasRegular) {
  844. prefix = 'fas';
  845. }
  846. if (typeof maybeNameMaybeUnicode === 'string') {
  847. acc.names[maybeNameMaybeUnicode] = {
  848. prefix: prefix,
  849. iconName: iconName
  850. };
  851. }
  852. if (typeof maybeNameMaybeUnicode === 'number') {
  853. acc.unicodes[maybeNameMaybeUnicode.toString(16)] = {
  854. prefix: prefix,
  855. iconName: iconName
  856. };
  857. }
  858. return acc;
  859. }, {
  860. names: {},
  861. unicodes: {}
  862. });
  863. _byOldName = shimLookups.names;
  864. _byOldUnicode = shimLookups.unicodes;
  865. _defaultUsablePrefix = getCanonicalPrefix(config.styleDefault, {
  866. family: config.familyDefault
  867. });
  868. };
  869. onChange(function (c) {
  870. _defaultUsablePrefix = getCanonicalPrefix(c.styleDefault, {
  871. family: config.familyDefault
  872. });
  873. });
  874. build();
  875. function byUnicode(prefix, unicode) {
  876. return (_byUnicode[prefix] || {})[unicode];
  877. }
  878. function byLigature(prefix, ligature) {
  879. return (_byLigature[prefix] || {})[ligature];
  880. }
  881. function byAlias(prefix, alias) {
  882. return (_byAlias[prefix] || {})[alias];
  883. }
  884. function byOldName(name) {
  885. return _byOldName[name] || {
  886. prefix: null,
  887. iconName: null
  888. };
  889. }
  890. function byOldUnicode(unicode) {
  891. var oldUnicode = _byOldUnicode[unicode];
  892. var newUnicode = byUnicode('fas', unicode);
  893. return oldUnicode || (newUnicode ? {
  894. prefix: 'fas',
  895. iconName: newUnicode
  896. } : null) || {
  897. prefix: null,
  898. iconName: null
  899. };
  900. }
  901. function getDefaultUsablePrefix() {
  902. return _defaultUsablePrefix;
  903. }
  904. var emptyCanonicalIcon = function emptyCanonicalIcon() {
  905. return {
  906. prefix: null,
  907. iconName: null,
  908. rest: []
  909. };
  910. };
  911. function getCanonicalPrefix(styleOrPrefix) {
  912. var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  913. var _params$family = params.family,
  914. family = _params$family === void 0 ? FAMILY_CLASSIC : _params$family;
  915. var style = PREFIX_TO_STYLE[family][styleOrPrefix];
  916. var prefix = STYLE_TO_PREFIX[family][styleOrPrefix] || STYLE_TO_PREFIX[family][style];
  917. var defined = styleOrPrefix in namespace.styles ? styleOrPrefix : null;
  918. return prefix || defined || null;
  919. }
  920. var PREFIXES_FOR_FAMILY = (_PREFIXES_FOR_FAMILY = {}, _defineProperty(_PREFIXES_FOR_FAMILY, FAMILY_CLASSIC, Object.keys(PREFIX_TO_LONG_STYLE[FAMILY_CLASSIC])), _defineProperty(_PREFIXES_FOR_FAMILY, FAMILY_SHARP, Object.keys(PREFIX_TO_LONG_STYLE[FAMILY_SHARP])), _PREFIXES_FOR_FAMILY);
  921. function getCanonicalIcon(values) {
  922. var _famProps;
  923. var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  924. var _params$skipLookups = params.skipLookups,
  925. skipLookups = _params$skipLookups === void 0 ? false : _params$skipLookups;
  926. var famProps = (_famProps = {}, _defineProperty(_famProps, FAMILY_CLASSIC, "".concat(config.cssPrefix, "-").concat(FAMILY_CLASSIC)), _defineProperty(_famProps, FAMILY_SHARP, "".concat(config.cssPrefix, "-").concat(FAMILY_SHARP)), _famProps);
  927. var givenPrefix = null;
  928. var family = FAMILY_CLASSIC;
  929. if (values.includes(famProps[FAMILY_CLASSIC]) || values.some(function (v) {
  930. return PREFIXES_FOR_FAMILY[FAMILY_CLASSIC].includes(v);
  931. })) {
  932. family = FAMILY_CLASSIC;
  933. }
  934. if (values.includes(famProps[FAMILY_SHARP]) || values.some(function (v) {
  935. return PREFIXES_FOR_FAMILY[FAMILY_SHARP].includes(v);
  936. })) {
  937. family = FAMILY_SHARP;
  938. }
  939. var canonical = values.reduce(function (acc, cls) {
  940. var iconName = getIconName(config.cssPrefix, cls);
  941. if (styles[cls]) {
  942. cls = LONG_STYLE[family].includes(cls) ? LONG_STYLE_TO_PREFIX[family][cls] : cls;
  943. givenPrefix = cls;
  944. acc.prefix = cls;
  945. } else if (PREFIXES[family].indexOf(cls) > -1) {
  946. givenPrefix = cls;
  947. acc.prefix = getCanonicalPrefix(cls, {
  948. family: family
  949. });
  950. } else if (iconName) {
  951. acc.iconName = iconName;
  952. } else if (cls !== config.replacementClass && cls !== famProps[FAMILY_CLASSIC] && cls !== famProps[FAMILY_SHARP]) {
  953. acc.rest.push(cls);
  954. }
  955. if (!skipLookups && acc.prefix && acc.iconName) {
  956. var shim = givenPrefix === 'fa' ? byOldName(acc.iconName) : {};
  957. var aliasIconName = byAlias(acc.prefix, acc.iconName);
  958. if (shim.prefix) {
  959. givenPrefix = null;
  960. }
  961. acc.iconName = shim.iconName || aliasIconName || acc.iconName;
  962. acc.prefix = shim.prefix || acc.prefix;
  963. if (acc.prefix === 'far' && !styles['far'] && styles['fas'] && !config.autoFetchSvg) {
  964. // Allow a fallback from the regular style to solid if regular is not available
  965. // but only if we aren't auto-fetching SVGs
  966. acc.prefix = 'fas';
  967. }
  968. }
  969. return acc;
  970. }, emptyCanonicalIcon());
  971. if (values.includes('fa-brands') || values.includes('fab')) {
  972. canonical.prefix = 'fab';
  973. }
  974. if (values.includes('fa-duotone') || values.includes('fad')) {
  975. canonical.prefix = 'fad';
  976. }
  977. if (!canonical.prefix && family === FAMILY_SHARP && (styles['fass'] || config.autoFetchSvg)) {
  978. canonical.prefix = 'fass';
  979. canonical.iconName = byAlias(canonical.prefix, canonical.iconName) || canonical.iconName;
  980. }
  981. if (canonical.prefix === 'fa' || givenPrefix === 'fa') {
  982. // The fa prefix is not canonical. So if it has made it through until this point
  983. // we will shift it to the correct prefix.
  984. canonical.prefix = getDefaultUsablePrefix() || 'fas';
  985. }
  986. return canonical;
  987. }
  988. var Library = /*#__PURE__*/function () {
  989. function Library() {
  990. _classCallCheck(this, Library);
  991. this.definitions = {};
  992. }
  993. _createClass(Library, [{
  994. key: "add",
  995. value: function add() {
  996. var _this = this;
  997. for (var _len = arguments.length, definitions = new Array(_len), _key = 0; _key < _len; _key++) {
  998. definitions[_key] = arguments[_key];
  999. }
  1000. var additions = definitions.reduce(this._pullDefinitions, {});
  1001. Object.keys(additions).forEach(function (key) {
  1002. _this.definitions[key] = _objectSpread2(_objectSpread2({}, _this.definitions[key] || {}), additions[key]);
  1003. defineIcons(key, additions[key]); // TODO can we stop doing this? We can't get the icons by 'fa-solid' any longer so this probably needs to change
  1004. var longPrefix = PREFIX_TO_LONG_STYLE[FAMILY_CLASSIC][key];
  1005. if (longPrefix) defineIcons(longPrefix, additions[key]);
  1006. build();
  1007. });
  1008. }
  1009. }, {
  1010. key: "reset",
  1011. value: function reset() {
  1012. this.definitions = {};
  1013. }
  1014. }, {
  1015. key: "_pullDefinitions",
  1016. value: function _pullDefinitions(additions, definition) {
  1017. var normalized = definition.prefix && definition.iconName && definition.icon ? {
  1018. 0: definition
  1019. } : definition;
  1020. Object.keys(normalized).map(function (key) {
  1021. var _normalized$key = normalized[key],
  1022. prefix = _normalized$key.prefix,
  1023. iconName = _normalized$key.iconName,
  1024. icon = _normalized$key.icon;
  1025. var aliases = icon[2];
  1026. if (!additions[prefix]) additions[prefix] = {};
  1027. if (aliases.length > 0) {
  1028. aliases.forEach(function (alias) {
  1029. if (typeof alias === 'string') {
  1030. additions[prefix][alias] = icon;
  1031. }
  1032. });
  1033. }
  1034. additions[prefix][iconName] = icon;
  1035. });
  1036. return additions;
  1037. }
  1038. }]);
  1039. return Library;
  1040. }();
  1041. var _plugins = [];
  1042. var _hooks = {};
  1043. var providers = {};
  1044. var defaultProviderKeys = Object.keys(providers);
  1045. function registerPlugins(nextPlugins, _ref) {
  1046. var obj = _ref.mixoutsTo;
  1047. _plugins = nextPlugins;
  1048. _hooks = {};
  1049. Object.keys(providers).forEach(function (k) {
  1050. if (defaultProviderKeys.indexOf(k) === -1) {
  1051. delete providers[k];
  1052. }
  1053. });
  1054. _plugins.forEach(function (plugin) {
  1055. var mixout = plugin.mixout ? plugin.mixout() : {};
  1056. Object.keys(mixout).forEach(function (tk) {
  1057. if (typeof mixout[tk] === 'function') {
  1058. obj[tk] = mixout[tk];
  1059. }
  1060. if (_typeof(mixout[tk]) === 'object') {
  1061. Object.keys(mixout[tk]).forEach(function (sk) {
  1062. if (!obj[tk]) {
  1063. obj[tk] = {};
  1064. }
  1065. obj[tk][sk] = mixout[tk][sk];
  1066. });
  1067. }
  1068. });
  1069. if (plugin.hooks) {
  1070. var hooks = plugin.hooks();
  1071. Object.keys(hooks).forEach(function (hook) {
  1072. if (!_hooks[hook]) {
  1073. _hooks[hook] = [];
  1074. }
  1075. _hooks[hook].push(hooks[hook]);
  1076. });
  1077. }
  1078. if (plugin.provides) {
  1079. plugin.provides(providers);
  1080. }
  1081. });
  1082. return obj;
  1083. }
  1084. function chainHooks(hook, accumulator) {
  1085. for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
  1086. args[_key - 2] = arguments[_key];
  1087. }
  1088. var hookFns = _hooks[hook] || [];
  1089. hookFns.forEach(function (hookFn) {
  1090. accumulator = hookFn.apply(null, [accumulator].concat(args)); // eslint-disable-line no-useless-call
  1091. });
  1092. return accumulator;
  1093. }
  1094. function callHooks(hook) {
  1095. for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  1096. args[_key2 - 1] = arguments[_key2];
  1097. }
  1098. var hookFns = _hooks[hook] || [];
  1099. hookFns.forEach(function (hookFn) {
  1100. hookFn.apply(null, args);
  1101. });
  1102. return undefined;
  1103. }
  1104. function callProvided() {
  1105. var hook = arguments[0];
  1106. var args = Array.prototype.slice.call(arguments, 1);
  1107. return providers[hook] ? providers[hook].apply(null, args) : undefined;
  1108. }
  1109. function findIconDefinition(iconLookup) {
  1110. if (iconLookup.prefix === 'fa') {
  1111. iconLookup.prefix = 'fas';
  1112. }
  1113. var iconName = iconLookup.iconName;
  1114. var prefix = iconLookup.prefix || getDefaultUsablePrefix();
  1115. if (!iconName) return;
  1116. iconName = byAlias(prefix, iconName) || iconName;
  1117. return iconFromMapping(library.definitions, prefix, iconName) || iconFromMapping(namespace.styles, prefix, iconName);
  1118. }
  1119. var library = new Library();
  1120. var noAuto = function noAuto() {
  1121. config.autoReplaceSvg = false;
  1122. config.observeMutations = false;
  1123. callHooks('noAuto');
  1124. };
  1125. var dom = {
  1126. i2svg: function i2svg() {
  1127. var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1128. if (IS_DOM) {
  1129. callHooks('beforeI2svg', params);
  1130. callProvided('pseudoElements2svg', params);
  1131. return callProvided('i2svg', params);
  1132. } else {
  1133. return Promise.reject('Operation requires a DOM of some kind.');
  1134. }
  1135. },
  1136. watch: function watch() {
  1137. var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1138. var autoReplaceSvgRoot = params.autoReplaceSvgRoot;
  1139. if (config.autoReplaceSvg === false) {
  1140. config.autoReplaceSvg = true;
  1141. }
  1142. config.observeMutations = true;
  1143. domready(function () {
  1144. autoReplace({
  1145. autoReplaceSvgRoot: autoReplaceSvgRoot
  1146. });
  1147. callHooks('watch', params);
  1148. });
  1149. }
  1150. };
  1151. var parse = {
  1152. icon: function icon(_icon) {
  1153. if (_icon === null) {
  1154. return null;
  1155. }
  1156. if (_typeof(_icon) === 'object' && _icon.prefix && _icon.iconName) {
  1157. return {
  1158. prefix: _icon.prefix,
  1159. iconName: byAlias(_icon.prefix, _icon.iconName) || _icon.iconName
  1160. };
  1161. }
  1162. if (Array.isArray(_icon) && _icon.length === 2) {
  1163. var iconName = _icon[1].indexOf('fa-') === 0 ? _icon[1].slice(3) : _icon[1];
  1164. var prefix = getCanonicalPrefix(_icon[0]);
  1165. return {
  1166. prefix: prefix,
  1167. iconName: byAlias(prefix, iconName) || iconName
  1168. };
  1169. }
  1170. if (typeof _icon === 'string' && (_icon.indexOf("".concat(config.cssPrefix, "-")) > -1 || _icon.match(ICON_SELECTION_SYNTAX_PATTERN))) {
  1171. var canonicalIcon = getCanonicalIcon(_icon.split(' '), {
  1172. skipLookups: true
  1173. });
  1174. return {
  1175. prefix: canonicalIcon.prefix || getDefaultUsablePrefix(),
  1176. iconName: byAlias(canonicalIcon.prefix, canonicalIcon.iconName) || canonicalIcon.iconName
  1177. };
  1178. }
  1179. if (typeof _icon === 'string') {
  1180. var _prefix = getDefaultUsablePrefix();
  1181. return {
  1182. prefix: _prefix,
  1183. iconName: byAlias(_prefix, _icon) || _icon
  1184. };
  1185. }
  1186. }
  1187. };
  1188. var api = {
  1189. noAuto: noAuto,
  1190. config: config,
  1191. dom: dom,
  1192. parse: parse,
  1193. library: library,
  1194. findIconDefinition: findIconDefinition,
  1195. toHtml: toHtml
  1196. };
  1197. var autoReplace = function autoReplace() {
  1198. var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1199. var _params$autoReplaceSv = params.autoReplaceSvgRoot,
  1200. autoReplaceSvgRoot = _params$autoReplaceSv === void 0 ? DOCUMENT : _params$autoReplaceSv;
  1201. if ((Object.keys(namespace.styles).length > 0 || config.autoFetchSvg) && IS_DOM && config.autoReplaceSvg) api.dom.i2svg({
  1202. node: autoReplaceSvgRoot
  1203. });
  1204. };
  1205. function bootstrap(plugins) {
  1206. if (IS_BROWSER) {
  1207. if (!WINDOW.FontAwesome) {
  1208. WINDOW.FontAwesome = api;
  1209. }
  1210. domready(function () {
  1211. autoReplace();
  1212. callHooks('bootstrap');
  1213. });
  1214. }
  1215. namespace.hooks = _objectSpread2(_objectSpread2({}, namespace.hooks), {}, {
  1216. addPack: function addPack(prefix, icons) {
  1217. namespace.styles[prefix] = _objectSpread2(_objectSpread2({}, namespace.styles[prefix] || {}), icons);
  1218. build();
  1219. autoReplace();
  1220. },
  1221. addPacks: function addPacks(packs) {
  1222. packs.forEach(function (_ref) {
  1223. var _ref2 = _slicedToArray(_ref, 2),
  1224. prefix = _ref2[0],
  1225. icons = _ref2[1];
  1226. namespace.styles[prefix] = _objectSpread2(_objectSpread2({}, namespace.styles[prefix] || {}), icons);
  1227. });
  1228. build();
  1229. autoReplace();
  1230. },
  1231. addShims: function addShims(shims) {
  1232. var _namespace$shims;
  1233. (_namespace$shims = namespace.shims).push.apply(_namespace$shims, _toConsumableArray(shims));
  1234. build();
  1235. autoReplace();
  1236. }
  1237. });
  1238. }
  1239. function domVariants(val, abstractCreator) {
  1240. Object.defineProperty(val, 'abstract', {
  1241. get: abstractCreator
  1242. });
  1243. Object.defineProperty(val, 'html', {
  1244. get: function get() {
  1245. return val.abstract.map(function (a) {
  1246. return toHtml(a);
  1247. });
  1248. }
  1249. });
  1250. Object.defineProperty(val, 'node', {
  1251. get: function get() {
  1252. if (!IS_DOM) return;
  1253. var container = DOCUMENT.createElement('div');
  1254. container.innerHTML = val.html;
  1255. return container.children;
  1256. }
  1257. });
  1258. return val;
  1259. }
  1260. function asIcon (_ref) {
  1261. var children = _ref.children,
  1262. main = _ref.main,
  1263. mask = _ref.mask,
  1264. attributes = _ref.attributes,
  1265. styles = _ref.styles,
  1266. transform = _ref.transform;
  1267. if (transformIsMeaningful(transform) && main.found && !mask.found) {
  1268. var width = main.width,
  1269. height = main.height;
  1270. var offset = {
  1271. x: width / height / 2,
  1272. y: 0.5
  1273. };
  1274. attributes['style'] = joinStyles(_objectSpread2(_objectSpread2({}, styles), {}, {
  1275. 'transform-origin': "".concat(offset.x + transform.x / 16, "em ").concat(offset.y + transform.y / 16, "em")
  1276. }));
  1277. }
  1278. return [{
  1279. tag: 'svg',
  1280. attributes: attributes,
  1281. children: children
  1282. }];
  1283. }
  1284. function asSymbol (_ref) {
  1285. var prefix = _ref.prefix,
  1286. iconName = _ref.iconName,
  1287. children = _ref.children,
  1288. attributes = _ref.attributes,
  1289. symbol = _ref.symbol;
  1290. var id = symbol === true ? "".concat(prefix, "-").concat(config.cssPrefix, "-").concat(iconName) : symbol;
  1291. return [{
  1292. tag: 'svg',
  1293. attributes: {
  1294. style: 'display: none;'
  1295. },
  1296. children: [{
  1297. tag: 'symbol',
  1298. attributes: _objectSpread2(_objectSpread2({}, attributes), {}, {
  1299. id: id
  1300. }),
  1301. children: children
  1302. }]
  1303. }];
  1304. }
  1305. function makeInlineSvgAbstract(params) {
  1306. var _params$icons = params.icons,
  1307. main = _params$icons.main,
  1308. mask = _params$icons.mask,
  1309. prefix = params.prefix,
  1310. iconName = params.iconName,
  1311. transform = params.transform,
  1312. symbol = params.symbol,
  1313. title = params.title,
  1314. maskId = params.maskId,
  1315. titleId = params.titleId,
  1316. extra = params.extra,
  1317. _params$watchable = params.watchable,
  1318. watchable = _params$watchable === void 0 ? false : _params$watchable;
  1319. var _ref = mask.found ? mask : main,
  1320. width = _ref.width,
  1321. height = _ref.height;
  1322. var isUploadedIcon = prefix === 'fak';
  1323. var attrClass = [config.replacementClass, iconName ? "".concat(config.cssPrefix, "-").concat(iconName) : ''].filter(function (c) {
  1324. return extra.classes.indexOf(c) === -1;
  1325. }).filter(function (c) {
  1326. return c !== '' || !!c;
  1327. }).concat(extra.classes).join(' ');
  1328. var content = {
  1329. children: [],
  1330. attributes: _objectSpread2(_objectSpread2({}, extra.attributes), {}, {
  1331. 'data-prefix': prefix,
  1332. 'data-icon': iconName,
  1333. 'class': attrClass,
  1334. 'role': extra.attributes.role || 'img',
  1335. 'xmlns': 'http://www.w3.org/2000/svg',
  1336. 'viewBox': "0 0 ".concat(width, " ").concat(height)
  1337. })
  1338. };
  1339. var uploadedIconWidthStyle = isUploadedIcon && !~extra.classes.indexOf('fa-fw') ? {
  1340. width: "".concat(width / height * 16 * 0.0625, "em")
  1341. } : {};
  1342. if (watchable) {
  1343. content.attributes[DATA_FA_I2SVG] = '';
  1344. }
  1345. if (title) {
  1346. content.children.push({
  1347. tag: 'title',
  1348. attributes: {
  1349. id: content.attributes['aria-labelledby'] || "title-".concat(titleId || nextUniqueId())
  1350. },
  1351. children: [title]
  1352. });
  1353. delete content.attributes.title;
  1354. }
  1355. var args = _objectSpread2(_objectSpread2({}, content), {}, {
  1356. prefix: prefix,
  1357. iconName: iconName,
  1358. main: main,
  1359. mask: mask,
  1360. maskId: maskId,
  1361. transform: transform,
  1362. symbol: symbol,
  1363. styles: _objectSpread2(_objectSpread2({}, uploadedIconWidthStyle), extra.styles)
  1364. });
  1365. var _ref2 = mask.found && main.found ? callProvided('generateAbstractMask', args) || {
  1366. children: [],
  1367. attributes: {}
  1368. } : callProvided('generateAbstractIcon', args) || {
  1369. children: [],
  1370. attributes: {}
  1371. },
  1372. children = _ref2.children,
  1373. attributes = _ref2.attributes;
  1374. args.children = children;
  1375. args.attributes = attributes;
  1376. if (symbol) {
  1377. return asSymbol(args);
  1378. } else {
  1379. return asIcon(args);
  1380. }
  1381. }
  1382. function makeLayersTextAbstract(params) {
  1383. var content = params.content,
  1384. width = params.width,
  1385. height = params.height,
  1386. transform = params.transform,
  1387. title = params.title,
  1388. extra = params.extra,
  1389. _params$watchable2 = params.watchable,
  1390. watchable = _params$watchable2 === void 0 ? false : _params$watchable2;
  1391. var attributes = _objectSpread2(_objectSpread2(_objectSpread2({}, extra.attributes), title ? {
  1392. 'title': title
  1393. } : {}), {}, {
  1394. 'class': extra.classes.join(' ')
  1395. });
  1396. if (watchable) {
  1397. attributes[DATA_FA_I2SVG] = '';
  1398. }
  1399. var styles = _objectSpread2({}, extra.styles);
  1400. if (transformIsMeaningful(transform)) {
  1401. styles['transform'] = transformForCss({
  1402. transform: transform,
  1403. startCentered: true,
  1404. width: width,
  1405. height: height
  1406. });
  1407. styles['-webkit-transform'] = styles['transform'];
  1408. }
  1409. var styleString = joinStyles(styles);
  1410. if (styleString.length > 0) {
  1411. attributes['style'] = styleString;
  1412. }
  1413. var val = [];
  1414. val.push({
  1415. tag: 'span',
  1416. attributes: attributes,
  1417. children: [content]
  1418. });
  1419. if (title) {
  1420. val.push({
  1421. tag: 'span',
  1422. attributes: {
  1423. class: 'sr-only'
  1424. },
  1425. children: [title]
  1426. });
  1427. }
  1428. return val;
  1429. }
  1430. function makeLayersCounterAbstract(params) {
  1431. var content = params.content,
  1432. title = params.title,
  1433. extra = params.extra;
  1434. var attributes = _objectSpread2(_objectSpread2(_objectSpread2({}, extra.attributes), title ? {
  1435. 'title': title
  1436. } : {}), {}, {
  1437. 'class': extra.classes.join(' ')
  1438. });
  1439. var styleString = joinStyles(extra.styles);
  1440. if (styleString.length > 0) {
  1441. attributes['style'] = styleString;
  1442. }
  1443. var val = [];
  1444. val.push({
  1445. tag: 'span',
  1446. attributes: attributes,
  1447. children: [content]
  1448. });
  1449. if (title) {
  1450. val.push({
  1451. tag: 'span',
  1452. attributes: {
  1453. class: 'sr-only'
  1454. },
  1455. children: [title]
  1456. });
  1457. }
  1458. return val;
  1459. }
  1460. var styles$1 = namespace.styles;
  1461. function asFoundIcon(icon) {
  1462. var width = icon[0];
  1463. var height = icon[1];
  1464. var _icon$slice = icon.slice(4),
  1465. _icon$slice2 = _slicedToArray(_icon$slice, 1),
  1466. vectorData = _icon$slice2[0];
  1467. var element = null;
  1468. if (Array.isArray(vectorData)) {
  1469. element = {
  1470. tag: 'g',
  1471. attributes: {
  1472. class: "".concat(config.cssPrefix, "-").concat(DUOTONE_CLASSES.GROUP)
  1473. },
  1474. children: [{
  1475. tag: 'path',
  1476. attributes: {
  1477. class: "".concat(config.cssPrefix, "-").concat(DUOTONE_CLASSES.SECONDARY),
  1478. fill: 'currentColor',
  1479. d: vectorData[0]
  1480. }
  1481. }, {
  1482. tag: 'path',
  1483. attributes: {
  1484. class: "".concat(config.cssPrefix, "-").concat(DUOTONE_CLASSES.PRIMARY),
  1485. fill: 'currentColor',
  1486. d: vectorData[1]
  1487. }
  1488. }]
  1489. };
  1490. } else {
  1491. element = {
  1492. tag: 'path',
  1493. attributes: {
  1494. fill: 'currentColor',
  1495. d: vectorData
  1496. }
  1497. };
  1498. }
  1499. return {
  1500. found: true,
  1501. width: width,
  1502. height: height,
  1503. icon: element
  1504. };
  1505. }
  1506. var missingIconResolutionMixin = {
  1507. found: false,
  1508. width: 512,
  1509. height: 512
  1510. };
  1511. function maybeNotifyMissing(iconName, prefix) {
  1512. if (!PRODUCTION && !config.showMissingIcons && iconName) {
  1513. console.error("Icon with name \"".concat(iconName, "\" and prefix \"").concat(prefix, "\" is missing."));
  1514. }
  1515. }
  1516. function findIcon(iconName, prefix) {
  1517. var givenPrefix = prefix;
  1518. if (prefix === 'fa' && config.styleDefault !== null) {
  1519. prefix = getDefaultUsablePrefix();
  1520. }
  1521. return new Promise(function (resolve, reject) {
  1522. var val = {
  1523. found: false,
  1524. width: 512,
  1525. height: 512,
  1526. icon: callProvided('missingIconAbstract') || {}
  1527. };
  1528. if (givenPrefix === 'fa') {
  1529. var shim = byOldName(iconName) || {};
  1530. iconName = shim.iconName || iconName;
  1531. prefix = shim.prefix || prefix;
  1532. }
  1533. if (iconName && prefix && styles$1[prefix] && styles$1[prefix][iconName]) {
  1534. var icon = styles$1[prefix][iconName];
  1535. return resolve(asFoundIcon(icon));
  1536. }
  1537. maybeNotifyMissing(iconName, prefix);
  1538. resolve(_objectSpread2(_objectSpread2({}, missingIconResolutionMixin), {}, {
  1539. icon: config.showMissingIcons && iconName ? callProvided('missingIconAbstract') || {} : {}
  1540. }));
  1541. });
  1542. }
  1543. var noop$1 = function noop() {};
  1544. var p = config.measurePerformance && PERFORMANCE && PERFORMANCE.mark && PERFORMANCE.measure ? PERFORMANCE : {
  1545. mark: noop$1,
  1546. measure: noop$1
  1547. };
  1548. var preamble = "FA \"6.4.0\"";
  1549. var begin = function begin(name) {
  1550. p.mark("".concat(preamble, " ").concat(name, " begins"));
  1551. return function () {
  1552. return end(name);
  1553. };
  1554. };
  1555. var end = function end(name) {
  1556. p.mark("".concat(preamble, " ").concat(name, " ends"));
  1557. p.measure("".concat(preamble, " ").concat(name), "".concat(preamble, " ").concat(name, " begins"), "".concat(preamble, " ").concat(name, " ends"));
  1558. };
  1559. var perf = {
  1560. begin: begin,
  1561. end: end
  1562. };
  1563. var noop$2 = function noop() {};
  1564. function isWatched(node) {
  1565. var i2svg = node.getAttribute ? node.getAttribute(DATA_FA_I2SVG) : null;
  1566. return typeof i2svg === 'string';
  1567. }
  1568. function hasPrefixAndIcon(node) {
  1569. var prefix = node.getAttribute ? node.getAttribute(DATA_PREFIX) : null;
  1570. var icon = node.getAttribute ? node.getAttribute(DATA_ICON) : null;
  1571. return prefix && icon;
  1572. }
  1573. function hasBeenReplaced(node) {
  1574. return node && node.classList && node.classList.contains && node.classList.contains(config.replacementClass);
  1575. }
  1576. function getMutator() {
  1577. if (config.autoReplaceSvg === true) {
  1578. return mutators.replace;
  1579. }
  1580. var mutator = mutators[config.autoReplaceSvg];
  1581. return mutator || mutators.replace;
  1582. }
  1583. function createElementNS(tag) {
  1584. return DOCUMENT.createElementNS('http://www.w3.org/2000/svg', tag);
  1585. }
  1586. function createElement(tag) {
  1587. return DOCUMENT.createElement(tag);
  1588. }
  1589. function convertSVG(abstractObj) {
  1590. var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1591. var _params$ceFn = params.ceFn,
  1592. ceFn = _params$ceFn === void 0 ? abstractObj.tag === 'svg' ? createElementNS : createElement : _params$ceFn;
  1593. if (typeof abstractObj === 'string') {
  1594. return DOCUMENT.createTextNode(abstractObj);
  1595. }
  1596. var tag = ceFn(abstractObj.tag);
  1597. Object.keys(abstractObj.attributes || []).forEach(function (key) {
  1598. tag.setAttribute(key, abstractObj.attributes[key]);
  1599. });
  1600. var children = abstractObj.children || [];
  1601. children.forEach(function (child) {
  1602. tag.appendChild(convertSVG(child, {
  1603. ceFn: ceFn
  1604. }));
  1605. });
  1606. return tag;
  1607. }
  1608. function nodeAsComment(node) {
  1609. var comment = " ".concat(node.outerHTML, " ");
  1610. /* BEGIN.ATTRIBUTION */
  1611. comment = "".concat(comment, "Font Awesome fontawesome.com ");
  1612. /* END.ATTRIBUTION */
  1613. return comment;
  1614. }
  1615. var mutators = {
  1616. replace: function replace(mutation) {
  1617. var node = mutation[0];
  1618. if (node.parentNode) {
  1619. mutation[1].forEach(function (_abstract) {
  1620. node.parentNode.insertBefore(convertSVG(_abstract), node);
  1621. });
  1622. if (node.getAttribute(DATA_FA_I2SVG) === null && config.keepOriginalSource) {
  1623. var comment = DOCUMENT.createComment(nodeAsComment(node));
  1624. node.parentNode.replaceChild(comment, node);
  1625. } else {
  1626. node.remove();
  1627. }
  1628. }
  1629. },
  1630. nest: function nest(mutation) {
  1631. var node = mutation[0];
  1632. var _abstract2 = mutation[1]; // If we already have a replaced node we do not want to continue nesting within it.
  1633. // Short-circuit to the standard replacement
  1634. if (~classArray(node).indexOf(config.replacementClass)) {
  1635. return mutators.replace(mutation);
  1636. }
  1637. var forSvg = new RegExp("".concat(config.cssPrefix, "-.*"));
  1638. delete _abstract2[0].attributes.id;
  1639. if (_abstract2[0].attributes.class) {
  1640. var splitClasses = _abstract2[0].attributes.class.split(' ').reduce(function (acc, cls) {
  1641. if (cls === config.replacementClass || cls.match(forSvg)) {
  1642. acc.toSvg.push(cls);
  1643. } else {
  1644. acc.toNode.push(cls);
  1645. }
  1646. return acc;
  1647. }, {
  1648. toNode: [],
  1649. toSvg: []
  1650. });
  1651. _abstract2[0].attributes.class = splitClasses.toSvg.join(' ');
  1652. if (splitClasses.toNode.length === 0) {
  1653. node.removeAttribute('class');
  1654. } else {
  1655. node.setAttribute('class', splitClasses.toNode.join(' '));
  1656. }
  1657. }
  1658. var newInnerHTML = _abstract2.map(function (a) {
  1659. return toHtml(a);
  1660. }).join('\n');
  1661. node.setAttribute(DATA_FA_I2SVG, '');
  1662. node.innerHTML = newInnerHTML;
  1663. }
  1664. };
  1665. function performOperationSync(op) {
  1666. op();
  1667. }
  1668. function perform(mutations, callback) {
  1669. var callbackFunction = typeof callback === 'function' ? callback : noop$2;
  1670. if (mutations.length === 0) {
  1671. callbackFunction();
  1672. } else {
  1673. var frame = performOperationSync;
  1674. if (config.mutateApproach === MUTATION_APPROACH_ASYNC) {
  1675. frame = WINDOW.requestAnimationFrame || performOperationSync;
  1676. }
  1677. frame(function () {
  1678. var mutator = getMutator();
  1679. var mark = perf.begin('mutate');
  1680. mutations.map(mutator);
  1681. mark();
  1682. callbackFunction();
  1683. });
  1684. }
  1685. }
  1686. var disabled = false;
  1687. function disableObservation() {
  1688. disabled = true;
  1689. }
  1690. function enableObservation() {
  1691. disabled = false;
  1692. }
  1693. var mo = null;
  1694. function observe(options) {
  1695. if (!MUTATION_OBSERVER) {
  1696. return;
  1697. }
  1698. if (!config.observeMutations) {
  1699. return;
  1700. }
  1701. var _options$treeCallback = options.treeCallback,
  1702. treeCallback = _options$treeCallback === void 0 ? noop$2 : _options$treeCallback,
  1703. _options$nodeCallback = options.nodeCallback,
  1704. nodeCallback = _options$nodeCallback === void 0 ? noop$2 : _options$nodeCallback,
  1705. _options$pseudoElemen = options.pseudoElementsCallback,
  1706. pseudoElementsCallback = _options$pseudoElemen === void 0 ? noop$2 : _options$pseudoElemen,
  1707. _options$observeMutat = options.observeMutationsRoot,
  1708. observeMutationsRoot = _options$observeMutat === void 0 ? DOCUMENT : _options$observeMutat;
  1709. mo = new MUTATION_OBSERVER(function (objects) {
  1710. if (disabled) return;
  1711. var defaultPrefix = getDefaultUsablePrefix();
  1712. toArray(objects).forEach(function (mutationRecord) {
  1713. if (mutationRecord.type === 'childList' && mutationRecord.addedNodes.length > 0 && !isWatched(mutationRecord.addedNodes[0])) {
  1714. if (config.searchPseudoElements) {
  1715. pseudoElementsCallback(mutationRecord.target);
  1716. }
  1717. treeCallback(mutationRecord.target);
  1718. }
  1719. if (mutationRecord.type === 'attributes' && mutationRecord.target.parentNode && config.searchPseudoElements) {
  1720. pseudoElementsCallback(mutationRecord.target.parentNode);
  1721. }
  1722. if (mutationRecord.type === 'attributes' && isWatched(mutationRecord.target) && ~ATTRIBUTES_WATCHED_FOR_MUTATION.indexOf(mutationRecord.attributeName)) {
  1723. if (mutationRecord.attributeName === 'class' && hasPrefixAndIcon(mutationRecord.target)) {
  1724. var _getCanonicalIcon = getCanonicalIcon(classArray(mutationRecord.target)),
  1725. prefix = _getCanonicalIcon.prefix,
  1726. iconName = _getCanonicalIcon.iconName;
  1727. mutationRecord.target.setAttribute(DATA_PREFIX, prefix || defaultPrefix);
  1728. if (iconName) mutationRecord.target.setAttribute(DATA_ICON, iconName);
  1729. } else if (hasBeenReplaced(mutationRecord.target)) {
  1730. nodeCallback(mutationRecord.target);
  1731. }
  1732. }
  1733. });
  1734. });
  1735. if (!IS_DOM) return;
  1736. mo.observe(observeMutationsRoot, {
  1737. childList: true,
  1738. attributes: true,
  1739. characterData: true,
  1740. subtree: true
  1741. });
  1742. }
  1743. function disconnect() {
  1744. if (!mo) return;
  1745. mo.disconnect();
  1746. }
  1747. function styleParser (node) {
  1748. var style = node.getAttribute('style');
  1749. var val = [];
  1750. if (style) {
  1751. val = style.split(';').reduce(function (acc, style) {
  1752. var styles = style.split(':');
  1753. var prop = styles[0];
  1754. var value = styles.slice(1);
  1755. if (prop && value.length > 0) {
  1756. acc[prop] = value.join(':').trim();
  1757. }
  1758. return acc;
  1759. }, {});
  1760. }
  1761. return val;
  1762. }
  1763. function classParser (node) {
  1764. var existingPrefix = node.getAttribute('data-prefix');
  1765. var existingIconName = node.getAttribute('data-icon');
  1766. var innerText = node.innerText !== undefined ? node.innerText.trim() : '';
  1767. var val = getCanonicalIcon(classArray(node));
  1768. if (!val.prefix) {
  1769. val.prefix = getDefaultUsablePrefix();
  1770. }
  1771. if (existingPrefix && existingIconName) {
  1772. val.prefix = existingPrefix;
  1773. val.iconName = existingIconName;
  1774. }
  1775. if (val.iconName && val.prefix) {
  1776. return val;
  1777. }
  1778. if (val.prefix && innerText.length > 0) {
  1779. val.iconName = byLigature(val.prefix, node.innerText) || byUnicode(val.prefix, toHex(node.innerText));
  1780. }
  1781. if (!val.iconName && config.autoFetchSvg && node.firstChild && node.firstChild.nodeType === Node.TEXT_NODE) {
  1782. val.iconName = node.firstChild.data;
  1783. }
  1784. return val;
  1785. }
  1786. function attributesParser (node) {
  1787. var extraAttributes = toArray(node.attributes).reduce(function (acc, attr) {
  1788. if (acc.name !== 'class' && acc.name !== 'style') {
  1789. acc[attr.name] = attr.value;
  1790. }
  1791. return acc;
  1792. }, {});
  1793. var title = node.getAttribute('title');
  1794. var titleId = node.getAttribute('data-fa-title-id');
  1795. if (config.autoA11y) {
  1796. if (title) {
  1797. extraAttributes['aria-labelledby'] = "".concat(config.replacementClass, "-title-").concat(titleId || nextUniqueId());
  1798. } else {
  1799. extraAttributes['aria-hidden'] = 'true';
  1800. extraAttributes['focusable'] = 'false';
  1801. }
  1802. }
  1803. return extraAttributes;
  1804. }
  1805. function blankMeta() {
  1806. return {
  1807. iconName: null,
  1808. title: null,
  1809. titleId: null,
  1810. prefix: null,
  1811. transform: meaninglessTransform,
  1812. symbol: false,
  1813. mask: {
  1814. iconName: null,
  1815. prefix: null,
  1816. rest: []
  1817. },
  1818. maskId: null,
  1819. extra: {
  1820. classes: [],
  1821. styles: {},
  1822. attributes: {}
  1823. }
  1824. };
  1825. }
  1826. function parseMeta(node) {
  1827. var parser = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
  1828. styleParser: true
  1829. };
  1830. var _classParser = classParser(node),
  1831. iconName = _classParser.iconName,
  1832. prefix = _classParser.prefix,
  1833. extraClasses = _classParser.rest;
  1834. var extraAttributes = attributesParser(node);
  1835. var pluginMeta = chainHooks('parseNodeAttributes', {}, node);
  1836. var extraStyles = parser.styleParser ? styleParser(node) : [];
  1837. return _objectSpread2({
  1838. iconName: iconName,
  1839. title: node.getAttribute('title'),
  1840. titleId: node.getAttribute('data-fa-title-id'),
  1841. prefix: prefix,
  1842. transform: meaninglessTransform,
  1843. mask: {
  1844. iconName: null,
  1845. prefix: null,
  1846. rest: []
  1847. },
  1848. maskId: null,
  1849. symbol: false,
  1850. extra: {
  1851. classes: extraClasses,
  1852. styles: extraStyles,
  1853. attributes: extraAttributes
  1854. }
  1855. }, pluginMeta);
  1856. }
  1857. var styles$2 = namespace.styles;
  1858. function generateMutation(node) {
  1859. var nodeMeta = config.autoReplaceSvg === 'nest' ? parseMeta(node, {
  1860. styleParser: false
  1861. }) : parseMeta(node);
  1862. if (~nodeMeta.extra.classes.indexOf(LAYERS_TEXT_CLASSNAME)) {
  1863. return callProvided('generateLayersText', node, nodeMeta);
  1864. } else {
  1865. return callProvided('generateSvgReplacementMutation', node, nodeMeta);
  1866. }
  1867. }
  1868. var knownPrefixes = new Set();
  1869. FAMILIES.map(function (family) {
  1870. knownPrefixes.add("fa-".concat(family));
  1871. });
  1872. Object.keys(PREFIX_TO_STYLE[FAMILY_CLASSIC]).map(knownPrefixes.add.bind(knownPrefixes));
  1873. Object.keys(PREFIX_TO_STYLE[FAMILY_SHARP]).map(knownPrefixes.add.bind(knownPrefixes));
  1874. knownPrefixes = _toConsumableArray(knownPrefixes);
  1875. function onTree(root) {
  1876. var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  1877. if (!IS_DOM) return Promise.resolve();
  1878. var htmlClassList = DOCUMENT.documentElement.classList;
  1879. var hclAdd = function hclAdd(suffix) {
  1880. return htmlClassList.add("".concat(HTML_CLASS_I2SVG_BASE_CLASS, "-").concat(suffix));
  1881. };
  1882. var hclRemove = function hclRemove(suffix) {
  1883. return htmlClassList.remove("".concat(HTML_CLASS_I2SVG_BASE_CLASS, "-").concat(suffix));
  1884. };
  1885. var prefixes = config.autoFetchSvg ? knownPrefixes : FAMILIES.map(function (f) {
  1886. return "fa-".concat(f);
  1887. }).concat(Object.keys(styles$2));
  1888. if (!prefixes.includes('fa')) {
  1889. prefixes.push('fa');
  1890. }
  1891. var prefixesDomQuery = [".".concat(LAYERS_TEXT_CLASSNAME, ":not([").concat(DATA_FA_I2SVG, "])")].concat(prefixes.map(function (p) {
  1892. return ".".concat(p, ":not([").concat(DATA_FA_I2SVG, "])");
  1893. })).join(', ');
  1894. if (prefixesDomQuery.length === 0) {
  1895. return Promise.resolve();
  1896. }
  1897. var candidates = [];
  1898. try {
  1899. candidates = toArray(root.querySelectorAll(prefixesDomQuery));
  1900. } catch (e) {// noop
  1901. }
  1902. if (candidates.length > 0) {
  1903. hclAdd('pending');
  1904. hclRemove('complete');
  1905. } else {
  1906. return Promise.resolve();
  1907. }
  1908. var mark = perf.begin('onTree');
  1909. var mutations = candidates.reduce(function (acc, node) {
  1910. try {
  1911. var mutation = generateMutation(node);
  1912. if (mutation) {
  1913. acc.push(mutation);
  1914. }
  1915. } catch (e) {
  1916. if (!PRODUCTION) {
  1917. if (e.name === 'MissingIcon') {
  1918. console.error(e);
  1919. }
  1920. }
  1921. }
  1922. return acc;
  1923. }, []);
  1924. return new Promise(function (resolve, reject) {
  1925. Promise.all(mutations).then(function (resolvedMutations) {
  1926. perform(resolvedMutations, function () {
  1927. hclAdd('active');
  1928. hclAdd('complete');
  1929. hclRemove('pending');
  1930. if (typeof callback === 'function') callback();
  1931. mark();
  1932. resolve();
  1933. });
  1934. }).catch(function (e) {
  1935. mark();
  1936. reject(e);
  1937. });
  1938. });
  1939. }
  1940. function onNode(node) {
  1941. var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  1942. generateMutation(node).then(function (mutation) {
  1943. if (mutation) {
  1944. perform([mutation], callback);
  1945. }
  1946. });
  1947. }
  1948. function resolveIcons(next) {
  1949. return function (maybeIconDefinition) {
  1950. var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1951. var iconDefinition = (maybeIconDefinition || {}).icon ? maybeIconDefinition : findIconDefinition(maybeIconDefinition || {});
  1952. var mask = params.mask;
  1953. if (mask) {
  1954. mask = (mask || {}).icon ? mask : findIconDefinition(mask || {});
  1955. }
  1956. return next(iconDefinition, _objectSpread2(_objectSpread2({}, params), {}, {
  1957. mask: mask
  1958. }));
  1959. };
  1960. }
  1961. var render = function render(iconDefinition) {
  1962. var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1963. var _params$transform = params.transform,
  1964. transform = _params$transform === void 0 ? meaninglessTransform : _params$transform,
  1965. _params$symbol = params.symbol,
  1966. symbol = _params$symbol === void 0 ? false : _params$symbol,
  1967. _params$mask = params.mask,
  1968. mask = _params$mask === void 0 ? null : _params$mask,
  1969. _params$maskId = params.maskId,
  1970. maskId = _params$maskId === void 0 ? null : _params$maskId,
  1971. _params$title = params.title,
  1972. title = _params$title === void 0 ? null : _params$title,
  1973. _params$titleId = params.titleId,
  1974. titleId = _params$titleId === void 0 ? null : _params$titleId,
  1975. _params$classes = params.classes,
  1976. classes = _params$classes === void 0 ? [] : _params$classes,
  1977. _params$attributes = params.attributes,
  1978. attributes = _params$attributes === void 0 ? {} : _params$attributes,
  1979. _params$styles = params.styles,
  1980. styles = _params$styles === void 0 ? {} : _params$styles;
  1981. if (!iconDefinition) return;
  1982. var prefix = iconDefinition.prefix,
  1983. iconName = iconDefinition.iconName,
  1984. icon = iconDefinition.icon;
  1985. return domVariants(_objectSpread2({
  1986. type: 'icon'
  1987. }, iconDefinition), function () {
  1988. callHooks('beforeDOMElementCreation', {
  1989. iconDefinition: iconDefinition,
  1990. params: params
  1991. });
  1992. if (config.autoA11y) {
  1993. if (title) {
  1994. attributes['aria-labelledby'] = "".concat(config.replacementClass, "-title-").concat(titleId || nextUniqueId());
  1995. } else {
  1996. attributes['aria-hidden'] = 'true';
  1997. attributes['focusable'] = 'false';
  1998. }
  1999. }
  2000. return makeInlineSvgAbstract({
  2001. icons: {
  2002. main: asFoundIcon(icon),
  2003. mask: mask ? asFoundIcon(mask.icon) : {
  2004. found: false,
  2005. width: null,
  2006. height: null,
  2007. icon: {}
  2008. }
  2009. },
  2010. prefix: prefix,
  2011. iconName: iconName,
  2012. transform: _objectSpread2(_objectSpread2({}, meaninglessTransform), transform),
  2013. symbol: symbol,
  2014. title: title,
  2015. maskId: maskId,
  2016. titleId: titleId,
  2017. extra: {
  2018. attributes: attributes,
  2019. styles: styles,
  2020. classes: classes
  2021. }
  2022. });
  2023. });
  2024. };
  2025. var ReplaceElements = {
  2026. mixout: function mixout() {
  2027. return {
  2028. icon: resolveIcons(render)
  2029. };
  2030. },
  2031. hooks: function hooks() {
  2032. return {
  2033. mutationObserverCallbacks: function mutationObserverCallbacks(accumulator) {
  2034. accumulator.treeCallback = onTree;
  2035. accumulator.nodeCallback = onNode;
  2036. return accumulator;
  2037. }
  2038. };
  2039. },
  2040. provides: function provides(providers$$1) {
  2041. providers$$1.i2svg = function (params) {
  2042. var _params$node = params.node,
  2043. node = _params$node === void 0 ? DOCUMENT : _params$node,
  2044. _params$callback = params.callback,
  2045. callback = _params$callback === void 0 ? function () {} : _params$callback;
  2046. return onTree(node, callback);
  2047. };
  2048. providers$$1.generateSvgReplacementMutation = function (node, nodeMeta) {
  2049. var iconName = nodeMeta.iconName,
  2050. title = nodeMeta.title,
  2051. titleId = nodeMeta.titleId,
  2052. prefix = nodeMeta.prefix,
  2053. transform = nodeMeta.transform,
  2054. symbol = nodeMeta.symbol,
  2055. mask = nodeMeta.mask,
  2056. maskId = nodeMeta.maskId,
  2057. extra = nodeMeta.extra;
  2058. return new Promise(function (resolve, reject) {
  2059. Promise.all([findIcon(iconName, prefix), mask.iconName ? findIcon(mask.iconName, mask.prefix) : Promise.resolve({
  2060. found: false,
  2061. width: 512,
  2062. height: 512,
  2063. icon: {}
  2064. })]).then(function (_ref) {
  2065. var _ref2 = _slicedToArray(_ref, 2),
  2066. main = _ref2[0],
  2067. mask = _ref2[1];
  2068. resolve([node, makeInlineSvgAbstract({
  2069. icons: {
  2070. main: main,
  2071. mask: mask
  2072. },
  2073. prefix: prefix,
  2074. iconName: iconName,
  2075. transform: transform,
  2076. symbol: symbol,
  2077. maskId: maskId,
  2078. title: title,
  2079. titleId: titleId,
  2080. extra: extra,
  2081. watchable: true
  2082. })]);
  2083. }).catch(reject);
  2084. });
  2085. };
  2086. providers$$1.generateAbstractIcon = function (_ref3) {
  2087. var children = _ref3.children,
  2088. attributes = _ref3.attributes,
  2089. main = _ref3.main,
  2090. transform = _ref3.transform,
  2091. styles = _ref3.styles;
  2092. var styleString = joinStyles(styles);
  2093. if (styleString.length > 0) {
  2094. attributes['style'] = styleString;
  2095. }
  2096. var nextChild;
  2097. if (transformIsMeaningful(transform)) {
  2098. nextChild = callProvided('generateAbstractTransformGrouping', {
  2099. main: main,
  2100. transform: transform,
  2101. containerWidth: main.width,
  2102. iconWidth: main.width
  2103. });
  2104. }
  2105. children.push(nextChild || main.icon);
  2106. return {
  2107. children: children,
  2108. attributes: attributes
  2109. };
  2110. };
  2111. }
  2112. };
  2113. var Layers = {
  2114. mixout: function mixout() {
  2115. return {
  2116. layer: function layer(assembler) {
  2117. var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  2118. var _params$classes = params.classes,
  2119. classes = _params$classes === void 0 ? [] : _params$classes;
  2120. return domVariants({
  2121. type: 'layer'
  2122. }, function () {
  2123. callHooks('beforeDOMElementCreation', {
  2124. assembler: assembler,
  2125. params: params
  2126. });
  2127. var children = [];
  2128. assembler(function (args) {
  2129. Array.isArray(args) ? args.map(function (a) {
  2130. children = children.concat(a.abstract);
  2131. }) : children = children.concat(args.abstract);
  2132. });
  2133. return [{
  2134. tag: 'span',
  2135. attributes: {
  2136. class: ["".concat(config.cssPrefix, "-layers")].concat(_toConsumableArray(classes)).join(' ')
  2137. },
  2138. children: children
  2139. }];
  2140. });
  2141. }
  2142. };
  2143. }
  2144. };
  2145. var LayersCounter = {
  2146. mixout: function mixout() {
  2147. return {
  2148. counter: function counter(content) {
  2149. var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  2150. var _params$title = params.title,
  2151. title = _params$title === void 0 ? null : _params$title,
  2152. _params$classes = params.classes,
  2153. classes = _params$classes === void 0 ? [] : _params$classes,
  2154. _params$attributes = params.attributes,
  2155. attributes = _params$attributes === void 0 ? {} : _params$attributes,
  2156. _params$styles = params.styles,
  2157. styles = _params$styles === void 0 ? {} : _params$styles;
  2158. return domVariants({
  2159. type: 'counter',
  2160. content: content
  2161. }, function () {
  2162. callHooks('beforeDOMElementCreation', {
  2163. content: content,
  2164. params: params
  2165. });
  2166. return makeLayersCounterAbstract({
  2167. content: content.toString(),
  2168. title: title,
  2169. extra: {
  2170. attributes: attributes,
  2171. styles: styles,
  2172. classes: ["".concat(config.cssPrefix, "-layers-counter")].concat(_toConsumableArray(classes))
  2173. }
  2174. });
  2175. });
  2176. }
  2177. };
  2178. }
  2179. };
  2180. var LayersText = {
  2181. mixout: function mixout() {
  2182. return {
  2183. text: function text(content) {
  2184. var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  2185. var _params$transform = params.transform,
  2186. transform = _params$transform === void 0 ? meaninglessTransform : _params$transform,
  2187. _params$title = params.title,
  2188. title = _params$title === void 0 ? null : _params$title,
  2189. _params$classes = params.classes,
  2190. classes = _params$classes === void 0 ? [] : _params$classes,
  2191. _params$attributes = params.attributes,
  2192. attributes = _params$attributes === void 0 ? {} : _params$attributes,
  2193. _params$styles = params.styles,
  2194. styles = _params$styles === void 0 ? {} : _params$styles;
  2195. return domVariants({
  2196. type: 'text',
  2197. content: content
  2198. }, function () {
  2199. callHooks('beforeDOMElementCreation', {
  2200. content: content,
  2201. params: params
  2202. });
  2203. return makeLayersTextAbstract({
  2204. content: content,
  2205. transform: _objectSpread2(_objectSpread2({}, meaninglessTransform), transform),
  2206. title: title,
  2207. extra: {
  2208. attributes: attributes,
  2209. styles: styles,
  2210. classes: ["".concat(config.cssPrefix, "-layers-text")].concat(_toConsumableArray(classes))
  2211. }
  2212. });
  2213. });
  2214. }
  2215. };
  2216. },
  2217. provides: function provides(providers$$1) {
  2218. providers$$1.generateLayersText = function (node, nodeMeta) {
  2219. var title = nodeMeta.title,
  2220. transform = nodeMeta.transform,
  2221. extra = nodeMeta.extra;
  2222. var width = null;
  2223. var height = null;
  2224. if (IS_IE) {
  2225. var computedFontSize = parseInt(getComputedStyle(node).fontSize, 10);
  2226. var boundingClientRect = node.getBoundingClientRect();
  2227. width = boundingClientRect.width / computedFontSize;
  2228. height = boundingClientRect.height / computedFontSize;
  2229. }
  2230. if (config.autoA11y && !title) {
  2231. extra.attributes['aria-hidden'] = 'true';
  2232. }
  2233. return Promise.resolve([node, makeLayersTextAbstract({
  2234. content: node.innerHTML,
  2235. width: width,
  2236. height: height,
  2237. transform: transform,
  2238. title: title,
  2239. extra: extra,
  2240. watchable: true
  2241. })]);
  2242. };
  2243. }
  2244. };
  2245. var CLEAN_CONTENT_PATTERN = new RegExp("\"", 'ug');
  2246. var SECONDARY_UNICODE_RANGE = [1105920, 1112319];
  2247. function hexValueFromContent(content) {
  2248. var cleaned = content.replace(CLEAN_CONTENT_PATTERN, '');
  2249. var codePoint = codePointAt(cleaned, 0);
  2250. var isPrependTen = codePoint >= SECONDARY_UNICODE_RANGE[0] && codePoint <= SECONDARY_UNICODE_RANGE[1];
  2251. var isDoubled = cleaned.length === 2 ? cleaned[0] === cleaned[1] : false;
  2252. return {
  2253. value: isDoubled ? toHex(cleaned[0]) : toHex(cleaned),
  2254. isSecondary: isPrependTen || isDoubled
  2255. };
  2256. }
  2257. function replaceForPosition(node, position) {
  2258. var pendingAttribute = "".concat(DATA_FA_PSEUDO_ELEMENT_PENDING).concat(position.replace(':', '-'));
  2259. return new Promise(function (resolve, reject) {
  2260. if (node.getAttribute(pendingAttribute) !== null) {
  2261. // This node is already being processed
  2262. return resolve();
  2263. }
  2264. var children = toArray(node.children);
  2265. var alreadyProcessedPseudoElement = children.filter(function (c) {
  2266. return c.getAttribute(DATA_FA_PSEUDO_ELEMENT) === position;
  2267. })[0];
  2268. var styles = WINDOW.getComputedStyle(node, position);
  2269. var fontFamily = styles.getPropertyValue('font-family').match(FONT_FAMILY_PATTERN);
  2270. var fontWeight = styles.getPropertyValue('font-weight');
  2271. var content = styles.getPropertyValue('content');
  2272. if (alreadyProcessedPseudoElement && !fontFamily) {
  2273. // If we've already processed it but the current computed style does not result in a font-family,
  2274. // that probably means that a class name that was previously present to make the icon has been
  2275. // removed. So we now should delete the icon.
  2276. node.removeChild(alreadyProcessedPseudoElement);
  2277. return resolve();
  2278. } else if (fontFamily && content !== 'none' && content !== '') {
  2279. var _content = styles.getPropertyValue('content');
  2280. var family = ~['Sharp'].indexOf(fontFamily[2]) ? FAMILY_SHARP : FAMILY_CLASSIC;
  2281. var prefix = ~['Solid', 'Regular', 'Light', 'Thin', 'Duotone', 'Brands', 'Kit'].indexOf(fontFamily[2]) ? STYLE_TO_PREFIX[family][fontFamily[2].toLowerCase()] : FONT_WEIGHT_TO_PREFIX[family][fontWeight];
  2282. var _hexValueFromContent = hexValueFromContent(_content),
  2283. hexValue = _hexValueFromContent.value,
  2284. isSecondary = _hexValueFromContent.isSecondary;
  2285. var isV4 = fontFamily[0].startsWith('FontAwesome');
  2286. var iconName = byUnicode(prefix, hexValue);
  2287. var iconIdentifier = iconName;
  2288. if (isV4) {
  2289. var iconName4 = byOldUnicode(hexValue);
  2290. if (iconName4.iconName && iconName4.prefix) {
  2291. iconName = iconName4.iconName;
  2292. prefix = iconName4.prefix;
  2293. }
  2294. } // Only convert the pseudo element in this ::before/::after position into an icon if we haven't
  2295. // already done so with the same prefix and iconName
  2296. if (iconName && !isSecondary && (!alreadyProcessedPseudoElement || alreadyProcessedPseudoElement.getAttribute(DATA_PREFIX) !== prefix || alreadyProcessedPseudoElement.getAttribute(DATA_ICON) !== iconIdentifier)) {
  2297. node.setAttribute(pendingAttribute, iconIdentifier);
  2298. if (alreadyProcessedPseudoElement) {
  2299. // Delete the old one, since we're replacing it with a new one
  2300. node.removeChild(alreadyProcessedPseudoElement);
  2301. }
  2302. var meta = blankMeta();
  2303. var extra = meta.extra;
  2304. extra.attributes[DATA_FA_PSEUDO_ELEMENT] = position;
  2305. findIcon(iconName, prefix).then(function (main) {
  2306. var _abstract = makeInlineSvgAbstract(_objectSpread2(_objectSpread2({}, meta), {}, {
  2307. icons: {
  2308. main: main,
  2309. mask: emptyCanonicalIcon()
  2310. },
  2311. prefix: prefix,
  2312. iconName: iconIdentifier,
  2313. extra: extra,
  2314. watchable: true
  2315. }));
  2316. var element = DOCUMENT.createElement('svg');
  2317. if (position === '::before') {
  2318. node.insertBefore(element, node.firstChild);
  2319. } else {
  2320. node.appendChild(element);
  2321. }
  2322. element.outerHTML = _abstract.map(function (a) {
  2323. return toHtml(a);
  2324. }).join('\n');
  2325. node.removeAttribute(pendingAttribute);
  2326. resolve();
  2327. }).catch(reject);
  2328. } else {
  2329. resolve();
  2330. }
  2331. } else {
  2332. resolve();
  2333. }
  2334. });
  2335. }
  2336. function replace(node) {
  2337. return Promise.all([replaceForPosition(node, '::before'), replaceForPosition(node, '::after')]);
  2338. }
  2339. function processable(node) {
  2340. 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');
  2341. }
  2342. function searchPseudoElements(root) {
  2343. if (!IS_DOM) return;
  2344. return new Promise(function (resolve, reject) {
  2345. var operations = toArray(root.querySelectorAll('*')).filter(processable).map(replace);
  2346. var end = perf.begin('searchPseudoElements');
  2347. disableObservation();
  2348. Promise.all(operations).then(function () {
  2349. end();
  2350. enableObservation();
  2351. resolve();
  2352. }).catch(function () {
  2353. end();
  2354. enableObservation();
  2355. reject();
  2356. });
  2357. });
  2358. }
  2359. var PseudoElements = {
  2360. hooks: function hooks() {
  2361. return {
  2362. mutationObserverCallbacks: function mutationObserverCallbacks(accumulator) {
  2363. accumulator.pseudoElementsCallback = searchPseudoElements;
  2364. return accumulator;
  2365. }
  2366. };
  2367. },
  2368. provides: function provides(providers$$1) {
  2369. providers$$1.pseudoElements2svg = function (params) {
  2370. var _params$node = params.node,
  2371. node = _params$node === void 0 ? DOCUMENT : _params$node;
  2372. if (config.searchPseudoElements) {
  2373. searchPseudoElements(node);
  2374. }
  2375. };
  2376. }
  2377. };
  2378. var _unwatched = false;
  2379. var MutationObserver$1 = {
  2380. mixout: function mixout() {
  2381. return {
  2382. dom: {
  2383. unwatch: function unwatch() {
  2384. disableObservation();
  2385. _unwatched = true;
  2386. }
  2387. }
  2388. };
  2389. },
  2390. hooks: function hooks() {
  2391. return {
  2392. bootstrap: function bootstrap() {
  2393. observe(chainHooks('mutationObserverCallbacks', {}));
  2394. },
  2395. noAuto: function noAuto() {
  2396. disconnect();
  2397. },
  2398. watch: function watch(params) {
  2399. var observeMutationsRoot = params.observeMutationsRoot;
  2400. if (_unwatched) {
  2401. enableObservation();
  2402. } else {
  2403. observe(chainHooks('mutationObserverCallbacks', {
  2404. observeMutationsRoot: observeMutationsRoot
  2405. }));
  2406. }
  2407. }
  2408. };
  2409. }
  2410. };
  2411. var parseTransformString = function parseTransformString(transformString) {
  2412. var transform = {
  2413. size: 16,
  2414. x: 0,
  2415. y: 0,
  2416. flipX: false,
  2417. flipY: false,
  2418. rotate: 0
  2419. };
  2420. return transformString.toLowerCase().split(' ').reduce(function (acc, n) {
  2421. var parts = n.toLowerCase().split('-');
  2422. var first = parts[0];
  2423. var rest = parts.slice(1).join('-');
  2424. if (first && rest === 'h') {
  2425. acc.flipX = true;
  2426. return acc;
  2427. }
  2428. if (first && rest === 'v') {
  2429. acc.flipY = true;
  2430. return acc;
  2431. }
  2432. rest = parseFloat(rest);
  2433. if (isNaN(rest)) {
  2434. return acc;
  2435. }
  2436. switch (first) {
  2437. case 'grow':
  2438. acc.size = acc.size + rest;
  2439. break;
  2440. case 'shrink':
  2441. acc.size = acc.size - rest;
  2442. break;
  2443. case 'left':
  2444. acc.x = acc.x - rest;
  2445. break;
  2446. case 'right':
  2447. acc.x = acc.x + rest;
  2448. break;
  2449. case 'up':
  2450. acc.y = acc.y - rest;
  2451. break;
  2452. case 'down':
  2453. acc.y = acc.y + rest;
  2454. break;
  2455. case 'rotate':
  2456. acc.rotate = acc.rotate + rest;
  2457. break;
  2458. }
  2459. return acc;
  2460. }, transform);
  2461. };
  2462. var PowerTransforms = {
  2463. mixout: function mixout() {
  2464. return {
  2465. parse: {
  2466. transform: function transform(transformString) {
  2467. return parseTransformString(transformString);
  2468. }
  2469. }
  2470. };
  2471. },
  2472. hooks: function hooks() {
  2473. return {
  2474. parseNodeAttributes: function parseNodeAttributes(accumulator, node) {
  2475. var transformString = node.getAttribute('data-fa-transform');
  2476. if (transformString) {
  2477. accumulator.transform = parseTransformString(transformString);
  2478. }
  2479. return accumulator;
  2480. }
  2481. };
  2482. },
  2483. provides: function provides(providers) {
  2484. providers.generateAbstractTransformGrouping = function (_ref) {
  2485. var main = _ref.main,
  2486. transform = _ref.transform,
  2487. containerWidth = _ref.containerWidth,
  2488. iconWidth = _ref.iconWidth;
  2489. var outer = {
  2490. transform: "translate(".concat(containerWidth / 2, " 256)")
  2491. };
  2492. var innerTranslate = "translate(".concat(transform.x * 32, ", ").concat(transform.y * 32, ") ");
  2493. var innerScale = "scale(".concat(transform.size / 16 * (transform.flipX ? -1 : 1), ", ").concat(transform.size / 16 * (transform.flipY ? -1 : 1), ") ");
  2494. var innerRotate = "rotate(".concat(transform.rotate, " 0 0)");
  2495. var inner = {
  2496. transform: "".concat(innerTranslate, " ").concat(innerScale, " ").concat(innerRotate)
  2497. };
  2498. var path = {
  2499. transform: "translate(".concat(iconWidth / 2 * -1, " -256)")
  2500. };
  2501. var operations = {
  2502. outer: outer,
  2503. inner: inner,
  2504. path: path
  2505. };
  2506. return {
  2507. tag: 'g',
  2508. attributes: _objectSpread2({}, operations.outer),
  2509. children: [{
  2510. tag: 'g',
  2511. attributes: _objectSpread2({}, operations.inner),
  2512. children: [{
  2513. tag: main.icon.tag,
  2514. children: main.icon.children,
  2515. attributes: _objectSpread2(_objectSpread2({}, main.icon.attributes), operations.path)
  2516. }]
  2517. }]
  2518. };
  2519. };
  2520. }
  2521. };
  2522. var ALL_SPACE = {
  2523. x: 0,
  2524. y: 0,
  2525. width: '100%',
  2526. height: '100%'
  2527. };
  2528. function fillBlack(_abstract) {
  2529. var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  2530. if (_abstract.attributes && (_abstract.attributes.fill || force)) {
  2531. _abstract.attributes.fill = 'black';
  2532. }
  2533. return _abstract;
  2534. }
  2535. function deGroup(_abstract2) {
  2536. if (_abstract2.tag === 'g') {
  2537. return _abstract2.children;
  2538. } else {
  2539. return [_abstract2];
  2540. }
  2541. }
  2542. var Masks = {
  2543. hooks: function hooks() {
  2544. return {
  2545. parseNodeAttributes: function parseNodeAttributes(accumulator, node) {
  2546. var maskData = node.getAttribute('data-fa-mask');
  2547. var mask = !maskData ? emptyCanonicalIcon() : getCanonicalIcon(maskData.split(' ').map(function (i) {
  2548. return i.trim();
  2549. }));
  2550. if (!mask.prefix) {
  2551. mask.prefix = getDefaultUsablePrefix();
  2552. }
  2553. accumulator.mask = mask;
  2554. accumulator.maskId = node.getAttribute('data-fa-mask-id');
  2555. return accumulator;
  2556. }
  2557. };
  2558. },
  2559. provides: function provides(providers) {
  2560. providers.generateAbstractMask = function (_ref) {
  2561. var children = _ref.children,
  2562. attributes = _ref.attributes,
  2563. main = _ref.main,
  2564. mask = _ref.mask,
  2565. explicitMaskId = _ref.maskId,
  2566. transform = _ref.transform;
  2567. var mainWidth = main.width,
  2568. mainPath = main.icon;
  2569. var maskWidth = mask.width,
  2570. maskPath = mask.icon;
  2571. var trans = transformForSvg({
  2572. transform: transform,
  2573. containerWidth: maskWidth,
  2574. iconWidth: mainWidth
  2575. });
  2576. var maskRect = {
  2577. tag: 'rect',
  2578. attributes: _objectSpread2(_objectSpread2({}, ALL_SPACE), {}, {
  2579. fill: 'white'
  2580. })
  2581. };
  2582. var maskInnerGroupChildrenMixin = mainPath.children ? {
  2583. children: mainPath.children.map(fillBlack)
  2584. } : {};
  2585. var maskInnerGroup = {
  2586. tag: 'g',
  2587. attributes: _objectSpread2({}, trans.inner),
  2588. children: [fillBlack(_objectSpread2({
  2589. tag: mainPath.tag,
  2590. attributes: _objectSpread2(_objectSpread2({}, mainPath.attributes), trans.path)
  2591. }, maskInnerGroupChildrenMixin))]
  2592. };
  2593. var maskOuterGroup = {
  2594. tag: 'g',
  2595. attributes: _objectSpread2({}, trans.outer),
  2596. children: [maskInnerGroup]
  2597. };
  2598. var maskId = "mask-".concat(explicitMaskId || nextUniqueId());
  2599. var clipId = "clip-".concat(explicitMaskId || nextUniqueId());
  2600. var maskTag = {
  2601. tag: 'mask',
  2602. attributes: _objectSpread2(_objectSpread2({}, ALL_SPACE), {}, {
  2603. id: maskId,
  2604. maskUnits: 'userSpaceOnUse',
  2605. maskContentUnits: 'userSpaceOnUse'
  2606. }),
  2607. children: [maskRect, maskOuterGroup]
  2608. };
  2609. var defs = {
  2610. tag: 'defs',
  2611. children: [{
  2612. tag: 'clipPath',
  2613. attributes: {
  2614. id: clipId
  2615. },
  2616. children: deGroup(maskPath)
  2617. }, maskTag]
  2618. };
  2619. children.push(defs, {
  2620. tag: 'rect',
  2621. attributes: _objectSpread2({
  2622. fill: 'currentColor',
  2623. 'clip-path': "url(#".concat(clipId, ")"),
  2624. mask: "url(#".concat(maskId, ")")
  2625. }, ALL_SPACE)
  2626. });
  2627. return {
  2628. children: children,
  2629. attributes: attributes
  2630. };
  2631. };
  2632. }
  2633. };
  2634. var MissingIconIndicator = {
  2635. provides: function provides(providers) {
  2636. var reduceMotion = false;
  2637. if (WINDOW.matchMedia) {
  2638. reduceMotion = WINDOW.matchMedia('(prefers-reduced-motion: reduce)').matches;
  2639. }
  2640. providers.missingIconAbstract = function () {
  2641. var gChildren = [];
  2642. var FILL = {
  2643. fill: 'currentColor'
  2644. };
  2645. var ANIMATION_BASE = {
  2646. attributeType: 'XML',
  2647. repeatCount: 'indefinite',
  2648. dur: '2s'
  2649. }; // Ring
  2650. gChildren.push({
  2651. tag: 'path',
  2652. attributes: _objectSpread2(_objectSpread2({}, FILL), {}, {
  2653. 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'
  2654. })
  2655. });
  2656. var OPACITY_ANIMATE = _objectSpread2(_objectSpread2({}, ANIMATION_BASE), {}, {
  2657. attributeName: 'opacity'
  2658. });
  2659. var dot = {
  2660. tag: 'circle',
  2661. attributes: _objectSpread2(_objectSpread2({}, FILL), {}, {
  2662. cx: '256',
  2663. cy: '364',
  2664. r: '28'
  2665. }),
  2666. children: []
  2667. };
  2668. if (!reduceMotion) {
  2669. dot.children.push({
  2670. tag: 'animate',
  2671. attributes: _objectSpread2(_objectSpread2({}, ANIMATION_BASE), {}, {
  2672. attributeName: 'r',
  2673. values: '28;14;28;28;14;28;'
  2674. })
  2675. }, {
  2676. tag: 'animate',
  2677. attributes: _objectSpread2(_objectSpread2({}, OPACITY_ANIMATE), {}, {
  2678. values: '1;0;1;1;0;1;'
  2679. })
  2680. });
  2681. }
  2682. gChildren.push(dot);
  2683. gChildren.push({
  2684. tag: 'path',
  2685. attributes: _objectSpread2(_objectSpread2({}, FILL), {}, {
  2686. opacity: '1',
  2687. 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'
  2688. }),
  2689. children: reduceMotion ? [] : [{
  2690. tag: 'animate',
  2691. attributes: _objectSpread2(_objectSpread2({}, OPACITY_ANIMATE), {}, {
  2692. values: '1;0;0;0;0;1;'
  2693. })
  2694. }]
  2695. });
  2696. if (!reduceMotion) {
  2697. // Exclamation
  2698. gChildren.push({
  2699. tag: 'path',
  2700. attributes: _objectSpread2(_objectSpread2({}, FILL), {}, {
  2701. opacity: '0',
  2702. 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'
  2703. }),
  2704. children: [{
  2705. tag: 'animate',
  2706. attributes: _objectSpread2(_objectSpread2({}, OPACITY_ANIMATE), {}, {
  2707. values: '0;0;1;1;0;0;'
  2708. })
  2709. }]
  2710. });
  2711. }
  2712. return {
  2713. tag: 'g',
  2714. attributes: {
  2715. 'class': 'missing'
  2716. },
  2717. children: gChildren
  2718. };
  2719. };
  2720. }
  2721. };
  2722. var SvgSymbols = {
  2723. hooks: function hooks() {
  2724. return {
  2725. parseNodeAttributes: function parseNodeAttributes(accumulator, node) {
  2726. var symbolData = node.getAttribute('data-fa-symbol');
  2727. var symbol = symbolData === null ? false : symbolData === '' ? true : symbolData;
  2728. accumulator['symbol'] = symbol;
  2729. return accumulator;
  2730. }
  2731. };
  2732. }
  2733. };
  2734. var plugins = [InjectCSS, ReplaceElements, Layers, LayersCounter, LayersText, PseudoElements, MutationObserver$1, PowerTransforms, Masks, MissingIconIndicator, SvgSymbols];
  2735. registerPlugins(plugins, {
  2736. mixoutsTo: api
  2737. });
  2738. bunker(bootstrap);
  2739. }());