/** Returns an object with given element's HTML attributes. */
export function getAttributes(element) {
    if (!element)
        return {};
    const attrs = Array.from(element.attributes);
    return attrs.reduce((props, attr) => {
        const { name, value } = attr;
        props[name] = value;
        return props;
    }, {});
}
/** Returns content of the SVG HTML string by stripping the svg tag. */
export function getSvgContent(html = '') {
    return html.replace(/(<\/?svg(?:.|\n)*?>)|(\r\n|\n|\r)/gm, '');
}
/** Returns object with initial state values. */
export function initState() {
    return { content: '', svgAttributes: {} };
}
/** Returns given HTML string as an HTML element. */
export function stringToHTML(html) {
    const container = document.createElement('div');
    container.innerHTML = html;
    return container.firstElementChild;
}
//# sourceMappingURL=helpers.js.map