PageSourceSearch

https://app.cropia.ai/_next/static/chunks/4228.f0122acde79ee441.js

js cropia.ai collected 2026-10-05 15:31:56 UTC 5,969 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4228],{4209:()=>{},74228:(e,t,r)=>{"use strict";r.r(t),r.d(t,{GeoSearchMap:()=>m,default:()=>y});var l=r(95155),a=r(12115),o=r(34606),i=r(62475);function s(e,t={}){if(null!=e.bbox&&!0!==t.recompute)return e.bbox;let r=[1/0,1/0,-1/0,-1/0];return(0,i.Fh)(e,e=>{r[0]>e[0]&&(r[0]=e[0]),r[1]>e[1]&&(r[1]=e[1]),r[2]<e[0]&&(r[2]=e[0]),r[3]<e[1]&&(r[3]=e[1])}),r}r(4209);let n="geo-search-upload",u="geo-search-uncovered",d="geo-search-matches",c=[-55.7658,-32.5228],p={type:"FeatureCollection",features:[]},f={version:8,sources:{satellite:{type:"raster",tiles:["https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"],tileSize:256,maxzoom:19,attribution:"Imagenes: Esri, Maxar, Earthstar Geographics"},osm:{type:"raster",tiles:["https://tile.openstreetmap.org/{z}/{x}/{y}.png"],tileSize:256,maxzoom:19,attribution:"&copy; OpenStreetMap contributors"}},layers:[{id:"satellite",type:"raster",source:"satellite"},{id:"osm",type:"raster",source:"osm",layout:{visibility:"none"}}]};function m(e){let{uploaded:t,uncovered:r,matches:i,selectedUiId:m,onSelect:y,focusUncoveredNonce:g=0}=e,h=(0,a.useRef)(null),v=(0,a.useRef)(null),b=(0,a.useRef)(y),[x,w]=(0,a.useState)(!1),[N,S]=(0,a.useState)("satellite");(0,a.useEffect)(()=>{b.current=y},[y]);let j=(0,a.useMemo)(()=>({type:"FeatureCollection",features:i.map(e=>({type:"Feature",geometry:e.geometry,properties:{uiId:e.ui_id,uiName:e.ui_name,fieldName:e.field_name,clientName:e.client_name,overlapHa:e.overlap_ha,overlapPctUi:e.overlap_pct_ui}}))}),[i]),C=(0,a.useMemo)(()=>r?{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:r}]}:p,[r]);return(0,a.useEffect)(()=>{if(!h.current||v.current)return;let e=new o.Map({container:h.current,style:f,center:c,zoom:5});return e.addControl(new o.NavigationControl({showCompass:!1}),"top-right"),e.addControl(new o.ScaleControl({unit:"metric"}),"bottom-left"),v.current=e,e.on("load",()=>{e.addSource(d,{type:"geojson",data:p}),e.addSource(n,{type:"geojson",data:p}),e.addSource(u,{type:"geojson",data:p}),e.addLayer({id:"matches-fill",type:"fill",source:d,paint:{"fill-color":"#22c55e","fill-opacity":.35}}),e.addLayer({id:"matches-line",type:"line",source:d,paint:{"line-color":"#16a34a","line-width":2}}),e.addLayer({id:"upload-fill",type:"fill",source:n,paint:{"fill-color":"#facc15","fill-opacity":.15}}),e.addLayer({id:"uncovered-fill",type:"fill",source:u,paint:{"fill-color":"#ef4444","fill-opacity":.35}}),e.addLayer({id:"uncovered-line",type:"line",source:u,paint:{"line-color":"#dc2626","line-width":1.5}}),e.addLayer({id:"upload-line",type:"line",source:n,paint:{"line-color":"#facc15","line-width":2.5,"line-dasharray":[2,1]}});let t=new o.Popup({closeButton:!1,closeOnClick:!1});e.on("mousemove","matches-fill",r=>{var l;let a=null==(l=r.features)?void 0:l[0];if(!a)return;e.getCanvas().style.cursor="pointer";let o=a.properties;t.setLngLat(r.lngLat).setHTML('<div style="font-size:12px;line-height:1.35"><strong>'+o.uiName+"</strong><br/>"+o.fieldName+" &middot; "+o.clientName+"<br/>Solape: "+o.overlapHa+" ha ("+o.overlapPctUi+"% del potrero)</div>").addTo(e)}),e.on("mouseleave","matches-fill",()=>{e.getCanvas().style.cursor="",t.remove()}),e.on("click","matches-fill",e=>{var t,r,l;let a=null==(t=e.features)?void 0:t[0];a&&(null==(l=b.current)||l.call(b,Number(null==(r=a.properties)?void 0:r.uiId)))}),w(!0)}),()=>{e.remove(),v.current=null,w(!1)}},[]),(0,a.useEffect)(()=>{let e=v.current;e&&x&&(e.setLayoutProperty("satellite","visibility","satellite"===N?"visible":"none"),e.setLayoutProperty("osm","visibility","osm"===N?"visible":"none"))},[N,x]),(0,a.useEffect)(()=>{var e,r,l,a;let o=v.current;if(!o||!x)return;null==(e=o.getSource(d))||e.setData(j),null==(r=o.getSource(n))||r.setData(null!=t?t:p),null==(l=o.getSource(u))||l.setData(C);let i=(null==t||null==(a=t.features)?void 0:a.length)?t:j;if(!i.features.length)return;let[c,f,m,y]=s(i);[c,f,m,y].every(Number.isFinite)&&o.fitBounds([[c,f],[m,y]],{padding:40,maxZoom:15,duration:600})},[t,j,C,x]),(0,a.useEffect)(()=>{let e=v.current;if(!e||!x||(e.setPaintProperty("matches-fill","fill-color",["case",["==",["get","uiId"],null!=m?m:-1],"#f97316","#22c55e"]),null==m))return;let t=j.features.find(e=>{var t;return Number(null==(t=e.properties)?void 0:t.uiId)===m});if(!t)return;let[r,l,a,o]=s(t);e.fitBounds([[r,l],[a,o]],{padding:80,maxZoom:16,duration:600})},[m,j,x]),(0,a.useEffect)(()=>{let e=v.current;if(!e||!x||!g||!C.features.length)return;let[t,r,l,a]=s(C);[t,r,l,a].every(Number.isFinite)&&e.fitBounds([[t,r],[l,a]],{padding:60,maxZoom:16,duration:600})},[g,C,x]),(0,l.jsxs)("div",{className:"relative h-[460px] w-full overflow-hidden rounded-lg border border-gray-200",children:[(0,l.jsx)("div",{ref:h,className:"h-full w-full"}),(0,l.jsx)("div",{className:"absolute left-3 top-3 flex overflow-hidden rounded-md border border-gray-300 bg-white text-xs font-semibold shadow-sm",children:["satellite","osm"].map(e=>(0,l.jsx)("button",{type:"button",onClick:()=>S(e),className:N===e?"bg-green-900 px-3 py-1.5 text-white":"px-3 py-1.5 text-gray-700 hover:bg-gray-50",children:"satellite"===e?"Satelital":"Mapa"},e))}),(0,l.jsxs)("div",{className:"pointer-events-none absolute left-3 top-14 flex flex-col gap-1 rounded-md bg-white/90 px-3 py-2 text-xs text-gray-700 shadow-sm",children:[(0,l.jsxs)("span",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"h-2.5 w-4 roun
1ded-sm border-2 border-dashed border-yellow-400 bg-yellow-300/30"}),"Archivo subido"]}),(0,l.jsxs)("span",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"h-2.5 w-4 rounded-sm border border-green-600 bg-green-500/40"}),"Potrero que intersecta"]}),C.features.length?(0,l.jsxs)("span",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"h-2.5 w-4 rounded-sm border border-red-600 bg-red-500/40"}),"Sin cubrir"]}):null]})]})}let y=m}}]);

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.