const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./BvCujbeF.js","./aNasIbik.js","./F4mCmN5V.js","./entry.DWOfX-bB.css"])))=>i.map(i=>d[i]); import{K as x,g as v,q as y,W as w,R as F,o as b,d as C,E as R,D as M,m as h,c as S}from"./F4mCmN5V.js";import{c as L,g as j}from"./B3UrLtWp.js";import{b as B}from"./BWFx8sgc.js";import{f as k,g as D}from"./BHNEEQEo.js";import{u as E}from"./BJhyvbvB.js";import{u as P}from"./CklmMKNQ.js";const I="https://api.weather.com";function N(){const{public:{weatherApiKey:c}}=x(),{units:s}=E(),{language:o}=P();async function i(p){const l=p.split(",").map(Number);if(l.length!==4||l.some(isNaN))return{stations:[]};const[m,g,f,t]=l,a=await k({minLon:m,minLat:g,maxLon:f,maxLat:t});if(a.length===0)return{stations:[]};const r=a.map(e=>`${e.a},${e.o}`).join(";"),d=await $fetch(`${I}/v3/aggcommon/v3-wx-observations-current`,{query:{geocodes:r,apiKey:c,format:"json",language:"en-US",units:s.value}}),u=[];return a.forEach((e,_)=>{const n=d[_]?.["v3-wx-observations-current"];n&&u.push({name:D(e,o.value),lat:e.a,lon:e.o,temperature:n.temperature,conditionShort:n.wxPhraseShort,conditionMedium:n.wxPhraseMedium,conditionLong:n.wxPhraseLong,iconCode:n.iconCode,windDirection:n.windDirectionCardinal,windSpeed:n.windSpeed})}),{stations:u}}return{fetchRegional:i}}const A=v({__name:"RegionalForecastMap",props:{geocode:{},zoom:{}},setup(c){const s=R(null),o=M(null),i=c,p=h(()=>j(i.geocode)),l=h(()=>L(p.value,180)),m=x(),{fetchRegional:g}=N();async function f(){if(!o.value)return;const t=o.value.getBounds();if(!t)return;const a=[t.getWest(),t.getSouth(),t.getEast(),t.getNorth()].join(",");try{const d={type:"FeatureCollection",features:(await g(a)).stations.map((e,_)=>({type:"Feature",geometry:{type:"Point",coordinates:[e.lon,e.lat]},properties:{name:e.name,temperature:e.temperature,iconId:B(e.iconCode),sortKey:_}}))},u=o.value.getSource("stations");u?u.setData(d):(o.value.addSource("stations",{type:"geojson",data:d}),o.value.addLayer({id:"station-labels",type:"symbol",source:"stations",layout:{"symbol-sort-key":["get","sortKey"],"text-field":["format",["get","name"],{"text-color":"#FFFFFF"},` `,{},["concat",["to-string",["get","temperature"]]],{"text-color":"#FFFF6F"}," ",{},["image",["get","iconId"]]],"text-font":["Martian Mono Condensed Medium","DIN Pro Medium","Arial Unicode MS Regular"],"text-size":24,"text-anchor":"center","text-justify":"center","text-allow-overlap":!1,"icon-allow-overlap":!1,"text-padding":10},paint:{"text-halo-color":"#000000","text-halo-width":1}}))}catch(r){console.error("[RegionalForecastMap] Failed to fetch regional data:",r)}}return y(async()=>{if(!s.value)return;const{default:t}=await w(async()=>{const{default:a}=await import("./BvCujbeF.js").then(r=>r.m);return{default:a}},__vite__mapDeps([0,1,2,3]),import.meta.url);t.accessToken=m.public.mapboxApiToken,o.value=new t.Map({attributionControl:!1,container:s.value,style:m.public.mapboxRegionalStyle,bounds:l.value,interactive:!1,fadeDuration:0}),o.value.on("load",()=>{f()})}),F(()=>{o.value?.remove()}),(t,a)=>(b(),C("div",{ref_key:"mapContainer",ref:s,class:"bg-twc-blue h-full w-full"},null,512))}}),K=Object.assign(A,{__name:"RegionalForecastMap"}),T=v({__name:"RegionalForecast",props:{geocode:{}},setup(c){return(s,o)=>{const i=K;return b(),S(i,{geocode:c.geocode},null,8,["geocode"])}}}),V=Object.assign(T,{__name:"ScreensRegionalForecast"});export{V as _};