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