/* esm.sh - @iconify/utils@3.1.7/lib/svg/parse */
import{wrapSVGContent as h}from"./defs.mjs";import{getSVGViewBox as u}from"./viewbox.mjs";function a(o){let t=o.trim().match(/(?:<(?:\?xml|!DOCTYPE)[^>]+>\s*)*<svg([^>]+)>([\s\S]+)<\/svg[^>]*>/);if(!t)return;let i=t[2].trim(),n=t[1].match(/[\w:-]+="[^"]*"/g),r=Object.create(null);return n?.forEach(e=>{let s=e.match(/([\w:-]+)="([^"]*)"/);s&&(r[s[1]]=s[2])}),{attribs:r,body:i}}function c(o){let t=o.attribs,i=u(t.viewBox??"");if(!i)return;let n=[];for(let e in t)(e==="style"||e.startsWith("fill")||e.startsWith("stroke"))&&n.push(`${e}="${t[e]}"`);let r=o.body;return n.length&&(r=h(r,"<g "+n.join(" ")+">","</g>")),{width:t.width,height:t.height,viewBox:i,body:r}}function b(o){let t=c(o);if(t)return{attributes:{width:t.width,height:t.height,viewBox:t.viewBox.join(" ")},viewBox:t.viewBox,body:t.body}}function d(o){let t=c(o);if(t){let i=t.viewBox;return{left:i[0],top:i[1],width:i[2],height:i[3],body:t.body}}}export{b as buildParsedSVG,d as convertParsedSVG,a as parseSVGContent};
//# sourceMappingURL=parse.mjs.map