fontawesome.js 77 KB

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