1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2481,7243],{10651:(e,t,r)=>{r.d(t,{JX:()=>l,N$:()=>a,OD:()=>o,pc:()=>i,zx:()=>n});class s extends Error{constructor(e,t,r=400){super(e),this.name=this.constructor.name,this.code=t,this.statusCode=r,Object.setPrototypeOf(this,new.target.prototype)}}class o extends s{constructor(e,t="FILE_VALIDATION_FAILED"){super(e,t,400)}}class n extends s{constructor(e,t="CONVERSION_FAILED"){super(e,t,500)}}class a extends s{constructor(e,t,r){super(r||(e?`Format '${e}' is not supported`:"Unsupported file format"),"UNSUPPORTED_FORMAT",400),this.format=e,this.supportedFormats=t}}class i extends s{constructor(e,t){super(e?`The ${e.toUpperCase()} file appears to be corrupted or invalid. ${t||"Please try with a different file."}`:`The file appears to be corrupted or invalid. ${t||"Please try with a different file."}`,"CORRUPTED_FILE",400)}}let c={NETWORK_ERROR:"Network error occurred during conversion",TIMEOUT:"Conversion timed out. Please try with a smaller file",ENCODING_ERROR:"Unable to process the file encoding. Please ensure the file is not corrupted."};function l(e){if(e instanceof s)return e.message;if(e instanceof Error){let t=e.message.toLowerCase();return t.includes("memory")||t.includes("heap")?"The file is too large to process. Please try with a smaller file or reduce its dimensions.":t.includes("timeout")?c.TIMEOUT:t.includes("network")||t.includes("fetch")?c.NETWORK_ERROR:t.includes("encoding")||t.includes("decode")?c.ENCODING_ERROR:e.message}return"An unexpected error occurred. Please try again."}},27243:(e,t,r)=>{r.d(t,{svgToPngHandler:()=>n});var s=r(10651),o=r(44134).Buffer;let n=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 s.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 s.OD("Invalid SVG: Missing SVG tag");return t}(e);t.onProgress&&t.onProgress(.1);let n=new DOMParser().parseFromString(r,"image/svg+xml").documentElement;if("parsererror"===n.tagName)throw new s.OD("Invalid SVG: Parse error");let a=t.width||parseInt(n.getAttribute("width")||"0"),i=t.height||parseInt(n.getAttribute("height")||"0");if(!a||!i){let e=n.getAttribute("viewBox");if(e){let[,,t,r]=e.split(" ").map(Number);a=a||t,i=i||r}}a&&i||(a=a||800,i=i||600);let c=t.dpi||96,l=c/96,d=Math.round(a*l),u=Math.round(i*l);t.onProgress&&t.onProgress(.3);let g=document.createElement("canvas");g.width=d,g.height=u;let f=g.getContext("2d");if(!f)throw new s.zx("Failed to create canvas context");t.background&&"transparent"!==t.background&&(f.fillStyle=t.background,f.fillRect(0,0,d,u)),1!==l&&f.scale(l,l),t.onProgress&&t.onProgress(.5);let h=new Blob([r],{type:"image/svg+xml;charset=utf-8"}),m=URL.createObjectURL(h);return new Promise((e,r)=>{let n=new Image;n.onload=async()=>{try{f.drawImage(n,0,0,a,i),t.onProgress&&t.onProgress(.8),g.toBlob(n=>{if(URL.revokeObjectURL(m),!n)return void r(new s.zx("Failed to convert canvas to blob"));t.onProgress&&t.onProgress(1),n.arrayBuffer().then(r=>{let s=o.from(r);e({success:!0,data:s,mimeType:"image/png",metadata:{width:d,height:u,format:"png",size:s.length,dpi:c,originalFormat:"svg",background:t.background||"transparent"}})}).catch(r)},"image/png",t.quality||.9)}catch(e){URL.revokeObjectURL(m),r(e)}},n.onerror=()=>{URL.revokeObjectURL(m),r(new s.zx("Failed to load SVG image"))},n.crossOrigin="anonymous",n.src=m})}catch(e){if(e instanceof s.zx||e instanceof s.OD||e instanceof s.N$)throw e;throw new s.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.