(globalThis["TURBOPACK_remote_chunk_loading_global_wx-next-web"]||(globalThis["TURBOPACK_remote_chunk_loading_global_wx-next-web"]=[])).push(["object"==typeof document?document.currentScript:void 0,992813,e=>{"use strict";var t=e.i(902875),r=e.i(64412),i=e.i(617874),s=e.i(247865),l=e.i(381477),a=e.i(546446),o=e.i(643548),n=e.i(674885),d=e.i(725287),c=e.i(523126),m=e.i(611540),u=e.i(664592),b=e.i(785355);let x={revalidateOnFocus:!1,dedupingInterval:6e4};var g=e.i(581014),p=e.i(202340),h=e.i(380993),f=e.i(548888),_=e.i(892186),v=e.i(240058),N=e.i(846871),j=e.i(632137);let w={ts:"border-[#61c747] bg-[#224818]",l:"border-[#25bef7] bg-[#093b4d]",cat1:"text-[0.625rem] border-[#ebdb02] bg-[#494501]",cat2:"text-[0.625rem] border-[#ebb700] bg-[#524000]",cat3:"text-[0.625rem] border-[#fc8800] bg-[#502c02]",cat4:"text-[0.625rem] border-[#fc5e00] bg-[#511e00]",cat5:"text-[0.625rem] border-[#ed2325] bg-[#4f0c0d]"},T=({titleKey:e,outboundUrl:r,imageUrl:l,stormDetails:a,units:o,loading:n})=>{let d=(0,g.useTranslations)("HurricaneTracker"),c=(0,g.useTranslations)("DetailsTable"),{advisoryTime:m,stormName:u,stormType:b,stormTypeCode:x,stormSubTypeCode:T,maxWind:y,direction:C,speed:S,pressure:U}=a||{},k=((0,i.unitsSystemByCode)(o)??i.imperial).speed,M=(0,s.useMemo)(()=>{let e="l";return T&&(e=`cat${T}`),T||"TS"!==x||(e="ts"),e},[T,x]);return(0,t.jsxs)(h.Card,{"data-testid":"HurricaneTracker","aria-label":d(e),children:[e&&(0,t.jsx)(h.CardHeader,{text:d(e)}),(0,t.jsx)(h.CardContent,{className:"p-0",children:(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsxs)(v.default,{href:r,className:"block",children:[(0,t.jsx)("div",{className:"absolute h-full w-full rounded-lg bg-gradient-to-b from-black via-transparent to-black [background:linear-gradient(0deg,rgba(0,0,0,1)_0%,rgba(0,0,0,0)_20%,rgba(0,0,0,0)_80%,rgba(0,0,0,1)_100%)]"}),(0,t.jsx)("div",{className:"z-0 h-80 w-full rounded-lg bg-[#4d505b] bg-cover bg-center",style:l?{backgroundImage:`url(${l})`}:void 0}),(0,p.isNotNil)(u)&&(0,t.jsxs)("div",{className:"absolute top-0 z-[1] mt-3 ml-4 flex max-w-[60%] text-sm leading-[1.25] text-white",children:[(0,t.jsx)("div",{className:(0,j.cn)("box-border flex h-[35px] w-[35px] min-w-[35px] items-center justify-center rounded-full border-2 border-white bg-gray-500 p-0.5 text-center leading-none font-bold",w[M]),children:x}),(0,t.jsxs)("div",{className:"ml-2.5 flex flex-col",children:[(0,t.jsx)("div",{className:"text-base leading-[1.15] font-bold",children:`${b} ${u}`}),(0,t.jsx)("div",{className:"text-xs",children:m})]})]}),(0,p.isNotNil)(S)&&(0,p.isNotNil)(C)&&(0,t.jsxs)("ul",{className:"absolute bottom-0 z-[1] box-border flex w-full list-none flex-row px-4 py-3 text-sm leading-[1.25] text-white",children:[(0,t.jsxs)("li",{className:"mr-8",children:[(0,t.jsx)("div",{className:"text-xs",children:d("maxWinds")}),(0,t.jsx)("div",{className:"font-bold",children:(0,t.jsx)(f.Wind,{windSpeed:y??void 0,units:o})})]}),(0,t.jsxs)("li",{className:"mr-8",children:[(0,t.jsx)("div",{className:"text-xs",children:d("movement")}),(0,t.jsx)("div",{className:"font-bold",children:d("directionSpeedUnit",{direction:C,speed:S,windUnit:k})})]}),(0,t.jsxs)("li",{className:"mr-0",children:[(0,t.jsx)("div",{className:"text-xs",children:c("pressure")}),(0,t.jsx)("div",{className:"font-bold",children:U?`${U} mb`:"--"})]})]}),n&&(0,t.jsx)(N.Loader,{className:"absolute top-1/2 left-1/2 -translate-1/2",variant:"white",size:"lg",label:"Loading"})]}),(0,t.jsx)(_.MapboxAttribution,{position:"top-right",color:"white",className:"!top-[13px] !right-4 z-[1] [&_button]:!p-0",stack:!0})]})})]})},y=({location:e,titleKey:r,zoom:g,stormId:p,basin:h,showPT:f,initializing:_,initialError:v})=>{let N=(0,a.useAtomValue)(n.userUnitPreferenceAtom),j=(0,i.unitsSystemByName)(N)?.code,{imageUrl:w,interactiveMapUrl:y,stormDetails:C,isLoading:S,error:U}=(({location:e,basin:t,showPT:r,stormId:g,overlays:p,zoom:h,stormIdSelectorName:f})=>{let{countryCode:_,placeId:v,ianaTimeZone:N}=e||{},j=(0,d.useParams)().locale||"en-US",w=j?.split("-")[0],T=(0,a.useAtomValue)(n.userUnitPreferenceAtom),y=((0,i.unitsSystemByName)(T)||i.imperial).code,C=(0,m.interpolateUrl)(m.URLS.radar,{locale:j,locId:v||""}),{data:S,isLoading:U,error:k}=(0,l.default)(e?["getTropicalCurrentPosition",t||"all","default","false",y,j]:null,([e,t,r,i,s,l])=>(0,o.getTropicalCurrentPosition)({basin:t,source:r,nautical:i,units:s,language:l}),x),M=S?.advisoryinfo,L=(0,s.useMemo)(()=>{if(!M||!M.length)return;let e=new Date(Date.now()),t=[];return M.forEach(i=>{let s=i?.currentposition?.storm_type_cd;if("RO"===s||"PT"===s&&!r)return;let l=new Date(i.adv_dt_tm),a=(0,c.diffInDays)(e.toString(),l.toString());(0===a||-1===a)&&("AL"===i.basin?t.unshift(i):t.push(i))}),t.length>0?t:void 0},[M,r]),P=(0,s.useMemo)(()=>{if(!L||!g)return null;let e=L.find(e=>e.storm_id.toLowerCase()===g.toLowerCase());if(e)return e;let t=L.find(e=>e.storm_name.toLowerCase()===g.toLowerCase());return t||null},[L,g]),A=(0,s.useMemo)(()=>P||f?P:!P&&L?L[0]:null,[L,P,f]),I=(0,s.useMemo)(()=>{if(!A)return null;let e=A.currentposition?.storm_type_cd,t=A.currentposition?.storm_sub_type_cd,r=A.adv_dt_tm,i=A.currentposition?.min_pressure;return i&&"e"===y&&(i=Math.round(33.8639*i)),i||(i=null),{advisoryTime:(0,u.formatShortMonthDateTime)({date:r,locale:j,timeZone:N||"UTC"}),maxWind:A.currentposition?.max_sustained_wind,stormName:A.storm_name,stormSubType:A.currentposition?.storm_sub_type,stormSubTypeCode:t,stormType:A.currentposition?.storm_type,stormTypeCode:t?`CAT ${t}`:"TS"===e?"TS":"L",direction:A.currentposition?.heading?.storm_dir_cardinal,speed:A.currentposition?.heading?.storm_spd,pressure:i}},[A,j,N,y]),z=(0,s.useMemo)(()=>A?(0,b.buildStormImageUrl)(A,{languageCode:w,countryCode:_,overlays:p,zoom:h}):null,[A,w,_,p,h]),D=(0,s.useMemo)(()=>A?(0,b.buildInteractiveMapUrl)({radarUrl:C,hasPlaceId:!!v,stormName:A.storm_name,zoom:h}):null,[A,v,C,h]);return{tropicalStorms:M,isLoading:U,error:k,allActiveStorms:L,queriedStorm:P,stormData:A,stormDetails:I,imageUrl:z,interactiveMapUrl:D}})({location:e,zoom:g||void 0,stormId:p||void 0,basin:h||void 0,showPT:f||void 0});return v||U?null:(0,t.jsx)(T,{titleKey:r??"title",outboundUrl:y??"",imageUrl:w,units:j,stormDetails:C,loading:!!(S||_)})},C=({hideModule:e,...i})=>{let{location:s,isLoading:l,error:a}=(0,r.useLocation)();return e?null:(0,t.jsx)(y,{...i,location:s,initializing:l,initialError:a})};e.s(["HurricaneTrackerBlockClient",0,C,"default",0,C],992813)},538911,function(e){e.n(e.i(992813))}]);