�PNG  IHDR��;���IDATx��ܻn�0���K�� �)(�pA��� ���7�LeG{�� �§㻢|��ذaÆ 6lذaÆ 6lذaÆ 6lom��$^�y���ذag�5bÆ 6lذaÆ 6lذa{���� 6lذaÆ �`����}H�Fkm�,�m����Ӫ���ô�ô!� �x�|'ܢ˟;�E:���9�&ᶒ�}�{�v]�n&�6� �h��_��t�ڠ͵-ҫ���Z;��Z$�.�P���k�ž)�!��o���>}l�eQfJ�T��u і���چ��\��X=8��Rن4`Vw�l�>����n�G�^��i�s��"ms�$�u��i��?w�bs[m�6�K4���O���.�4��%����/����b�C%��t ��M�ז� �-l�G6�mrz2���s�%�9��s@���-�k�9�=���)������k�B5����\��+͂�Zsٲ ��Rn��~G���R���C����� �wIcI��n7jJ���hۛNCS|���j0��8y�iHKֶۛ�k�Ɉ+;Sz������L/��F�*\��Ԕ�#"5��m�2��[S��������=�g��n�a�P�e�ғ�L�� lذaÆ 6l�^k��̱aÆ 6lذaÆ 6lذa;���� �_��ذaÆ 6lذaÆ 6lذaÆ ���R���IEND�B` 'use strict'; const { inheritableAttrs, pathElems } = require('./_collections'); exports.type = 'perItemReverse'; exports.active = true; exports.description = 'moves elements attributes to the existing group wrapper'; /** * Collapse content's intersected and inheritable * attributes to the existing group wrapper. * * @example * * * text * * * * ⬇ * * * text * * * * * @param {Object} item current iteration item * @return {Boolean} if false, item will be filtered out * * @author Kir Belevich */ exports.fn = function (item) { if ( item.type === 'element' && item.name === 'g' && item.children.length > 1 ) { var intersection = {}, hasTransform = false, hasClip = item.attributes['clip-path'] != null || item.attributes.mask != null, intersected = item.children.every(function (inner) { if ( inner.type === 'element' && Object.keys(inner.attributes).length !== 0 ) { // don't mess with possible styles (hack until CSS parsing is implemented) if (inner.attributes.class) return false; if (!Object.keys(intersection).length) { intersection = inner.attributes; } else { intersection = intersectInheritableAttrs( intersection, inner.attributes ); if (!intersection) return false; } return true; } }), allPath = item.children.every(function (inner) { return inner.isElem(pathElems); }); if (intersected) { item.children.forEach(function (g) { for (const [name, value] of Object.entries(intersection)) { if ((!allPath && !hasClip) || name !== 'transform') { delete g.attributes[name]; if (name === 'transform') { if (!hasTransform) { if (item.attributes.transform != null) { item.attributes.transform = item.attributes.transform + ' ' + value; } else { item.attributes.transform = value; } hasTransform = true; } } else { item.attributes[name] = value; } } } }); } } }; /** * Intersect inheritable attributes. * * @param {Object} a first attrs object * @param {Object} b second attrs object * * @return {Object} intersected attrs object */ function intersectInheritableAttrs(a, b) { var c = {}; for (const [name, value] of Object.entries(a)) { if ( // eslint-disable-next-line no-prototype-builtins b.hasOwnProperty(name) && inheritableAttrs.includes(name) && value === b[name] ) { c[name] = value; } } if (!Object.keys(c).length) return false; return c; }