fontawesome.js 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979
  1. /*!
  2. * Font Awesome Free 5.3.1 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. var noop = function noop() {};
  8. var _WINDOW = {};
  9. var _DOCUMENT = {};
  10. var _MUTATION_OBSERVER$1 = null;
  11. var _PERFORMANCE = { mark: noop, measure: noop };
  12. try {
  13. if (typeof window !== 'undefined') _WINDOW = window;
  14. if (typeof document !== 'undefined') _DOCUMENT = document;
  15. if (typeof MutationObserver !== 'undefined') _MUTATION_OBSERVER$1 = MutationObserver;
  16. if (typeof performance !== 'undefined') _PERFORMANCE = performance;
  17. } catch (e) {}
  18. var _ref = _WINDOW.navigator || {};
  19. var _ref$userAgent = _ref.userAgent;
  20. var userAgent = _ref$userAgent === undefined ? '' : _ref$userAgent;
  21. var WINDOW = _WINDOW;
  22. var DOCUMENT = _DOCUMENT;
  23. var MUTATION_OBSERVER = _MUTATION_OBSERVER$1;
  24. var PERFORMANCE = _PERFORMANCE;
  25. var IS_BROWSER = !!WINDOW.document;
  26. var IS_DOM = !!DOCUMENT.documentElement && !!DOCUMENT.head && typeof DOCUMENT.addEventListener === 'function' && typeof DOCUMENT.createElement === 'function';
  27. var IS_IE = ~userAgent.indexOf('MSIE') || ~userAgent.indexOf('Trident/');
  28. var NAMESPACE_IDENTIFIER = '___FONT_AWESOME___';
  29. var UNITS_IN_GRID = 16;
  30. var DEFAULT_FAMILY_PREFIX = 'fa';
  31. var DEFAULT_REPLACEMENT_CLASS = 'svg-inline--fa';
  32. var DATA_FA_I2SVG = 'data-fa-i2svg';
  33. var DATA_FA_PSEUDO_ELEMENT = 'data-fa-pseudo-element';
  34. var DATA_PREFIX = 'data-prefix';
  35. var DATA_ICON = 'data-icon';
  36. var HTML_CLASS_I2SVG_BASE_CLASS = 'fontawesome-i2svg';
  37. var TAGNAMES_TO_SKIP_FOR_PSEUDOELEMENTS = ['HTML', 'HEAD', 'STYLE', 'SCRIPT'];
  38. var PRODUCTION = function () {
  39. try {
  40. return "production" === 'production';
  41. } catch (e) {
  42. return false;
  43. }
  44. }();
  45. var oneToTen = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
  46. var oneToTwenty = oneToTen.concat([11, 12, 13, 14, 15, 16, 17, 18, 19, 20]);
  47. var ATTRIBUTES_WATCHED_FOR_MUTATION = ['class', 'data-prefix', 'data-icon', 'data-fa-transform', 'data-fa-mask'];
  48. 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', 'stack', 'stack-1x', 'stack-2x', 'inverse', 'layers', 'layers-text', 'layers-counter'].concat(oneToTen.map(function (n) {
  49. return n + 'x';
  50. })).concat(oneToTwenty.map(function (n) {
  51. return 'w-' + n;
  52. }));
  53. var classCallCheck = function (instance, Constructor) {
  54. if (!(instance instanceof Constructor)) {
  55. throw new TypeError("Cannot call a class as a function");
  56. }
  57. };
  58. var createClass = function () {
  59. function defineProperties(target, props) {
  60. for (var i = 0; i < props.length; i++) {
  61. var descriptor = props[i];
  62. descriptor.enumerable = descriptor.enumerable || false;
  63. descriptor.configurable = true;
  64. if ("value" in descriptor) descriptor.writable = true;
  65. Object.defineProperty(target, descriptor.key, descriptor);
  66. }
  67. }
  68. return function (Constructor, protoProps, staticProps) {
  69. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  70. if (staticProps) defineProperties(Constructor, staticProps);
  71. return Constructor;
  72. };
  73. }();
  74. var _extends = Object.assign || function (target) {
  75. for (var i = 1; i < arguments.length; i++) {
  76. var source = arguments[i];
  77. for (var key in source) {
  78. if (Object.prototype.hasOwnProperty.call(source, key)) {
  79. target[key] = source[key];
  80. }
  81. }
  82. }
  83. return target;
  84. };
  85. var slicedToArray = function () {
  86. function sliceIterator(arr, i) {
  87. var _arr = [];
  88. var _n = true;
  89. var _d = false;
  90. var _e = undefined;
  91. try {
  92. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  93. _arr.push(_s.value);
  94. if (i && _arr.length === i) break;
  95. }
  96. } catch (err) {
  97. _d = true;
  98. _e = err;
  99. } finally {
  100. try {
  101. if (!_n && _i["return"]) _i["return"]();
  102. } finally {
  103. if (_d) throw _e;
  104. }
  105. }
  106. return _arr;
  107. }
  108. return function (arr, i) {
  109. if (Array.isArray(arr)) {
  110. return arr;
  111. } else if (Symbol.iterator in Object(arr)) {
  112. return sliceIterator(arr, i);
  113. } else {
  114. throw new TypeError("Invalid attempt to destructure non-iterable instance");
  115. }
  116. };
  117. }();
  118. var toConsumableArray = function (arr) {
  119. if (Array.isArray(arr)) {
  120. for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
  121. return arr2;
  122. } else {
  123. return Array.from(arr);
  124. }
  125. };
  126. var initial = WINDOW.FontAwesomeConfig || {};
  127. function getAttrConfig(attr) {
  128. var element = DOCUMENT.querySelector('script[' + attr + ']');
  129. if (element) {
  130. return element.getAttribute(attr);
  131. }
  132. }
  133. function coerce(val) {
  134. // Getting an empty string will occur if the attribute is set on the HTML tag but without a value
  135. // We'll assume that this is an indication that it should be toggled to true
  136. // For example <script data-search-pseudo-elements src="..."></script>
  137. if (val === '') return true;
  138. if (val === 'false') return false;
  139. if (val === 'true') return true;
  140. return val;
  141. }
  142. if (DOCUMENT && typeof DOCUMENT.querySelector === 'function') {
  143. 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-keep-original-source', 'keepOriginalSource'], ['data-measure-performance', 'measurePerformance'], ['data-show-missing-icons', 'showMissingIcons']];
  144. attrs.forEach(function (_ref) {
  145. var _ref2 = slicedToArray(_ref, 2),
  146. attr = _ref2[0],
  147. key = _ref2[1];
  148. var val = coerce(getAttrConfig(attr));
  149. if (val !== undefined && val !== null) {
  150. initial[key] = val;
  151. }
  152. });
  153. }
  154. var _default = _extends({
  155. familyPrefix: DEFAULT_FAMILY_PREFIX,
  156. replacementClass: DEFAULT_REPLACEMENT_CLASS,
  157. autoReplaceSvg: true,
  158. autoAddCss: true,
  159. autoA11y: true,
  160. searchPseudoElements: false,
  161. observeMutations: true,
  162. keepOriginalSource: true,
  163. measurePerformance: false,
  164. showMissingIcons: true
  165. }, initial);
  166. if (!_default.autoReplaceSvg) _default.observeMutations = false;
  167. var config = _extends({}, _default);
  168. WINDOW.FontAwesomeConfig = config;
  169. var w = WINDOW || {};
  170. if (!w[NAMESPACE_IDENTIFIER]) w[NAMESPACE_IDENTIFIER] = {};
  171. if (!w[NAMESPACE_IDENTIFIER].styles) w[NAMESPACE_IDENTIFIER].styles = {};
  172. if (!w[NAMESPACE_IDENTIFIER].hooks) w[NAMESPACE_IDENTIFIER].hooks = {};
  173. if (!w[NAMESPACE_IDENTIFIER].shims) w[NAMESPACE_IDENTIFIER].shims = [];
  174. var namespace = w[NAMESPACE_IDENTIFIER];
  175. var functions = [];
  176. var listener = function listener() {
  177. DOCUMENT.removeEventListener('DOMContentLoaded', listener);
  178. loaded = 1;
  179. functions.map(function (fn) {
  180. return fn();
  181. });
  182. };
  183. var loaded = false;
  184. if (IS_DOM) {
  185. loaded = (DOCUMENT.documentElement.doScroll ? /^loaded|^c/ : /^loaded|^i|^c/).test(DOCUMENT.readyState);
  186. if (!loaded) DOCUMENT.addEventListener('DOMContentLoaded', listener);
  187. }
  188. var domready = function (fn) {
  189. if (!IS_DOM) return;
  190. loaded ? setTimeout(fn, 0) : functions.push(fn);
  191. };
  192. var d = UNITS_IN_GRID;
  193. var meaninglessTransform = {
  194. size: 16,
  195. x: 0,
  196. y: 0,
  197. rotate: 0,
  198. flipX: false,
  199. flipY: false
  200. };
  201. function isReserved(name) {
  202. return ~RESERVED_CLASSES.indexOf(name);
  203. }
  204. function bunker(fn) {
  205. try {
  206. fn();
  207. } catch (e) {
  208. if (!PRODUCTION) {
  209. throw e;
  210. }
  211. }
  212. }
  213. function insertCss(css) {
  214. if (!css || !IS_DOM) {
  215. return;
  216. }
  217. var style = DOCUMENT.createElement('style');
  218. style.setAttribute('type', 'text/css');
  219. style.innerHTML = css;
  220. var headChildren = DOCUMENT.head.childNodes;
  221. var beforeChild = null;
  222. for (var i = headChildren.length - 1; i > -1; i--) {
  223. var child = headChildren[i];
  224. var tagName = (child.tagName || '').toUpperCase();
  225. if (['STYLE', 'LINK'].indexOf(tagName) > -1) {
  226. beforeChild = child;
  227. }
  228. }
  229. DOCUMENT.head.insertBefore(style, beforeChild);
  230. return css;
  231. }
  232. var _uniqueId = 0;
  233. function nextUniqueId() {
  234. _uniqueId++;
  235. return _uniqueId;
  236. }
  237. function toArray(obj) {
  238. var array = [];
  239. for (var i = (obj || []).length >>> 0; i--;) {
  240. array[i] = obj[i];
  241. }
  242. return array;
  243. }
  244. function classArray(node) {
  245. if (node.classList) {
  246. return toArray(node.classList);
  247. } else {
  248. return (node.getAttribute('class') || '').split(' ').filter(function (i) {
  249. return i;
  250. });
  251. }
  252. }
  253. function getIconName(familyPrefix, cls) {
  254. var parts = cls.split('-');
  255. var prefix = parts[0];
  256. var iconName = parts.slice(1).join('-');
  257. if (prefix === familyPrefix && iconName !== '' && !isReserved(iconName)) {
  258. return iconName;
  259. } else {
  260. return null;
  261. }
  262. }
  263. function htmlEscape(str) {
  264. return ('' + str).replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
  265. }
  266. function joinAttributes(attributes) {
  267. return Object.keys(attributes || {}).reduce(function (acc, attributeName) {
  268. return acc + (attributeName + '="' + htmlEscape(attributes[attributeName]) + '" ');
  269. }, '').trim();
  270. }
  271. function joinStyles(styles) {
  272. return Object.keys(styles || {}).reduce(function (acc, styleName) {
  273. return acc + (styleName + ': ' + styles[styleName] + ';');
  274. }, '');
  275. }
  276. function transformIsMeaningful(transform) {
  277. return transform.size !== meaninglessTransform.size || transform.x !== meaninglessTransform.x || transform.y !== meaninglessTransform.y || transform.rotate !== meaninglessTransform.rotate || transform.flipX || transform.flipY;
  278. }
  279. function transformForSvg(_ref) {
  280. var transform = _ref.transform,
  281. containerWidth = _ref.containerWidth,
  282. iconWidth = _ref.iconWidth;
  283. var outer = {
  284. transform: 'translate(' + containerWidth / 2 + ' 256)'
  285. };
  286. var innerTranslate = 'translate(' + transform.x * 32 + ', ' + transform.y * 32 + ') ';
  287. var innerScale = 'scale(' + transform.size / 16 * (transform.flipX ? -1 : 1) + ', ' + transform.size / 16 * (transform.flipY ? -1 : 1) + ') ';
  288. var innerRotate = 'rotate(' + transform.rotate + ' 0 0)';
  289. var inner = {
  290. transform: innerTranslate + ' ' + innerScale + ' ' + innerRotate
  291. };
  292. var path = {
  293. transform: 'translate(' + iconWidth / 2 * -1 + ' -256)'
  294. };
  295. return {
  296. outer: outer,
  297. inner: inner,
  298. path: path
  299. };
  300. }
  301. function transformForCss(_ref2) {
  302. var transform = _ref2.transform,
  303. _ref2$width = _ref2.width,
  304. width = _ref2$width === undefined ? UNITS_IN_GRID : _ref2$width,
  305. _ref2$height = _ref2.height,
  306. height = _ref2$height === undefined ? UNITS_IN_GRID : _ref2$height,
  307. _ref2$startCentered = _ref2.startCentered,
  308. startCentered = _ref2$startCentered === undefined ? false : _ref2$startCentered;
  309. var val = '';
  310. if (startCentered && IS_IE) {
  311. val += 'translate(' + (transform.x / d - width / 2) + 'em, ' + (transform.y / d - height / 2) + 'em) ';
  312. } else if (startCentered) {
  313. val += 'translate(calc(-50% + ' + transform.x / d + 'em), calc(-50% + ' + transform.y / d + 'em)) ';
  314. } else {
  315. val += 'translate(' + transform.x / d + 'em, ' + transform.y / d + 'em) ';
  316. }
  317. val += 'scale(' + transform.size / d * (transform.flipX ? -1 : 1) + ', ' + transform.size / d * (transform.flipY ? -1 : 1) + ') ';
  318. val += 'rotate(' + transform.rotate + 'deg) ';
  319. return val;
  320. }
  321. var ALL_SPACE = {
  322. x: 0,
  323. y: 0,
  324. width: '100%',
  325. height: '100%'
  326. };
  327. var makeIconMasking = function (_ref) {
  328. var children = _ref.children,
  329. attributes = _ref.attributes,
  330. main = _ref.main,
  331. mask = _ref.mask,
  332. transform = _ref.transform;
  333. var mainWidth = main.width,
  334. mainPath = main.icon;
  335. var maskWidth = mask.width,
  336. maskPath = mask.icon;
  337. var trans = transformForSvg({ transform: transform, containerWidth: maskWidth, iconWidth: mainWidth });
  338. var maskRect = {
  339. tag: 'rect',
  340. attributes: _extends({}, ALL_SPACE, {
  341. fill: 'white'
  342. })
  343. };
  344. var maskInnerGroup = {
  345. tag: 'g',
  346. attributes: _extends({}, trans.inner),
  347. children: [{ tag: 'path', attributes: _extends({}, mainPath.attributes, trans.path, { fill: 'black' }) }]
  348. };
  349. var maskOuterGroup = {
  350. tag: 'g',
  351. attributes: _extends({}, trans.outer),
  352. children: [maskInnerGroup]
  353. };
  354. var maskId = 'mask-' + nextUniqueId();
  355. var clipId = 'clip-' + nextUniqueId();
  356. var maskTag = {
  357. tag: 'mask',
  358. attributes: _extends({}, ALL_SPACE, {
  359. id: maskId,
  360. maskUnits: 'userSpaceOnUse',
  361. maskContentUnits: 'userSpaceOnUse'
  362. }),
  363. children: [maskRect, maskOuterGroup]
  364. };
  365. var defs = {
  366. tag: 'defs',
  367. children: [{ tag: 'clipPath', attributes: { id: clipId }, children: [maskPath] }, maskTag]
  368. };
  369. children.push(defs, { tag: 'rect', attributes: _extends({ fill: 'currentColor', 'clip-path': 'url(#' + clipId + ')', mask: 'url(#' + maskId + ')' }, ALL_SPACE) });
  370. return {
  371. children: children,
  372. attributes: attributes
  373. };
  374. };
  375. var makeIconStandard = function (_ref) {
  376. var children = _ref.children,
  377. attributes = _ref.attributes,
  378. main = _ref.main,
  379. transform = _ref.transform,
  380. styles = _ref.styles;
  381. var styleString = joinStyles(styles);
  382. if (styleString.length > 0) {
  383. attributes['style'] = styleString;
  384. }
  385. if (transformIsMeaningful(transform)) {
  386. var trans = transformForSvg({ transform: transform, containerWidth: main.width, iconWidth: main.width });
  387. children.push({
  388. tag: 'g',
  389. attributes: _extends({}, trans.outer),
  390. children: [{
  391. tag: 'g',
  392. attributes: _extends({}, trans.inner),
  393. children: [{
  394. tag: main.icon.tag,
  395. children: main.icon.children,
  396. attributes: _extends({}, main.icon.attributes, trans.path)
  397. }]
  398. }]
  399. });
  400. } else {
  401. children.push(main.icon);
  402. }
  403. return {
  404. children: children,
  405. attributes: attributes
  406. };
  407. };
  408. var asIcon = function (_ref) {
  409. var children = _ref.children,
  410. main = _ref.main,
  411. mask = _ref.mask,
  412. attributes = _ref.attributes,
  413. styles = _ref.styles,
  414. transform = _ref.transform;
  415. if (transformIsMeaningful(transform) && main.found && !mask.found) {
  416. var width = main.width,
  417. height = main.height;
  418. var offset = {
  419. x: width / height / 2,
  420. y: 0.5
  421. };
  422. attributes['style'] = joinStyles(_extends({}, styles, {
  423. 'transform-origin': offset.x + transform.x / 16 + 'em ' + (offset.y + transform.y / 16) + 'em'
  424. }));
  425. }
  426. return [{
  427. tag: 'svg',
  428. attributes: attributes,
  429. children: children
  430. }];
  431. };
  432. var asSymbol = function (_ref) {
  433. var prefix = _ref.prefix,
  434. iconName = _ref.iconName,
  435. children = _ref.children,
  436. attributes = _ref.attributes,
  437. symbol = _ref.symbol;
  438. var id = symbol === true ? prefix + '-' + config.familyPrefix + '-' + iconName : symbol;
  439. return [{
  440. tag: 'svg',
  441. attributes: {
  442. style: 'display: none;'
  443. },
  444. children: [{
  445. tag: 'symbol',
  446. attributes: _extends({}, attributes, { id: id }),
  447. children: children
  448. }]
  449. }];
  450. };
  451. function makeInlineSvgAbstract(params) {
  452. var _params$icons = params.icons,
  453. main = _params$icons.main,
  454. mask = _params$icons.mask,
  455. prefix = params.prefix,
  456. iconName = params.iconName,
  457. transform = params.transform,
  458. symbol = params.symbol,
  459. title = params.title,
  460. extra = params.extra,
  461. _params$watchable = params.watchable,
  462. watchable = _params$watchable === undefined ? false : _params$watchable;
  463. var _ref = mask.found ? mask : main,
  464. width = _ref.width,
  465. height = _ref.height;
  466. var widthClass = 'fa-w-' + Math.ceil(width / height * 16);
  467. var attrClass = [config.replacementClass, iconName ? config.familyPrefix + '-' + iconName : '', widthClass].filter(function (c) {
  468. return extra.classes.indexOf(c) === -1;
  469. }).concat(extra.classes).join(' ');
  470. var content = {
  471. children: [],
  472. attributes: _extends({}, extra.attributes, {
  473. 'data-prefix': prefix,
  474. 'data-icon': iconName,
  475. 'class': attrClass,
  476. 'role': 'img',
  477. 'xmlns': 'http://www.w3.org/2000/svg',
  478. 'viewBox': '0 0 ' + width + ' ' + height
  479. })
  480. };
  481. if (watchable) {
  482. content.attributes[DATA_FA_I2SVG] = '';
  483. }
  484. if (title) content.children.push({ tag: 'title', attributes: { id: content.attributes['aria-labelledby'] || 'title-' + nextUniqueId() }, children: [title] });
  485. var args = _extends({}, content, {
  486. prefix: prefix,
  487. iconName: iconName,
  488. main: main,
  489. mask: mask,
  490. transform: transform,
  491. symbol: symbol,
  492. styles: extra.styles
  493. });
  494. var _ref2 = mask.found && main.found ? makeIconMasking(args) : makeIconStandard(args),
  495. children = _ref2.children,
  496. attributes = _ref2.attributes;
  497. args.children = children;
  498. args.attributes = attributes;
  499. if (symbol) {
  500. return asSymbol(args);
  501. } else {
  502. return asIcon(args);
  503. }
  504. }
  505. function makeLayersTextAbstract(params) {
  506. var content = params.content,
  507. width = params.width,
  508. height = params.height,
  509. transform = params.transform,
  510. title = params.title,
  511. extra = params.extra,
  512. _params$watchable2 = params.watchable,
  513. watchable = _params$watchable2 === undefined ? false : _params$watchable2;
  514. var attributes = _extends({}, extra.attributes, title ? { 'title': title } : {}, {
  515. 'class': extra.classes.join(' ')
  516. });
  517. if (watchable) {
  518. attributes[DATA_FA_I2SVG] = '';
  519. }
  520. var styles = _extends({}, extra.styles);
  521. if (transformIsMeaningful(transform)) {
  522. styles['transform'] = transformForCss({ transform: transform, startCentered: true, width: width, height: height });
  523. styles['-webkit-transform'] = styles['transform'];
  524. }
  525. var styleString = joinStyles(styles);
  526. if (styleString.length > 0) {
  527. attributes['style'] = styleString;
  528. }
  529. var val = [];
  530. val.push({
  531. tag: 'span',
  532. attributes: attributes,
  533. children: [content]
  534. });
  535. if (title) {
  536. val.push({ tag: 'span', attributes: { class: 'sr-only' }, children: [title] });
  537. }
  538. return val;
  539. }
  540. function makeLayersCounterAbstract(params) {
  541. var content = params.content,
  542. title = params.title,
  543. extra = params.extra;
  544. var attributes = _extends({}, extra.attributes, title ? { 'title': title } : {}, {
  545. 'class': extra.classes.join(' ')
  546. });
  547. var styleString = joinStyles(extra.styles);
  548. if (styleString.length > 0) {
  549. attributes['style'] = styleString;
  550. }
  551. var val = [];
  552. val.push({
  553. tag: 'span',
  554. attributes: attributes,
  555. children: [content]
  556. });
  557. if (title) {
  558. val.push({ tag: 'span', attributes: { class: 'sr-only' }, children: [title] });
  559. }
  560. return val;
  561. }
  562. var noop$2 = function noop() {};
  563. var p = config.measurePerformance && PERFORMANCE && PERFORMANCE.mark && PERFORMANCE.measure ? PERFORMANCE : { mark: noop$2, measure: noop$2 };
  564. var preamble = 'FA "5.3.1"';
  565. var begin = function begin(name) {
  566. p.mark(preamble + ' ' + name + ' begins');
  567. return function () {
  568. return end(name);
  569. };
  570. };
  571. var end = function end(name) {
  572. p.mark(preamble + ' ' + name + ' ends');
  573. p.measure(preamble + ' ' + name, preamble + ' ' + name + ' begins', preamble + ' ' + name + ' ends');
  574. };
  575. var perf = { begin: begin, end: end };
  576. 'use strict';
  577. /**
  578. * Internal helper to bind a function known to have 4 arguments
  579. * to a given context.
  580. */
  581. var bindInternal4 = function bindInternal4 (func, thisContext) {
  582. return function (a, b, c, d) {
  583. return func.call(thisContext, a, b, c, d);
  584. };
  585. };
  586. 'use strict';
  587. /**
  588. * # Reduce
  589. *
  590. * A fast object `.reduce()` implementation.
  591. *
  592. * @param {Object} subject The object to reduce over.
  593. * @param {Function} fn The reducer function.
  594. * @param {mixed} initialValue The initial value for the reducer, defaults to subject[0].
  595. * @param {Object} thisContext The context for the reducer.
  596. * @return {mixed} The final result.
  597. */
  598. var reduce = function fastReduceObject (subject, fn, initialValue, thisContext) {
  599. var keys = Object.keys(subject),
  600. length = keys.length,
  601. iterator = thisContext !== undefined ? bindInternal4(fn, thisContext) : fn,
  602. i, key, result;
  603. if (initialValue === undefined) {
  604. i = 1;
  605. result = subject[keys[0]];
  606. }
  607. else {
  608. i = 0;
  609. result = initialValue;
  610. }
  611. for (; i < length; i++) {
  612. key = keys[i];
  613. result = iterator(result, subject[key], key, subject);
  614. }
  615. return result;
  616. };
  617. var styles$2 = namespace.styles;
  618. var shims = namespace.shims;
  619. var _byUnicode = {};
  620. var _byLigature = {};
  621. var _byOldName = {};
  622. var build = function build() {
  623. var lookup = function lookup(reducer) {
  624. return reduce(styles$2, function (o, style, prefix) {
  625. o[prefix] = reduce(style, reducer, {});
  626. return o;
  627. }, {});
  628. };
  629. _byUnicode = lookup(function (acc, icon, iconName) {
  630. acc[icon[3]] = iconName;
  631. return acc;
  632. });
  633. _byLigature = lookup(function (acc, icon, iconName) {
  634. var ligatures = icon[2];
  635. acc[iconName] = iconName;
  636. ligatures.forEach(function (ligature) {
  637. acc[ligature] = iconName;
  638. });
  639. return acc;
  640. });
  641. var hasRegular = 'far' in styles$2;
  642. _byOldName = reduce(shims, function (acc, shim) {
  643. var oldName = shim[0];
  644. var prefix = shim[1];
  645. var iconName = shim[2];
  646. if (prefix === 'far' && !hasRegular) {
  647. prefix = 'fas';
  648. }
  649. acc[oldName] = { prefix: prefix, iconName: iconName };
  650. return acc;
  651. }, {});
  652. };
  653. build();
  654. function byUnicode(prefix, unicode) {
  655. return _byUnicode[prefix][unicode];
  656. }
  657. function byLigature(prefix, ligature) {
  658. return _byLigature[prefix][ligature];
  659. }
  660. function byOldName(name) {
  661. return _byOldName[name] || { prefix: null, iconName: null };
  662. }
  663. var styles$1 = namespace.styles;
  664. var emptyCanonicalIcon = function emptyCanonicalIcon() {
  665. return { prefix: null, iconName: null, rest: [] };
  666. };
  667. function getCanonicalIcon(values) {
  668. return values.reduce(function (acc, cls) {
  669. var iconName = getIconName(config.familyPrefix, cls);
  670. if (styles$1[cls]) {
  671. acc.prefix = cls;
  672. } else if (iconName) {
  673. var shim = acc.prefix === 'fa' ? byOldName(iconName) : {};
  674. acc.iconName = shim.iconName || iconName;
  675. acc.prefix = shim.prefix || acc.prefix;
  676. } else if (cls !== config.replacementClass && cls.indexOf('fa-w-') !== 0) {
  677. acc.rest.push(cls);
  678. }
  679. return acc;
  680. }, emptyCanonicalIcon());
  681. }
  682. function iconFromMapping(mapping, prefix, iconName) {
  683. if (mapping && mapping[prefix] && mapping[prefix][iconName]) {
  684. return {
  685. prefix: prefix,
  686. iconName: iconName,
  687. icon: mapping[prefix][iconName]
  688. };
  689. }
  690. }
  691. function toHtml(abstractNodes) {
  692. var tag = abstractNodes.tag,
  693. _abstractNodes$attrib = abstractNodes.attributes,
  694. attributes = _abstractNodes$attrib === undefined ? {} : _abstractNodes$attrib,
  695. _abstractNodes$childr = abstractNodes.children,
  696. children = _abstractNodes$childr === undefined ? [] : _abstractNodes$childr;
  697. if (typeof abstractNodes === 'string') {
  698. return htmlEscape(abstractNodes);
  699. } else {
  700. return '<' + tag + ' ' + joinAttributes(attributes) + '>' + children.map(toHtml).join('') + '</' + tag + '>';
  701. }
  702. }
  703. var noop$1 = function noop() {};
  704. function isWatched(node) {
  705. var i2svg = node.getAttribute ? node.getAttribute(DATA_FA_I2SVG) : null;
  706. return typeof i2svg === 'string';
  707. }
  708. function getMutator() {
  709. if (config.autoReplaceSvg === true) {
  710. return mutators.replace;
  711. }
  712. var mutator = mutators[config.autoReplaceSvg];
  713. return mutator || mutators.replace;
  714. }
  715. var mutators = {
  716. replace: function replace(mutation) {
  717. var node = mutation[0];
  718. var abstract = mutation[1];
  719. var newOuterHTML = abstract.map(function (a) {
  720. return toHtml(a);
  721. }).join('\n');
  722. if (node.parentNode && node.outerHTML) {
  723. node.outerHTML = newOuterHTML + (config.keepOriginalSource && node.tagName.toLowerCase() !== 'svg' ? '<!-- ' + node.outerHTML + ' -->' : '');
  724. } else if (node.parentNode) {
  725. var newNode = document.createElement('span');
  726. node.parentNode.replaceChild(newNode, node);
  727. newNode.outerHTML = newOuterHTML;
  728. }
  729. },
  730. nest: function nest(mutation) {
  731. var node = mutation[0];
  732. var abstract = mutation[1];
  733. // If we already have a replaced node we do not want to continue nesting within it.
  734. // Short-circuit to the standard replacement
  735. if (~classArray(node).indexOf(config.replacementClass)) {
  736. return mutators.replace(mutation);
  737. }
  738. var forSvg = new RegExp(config.familyPrefix + '-.*');
  739. delete abstract[0].attributes.style;
  740. var splitClasses = abstract[0].attributes.class.split(' ').reduce(function (acc, cls) {
  741. if (cls === config.replacementClass || cls.match(forSvg)) {
  742. acc.toSvg.push(cls);
  743. } else {
  744. acc.toNode.push(cls);
  745. }
  746. return acc;
  747. }, { toNode: [], toSvg: [] });
  748. abstract[0].attributes.class = splitClasses.toSvg.join(' ');
  749. var newInnerHTML = abstract.map(function (a) {
  750. return toHtml(a);
  751. }).join('\n');
  752. node.setAttribute('class', splitClasses.toNode.join(' '));
  753. node.setAttribute(DATA_FA_I2SVG, '');
  754. node.innerHTML = newInnerHTML;
  755. }
  756. };
  757. function perform(mutations, callback) {
  758. var callbackFunction = typeof callback === 'function' ? callback : noop$1;
  759. if (mutations.length === 0) {
  760. callbackFunction();
  761. } else {
  762. var frame = WINDOW.requestAnimationFrame || function (op) {
  763. return op();
  764. };
  765. frame(function () {
  766. var mutator = getMutator();
  767. var mark = perf.begin('mutate');
  768. mutations.map(mutator);
  769. mark();
  770. callbackFunction();
  771. });
  772. }
  773. }
  774. var disabled = false;
  775. function disableObservation(operation) {
  776. disabled = true;
  777. operation();
  778. disabled = false;
  779. }
  780. var mo = null;
  781. function observe(options) {
  782. if (!MUTATION_OBSERVER) {
  783. return;
  784. }
  785. if (!config.observeMutations) {
  786. return;
  787. }
  788. var treeCallback = options.treeCallback,
  789. nodeCallback = options.nodeCallback,
  790. pseudoElementsCallback = options.pseudoElementsCallback,
  791. _options$observeMutat = options.observeMutationsRoot,
  792. observeMutationsRoot = _options$observeMutat === undefined ? DOCUMENT.body : _options$observeMutat;
  793. mo = new MUTATION_OBSERVER(function (objects) {
  794. if (disabled) return;
  795. toArray(objects).forEach(function (mutationRecord) {
  796. if (mutationRecord.type === 'childList' && mutationRecord.addedNodes.length > 0 && !isWatched(mutationRecord.addedNodes[0])) {
  797. if (config.searchPseudoElements) {
  798. pseudoElementsCallback(mutationRecord.target);
  799. }
  800. treeCallback(mutationRecord.target);
  801. }
  802. if (mutationRecord.type === 'attributes' && mutationRecord.target.parentNode && config.searchPseudoElements) {
  803. pseudoElementsCallback(mutationRecord.target.parentNode);
  804. }
  805. if (mutationRecord.type === 'attributes' && isWatched(mutationRecord.target) && ~ATTRIBUTES_WATCHED_FOR_MUTATION.indexOf(mutationRecord.attributeName)) {
  806. if (mutationRecord.attributeName === 'class') {
  807. var _getCanonicalIcon = getCanonicalIcon(classArray(mutationRecord.target)),
  808. prefix = _getCanonicalIcon.prefix,
  809. iconName = _getCanonicalIcon.iconName;
  810. if (prefix) mutationRecord.target.setAttribute('data-prefix', prefix);
  811. if (iconName) mutationRecord.target.setAttribute('data-icon', iconName);
  812. } else {
  813. nodeCallback(mutationRecord.target);
  814. }
  815. }
  816. });
  817. });
  818. if (!IS_DOM) return;
  819. mo.observe(observeMutationsRoot, {
  820. childList: true, attributes: true, characterData: true, subtree: true
  821. });
  822. }
  823. function disconnect() {
  824. if (!mo) return;
  825. mo.disconnect();
  826. }
  827. var styleParser = function (node) {
  828. var style = node.getAttribute('style');
  829. var val = [];
  830. if (style) {
  831. val = style.split(';').reduce(function (acc, style) {
  832. var styles = style.split(':');
  833. var prop = styles[0];
  834. var value = styles.slice(1);
  835. if (prop && value.length > 0) {
  836. acc[prop] = value.join(':').trim();
  837. }
  838. return acc;
  839. }, {});
  840. }
  841. return val;
  842. };
  843. function toHex(unicode) {
  844. var result = '';
  845. for (var i = 0; i < unicode.length; i++) {
  846. var hex = unicode.charCodeAt(i).toString(16);
  847. result += ('000' + hex).slice(-4);
  848. }
  849. return result;
  850. }
  851. var classParser = function (node) {
  852. var existingPrefix = node.getAttribute('data-prefix');
  853. var existingIconName = node.getAttribute('data-icon');
  854. var innerText = node.innerText !== undefined ? node.innerText.trim() : '';
  855. var val = getCanonicalIcon(classArray(node));
  856. if (existingPrefix && existingIconName) {
  857. val.prefix = existingPrefix;
  858. val.iconName = existingIconName;
  859. }
  860. if (val.prefix && innerText.length > 1) {
  861. val.iconName = byLigature(val.prefix, node.innerText);
  862. } else if (val.prefix && innerText.length === 1) {
  863. val.iconName = byUnicode(val.prefix, toHex(node.innerText));
  864. }
  865. return val;
  866. };
  867. var parseTransformString = function parseTransformString(transformString) {
  868. var transform = {
  869. size: 16,
  870. x: 0,
  871. y: 0,
  872. flipX: false,
  873. flipY: false,
  874. rotate: 0
  875. };
  876. if (!transformString) {
  877. return transform;
  878. } else {
  879. return transformString.toLowerCase().split(' ').reduce(function (acc, n) {
  880. var parts = n.toLowerCase().split('-');
  881. var first = parts[0];
  882. var rest = parts.slice(1).join('-');
  883. if (first && rest === 'h') {
  884. acc.flipX = true;
  885. return acc;
  886. }
  887. if (first && rest === 'v') {
  888. acc.flipY = true;
  889. return acc;
  890. }
  891. rest = parseFloat(rest);
  892. if (isNaN(rest)) {
  893. return acc;
  894. }
  895. switch (first) {
  896. case 'grow':
  897. acc.size = acc.size + rest;
  898. break;
  899. case 'shrink':
  900. acc.size = acc.size - rest;
  901. break;
  902. case 'left':
  903. acc.x = acc.x - rest;
  904. break;
  905. case 'right':
  906. acc.x = acc.x + rest;
  907. break;
  908. case 'up':
  909. acc.y = acc.y - rest;
  910. break;
  911. case 'down':
  912. acc.y = acc.y + rest;
  913. break;
  914. case 'rotate':
  915. acc.rotate = acc.rotate + rest;
  916. break;
  917. }
  918. return acc;
  919. }, transform);
  920. }
  921. };
  922. var transformParser = function (node) {
  923. return parseTransformString(node.getAttribute('data-fa-transform'));
  924. };
  925. var symbolParser = function (node) {
  926. var symbol = node.getAttribute('data-fa-symbol');
  927. return symbol === null ? false : symbol === '' ? true : symbol;
  928. };
  929. var attributesParser = function (node) {
  930. var extraAttributes = toArray(node.attributes).reduce(function (acc, attr) {
  931. if (acc.name !== 'class' && acc.name !== 'style') {
  932. acc[attr.name] = attr.value;
  933. }
  934. return acc;
  935. }, {});
  936. var title = node.getAttribute('title');
  937. if (config.autoA11y) {
  938. if (title) {
  939. extraAttributes['aria-labelledby'] = config.replacementClass + '-title-' + nextUniqueId();
  940. } else {
  941. extraAttributes['aria-hidden'] = 'true';
  942. }
  943. }
  944. return extraAttributes;
  945. };
  946. var maskParser = function (node) {
  947. var mask = node.getAttribute('data-fa-mask');
  948. if (!mask) {
  949. return emptyCanonicalIcon();
  950. } else {
  951. return getCanonicalIcon(mask.split(' ').map(function (i) {
  952. return i.trim();
  953. }));
  954. }
  955. };
  956. var blankMeta = {
  957. iconName: null,
  958. title: null,
  959. prefix: null,
  960. transform: meaninglessTransform,
  961. symbol: false,
  962. mask: null,
  963. extra: { classes: [], styles: {}, attributes: {} }
  964. };
  965. function parseMeta(node) {
  966. var _classParser = classParser(node),
  967. iconName = _classParser.iconName,
  968. prefix = _classParser.prefix,
  969. extraClasses = _classParser.rest;
  970. var extraStyles = styleParser(node);
  971. var transform = transformParser(node);
  972. var symbol = symbolParser(node);
  973. var extraAttributes = attributesParser(node);
  974. var mask = maskParser(node);
  975. return {
  976. iconName: iconName,
  977. title: node.getAttribute('title'),
  978. prefix: prefix,
  979. transform: transform,
  980. symbol: symbol,
  981. mask: mask,
  982. extra: {
  983. classes: extraClasses,
  984. styles: extraStyles,
  985. attributes: extraAttributes
  986. }
  987. };
  988. }
  989. function MissingIcon(error) {
  990. this.name = 'MissingIcon';
  991. this.message = error || 'Icon unavailable';
  992. this.stack = new Error().stack;
  993. }
  994. MissingIcon.prototype = Object.create(Error.prototype);
  995. MissingIcon.prototype.constructor = MissingIcon;
  996. var FILL = { fill: 'currentColor' };
  997. var ANIMATION_BASE = {
  998. attributeType: 'XML',
  999. repeatCount: 'indefinite',
  1000. dur: '2s'
  1001. };
  1002. var RING = {
  1003. tag: 'path',
  1004. attributes: _extends({}, FILL, {
  1005. 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'
  1006. })
  1007. };
  1008. var OPACITY_ANIMATE = _extends({}, ANIMATION_BASE, {
  1009. attributeName: 'opacity'
  1010. });
  1011. var DOT = {
  1012. tag: 'circle',
  1013. attributes: _extends({}, FILL, {
  1014. cx: '256',
  1015. cy: '364',
  1016. r: '28'
  1017. }),
  1018. children: [{ tag: 'animate', attributes: _extends({}, ANIMATION_BASE, { attributeName: 'r', values: '28;14;28;28;14;28;' }) }, { tag: 'animate', attributes: _extends({}, OPACITY_ANIMATE, { values: '1;0;1;1;0;1;' }) }]
  1019. };
  1020. var QUESTION = {
  1021. tag: 'path',
  1022. attributes: _extends({}, FILL, {
  1023. opacity: '1',
  1024. 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'
  1025. }),
  1026. children: [{ tag: 'animate', attributes: _extends({}, OPACITY_ANIMATE, { values: '1;0;0;0;0;1;' }) }]
  1027. };
  1028. var EXCLAMATION = {
  1029. tag: 'path',
  1030. attributes: _extends({}, FILL, {
  1031. opacity: '0',
  1032. 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'
  1033. }),
  1034. children: [{ tag: 'animate', attributes: _extends({}, OPACITY_ANIMATE, { values: '0;0;1;1;0;0;' }) }]
  1035. };
  1036. var missing = { tag: 'g', children: [RING, DOT, QUESTION, EXCLAMATION] };
  1037. var styles = namespace.styles;
  1038. var LAYERS_TEXT_CLASSNAME = 'fa-layers-text';
  1039. var FONT_FAMILY_PATTERN = /Font Awesome 5 (Solid|Regular|Light|Brands|Free|Pro)/;
  1040. var STYLE_TO_PREFIX = {
  1041. 'Solid': 'fas',
  1042. 'Regular': 'far',
  1043. 'Light': 'fal',
  1044. 'Brands': 'fab'
  1045. };
  1046. var FONT_WEIGHT_TO_PREFIX = {
  1047. '900': 'fas',
  1048. '400': 'far',
  1049. '300': 'fal'
  1050. };
  1051. function findIcon(iconName, prefix) {
  1052. var val = {
  1053. found: false,
  1054. width: 512,
  1055. height: 512,
  1056. icon: missing
  1057. };
  1058. if (iconName && prefix && styles[prefix] && styles[prefix][iconName]) {
  1059. var icon = styles[prefix][iconName];
  1060. var width = icon[0];
  1061. var height = icon[1];
  1062. var vectorData = icon.slice(4);
  1063. val = {
  1064. found: true,
  1065. width: width,
  1066. height: height,
  1067. icon: { tag: 'path', attributes: { fill: 'currentColor', d: vectorData[0] } }
  1068. };
  1069. } else if (iconName && prefix && !config.showMissingIcons) {
  1070. throw new MissingIcon('Icon is missing for prefix ' + prefix + ' with icon name ' + iconName);
  1071. }
  1072. return val;
  1073. }
  1074. function generateSvgReplacementMutation(node, nodeMeta) {
  1075. var iconName = nodeMeta.iconName,
  1076. title = nodeMeta.title,
  1077. prefix = nodeMeta.prefix,
  1078. transform = nodeMeta.transform,
  1079. symbol = nodeMeta.symbol,
  1080. mask = nodeMeta.mask,
  1081. extra = nodeMeta.extra;
  1082. return [node, makeInlineSvgAbstract({
  1083. icons: {
  1084. main: findIcon(iconName, prefix),
  1085. mask: findIcon(mask.iconName, mask.prefix)
  1086. },
  1087. prefix: prefix,
  1088. iconName: iconName,
  1089. transform: transform,
  1090. symbol: symbol,
  1091. mask: mask,
  1092. title: title,
  1093. extra: extra,
  1094. watchable: true
  1095. })];
  1096. }
  1097. function generateLayersText(node, nodeMeta) {
  1098. var title = nodeMeta.title,
  1099. transform = nodeMeta.transform,
  1100. extra = nodeMeta.extra;
  1101. var width = null;
  1102. var height = null;
  1103. if (IS_IE) {
  1104. var computedFontSize = parseInt(getComputedStyle(node).fontSize, 10);
  1105. var boundingClientRect = node.getBoundingClientRect();
  1106. width = boundingClientRect.width / computedFontSize;
  1107. height = boundingClientRect.height / computedFontSize;
  1108. }
  1109. if (config.autoA11y && !title) {
  1110. extra.attributes['aria-hidden'] = 'true';
  1111. }
  1112. return [node, makeLayersTextAbstract({
  1113. content: node.innerHTML,
  1114. width: width,
  1115. height: height,
  1116. transform: transform,
  1117. title: title,
  1118. extra: extra,
  1119. watchable: true
  1120. })];
  1121. }
  1122. function generateMutation(node) {
  1123. var nodeMeta = parseMeta(node);
  1124. if (~nodeMeta.extra.classes.indexOf(LAYERS_TEXT_CLASSNAME)) {
  1125. return generateLayersText(node, nodeMeta);
  1126. } else {
  1127. return generateSvgReplacementMutation(node, nodeMeta);
  1128. }
  1129. }
  1130. function searchPseudoElements(root) {
  1131. if (!IS_DOM) return;
  1132. var end = perf.begin('searchPseudoElements');
  1133. disableObservation(function () {
  1134. toArray(root.querySelectorAll('*')).filter(function (n) {
  1135. return n.parentNode !== document.head && !~TAGNAMES_TO_SKIP_FOR_PSEUDOELEMENTS.indexOf(n.tagName.toUpperCase()) && !n.getAttribute(DATA_FA_PSEUDO_ELEMENT) && (!n.parentNode || n.parentNode.tagName !== 'svg');
  1136. }).forEach(function (node) {
  1137. [':before', ':after'].forEach(function (pos) {
  1138. var children = toArray(node.children);
  1139. var alreadyProcessedPseudoElement = children.filter(function (c) {
  1140. return c.getAttribute(DATA_FA_PSEUDO_ELEMENT) === pos;
  1141. })[0];
  1142. var styles = WINDOW.getComputedStyle(node, pos);
  1143. var fontFamily = styles.getPropertyValue('font-family').match(FONT_FAMILY_PATTERN);
  1144. var fontWeight = styles.getPropertyValue('font-weight');
  1145. if (alreadyProcessedPseudoElement && !fontFamily) {
  1146. // If we've already processed it but the current computed style does not result in a font-family,
  1147. // that probably means that a class name that was previously present to make the icon has been
  1148. // removed. So we now should delete the icon.
  1149. node.removeChild(alreadyProcessedPseudoElement);
  1150. } else if (fontFamily) {
  1151. var content = styles.getPropertyValue('content');
  1152. var prefix = ~['Light', 'Regular', 'Solid', 'Brands'].indexOf(fontFamily[1]) ? STYLE_TO_PREFIX[fontFamily[1]] : FONT_WEIGHT_TO_PREFIX[fontWeight];
  1153. var iconName = byUnicode(prefix, toHex(content.length === 3 ? content.substr(1, 1) : content));
  1154. // Only convert the pseudo element in this :before/:after position into an icon if we haven't
  1155. // already done so with the same prefix and iconName
  1156. if (!alreadyProcessedPseudoElement || alreadyProcessedPseudoElement.getAttribute(DATA_PREFIX) !== prefix || alreadyProcessedPseudoElement.getAttribute(DATA_ICON) !== iconName) {
  1157. if (alreadyProcessedPseudoElement) {
  1158. // Delete the old one, since we're replacing it with a new one
  1159. node.removeChild(alreadyProcessedPseudoElement);
  1160. }
  1161. var extra = blankMeta.extra;
  1162. extra.attributes[DATA_FA_PSEUDO_ELEMENT] = pos;
  1163. var abstract = makeInlineSvgAbstract(_extends({}, blankMeta, {
  1164. icons: {
  1165. main: findIcon(iconName, prefix),
  1166. mask: emptyCanonicalIcon()
  1167. },
  1168. prefix: prefix,
  1169. iconName: iconName,
  1170. extra: extra,
  1171. watchable: true
  1172. }));
  1173. var element = DOCUMENT.createElement('svg');
  1174. if (pos === ':before') {
  1175. node.insertBefore(element, node.firstChild);
  1176. } else {
  1177. node.appendChild(element);
  1178. }
  1179. element.outerHTML = abstract.map(function (a) {
  1180. return toHtml(a);
  1181. }).join('\n');
  1182. }
  1183. }
  1184. });
  1185. });
  1186. });
  1187. end();
  1188. }
  1189. function onTree(root) {
  1190. var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  1191. if (!IS_DOM) return;
  1192. var htmlClassList = DOCUMENT.documentElement.classList;
  1193. var hclAdd = function hclAdd(suffix) {
  1194. return htmlClassList.add(HTML_CLASS_I2SVG_BASE_CLASS + '-' + suffix);
  1195. };
  1196. var hclRemove = function hclRemove(suffix) {
  1197. return htmlClassList.remove(HTML_CLASS_I2SVG_BASE_CLASS + '-' + suffix);
  1198. };
  1199. var prefixes = Object.keys(styles);
  1200. var prefixesDomQuery = ['.' + LAYERS_TEXT_CLASSNAME + ':not([' + DATA_FA_I2SVG + '])'].concat(prefixes.map(function (p) {
  1201. return '.' + p + ':not([' + DATA_FA_I2SVG + '])';
  1202. })).join(', ');
  1203. if (prefixesDomQuery.length === 0) {
  1204. return;
  1205. }
  1206. var candidates = toArray(root.querySelectorAll(prefixesDomQuery));
  1207. if (candidates.length > 0) {
  1208. hclAdd('pending');
  1209. hclRemove('complete');
  1210. } else {
  1211. return;
  1212. }
  1213. var mark = perf.begin('onTree');
  1214. var mutations = candidates.reduce(function (acc, node) {
  1215. try {
  1216. var mutation = generateMutation(node);
  1217. if (mutation) {
  1218. acc.push(mutation);
  1219. }
  1220. } catch (e) {
  1221. if (!PRODUCTION) {
  1222. if (e instanceof MissingIcon) {
  1223. console.error(e);
  1224. }
  1225. }
  1226. }
  1227. return acc;
  1228. }, []);
  1229. mark();
  1230. perform(mutations, function () {
  1231. hclAdd('active');
  1232. hclAdd('complete');
  1233. hclRemove('pending');
  1234. if (typeof callback === 'function') callback();
  1235. });
  1236. }
  1237. function onNode(node) {
  1238. var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  1239. var mutation = generateMutation(node);
  1240. if (mutation) {
  1241. perform([mutation], callback);
  1242. }
  1243. }
  1244. 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.33333em;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-horizontal.fa-flip-vertical{-webkit-transform:scale(-1,-1);transform:scale(-1,-1)}: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:2em}.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:1em}.svg-inline--fa.fa-stack-2x{height:2em;width:2em}.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}";
  1245. var css = function () {
  1246. var dfp = DEFAULT_FAMILY_PREFIX;
  1247. var drc = DEFAULT_REPLACEMENT_CLASS;
  1248. var fp = config.familyPrefix;
  1249. var rc = config.replacementClass;
  1250. var s = baseStyles;
  1251. if (fp !== dfp || rc !== drc) {
  1252. var dPatt = new RegExp('\\.' + dfp + '\\-', 'g');
  1253. var rPatt = new RegExp('\\.' + drc, 'g');
  1254. s = s.replace(dPatt, '.' + fp + '-').replace(rPatt, '.' + rc);
  1255. }
  1256. return s;
  1257. };
  1258. function define(prefix, icons) {
  1259. var normalized = Object.keys(icons).reduce(function (acc, iconName) {
  1260. var icon = icons[iconName];
  1261. var expanded = !!icon.icon;
  1262. if (expanded) {
  1263. acc[icon.iconName] = icon.icon;
  1264. } else {
  1265. acc[iconName] = icon;
  1266. }
  1267. return acc;
  1268. }, {});
  1269. if (typeof namespace.hooks.addPack === 'function') {
  1270. namespace.hooks.addPack(prefix, normalized);
  1271. } else {
  1272. namespace.styles[prefix] = _extends({}, namespace.styles[prefix] || {}, normalized);
  1273. }
  1274. /**
  1275. * Font Awesome 4 used the prefix of `fa` for all icons. With the introduction
  1276. * of new styles we needed to differentiate between them. Prefix `fa` is now an alias
  1277. * for `fas` so we'll easy the upgrade process for our users by automatically defining
  1278. * this as well.
  1279. */
  1280. if (prefix === 'fas') {
  1281. define('fa', icons);
  1282. }
  1283. }
  1284. var Library = function () {
  1285. function Library() {
  1286. classCallCheck(this, Library);
  1287. this.definitions = {};
  1288. }
  1289. createClass(Library, [{
  1290. key: 'add',
  1291. value: function add() {
  1292. var _this = this;
  1293. for (var _len = arguments.length, definitions = Array(_len), _key = 0; _key < _len; _key++) {
  1294. definitions[_key] = arguments[_key];
  1295. }
  1296. var additions = definitions.reduce(this._pullDefinitions, {});
  1297. Object.keys(additions).forEach(function (key) {
  1298. _this.definitions[key] = _extends({}, _this.definitions[key] || {}, additions[key]);
  1299. define(key, additions[key]);
  1300. build();
  1301. });
  1302. }
  1303. }, {
  1304. key: 'reset',
  1305. value: function reset() {
  1306. this.definitions = {};
  1307. }
  1308. }, {
  1309. key: '_pullDefinitions',
  1310. value: function _pullDefinitions(additions, definition) {
  1311. var normalized = definition.prefix && definition.iconName && definition.icon ? { 0: definition } : definition;
  1312. Object.keys(normalized).map(function (key) {
  1313. var _normalized$key = normalized[key],
  1314. prefix = _normalized$key.prefix,
  1315. iconName = _normalized$key.iconName,
  1316. icon = _normalized$key.icon;
  1317. if (!additions[prefix]) additions[prefix] = {};
  1318. additions[prefix][iconName] = icon;
  1319. });
  1320. return additions;
  1321. }
  1322. }]);
  1323. return Library;
  1324. }();
  1325. function prepIcon(icon) {
  1326. var width = icon[0];
  1327. var height = icon[1];
  1328. var vectorData = icon.slice(4);
  1329. return {
  1330. found: true,
  1331. width: width,
  1332. height: height,
  1333. icon: { tag: 'path', attributes: { fill: 'currentColor', d: vectorData[0] } }
  1334. };
  1335. }
  1336. function ensureCss() {
  1337. if (config.autoAddCss && !_cssInserted) {
  1338. insertCss(css());
  1339. _cssInserted = true;
  1340. }
  1341. }
  1342. function apiObject(val, abstractCreator) {
  1343. Object.defineProperty(val, 'abstract', {
  1344. get: abstractCreator
  1345. });
  1346. Object.defineProperty(val, 'html', {
  1347. get: function get() {
  1348. return val.abstract.map(function (a) {
  1349. return toHtml(a);
  1350. });
  1351. }
  1352. });
  1353. Object.defineProperty(val, 'node', {
  1354. get: function get() {
  1355. if (!IS_DOM) return;
  1356. var container = DOCUMENT.createElement('div');
  1357. container.innerHTML = val.html;
  1358. return container.children;
  1359. }
  1360. });
  1361. return val;
  1362. }
  1363. function findIconDefinition(params) {
  1364. var _params$prefix = params.prefix,
  1365. prefix = _params$prefix === undefined ? 'fa' : _params$prefix,
  1366. iconName = params.iconName;
  1367. if (!iconName) return;
  1368. return iconFromMapping(library.definitions, prefix, iconName) || iconFromMapping(namespace.styles, prefix, iconName);
  1369. }
  1370. function resolveIcons(next) {
  1371. return function (maybeIconDefinition) {
  1372. var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1373. var iconDefinition = (maybeIconDefinition || {}).icon ? maybeIconDefinition : findIconDefinition(maybeIconDefinition || {});
  1374. var mask = params.mask;
  1375. if (mask) {
  1376. mask = (mask || {}).icon ? mask : findIconDefinition(mask || {});
  1377. }
  1378. return next(iconDefinition, _extends({}, params, { mask: mask }));
  1379. };
  1380. }
  1381. var library = new Library();
  1382. var noAuto = function noAuto() {
  1383. config.autoReplaceSvg = false;
  1384. config.observeMutations = false;
  1385. disconnect();
  1386. };
  1387. var _cssInserted = false;
  1388. var dom = {
  1389. i2svg: function i2svg() {
  1390. var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1391. if (IS_DOM) {
  1392. ensureCss();
  1393. var _params$node = params.node,
  1394. node = _params$node === undefined ? DOCUMENT : _params$node,
  1395. _params$callback = params.callback,
  1396. callback = _params$callback === undefined ? function () {} : _params$callback;
  1397. if (config.searchPseudoElements) {
  1398. searchPseudoElements(node);
  1399. }
  1400. onTree(node, callback);
  1401. }
  1402. },
  1403. css: css,
  1404. insertCss: function insertCss$$1() {
  1405. if (!_cssInserted) {
  1406. insertCss(css());
  1407. _cssInserted = true;
  1408. }
  1409. },
  1410. watch: function watch() {
  1411. var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1412. var autoReplaceSvgRoot = params.autoReplaceSvgRoot,
  1413. observeMutationsRoot = params.observeMutationsRoot;
  1414. if (config.autoReplaceSvg === false) {
  1415. config.autoReplaceSvg = true;
  1416. }
  1417. config.observeMutations = true;
  1418. domready(function () {
  1419. autoReplace({
  1420. autoReplaceSvgRoot: autoReplaceSvgRoot
  1421. });
  1422. observe({
  1423. treeCallback: onTree,
  1424. nodeCallback: onNode,
  1425. pseudoElementsCallback: searchPseudoElements,
  1426. observeMutationsRoot: observeMutationsRoot
  1427. });
  1428. });
  1429. }
  1430. };
  1431. var parse = {
  1432. transform: function transform(transformString) {
  1433. return parseTransformString(transformString);
  1434. }
  1435. };
  1436. var icon = resolveIcons(function (iconDefinition) {
  1437. var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1438. var _params$transform = params.transform,
  1439. transform = _params$transform === undefined ? meaninglessTransform : _params$transform,
  1440. _params$symbol = params.symbol,
  1441. symbol = _params$symbol === undefined ? false : _params$symbol,
  1442. _params$mask = params.mask,
  1443. mask = _params$mask === undefined ? null : _params$mask,
  1444. _params$title = params.title,
  1445. title = _params$title === undefined ? null : _params$title,
  1446. _params$classes = params.classes,
  1447. classes = _params$classes === undefined ? [] : _params$classes,
  1448. _params$attributes = params.attributes,
  1449. attributes = _params$attributes === undefined ? {} : _params$attributes,
  1450. _params$styles = params.styles,
  1451. styles = _params$styles === undefined ? {} : _params$styles;
  1452. if (!iconDefinition) return;
  1453. var prefix = iconDefinition.prefix,
  1454. iconName = iconDefinition.iconName,
  1455. icon = iconDefinition.icon;
  1456. return apiObject(_extends({ type: 'icon' }, iconDefinition), function () {
  1457. ensureCss();
  1458. if (config.autoA11y) {
  1459. if (title) {
  1460. attributes['aria-labelledby'] = config.replacementClass + '-title-' + nextUniqueId();
  1461. } else {
  1462. attributes['aria-hidden'] = 'true';
  1463. }
  1464. }
  1465. return makeInlineSvgAbstract({
  1466. icons: {
  1467. main: prepIcon(icon),
  1468. mask: mask ? prepIcon(mask.icon) : { found: false, width: null, height: null, icon: {} }
  1469. },
  1470. prefix: prefix,
  1471. iconName: iconName,
  1472. transform: _extends({}, meaninglessTransform, transform),
  1473. symbol: symbol,
  1474. title: title,
  1475. extra: {
  1476. attributes: attributes,
  1477. styles: styles,
  1478. classes: classes
  1479. }
  1480. });
  1481. });
  1482. });
  1483. var text = function text(content) {
  1484. var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1485. var _params$transform2 = params.transform,
  1486. transform = _params$transform2 === undefined ? meaninglessTransform : _params$transform2,
  1487. _params$title2 = params.title,
  1488. title = _params$title2 === undefined ? null : _params$title2,
  1489. _params$classes2 = params.classes,
  1490. classes = _params$classes2 === undefined ? [] : _params$classes2,
  1491. _params$attributes2 = params.attributes,
  1492. attributes = _params$attributes2 === undefined ? {} : _params$attributes2,
  1493. _params$styles2 = params.styles,
  1494. styles = _params$styles2 === undefined ? {} : _params$styles2;
  1495. return apiObject({ type: 'text', content: content }, function () {
  1496. ensureCss();
  1497. return makeLayersTextAbstract({
  1498. content: content,
  1499. transform: _extends({}, meaninglessTransform, transform),
  1500. title: title,
  1501. extra: {
  1502. attributes: attributes,
  1503. styles: styles,
  1504. classes: [config.familyPrefix + '-layers-text'].concat(toConsumableArray(classes))
  1505. }
  1506. });
  1507. });
  1508. };
  1509. var counter = function counter(content) {
  1510. var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1511. var _params$title3 = params.title,
  1512. title = _params$title3 === undefined ? null : _params$title3,
  1513. _params$classes3 = params.classes,
  1514. classes = _params$classes3 === undefined ? [] : _params$classes3,
  1515. _params$attributes3 = params.attributes,
  1516. attributes = _params$attributes3 === undefined ? {} : _params$attributes3,
  1517. _params$styles3 = params.styles,
  1518. styles = _params$styles3 === undefined ? {} : _params$styles3;
  1519. return apiObject({ type: 'counter', content: content }, function () {
  1520. ensureCss();
  1521. return makeLayersCounterAbstract({
  1522. content: content.toString(),
  1523. title: title,
  1524. extra: {
  1525. attributes: attributes,
  1526. styles: styles,
  1527. classes: [config.familyPrefix + '-layers-counter'].concat(toConsumableArray(classes))
  1528. }
  1529. });
  1530. });
  1531. };
  1532. var layer = function layer(assembler) {
  1533. return apiObject({ type: 'layer' }, function () {
  1534. ensureCss();
  1535. var children = [];
  1536. assembler(function (args) {
  1537. Array.isArray(args) ? args.map(function (a) {
  1538. children = children.concat(a.abstract);
  1539. }) : children = children.concat(args.abstract);
  1540. });
  1541. return [{
  1542. tag: 'span',
  1543. attributes: { class: config.familyPrefix + '-layers' },
  1544. children: children
  1545. }];
  1546. });
  1547. };
  1548. var api = {
  1549. noAuto: noAuto,
  1550. config: config,
  1551. dom: dom,
  1552. library: library,
  1553. parse: parse,
  1554. findIconDefinition: findIconDefinition,
  1555. icon: icon,
  1556. text: text,
  1557. counter: counter,
  1558. layer: layer,
  1559. toHtml: toHtml
  1560. };
  1561. var autoReplace = function autoReplace() {
  1562. var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1563. var _params$autoReplaceSv = params.autoReplaceSvgRoot,
  1564. autoReplaceSvgRoot = _params$autoReplaceSv === undefined ? DOCUMENT : _params$autoReplaceSv;
  1565. if (Object.keys(namespace.styles).length > 0 && IS_DOM && config.autoReplaceSvg) api.dom.i2svg({ node: autoReplaceSvgRoot });
  1566. };
  1567. function bootstrap() {
  1568. if (IS_BROWSER) {
  1569. if (!WINDOW.FontAwesome) {
  1570. WINDOW.FontAwesome = api;
  1571. }
  1572. domready(function () {
  1573. autoReplace();
  1574. observe({
  1575. treeCallback: onTree,
  1576. nodeCallback: onNode,
  1577. pseudoElementsCallback: searchPseudoElements
  1578. });
  1579. });
  1580. }
  1581. namespace.hooks = _extends({}, namespace.hooks, {
  1582. addPack: function addPack(prefix, icons) {
  1583. namespace.styles[prefix] = _extends({}, namespace.styles[prefix] || {}, icons);
  1584. build();
  1585. autoReplace();
  1586. },
  1587. addShims: function addShims(shims) {
  1588. var _namespace$shims;
  1589. (_namespace$shims = namespace.shims).push.apply(_namespace$shims, toConsumableArray(shims));
  1590. build();
  1591. autoReplace();
  1592. }
  1593. });
  1594. }
  1595. bunker(bootstrap);
  1596. }());