fontawesome.js 80 KB

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