1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4474],{10651:(e,t,r)=>{r.d(t,{JX:()=>h,N$:()=>o,OD:()=>s,pc:()=>n,zx:()=>a});class i 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 s extends i{constructor(e,t="FILE_VALIDATION_FAILED"){super(e,t,400)}}class a extends i{constructor(e,t="CONVERSION_FAILED"){super(e,t,500)}}class o extends i{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 n extends i{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 h(e){if(e instanceof i)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."}},34474:(e,t,r)=>{r.d(t,{svgToJpgHandler:()=>l});var i=r(90816),s=r(10651),a=r(119),o=r(44134).Buffer;class n extends i.k{async loadLibraries(){{let e=await r.e(3503).then(r.bind(r,33503));this.browserHandler=e.svgToJpgBrowserHandler}}async performConversionWithLibraries(e,t){if(this.browserHandler)return this.browserHandler(e,t);if(!this.serverHandler)throw new s.zx("No conversion handler available","NO_HANDLER");let r=this.serverHandler,i=this.validateSvgInput(e),{svg:a,width:n,height:l}=this.processSvgDimensions(i,t),h=o.from(a,"utf8"),c=t.background||"#ffffff",d=Math.min(100,Math.max(1,t.quality??85)),p=r(h,{density:96});p=p.flatten({background:c}),(t.width||t.height)&&!1!==t.preserveAspectRatio&&(p=p.resize(t.width||null,t.height||null,{fit:"inside",withoutEnlargement:!1}));let m=await p.jpeg({quality:d,progressive:t.progressive??!0,chromaSubsampling:t.chromaSubsampling||"4:2:0"}).toBuffer(),g=await r(m).metadata();return this.createSuccessResult(m,"image/jpeg",{width:g.width,height:g.height,quality:d})}validateSvgInput(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=(0,a.ST)(e);if("svg"!==t)throw new s.N$(t||"unknown",["svg"],`Expected SVG format but received ${t||"unknown format"}`);return e.toString("utf8")}processSvgDimensions(e,t){let r,i,s=e.match(/width="([^"]+)"/),a=e.match(/height="([^"]+)"/),o=e.match(/viewBox="([^"]+)"/);if(s){let e=parseFloat(s[1]);isNaN(e)||(r=e)}if(a){let e=parseFloat(a[1]);isNaN(e)||(i=e)}if(!r&&!i&&o){let[,,e,t]=o[1].split(" ").map(parseFloat);isNaN(e)||isNaN(t)||(r=e,i=t)}r=t.width||r||512,i=t.height||i||512;let n=e;return n=s?n.replace(s[0],`width="${r}"`):n.replace("<svg",`<svg width="${r}"`),{svg:n=a?n.replace(a[0],`height="${i}"`):n.replace("<svg",`<svg height="${i}"`),width:r,height:i}}constructor(...e){super(...e),this.name="SVG to JPG",this.from="svg",this.to="jpg",this.description="Convert SVG vector graphics to JPG images",this.isClientSide=!1,this.browserHandler=null,this.serverHandler=null}}let l=new n().handler},90816:(e,t,r)=>{r.d(t,{I:()=>o,k:()=>n});var i=r(10651),s=r(119),a=r(44134).Buffer;class o{get handler(){return this.handleConversion.bind(this)}async handleConversion(e,t={}){let r;try{let i=this.normalizeInput(e);r=i.length,Date.now(),await this.trackConversionStart(r,t),await this.validateInput(i,t),this.reportProgress(t,.1),await this.trackConversionProgress(.1);let s=await this.performConversion(i,t);return this.reportProgress(t,1),await this.trackConversionProgress(1),await this.trackConversionComplete(!0,s,void 0,r),s}catch(e){if(await this.trackConversionComplete(!1,null,e,r),e instanceof i.zx||e instanceof i.OD)throw e;throw new i.zx((0,i.JX)(e),`${this.from.toUpperCase()}_TO_${this.to.toUpperCase()}_FAILED`)}}normalizeInput(e){return"string"==typeof e?a.from(e,"base64"):e}
1async validateInput(e,t){let r=(0,s.nJ)(e,{allowedFormats:[this.from],targetFormat:this.to});if(!r.isValid)throw new i.OD(r.error);let a=(0,s.XN)(this.from,this.to);if(!a.supported)throw new i.zx(a.reason,"UNSUPPORTED_CONVERSION");let o=(0,s.Ln)(t,this.from,this.to);if(!o.isValid)throw new i.zx(o.error,"INVALID_PARAMETERS")}reportProgress(e,t){if(e.onProgress&&"function"==typeof e.onProgress)try{e.onProgress(Math.min(1,Math.max(0,t)))}catch(e){}}async trackConversionStart(e,t){try{let{trackConversionStart:i}=await r.e(5804).then(r.bind(r,45804));i(this.name,this.from,this.to,e,t)}catch{}}async trackConversionProgress(e){try{let{trackConversionProgress:t}=await r.e(5804).then(r.bind(r,45804));t(this.name,this.from,this.to,e)}catch{}}async trackConversionComplete(e,t,i,s){try{let{trackConversionComplete:s}=await r.e(5804).then(r.bind(r,45804));s(this.name,this.from,this.to,e,t,i)}catch{}}async trackLibraryLoad(e,t,i,s){try{let{trackLibraryLoad:a}=await r.e(5804).then(r.bind(r,45804));a(this.name,e,t,i,s)}catch{}}createSuccessResult(e,t,r){return{success:!0,data:e,mimeType:t,metadata:{format:this.to,size:"string"==typeof e?a.byteLength(e,"utf8"):e.length,...r}}}getOutputMimeType(){return({png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",bmp:"image/bmp",svg:"image/svg+xml",pdf:"application/pdf",ico:"image/x-icon",tiff:"image/tiff",eps:"application/postscript",ai:"application/illustrator",dxf:"application/dxf",stl:"model/stl",avif:"image/avif",cdr:"application/x-coreldraw",mp4:"video/mp4",html:"text/html",ttf:"font/ttf",emf:"image/x-emf",wmf:"image/x-wmf",image:"application/octet-stream"})[this.to]||"application/octet-stream"}constructor(){this.isClientSide=!0,this.isPremium=!1}}class n extends o{async ensureLibrariesLoaded(){if(this.libraryLoaded)return;if(this.loadingPromise)return void await this.loadingPromise;let e=Date.now();this.loadingPromise=this.loadLibraries().then(async()=>{this.libraryLoaded=!0;let t=Date.now()-e;await this.trackLibraryLoad("main",t,!0)}).catch(async t=>{this.loadingPromise=null;let r=Date.now()-e;throw await this.trackLibraryLoad("main",r,!1,t.message),new i.zx(`Failed to load required libraries for ${this.name}: ${t.message}`,"LIBRARY_LOAD_FAILED")}),await this.loadingPromise}async performConversion(e,t){await this.ensureLibrariesLoaded(),this.reportProgress(t,.3),await this.trackConversionProgress(.3);let r=await this.performConversionWithLibraries(e,t);return this.reportProgress(t,.9),await this.trackConversionProgress(.9),r}constructor(...e){super(...e),this.libraryLoaded=!1,this.loadingPromise=null}}}}]);
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.