1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1135],{91135:function(e,t,o){o.r(t),o.d(t,{default:function(){return g}});var l=o(57437),i=o(2265),a=o(27648),s=o(51817),r=o(26899),n=o(66927),d=o(62973),c=o(23959),m=o(70682),h=o(1592);let u={0:{label:"toolWidgets.weatherAtPoint.wmoClearSky",emoji:"âï¸"},1:{label:"toolWidgets.weatherAtPoint.wmoMainlyClear",emoji:"\uD83C\uDF24ï¸"},2:{label:"toolWidgets.weatherAtPoint.wmoPartlyCloudy",emoji:"â
"},3:{label:"toolWidgets.weatherAtPoint.wmoOvercast",emoji:"âï¸"},45:{label:"toolWidgets.weatherAtPoint.wmoFoggy",emoji:"\uD83C\uDF2Bï¸"},48:{label:"toolWidgets.weatherAtPoint.wmoIcyFog",emoji:"\uD83C\uDF2Bï¸"},51:{label:"toolWidgets.weatherAtPoint.wmoLightDrizzle",emoji:"\uD83C\uDF26ï¸"},53:{label:"toolWidgets.weatherAtPoint.wmoModerateDrizzle",emoji:"\uD83C\uDF26ï¸"},55:{label:"toolWidgets.weatherAtPoint.wmoDenseDrizzle",emoji:"\uD83C\uDF27ï¸"},61:{label:"toolWidgets.weatherAtPoint.wmoSlightRain",emoji:"\uD83C\uDF27ï¸"},63:{label:"toolWidgets.weatherAtPoint.wmoModerateRain",emoji:"\uD83C\uDF27ï¸"},65:{label:"toolWidgets.weatherAtPoint.wmoHeavyRain",emoji:"\uD83C\uDF27ï¸"},71:{label:"toolWidgets.weatherAtPoint.wmoSlightSnowfall",emoji:"\uD83C\uDF28ï¸"},73:{label:"toolWidgets.weatherAtPoint.wmoModerateSnowfall",emoji:"âï¸"},75:{label:"toolWidgets.weatherAtPoint.wmoHeavySnowfall",emoji:"âï¸"},77:{label:"toolWidgets.weatherAtPoint.wmoSnowGrains",emoji:"\uD83C\uDF28ï¸"},80:{label:"toolWidgets.weatherAtPoint.wmoSlightRainShowers",emoji:"\uD83C\uDF26ï¸"},81:{label:"toolWidgets.weatherAtPoint.wmoModerateShowers",emoji:"\uD83C\uDF27ï¸"},82:{label:"toolWidgets.weatherAtPoint.wmoViolentShowers",emoji:"âï¸"},85:{label:"toolWidgets.weatherAtPoint.wmoSlightSnowShowers",emoji:"\uD83C\uDF28ï¸"},86:{label:"toolWidgets.weatherAtPoint.wmoHeavySnowShowers",emoji:"âï¸"},95:{label:"toolWidgets.weatherAtPoint.wmoThunderstorm",emoji:"âï¸"},96:{label:"toolWidgets.weatherAtPoint.wmoThunderstormHail",emoji:"âï¸"},99:{label:"toolWidgets.weatherAtPoint.wmoThunderstormHeavyHail",emoji:"âï¸"}},x=["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"];function g(){var e;let{t}=(0,h.NT)(),[o,g]=(0,i.useState)(""),[p,w]=(0,i.useState)(""),[b,j]=(0,i.useState)(null),[P,W]=(0,i.useState)(""),[A,f]=(0,i.useState)(!1),[N,v]=(0,i.useState)(""),[D,y]=(0,i.useState)(!1);async function S(){let e=(0,m.OK)(o),l=(0,m.OK)(p);if(""===o||""===p||Math.abs(e)>90||Math.abs(l)>180){v(t("toolWidgets.weatherAtPoint.errorCoordRange"));return}f(!0),v(""),j(null);try{var i;let o=new URL("https://api.open-meteo.com/v1/forecast");o.searchParams.set("latitude",String(e)),o.searchParams.set("longitude",String(l)),o.searchParams.set("timezone","auto"),o.searchParams.set("forecast_days","1"),o.searchParams.set("current","temperature_2m,apparent_temperature,relative_humidity_2m,precipitation,weather_code,wind_speed_10m,wind_direction_10m,is_day");let a=await fetch(o.toString());if(!a.ok)throw Error(t("toolWidgets.weatherAtPoint.errorServiceUnavailable"));let s=await a.json(),r=s.current;if(!r)throw Error(t("toolWidgets.weatherAtPoint.errorNoData"));j(r),W(null!==(i=s.timezone)&&void 0!==i?i:"")}catch(e){v(e instanceof Error?e.message:t("toolWidgets.weatherAtPoint.errorFetchFailed"))}finally{f(!1)}}let _=b?null!==(e=u[b.weather_code])&&void 0!==e?e:{label:"toolWidgets.weatherAtPoint.wmoCodeFallback",emoji:"\uD83C\uDF21ï¸"}:null,C=(null==b?void 0:b.is_day)===0;return(0,l.jsx)(m.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)(m._s,{label:t("toolWidgets.weatherAtPoint.latitude"),type:"number",value:o,onChange:e=>g(e.target.value),suffix:"\xb0",placeholder:t("toolWidgets.weatherAtPoint.latPlaceholder"),min:"-90",max:"90",step:"0.0001"}),(0,l.jsx)(m._s,{label:t("toolWidgets.weatherAtPoint.longitude"),type:"number",value:p,onChange:e=>w(e.target.value),suffix:"\xb0",placeholder:t("toolWidgets.weatherAtPoint.lngPlaceholder"),min:"-180",max:"180",step:"0.0001"})]}),(0,l.jsx)("button",{type:"button",onClick:function(){if(!navigator.geolocation){v(t("toolWidgets.weatherAtPoint.errorGeoUnsupported"));return}y(!0),v("");let e=!1,o=null;navigator.geolocation.getCurrentPosition(t=>{e=!0,null!==o&&(clearTimeout(o),o=null),g(t.coords.latitude.toFixed(5)),w(t.coords.longitude.toFixed(5)),v(""),y(!1)},l=>{if(e){y(!1);return}let i=l.code===l.PERMISSION_DENIED?t("toolWidgets.weatherAtPoint.errorPermissionDenied"):l.code===l.POSITION_UNAVAILABLE?t("toolWidgets.weatherAtPoint.errorPositionUnavailable"):l.code===l.TIMEOUT?t("toolWidgets.weatherAtPoint.errorTimeout"):t("toolWidgets.weatherAtPoint.errorLocationGeneric");o=setTimeout(()=>{e||(v(i),y(!1))},300)},{timeout:1e4,enableHighAccuracy:!1})},disabled:D,"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:D?t("toolWidgets.weatherAtPoint.locating"):t("toolWidgets.weatherAtPoint.useMyLocation")}),(0,l.jsx)("button",{type:"button",onClick:S,disabled:A||""===o||""===p,"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:A?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(s.Z,{size:15,className:"animate-spin"}),t("toolWidgets.weatherAtPoint.fetchingWeather")]}):t("toolWidgets.weatherAtPoint.getCurrentWeather")}),N&&(0,l.jsx)(m.qX,{tone:"error",children:N}),b&&_&&(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsxs)("div",{className:"rounded-xl border border-lp-blue/20 bg-lp-blue/[0.06] px-5 py-5 text-center",children:[(0,l.jsx)("div",{className:"text-4xl leading-none",children:C?"\uD83C\uDF19":_.emoji}),(0,l.jsx)("p",{className:"mt-2 text-3xl font-bold text-lp-blue",children:(0,l.jsxs)("span",{dir:"ltr",children:[(0,m.ZN)(b.temperature_2m,1),"\xb0C"]})}),(0,l.jsx)("p",{className:"mt-0.5 text-sm font-semibold text-lp-ink",children:t(_.label,{code:b.weather_code})}),P&&(0,l.jsx)("p",{className:"mt-0.5 text-xs text-lp-slate",children:P})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-2.5",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 rounded-xl bg-lp-bg px-4 py-3",children:[(0,l.jsx)(r.Z,{size:16,className:"shrink-0 text-lp-blue"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-xs text-lp-slate",children:t("toolWidgets.weatherAtPoint.feelsLike")}),(0,l.jsx)("p",{className:"font-mono text-sm font-bold text-lp-ink",children:(0,l.jsxs)("span",{dir:"ltr",children:[(0,m.ZN)(b.apparent_temperature,1),"\xb0C"]})})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 rounded-xl bg-lp-bg px-4 py-3",children:[(0,l.jsx)(n.Z,{size:16,className:"shrink-0 text-lp-blue"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-xs text-lp-slate",children:t("toolWidgets.weatherAtPoint.humidity")}),(0,l.jsx)("p",{className:"font-mono text-sm font-bold text-lp-ink",children:(0,l.jsxs)("span",{dir:"ltr",children:[b.relative_humidity_2m,"%"]})})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 rounded-xl bg-lp-bg px-4 py-3",children:[(0,l.jsx)(d.Z,{size:16,className:"shrink-0 text-lp-blue"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-xs text-lp-slate",children:t("toolWidgets.weatherAtPoint.wind")}),(0,l.jsxs)("p",{className:"font-mono text-sm font-bold text-lp-ink",children:[(0,l.jsxs)("span",{dir:"ltr",children:[(0,m.ZN)(b.wind_speed_10m,1)," km/h"]})," ",x[Math.round(b.wind_direction_10m/22.5)%16]]})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 rounded-xl bg-lp-bg px-4 py-3",children:[(0,l.jsx)(c.Z,{size:16,className:"shrink-0 text-lp-blue"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-xs text-lp-slate",children:t("toolWidgets.weatherAtPoint.precipitation")}),(0,l.jsx)("p",{className:"font-mono text-sm font-bold text-lp-ink",children:(0,l.jsxs)("span",{dir:"ltr",children:[(0,m.ZN)(b.precipitation,1)," mm"]})})]})]})]})]}),(0,l.jsx)(a.default,{href:"/measure",className:"block text-xs text-lp-slate underline transition-colors hover:text-lp-blue",children:t("toolWidgets.weatherAtPoint.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.