1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2231],{22231:function(e,o,t){t.r(o),t.d(o,{default:function(){return n}});var l=t(57437),r=t(2265),s=t(27648),a=t(51817),i=t(83774),d=t(70682),c=t(1592);function n(){let{t:e}=(0,c.NT)(),[o,t]=(0,r.useState)(""),[n,u]=(0,r.useState)(""),[g,p]=(0,r.useState)(null),[b,v]=(0,r.useState)(!1),[x,m]=(0,r.useState)(""),[y,h]=(0,r.useState)(!1);async function f(){let t=(0,d.OK)(o),l=(0,d.OK)(n);if(""===o||""===n||Math.abs(t)>90||Math.abs(l)>180){m(e("toolWidgets.reverseGeocode.errorCoordRange"));return}v(!0),m(""),p(null);try{var r;let o=await fetch("/api/reverse-geocode?lat=".concat(t,"&lng=").concat(l)),s=await o.json();if(!o.ok)throw Error(null!==(r=s.error)&&void 0!==r?r:e("toolWidgets.reverseGeocode.errorLookupFailed"));p(s)}catch(o){m(o instanceof Error?o.message:e("toolWidgets.reverseGeocode.errorLookupFailedRetry"))}finally{v(!1)}}let G=null==g?void 0:g.components;return(0,l.jsx)(d.tG,{children:(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,l.jsx)(d._s,{label:e("toolWidgets.reverseGeocode.latitude"),type:"number",value:o,onChange:e=>t(e.target.value),suffix:"\xb0",placeholder:e("toolWidgets.reverseGeocode.latPlaceholder"),min:"-90",max:"90",step:"0.000001"}),(0,l.jsx)(d._s,{label:e("toolWidgets.reverseGeocode.longitude"),type:"number",value:n,onChange:e=>u(e.target.value),suffix:"\xb0",placeholder:e("toolWidgets.reverseGeocode.lngPlaceholder"),min:"-180",max:"180",step:"0.000001"})]}),(0,l.jsx)("button",{type:"button",onClick:function(){if(!navigator.geolocation){m(e("toolWidgets.reverseGeocode.errorGeoUnsupported"));return}h(!0),m("");let o=!1,l=null;navigator.geolocation.getCurrentPosition(e=>{o=!0,null!==l&&(clearTimeout(l),l=null),t(e.coords.latitude.toFixed(6)),u(e.coords.longitude.toFixed(6)),m(""),h(!1)},t=>{if(o){h(!1);return}let r=t.code===t.PERMISSION_DENIED?e("toolWidgets.reverseGeocode.errorPermissionDenied"):t.code===t.POSITION_UNAVAILABLE?e("toolWidgets.reverseGeocode.errorPositionUnavailable"):t.code===t.TIMEOUT?e("toolWidgets.reverseGeocode.errorTimeout"):e("toolWidgets.reverseGeocode.errorLocationGeneric");l=setTimeout(()=>{o||(m(r),h(!1))},300)},{timeout:1e4,enableHighAccuracy:!1})},disabled:y,"data-track-cat":"tool_widget","data-track-label":"Use My Location",className:"flex w-full items-center justify-center gap-2 rounded-xl border border-lp-blue/30 bg-lp-blue/5 px-4 py-2.5 text-sm font-semibold text-lp-blue transition-colors hover:bg-lp-blue/10 disabled:opacity-60",children:y?e("toolWidgets.reverseGeocode.locating"):e("toolWidgets.reverseGeocode.useMyLocation")}),(0,l.jsx)("button",{type:"button",onClick:f,disabled:b||""===o||""===n,"data-track-cat":"tool_widget",className:"flex w-full items-center justify-center gap-2 rounded-xl bg-lp-blue px-5 py-3 text-sm font-bold text-white transition-all hover:bg-lp-blue-600 hover:shadow-[0_4px_16px_rgba(69,110,254,0.4)] disabled:cursor-not-allowed disabled:opacity-50",children:b?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.Z,{size:15,className:"animate-spin"}),e("toolWidgets.reverseGeocode.lookingUp")]}):e("toolWidgets.reverseGeocode.findAddress")}),x&&(0,l.jsx)(d.qX,{tone:"error",children:x}),g&&G&&(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsxs)("div",{className:"flex items-start gap-2 rounded-xl bg-lp-bg px-4 py-3",children:[(0,l.jsx)(i.Z,{size:14,className:"mt-0.5 shrink-0 text-lp-blue"}),(0,l.jsx)("p",{className:"text-sm text-lp-slate",children:g.displayName})]}),G.street&&(0,l.jsx)(d.O0,{label:e("toolWidgets.reverseGeocode.street"),value:G.street,copyable:!0}),G.city&&(0,l.jsx)(d.O0,{label:e("toolWidgets.reverseGeocode.cityTown"),value:G.city,copyable:!0}),G.state&&(0,l.jsx)(d.O0,{label:e("toolWidgets.reverseGeocode.stateRegion"),value:G.state,copyable:!0}),G.postalCode&&(0,l.jsx)(d.O0,{label:e("toolWidgets.reverseGeocode.postalCode"),value:G.postalCode,copyable:!0}),G.country&&(0,l.jsx)(d.O0,{label:e("toolWidgets.reverseGeocode.country"),value:"".concat(G.country," (").concat(G.countryCode,")"),copyable:!0}),(0,l.jsx)(d.O0,{label:e("toolWidgets.reverseGeocode.fullAddress"),value:g.displayName,copyable:!0})]}),(0,l.jsx)(s.default,{href:"/measure",className:"block text-xs text-lp-slate underline transition-colors hover:text-lp-blue",children:e("toolWidgets.reverseGeocode.measureAreaLink")})]})})}}}]);
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.