PageSourceSearch

https://www.asturmet.com/_next/static/chunks/app/layout-3962c797ac5bab44.js

js asturmet.com collected 2026-09-24 18:31:00 UTC 50,294 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{3167:(e,t,a)=>{"use strict";a.d(t,{Ei:()=>l,S$:()=>d,Y1:()=>r,YQ:()=>o,fj:()=>s,k5:()=>i,nV:()=>n});let r={cantabrico:"Cant\xe1brico",asturias:"Asturias",cordillera:"Monta\xf1a",galicia:"Galicia",cantabria:"Cantabria","pais-vasco":"Pa\xeds Vasco"},s={temperatura:"Temperatura",lluvia:"Lluvia",viento:"Viento",rachas:"Rachas",humedad:"Humedad",nubosidad:"Nubosidad",presion:"Presi\xf3n"};function n(e){if(!/^\/v1\/forecast-layers\/(?:runs\/[a-f0-9]{64}\/(?:regions\/[a-z-]+\/(?:ecmwf|gfs)\/manifest\.json|assets\/[a-f0-9]{64}\.(?:png|json)))$/.test(e))throw Error("invalid_layer_url");return e}function i(e){if(!e||1!==e.schemaVersion||!/^[a-f0-9]{64}$/.test(e.layerRunId)||!["ecmwf","gfs"].includes(e.model)||e.sourceNamespace!==("gfs"===e.model?"base":"models/ecmwf")||!/^[A-Za-z0-9._-]{1,128}$/.test(e.sourceForecastRunId)||![e.sourceCatalogChecksum,e.sourceRegionsChecksum,e.sourceBoundaryChecksum].every(e=>"string"==typeof e&&/^[a-f0-9]{64}$/.test(e))||!Object.hasOwn(r,e.region)||!Number.isFinite(Date.parse(e.modelRunAt))||"EPSG:3857"!==e.crs||!Array.isArray(e.bounds)||4!==e.bounds.length||!e.bounds.every(Number.isFinite)||e.bounds[0]<-9.5||e.bounds[2]>-1.5||e.bounds[1]<41.7||e.bounds[3]>44||e.bounds[0]>=e.bounds[2]||e.bounds[1]>=e.bounds[3]||!Array.isArray(e.layers)||7!==e.layers.length||7!==new Set(e.layers.map(e=>e.id)).size||!Array.isArray(e.overlays)||e.overlays.length>130)throw Error("invalid_layer_manifest");let t=t=>{if(!t||!/^[a-f0-9]{64}$/.test(t.checksum)||!t.id.startsWith(`${t.checksum}.`)||t.bytes<=0||t.bytes>4e6||t.url!==`/v1/forecast-layers/runs/${e.layerRunId}/assets/${t.id}`)throw Error("invalid_layer_asset");n(t.url)};if(t(e.geometry),e.viewBounds&&(4!==e.viewBounds.length||!e.viewBounds.every(Number.isFinite)||e.viewBounds[0]<-9.5||e.viewBounds[2]>-1.5||e.viewBounds[1]<41.7||e.viewBounds[3]>44||e.viewBounds[0]>=e.viewBounds[2]||e.viewBounds[1]>=e.viewBounds[3]))throw Error("invalid_layer_viewport");for(let a of e.layers){if(!Object.hasOwn(s,a.id)||!Array.isArray(a.frames)||a.frames.length>130||!Array.isArray(a.levels)||!Array.isArray(a.colors)||a.levels.length<2||a.levels.length>32||a.levels.length!==a.colors.length||!a.levels.every(Number.isFinite)||!a.colors.every(e=>/^#[a-f0-9]{6}$/i.test(e)))throw Error("invalid_layer");for(let[e,r]of a.frames.entries()){if(!Number.isFinite(Date.parse(r.validTime))||e>0&&Date.parse(r.validTime)<=Date.parse(a.frames[e-1].validTime)||!Number.isInteger(r.width)||!Number.isInteger(r.height)||r.width<2||r.height<2||r.width*r.height>1e6)throw Error("invalid_frame");t(r.image)}}for(let a of e.overlays)a.wind&&t(a.wind),a.isobars&&t(a.isobars);return e}function o(e,t,a=Date.now()){if(!e.length)return 0;if(!t||!Number.isFinite(Date.parse(t))){let t=e.findIndex(e=>Date.parse(e.validTime)>=a);return t<0?e.length-1:t}let r=Date.parse(t);return e.reduce((t,a,s)=>Math.abs(Date.parse(a.validTime)-r)<Math.abs(Date.parse(e[t].validTime)-r)?s:t,0)}function l(e){if(!e||80!==e.width||32!==e.height||"EPSG:3857"!==e.crs||"m/s"!==e.unit||!Array.isArray(e.bounds)||4!==e.bounds.length||!e.bounds.every(Number.isFinite)||![e.u,e.v].every(e=>Array.isArray(e)&&2560===e.length&&e.every(e=>null===e||Number.isFinite(e)&&250>=Math.abs(e))))throw Error("invalid_wind_grid");return e}function d(e){return new Intl.DateTimeFormat("es-ES",{timeZone:"Europe/Madrid",weekday:"short",day:"2-digit",month:"short",hour:"2-digit",minute:"2-digit",timeZoneName:"short"}).format(new Date(e))}},10422:(e,t,a)=>{"use strict";a.d(t,{MobileNav:()=>R});var r=a(95155),s=a(66614),n=a(58120),i=a(15197),o=a(18281),l=a(33024),d=a(98500),c=a.n(d),u=a(12115),m=a(73321),f=a(72140),h=a(89999),p=a(29483),x=a(33210),g=a(40980);function b({...e}){return(0,r.jsx)(p.bL,{"data-slot":"sheet",...e})}function v({...e}){return(0,r.jsx)(p.l9,{"data-slot":"sheet-trigger",...e})}function y({...e}){return(0,r.jsx)(p.bm,{"data-slot":"sheet-close",...e})}function w({...e}){return(0,r.jsx)(p.ZL,{"data-slot":"sheet-portal",...e})}function j({className:e,...t}){return(0,r.jsx)(p.hJ,{"data-slot":"sheet-overlay",className:(0,g.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function N({className:e,children:t,side:a="right",...s}){return(0,r.jsxs)(w,{children:[(0,r.jsx)(j,{}),(0,r.jsxs)(p.UC,{"data-slot":"sheet-content",className:(0,g.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500","right"===a&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm","left"===a&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm","top"===a&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b","bottom"===a&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",e),...s,children:[t,(0,r.jsxs)(p.bm,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[(0,r.jsx)(x.A,{className:"size-4"}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function k({className:e,...t}){return(0,r.jsx)("div",{"data-slot":"sheet-header",className:(0,g.cn)("flex flex-col gap-1.5 p-4",e),...t})}function A({className:e,...t}){return(0,r.jsx)(p.hE,{"data-slot":"sheet-title",className:(0,g.cn)("text-foreground font-semibold",e),...t})}function E({className:e,...t}
1){return(0,r.jsx)(p.VY,{"data-slot":"sheet-description",className:(0,g.cn)("text-muted-foreground text-sm",e),...t})}function S(){let e=(0,m.usePathname)(),{scope:t}=(0,h.B)(),[a,s]=(0,u.useState)(!1),n=e?.startsWith("/estaciones")||e?.startsWith("/climatologia");return(0,u.useEffect)(()=>{let e=window.matchMedia("(min-width: 768px)"),t=()=>{e.matches&&s(!1)};return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[]),(0,r.jsxs)(b,{open:a,onOpenChange:s,children:[(0,r.jsx)(v,{asChild:!0,children:(0,r.jsxs)("button",{type:"button",className:(0,g.cn)("relative flex h-full w-full flex-col items-center justify-center gap-1 group",n?"text-primary":"text-muted-foreground hover:text-foreground"),children:[n&&(0,r.jsx)("span",{className:"absolute inset-x-0 -top-[1px] mx-auto h-[2px] w-8 rounded-full bg-primary"}),(0,r.jsx)(o.A,{strokeWidth:n?2.5:1.5,className:"h-6 w-6"}),(0,r.jsx)("span",{className:"text-[10px] font-medium tracking-wide uppercase",children:"Observado"})]})}),(0,r.jsxs)(N,{side:"bottom",className:"rounded-t-2xl pb-[max(1rem,env(safe-area-inset-bottom))]",children:[(0,r.jsxs)(k,{children:[(0,r.jsx)(A,{children:"Observado"}),(0,r.jsx)(E,{children:"Consulta las estaciones y sus datos meteorol\xf3gicos."})]}),(0,r.jsx)("nav",{"aria-label":"Datos observados",className:"grid gap-2 px-4",children:[{href:`/estaciones?region=${t}`,path:"/estaciones",label:"Tiempo real",icon:o.A},{href:`/climatologia?region=${t}`,path:"/climatologia",label:"Climatolog\xeda",icon:f.A}].map(({href:t,path:a,label:s,icon:n})=>(0,r.jsx)(y,{asChild:!0,children:(0,r.jsxs)(c(),{href:t,"aria-current":e?.startsWith(a)?"page":void 0,className:(0,g.cn)("flex min-h-14 items-center gap-3 rounded-xl border border-border px-4 py-3 text-sm font-medium hover:bg-accent",e?.startsWith(a)&&"border-primary/30 bg-primary/5 text-primary"),children:[(0,r.jsx)(n,{className:"h-5 w-5","aria-hidden":"true"}),s]})},a))})]})]})}var C=a(39430),_=a(11145),T=a(88276),M=a(11239);let D=[{name:"Inicio",href:"/",icon:s.A},{name:"Pron\xf3stico",href:"/pronostico",icon:n.A},{name:"Noticias",href:"/noticias",icon:i.A},{name:"Estaciones",href:"/estaciones",icon:o.A}];function R(){let e=(0,m.usePathname)(),{hasUnreadNews:t}=(0,T.Q)();return(0,r.jsxs)("div",{className:"fixed bottom-0 left-0 right-0 z-50 md:hidden",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-xl border-t border-border"}),(0,r.jsx)("nav",{className:"relative flex justify-around items-center h-16 pb-safe",children:D.map(a=>{if("/estaciones"===a.href)return(0,r.jsx)(S,{},a.name);let s="/"===a.href?"/"===e:e?.startsWith(a.href),n="/noticias"===a.href&&t,i=a.icon;return(0,r.jsxs)(c(),{href:a.href,"aria-label":"/noticias"===a.href?(0,_.iU)(n):a.name,className:"relative flex flex-col items-center justify-center w-full h-full group",children:[s&&(0,r.jsx)(C.P.div,{layoutId:"mobile-nav-active",className:"absolute inset-x-0 -top-[1px] h-[2px] bg-primary mx-auto w-8 rounded-full",initial:{opacity:0}
1,animate:{opacity:1},transition:{duration:.3}}),(0,r.jsxs)("div",{className:(0,g.cn)("flex flex-col items-center gap-1 transition-colors duration-200",s?"text-primary":"text-muted-foreground group-hover:text-foreground"),children:[(0,r.jsxs)("span",{className:"relative",children:[(0,r.jsx)(i,{strokeWidth:s?2.5:1.5,className:"w-6 h-6"}),(0,r.jsx)(M.O,{visible:n,className:"-right-1.5 -top-1.5"})]}),(0,r.jsx)("span",{className:"text-[10px] font-medium tracking-wide uppercase",children:a.name})]})]},a.name)})})]})}D.push({name:"Modelos",href:"/modelos",icon:l.A})},11145:(e,t,a)=>{"use strict";a.d(t,{XL:()=>i,Z7:()=>o,cb:()=>s,en:()=>c,iU:()=>d,lu:()=>r,xi:()=>l});let r="asturmet:read-news:v1",s="asturmet:news-read";function n(e,t){let a=t-Date.parse(e);return Number.isFinite(a)&&a>=0&&a<864e5}function i(e,t){let a;try{a=JSON.parse(e.getItem(r)??"{}")}catch{return e.removeItem(r),{}}if(!a||"object"!=typeof a||Array.isArray(a))return e.removeItem(r),{};let s=Object.entries(a).filter(([,e])=>"string"==typeof e&&n(e,t)),i=Object.fromEntries(s);return 0===s.length?e.removeItem(r):e.setItem(r,JSON.stringify(i)),i}function o(e,t,a){let s=i(e,a);if(!n(t.publishedAt,a))return s;let o={...s,[t.id]:t.publishedAt};return e.setItem(r,JSON.stringify(o)),o}function l(e,t){let a=e.filter(e=>n(e,t)).map(e=>Date.parse(e)+864e5-t+1);return a.length>0?Math.min(...a):null}function d(e){return e?"Noticias, hay noticias nuevas":"Noticias"}function c(e,t,a){return e.filter(e=>n(e.publishedAt,a)&&t[e.id]!==e.publishedAt).map(e=>e.id)}},11239:(e,t,a)=>{"use strict";a.d(t,{O:()=>n});var r=a(95155),s=a(40980);function n({className:e,visible:t}){return t?(0,r.jsx)("span",{"aria-hidden":"true",className:(0,s.cn)("absolute size-2.5 rounded-full bg-red-500 ring-2 ring-background",e)}):null}},13200:(e,t,a)=>{"use strict";a.d(t,{FH:()=>r,Hz:()=>y,To:()=>s,Yb:()=>w,cY:()=>l,el:()=>v,fI:()=>j,gh:()=>d,kU:()=>m,lx:()=>c,mx:()=>b,nP:()=>f,zR:()=>u});let r=[{id:"rain",label:"Lluvia"},{id:"snow",label:"Nieve"},{id:"wind",label:"Viento"},{id:"thunderstorm",label:"Tormentas"},{id:"heat",label:"Calor"},{id:"cold",label:"Fr\xedo"},{id:"coastal",label:"Fen\xf3menos costeros"},{id:"flood",label:"Inundaciones"},{id:"wildfire",label:"Incendios forestales"},{id:"other",label:"Otros"}];function s(e){return r.find(t=>t.id===e.eventType)?.id??"unclassified"}function n(e){return"low"===e.severity||"medium"===e.severity||"maximum"===e.severity?e.severity:null}let i={low:0,medium:1,maximum:2,unknown:-1},o={low:{background:"#facc15",text:"#111827"},medium:{background:"#f97316",text:"#111827"},maximum:{background:"#dc2626",text:"#ffffff"},unknown:{background:"#64748b",text:"#ffffff"}};function l(e){return o[n(e)??"unknown"]}function d(e,t){if(!t)return o.unknown;let{level:a}=c(e);return"none"===a?{background:"#bbf7d0",text:"#14532d"}:o[a]}function c(e){let t=[...new Map(e.map(e=>[e.id,e])).values()],a=t.filter(e=>!n(e)).length;return{level:t.length?t.some(e=>"maximum"===n(e))?"maximum":t.some(e=>"medium"===n(e))?"medium":t.some(e=>"low"===n(e))?"low":"unknown":"none",count:t.length,unclassifiedCount:a}}function u(e){if("none"===e.level)return"Sin avisos";if("unknown"===e.level)return"Nivel sin definir";let t="maximum"===e.level?"Alerta alta":"medium"===e.level?"Alerta media":"Alerta baja";return e.unclassifiedCount?`${t}; hay avisos sin nivel definido`:t}function m(e,t=!1){let a=[{value:"all",label:"Todos los fen\xf3menos",summary:c(e)},...r.map(t=>({value:t.id,label:t.label,summary:c(e.filter(e=>s(e)===t.id))}))],n=e.filter(e=>"unclassified"===s(e));return(n.length||t)&&a.push({value:"unclassified",label:"Sin clasificar",summary:c(n)}),a}function f(e,t){let a=new Set(t);return e.filter(e=>e.areas.some(e=>a.has(e.id)))}let h=e=>"string"==typeof e&&/^#[a-fA-F0-9]{6}$/.test(e),p=e=>!!e&&"object"==typeof e&&!Array.isArray(e),x=e=>p(e)&&h(e.background)&&h(e.text),g=e=>"string"==typeof e&&/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:Z|\+00:00)$/.test(e)&&Number.isFinite(Date.parse(e));function b(e){if(!p(e)||1!==e.version||!g(e.generatedAt)||!Array.isArray(e.alerts)||e.alerts.length>500)throw Error("invalid_alert_feed");let t=new Set;for(let a of e.alerts){if(!p(a)||!Number.isSafeInteger(a.id)||1>Number(a.id)||t.has(a.id)||"string"!=typeof a.title||a.title.length>1e3||"string"!=typeof a.body||a.body.length>1e4||!g(a.start)||!g(a.end)||Date.parse(a.start)>=Date.parse(a.end)||!g(a.publishedAt)||!g(a.updatedAt)||![0,1,2].includes(Number(a.priority))||"number"!=typeof a.priority||!x(a.style)||!Array.isArray(a.areas)||!a.areas.length||a.areas.length>745)throw Error("invalid_alert");if(void 0!==a.severity&&"string"!=typeof a.severity)throw Error("invalid_alert_severity");t.add(a.id);let e=new Set;for(let t of a.areas){if(!p(t)||"string"!=typeof t.id||!/^municipality:\d{5}$/.test(t.id)||e.has(t.id)||"string"!=typeof t.name||t.name.length>200||!["asturias","galicia","cantabria","pais-vasco"].includes(String(t.region))||null!==t.style&&!x(t.style))throw Error("invalid_alert_area");e.add(t.id)}}return e}function v(e){return new Intl.DateTimeFormat("en-CA",{timeZone:"Europe/Madrid",year:"numeric",month:"2-digit",day:"2-digit"}).format(e)}function y(e,t,a=Date.now()){return e.filter(e=>Date.parse(e.end)>a&&v(Date.parse(e.start))<=t&&v(Date.parse(e.end)-1)>=t).sort((e,t)=>
1i[n(t)??"unknown"]-i[n(e)??"unknown"]||Date.parse(t.publishedAt)-Date.parse(e.publishedAt)||t.id-e.id)}function w(e,t){return y(e,v(t),t).filter(e=>Date.parse(e.start)<=t)}function j(e,t,a,r,n="all"){return y(e,t,a).filter(e=>("all"===n||s(e)===n)&&("cantabrico"===r||e.areas.some(e=>e.region===("cordillera"===r?"asturias":r))))}},17052:(e,t,a)=>{"use strict";a.d(t,{ForecastModelProvider:()=>i,g:()=>o});var r=a(95155),s=a(12115);let n=(0,s.createContext)(null);function i({children:e}){let[t,a]=(0,s.useState)("asturmet");return(0,r.jsx)(n.Provider,{value:{model:t,setModel:a},children:e})}function o(){let e=(0,s.useContext)(n);if(!e)throw Error("ForecastModelProvider missing");return e}},17414:(e,t,a)=>{"use strict";a.d(t,{AM:()=>i,Wv:()=>o,hl:()=>l});var r=a(95155);a(12115);var s=a(60339),n=a(40980);function i({...e}){return(0,r.jsx)(s.bL,{"data-slot":"popover",...e})}function o({...e}){return(0,r.jsx)(s.l9,{"data-slot":"popover-trigger",...e})}function l({className:e,align:t="center",sideOffset:a=4,...i}){return(0,r.jsx)(s.ZL,{children:(0,r.jsx)(s.UC,{"data-slot":"popover-content",align:t,sideOffset:a,className:(0,n.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...i})})}},34501:(e,t,a)=>{"use strict";a.d(t,{Header:()=>ef});var r=a(95155),s=a(12115),n=a(89999),i=a(98500),o=a.n(i),l=a(5772),d=a(73321),c=a(40980),u=a(11571),m=a(61878),f=a(94514),h=a(24538),p=a(6296),x=a(14801),g=a(42763);let b=s.forwardRef(({className:e,...t},a)=>(0,r.jsx)(x.uB,{ref:a,className:(0,c.cn)("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));b.displayName=x.uB.displayName;let v=s.forwardRef(({className:e,...t},a)=>(0,r.jsxs)("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[(0,r.jsx)(m.A,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),(0,r.jsx)(x.uB.Input,{ref:a,className:(0,c.cn)("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));v.displayName=x.uB.Input.displayName;let y=s.forwardRef(({className:e,...t},a)=>(0,r.jsx)(x.uB.List,{ref:a,className:(0,c.cn)("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));y.displayName=x.uB.List.displayName;let w=s.forwardRef((e,t)=>(0,r.jsx)(x.uB.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));w.displayName=x.uB.Empty.displayName;let j=s.forwardRef(({className:e,...t},a)=>(0,r.jsx)(x.uB.Group,{ref:a,className:(0,c.cn)("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));j.displayName=x.uB.Group.displayName,s.forwardRef(({className:e,...t},a)=>(0,r.jsx)(x.uB.Separator,{ref:a,className:(0,c.cn)("-mx-1 h-px bg-border",e),...t})).displayName=x.uB.Separator.displayName;let N=s.forwardRef(({className:e,...t},a)=>(0,r.jsx)(x.uB.Item,{ref:a,className:(0,c.cn)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",e),...t}));N.displayName=x.uB.Item.displayName;var k=a(15589);function A({locations:e,query:t,loading:a,error:n,region:i,allowLegacyFeatured:o,totalLocationCount:l,nearestLocation:d,selectedSlug:c,onRetry:u,onSelect:m}){let x=s.useDeferredValue(t),[g,b]=s.useState({query:x,count:k.We}),v=s.useRef(null),E=s.useRef(null),S=s.useRef(!0),C=(0,k.bu)(x).length>0,_=s.useMemo(()=>{let e=(0,k.pz)(i,o);return d?(0,k.$n)(e,[d]):e},[o,d,i]),T=s.useMemo(()=>new Intl.NumberFormat("es-ES"),[]),M=n&&0===e.length?`No se pudo cargar el cat\xe1logo de ${i.label}`:n,{mountainLocations:D,generalLocations:R}=s.useMemo(()=>{let t=(0,k.Q4)(e,C?x:""),a=C?[]:d?[..._,d]:_,r=(0,k.$n)(t.filter(k.$9),a).slice(0,k.We),s=new Set(r.map(e=>(0,k.bu)(e.name))),n=(0,k.$n)(t.filter(e=>!(0,k.$9)(e)&&!s.has((0,k.bu)(e.name))),[...a,...r]);return{mountainLocations:r,generalLocations:n}},[x,_,C,e,d]);s.useLayoutEffect(()=>{v.current&&(v.current.scrollTop=0),b({query:x,count:k.We}),S.current=!0},[x]);let I=s.useCallback(()=>{b(e=>({query:x,count:(0,k.ZP)(e.query===x?e.count:k.We,R.length)}))},[x,R.length]),$=Math.min(g.query===x?g.count:k.We,R.length),P=R.slice(0,$),z=$<R.length;s.useEffect(()=>{let e=v.current,t=E.current;if(!z||!e||!t)return;let a=new IntersectionObserver(([e])=>{if(!e.isIntersecting){S.current=!0;return}S.current&&(S.current=!1,I())},{root:e,rootMargin:"0px 0px 80px 0px"});return a.observe(t),()=>a.disconnect()},[z,I,$]);let B=(e,t)=>{let a=c===e.slug?f.A:h.A;return(0,r.jsxs)(N,{value:`${e.name} ${e.slug}`,onSelect:()=>m(e.slug),className:t?.nearby?"aria-selected:bg-blue-50 dark:aria-selected:bg-blue-900/20":void 0,children:[(0,r.jsx)(a,{className:t?.nearby?"mr-2 h-4 w-4 text-blue-500":"mr-2 h-4 w-4 text-weather-rain"}),(0,r.jsx)("span",{className:t?.nearby?"font-bold text-primary":void 0,children:t?.nearby?`Tu ubicaci\xf3n: ${e.name}`:e.name})]},e.slug)};return(0,r.jsxs)(y,{ref:v,children:[a&&(0,r.jsxs)("div",{role:"status",className:"flex items-center gap-2 px-4 py-3 text-sm text-muted-foreground",children:[(0,r.jsx)(p.A,{className:"h-4 w-4 animate-spin"})," Actualizando"," ",T.format(l)," localidades de"," ",i.label,"…"]}),M&&(0,r.jsxs)("div",{role:"status",className:"px-4 py-3 text-xs text-amber-700 dark:text-amber-300",children:[M," ",(0,r.jsx)("button",{type:"button",onClick:u,className:"font-semibold underline",children:"Reintentar"})]}),!a&&0===D.length&&0===R.length&&(0,r.jsx)(w,{children:"No se encontraron resultados."}),!C&&d&&(0,r.jsx)(j,{heading:"Cerca de ti",children:B(d,{nearby:!0})}),!C&&_.length>0&&(0,r.jsx)(j,{heading:"Localidades principales",children:_.map(e=>B(e))}),D.length>0&&(0,r.jsx)(j,{heading:"Monta\xf1a",children:D.map(e=>B(e))}),P.length>0&&(0,r.jsx)(j,{heading:C?"Resultados":"Todas las localidades",children:P.map(e=>B(e))}),(0,r.jsxs)("div",{"aria-live":"polite",className:"px-3 py-2 text-center text-xs text-muted-foreground",children:["Mostrando ",D.length+$," de"," ",D.length+R.length," localidades"]}),z&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{ref:E,"aria-hidden":"true",className:"h-px"}),(0,r.jsx)("div",{className:"px-3 pb-3 pt-1",children:(0,r.jsx)("button",{type:"button",onClick:I,className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-medium text-foreground transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:"Mostrar 50 m\xe1s"})})]})]})}var E=a(50109),S=a(71549);let C=/^[a-f0-9]{64}$/;function _(e,t){return Object.keys(e).length===t.length&&t.every(t=>Object.hasOwn(e,t))}function T(e){return"object"==typeof e&&null!==e&&_(e,["code","name"])&&"string"==typeof e.code&&""!==e.code.trim()&&"string"==typeof e.name&&""!==e.name.trim()}let M=null;async function D(){let e=await fetch("/api/locations",{cache:"no-cache",headers:{accept:"application/json"}});if(!e.ok)throw Error(`location_catalog_${e.status}`);var t=await e.json();if("object"!=typeof t||null===t||!_(t,["catalogVersion","checksum","count","locations"])||"string"!=typeof t.catalogVersion||""===t.catalogVersion.trim()||"string"!=typeof t.checksum||!C.test(t.checksum)||"number"!=typeof t.count||!Number.isInteger(t.count)||t.count<1||!Array.isArray(t.locations)||t.locations.length!==t.count)throw Error("invalid_location_catalog");let a=new Set,r=t.locations.map(e=>{if("object"!=typeof e||null===e)throw Error("invalid_location_catalog");let t=_(e,["name","slug"]),r=_(e,["name","slug","aliases","categories"]),s=_(e,["name","slug","aliases","categories","official"]),n=_(e,["name","slug","aliases","categories","scope"]),i=_(e,["name","slug","aliases","categories","scope","official"]);if(!t&&!r&&!s&&!n&&!i||"string"!=typeof e.name||""===e.name.trim()||"string"!=typeof e.slug||""===e.slug.trim()||(s||i)&&!function(e){if("object"!=typeof e||null===e||!_(e,["autonomousCommunity","province","municipality","type","population","source"])||!T(e.autonomousCommunity)||!T(e.province)||!T(e.municipality)||!T(e.type)||null!==e.population&&("number"!=typeof e.population||!Number.isSafeInteger(e.population)||e.population<0)||"object"!=typeof e.source||null===e.source)return!1;
1let t=e.source,a="string"==typeof t.date?new Date(`${t.date}T00:00:00Z`):null;return!(!_(t,["identifier","date","discrepanteIne"])||"string"!=typeof t.date||!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||null===a||Number.isNaN(a.valueOf()))&&a.toISOString().slice(0,10)===t.date&&"boolean"==typeof t.discrepanteIne&&("ign-ngmep-ine"===t.identifier&&!t.discrepanteIne||"ign-ngmep-rel"===t.identifier&&t.discrepanteIne)}(e.official)||(n||i)&&!(0,S.jl)(e.scope))throw Error("invalid_location_catalog");let o=e.name.normalize("NFC"),l=e.slug.normalize("NFC"),d=[l],c=[];if((r||s||n||i)&&(!Array.isArray(e.aliases)||0===e.aliases.length||!e.aliases.every(e=>"string"==typeof e&&""!==e.trim())||!Array.isArray(e.categories)||!e.categories.every(e=>"mountain"===e)||(d=e.aliases.map(e=>e.normalize("NFC")),c=e.categories,new Set(d).size!==d.length||!d.includes(l)||new Set(c).size!==c.length)))throw Error("invalid_location_catalog");let u={name:o,slug:l,aliases:d,categories:c,...n||i?{scope:e.scope}:{},...s||i?{official:e.official}:{}};if(a.has(u.slug))throw Error("invalid_location_catalog");return a.add(u.slug),u});return{catalogVersion:t.catalogVersion,checksum:t.checksum,count:t.count,locations:r}}function R({iconOnly:e}){let[t,a]=s.useState(!1),[i,o]=s.useState(""),l=s.useRef(null),f=(0,d.useRouter)(),{nearestLocation:h,updateLocationCatalog:p}=(0,E.m)(),{catalog:x,error:y,loading:w,retry:j}
1=function(e){let[t,a]=(0,s.useState)(k.vU),[r,n]=(0,s.useState)("idle"),[i,o]=(0,s.useState)(0);(0,s.useEffect)(()=>{if(!e)return;let t=!0;return(M??=D().then(e=>(M=null,e),e=>{throw M=null,e})).then(e=>{t&&(a(e),n("success"))}).catch(()=>{t&&(a(k.vU),n("error"))}),()=>{t=!1}},[e,i]);let l=(0,s.useCallback)(()=>{M=null,n("idle"),o(e=>e+1)},[]);return{catalog:t,error:"error"===r?"No se pudo actualizar el cat\xe1logo. Mostramos las ubicaciones habituales.":null,loading:e&&"idle"===r,usingFallback:t.checksum===k.vU.checksum,retry:l}}(t),{scope:N,region:S,hasActiveRegistry:C}=(0,n.B)(),_=s.useMemo(()=>(0,k.Xb)(x.locations,S,{allowLegacyDerivation:!C}),[x.locations,C,S]),T=h&&_.some(({slug:e})=>e===h.slug)?h:null,I=e=>{a(e),e||o("")};return s.useEffect(()=>{p(x)},[x,p]),s.useLayoutEffect(()=>{a(!1),o("")},[N]),s.useEffect(()=>{let e=e=>{"k"===e.key&&(e.metaKey||e.ctrlKey)&&l.current?.offsetParent!==null&&(e.preventDefault(),a(e=>{let t=!e;return t||o(""),t}))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[]),(0,r.jsxs)(r.Fragment,{children:[e?(0,r.jsx)("button",{ref:l,type:"button",onClick:()=>I(!0),className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full border border-border/50 bg-background/50 text-muted-foreground shadow-sm backdrop-blur-sm transition-all hover:border-primary/20 hover:bg-accent hover:text-primary","aria-label":"Buscar localidad",children:(0,r.jsx)(m.A,{className:"w-5 h-5"})}):(0,r.jsxs)("button",{ref:l,type:"button",onClick:()=>I(!0),className:(0,c.cn)("relative items-center justify-between rounded-lg border border-input px-4 py-2 text-sm font-medium shadow-sm hover:bg-accent hover:text-accent-foreground w-full md:w-44 xl:w-80 flex transition-colors","bg-card/95 dark:bg-white/5 border-border/50 text-muted-foreground"),children:[(0,r.jsxs)("span",{className:"inline-flex items-center",children:[(0,r.jsx)(m.A,{className:"mr-2 h-4 w-4 opacity-70"}),"Buscar localidad..."]}),(0,r.jsxs)("kbd",{className:"pointer-events-none hidden h-5 select-none items-center gap-1 rounded border border-border bg-muted px-1.5 font-mono text-[10px] font-small opacity-100 sm:flex text-muted-foreground",children:[(0,r.jsx)("span",{className:"text-xs mt-1",children:"⌘"}),(0,r.jsx)("span",{className:"text-xs mt-0.5",children:"K"})]})]}),(0,r.jsx)(g.lG,{open:t,onOpenChange:I,children:(0,r.jsxs)(g.Cf,{onCloseAutoFocus:e=>{e.preventDefault(),l.current?.focus()},className:"overflow-hidden p-0 shadow-lg w-[95vw] sm:max-w-lg rounded-xl duration-500 ease-out data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:slide-in-from-bottom-2 top-[10%] translate-y-0 sm:top-[50%] sm:translate-y-[-50%]",children:[(0,r.jsx)(g.L3,{className:"sr-only",children:"Buscar ubicaci\xf3n"}),(0,r.jsxs)(g.rr,{className:"sr-only",children:["Busca entre las localidades con pron\xf3stico activo en ",S.label]}),(0,r.jsxs)(b,{shouldFilter:!1,className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",children:[(0,r.jsx)(v,{value:i,onValueChange:o,placeholder:"Escribe para buscar una localidad..."}),(0,r.jsx)(A,{locations:_,query:i,loading:w,error:y,nearestLocation:T,region:S,allowLegacyFeatured:!C,totalLocationCount:_.length,onRetry:j,onSelect:e=>{a(!1),o(""),f.push((0,u.Gu)(e,N))}})]})]})})]})}var I=a(70813),$=a(66088),P=a(17414);function z({selection:e}={}
1){let[t,a]=(0,s.useState)(!1),{scope:i,region:o,regions:l,setScope:d}=(0,n.B)(),u=e?.value??i,m=e?.options??l,h=m.find(e=>e.id===u)?.label??o.label;return(0,r.jsxs)(P.AM,{open:t,onOpenChange:a,children:[(0,r.jsx)(P.Wv,{asChild:!0,children:(0,r.jsxs)("button",{type:"button","aria-label":"Seleccionar mapa y regi\xf3n","aria-expanded":t,className:"inline-flex h-11 max-w-[8.5rem] min-w-0 items-center gap-1.5 rounded-lg border border-border/50 bg-card/95 px-2.5 text-sm font-medium text-foreground shadow-sm transition-colors hover:border-primary/30 hover:bg-accent min-[540px]:max-w-[11rem] sm:max-w-none sm:px-3 md:h-10",children:[(0,r.jsx)(I.A,{className:"h-4 w-4 shrink-0 text-primary","aria-hidden":"true"}),(0,r.jsx)("span",{className:"truncate",children:h}),(0,r.jsx)($.A,{className:(0,c.cn)("h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform",t&&"rotate-180"),"aria-hidden":"true"})]})}),(0,r.jsx)(P.hl,{align:"end",className:"w-56 p-1.5",children:(0,r.jsx)("div",{role:"group","aria-label":"Mapas y regiones",className:"space-y-1",children:m.map(t=>(0,r.jsxs)("button",{type:"button","aria-pressed":t.id===u,onClick:()=>{var r;return r=t.id,void(e?e.onSelect(r):d(r),a(!1))},className:(0,c.cn)("flex w-full items-center justify-between rounded-md px-3 py-2 text-left text-sm transition-colors hover:bg-accent hover:text-accent-foreground",t.id===u&&"bg-primary/10 font-semibold text-primary"),children:[(0,r.jsx)("span",{children:t.label}),(0,r.jsx)(f.A,{className:(0,c.cn)("h-4 w-4",t.id===u?"opacity-100":"opacity-0"),"aria-hidden":"true"})]},t.id))})})]})}var B=a(3167);let L=Object.entries(B.Y1).map(([e,t])=>({id:e,label:t}));function O(){let e=(0,d.useSearchParams)(),{scope:t}=(0,n.B)(),a=e.get("region"),s=a&&Object.hasOwn(B.Y1,a)?a:Object.hasOwn(B.Y1,t)?t:"cantabrico";return(0,r.jsx)(z,{selection:{value:s,options:L,onSelect:e=>{let t=new URLSearchParams(window.location.search);t.set("region",e),window.history.pushState(null,"",`/modelos?${t}`)}}})}var F=a(74635),W=a(60119);function U(){let{nearestLocation:e,error:t,loading:a,requestLocation:i}=(0,E.m)(),{scope:l,setScope:d}=(0,n.B)(),{data:m,loading:f}
1=function(e){let[t,a]=(0,s.useState)(null),[r,n]=(0,s.useState)(!0),[i,o]=(0,s.useState)(null);return(0,s.useEffect)(()=>{let t=!0;return async function(){if(e)try{n(!0),o(null);let r=await F.S.getForecast(e);t&&a(r)}catch(e){t&&(o("Error al cargar datos meteorol\xf3gicos"),console.error(e))}finally{t&&n(!1)}}(),()=>{t=!1}},[e]),{data:t,loading:r,error:i}}(e?.slug||""),x=async()=>{let e=await i();e&&d((0,u.ZR)(l,e.scope))};if(!e){let e=a?"Obteniendo mi ubicaci\xf3n":t?"Reintentar mi ubicaci\xf3n":"Usar mi ubicaci\xf3n";return(0,r.jsxs)("div",{className:"relative","aria-live":"polite",children:[(0,r.jsxs)("button",{type:"button","aria-label":e,title:t??e,disabled:a,onClick:x,className:(0,c.cn)("flex min-h-11 min-w-11 items-center justify-center gap-2 rounded-full px-3 text-xs font-semibold","border border-blue-100 bg-blue-50/50 text-blue-700 shadow-sm","transition-colors hover:bg-blue-100/60 disabled:cursor-wait disabled:opacity-70","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2","dark:border-blue-900/30 dark:bg-blue-900/10 dark:text-blue-300 dark:hover:bg-blue-900/20"),children:[a?(0,r.jsx)(p.A,{className:"h-4 w-4 shrink-0 animate-spin"}):(0,r.jsx)(W.A,{className:"h-4 w-4 shrink-0"}),(0,r.jsx)("span",{className:"hidden min-[480px]:inline",children:a?"Ubicando…":"Mi ubicaci\xf3n"})]}),t?(0,r.jsx)("span",{className:"sr-only",children:t}):null]})}let g=f&&!m,b=m?.current?.temp;return(0,r.jsxs)(o(),{href:(0,u.Gu)(e.slug,(0,u.ZR)(l,e.scope)),"aria-label":`Pron\xf3stico en ${e.name}`,className:(0,c.cn)("flex h-11 w-11 shrink-0 items-center justify-center gap-1.5 rounded-full px-2 py-1.5 shadow-sm min-[480px]:w-auto min-[480px]:justify-start min-[480px]:gap-2 min-[480px]:px-3","bg-blue-50/50 dark:bg-blue-900/10 border border-blue-100 dark:border-blue-900/30","hover:bg-blue-100/50 dark:hover:bg-blue-900/20 transition-colors duration-200 group"),children:[(0,r.jsx)(h.A,{className:"w-3.5 h-3.5 text-blue-500 shrink-0"}),(0,r.jsxs)("div",{className:"hidden min-w-0 items-center gap-1.5 text-xs font-medium text-blue-700 dark:text-blue-300 min-[480px]:flex min-[480px]:gap-2",children:[(0,r.jsx)("span",{className:"max-w-10 truncate min-[360px]:max-w-16 min-[480px]:max-w-[100px]",children:e.name}),g?(0,r.jsx)(p.A,{className:"h-3 w-3 shrink-0 animate-spin text-blue-400"}):void 0!==b?(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-0.5 font-bold",children:[(0,r.jsx)("span",{className:"mx-0.5 h-3 w-0.5 rounded-full bg-blue-200 dark:bg-blue-800 min-[480px]:mx-1"}),b,"\xb0"]}):null]})]})}var V=a(88276),Z=a(11239),Y=a(60339),G=a(41585),q=a(93119),H=a(61767),J=a(12651),Q=a(33210),K=a(83404),X=a(13200),ee=a(69939);let et=e=>new Intl.DateTimeFormat("es-ES",{timeZone:"Europe/Madrid",dateStyle:"short",timeStyle:"short"}).format(new Date(e));function ea(){let{feed:e,status:t,now:a}=(0,K.w)(),n=(0,s.useId)(),i="ready"===t&&e?(0,X.Yb)(e.alerts,a):[],l=(0,X.lx)(i),d="loading"===t?"Consultando avisos…":"error"===t?"Avisos no disponibles":"disabled"===t?"Avisos desactivados":i.length?"Hay avisos de ASTURMET":"Sin avisos activos",c="loading"===t?p.A:"error"===t?G.A:"disabled"===t?q.A:i.length?H.A:J.A;return(0,r.jsxs)(P.AM,{children:[(0,r.jsx)(P.Wv,{asChild:!0,children:(0,r.jsxs)("button",{type:"button","aria-label":`${d}${"ready"===t?`. ${(0,X.zR)(l)}`:""}. Ver avisos de ASTURMET`,title:d,className:"relative flex h-11 w-11 shrink-0 items-center justify-center gap-2 rounded-full border border-border/50 bg-card/95 text-xs font-medium text-foreground shadow-sm transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 sm:w-auto sm:px-3 dark:bg-white/5",children:["ready"===t?(0,r.jsx)(ee.Y,{summary:l,className:"rounded-full",children:(0,r.jsx)(c,{"aria-hidden":"true",className:"h-5 w-5 sm:h-4 sm:w-4"})}):(0,r.jsx)(c,{"aria-hidden":"true",className:`h-5 w-5 shrink-0 sm:h-4 sm:w-4 ${"loading"===t?"motion-safe:animate-spin":""}`}),(0,r.jsx)("span",{className:"hidden sm:inline",children:d}),i.length>0&&(0,r.jsx)("span",{"aria-hidden":"true",className:"absolute -right-0.5 -top-0.5 flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-slate-800 px-1 text-[10px] font-semibold leading-none text-white ring-2 ring-white sm:static sm:ring-0 dark:ring-slate-900",children:i.length>99?"99+":i.length})]})}),(0,r.jsxs)("span",{className:"sr-only",role:"status",children:[d,i.length>0?`: ${i.length}`:""]}),(0,r.jsxs)(P.hl,{align:"end",collisionPadding:12,"aria-labelledby":n,className:"z-[1300] flex max-h-[min(32rem,var(--radix-popover-content-available-height))] w-[calc(100vw-1.5rem)] max-w-sm flex-col rounded-xl p-0",children:[(0,r.jsxs)("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b px-4 py-2",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{id:n,className:"text-sm font-semibold",children:"Avisos de ASTURMET"}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Vigentes ahora \xb7 Todas las zonas"})]}),(0,r.jsx)(Y.bm,{"aria-label":"Cerrar avisos",className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-md hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",children:(0,r.jsx)(Q.A,{"aria-hidden":"true",className:"h-4 w-4"})})]}),(0,r.jsxs)("div",{className:"min-h-0 space-y-3 overflow-y-auto overscroll-contain p-4",children:["ready"===t&&i.length?i.map(e=>(0,r.jsxs)("article",{className:"space-y-2 rounded-lg border p-3 text-sm [overflow-wrap:anywhere]",children:[(0,r.jsx)("h3",{className:"font-semibold",children:e.title}),(0,r.jsx)(ee.F,{summary:(0,X.lx)([e])}),(0,r.jsx)("p",{className:"whitespace-pre-wrap",children:e.body}),(0,r.jsxs)("p",{className:"text-xs",children:[(0,r.jsx)("span",{className:"font-semibold",children:"Zonas: "}),e.areas.map(e=>
1e.name).join(", ")]}),(0,r.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Desde ",(0,r.jsx)("time",{dateTime:e.start,children:et(e.start)}),(0,r.jsx)("br",{}),"Hasta ",(0,r.jsx)("time",{dateTime:e.end,children:et(e.end)})," (hora de Madrid)"]})]},e.id)):(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"disabled"===t?"Los avisos editoriales de ASTURMET todav\xeda no est\xe1n habilitados.":"error"===t?"No podemos consultar los avisos ahora. Se volver\xe1 a intentar autom\xe1ticamente.":"loading"===t?"Consultando los avisos de ASTURMET…":"No hay avisos de ASTURMET vigentes en este momento."}),(0,r.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"Avisos editoriales propios de ASTURMET."}),(0,r.jsx)(Y.bm,{asChild:!0,children:(0,r.jsx)(o(),{href:"/avisos",className:"flex min-h-11 items-center rounded-sm text-sm font-medium text-primary underline underline-offset-4 hover:text-primary/80 focus-visible:outline-2 focus-visible:outline-ring",children:"Ver todos los avisos"})})]})]})]})}var er=a(11145),es=a(80642),en=a(39430),ei=a(74526),eo=a(20200),el=a(7484),ed=a(62312),ec=a(98237),eu=a(10647),em=a(59320);function ef(){let e=(0,d.usePathname)(),t="/modelos"===e,{scope:a}=(0,n.B)(),[i,m]=(0,s.useState)(!1),{nearestLocation:f}=(0,E.m)(),{hasUnreadNews:h}=(0,V.Q)();return(0,r.jsx)("header",{className:"sticky top-0 z-50 w-full border-b border-border/40 bg-slate-100/80 backdrop-blur-md supp
1orts-[backdrop-filter]:bg-slate-100/60 dark:bg-slate-900/80 dark:supports-[backdrop-filter]:bg-slate-900/60",children:(0,r.jsxs)("div",{className:"container mx-auto flex max-w-[1300px] flex-col px-4 py-2.5 md:px-6 md:py-0",children:[(0,r.jsxs)("div",{className:"flex flex-col md:flex-row md:items-center justify-between py-0 md:py-2 border-b border-border/10 gap-1 md:gap-4",children:[(0,r.jsx)("div",{className:"hidden md:flex items-center justify-between w-full md:w-auto",children:(0,r.jsxs)(o(),{href:"/",className:"flex items-center space-x-3 group",children:[(0,r.jsx)("div",{className:"relative h-8 w-8",children:(0,r.jsx)(l.default,{src:"/logo.png",alt:"Asturmet Logo",width:32,height:32,className:"object-contain drop-shadow-sm transition-transform group-hover:scale-110"})}),(0,r.jsx)("span",{className:"font-bold text-lg text-foreground tracking-tight",children:"Asturmet"})]})}),(0,r.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 min-[480px]:gap-3 md:ml-auto md:w-auto md:justify-end",children:[(0,r.jsxs)("div",{role:"group","aria-label":"Mapa y b\xfasqueda",className:"flex min-w-0 items-center gap-1 min-[480px]:gap-2 md:hidden",children:[t?(0,r.jsx)(s.Suspense,{fallback:(0,r.jsx)(z,{}),children:(0,r.jsx)(O,{})}):(0,r.jsx)(z,{}),(0,r.jsx)(R,{iconOnly:!0})]}),(0,r.jsxs)("div",{role:"group","aria-label":"Ubicaci\xf3n y avisos",className:"flex shrink-0 items-center gap-2",children:[(0,r.jsx)("div",{className:"min-w-0 shrink-0 md:ml-4",children:(0,r.jsx)(U,{})}),(0,r.jsx)(ea,{})]})]})]}),(0,r.jsxs)("div",{className:(0,c.cn)("hidden md:flex h-14 items-center justify-between gap-4","md:h-auto md:min-h-14 md:flex-wrap md:py-2 xl:flex-nowrap"),children:[(0,r.jsxs)("nav",{className:"hidden md:flex items-center space-x-1",children:[(0,r.jsx)(o(),{href:"/",className:(0,c.cn)("px-3 py-2 rounded-md text-sm transition-all duration-200","/"===e?"text-primary font-bold":"text-muted-foreground font-medium hover:bg-black/5 dark:hover:bg-white/5 hover:text-foreground"),children:"Inicio"}),(0,r.jsx)(o(),{href:f?(0,u.Gu)(f.slug,(0,u.ZR)(a,f.scope)):"/pronostico",className:(0,c.cn)("px-3 py-2 rounded-md text-sm transition-all duration-200",e?.startsWith("/pronostico")?"text-primary font-bold":"text-muted-foreground font-medium hover:bg-black/5 dark:hover:bg-white/5 hover:text-foreground"),children:"Pron\xf3stico"}),(0,r.jsx)(o(),{href:"/estaciones",className:(0,c.cn)("px-3 py-2 rounded-md text-sm transition-all duration-200",e?.startsWith("/estaciones")?"text-primary font-bold":"text-muted-foreground font-medium hover:bg-black/5 dark:hover:bg-white/5 hover:text-foreground"),children:"Estaciones"}),(0,r.jsx)(o(),{href:`/climatologia?region=${a}`,"aria-current":e?.startsWith("/climatologia")?"page":void 0,className:(0,c.cn)("px-3 py-2 rounded-md text-sm transition-all duration-200",e?.startsWith("/climatologia")?"text-primary font-bold":"text-muted-foreground font-medium hover:bg-black/5 dark:hover:bg-white/5 hover:text-foreground"),children:"Climatolog\xeda"}),(0,r.jsx)(o(),{href:"/modelos","aria-current":e?.startsWith("/modelos")?"page":void 0,className:(0,c.cn)("min-h-11 inline-flex items-center rounded-md px-3 text-sm",e?.startsWith("/modelos")?"font-bold text-primary":"text-muted-foreground hover:text-foreground"),children:"Modelos"}),(0,r.jsxs)("div",{className:"relative group px-1",onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),children:[(0,r.jsx)(o(),{href:"/mapas",className:(0,c.cn)("px-3 py-2 rounded-md text-sm transition-all duration-200 flex items-center gap-1",e?.startsWith("/mapas")?"text-primary font-bold":"text-muted-foreground font-medium hover:bg-black/5 dark:hover:bg-white/5 hover:text-foreground"),children:(0,r.jsx)("span",{className:"flex items-center gap-1",children:"Mapas"})}),(0,r.jsx)(es.N,{children:i&&(0,r.jsx)(en.P.div,{initial:{opacity:0,y:10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.95},transition:{duration:.2,ease:"easeOut"},className:"absolute left-0 top-full pt-2 z-50 w-[400px]",children:(0,r.jsx)("div",{className:"bg-card/95 backdrop-blur-xl rounded-xl shadow-2xl border border-border/50 p-4 ring-1 ring-black/5 dark:ring-white/10",children:(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("div",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-wider px-2",children:"Tiempo Actual"}),(0,r.jsx)("div",{className:"space-y-1",children:[{label:"Temperatura",id:"temperature",icon:ei.A},{label:"Precipitaci\xf3n",id:"precipitation",icon:eo.A},{label:"Viento",id:"wind",icon:el.A},{label:"Lluvia Acumulada",id:"precipitation_total",icon:ed.A}].map(e=>(0,r.jsxs)(o(),{href:`/mapas?layer=${e.id}`,className:"flex items-center gap-3 px-3 py-2 text-sm text-foreground
1/80 hover:text-primary hover:bg-primary/5 rounded-lg transition-all group/item",onClick:()=>m(!1),children:[(0,r.jsx)(e.icon,{className:"w-4 h-4 text-muted-foreground group-hover/item:text-primary transition-colors"}),e.label]},e.id))})]}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("div",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-wider px-2",children:"Extremos"}),(0,r.jsx)("div",{className:"space-y-1",children:[{label:"Temp. M\xe1xima",id:"tmax",icon:ec.A},{label:"Temp. M\xednima",id:"tmin",icon:eu.A},{label:"Racha Viento",id:"wind_max",icon:em.A}].map(e=>(0,r.jsxs)(o(),{href:`/mapas?layer=${e.id}`,className:"flex items-center gap-3 px-3 py-2 text-sm text-foreground/80 hover:text-primary hover:bg-primary/5 rounded-lg transition-all group/item",onClick:()=>m(!1),children:[(0,r.jsx)(e.icon,{className:"w-4 h-4 text-muted-foreground group-hover/item:text-primary transition-colors"}),e.label]},e.id))})]})]})})})})]}),(0,r.jsx)(o(),{href:"/noticias","aria-label":(0,er.iU)(h),className:(0,c.cn)("px-3 py-2 rounded-md text-sm transition-all duration-200",e?.startsWith("/noticias")?"text-primary font-bold":"text-muted-foreground font-medium hover:bg-black/5 dark:hover:bg-white/5 hover:text-foreground"),children:(0,r.jsxs)("span",{className:"relative",children:["Noticias",(0,r.jsx)(Z.O,{visible:h,className:"-right-2.5 -top-1.5"})]})}),(0,r.jsx)(o(),{href:"https://foro.asturmet.com/",target:"_blank",rel:"noopener noreferrer",className:"px-3 py-2 rounded-md text-sm font-medium text-muted-foreground hover:bg-black/5 dark:hover:bg-white/5 hover:text-foreground transition-all duration-200",children:"Foro"})]}),(0,r.jsxs)("div",{className:"flex flex-1 items-center justify-end gap-2 md:flex-none",children:[t?(0,r.jsx)(s.Suspense,{fallback:(0,r.jsx)(z,{}),children:(0,r.jsx)(O,{})}):(0,r.jsx)(z,{}),(0,r.jsx)(R,{})]})]})]})})}},40980:(e,t,a)=>{"use strict";a.d(t,{cn:()=>n});var r=a(29722),s=a(622);function n(...e){return(0,s.QP)((0,r.$)(e))}},42763:(e,t,a)=>{"use strict";a.d(t,{Cf:()=>m,L3:()=>f,lG:()=>l,rr:()=>h,zM:()=>d});var r=a(95155),s=a(12115),n=a(29483),i=a(33210),o=a(40980);let l=n.bL,d=n.l9,c=n.ZL;n.bm;let u=s.forwardRef(({className:e,...t},a)=>(0,r.jsx)(n.hJ,{ref:a,className:(0,o.cn)("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 duration-500",e),...t}));u.displayName=n.hJ.displayName;let m=s.forwardRef(({className:e,children:t,container:a,...s},l)=>(0,r.jsxs)(c,{container:a,children:[(0,r.jsx)(u,{className:a?"z-[1000]":void 0}),(0,r.jsxs)(n.UC,{ref:l,className:(0,o.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 sm:rounded-lg",a&&"z-[1001]",e),...s,children:[t,(0,r.jsxs)(n.bm,{className:"absolute right-4 top-4 roun
1ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,r.jsx)(i.A,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));m.displayName=n.UC.displayName;let f=s.forwardRef(({className:e,...t},a)=>(0,r.jsx)(n.hE,{ref:a,className:(0,o.cn)("text-lg font-semibold leading-none tracking-tight",e),...t}));f.displayName=n.hE.displayName;let h=s.forwardRef(({className:e,...t},a)=>(0,r.jsx)(n.VY,{ref:a,className:(0,o.cn)("text-sm text-muted-foreground",e),...t}));h.displayName=n.VY.displayName},51743:()=>{},69939:(e,t,a)=>{"use strict";a.d(t,{F:()=>m,Y:()=>u});var r=a(95155),s=a(6296),n=a(94961),i=a(12651),o=a(41585),l=a(13200),d=a(40980);let c={none:"border-emerald-200 bg-emerald-50 text-emerald-800",low:"border-yellow-300 bg-yellow-100 text-yellow-900",medium:"border-orange-300 bg-orange-100 text-orange-900",maximum:"border-red-200 bg-red-100 text-red-800",unknown:"border-slate-200 bg-slate-100 text-slate-700"};function u({summary:e,children:t,className:a,label:s=(0,l.zR)(e)}){return(0,r.jsxs)("span",{title:s,className:(0,d.cn)("inline-flex size-8 shrink-0 items-center justify-center rounded-lg border",c[e.level],a),children:[t,(0,r.jsx)("span",{className:"sr-only",children:s})]})}function m({summary:e,state:t="ready",context:a,className:u,children:f}){let h="ready"===t&&void 0!==e,p=h?(0,l.zR)(e):"loading"===t?"Consultando avisos…":"disabled"===t?"Avisos desactivados":"Avisos no disponibles",x="loading"===t?s.A:h?"none"===e.level?i.A:"unknown"===e.level?n.A:o.A:n.A;return(0,r.jsxs)("span",{className:(0,d.cn)("inline-flex min-w-0 items-center gap-2 rounded-lg border px-2.5 py-1.5 text-xs font-medium leading-4",h?c[e.level]:c.unknown,u),children:[(0,r.jsx)(x,{"aria-hidden":"true",className:(0,d.cn)("size-4 shrink-0","loading"===t&&"motion-safe:animate-spin")}),(0,r.jsx)("span",{children:a&&h?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"block",children:a}),(0,r.jsx)("span",{className:"block text-[11px] font-normal",children:p})]}):p}),f]})}},80064:(e,t,a)=>{Promise.resolve().then(a.t.bind(a,95642,23)),Promise.resolve().then(a.t.bind(a,61691,23)),Promise.resolve().then(a.t.bind(a,51743,23)),Promise.resolve().then(a.bind(a,34501)),Promise.resolve().then(a.bind(a,10422)),Promise.resolve().then(a.bind(a,83404)),Promise.resolve().then(a.bind(a,17052)),Promise.resolve().then(a.bind(a,89999)),Promise.resolve().then(a.bind(a,50109)),Promise.resolve().then(a.bind(a,88276))},83404:(e,t,a)=>{"use strict";a.d(t,{EditorialAlertsProvider:()=>o,w:()=>l});var r=a(95155),s=a(12115),n=a(13200);let i=(0,s.createContext)({feed:null,status:"loading",now:0});function o({children:e}
1){let[t,a]=(0,s.useState)(null),l=(0,s.useRef)(null),[d,c]=(0,s.useState)("loading"),[u,m]=(0,s.useState)(0);(0,s.useEffect)(()=>{let e,t=!0,r=!1,s=!1,i=!1,o=new AbortController;async function d(){if(!r){clearTimeout(e),e=void 0,r=!0;try{let e=await fetch("/api/alerts",{cache:"no-store",signal:AbortSignal.any([o.signal,AbortSignal.timeout(15e3)])});if(!e.ok)throw Error("unavailable");let r=await e.json();if(!t)return;if(r?.disabled===!0){i=!0,l.current=null,a(null),c("disabled");return}let s=(0,n.mx)(r);if(Date.now()-Date.parse(s.generatedAt)>12e4)throw Error("stale");i=!0,l.current=s,a(s),m(Date.now()),c("ready")}catch{t&&(i||s?(i=!0,l.current=null,c("error"),a(null)):(s=!0,e=setTimeout(()=>{d()},2e3)))}finally{r=!1}}}d();let u=setInterval(d,6e4),f=setInterval(()=>{let e=Date.now(),t=l.current;m(a=>{let r=t=>a<t&&t<=e;return(0,n.el)(a)!==(0,n.el)(e)||t&&(r(Date.parse(t.generatedAt)+120001)||t.alerts.some(e=>r(Date.parse(e.start))||r(Date.parse(e.end))))?e:a})},1e3);return window.addEventListener("focus",d),()=>{t=!1,o.abort(),clearTimeout(e),clearInterval(u),clearInterval(f),window.removeEventListener("focus",d)}},[]);let f=t&&u-Date.parse(t.generatedAt)>12e4?"error":d;return(0,r.jsx)(i.Provider,{value:{feed:"error"===f?null:t,status:f,now:u},children:e})}let l=()=>(0,s.useContext)(i)},88276:(e,t,a)=>{"use strict";a.d(t,{NewsNotificationProvider:()=>o,Q:()=>l});var r=a(95155),s=a(12115),n=a(11145);let i=(0,s.createContext)(null);function o({children:e,newsItems:t}){let[a,l]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{let e,a=()=>{e&&clearTimeout(e);let r=Date.now(),s={};
1try{s=(0,n.XL)(window.localStorage,r)}catch{}l((0,n.en)(t,s,r).length>0);let i=(0,n.xi)([...t.map(e=>e.publishedAt),...Object.values(s)],r);null!==i&&(e=setTimeout(a,i))},r=e=>{(null===e.key||e.key===n.lu)&&a()};return a(),window.addEventListener(n.cb,a),window.addEventListener("storage",r),()=>{e&&clearTimeout(e),window.removeEventListener(n.cb,a),window.removeEventListener("storage",r)}},[t]),(0,r.jsx)(i.Provider,{value:{hasUnreadNews:a},children:e})}function l(){let e=(0,s.useContext)(i);if(!e)throw Error("useNewsNotificationStatus must be used within NewsNotificationProvider");return e}}},e=>{e.O(0,[8952,3334,8500,9060,9149,1237,3249,8437,825,9999,8441,8928,7358],()=>e(e.s=80064)),_N_E=e.O()}]);

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.