react-svg 14.1.19 → 15.0.2
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/dist/react-svg.cjs.development.js.map +1 -1
- package/dist/react-svg.cjs.production.js.map +1 -1
- package/dist/react-svg.esm.js.map +1 -1
- package/dist/react-svg.umd.development.js +816 -848
- package/dist/react-svg.umd.development.js.map +1 -1
- package/dist/react-svg.umd.production.js +1 -1
- package/dist/react-svg.umd.production.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/package.json +45 -36
|
@@ -1,857 +1,825 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('prop-types'), require('react')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'prop-types', 'react'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactSVG = {}, global.PropTypes, global.React));
|
|
5
5
|
})(this, (function (exports, PropTypes, React) { 'use strict';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
var _objectWithoutPropertiesLoose = unwrapExports(objectWithoutPropertiesLoose);
|
|
79
|
-
|
|
80
|
-
var setPrototypeOf = createCommonjsModule(function (module) {
|
|
81
|
-
function _setPrototypeOf(o, p) {
|
|
82
|
-
module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
83
|
-
o.__proto__ = p;
|
|
84
|
-
return o;
|
|
85
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
86
|
-
return _setPrototypeOf(o, p);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
unwrapExports(setPrototypeOf);
|
|
93
|
-
|
|
94
|
-
var inheritsLoose = createCommonjsModule(function (module) {
|
|
95
|
-
function _inheritsLoose(subClass, superClass) {
|
|
96
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
97
|
-
subClass.prototype.constructor = subClass;
|
|
98
|
-
setPrototypeOf(subClass, superClass);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
module.exports = _inheritsLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
var _inheritsLoose = unwrapExports(inheritsLoose);
|
|
105
|
-
|
|
106
|
-
/*! *****************************************************************************
|
|
107
|
-
Copyright (c) Microsoft Corporation.
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n["default"] = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var PropTypes__namespace = /*#__PURE__*/_interopNamespace(PropTypes);
|
|
26
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
27
|
+
|
|
28
|
+
function _extends() {
|
|
29
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
30
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
31
|
+
var source = arguments[i];
|
|
32
|
+
|
|
33
|
+
for (var key in source) {
|
|
34
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
35
|
+
target[key] = source[key];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return target;
|
|
41
|
+
};
|
|
42
|
+
return _extends.apply(this, arguments);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
46
|
+
if (source == null) return {};
|
|
47
|
+
var target = {};
|
|
48
|
+
var sourceKeys = Object.keys(source);
|
|
49
|
+
var key, i;
|
|
50
|
+
|
|
51
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
52
|
+
key = sourceKeys[i];
|
|
53
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
54
|
+
target[key] = source[key];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return target;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function _setPrototypeOf(o, p) {
|
|
61
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
62
|
+
o.__proto__ = p;
|
|
63
|
+
return o;
|
|
64
|
+
};
|
|
65
|
+
return _setPrototypeOf(o, p);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function _inheritsLoose(subClass, superClass) {
|
|
69
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
70
|
+
subClass.prototype.constructor = subClass;
|
|
71
|
+
_setPrototypeOf(subClass, superClass);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/******************************************************************************
|
|
75
|
+
Copyright (c) Microsoft Corporation.
|
|
108
76
|
|
|
109
|
-
|
|
110
|
-
|
|
77
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
78
|
+
purpose with or without fee is hereby granted.
|
|
111
79
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
80
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
81
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
82
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
83
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
84
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
85
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
86
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
87
|
+
***************************************************************************** */
|
|
120
88
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
89
|
+
function __spreadArray(to, from, pack) {
|
|
90
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
91
|
+
if (ar || !(i in from)) {
|
|
92
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
93
|
+
ar[i] = from[i];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/*!
|
|
100
|
+
* content-type
|
|
101
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
102
|
+
* MIT Licensed
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* RegExp to match *( ";" parameter ) in RFC 7231 sec 3.1.1.1
|
|
107
|
+
*
|
|
108
|
+
* parameter = token "=" ( token / quoted-string )
|
|
109
|
+
* token = 1*tchar
|
|
110
|
+
* tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
|
|
111
|
+
* / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
|
|
112
|
+
* / DIGIT / ALPHA
|
|
113
|
+
* ; any VCHAR, except delimiters
|
|
114
|
+
* quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE
|
|
115
|
+
* qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text
|
|
116
|
+
* obs-text = %x80-FF
|
|
117
|
+
* quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
|
|
118
|
+
*/
|
|
119
|
+
var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* RegExp to match quoted-pair in RFC 7230 sec 3.2.6
|
|
123
|
+
*
|
|
124
|
+
* quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
|
|
125
|
+
* obs-text = %x80-FF
|
|
126
|
+
*/
|
|
127
|
+
var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* RegExp to match type in RFC 7231 sec 3.1.1.1
|
|
131
|
+
*
|
|
132
|
+
* media-type = type "/" subtype
|
|
133
|
+
* type = token
|
|
134
|
+
* subtype = token
|
|
135
|
+
*/
|
|
136
|
+
var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
137
|
+
var parse_1 = parse;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Parse media type to object.
|
|
141
|
+
*
|
|
142
|
+
* @param {string|object} string
|
|
143
|
+
* @return {Object}
|
|
144
|
+
* @public
|
|
145
|
+
*/
|
|
146
|
+
|
|
147
|
+
function parse (string) {
|
|
148
|
+
if (!string) {
|
|
149
|
+
throw new TypeError('argument string is required')
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// support req/res-like objects as argument
|
|
153
|
+
var header = typeof string === 'object'
|
|
154
|
+
? getcontenttype(string)
|
|
155
|
+
: string;
|
|
156
|
+
|
|
157
|
+
if (typeof header !== 'string') {
|
|
158
|
+
throw new TypeError('argument string is required to be a string')
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
var index = header.indexOf(';');
|
|
162
|
+
var type = index !== -1
|
|
163
|
+
? header.substr(0, index).trim()
|
|
164
|
+
: header.trim();
|
|
165
|
+
|
|
166
|
+
if (!TYPE_REGEXP.test(type)) {
|
|
167
|
+
throw new TypeError('invalid media type')
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
var obj = new ContentType(type.toLowerCase());
|
|
171
|
+
|
|
172
|
+
// parse parameters
|
|
173
|
+
if (index !== -1) {
|
|
174
|
+
var key;
|
|
175
|
+
var match;
|
|
176
|
+
var value;
|
|
177
|
+
|
|
178
|
+
PARAM_REGEXP.lastIndex = index;
|
|
179
|
+
|
|
180
|
+
while ((match = PARAM_REGEXP.exec(header))) {
|
|
181
|
+
if (match.index !== index) {
|
|
182
|
+
throw new TypeError('invalid parameter format')
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
index += match[0].length;
|
|
186
|
+
key = match[1].toLowerCase();
|
|
187
|
+
value = match[2];
|
|
188
|
+
|
|
189
|
+
if (value[0] === '"') {
|
|
190
|
+
// remove quotes and escapes
|
|
191
|
+
value = value
|
|
192
|
+
.substr(1, value.length - 2)
|
|
193
|
+
.replace(QESC_REGEXP, '$1');
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
obj.parameters[key] = value;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (index !== header.length) {
|
|
200
|
+
throw new TypeError('invalid parameter format')
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return obj
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Get content-type from req/res objects.
|
|
209
|
+
*
|
|
210
|
+
* @param {object}
|
|
211
|
+
* @return {Object}
|
|
212
|
+
* @private
|
|
213
|
+
*/
|
|
214
|
+
|
|
215
|
+
function getcontenttype (obj) {
|
|
216
|
+
var header;
|
|
217
|
+
|
|
218
|
+
if (typeof obj.getHeader === 'function') {
|
|
219
|
+
// res-like
|
|
220
|
+
header = obj.getHeader('content-type');
|
|
221
|
+
} else if (typeof obj.headers === 'object') {
|
|
222
|
+
// req-like
|
|
223
|
+
header = obj.headers && obj.headers['content-type'];
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (typeof header !== 'string') {
|
|
227
|
+
throw new TypeError('content-type header is missing from object')
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return header
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Class to represent a content type.
|
|
235
|
+
* @private
|
|
236
|
+
*/
|
|
237
|
+
function ContentType (type) {
|
|
238
|
+
this.parameters = Object.create(null);
|
|
239
|
+
this.type = type;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
var cache = new Map();
|
|
243
|
+
|
|
244
|
+
var cloneSvg = function cloneSvg(sourceSvg) {
|
|
245
|
+
return sourceSvg.cloneNode(true);
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
var isLocal = function isLocal() {
|
|
249
|
+
return window.location.protocol === 'file:';
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
var makeAjaxRequest = function makeAjaxRequest(url, httpRequestWithCredentials, callback) {
|
|
253
|
+
var httpRequest = new XMLHttpRequest();
|
|
254
|
+
|
|
255
|
+
httpRequest.onreadystatechange = function () {
|
|
256
|
+
try {
|
|
257
|
+
if (!/\.svg/i.test(url) && httpRequest.readyState === 2) {
|
|
258
|
+
var contentType = httpRequest.getResponseHeader('Content-Type');
|
|
259
|
+
|
|
260
|
+
if (!contentType) {
|
|
261
|
+
throw new Error('Content type not found');
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
var type = parse_1(contentType).type;
|
|
265
|
+
|
|
266
|
+
if (!(type === 'image/svg+xml' || type === 'text/plain')) {
|
|
267
|
+
throw new Error("Invalid content type: ".concat(type));
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
if (httpRequest.readyState === 4) {
|
|
272
|
+
if (httpRequest.status === 404 || httpRequest.responseXML === null) {
|
|
273
|
+
throw new Error(isLocal() ? 'Note: SVG injection ajax calls do not work locally without ' + 'adjusting security settings in your browser. Or consider ' + 'using a local webserver.' : 'Unable to load SVG file: ' + url);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
if (httpRequest.status === 200 || isLocal() && httpRequest.status === 0) {
|
|
277
|
+
callback(null, httpRequest);
|
|
278
|
+
} else {
|
|
279
|
+
throw new Error('There was a problem injecting the SVG: ' + httpRequest.status + ' ' + httpRequest.statusText);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
} catch (error) {
|
|
283
|
+
httpRequest.abort();
|
|
284
|
+
|
|
285
|
+
if (error instanceof Error) {
|
|
286
|
+
callback(error, httpRequest);
|
|
287
|
+
} else {
|
|
288
|
+
throw error;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
httpRequest.open('GET', url);
|
|
294
|
+
httpRequest.withCredentials = httpRequestWithCredentials;
|
|
295
|
+
|
|
296
|
+
if (httpRequest.overrideMimeType) {
|
|
297
|
+
httpRequest.overrideMimeType('text/xml');
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
httpRequest.send();
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
var requestQueue = {};
|
|
304
|
+
var queueRequest = function queueRequest(url, callback) {
|
|
305
|
+
requestQueue[url] = requestQueue[url] || [];
|
|
306
|
+
requestQueue[url].push(callback);
|
|
307
|
+
};
|
|
308
|
+
var processRequestQueue = function processRequestQueue(url) {
|
|
309
|
+
var _loop_1 = function _loop_1(i, len) {
|
|
310
|
+
setTimeout(function () {
|
|
311
|
+
if (Array.isArray(requestQueue[url])) {
|
|
312
|
+
var cacheValue = cache.get(url);
|
|
313
|
+
var callback = requestQueue[url][i];
|
|
314
|
+
|
|
315
|
+
if (cacheValue instanceof SVGSVGElement) {
|
|
316
|
+
callback(null, cloneSvg(cacheValue));
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if (cacheValue instanceof Error) {
|
|
320
|
+
callback(cacheValue);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if (i === requestQueue[url].length - 1) {
|
|
324
|
+
delete requestQueue[url];
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}, 0);
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
for (var i = 0, len = requestQueue[url].length; i < len; i++) {
|
|
331
|
+
_loop_1(i);
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
var loadSvgCached = function loadSvgCached(url, httpRequestWithCredentials, callback) {
|
|
336
|
+
if (cache.has(url)) {
|
|
337
|
+
var cacheValue = cache.get(url);
|
|
338
|
+
|
|
339
|
+
if (cacheValue === undefined) {
|
|
340
|
+
queueRequest(url, callback);
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if (cacheValue instanceof SVGSVGElement) {
|
|
345
|
+
callback(null, cloneSvg(cacheValue));
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
cache.set(url, undefined);
|
|
351
|
+
queueRequest(url, callback);
|
|
352
|
+
makeAjaxRequest(url, httpRequestWithCredentials, function (error, httpRequest) {
|
|
353
|
+
if (error) {
|
|
354
|
+
cache.set(url, error);
|
|
355
|
+
} else if (httpRequest.responseXML instanceof Document && httpRequest.responseXML.documentElement && httpRequest.responseXML.documentElement instanceof SVGSVGElement) {
|
|
356
|
+
cache.set(url, httpRequest.responseXML.documentElement);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
processRequestQueue(url);
|
|
360
|
+
});
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
var loadSvgUncached = function loadSvgUncached(url, httpRequestWithCredentials, callback) {
|
|
364
|
+
makeAjaxRequest(url, httpRequestWithCredentials, function (error, httpRequest) {
|
|
365
|
+
if (error) {
|
|
366
|
+
callback(error);
|
|
367
|
+
} else if (httpRequest.responseXML instanceof Document && httpRequest.responseXML.documentElement && httpRequest.responseXML.documentElement instanceof SVGSVGElement) {
|
|
368
|
+
callback(null, httpRequest.responseXML.documentElement);
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
var idCounter = 0;
|
|
374
|
+
|
|
375
|
+
var uniqueId = function uniqueId() {
|
|
376
|
+
return ++idCounter;
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
var injectedElements = [];
|
|
380
|
+
var ranScripts = {};
|
|
381
|
+
var svgNamespace$1 = 'http://www.w3.org/2000/svg';
|
|
382
|
+
var xlinkNamespace$1 = 'http://www.w3.org/1999/xlink';
|
|
383
|
+
|
|
384
|
+
var injectElement = function injectElement(el, evalScripts, renumerateIRIElements, cacheRequests, httpRequestWithCredentials, beforeEach, callback) {
|
|
385
|
+
var elUrl = el.getAttribute('data-src') || el.getAttribute('src');
|
|
386
|
+
|
|
387
|
+
if (!elUrl) {
|
|
388
|
+
callback(new Error('Invalid data-src or src attribute'));
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
if (injectedElements.indexOf(el) !== -1) {
|
|
393
|
+
injectedElements.splice(injectedElements.indexOf(el), 1);
|
|
394
|
+
el = null;
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
injectedElements.push(el);
|
|
399
|
+
el.setAttribute('src', '');
|
|
400
|
+
var loadSvg = cacheRequests ? loadSvgCached : loadSvgUncached;
|
|
401
|
+
loadSvg(elUrl, httpRequestWithCredentials, function (error, svg) {
|
|
402
|
+
if (!svg) {
|
|
403
|
+
injectedElements.splice(injectedElements.indexOf(el), 1);
|
|
404
|
+
el = null;
|
|
405
|
+
callback(error);
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
var elId = el.getAttribute('id');
|
|
410
|
+
|
|
411
|
+
if (elId) {
|
|
412
|
+
svg.setAttribute('id', elId);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
var elTitle = el.getAttribute('title');
|
|
416
|
+
|
|
417
|
+
if (elTitle) {
|
|
418
|
+
svg.setAttribute('title', elTitle);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
var elWidth = el.getAttribute('width');
|
|
422
|
+
|
|
423
|
+
if (elWidth) {
|
|
424
|
+
svg.setAttribute('width', elWidth);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
var elHeight = el.getAttribute('height');
|
|
428
|
+
|
|
429
|
+
if (elHeight) {
|
|
430
|
+
svg.setAttribute('height', elHeight);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
var mergedClasses = Array.from(new Set(__spreadArray(__spreadArray(__spreadArray([], (svg.getAttribute('class') || '').split(' '), true), ['injected-svg'], false), (el.getAttribute('class') || '').split(' '), true))).join(' ').trim();
|
|
434
|
+
svg.setAttribute('class', mergedClasses);
|
|
435
|
+
var elStyle = el.getAttribute('style');
|
|
436
|
+
|
|
437
|
+
if (elStyle) {
|
|
438
|
+
svg.setAttribute('style', elStyle);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
svg.setAttribute('data-src', elUrl);
|
|
442
|
+
var elData = [].filter.call(el.attributes, function (at) {
|
|
443
|
+
return /^data-\w[\w-]*$/.test(at.name);
|
|
444
|
+
});
|
|
445
|
+
Array.prototype.forEach.call(elData, function (dataAttr) {
|
|
446
|
+
if (dataAttr.name && dataAttr.value) {
|
|
447
|
+
svg.setAttribute(dataAttr.name, dataAttr.value);
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
if (renumerateIRIElements) {
|
|
452
|
+
var iriElementsAndProperties_1 = {
|
|
453
|
+
clipPath: ['clip-path'],
|
|
454
|
+
'color-profile': ['color-profile'],
|
|
455
|
+
cursor: ['cursor'],
|
|
456
|
+
filter: ['filter'],
|
|
457
|
+
linearGradient: ['fill', 'stroke'],
|
|
458
|
+
marker: ['marker', 'marker-start', 'marker-mid', 'marker-end'],
|
|
459
|
+
mask: ['mask'],
|
|
460
|
+
path: [],
|
|
461
|
+
pattern: ['fill', 'stroke'],
|
|
462
|
+
radialGradient: ['fill', 'stroke']
|
|
463
|
+
};
|
|
464
|
+
var element_1;
|
|
465
|
+
var elements_1;
|
|
466
|
+
var properties_1;
|
|
467
|
+
var currentId_1;
|
|
468
|
+
var newId_1;
|
|
469
|
+
Object.keys(iriElementsAndProperties_1).forEach(function (key) {
|
|
470
|
+
element_1 = key;
|
|
471
|
+
properties_1 = iriElementsAndProperties_1[key];
|
|
472
|
+
elements_1 = svg.querySelectorAll(element_1 + '[id]');
|
|
473
|
+
|
|
474
|
+
var _loop_1 = function _loop_1(a, elementsLen) {
|
|
475
|
+
currentId_1 = elements_1[a].id;
|
|
476
|
+
newId_1 = currentId_1 + '-' + uniqueId();
|
|
477
|
+
var referencingElements;
|
|
478
|
+
Array.prototype.forEach.call(properties_1, function (property) {
|
|
479
|
+
referencingElements = svg.querySelectorAll('[' + property + '*="' + currentId_1 + '"]');
|
|
480
|
+
|
|
481
|
+
for (var b = 0, referencingElementLen = referencingElements.length; b < referencingElementLen; b++) {
|
|
482
|
+
var attrValue = referencingElements[b].getAttribute(property);
|
|
483
|
+
|
|
484
|
+
if (attrValue && !attrValue.match(new RegExp('url\\("?#' + currentId_1 + '"?\\)'))) {
|
|
485
|
+
continue;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
referencingElements[b].setAttribute(property, 'url(#' + newId_1 + ')');
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
var allLinks = svg.querySelectorAll('[*|href]');
|
|
492
|
+
var links = [];
|
|
493
|
+
|
|
494
|
+
for (var c = 0, allLinksLen = allLinks.length; c < allLinksLen; c++) {
|
|
495
|
+
var href = allLinks[c].getAttributeNS(xlinkNamespace$1, 'href');
|
|
496
|
+
|
|
497
|
+
if (href && href.toString() === '#' + elements_1[a].id) {
|
|
498
|
+
links.push(allLinks[c]);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
for (var d = 0, linksLen = links.length; d < linksLen; d++) {
|
|
503
|
+
links[d].setAttributeNS(xlinkNamespace$1, 'href', '#' + newId_1);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
elements_1[a].id = newId_1;
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
for (var a = 0, elementsLen = elements_1.length; a < elementsLen; a++) {
|
|
510
|
+
_loop_1(a);
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
svg.removeAttribute('xmlns:a');
|
|
516
|
+
var scripts = svg.querySelectorAll('script');
|
|
517
|
+
var scriptsToEval = [];
|
|
518
|
+
var script;
|
|
519
|
+
var scriptType;
|
|
520
|
+
|
|
521
|
+
for (var i = 0, scriptsLen = scripts.length; i < scriptsLen; i++) {
|
|
522
|
+
scriptType = scripts[i].getAttribute('type');
|
|
523
|
+
|
|
524
|
+
if (!scriptType || scriptType === 'application/ecmascript' || scriptType === 'application/javascript' || scriptType === 'text/javascript') {
|
|
525
|
+
script = scripts[i].innerText || scripts[i].textContent;
|
|
526
|
+
|
|
527
|
+
if (script) {
|
|
528
|
+
scriptsToEval.push(script);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
svg.removeChild(scripts[i]);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
if (scriptsToEval.length > 0 && (evalScripts === 'always' || evalScripts === 'once' && !ranScripts[elUrl])) {
|
|
536
|
+
for (var l = 0, scriptsToEvalLen = scriptsToEval.length; l < scriptsToEvalLen; l++) {
|
|
537
|
+
new Function(scriptsToEval[l])(window);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
ranScripts[elUrl] = true;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
var styleTags = svg.querySelectorAll('style');
|
|
544
|
+
Array.prototype.forEach.call(styleTags, function (styleTag) {
|
|
545
|
+
styleTag.textContent += '';
|
|
546
|
+
});
|
|
547
|
+
svg.setAttribute('xmlns', svgNamespace$1);
|
|
548
|
+
svg.setAttribute('xmlns:xlink', xlinkNamespace$1);
|
|
549
|
+
beforeEach(svg);
|
|
550
|
+
|
|
551
|
+
if (!el.parentNode) {
|
|
552
|
+
injectedElements.splice(injectedElements.indexOf(el), 1);
|
|
553
|
+
el = null;
|
|
554
|
+
callback(new Error('Parent node is null'));
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
el.parentNode.replaceChild(svg, el);
|
|
559
|
+
injectedElements.splice(injectedElements.indexOf(el), 1);
|
|
560
|
+
el = null;
|
|
561
|
+
callback(null, svg);
|
|
562
|
+
});
|
|
563
|
+
};
|
|
564
|
+
|
|
565
|
+
var SVGInjector = function SVGInjector(elements, _a) {
|
|
566
|
+
var _b = _a === void 0 ? {} : _a,
|
|
567
|
+
_c = _b.afterAll,
|
|
568
|
+
afterAll = _c === void 0 ? function () {
|
|
569
|
+
return undefined;
|
|
570
|
+
} : _c,
|
|
571
|
+
_d = _b.afterEach,
|
|
572
|
+
afterEach = _d === void 0 ? function () {
|
|
573
|
+
return undefined;
|
|
574
|
+
} : _d,
|
|
575
|
+
_e = _b.beforeEach,
|
|
576
|
+
beforeEach = _e === void 0 ? function () {
|
|
577
|
+
return undefined;
|
|
578
|
+
} : _e,
|
|
579
|
+
_f = _b.cacheRequests,
|
|
580
|
+
cacheRequests = _f === void 0 ? true : _f,
|
|
581
|
+
_g = _b.evalScripts,
|
|
582
|
+
evalScripts = _g === void 0 ? 'never' : _g,
|
|
583
|
+
_h = _b.httpRequestWithCredentials,
|
|
584
|
+
httpRequestWithCredentials = _h === void 0 ? false : _h,
|
|
585
|
+
_j = _b.renumerateIRIElements,
|
|
586
|
+
renumerateIRIElements = _j === void 0 ? true : _j;
|
|
587
|
+
|
|
588
|
+
if (elements && 'length' in elements) {
|
|
589
|
+
var elementsLoaded_1 = 0;
|
|
590
|
+
|
|
591
|
+
for (var i = 0, j = elements.length; i < j; i++) {
|
|
592
|
+
injectElement(elements[i], evalScripts, renumerateIRIElements, cacheRequests, httpRequestWithCredentials, beforeEach, function (error, svg) {
|
|
593
|
+
afterEach(error, svg);
|
|
594
|
+
|
|
595
|
+
if (elements && 'length' in elements && elements.length === ++elementsLoaded_1) {
|
|
596
|
+
afterAll(elementsLoaded_1);
|
|
597
|
+
}
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
} else if (elements) {
|
|
601
|
+
injectElement(elements, evalScripts, renumerateIRIElements, cacheRequests, httpRequestWithCredentials, beforeEach, function (error, svg) {
|
|
602
|
+
afterEach(error, svg);
|
|
603
|
+
afterAll(1);
|
|
604
|
+
elements = null;
|
|
605
|
+
});
|
|
606
|
+
} else {
|
|
607
|
+
afterAll(0);
|
|
608
|
+
}
|
|
609
|
+
};
|
|
610
|
+
|
|
611
|
+
// Hat-tip: https://github.com/developit/preact-compat/blob/master/src/index.js#L402.
|
|
612
|
+
var shallowDiffers = function shallowDiffers(a, b) {
|
|
613
|
+
for (var i in a) {
|
|
614
|
+
if (!(i in b)) {
|
|
615
|
+
return true;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
for (var _i in b) {
|
|
620
|
+
if (a[_i] !== b[_i]) {
|
|
621
|
+
return true;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
return false;
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
var _excluded = ["afterInjection", "beforeInjection", "evalScripts", "fallback", "httpRequestWithCredentials", "loading", "renumerateIRIElements", "src", "useRequestCache", "wrapper"];
|
|
629
|
+
var svgNamespace = 'http://www.w3.org/2000/svg';
|
|
630
|
+
var xlinkNamespace = 'http://www.w3.org/1999/xlink';
|
|
631
|
+
var ReactSVG = /*#__PURE__*/function (_React$Component) {
|
|
632
|
+
_inheritsLoose(ReactSVG, _React$Component);
|
|
633
|
+
|
|
634
|
+
function ReactSVG() {
|
|
635
|
+
var _this;
|
|
636
|
+
|
|
637
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
638
|
+
args[_key] = arguments[_key];
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
642
|
+
_this.initialState = {
|
|
643
|
+
hasError: false,
|
|
644
|
+
isLoading: true
|
|
645
|
+
};
|
|
646
|
+
_this.state = _this.initialState;
|
|
647
|
+
_this._isMounted = false;
|
|
648
|
+
_this.reactWrapper = void 0;
|
|
649
|
+
_this.nonReactWrapper = void 0;
|
|
650
|
+
|
|
651
|
+
_this.refCallback = function (reactWrapper) {
|
|
652
|
+
_this.reactWrapper = reactWrapper;
|
|
653
|
+
};
|
|
654
|
+
|
|
655
|
+
return _this;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
var _proto = ReactSVG.prototype;
|
|
659
|
+
|
|
660
|
+
_proto.renderSVG = function renderSVG() {
|
|
661
|
+
var _this2 = this;
|
|
662
|
+
|
|
663
|
+
/* istanbul ignore else */
|
|
664
|
+
if (this.reactWrapper instanceof Node) {
|
|
665
|
+
var _this$props = this.props,
|
|
666
|
+
beforeInjection = _this$props.beforeInjection,
|
|
667
|
+
evalScripts = _this$props.evalScripts,
|
|
668
|
+
httpRequestWithCredentials = _this$props.httpRequestWithCredentials,
|
|
669
|
+
renumerateIRIElements = _this$props.renumerateIRIElements,
|
|
670
|
+
src = _this$props.src,
|
|
671
|
+
useRequestCache = _this$props.useRequestCache;
|
|
672
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
673
|
+
|
|
674
|
+
var afterInjection = this.props.afterInjection;
|
|
675
|
+
var wrapper = this.props.wrapper;
|
|
676
|
+
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
677
|
+
|
|
678
|
+
var nonReactWrapper;
|
|
679
|
+
var nonReactTarget;
|
|
680
|
+
|
|
681
|
+
if (wrapper === 'svg') {
|
|
682
|
+
nonReactWrapper = document.createElementNS(svgNamespace, wrapper);
|
|
683
|
+
nonReactWrapper.setAttribute('xmlns', svgNamespace);
|
|
684
|
+
nonReactWrapper.setAttribute('xmlns:xlink', xlinkNamespace);
|
|
685
|
+
nonReactTarget = document.createElementNS(svgNamespace, wrapper);
|
|
686
|
+
} else {
|
|
687
|
+
nonReactWrapper = document.createElement(wrapper);
|
|
688
|
+
nonReactTarget = document.createElement(wrapper);
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
nonReactWrapper.appendChild(nonReactTarget);
|
|
692
|
+
nonReactTarget.dataset.src = src;
|
|
693
|
+
this.nonReactWrapper = this.reactWrapper.appendChild(nonReactWrapper);
|
|
694
|
+
|
|
695
|
+
var afterEach = function afterEach(error, svg) {
|
|
696
|
+
if (error) {
|
|
697
|
+
_this2.removeSVG();
|
|
698
|
+
|
|
699
|
+
if (!_this2._isMounted) {
|
|
700
|
+
afterInjection(error);
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
} // TODO (Tane): It'd be better to cleanly unsubscribe from SVGInjector
|
|
704
|
+
// callbacks instead of tracking a property like this.
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+
if (_this2._isMounted) {
|
|
708
|
+
_this2.setState(function () {
|
|
709
|
+
return {
|
|
710
|
+
hasError: !!error,
|
|
711
|
+
isLoading: false
|
|
712
|
+
};
|
|
713
|
+
}, function () {
|
|
714
|
+
afterInjection(error, svg);
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
};
|
|
718
|
+
|
|
719
|
+
SVGInjector(nonReactTarget, {
|
|
720
|
+
afterEach: afterEach,
|
|
721
|
+
beforeEach: beforeInjection,
|
|
722
|
+
cacheRequests: useRequestCache,
|
|
723
|
+
evalScripts: evalScripts,
|
|
724
|
+
httpRequestWithCredentials: httpRequestWithCredentials,
|
|
725
|
+
renumerateIRIElements: renumerateIRIElements
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
};
|
|
729
|
+
|
|
730
|
+
_proto.removeSVG = function removeSVG() {
|
|
731
|
+
var _this$nonReactWrapper;
|
|
732
|
+
|
|
733
|
+
if ((_this$nonReactWrapper = this.nonReactWrapper) != null && _this$nonReactWrapper.parentNode) {
|
|
734
|
+
this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper);
|
|
735
|
+
this.nonReactWrapper = null;
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
|
|
739
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
740
|
+
this._isMounted = true;
|
|
741
|
+
this.renderSVG();
|
|
742
|
+
};
|
|
743
|
+
|
|
744
|
+
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
|
745
|
+
var _this3 = this;
|
|
746
|
+
|
|
747
|
+
if (shallowDiffers(prevProps, this.props)) {
|
|
748
|
+
this.setState(function () {
|
|
749
|
+
return _this3.initialState;
|
|
750
|
+
}, function () {
|
|
751
|
+
_this3.removeSVG();
|
|
752
|
+
|
|
753
|
+
_this3.renderSVG();
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
};
|
|
757
|
+
|
|
758
|
+
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
759
|
+
this._isMounted = false;
|
|
760
|
+
this.removeSVG();
|
|
761
|
+
};
|
|
762
|
+
|
|
763
|
+
_proto.render = function render() {
|
|
764
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
765
|
+
var _this$props2 = this.props;
|
|
766
|
+
_this$props2.afterInjection;
|
|
767
|
+
_this$props2.beforeInjection;
|
|
768
|
+
_this$props2.evalScripts;
|
|
769
|
+
var Fallback = _this$props2.fallback;
|
|
770
|
+
_this$props2.httpRequestWithCredentials;
|
|
771
|
+
var Loading = _this$props2.loading;
|
|
772
|
+
_this$props2.renumerateIRIElements;
|
|
773
|
+
_this$props2.src;
|
|
774
|
+
_this$props2.useRequestCache;
|
|
775
|
+
var wrapper = _this$props2.wrapper,
|
|
776
|
+
rest = _objectWithoutPropertiesLoose(_this$props2, _excluded);
|
|
777
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
778
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
779
|
+
|
|
780
|
+
|
|
781
|
+
var Wrapper = wrapper;
|
|
782
|
+
return /*#__PURE__*/React__namespace.createElement(Wrapper, _extends({}, rest, {
|
|
783
|
+
ref: this.refCallback
|
|
784
|
+
}, wrapper === 'svg' ? {
|
|
785
|
+
xmlns: svgNamespace,
|
|
786
|
+
xmlnsXlink: xlinkNamespace
|
|
787
|
+
} : {}), this.state.isLoading && Loading && /*#__PURE__*/React__namespace.createElement(Loading, null), this.state.hasError && Fallback && /*#__PURE__*/React__namespace.createElement(Fallback, null));
|
|
788
|
+
};
|
|
789
|
+
|
|
790
|
+
return ReactSVG;
|
|
791
|
+
}(React__namespace.Component);
|
|
792
|
+
ReactSVG.defaultProps = {
|
|
793
|
+
afterInjection: function afterInjection() {
|
|
794
|
+
return undefined;
|
|
795
|
+
},
|
|
796
|
+
beforeInjection: function beforeInjection() {
|
|
797
|
+
return undefined;
|
|
798
|
+
},
|
|
799
|
+
evalScripts: 'never',
|
|
800
|
+
fallback: null,
|
|
801
|
+
httpRequestWithCredentials: false,
|
|
802
|
+
loading: null,
|
|
803
|
+
renumerateIRIElements: true,
|
|
804
|
+
useRequestCache: true,
|
|
805
|
+
wrapper: 'div'
|
|
806
|
+
};
|
|
807
|
+
ReactSVG.propTypes = {
|
|
808
|
+
afterInjection: PropTypes__namespace.func,
|
|
809
|
+
beforeInjection: PropTypes__namespace.func,
|
|
810
|
+
evalScripts: PropTypes__namespace.oneOf(['always', 'once', 'never']),
|
|
811
|
+
fallback: PropTypes__namespace.oneOfType([PropTypes__namespace.func, PropTypes__namespace.object, PropTypes__namespace.string]),
|
|
812
|
+
httpRequestWithCredentials: PropTypes__namespace.bool,
|
|
813
|
+
loading: PropTypes__namespace.oneOfType([PropTypes__namespace.func, PropTypes__namespace.object, PropTypes__namespace.string]),
|
|
814
|
+
renumerateIRIElements: PropTypes__namespace.bool,
|
|
815
|
+
src: PropTypes__namespace.string.isRequired,
|
|
816
|
+
useRequestCache: PropTypes__namespace.bool,
|
|
817
|
+
wrapper: PropTypes__namespace.oneOf(['div', 'span', 'svg'])
|
|
818
|
+
};
|
|
819
|
+
|
|
820
|
+
exports.ReactSVG = ReactSVG;
|
|
821
|
+
|
|
822
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
855
823
|
|
|
856
824
|
}));
|
|
857
825
|
//# sourceMappingURL=react-svg.umd.development.js.map
|