PageSourceSearch

https://fieldcalc.app/_next/static/chunks/5804.fbbefb56dad46658.js

js fieldcalc.app collected 2026-10-02 00:27:00 UTC 5,955 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5804],{65804:function(e,t,n){n.r(t),n.d(t,{default:function(){return u}});var l=n(57437),r=n(2265),o=n(51817),i=n(92735),a=n(70682),s=n(1592);function c(e,t){return"".concat(e,",").concat(t,",0")}function d(e){let t="<name>".concat(e.layer,"</name>");if("POINT"===e.type)return"<Placemark>".concat(t,"<Point><coordinates>").concat(c(e.px,e.py),"</coordinates></Point></Placemark>");if("LINE"===e.type)return"<Placemark>".concat(t,"<LineString><coordinates>").concat(c(e.x1,e.y1)," ").concat(c(e.x2,e.y2),"</coordinates></LineString></Placemark>");if("LWPOLYLINE"===e.type){let n=(e.closed?[...e.vertices,e.vertices[0]]:e.vertices).map(e=>{let[t,n]=e;return c(t,n)}).join(" ");return e.closed&&e.vertices.length>=3?"<Placemark>".concat(t,"<Polygon><outerBoundaryIs><LinearRing><coordinates>").concat(n,"</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>"):"<Placemark>".concat(t,"<LineString><coordinates>").concat(n,"</coordinates></LineString></Placemark>")}if("CIRCLE"===e.type){let n=function(e,t,n){let l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:36;return Array.from({length:l+1},(r,o)=>{let i=o/l*2*Math.PI;return c(e+n*Math.cos(i),t+n*Math.sin(i))}).join(" ")}(e.cx,e.cy,e.r);return"<Placemark>".concat(t,"<Polygon><outerBoundaryIs><LinearRing><coordinates>").concat(n,"</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>")}return""}function u(){let{t:e}=(0,s.NT)(),[t,n]=(0,r.useState)(!1),[c,u]=(0,r.useState)(""),[m,p]=(0,r.useState)(""),[f,x]=(0,r.useState)(null),[g,y]=(0,r.useState)("");async function h(t){let l=t[0];if(l){n(!0),u(""),p(""),x(null),y(l.name.replace(/\.dxf$/i,""));try{let t=await (0,a.ue)(l);if(!t.includes("ENTITIES"))throw Error(e("toolWidgets.dxfToKml.errorNotDxf"));let{entities:n,skipped:r}=function(e){let t=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n").split("\n"),n=[],l=0,r=0;for(;r<t.length&&"ENTITIES"!==t[r].trim();)r++;if(++r>=t.length)return{entities:n,skipped:l};function o(){for(;r<t.length;){var e,n;let l=null===(e=t[r])||void 0===e?void 0:e.trim(),o=null===(n=t[r+1])||void 0===n?void 0:n.trim();if(void 0===l||void 0===o)break;r+=2;let i=parseInt(l,10);if(Number.isFinite(i))return[i,o]}return null}for(;r<t.length;){let e=o();if(!e)break;let[t,i]=e;if(0===t&&("ENDSEC"===i||"EOF"===i))break;if(0!==t)continue;let a=i.toUpperCase();if("POINT"===a){let e;let t={type:"POINT",layer:"0"};for(;null!==(e=o())&&0!==e[0];)8===e[0]&&(t.layer=e[1]),10===e[0]&&(t.px=parseFloat(e[1])),20===e[0]&&(t.py=parseFloat(e[1]));(null==e?void 0:e[0])===0&&(r-=2),Number.isFinite(t.px)&&Number.isFinite(t.py)?n.push(t):l++}else if("LINE"===a){let e;let t={type:"LINE",layer:"0"};for(;null!==(e=o())&&0!==e[0];)8===e[0]&&(t.layer=e[1]),10===e[0]&&(t.x1=parseFloat(e[1])),20===e[0]&&(t.y1=parseFloat(e[1])),11===e[0]&&(t.x2=parseFloat(e[1])),21===e[0]&&(t.y2=parseFloat(e[1]));(null==e?void 0:e[0])===0&&(r-=2),Number.isFinite(t.x1)&&Number.isFinite(t.y1)&&Number.isFinite(t.x2)&&Number.isFinite(t.y2)?n.push(t):l++}else if("LWPOLYLINE"===a){let e,t;let i={type:"LWPOLYLINE",layer:"0",vertices:[],closed:!1};for(;null!==(t=o())&&0!==t[0];)8===t[0]&&(i.layer=t[1]),70===t[0]&&(i.closed=(1&parseInt(t[1],10))==1),10===t[0]&&(e=parseFloat(t[1])),20===t[0]&&Number.isFinite(e)&&(i.vertices.push([e,parseFloat(t[1])]),e=void 0);(null==t?void 0:t[0])===0&&(r-=2),i.vertices.length>0?n.push(i):l++}else if("CIRCLE"===a){let e;let t={type:"CIRCLE",layer:"0"};for(;null!==(e=o())&&0!==e[0];)8===e[0]&&(t.layer=e[1]),10===e[0]&&(t.cx=parseFloat(e[1])),20===e[0]&&(t.cy=parseFloat(e[1])),40===e[0]&&(t.r=parseFloat(e[1]));(null==e?void 0:e[0])===0&&(r-=2),Number.isFinite(t.cx)&&Number.isFinite(t.cy)&&Number.isFinite(t.r)?n.push(t):l++}else!function(){let e;for(;null!==(e=o())&&0!==e[0];);e&&0===e[0]&&(r-=2)}(),l++}return{entities:n,skipped:l}}(t);if(0===n.length)throw Error(e("toolWidgets.dxfToKml.errorNoGeometry"));p(function(e,t){let n=e.map(d).filter(Boolean).join("\n    ");return'<?xml version="1.0" encoding="UTF-8"?>\n<kml xmlns="http://www.opengis.net/kml/2.2">\n  <Document>\n    <name>'.concat(t,"</name>
1\n    ").concat(n,"\n  </Document>\n</kml>")}(n,l.name)),x({total:n.length,skipped:r})}catch(t){u(t instanceof Error?t.message:e("toolWidgets.dxfToKml.errorParseFailed"))}finally{n(!1)}}}return(0,l.jsx)(a.tG,{children:(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsx)(a.Yo,{accept:".dxf",hint:e("toolWidgets.dxfToKml.dropzoneHint"),onFiles:h}),(0,l.jsx)(a.qX,{tone:"info",children:(0,l.jsx)("div",{dangerouslySetInnerHTML:{__html:e("toolWidgets.dxfToKml.infoSupportedEntities")}})}),t&&(0,l.jsxs)("div",{className:"flex items-center justify-center gap-2 rounded-xl bg-lp-bg px-4 py-4 text-sm font-semibold text-lp-slate",children:[(0,l.jsx)(o.Z,{size:16,className:"animate-spin text-lp-blue"}),e("toolWidgets.dxfToKml.parsing")]}),c&&(0,l.jsx)(a.qX,{tone:"error",children:c}),f&&m&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)(a.O0,{label:e("toolWidgets.dxfToKml.featuresConverted"),value:String(f.total)}),f.skipped>0&&(0,l.jsx)(a.O0,{label:e("toolWidgets.dxfToKml.entitiesSkipped"),value:String(f.skipped)})]}),(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"mb-1.5 flex items-center justify-between",children:[(0,l.jsx)(a.eX,{children:e("toolWidgets.dxfToKml.kmlPreview")}),(0,l.jsx)(a.qi,{text:m,label:e("toolWidgets.dxfToKml.copyAll")})]}),(0,l.jsx)("pre",{className:"max-h-52 overflow-auto rounded-xl border border-lp-line bg-lp-bg p-3 font-mono text-xs leading-relaxed text-lp-ink",children:m.length>2400?m.slice(0,2400)+"\n"+e("toolWidgets.dxfToKml.truncatedNote"):m})]}),(0,l.jsxs)(a.KM,{className:"w-full",onClick:()=>(0,a.Di)("".concat(g||"converted",".kml"),m,"application/vnd.google-earth.kml+xml"),"data-track-cat":"tool_widget",children:[(0,l.jsx)(i.Z,{size:16}),e("toolWidgets.dxfToKml.downloadButton")]})]})]})})}}}]);

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.