dll.js 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423
  1. var dll =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  38. /******/ __webpack_require__.d = function(exports, name, getter) {
  39. /******/ if(!__webpack_require__.o(exports, name)) {
  40. /******/ Object.defineProperty(exports, name, {
  41. /******/ configurable: false,
  42. /******/ enumerable: true,
  43. /******/ get: getter
  44. /******/ });
  45. /******/ }
  46. /******/ };
  47. /******/
  48. /******/ // getDefaultExport function for compatibility with non-harmony modules
  49. /******/ __webpack_require__.n = function(module) {
  50. /******/ var getter = module && module.__esModule ?
  51. /******/ function getDefault() { return module['default']; } :
  52. /******/ function getModuleExports() { return module; };
  53. /******/ __webpack_require__.d(getter, 'a', getter);
  54. /******/ return getter;
  55. /******/ };
  56. /******/
  57. /******/ // Object.prototype.hasOwnProperty.call
  58. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  59. /******/
  60. /******/ // __webpack_public_path__
  61. /******/ __webpack_require__.p = "";
  62. /******/
  63. /******/ // Load entry module and return exports
  64. /******/ return __webpack_require__(__webpack_require__.s = 1);
  65. /******/ })
  66. /************************************************************************/
  67. /******/ ([
  68. /* 0 */
  69. /***/ (function(module, exports) {
  70. var g;
  71. // This works in non-strict mode
  72. g = (function() {
  73. return this;
  74. })();
  75. try {
  76. // This works if eval is allowed (see CSP)
  77. g = g || Function("return this")() || (1,eval)("this");
  78. } catch(e) {
  79. // This works if the window reference is available
  80. if(typeof window === "object")
  81. g = window;
  82. }
  83. // g can still be undefined, but nothing to do about it...
  84. // We return undefined, instead of nothing here, so it's
  85. // easier to handle this case. if(!global) { ...}
  86. module.exports = g;
  87. /***/ }),
  88. /* 1 */
  89. /***/ (function(module, exports, __webpack_require__) {
  90. module.exports = __webpack_require__;
  91. /***/ }),
  92. /* 2 */
  93. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  94. "use strict";
  95. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  96. /* harmony export (immutable) */ __webpack_exports__["dll"] = dll;
  97. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__assets_facebook_svg__ = __webpack_require__(3);
  98. function dll() {
  99. console.log('dll module');
  100. }
  101. /***/ }),
  102. /* 3 */
  103. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  104. "use strict";
  105. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  106. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_svg_baker_runtime_browser_symbol__ = __webpack_require__(4);
  107. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_svg_baker_runtime_browser_symbol___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_svg_baker_runtime_browser_symbol__);
  108. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_svg_sprite_loader_runtime_browser_sprite_build__ = __webpack_require__(5);
  109. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_svg_sprite_loader_runtime_browser_sprite_build___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_svg_sprite_loader_runtime_browser_sprite_build__);
  110. var symbol = new __WEBPACK_IMPORTED_MODULE_0_svg_baker_runtime_browser_symbol___default.a({
  111. "id": "facebook",
  112. "use": "facebook-usage",
  113. "viewBox": "0 0 1000 1000",
  114. "content": "<symbol viewBox=\"0 0 1000 1000\" id=\"facebook\"><path d=\"M990 500c0-270.6-219.4-490-490-490S10 229.4 10 500s219.4 490 490 490 490-219.4 490-490zm-935.5 0C54.5 254 254 54.5 500 54.5S945.5 254 945.5 500 746.1 945.5 500 945.5C254 945.5 54.5 746 54.5 500z\" /><path d=\"M518.8 782.8V500h93.3l14.7-93.7h-108v-47c0-24.5 8-47.8 43.1-47.8h70.2V218h-99.6c-83.7 0-106.6 55.1-106.6 131.6v56.7h-57.5V500h57.5v282.8h92.9z\" /></symbol>"
  115. });
  116. var result = __WEBPACK_IMPORTED_MODULE_1_svg_sprite_loader_runtime_browser_sprite_build___default.a.add(symbol);
  117. /* harmony default export */ __webpack_exports__["default"] = (symbol);
  118. /***/ }),
  119. /* 4 */
  120. /***/ (function(module, exports, __webpack_require__) {
  121. /* WEBPACK VAR INJECTION */(function(global) {(function (global, factory) {
  122. true ? module.exports = factory() :
  123. typeof define === 'function' && define.amd ? define(factory) :
  124. (global.BrowserSpriteSymbol = factory());
  125. }(this, (function () { 'use strict';
  126. var SpriteSymbol = function SpriteSymbol(ref) {
  127. var id = ref.id;
  128. var viewBox = ref.viewBox;
  129. var content = ref.content;
  130. this.id = id;
  131. this.viewBox = viewBox;
  132. this.content = content;
  133. };
  134. /**
  135. * @return {string}
  136. */
  137. SpriteSymbol.prototype.stringify = function stringify () {
  138. return this.content;
  139. };
  140. /**
  141. * @return {string}
  142. */
  143. SpriteSymbol.prototype.toString = function toString () {
  144. return this.stringify();
  145. };
  146. SpriteSymbol.prototype.destroy = function destroy () {
  147. var this$1 = this;
  148. ['id', 'viewBox', 'content'].forEach(function (prop) { return delete this$1[prop]; });
  149. };
  150. /**
  151. * @param {string} content
  152. * @return {Element}
  153. */
  154. var parse = function (content) {
  155. var hasImportNode = !!document.importNode;
  156. var doc = new DOMParser().parseFromString(content, 'image/svg+xml').documentElement;
  157. /**
  158. * Fix for browser which are throwing WrongDocumentError
  159. * if you insert an element which is not part of the document
  160. * @see http://stackoverflow.com/a/7986519/4624403
  161. */
  162. if (hasImportNode) {
  163. return document.importNode(doc, true);
  164. }
  165. return doc;
  166. };
  167. var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  168. function createCommonjsModule(fn, module) {
  169. return module = { exports: {} }, fn(module, module.exports), module.exports;
  170. }
  171. var index = createCommonjsModule(function (module, exports) {
  172. (function (root, factory) {
  173. if (false) {
  174. undefined(factory);
  175. } else {
  176. module.exports = factory();
  177. }
  178. }(commonjsGlobal, function () {
  179. function isMergeableObject(val) {
  180. var nonNullObject = val && typeof val === 'object';
  181. return nonNullObject
  182. && Object.prototype.toString.call(val) !== '[object RegExp]'
  183. && Object.prototype.toString.call(val) !== '[object Date]'
  184. }
  185. function emptyTarget(val) {
  186. return Array.isArray(val) ? [] : {}
  187. }
  188. function cloneIfNecessary(value, optionsArgument) {
  189. var clone = optionsArgument && optionsArgument.clone === true;
  190. return (clone && isMergeableObject(value)) ? deepmerge(emptyTarget(value), value, optionsArgument) : value
  191. }
  192. function defaultArrayMerge(target, source, optionsArgument) {
  193. var destination = target.slice();
  194. source.forEach(function(e, i) {
  195. if (typeof destination[i] === 'undefined') {
  196. destination[i] = cloneIfNecessary(e, optionsArgument);
  197. } else if (isMergeableObject(e)) {
  198. destination[i] = deepmerge(target[i], e, optionsArgument);
  199. } else if (target.indexOf(e) === -1) {
  200. destination.push(cloneIfNecessary(e, optionsArgument));
  201. }
  202. });
  203. return destination
  204. }
  205. function mergeObject(target, source, optionsArgument) {
  206. var destination = {};
  207. if (isMergeableObject(target)) {
  208. Object.keys(target).forEach(function (key) {
  209. destination[key] = cloneIfNecessary(target[key], optionsArgument);
  210. });
  211. }
  212. Object.keys(source).forEach(function (key) {
  213. if (!isMergeableObject(source[key]) || !target[key]) {
  214. destination[key] = cloneIfNecessary(source[key], optionsArgument);
  215. } else {
  216. destination[key] = deepmerge(target[key], source[key], optionsArgument);
  217. }
  218. });
  219. return destination
  220. }
  221. function deepmerge(target, source, optionsArgument) {
  222. var array = Array.isArray(source);
  223. var options = optionsArgument || { arrayMerge: defaultArrayMerge };
  224. var arrayMerge = options.arrayMerge || defaultArrayMerge;
  225. if (array) {
  226. return Array.isArray(target) ? arrayMerge(target, source, optionsArgument) : cloneIfNecessary(source, optionsArgument)
  227. } else {
  228. return mergeObject(target, source, optionsArgument)
  229. }
  230. }
  231. deepmerge.all = function deepmergeAll(array, optionsArgument) {
  232. if (!Array.isArray(array) || array.length < 2) {
  233. throw new Error('first argument should be an array with at least two elements')
  234. }
  235. // we are sure there are at least 2 values, so it is safe to have no initial value
  236. return array.reduce(function(prev, next) {
  237. return deepmerge(prev, next, optionsArgument)
  238. })
  239. };
  240. return deepmerge
  241. }));
  242. });
  243. var namespaces_1 = createCommonjsModule(function (module, exports) {
  244. var namespaces = {
  245. svg: {
  246. name: 'xmlns',
  247. uri: 'http://www.w3.org/2000/svg'
  248. },
  249. xlink: {
  250. name: 'xmlns:xlink',
  251. uri: 'http://www.w3.org/1999/xlink'
  252. }
  253. };
  254. exports.default = namespaces;
  255. module.exports = exports.default;
  256. });
  257. /**
  258. * @param {Object} attrs
  259. * @return {string}
  260. */
  261. var objectToAttrsString = function (attrs) {
  262. return Object.keys(attrs).map(function (attr) {
  263. var value = attrs[attr].toString().replace(/"/g, '&quot;');
  264. return (attr + "=\"" + value + "\"");
  265. }).join(' ');
  266. };
  267. var svg = namespaces_1.svg;
  268. var xlink = namespaces_1.xlink;
  269. var defaultAttrs = {};
  270. defaultAttrs[svg.name] = svg.uri;
  271. defaultAttrs[xlink.name] = xlink.uri;
  272. /**
  273. * @param {string} [content]
  274. * @param {Object} [attributes]
  275. * @return {string}
  276. */
  277. var wrapInSvgString = function (content, attributes) {
  278. if ( content === void 0 ) content = '';
  279. var attrs = index(defaultAttrs, attributes || {});
  280. var attrsRendered = objectToAttrsString(attrs);
  281. return ("<svg " + attrsRendered + ">" + content + "</svg>");
  282. };
  283. var BrowserSpriteSymbol = (function (SpriteSymbol$$1) {
  284. function BrowserSpriteSymbol () {
  285. SpriteSymbol$$1.apply(this, arguments);
  286. }
  287. if ( SpriteSymbol$$1 ) BrowserSpriteSymbol.__proto__ = SpriteSymbol$$1;
  288. BrowserSpriteSymbol.prototype = Object.create( SpriteSymbol$$1 && SpriteSymbol$$1.prototype );
  289. BrowserSpriteSymbol.prototype.constructor = BrowserSpriteSymbol;
  290. var prototypeAccessors = { isMounted: {} };
  291. prototypeAccessors.isMounted.get = function () {
  292. return !!this.node;
  293. };
  294. /**
  295. * @param {Element} node
  296. * @return {BrowserSpriteSymbol}
  297. */
  298. BrowserSpriteSymbol.createFromExistingNode = function createFromExistingNode (node) {
  299. return new BrowserSpriteSymbol({
  300. id: node.getAttribute('id'),
  301. viewBox: node.getAttribute('viewBox'),
  302. content: node.outerHTML
  303. });
  304. };
  305. BrowserSpriteSymbol.prototype.destroy = function destroy () {
  306. if (this.isMounted) {
  307. this.unmount();
  308. }
  309. SpriteSymbol$$1.prototype.destroy.call(this);
  310. };
  311. /**
  312. * @param {Element|string} target
  313. * @return {Element}
  314. */
  315. BrowserSpriteSymbol.prototype.mount = function mount (target) {
  316. if (this.isMounted) {
  317. return this.node;
  318. }
  319. var mountTarget = typeof target === 'string' ? document.querySelector(target) : target;
  320. var node = this.render();
  321. this.node = node;
  322. mountTarget.appendChild(node);
  323. return node;
  324. };
  325. /**
  326. * @return {Element}
  327. */
  328. BrowserSpriteSymbol.prototype.render = function render () {
  329. var content = this.stringify();
  330. return parse(wrapInSvgString(content)).childNodes[0];
  331. };
  332. BrowserSpriteSymbol.prototype.unmount = function unmount () {
  333. this.node.parentNode.removeChild(this.node);
  334. };
  335. Object.defineProperties( BrowserSpriteSymbol.prototype, prototypeAccessors );
  336. return BrowserSpriteSymbol;
  337. }(SpriteSymbol));
  338. return BrowserSpriteSymbol;
  339. })));
  340. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
  341. /***/ }),
  342. /* 5 */
  343. /***/ (function(module, exports, __webpack_require__) {
  344. /* WEBPACK VAR INJECTION */(function(global) {(function (global, factory) {
  345. true ? module.exports = factory() :
  346. typeof define === 'function' && define.amd ? define(factory) :
  347. (global.BrowserSprite = factory());
  348. }(this, (function () { 'use strict';
  349. var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  350. function createCommonjsModule(fn, module) {
  351. return module = { exports: {} }, fn(module, module.exports), module.exports;
  352. }
  353. var deepmerge = createCommonjsModule(function (module, exports) {
  354. (function (root, factory) {
  355. if (false) {
  356. undefined(factory);
  357. } else {
  358. module.exports = factory();
  359. }
  360. }(commonjsGlobal, function () {
  361. function isMergeableObject(val) {
  362. var nonNullObject = val && typeof val === 'object';
  363. return nonNullObject
  364. && Object.prototype.toString.call(val) !== '[object RegExp]'
  365. && Object.prototype.toString.call(val) !== '[object Date]'
  366. }
  367. function emptyTarget(val) {
  368. return Array.isArray(val) ? [] : {}
  369. }
  370. function cloneIfNecessary(value, optionsArgument) {
  371. var clone = optionsArgument && optionsArgument.clone === true;
  372. return (clone && isMergeableObject(value)) ? deepmerge(emptyTarget(value), value, optionsArgument) : value
  373. }
  374. function defaultArrayMerge(target, source, optionsArgument) {
  375. var destination = target.slice();
  376. source.forEach(function(e, i) {
  377. if (typeof destination[i] === 'undefined') {
  378. destination[i] = cloneIfNecessary(e, optionsArgument);
  379. } else if (isMergeableObject(e)) {
  380. destination[i] = deepmerge(target[i], e, optionsArgument);
  381. } else if (target.indexOf(e) === -1) {
  382. destination.push(cloneIfNecessary(e, optionsArgument));
  383. }
  384. });
  385. return destination
  386. }
  387. function mergeObject(target, source, optionsArgument) {
  388. var destination = {};
  389. if (isMergeableObject(target)) {
  390. Object.keys(target).forEach(function (key) {
  391. destination[key] = cloneIfNecessary(target[key], optionsArgument);
  392. });
  393. }
  394. Object.keys(source).forEach(function (key) {
  395. if (!isMergeableObject(source[key]) || !target[key]) {
  396. destination[key] = cloneIfNecessary(source[key], optionsArgument);
  397. } else {
  398. destination[key] = deepmerge(target[key], source[key], optionsArgument);
  399. }
  400. });
  401. return destination
  402. }
  403. function deepmerge(target, source, optionsArgument) {
  404. var array = Array.isArray(source);
  405. var options = optionsArgument || { arrayMerge: defaultArrayMerge };
  406. var arrayMerge = options.arrayMerge || defaultArrayMerge;
  407. if (array) {
  408. return Array.isArray(target) ? arrayMerge(target, source, optionsArgument) : cloneIfNecessary(source, optionsArgument)
  409. } else {
  410. return mergeObject(target, source, optionsArgument)
  411. }
  412. }
  413. deepmerge.all = function deepmergeAll(array, optionsArgument) {
  414. if (!Array.isArray(array) || array.length < 2) {
  415. throw new Error('first argument should be an array with at least two elements')
  416. }
  417. // we are sure there are at least 2 values, so it is safe to have no initial value
  418. return array.reduce(function(prev, next) {
  419. return deepmerge(prev, next, optionsArgument)
  420. })
  421. };
  422. return deepmerge
  423. }));
  424. });
  425. //
  426. // An event handler can take an optional event argument
  427. // and should not return a value
  428. // An array of all currently registered event handlers for a type
  429. // A map of event types and their corresponding event handlers.
  430. /** Mitt: Tiny (~200b) functional event emitter / pubsub.
  431. * @name mitt
  432. * @returns {Mitt}
  433. */
  434. function mitt(all ) {
  435. all = all || Object.create(null);
  436. return {
  437. /**
  438. * Register an event handler for the given type.
  439. *
  440. * @param {String} type Type of event to listen for, or `"*"` for all events
  441. * @param {Function} handler Function to call in response to given event
  442. * @memberOf mitt
  443. */
  444. on: function on(type , handler ) {
  445. (all[type] || (all[type] = [])).push(handler);
  446. },
  447. /**
  448. * Remove an event handler for the given type.
  449. *
  450. * @param {String} type Type of event to unregister `handler` from, or `"*"`
  451. * @param {Function} handler Handler function to remove
  452. * @memberOf mitt
  453. */
  454. off: function off(type , handler ) {
  455. if (all[type]) {
  456. all[type].splice(all[type].indexOf(handler) >>> 0, 1);
  457. }
  458. },
  459. /**
  460. * Invoke all handlers for the given type.
  461. * If present, `"*"` handlers are invoked after type-matched handlers.
  462. *
  463. * @param {String} type The event type to invoke
  464. * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler
  465. * @memberof mitt
  466. */
  467. emit: function emit(type , evt ) {
  468. (all[type] || []).map(function (handler) { handler(evt); });
  469. (all['*'] || []).map(function (handler) { handler(type, evt); });
  470. }
  471. };
  472. }
  473. var namespaces_1 = createCommonjsModule(function (module, exports) {
  474. var namespaces = {
  475. svg: {
  476. name: 'xmlns',
  477. uri: 'http://www.w3.org/2000/svg'
  478. },
  479. xlink: {
  480. name: 'xmlns:xlink',
  481. uri: 'http://www.w3.org/1999/xlink'
  482. }
  483. };
  484. exports.default = namespaces;
  485. module.exports = exports.default;
  486. });
  487. /**
  488. * @param {Object} attrs
  489. * @return {string}
  490. */
  491. var objectToAttrsString = function (attrs) {
  492. return Object.keys(attrs).map(function (attr) {
  493. var value = attrs[attr].toString().replace(/"/g, '&quot;');
  494. return (attr + "=\"" + value + "\"");
  495. }).join(' ');
  496. };
  497. var svg = namespaces_1.svg;
  498. var xlink = namespaces_1.xlink;
  499. var defaultAttrs = {};
  500. defaultAttrs[svg.name] = svg.uri;
  501. defaultAttrs[xlink.name] = xlink.uri;
  502. /**
  503. * @param {string} [content]
  504. * @param {Object} [attributes]
  505. * @return {string}
  506. */
  507. var wrapInSvgString = function (content, attributes) {
  508. if ( content === void 0 ) content = '';
  509. var attrs = deepmerge(defaultAttrs, attributes || {});
  510. var attrsRendered = objectToAttrsString(attrs);
  511. return ("<svg " + attrsRendered + ">" + content + "</svg>");
  512. };
  513. var svg$1 = namespaces_1.svg;
  514. var xlink$1 = namespaces_1.xlink;
  515. var defaultConfig = {
  516. attrs: ( obj = {
  517. style: ['position: absolute', 'width: 0', 'height: 0'].join('; ')
  518. }, obj[svg$1.name] = svg$1.uri, obj[xlink$1.name] = xlink$1.uri, obj )
  519. };
  520. var obj;
  521. var Sprite = function Sprite(config) {
  522. this.config = deepmerge(defaultConfig, config || {});
  523. this.symbols = [];
  524. };
  525. /**
  526. * Add new symbol. If symbol with the same id exists it will be replaced.
  527. * @param {SpriteSymbol} symbol
  528. * @return {boolean} `true` - symbol was added, `false` - replaced
  529. */
  530. Sprite.prototype.add = function add (symbol) {
  531. var ref = this;
  532. var symbols = ref.symbols;
  533. var existing = this.find(symbol.id);
  534. if (existing) {
  535. symbols[symbols.indexOf(existing)] = symbol;
  536. return false;
  537. }
  538. symbols.push(symbol);
  539. return true;
  540. };
  541. /**
  542. * Remove symbol & destroy it
  543. * @param {string} id
  544. * @return {boolean} `true` - symbol was found & successfully destroyed, `false` - otherwise
  545. */
  546. Sprite.prototype.remove = function remove (id) {
  547. var ref = this;
  548. var symbols = ref.symbols;
  549. var symbol = this.find(id);
  550. if (symbol) {
  551. symbols.splice(symbols.indexOf(symbol), 1);
  552. symbol.destroy();
  553. return true;
  554. }
  555. return false;
  556. };
  557. /**
  558. * @param {string} id
  559. * @return {SpriteSymbol|null}
  560. */
  561. Sprite.prototype.find = function find (id) {
  562. return this.symbols.filter(function (s) { return s.id === id; })[0] || null;
  563. };
  564. /**
  565. * @param {string} id
  566. * @return {boolean}
  567. */
  568. Sprite.prototype.has = function has (id) {
  569. return this.find(id) !== null;
  570. };
  571. /**
  572. * @return {string}
  573. */
  574. Sprite.prototype.stringify = function stringify () {
  575. var ref = this.config;
  576. var attrs = ref.attrs;
  577. var stringifiedSymbols = this.symbols.map(function (s) { return s.stringify(); }).join('');
  578. return wrapInSvgString(stringifiedSymbols, attrs);
  579. };
  580. /**
  581. * @return {string}
  582. */
  583. Sprite.prototype.toString = function toString () {
  584. return this.stringify();
  585. };
  586. Sprite.prototype.destroy = function destroy () {
  587. this.symbols.forEach(function (s) { return s.destroy(); });
  588. };
  589. var SpriteSymbol = function SpriteSymbol(ref) {
  590. var id = ref.id;
  591. var viewBox = ref.viewBox;
  592. var content = ref.content;
  593. this.id = id;
  594. this.viewBox = viewBox;
  595. this.content = content;
  596. };
  597. /**
  598. * @return {string}
  599. */
  600. SpriteSymbol.prototype.stringify = function stringify () {
  601. return this.content;
  602. };
  603. /**
  604. * @return {string}
  605. */
  606. SpriteSymbol.prototype.toString = function toString () {
  607. return this.stringify();
  608. };
  609. SpriteSymbol.prototype.destroy = function destroy () {
  610. var this$1 = this;
  611. ['id', 'viewBox', 'content'].forEach(function (prop) { return delete this$1[prop]; });
  612. };
  613. /**
  614. * @param {string} content
  615. * @return {Element}
  616. */
  617. var parse = function (content) {
  618. var hasImportNode = !!document.importNode;
  619. var doc = new DOMParser().parseFromString(content, 'image/svg+xml').documentElement;
  620. /**
  621. * Fix for browser which are throwing WrongDocumentError
  622. * if you insert an element which is not part of the document
  623. * @see http://stackoverflow.com/a/7986519/4624403
  624. */
  625. if (hasImportNode) {
  626. return document.importNode(doc, true);
  627. }
  628. return doc;
  629. };
  630. var BrowserSpriteSymbol = (function (SpriteSymbol$$1) {
  631. function BrowserSpriteSymbol () {
  632. SpriteSymbol$$1.apply(this, arguments);
  633. }
  634. if ( SpriteSymbol$$1 ) BrowserSpriteSymbol.__proto__ = SpriteSymbol$$1;
  635. BrowserSpriteSymbol.prototype = Object.create( SpriteSymbol$$1 && SpriteSymbol$$1.prototype );
  636. BrowserSpriteSymbol.prototype.constructor = BrowserSpriteSymbol;
  637. var prototypeAccessors = { isMounted: {} };
  638. prototypeAccessors.isMounted.get = function () {
  639. return !!this.node;
  640. };
  641. /**
  642. * @param {Element} node
  643. * @return {BrowserSpriteSymbol}
  644. */
  645. BrowserSpriteSymbol.createFromExistingNode = function createFromExistingNode (node) {
  646. return new BrowserSpriteSymbol({
  647. id: node.getAttribute('id'),
  648. viewBox: node.getAttribute('viewBox'),
  649. content: node.outerHTML
  650. });
  651. };
  652. BrowserSpriteSymbol.prototype.destroy = function destroy () {
  653. if (this.isMounted) {
  654. this.unmount();
  655. }
  656. SpriteSymbol$$1.prototype.destroy.call(this);
  657. };
  658. /**
  659. * @param {Element|string} target
  660. * @return {Element}
  661. */
  662. BrowserSpriteSymbol.prototype.mount = function mount (target) {
  663. if (this.isMounted) {
  664. return this.node;
  665. }
  666. var mountTarget = typeof target === 'string' ? document.querySelector(target) : target;
  667. var node = this.render();
  668. this.node = node;
  669. mountTarget.appendChild(node);
  670. return node;
  671. };
  672. /**
  673. * @return {Element}
  674. */
  675. BrowserSpriteSymbol.prototype.render = function render () {
  676. var content = this.stringify();
  677. return parse(wrapInSvgString(content)).childNodes[0];
  678. };
  679. BrowserSpriteSymbol.prototype.unmount = function unmount () {
  680. this.node.parentNode.removeChild(this.node);
  681. };
  682. Object.defineProperties( BrowserSpriteSymbol.prototype, prototypeAccessors );
  683. return BrowserSpriteSymbol;
  684. }(SpriteSymbol));
  685. var defaultConfig$1 = {
  686. /**
  687. * Should following options be automatically configured:
  688. * - `syncUrlsWithBaseTag`
  689. * - `locationChangeAngularEmitter`
  690. * - `moveGradientsOutsideSymbol`
  691. * @type {boolean}
  692. */
  693. autoConfigure: true,
  694. /**
  695. * Default mounting selector
  696. * @type {string}
  697. */
  698. mountTo: 'body',
  699. /**
  700. * Fix disappearing SVG elements when <base href> exists.
  701. * Executes when sprite mounted.
  702. * @see http://stackoverflow.com/a/18265336/796152
  703. * @see https://github.com/everdimension/angular-svg-base-fix
  704. * @see https://github.com/angular/angular.js/issues/8934#issuecomment-56568466
  705. * @type {boolean}
  706. */
  707. syncUrlsWithBaseTag: false,
  708. /**
  709. * Should sprite listen custom location change event
  710. * @type {boolean}
  711. */
  712. listenLocationChangeEvent: true,
  713. /**
  714. * Custom window event name which should be emitted to update sprite urls
  715. * @type {string}
  716. */
  717. locationChangeEvent: 'locationChange',
  718. /**
  719. * Emit location change event in Angular automatically
  720. * @type {boolean}
  721. */
  722. locationChangeAngularEmitter: false,
  723. /**
  724. * Selector to find symbols usages when updating sprite urls
  725. * @type {string}
  726. */
  727. usagesToUpdate: 'use[*|href]',
  728. /**
  729. * Fix Firefox bug when gradients and patterns don't work if they are within a symbol.
  730. * Executes when sprite is rendered, but not mounted.
  731. * @see https://bugzilla.mozilla.org/show_bug.cgi?id=306674
  732. * @see https://bugzilla.mozilla.org/show_bug.cgi?id=353575
  733. * @see https://bugzilla.mozilla.org/show_bug.cgi?id=1235364
  734. * @type {boolean}
  735. */
  736. moveGradientsOutsideSymbol: false
  737. };
  738. /**
  739. * @param {*} arrayLike
  740. * @return {Array}
  741. */
  742. var arrayFrom = function (arrayLike) {
  743. return Array.prototype.slice.call(arrayLike, 0);
  744. };
  745. var ua = navigator.userAgent;
  746. var browser = {
  747. isChrome: /chrome/i.test(ua),
  748. isFirefox: /firefox/i.test(ua),
  749. // https://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx
  750. isIE: /msie/i.test(ua) || /trident/i.test(ua),
  751. isEdge: /edge/i.test(ua)
  752. };
  753. /**
  754. * @param {string} name
  755. * @param {*} data
  756. */
  757. var dispatchEvent = function (name, data) {
  758. var event = document.createEvent('CustomEvent');
  759. event.initCustomEvent(name, false, false, data);
  760. window.dispatchEvent(event);
  761. };
  762. /**
  763. * IE doesn't evaluate <style> tags in SVGs that are dynamically added to the page.
  764. * This trick will trigger IE to read and use any existing SVG <style> tags.
  765. * @see https://github.com/iconic/SVGInjector/issues/23
  766. * @see https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10898469/
  767. *
  768. * @param {Element} node DOM Element to search <style> tags in
  769. * @return {Array<HTMLStyleElement>}
  770. */
  771. var evalStylesIEWorkaround = function (node) {
  772. var updatedNodes = [];
  773. arrayFrom(node.querySelectorAll('style'))
  774. .forEach(function (style) {
  775. style.textContent += '';
  776. updatedNodes.push(style);
  777. });
  778. return updatedNodes;
  779. };
  780. /**
  781. * @param {string} [url] If not provided - current URL will be used
  782. * @return {string}
  783. */
  784. var getUrlWithoutFragment = function (url) {
  785. return (url || window.location.href).split('#')[0];
  786. };
  787. /* global angular */
  788. /**
  789. * @param {string} eventName
  790. */
  791. var locationChangeAngularEmitter = function (eventName) {
  792. angular.module('ng').run(['$rootScope', function ($rootScope) {
  793. $rootScope.$on('$locationChangeSuccess', function (e, newUrl, oldUrl) {
  794. dispatchEvent(eventName, { oldUrl: oldUrl, newUrl: newUrl });
  795. });
  796. }]);
  797. };
  798. var defaultSelector = 'linearGradient, radialGradient, pattern';
  799. /**
  800. * @param {Element} svg
  801. * @param {string} [selector]
  802. * @return {Element}
  803. */
  804. var moveGradientsOutsideSymbol = function (svg, selector) {
  805. if ( selector === void 0 ) selector = defaultSelector;
  806. arrayFrom(svg.querySelectorAll('symbol')).forEach(function (symbol) {
  807. arrayFrom(symbol.querySelectorAll(selector)).forEach(function (node) {
  808. symbol.parentNode.insertBefore(node, symbol);
  809. });
  810. });
  811. return svg;
  812. };
  813. /**
  814. * @param {NodeList} nodes
  815. * @param {Function} [matcher]
  816. * @return {Attr[]}
  817. */
  818. function selectAttributes(nodes, matcher) {
  819. var attrs = arrayFrom(nodes).reduce(function (acc, node) {
  820. if (!node.attributes) {
  821. return acc;
  822. }
  823. var arrayfied = arrayFrom(node.attributes);
  824. var matched = matcher ? arrayfied.filter(matcher) : arrayfied;
  825. return acc.concat(matched);
  826. }, []);
  827. return attrs;
  828. }
  829. /**
  830. * @param {NodeList|Node} nodes
  831. * @param {boolean} [clone=true]
  832. * @return {string}
  833. */
  834. var xLinkNS = namespaces_1.xlink.uri;
  835. var xLinkAttrName = 'xlink:href';
  836. // eslint-disable-next-line no-useless-escape
  837. var specialUrlCharsPattern = /[{}|\\\^\[\]`"<>]/g;
  838. function encoder(url) {
  839. return url.replace(specialUrlCharsPattern, function (match) {
  840. return ("%" + (match[0].charCodeAt(0).toString(16).toUpperCase()));
  841. });
  842. }
  843. /**
  844. * @param {NodeList} nodes
  845. * @param {string} startsWith
  846. * @param {string} replaceWith
  847. * @return {NodeList}
  848. */
  849. function updateReferences(nodes, startsWith, replaceWith) {
  850. arrayFrom(nodes).forEach(function (node) {
  851. var href = node.getAttribute(xLinkAttrName);
  852. if (href && href.indexOf(startsWith) === 0) {
  853. var newUrl = href.replace(startsWith, replaceWith);
  854. node.setAttributeNS(xLinkNS, xLinkAttrName, newUrl);
  855. }
  856. });
  857. return nodes;
  858. }
  859. /**
  860. * List of SVG attributes to update url() target in them
  861. */
  862. var attList = [
  863. 'clipPath',
  864. 'colorProfile',
  865. 'src',
  866. 'cursor',
  867. 'fill',
  868. 'filter',
  869. 'marker',
  870. 'markerStart',
  871. 'markerMid',
  872. 'markerEnd',
  873. 'mask',
  874. 'stroke',
  875. 'style'
  876. ];
  877. var attSelector = attList.map(function (attr) { return ("[" + attr + "]"); }).join(',');
  878. /**
  879. * Update URLs in svg image (like `fill="url(...)"`) and update referencing elements
  880. * @param {Element} svg
  881. * @param {NodeList} references
  882. * @param {string|RegExp} startsWith
  883. * @param {string} replaceWith
  884. * @return {void}
  885. *
  886. * @example
  887. * const sprite = document.querySelector('svg.sprite');
  888. * const usages = document.querySelectorAll('use');
  889. * updateUrls(sprite, usages, '#', 'prefix#');
  890. */
  891. var updateUrls = function (svg, references, startsWith, replaceWith) {
  892. var startsWithEncoded = encoder(startsWith);
  893. var replaceWithEncoded = encoder(replaceWith);
  894. var nodes = svg.querySelectorAll(attSelector);
  895. var attrs = selectAttributes(nodes, function (ref) {
  896. var localName = ref.localName;
  897. var value = ref.value;
  898. return attList.indexOf(localName) !== -1 && value.indexOf(("url(" + startsWithEncoded)) !== -1;
  899. });
  900. attrs.forEach(function (attr) { return attr.value = attr.value.replace(startsWithEncoded, replaceWithEncoded); });
  901. updateReferences(references, startsWithEncoded, replaceWithEncoded);
  902. };
  903. /**
  904. * Internal emitter events
  905. * @enum
  906. * @private
  907. */
  908. var Events = {
  909. MOUNT: 'mount',
  910. SYMBOL_MOUNT: 'symbol_mount'
  911. };
  912. var BrowserSprite = (function (Sprite$$1) {
  913. function BrowserSprite(cfg) {
  914. var this$1 = this;
  915. if ( cfg === void 0 ) cfg = {};
  916. Sprite$$1.call(this, deepmerge(defaultConfig$1, cfg));
  917. var emitter = mitt();
  918. this._emitter = emitter;
  919. this.node = null;
  920. var ref = this;
  921. var config = ref.config;
  922. if (config.autoConfigure) {
  923. this._autoConfigure(cfg);
  924. }
  925. if (config.syncUrlsWithBaseTag) {
  926. var baseUrl = document.getElementsByTagName('base')[0].getAttribute('href');
  927. emitter.on(Events.MOUNT, function () { return this$1.updateUrls('#', baseUrl); });
  928. }
  929. var handleLocationChange = this._handleLocationChange.bind(this);
  930. this._handleLocationChange = handleLocationChange;
  931. // Provide way to update sprite urls externally via dispatching custom window event
  932. if (config.listenLocationChangeEvent) {
  933. window.addEventListener(config.locationChangeEvent, handleLocationChange);
  934. }
  935. // Emit location change event in Angular automatically
  936. if (config.locationChangeAngularEmitter) {
  937. locationChangeAngularEmitter(config.locationChangeEvent);
  938. }
  939. // After sprite mounted
  940. emitter.on(Events.MOUNT, function (spriteNode) {
  941. if (config.moveGradientsOutsideSymbol) {
  942. moveGradientsOutsideSymbol(spriteNode);
  943. }
  944. });
  945. // After symbol mounted into sprite
  946. emitter.on(Events.SYMBOL_MOUNT, function (symbolNode) {
  947. if (config.moveGradientsOutsideSymbol) {
  948. moveGradientsOutsideSymbol(symbolNode.parentNode);
  949. }
  950. if (browser.isIE || browser.isEdge) {
  951. evalStylesIEWorkaround(symbolNode);
  952. }
  953. });
  954. }
  955. if ( Sprite$$1 ) BrowserSprite.__proto__ = Sprite$$1;
  956. BrowserSprite.prototype = Object.create( Sprite$$1 && Sprite$$1.prototype );
  957. BrowserSprite.prototype.constructor = BrowserSprite;
  958. var prototypeAccessors = { isMounted: {} };
  959. /**
  960. * @return {boolean}
  961. */
  962. prototypeAccessors.isMounted.get = function () {
  963. return !!this.node;
  964. };
  965. /**
  966. * Automatically configure following options
  967. * - `syncUrlsWithBaseTag`
  968. * - `locationChangeAngularEmitter`
  969. * - `moveGradientsOutsideSymbol`
  970. * @param {Object} cfg
  971. * @private
  972. */
  973. BrowserSprite.prototype._autoConfigure = function _autoConfigure (cfg) {
  974. var ref = this;
  975. var config = ref.config;
  976. if (typeof cfg.syncUrlsWithBaseTag === 'undefined') {
  977. config.syncUrlsWithBaseTag = typeof document.getElementsByTagName('base')[0] !== 'undefined';
  978. }
  979. if (typeof cfg.locationChangeAngularEmitter === 'undefined') {
  980. config.locationChangeAngularEmitter = 'angular' in window;
  981. }
  982. if (typeof cfg.moveGradientsOutsideSymbol === 'undefined') {
  983. config.moveGradientsOutsideSymbol = browser.isFirefox;
  984. }
  985. };
  986. /**
  987. * @param {Event} event
  988. * @param {Object} event.detail
  989. * @param {string} event.detail.oldUrl
  990. * @param {string} event.detail.newUrl
  991. * @private
  992. */
  993. BrowserSprite.prototype._handleLocationChange = function _handleLocationChange (event) {
  994. var ref = event.detail;
  995. var oldUrl = ref.oldUrl;
  996. var newUrl = ref.newUrl;
  997. this.updateUrls(oldUrl, newUrl);
  998. };
  999. /**
  1000. * Add new symbol. If symbol with the same id exists it will be replaced.
  1001. * If sprite already mounted - `symbol.mount(sprite.node)` will be called.
  1002. * @fires Events#SYMBOL_MOUNT
  1003. * @param {BrowserSpriteSymbol} symbol
  1004. * @return {boolean} `true` - symbol was added, `false` - replaced
  1005. */
  1006. BrowserSprite.prototype.add = function add (symbol) {
  1007. var sprite = this;
  1008. var isNewSymbol = Sprite$$1.prototype.add.call(this, symbol);
  1009. if (this.isMounted && isNewSymbol) {
  1010. symbol.mount(sprite.node);
  1011. this._emitter.emit(Events.SYMBOL_MOUNT, symbol.node);
  1012. }
  1013. return isNewSymbol;
  1014. };
  1015. /**
  1016. * Attach to existing DOM node
  1017. * @param {string|Element} target
  1018. * @return {Element|null} attached DOM Element. null if node to attach not found.
  1019. */
  1020. BrowserSprite.prototype.attach = function attach (target) {
  1021. var this$1 = this;
  1022. var sprite = this;
  1023. if (sprite.isMounted) {
  1024. return sprite.node;
  1025. }
  1026. /** @type Element */
  1027. var node = typeof target === 'string' ? document.querySelector(target) : target;
  1028. sprite.node = node;
  1029. // Already added symbols needs to be mounted
  1030. this.symbols.forEach(function (symbol) {
  1031. symbol.mount(sprite.node);
  1032. this$1._emitter.emit(Events.SYMBOL_MOUNT, symbol.node);
  1033. });
  1034. // Create symbols from existing DOM nodes, add and mount them
  1035. arrayFrom(node.querySelectorAll('symbol'))
  1036. .forEach(function (symbolNode) {
  1037. var symbol = BrowserSpriteSymbol.createFromExistingNode(symbolNode);
  1038. symbol.node = symbolNode; // hack to prevent symbol mounting to sprite when adding
  1039. sprite.add(symbol);
  1040. });
  1041. this._emitter.emit(Events.MOUNT, node);
  1042. return node;
  1043. };
  1044. BrowserSprite.prototype.destroy = function destroy () {
  1045. var ref = this;
  1046. var config = ref.config;
  1047. var symbols = ref.symbols;
  1048. var _emitter = ref._emitter;
  1049. symbols.forEach(function (s) { return s.destroy(); });
  1050. _emitter.off('*');
  1051. window.removeEventListener(config.locationChangeEvent, this._handleLocationChange);
  1052. if (this.isMounted) {
  1053. this.unmount();
  1054. }
  1055. };
  1056. /**
  1057. * @fires Events#MOUNT
  1058. * @param {string|Element} [target]
  1059. * @param {boolean} [prepend=false]
  1060. * @return {Element|null} rendered sprite node. null if mount node not found.
  1061. */
  1062. BrowserSprite.prototype.mount = function mount (target, prepend) {
  1063. if ( target === void 0 ) target = this.config.mountTo;
  1064. if ( prepend === void 0 ) prepend = false;
  1065. var sprite = this;
  1066. if (sprite.isMounted) {
  1067. return sprite.node;
  1068. }
  1069. var mountNode = typeof target === 'string' ? document.querySelector(target) : target;
  1070. var node = sprite.render();
  1071. this.node = node;
  1072. if (prepend && mountNode.childNodes[0]) {
  1073. mountNode.insertBefore(node, mountNode.childNodes[0]);
  1074. } else {
  1075. mountNode.appendChild(node);
  1076. }
  1077. this._emitter.emit(Events.MOUNT, node);
  1078. return node;
  1079. };
  1080. /**
  1081. * @return {Element}
  1082. */
  1083. BrowserSprite.prototype.render = function render () {
  1084. return parse(this.stringify());
  1085. };
  1086. /**
  1087. * Detach sprite from the DOM
  1088. */
  1089. BrowserSprite.prototype.unmount = function unmount () {
  1090. this.node.parentNode.removeChild(this.node);
  1091. };
  1092. /**
  1093. * Update URLs in sprite and usage elements
  1094. * @param {string} oldUrl
  1095. * @param {string} newUrl
  1096. * @return {boolean} `true` - URLs was updated, `false` - sprite is not mounted
  1097. */
  1098. BrowserSprite.prototype.updateUrls = function updateUrls$1 (oldUrl, newUrl) {
  1099. if (!this.isMounted) {
  1100. return false;
  1101. }
  1102. var usages = document.querySelectorAll(this.config.usagesToUpdate);
  1103. updateUrls(
  1104. this.node,
  1105. usages,
  1106. ((getUrlWithoutFragment(oldUrl)) + "#"),
  1107. ((getUrlWithoutFragment(newUrl)) + "#")
  1108. );
  1109. return true;
  1110. };
  1111. Object.defineProperties( BrowserSprite.prototype, prototypeAccessors );
  1112. return BrowserSprite;
  1113. }(Sprite));
  1114. var ready$1 = createCommonjsModule(function (module) {
  1115. /*!
  1116. * domready (c) Dustin Diaz 2014 - License MIT
  1117. */
  1118. !function (name, definition) {
  1119. { module.exports = definition(); }
  1120. }('domready', function () {
  1121. var fns = [], listener
  1122. , doc = document
  1123. , hack = doc.documentElement.doScroll
  1124. , domContentLoaded = 'DOMContentLoaded'
  1125. , loaded = (hack ? /^loaded|^c/ : /^loaded|^i|^c/).test(doc.readyState);
  1126. if (!loaded)
  1127. { doc.addEventListener(domContentLoaded, listener = function () {
  1128. doc.removeEventListener(domContentLoaded, listener);
  1129. loaded = 1;
  1130. while (listener = fns.shift()) { listener(); }
  1131. }); }
  1132. return function (fn) {
  1133. loaded ? setTimeout(fn, 0) : fns.push(fn);
  1134. }
  1135. });
  1136. });
  1137. var spriteNodeId = '__SVG_SPRITE_NODE__';
  1138. var spriteGlobalVarName = '__SVG_SPRITE__';
  1139. var isSpriteExists = !!window[spriteGlobalVarName];
  1140. // eslint-disable-next-line import/no-mutable-exports
  1141. var sprite;
  1142. if (isSpriteExists) {
  1143. sprite = window[spriteGlobalVarName];
  1144. } else {
  1145. sprite = new BrowserSprite({ attrs: { id: spriteNodeId } });
  1146. window[spriteGlobalVarName] = sprite;
  1147. }
  1148. var loadSprite = function () {
  1149. /**
  1150. * Check for page already contains sprite node
  1151. * If found - attach to and reuse it's content
  1152. * If not - render and mount the new sprite
  1153. */
  1154. var existing = document.getElementById(spriteNodeId);
  1155. if (existing) {
  1156. sprite.attach(existing);
  1157. } else {
  1158. sprite.mount(document.body, true);
  1159. }
  1160. };
  1161. if (document.body) {
  1162. loadSprite();
  1163. } else {
  1164. ready$1(loadSprite);
  1165. }
  1166. var sprite$1 = sprite;
  1167. return sprite$1;
  1168. })));
  1169. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
  1170. /***/ })
  1171. /******/ ]);