1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2879],{10651:(e,t,r)=>{r.d(t,{JX:()=>c,N$:()=>i,OD:()=>a,pc:()=>o,zx:()=>s});class n 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 a extends n{constructor(e,t="FILE_VALIDATION_FAILED"){super(e,t,400)}}class s extends n{constructor(e,t="CONVERSION_FAILED"){super(e,t,500)}}class i extends n{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 o extends n{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 n)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."}},52879:(e,t,r)=>{r.d(t,{dxfToSvgHandler:()=>s});var n=r(10651),a=r(44134).Buffer;let s=async(e,t={})=>{try{let r=function(e){let t="string"==typeof e?e:e.toString("utf8");if(!t.includes("0\nSECTION")&&!t.includes("0\r\nSECTION"))throw new n.OD("Invalid DXF: Missing SECTION marker");if(!t.includes("ENTITIES"))throw new n.OD("Invalid DXF: Missing ENTITIES section");return t}(e),s=function(e){let t=e.split(/\r?\n/),r=[],a=0,s=new Set;for(;a<t.length&&"ENTITIES"!==t[a].trim();)a++;if(a>=t.length)throw new n.OD("Invalid DXF: No ENTITIES section found");for(a++;a<t.length&&"ENDSEC"!==t[a].trim();){if(t[a]&&t[a+1]){let e=parseInt(t[a].trim()),n=t[a+1].trim();if(0===e&&"ENDSEC"!==n){s.add(n);try{let e=null;switch(n){case"LINE":e=function(e,t){let r={type:"LINE",points:[]},n=t+2,a=0,s=0,i=0,o=0;for(;n<e.length-1;){let t=parseInt(e[n]);if(0===t)break;let r=parseFloat(e[n+1]);switch(t){case 10:a=r;break;case 20:s=r;break;case 11:i=r;break;case 21:o=r}n+=2}return r.points=[{x:a,y:s},{x:i,y:o}],r}(t,a);break;case"CIRCLE":e=function(e,t){let r={type:"CIRCLE"},n=t+2,a=0,s=0,i=0;for(;n<e.length-1;){let t=parseInt(e[n]);if(0===t)break;let r=parseFloat(e[n+1]);switch(t){case 10:a=r;break;case 20:s=r;break;case 40:i=r}n+=2}return r.center={x:a,y:s},r.radius=i,r}(t,a);break;case"ARC":e=function(e,t){let r={type:"ARC"},n=t+2,a=0,s=0,i=0,o=0,l=0;for(;n<e.length-1;){let t=parseInt(e[n]),r=parseFloat(e[n+1]);if(0===t)break;switch(t){case 10:a=r;break;case 20:s=r;break;case 40:i=r;break;case 50:o=r;break;case 51:l=r}n+=2}return r.center={x:a,y:s},r.radius=i,r.startAngle=o,r.endAngle=l,r}(t,a);break;case"POLYLINE":case"LWPOLYLINE":e=function(e,t){let r={type:"POLYLINE",points:[]},n=t+2;for(;n<e.length-1;){let t=parseInt(e[n]),a=e[n+1];if(0===t){if("VERTEX"===a.trim()){let t=function(e,t){let r=t+2,n=0,a=0;for(;r<e.length-1;){let t=parseInt(e[r]),s=parseFloat(e[r+1]);if(0===t)break;switch(t){case 10:n=s;break;case 20:a=s}r+=2}return{x:n,y:a}}(e,n);r.points.push(t)}else if("SEQEND"===a.trim())break}n+=2}return r}(t,a);break;case"SPLINE":e=function(e,t){let r={type:"SPLINE",controlPoints:[],knots:[],weights:[],degree:3},n=t+2;for(;n<e.length-1;){let t=parseInt(e[n]),a=e[n+1];if(0===t)break;switch(t){case 71:r.degree=parseInt(a);break;case 72:case 73:parseInt(a)}n+=2}n=t+2;let a=0,s=0;for(;n<e.length-1;){let t=parseInt(e[n]),i=parseFloat(e[n+1]);if(0===t)break;switch(t){case 10:r.controlPoints[a]||(r.controlPoints[a]={x:0,y:0}),r.controlPoints[a].x=i;break;case 20:r.controlPoints[a]||(r.controlPoints[a]={x:0,y:0}),r.controlPoints[a].y=i,a++;break;case 40:r.knots[s]=i,s++;break;case 41:r.weights||(r.weights=[]),r.weights.push(i)}n+=2}return r}(t,a);break;case"TEXT":case"MTEXT":e=function(e,t){var r;let n=e[t+1].trim(),a={type:n,points:[]},s=t+2,i=0,o=0,l=10,c=0,h="",p=0,f=0,d="Standard",u=1;for(;s<e.length-1;){let t=parseInt(e[s]);if(0===t)break;
1let r=e[s+1].trim();switch(t){case 10:i=parseFloat(r);break;case 20:o=parseFloat(r);break;case 40:l=parseFloat(r);break;case 50:c=parseFloat(r);break;case 1:h=r;break;case 3:h+=r;break;case 7:d=r;break;case 41:u=parseFloat(r);break;case 71:p=parseInt(r);break;case 72:f=parseInt(r)}s+=2}return"MTEXT"===n&&(h=(r=h)?r.replace(/\\P/g,"\n").replace(/\\p/g,"\n").replace(/\\~/g,"").replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/\\\\/g,"\\").replace(/\\f[^;]*;/g,"").replace(/\\[hH][^;]*;/g,"").replace(/\\[wW][^;]*;/g,"").replace(/\\[qQ][^;]*;/g,"").replace(/\\[cC]\d+;/g,"").replace(/\\[lL]/g,"").replace(/\\[lL]/g,"").replace(/\\[oO]/g,"").replace(/\\[kK]/g,"").replace(/\\[^;]*;/g,"").replace(/[{}]/g,"").trim():""),a.points=[{x:i,y:o}],a.text=h,a.height=l,a.rotation=c,a.alignmentH=p,a.alignmentV=f,a.style=d,a.widthFactor=u,a}(t,a);break;case"HATCH":e=function(e,t){let r={type:"HATCH",points:[]},n=t+2,a=!1,s="";for(;n<e.length-1;){let t=parseInt(e[n]),r=e[n+1];if(0===t)break;switch(t){case 2:"SOLID"===(s=r.trim())&&(a=!0);break;case 70:a=1===parseInt(r)}n+=2}return r.hatchPattern=s,r.solid=a,r}(t,a)}e&&r.push(e)}catch(e){}for(a+=2;a<t.length-1&&0!==parseInt(t[a].trim());)a+=2;continue}}a+=2}if(0===r.length){let e=Array.from(s).join(", ");throw new n.zx(`No drawable entities found in DXF file. Found entity types: ${e||"none"}. Supported types: LINE, CIRCLE, ARC, POLYLINE, LWPOLYLINE, SPLINE, TEXT, MTEXT, HATCH`,"DXF_NO_SUPPORTED_ENTITIES")}return r}(r);if(0===s.length)throw new n.zx("No drawable entities found in DXF file","DXF_NO_ENTITIES");let i=function(e,t){let r=t.scale||1,n=t.strokeWidth||1,a=t.defaultColor||"#000000",s=1/0,i=1/0,o=-1/0,l=-1/0;e.forEach(e=>{e.points&&e.points.forEach(e=>{s=Math.min(s,e.x),i=Math.min(i,e.y),o=Math.max(o,e.x),l=Math.max(l,e.y)}),e.center&&(s=Math.min(s,e.center.x-(e.radius||0)),i=Math.min(i,e.center.y-(e.radius||0)),o=Math.max(o,e.center.x+(e.radius||0)),l=Math.max(l,e.center.y+(e.radius||0))),e.controlPoints&&e.controlPoints.forEach(e=>{s=Math.min(s,e.x),i=Math.min(i,e.y),o=Math.max(o,e.x),l=Math.max(l,e.y)})});let c=(o-s)*r,h=(l-i)*r,p=`<?xml version="1.0" encoding="UTF-8"?> 2<svg xmlns="http://www.w3.org/2000/svg" 3 width="${c}" 4 height="${h}" 5 viewBox="${s*r} ${i*r} ${c} ${h}"> 6 <g transform="scale(${r})"> 7`;return e.forEach(e=>{let t=e.color||a;switch(e.type){case"LINE":e.points&&e.points.length>=2&&(p+=` <line x1="${e.points[0].x}" y1="${e.points[0].y}" 8 x2="${e.points[1].x}" y2="${e.points[1].y}" 9 stroke="${t}" stroke-width="${n}" fill="none"/> 10`);break;case"CIRCLE":e.center&&e.radius&&(p+=` <circle cx="${e.center.x}" cy="${e.center.y}" 11 r="${e.radius}" 12 stroke="${t}" stroke-width="${n}" fill="none"/> 13`);break;case"ARC":if(e.center&&e.radius&&void 0!==e.startAngle&&void 0!==e.endAngle){let r=e.startAngle*Math.PI/180,a=e.endAngle*Math.PI/180,s=e.center.x+e.radius*Math.cos(r),i=e.center.y+e.radius*Math.sin(r),o=e.center.x+e.radius*Math.cos(a),l=e.center.y+e.radius*Math.sin(a),c=+(Math.abs(a-r)>Math.PI);p+=` <path d="M ${s} ${i} A ${e.radius} ${e.radius} 0 ${c} 1 ${o} ${l}" 14 stroke="${t}" stroke-width="${n}" fill="none"/> 15`}break;case"POLYLINE":if(e.points&&e.points.length>0){let r=`M ${e.points[0].x} ${e.points[0].y}`;for(let t=1;t<e.points.length;t++)r+=` L ${e.points[t].x} ${e.points[t].y}`;p+=` <path d="${r}" 16 stroke="${t}" stroke-width="${n}" fill="none"/> 17`}break;case"SPLINE":if(e.controlPoints&&e.controlPoints.length>1){let r=function(e,t,r=3){if(e.length<2)return"";let n=`M ${e[0].x} ${e[0].y}`;if(2===e.length)n+=` L ${e[1].x} ${e[1].y}`;else if(3===e.length){let t=e[0],r=e[1],a=e[2],s={x:t.x+2/3*(r.x-t.x),y:t.y+2/3*(r.y-t.y)},i={x:a.x+2/3*(r.x-a.x),y:a.y+2/3*(r.y-a.y)};n+=` C ${s.x} ${s.y} ${i.x} ${i.y} ${a.x} ${a.y}`}else for(let t=0;t<e.length-1;t+=3){e[t];let r=e[Math.min(t+1,e.length-1)],a=e[Math.min(t+2,e.length-1)],s=e[Math.min(t+3,e.length-1)];t+3<e.length?n+=` C ${r.x} ${r.y} ${a.x} ${a.y} ${s.x} ${s.y}`:t+2<e.length?n+=` C ${r.x} ${r.y} ${a.x} ${a.y} ${a.x} ${a.y}`:t+1<e.length&&(n+=` L ${r.x} ${r.y}`)}return n}(e.controlPoints,e.knots,e.degree||3);p+=` <path d="${r}" 18 stroke="${t}" stroke-width="${n}" fill="none"/> 19`}break;case"TEXT":case"MTEXT":if(e.points&&e.points.length>0&&e.text){let r=e.points[0].x,n=e.points[0].y,a=e.height||10,s=e.rotation||0,i=e.widthFactor||1,o="start";1===e.alignmentH?o="middle":2===e.alignmentH&&(o="end");let l="alphabetic";1===e.alignmentV?l="text-bottom":2===e.alignmentV?l="middle":3===e.alignmentV&&(l="text-top");let c=[];0!==s&&c.push(`rotate(${s} ${r} ${n})`),1!==i&&c.push(`scale(${i} 1)`);let h=c.length>0?` transform="${c.join(" ")}"`:"",f=e.text.split("\n");if(1===f.length)p+=` <text x="${r}" y="${n}" font-size="${a}" text-anchor="${o}" dominant-baseline="${l}"${h} 20 fill="${t}">${e.text}</text> 21`;else{let e=1.2*a;p+=` <g${h}> 22`,f.forEach((s,i)=>{p+=` <text x="${r}" y="${n+i*e}" font-size="${a}" text-anchor="${o}" dominant-baseline="${l}" 23 fill="${t}">${s}</text> 24`}),p+=` </g> 25`}}break;case"HATCH":e.solid&&(p+=` <!-- HATCH entity (${e.hatchPattern||"SOLID"}) - simplified rendering --> 26`)}}),p+=` </g> 27</svg>`}(s,t),o=a.from(i,"utf8"),l=i.match(/width="([^"]+)"/),c=i.match(/height="([^"]+)"/);return{success:!0,data:o,mimeType:"image/svg+xml",metadata:{format:"svg",size:o.length,width:l?parseFloat(l[1]):void 0,height:c?parseFloat(c[1]):void 0}}}catch(e){if(e instanceof n.OD||e instanceof n.zx)throw e;if(e instanceof Error)throw new n.zx(`DXF to SVG conversion failed: ${e.message}`,"DXF_TO_SVG_FAILED");throw new n.zx("An unexpected error occurred during DXF to SVG conversion","DXF_TO_SVG_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.