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