fontawesome.js 97 KB

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