PageSourceSearch

https://www.svgai.org/_next/static/chunks/3803.bec53346836d0e92.js

js svgai.org collected 2026-10-04 08:37:45 UTC 3,272 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3803],{10651:(e,t,r)=>{r.d(t,{JX:()=>c,N$:()=>a,OD:()=>s,pc:()=>i,zx:()=>n});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 s extends o{constructor(e,t="FILE_VALIDATION_FAILED"){super(e,t,400)}}class n extends o{constructor(e,t="CONVERSION_FAILED"){super(e,t,500)}}class a 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 i 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."}},33803:(e,t,r)=>{r.d(t,{svgToEmfHandler:()=>n});var o=r(10651),s=r(44134).Buffer;let n=async(e,t={})=>{try{let r="string"==typeof e?e:e.toString("utf8"),n=new Blob([r],{type:"image/svg+xml"}),a=new FormData;a.append("file",n,"image.svg"),t.width&&a.append("width",t.width.toString()),t.height&&a.append("height",t.height.toString()),void 0!==t.preserveAspectRatio&&a.append("preserveAspectRatio",t.preserveAspectRatio.toString());let i=Date.now(),l=function(e,t){return e?setInterval(()=>{let r=Date.now()-t;e(Math.min(r<2e3?.1+r/2e3*.2:r<8e3?.3+(r-2e3)/6e3*.5:r<15e3?.8+(r-8e3)/7e3*.1:.9,.9))},250):null}(t.onProgress,i);try{let e=await fetch("/api/convert/svg-to-emf",{method:"POST",body:a,signal:AbortSignal.timeout(3e5)});l&&clearInterval(l);let r=e.headers.get("content-type")||"";if(!e.ok){let t=`Request failed with status ${e.status}`;try{if(r.includes("application/json")){let r=await e.json();t=r.error||r.message||t}else{let r=await e.text();r&&r.length<1e3&&(t=r)}}catch(e){}throw new o.zx(t,"API_REQUEST_FAILED")}let n=await e.arrayBuffer(),c=s.from(n);if(c.length<88)throw new o.zx("Invalid EMF data received - too small","INVALID_EMF_DATA");let d=Date.now()-i;return t.onProgress&&t.onProgress(1),{success:!0,data:c,mimeType:"image/x-emf",metadata:{format:"emf",size:c.length,conversionTime:d,engine:"inkscape",originalFormat:"svg"}}}catch(e){throw l&&clearInterval(l),e}}catch(e){if(e instanceof Error&&"AbortError"===e.name)throw new o.zx("Conversion timed out. The file may be too large or complex.","CONVERSION_TIMEOUT");if(e instanceof o.zx)throw e;throw new o.zx(`Failed to convert SVG file: ${e instanceof Error?e.message:"Unknown error"}`,"SVG_TO_EMF_FAILED")}}}}]);

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.