1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4392],{10651:(e,t,r)=>{r.d(t,{JX:()=>c,N$:()=>i,OD:()=>n,pc:()=>a,zx:()=>s});class o 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 n extends o{constructor(e,t="FILE_VALIDATION_FAILED"){super(e,t,400)}}class s extends o{constructor(e,t="CONVERSION_FAILED"){super(e,t,500)}}class i extends o{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 a extends o{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 l={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 c(e){if(e instanceof o)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")?l.TIMEOUT:t.includes("network")||t.includes("fetch")?l.NETWORK_ERROR:t.includes("encoding")||t.includes("decode")?l.ENCODING_ERROR:e.message}return"An unexpected error occurred. Please try again."}},24392:(e,t,r)=>{r.d(t,{svgToIcoHandler:()=>c});var o=r(10651),n=r(119),s=r(44134).Buffer;let i=[16,24,32,48,64,128,256];async function a(e,t,r){try{let o=e.toString("utf8"),n=new Blob([o],{type:"image/svg+xml"}),s=URL.createObjectURL(n);return new Promise((e,o)=>{let n=new Image;n.onload=()=>{try{let o=document.createElement("canvas");o.width=t,o.height=t;let i=o.getContext("2d");r&&(i.fillStyle=r,i.fillRect(0,0,t,t));let a=Math.min(t/n.width,t/n.height),l=n.width*a,c=n.height*a,d=(t-l)/2,u=(t-c)/2;i.drawImage(n,d,u,l,c);let f=i.getImageData(0,0,t,t);URL.revokeObjectURL(s),e(f)}catch(e){URL.revokeObjectURL(s),o(e)}},n.onerror=()=>{URL.revokeObjectURL(s),o(Error("Failed to load SVG image"))},n.src=s})}catch(e){throw new o.zx(`Failed to convert SVG to ImageData at size ${t}x${t}: ${e instanceof Error?e.message:"Unknown error"}`,"SVG_TO_IMAGEDATA_FAILED")}}async function l(e){try{let t=document.createElement("canvas");return t.width=e.width,t.height=e.height,t.getContext("2d").putImageData(e,0,0),new Promise((e,r)=>{t.toBlob(t=>{if(!t)return void r(Error("Failed to create PNG blob"));let o=new FileReader;o.onload=()=>{o.result instanceof ArrayBuffer?e(s.from(o.result)):r(Error("Failed to read PNG blob as ArrayBuffer"))},o.onerror=()=>r(Error("Failed to read PNG blob")),o.readAsArrayBuffer(t)},"image/png")})}catch(e){throw new o.zx(`Failed to convert ImageData to PNG: ${e instanceof Error?e.message:"Unknown error"}`,"IMAGEDATA_TO_PNG_FAILED")}}let c=async(e,t={})=>{try{let r="string"==typeof e?s.from(e,"utf8"):e;!function(e){let t=(0,n.ST)(e);if(!t)throw new o.OD("Unable to detect file format");if("svg"!==t)throw new o.N$(t,["svg"],`Expected SVG format but received ${t}`)}(r),t.onProgress&&t.onProgress(.1);let c=t.sizes||i;if(!1===t.includeLarge&&(c=c.filter(e=>256!==e)),c=c.filter(e=>e>0&&e<=256),0===c.length)throw new o.zx("No valid sizes specified for ICO generation","ICO_NO_SIZES");c.sort((e,t)=>e-t);let d=[],u=.7/c.length;for(let e=0;e<c.length;e++){let o=c[e];t.onProgress&&t.onProgress(.1+e*u);let n=await a(r,o,t.backgroundColor);d.push({size:o,imageData:n})}t.onProgress&&t.onProgress(.8);let f=16*d.length,h=6+f,w=[],g=[];for(let{size:e,imageData:t}of d){let r;r=e>=256?await l(t):function(e){try{let t=e.width,r=e.height,o=e.data,n=t*r*4,i=s.alloc(40+n);i.writeUInt32LE(40,0),i.writeInt32LE(t,4),i.writeInt32LE(2*r,8),i.writeUInt16LE(1,12),i.writeUInt16LE(32,14),i.writeUInt32LE(0,16),i.writeUInt32LE(n,20),i.writeInt32LE(0,24),i.writeInt32LE(0,28),i.writeUInt32LE(0,32),i.writeUInt32LE(0,36);for(let e=0;e<r;e++)for(let n=0;n<t;n++){let s=((r-1-e)*t+n)*4,a=40+(e*t+n)*4;i[a]=o[s+2],i[a+1]=o[s+1],i[a+2]=o[s],i[a+3]=o[s+3]}return i}catch(e){throw new o.zx(`Failed to convert ImageData to BMP: ${e instanceof Error?e.message:"Unknown error"}`,"IMAGEDATA_TO_BMP_FAILED")}}(t),w.push(function(e,t,r,o){let n=s.alloc(16);return n.writeUInt8(256===e?0:e,0),n.writeUInt8(256===t?0:t,1),n.writeUInt8(0,2),n.writeUInt8(0,3),n.writeUInt16LE(1,4),n.writeUInt16LE(32,6),n.writeUInt32LE(r.length,8),n.writeUInt32LE(o,12),n}
1(e,e,r,h)),g.push(r),h+=r.length}t.onProgress&&t.onProgress(.9);let E=s.concat([function(e){let t=s.alloc(6);return t.writeUInt16LE(0,0),t.writeUInt16LE(1,2),t.writeUInt16LE(e,4),t}(d.length),...w,...g]);return t.onProgress&&t.onProgress(1),{success:!0,data:E,mimeType:"image/x-icon",metadata:{format:"ico",size:E.length,width:c[c.length-1],height:c[c.length-1]}}}catch(e){if(e instanceof o.OD||e instanceof o.N$||e instanceof o.zx)throw e;if(e instanceof Error)throw new o.zx(`SVG to ICO conversion failed: ${e.message}`,"SVG_TO_ICO_FAILED");throw new o.zx("An unexpected error occurred during SVG to ICO conversion","SVG_TO_ICO_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.