1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2481],{27243:(e,t,r)=>{r.d(t,{svgToPngHandler:()=>a});var n=r(10651),o=r(44134).Buffer;let a=async(e,t={})=>{try{let r=function(e){if("string"==typeof e){let t=e.trim();if(!t.includes("<svg")&&!t.includes("<?xml"))throw new n.OD("Invalid SVG: Missing SVG tag");return t}let t=o.from(e).toString("utf-8").trim();if(!t.includes("<svg")&&!t.includes("<?xml"))throw new n.OD("Invalid SVG: Missing SVG tag");return t}(e);t.onProgress&&t.onProgress(.1);let a=new DOMParser().parseFromString(r,"image/svg+xml").documentElement;if("parsererror"===a.tagName)throw new n.OD("Invalid SVG: Parse error");let s=t.width||parseInt(a.getAttribute("width")||"0"),i=t.height||parseInt(a.getAttribute("height")||"0");if(!s||!i){let e=a.getAttribute("viewBox");if(e){let[,,t,r]=e.split(" ").map(Number);s=s||t,i=i||r}}s&&i||(s=s||800,i=i||600);let g=t.dpi||96,l=g/96,c=Math.round(s*l),d=Math.round(i*l);t.onProgress&&t.onProgress(.3);let u=document.createElement("canvas");u.width=c,u.height=d;let m=u.getContext("2d");if(!m)throw new n.zx("Failed to create canvas context");t.background&&"transparent"!==t.background&&(m.fillStyle=t.background,m.fillRect(0,0,c,d)),1!==l&&m.scale(l,l),t.onProgress&&t.onProgress(.5);let f=new Blob([r],{type:"image/svg+xml;charset=utf-8"}),h=URL.createObjectURL(f);return new Promise((e,r)=>{let a=new Image;a.onload=async()=>{try{m.drawImage(a,0,0,s,i),t.onProgress&&t.onProgress(.8),u.toBlob(a=>{if(URL.revokeObjectURL(h),!a)return void r(new n.zx("Failed to convert canvas to blob"));t.onProgress&&t.onProgress(1),a.arrayBuffer().then(r=>{let n=o.from(r);e({success:!0,data:n,mimeType:"image/png",metadata:{width:c,height:d,format:"png",size:n.length,dpi:g,originalFormat:"svg",background:t.background||"transparent"}})}).catch(r)},"image/png",t.quality||.9)}catch(e){URL.revokeObjectURL(h),r(e)}},a.onerror=()=>{URL.revokeObjectURL(h),r(new n.zx("Failed to load SVG image"))},a.crossOrigin="anonymous",a.src=h})}catch(e){if(e instanceof n.zx||e instanceof n.OD||e instanceof n.N$)throw e;throw new n.zx(`SVG to PNG conversion failed: ${e instanceof Error?e.message:"Unknown error"}`)}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.