1import{j as e}from"./vendor-editor-BX0sR0z-.js";import{r as n}from"./vendor-react-BPk9u-w4.js";import{CBNLayout as V}from"./index-Dp_1FU1N.js";import{S as Y}from"./SEO-B_3HaRH0.js";import{d as Z,e as D,h as J,m as A}from"./index-FZUSOwo2.js";import{g as M}from"./getOptimizedImageUrl-DbohTHrX.js";import{u as K,a as X}from"./useBroadcast-DddCz1VT.js";import{u as ee,i as b}from"./useRadioPlayback-BpXZBo6m.js";import{c as O,L as y,P as w,b as j,o as ae,p as re,q as se,r as te,U as ie,s as ne}from"./vendor-icons-D7M_7Je-.js";import"./vendor-charts-Cf-ruFca.js";import"./vendor-ui-utils-Bbg69IUi.js";import"./vendor-graph-Df3mHyA7.js";import"./vendor-helmet-C74EPpLp.js";import"./portalEntityIds-B3YcqYmS.js";import"./usePortalSeoConfig-C108lqtU.js";import"./toCdnUrl-DV2rJaVv.js";import"./vendor-supabase-UBwEW4nm.js";import"./vendor-sonner-DPZ7yCFm.js";const R=[{wd:0,short:"Dom",long:"Domingo"},{wd:1,short:"Seg",long:"Segunda"},{wd:2,short:"Ter",long:"Terça"},{wd:3,short:"Qua",long:"Quarta"},{wd:4,short:"Qui",long:"Quinta"},{wd:5,short:"Sex",long:"Sexta"},{wd:6,short:"Sáb",long:"Sábado"}],v=i=>i?i.slice(0,5):"",oe=new Intl.ListFormat("pt-BR",{style:"long",type:"conjunction"}),q=i=>{try{const u=new Intl.DateTimeFormat("en-US",{timeZone:i,weekday:"short"}).format(new Date);return{Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6}[u]??new Date().getDay()}catch{return new Date().getDay()}},le=()=>{const i=D();return e.jsx("span",{className:"flex items-end gap-0.5 h-3","aria-hidden":"true",children:[.4,1,.6].map((u,l)=>e.jsx(A.span,{className:"w-0.5 bg-current rounded-full",style:{height:"30%"},animate:i?{height:"70%"}:{height:["30%",`${u*100}%`,"45%"]},transition:i?{duration:0}:{duration:.9,repeat:1/0,delay:l*.15}},l))})},$e=()=>{var E;const{currentPortal:i,isPortalLoading:u}=Z(),{channels:l,loading:B}=K(i.id,"radio"),{byChannelId:N,progressFor:T}=X(i.id,{enabled:!u,ticker:!0}),d=ee(i.id,i.logoUrl,N),G=D(),k=n.useRef({}),_=n.useRef({}),P=r=>r==null?void 0:r.scrollIntoView({behavior:G?"auto":"smooth",block:"nearest",inline:"center"}),[$,S]=n.useState(null),[C,F]=n.useState([]),[c,L]=n.useState(null),[U,z]=n.useState(!1);n.useEffect(()=>{S(r=>{var s;return r??((s=l[0])==null?void 0:s.id)??null})},[l]);const a=n.useMemo(()=>l.find(r=>r.id===$)??l[0]??null,[l,$]),o=a?N.get(a.id):null,h=T(a==null?void 0:a.id);n.useEffect(()=>{a&&L(r=>r??q(a.timezone))},[a]),n.useEffect(()=>{if(!a)return;let r=!1;return(async()=>{z(!0);const{data:s,error:t}=await J.rpc("get_broadcast_grid",{p_portal_id:i.id,p_medium:"radio",p_channel_id:a.id});r||(!t&&s&&F(s),z(!1))})(),()=>{r=!0}},[a,i.id]),n.useEffect(()=>{a&&P(k.current[a.id])},[a]),n.useEffect(()=>{c!==null&&P(_.current[String(c)])},[c]);const m=n.useMemo(()=>C.filter(r=>r.weekday===c),[C,c]),g=((E=R.find(r=>r.wd===c))==null?void 0:E.long)??"",Q=a?q(a.timezone):null,p=b(a==null?void 0:a.stream_url),x=a?d.isPlaying(a.id):!1,I=a?d.isLoading(a.id):!1,W=a?d.hasError(a.id):!1,H=n.useMemo(()=>{if(!(!a||m.length===0))return[{"@context":"https://schema.org","@type":"RadioBroadcastService",name:a.name,broadcastFrequency:a.frequency??void 0,areaServed:`${a.city}${a.state?`, ${a.state}`:""}`,inLanguage:"pt-BR"},{"@context":"https://schema.org","@type":"ItemList",name:`Programação ${a.name} â ${g}`,numberOfItems:m.length,itemListElement:m.map((r,s)=>({"@type":"ListItem",position:s+1,item:{"@type":"RadioSeries",name:r.program_name,...r.program_cover_url?{image:r.program_cover_url}:{},...r.hosts&&r.hosts.length>0?{actor:r.hosts.map(t=>({"@type":"Person",name:t}))}:{}}}))}]},[a,m,g]);return e.jsxs(V,{children:[e.jsx(Y,{title:a?`Programação ${a.name}${a.frequency?` ${a.frequency}`:""}`:"Programação â CBN Amazônia",description:a?`Grade completa da ${a.name} em ${a.city}: horários, programas e apresentadores, dia a dia. Ouça ao vivo.`:"Grade de programação das emissoras CBN Amazônia: horários, programas e apresentadores nas praças da Amazônia.",canonicalPath:"/programacao",jsonLd:H}),e.jsxs("header",{className:"relative bg-gradient-to-br from-gray-900 via-gray-900 to-gray-800 text-white overflow-hidden print:bg-white print:text-black",children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.12] pointer-events-none print:hidden","aria-hidden":"true",children:e.jsx("div",{className:"absolute -top-24 left-1/4 w-72 h-72 sm:w-96 sm:h-96 bg-red-600 rounded-full blur-3xl"})}),e.jsxs("div",{className:"relative z-10 max-w-[1200px] mx-auto px-4 py-8 sm:py-12",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-3",children:[e.jsx(O,{className:"h-5 w-5 text-red-500","aria-hidden":"true"}),e.jsx("span",{className:"text-[11px] font-bold tracking-[0.18em] text-red-400 uppercase",children:"Grade completa"})]}),e.jsx("h1",{className:"text-3xl sm:text-4xl font-bold tracking-tight mb-2.5",children:"Programação"}),e.jsx("p",{className:"text-gray-300 max-w-2xl text-sm sm:text-base",children:"O que toca em cada praça da CBN Amazônia, hora a hora. Os horários são sempre os da cidade escolhida."}),a&&(o==null?void 0:o.current_program)&&e.jsxs("div",{className:"mt-6 sm:mt-8 rounded-2xl bg-white/[0.06] ring-1 ring-white/10 backdrop-blur-sm p-3 sm:p-4 print:hidden",children:[e.jsxs("div",{className:"flex items-center gap-3 sm:gap-4",children:[e.jsx("button",{type:"button",onClick:()=>a&&d.toggle(a),disabled:!p,"aria-label":x?`Pausar ${a.name}`:`Ouvir ${a.name}
1 ao vivo`,className:`w-12 h-12 sm:w-14 sm:h-14 rounded-full flex items-center justify-center flex-shrink-0 shadow-lg transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-red-400 focus-visible:ring-offset-2 focus-visible:ring-offset-gray-900 ${p?"bg-gradient-to-br from-red-500 to-red-600 hover:from-red-400 hover:to-red-500 shadow-red-900/50 active:scale-95":"bg-white/10 cursor-not-allowed"}`,children:I?e.jsx(y,{className:"w-5 h-5 sm:w-6 sm:h-6 animate-spin"}):x?e.jsx(w,{className:"w-5 h-5 sm:w-6 sm:h-6 fill-current"}):e.jsx(j,{className:"w-5 h-5 sm:w-6 sm:h-6 fill-current ml-0.5"})}),o.current_cover_url&&e.jsx("img",{src:M(o.current_cover_url,{width:128,height:128}),alt:"",width:56,height:56,className:"hidden sm:block w-14 h-14 rounded-xl object-cover bg-white/5 ring-1 ring-white/10 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 bg-red-600 rounded text-[10px] font-bold tracking-[0.12em] flex-shrink-0",children:[e.jsx("span",{className:"w-1 h-1 bg-white rounded-full animate-pulse"}),"NO AR"]}),e.jsxs("span",{className:"text-xs text-white/60 truncate tabular-nums",children:[h.clock," em ",a.city]})]}),e.jsx("p",{className:"mt-1 font-semibold truncate",children:o.current_program}),o.next_program&&e.jsxs("p",{className:"text-xs text-white/60 truncate",children:["a seguir ",o.next_program," à s ",v(o.next_start)]})]}),x&&e.jsx("span",{className:"hidden sm:flex text-red-400 flex-shrink-0",children:e.jsx(le,{})})]}),h.ratio!==null&&e.jsx("div",{className:"mt-3 h-1 w-full rounded-full bg-white/10 overflow-hidden",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(h.ratio*100),"aria-label":`Progresso de ${o.current_program}`,children:e.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-red-600 to-red-400 transition-[width] duration-1000 ease-linear",style:{width:`${Math.round(h.ratio*100)}%`}})}),W&&e.jsxs("p",{className:"flex items-center gap-2 mt-2.5 text-sm text-red-300",role:"alert",children:[e.jsx(ae,{className:"w-4 h-4 flex-shrink-0","aria-hidden":"true"}),"Não foi possÃvel conectar à transmissão. Tente novamente."]})]})]})]}),e.jsx("div",{className:"border-b border-gray-200 bg-white/95 backdrop-blur sticky top-[65px] sm:top-[75px] z-20 print:static print:border-0 print:bg-white",children:e.jsxs("div",{className:"max-w-[1200px] mx-auto px-4",children:[e.jsxs("nav",{className:"flex items-center gap-1.5 overflow-x-auto scrollbar-hide py-2.5","aria-label":"Praças",children:[e.jsx(re,{className:"h-4 w-4 text-gray-500 flex-shrink-0 mr-0.5","aria-hidden":"true"}),l.map(r=>{const s=(a==null?void 0:a.id)===r.id,t=d.isPlaying(r.id);return e.jsxs("div",{className:"flex items-center flex-shrink-0",children:[e.jsxs("button",{ref:f=>{k.current[r.id]=f},type:"button",onClick:()=>S(r.id),"aria-pressed":s,className:`h-9 pl-3.5 text-sm font-medium whitespace-nowrap transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-red-500 ${b(r.stream_url)?"pr-1.5 rounded-l-full":"pr-3.5 rounded-full"} ${s?"bg-gray-900 text-white":"text-gray-600 hover:bg-gray-100"}`,children:[r.city,r.frequency&&e.jsxs("span",{className:s?"text-gray-300":"text-gray-500",children:[" ",r.frequency.replace(" FM","")]})]}),b(r.stream_url)&&e.jsx("button",{type:"button",onClick:()=>d.toggle(r),"aria-label":t?`Pausar ${r.name}`:`Ouvir ${r.name} ao vivo`,className:`h-9 w-9 rounded-r-full flex items-center justify-center transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-red-500 ${t?"bg-red-600 text-white":s?"bg-gray-900 text-gray-300 hover:text-white":"bg-gray-100 text-gray-600 hover:text-gray-900"}`,children:d.isLoading(r.id)?e.jsx(y,{className:"h-3.5 w-3.5 animate-spin"}):t?e.jsx(w,{className:"h-3.5 w-3.5 fill-current"}):e.jsx(j,{className:"h-3.5 w-3.5 fill-current ml-0.5"})})]},r.id)})]}),e.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto scrollbar-hide pb-2.5",children:[e.jsx(se,{className:"h-4 w-4 text-gray-500 flex-shrink-0 mr-1","aria-hidden":"true"}),R.map(r=>{const s=Q===r.wd,t=c===r.wd;return e.jsxs("button",{ref:f=>{_.current[String(r.wd)]=f},type:"button",onClick:()=>L(r.wd),"aria-pressed":t,className:`relative px-3.5 h-9 rounded-lg text-sm font-medium flex-shrink-0 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-red-500 ${t?"bg-red-600 text-white":"text-gray-600 hover:bg-gray-100"}`,children:[r.short,s&&!t&&e.jsx("span",{className:"absolute bottom-1 left-1/2 -translate-x-1/2 w-1 h-1 rounded-full bg-red-600"})]},r.wd)}),e.jsxs("button",{type:"button",onClick:()=>window.print(),className:"ml-auto hidden sm:flex items-center gap-1.5 px-3 h-9 rounded-lg text-sm text-gray-500 hover:text-gray-900 hover:bg-gray-100 transition-colors print:hidden flex-shrink-0",children:[e.jsx(te,{className:"h-4 w-4","aria-hidden":"true"}),"Imprimir"]})]})]})}),e.jsxs("main",{className:"max-w-[1200px] mx-auto px-4 py-7 sm:py-10",children:[a&&e.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1 mb-5",children:[e.jsxs("h2",{className:"text-lg font-bold text-gray-900",children:[a.name,e.jsxs("span",{className:"ml-2 font-normal text-gray-500",children:[g,a.frequency?` · ${a.frequency}`:""]})]}),e.jsxs("span",{className:"text-sm text-gray-500 tabular-nums",children:[m.length," programas"]})]}),B||U?e.jsx("div",{className:"space-y-2","aria-busy":"true","aria-label":"Carregando a grade",children:[1,2,3,4,5,6].map(r=>e.jsx("div",{className:"h-[72px] bg-gray-100 rounded-xl animate-pulse"},r))}):m.length===0?e.jsxs("p",{className:"text-gray-500 py-10",children:["Grade indisponÃvel para ",g.toLowerCase()," nesta praça."]}):e.jsx("ol",{children:m.map((r,s)=>{const t=(o==null?void 0:o.current_slot_id)===r.slot_id;return e.jsxs(A.li,{initial:{opacity:0,y:6}
1,animate:{opacity:1,y:0},transition:{duration:.25,delay:Math.min(s*.015,.3)},className:`flex items-center gap-3 sm:gap-4 py-3.5 px-3 -mx-3 rounded-xl transition-colors border-b border-gray-100 last:border-b-0 ${t?"bg-red-50 ring-1 ring-red-100 border-transparent":""}`,children:[e.jsxs("div",{className:"w-[76px] sm:w-[104px] flex-shrink-0",children:[e.jsx("div",{className:`font-semibold tabular-nums ${t?"text-red-600":"text-gray-900"}`,children:v(r.start_time)}),e.jsxs("div",{className:"text-xs text-gray-500 tabular-nums",children:["até ",v(r.end_time)]})]}),r.program_cover_url?e.jsx("img",{src:M(r.program_cover_url,{width:96,height:96}),alt:"",loading:"lazy",width:48,height:48,className:"w-11 h-11 sm:w-12 sm:h-12 rounded-lg object-cover bg-gray-100 flex-shrink-0"}):e.jsx("div",{className:"w-11 h-11 sm:w-12 sm:h-12 rounded-lg bg-gray-100 flex items-center justify-center flex-shrink-0",children:e.jsx(O,{className:"h-5 w-5 text-gray-300","aria-hidden":"true"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"font-semibold text-gray-900 truncate",children:r.program_name}),t&&e.jsxs("span",{className:"flex items-center gap-1.5 px-2 py-0.5 bg-red-600 text-white rounded text-[10px] font-bold tracking-wider flex-shrink-0",children:[e.jsx("span",{className:"w-1 h-1 bg-white rounded-full animate-pulse"}),"NO AR"]})]}),r.hosts&&r.hosts.length>0&&e.jsxs("p",{className:"flex items-center gap-1.5 text-sm text-gray-500 truncate",children:[e.jsx(ie,{className:"h-3.5 w-3.5 flex-shrink-0 text-gray-300","aria-hidden":"true"}),oe.format(r.hosts)]})]}),t&&a&&p&&e.jsx("button",{type:"button",onClick:()=>d.toggle(a),"aria-label":x?`Pausar ${a.name}`:`Ouvir ${a.name} ao vivo`,className:"w-10 h-10 rounded-full bg-red-600 text-white flex items-center justify-center flex-shrink-0 hover:bg-red-500 active:scale-95 transition-[transform,background-color] focus:outline-none focus-visible:ring-2 focus-visible:ring-red-500 focus-visible:ring-offset-2 print:hidden",children:I?e.jsx(y,{className:"h-4 w-4 animate-spin"}):x?e.jsx(w,{className:"h-4 w-4 fill-current"}):e.jsx(j,{className:"h-4 w-4 fill-current ml-0.5"})})]},r.slot_id)})}),e.jsxs("p",{className:"mt-8 flex items-start gap-2 text-xs text-gray-500",children:[e.jsx(ne,{className:"h-3.5 w-3.5 flex-shrink-0 mt-px","aria-hidden":"true"}),"Horários de ",(a==null?void 0:a.city)??"cada praça"," e sujeitos a alteração sem aviso prévio."]})]})]})};export{$e as default};
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.