PageSourceSearch

https://www.svgai.org/_next/static/chunks/1259.231e9b794f0c249c.js

js svgai.org collected 2026-10-04 08:37:11 UTC 2,741 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1259],{21259:(e,t,r)=>{r.d(t,{svgToBmpHandler:()=>i});var n=r(10651),s=r(44134).Buffer;let i=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=s.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 i=new DOMParser().parseFromString(r,"image/svg+xml").documentElement;if("parsererror"===i.tagName)throw new n.OD("Invalid SVG: Parse error");let o=t.width||parseInt(i.getAttribute("width")||"0"),a=t.height||parseInt(i.getAttribute("height")||"0");if(!o||!a){let e=i.getAttribute("viewBox");if(e){let[,,t,r]=e.split(" ").map(Number);o=o||t,a=a||r}}o&&a||(o=o||800,a=a||600);let l=t.dpi||96,g=l/96,c=Math.round(o*g),m=Math.round(a*g);t.onProgress&&t.onProgress(.3);let h=document.createElement("canvas");h.width=c,h.height=m;let d=h.getContext("2d",{willReadFrequently:!0});if(!d)throw new n.zx("Failed to create canvas context");d.fillStyle=t.background||"#FFFFFF",d.fillRect(0,0,c,m),1!==g&&d.scale(g,g),t.onProgress&&t.onProgress(.5);let f=new Blob([r],{type:"image/svg+xml;charset=utf-8"}),w=URL.createObjectURL(f);return new Promise((e,r)=>{let i=new Image;i.onload=async()=>{try{d.drawImage(i,0,0,o,a),t.onProgress&&t.onProgress(.7);let r=d.getImageData(0,0,c,m),n=t.bitDepth||24,g=function(e,t=24){let r=e.width,n=e.height,s=e.data,i=t/8,o=4*Math.ceil(r*i/4),a=o*n,l=54+a,g=new ArrayBuffer(l),c=new DataView(g),m=new Uint8Array(g);c.setUint8(0,66),c.setUint8(1,77),c.setUint32(2,l,!0),c.setUint32(6,0,!0),c.setUint32(10,54,!0),c.setUint32(14,40,!0),c.setInt32(18,r,!0),c.setInt32(22,n,!0),c.setUint16(26,1,!0),c.setUint16(28,t,!0),c.setUint32(30,0,!0),c.setUint32(34,a,!0),c.setInt32(38,3780,!0),c.setInt32(42,3780,!0),c.setUint32(46,0,!0),c.setUint32(50,0,!0);let h=54;for(let e=n-1;e>=0;e--){for(let n=0;n<r;n++){let i=(e*r+n)*4;24===t?(m[h++]=s[i+2],m[h++]=s[i+1],m[h++]=s[i]):32===t&&(m[h++]=s[i+2],m[h++]=s[i+1],m[h++]=s[i],m[h++]=s[i+3])}let n=o-r*i;for(let e=0;e<n;e++)m[h++]=0}return g}(r,n),h=s.from(g);t.onProgress&&t.onProgress(1),URL.revokeObjectURL(w),e({success:!0,data:h,mimeType:"image/bmp",metadata:{width:c,height:m,format:"bmp",size:h.length,bitDepth:n,dpi:l,originalFormat:"svg"}})}catch(e){URL.revokeObjectURL(w),r(e)}},i.onerror=()=>{URL.revokeObjectURL(w),r(new n.zx("Failed to load SVG image"))},i.crossOrigin="anonymous",i.src=w})}catch(e){if(e instanceof n.zx||e instanceof n.OD)throw e;throw new n.zx(`SVG to BMP 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.