fontawesome.dev.js 77 KB

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