PageSourceSearch

https://kvcr.org/build/assets/Schedule-GSMngmNX.js

js kvcr.org collected 2026-10-02 05:06:53 UTC 23,143 bytes, 1 lines download raw bytes

1import{r as m,j as e,c as K,L as O}from"./app-CbjOlfpv.js";import{H as Y}from"./SafeHead-OZwuQ1sY.js";import{L as q,w as z}from"./Layout-BytDf8yK.js";import{P as G}from"./index-Dl871znN.js";import{P as Z}from"./PageHeader-Bysv8EhX.js";import{s as P,a as V,D as Q}from"./index.es-BD0L0HUo.js";import"./clsx-B-dksMZM.js";function X(s){const r=Math.floor(s/100),n=s%100,x=r<12?"AM":"PM";return`${r%12===0?12:r%12}:${String(n).padStart(2,"0")} ${x}`}function J(s){const[r,n,x]=s.split("-").map(Number);return new Date(r,n-1,x).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}const ee=({listing:s,onClose:r})=>{const[n,x]=m.useState([]),[i,g]=m.useState(!0),[w,v]=m.useState(null),f=m.useRef(null);m.useEffect(()=>{const t=new URLSearchParams;if(s.program_id?t.set("program_id",String(s.program_id)):s.show_id&&t.set("show_id",s.show_id),!t.toString()){g(!1);return}fetch(`/api/tv/upcoming?${t}`).then(c=>c.json()).then(c=>{x(c),g(!1)}).catch(()=>g(!1))},[s.program_id,s.show_id]),m.useEffect(()=>{const t=c=>{c.key==="Escape"&&r()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[r]),m.useEffect(()=>{var t;(t=f.current)==null||t.focus()},[]);const N=s.image_url||s.iconic_image_url,o=N?N.replace(/(\?resize=)\d+x\d+/,"$11000x563"):void 0,l=s.episode_description||s.description;return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",onClick:t=>{t.target===t.currentTarget&&r()},role:"dialog","aria-modal":"true","aria-label":s.title,children:e.jsxs("div",{ref:f,tabIndex:-1,className:"relative max-h-[90vh] w-full max-w-lg overflow-y-auto rounded-lg bg-white shadow-xl outline-none",children:[o&&e.jsx("div",{className:"w-full bg-cover bg-center",style:{aspectRatio:"16 / 9",backgroundImage:`linear-gradient(rgba(0,0,0,0.45), rgba(0,0,0,0.45)), url(${o})`}}),e.jsx("button",{onClick:r,className:"absolute top-3 right-3 flex h-8 w-8 items-center justify-center rounded-full bg-black/50 text-white hover:bg-black/70","aria-label":"Close",children:"✕"}),e.jsxs("div",{className:"p-5",children:[e.jsx("h2",{className:"text-xl font-bold text-gray-900",children:s.title}),s.episode_title&&e.jsx("p",{className:"mt-1 text-sm font-medium text-gray-600",children:s.episode_title}),l&&e.jsx("p",{className:"mt-3 text-sm text-gray-700",children:l}),e.jsxs("div",{className:"mt-5",children:[e.jsx("h3",{className:"mb-2 text-sm font-semibold tracking-wide text-gray-500 uppercase",children:"Upcoming Airings"}),i&&e.jsx("p",{className:"text-sm text-gray-400",children:"Loading..."}),!i&&n.length===0&&e.jsx("p",{className:"text-sm text-gray-400",children:"No upcoming airings found."}),!i&&n.length>0&&e.jsx("ul",{className:"divide-y divide-gray-100",children:n.map((t,c)=>{var h;const p=t.episode_description||(t.episode_title?t.description:null),j=!!(t.episode_title||p),a=w===c;return e.jsxs("li",{children:[e.jsxs("button",{type:"button",onClick:()=>j&&v(a?null:c),className:`flex w-full items-center justify-between py-2 text-left text-sm ${j?"cursor-pointer hover:bg-gray-50":"cursor-default"}`,children:[e.jsxs("span",{className:"text-gray-800",children:[J(t.listing_date)," — ",X(t.start_time)]}),e.jsxs("span",{className:"ml-4 flex items-center gap-2 text-xs text-gray-500",children:[((h=t.television_channel)==null?void 0:h.full_name)??"",j&&e.jsx("svg",{className:`h-3 w-3 shrink-0 transition-transform ${a?"rotate-180":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:e.jsx("path",{d:"M6 9l6 6 6-6"})})]})]}),a&&e.jsxs("div",{className:"pb-3 pl-1 text-sm",children:[t.episode_title&&e.jsx("p",{className:"font-medium text-gray-700",children:t.episode_title}),p&&e.jsx("p",{className:"mt-1 text-gray-500",children:p})]})]},c)})})]})]})]})})},U=({channelId:s,slotIdx:r,isCurrentTimeSlot:n=!1})=>e.jsx("div",{className:`flex h-[120px] min-h-[160px] min-w-[120px] items-center justify-center p-2 ${n?"bg-blue-50 ring-2 ring-blue-400":"bg-gray-50"}`,children:e.jsx("span",{className:"text-xs text-gray-600",children:"No Listing"})},`slot-${s}-${r}`),B=({show:s,slotsToSpan:r,channelId:n,slotIdx:x,isExtended:i=!1,isCurrentTimeSlot:g=!1,isSearchActive:w=!1,isMatch:v=!1,onListingClick:f})=>{const[N,o]=m.useState(!1),l=m.useRef(null);m.useEffect(()=>{const a=new IntersectionObserver(([h])=>{h.isIntersecting&&(o(!0),a.unobserve(h.target))},{rootMargin:"50px"});return l.current&&a.observe(l.current),()=>a.disconnect()},[]);const t=s.iconic_image_url||s.image_url,c=!!t&&N,p=c?"text-white drop-shadow-lg":"text-black",j=w?v?"ring-4 ring-emerald-400 shadow-lg brightness-110":"opacity-40 saturate-50":"";return e.jsxs("div",{ref:l,className:`flex h-[160px] min-h-[100px] min-w-[180px] cursor-pointer flex-col justify-center bg-gray-100 bg-cover bg-center bg-no-repeat p-3 ${g?"ring-2 ring-yellow-200":""} ${j}`,"data-show-match":w&&v?"true":"false","data-slot-idx":x,style:{gridColumn:`span ${r}`,...c&&{backgroundImage:`linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)), url(${t})`}},onClick:()=>f==null?void 0:f(s),role:"button",tabIndex:0,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(f==null||f(s))},children:[e.jsx("span",{className:`mb-1 text-center text-sm font-bold ${p}`,children:s.title}),s.episode_title&&e.jsx("span",{className:`text-center text-xs ${p}`,children:s.episode_title})]},`show-${n}-${s.start_time}-${i?"ext":""}${x}`)},F=s=>Math.floor(s/100)*60+s%100,W=s=>{const r=String(s).padStart(4,"0");let n=parseInt(r.slice(0,2),10);const x=r.slice(2,4),i=n>=12?"PM":"AM";return n===0?n=12:n>12&&(n-=12),`${n}:${x} ${i}`},te=(s,r,n)=>{if(s.duration&&s.duration>0)return s.duration;if(r<n.length-1){const x=F(s.start_time);return F(n[r+1].start_time)-x}return 30},se=()=>{const s=[];for(let r=0;r<=23;r++)for(let n=0;n<60;n+=30){const x=r*100+n;s.push(W(x))}return s},H=s=>{const[r,n]=s.split(" "),[x,i]=r.split(":");let g=parseInt(x);const w=parseInt(i);return n==="PM"&&g!==12&&(g+=12),n==="AM"&&g===12&&(g=0),g*100+w},re=s=>s,ae=({visibleTimeSlots:s,currentSlotIndex:r,highlightCurrentTime:n,listingsByChannel:x,channelId:i,searchQuery:g="",onListingClick:w})=>{const v=(x[i]||[]).sort((o,l)=>o.start_time-l.start_time),f=g.trim().toLowerCase(),N=()=>{let o=null,l=0,t=0;const c=[];for(;t<s.length;){const p=s[t],j=H(p),a=v.find(h=>re(h.start_time)===j);if(a){const h=v.findIndex(D=>D.start_time===a.start_time&&D.title===a.title),b=te(a,h,v)>=60?2:1,$=f.length===0?!1:a.title.toLowerCase().includes(f)||(a.episode_title||"").toLowerCase().includes(f),_=s.length-t,d=Math.min(b,_);o=a,l=d,c.push(e.jsx(B,{show:a,slotsToSpan:d,channelId:i,slotIdx:t,isCurrentTimeSlot:n&&r>=t&&r<t+d,isSearchActive:f.length>0,isMatch:$,onListingClick:w},`show-${i}-${a.start_time}-${t}`)),t+=d}else if(o){if(s.length-(t-l)>0){l+=1;const y=Math.min(l,s.length-(t-l+1));c.pop();const b=t-y+1;c.push(e.jsx(B,{show:o,slotsToSpan:y,channelId:i,slotIdx:b,isExtended:!0,isCurrentTimeSlot:n&&r>=b&&r<b+y,isSearchActive:f.length>0,isMatch:f.length>0&&(o.title.toLowerCase().includes(f)||(o.episode_title||"").toLowerCase().includes(f)),onListingClick:w},`show-${i}-${o.start_time}-ext${t}`))}else c.push(e.jsx(U,{channelId:i,slotIdx:t,isCurrentTimeSlot:n&&t===r},`slot-${i}-${t}`)),o=null,l=0;t+=1}else c.push(e.jsx(U,{channelId:i,slotIdx:t,isCurrentTimeSlot:n&&t===r},`slot-${i}-${t}`)),t+=1}return c};return e.jsx("div",{className:"mb-2 grid min-w-max items-center gap-2 border-y border-gray-200",style:{gridTemplateColumns:`repeat(${s.length}, 180px)`},children:N()})},ne=({channel:s,listings:r,activeIndex:n,highlightCurrentTime:x,normalizedQuery:i,onListingClick:g})=>{const w=m.useRef(null),v=m.useRef(null),f=m.useRef(!1),N=m.useRef(0),o=m.useRef(0),l=m.useRef(0);m.useEffect(()=>{const a=requestAnimationFrame(()=>{const h=w.current,y=v.current;if(!h||!y)return;const b=h.getBoundingClientRect(),_=y.getBoundingClientRect().left-b.left;h.scrollLeft=Math.max(0,_-h.offsetWidth/2+y.offsetWidth/2)});return()=>cancelAnimationFrame(a)},[]);const t=a=>{const h=w.current;h&&(f.current=!0,N.current=a.pageX-h.offsetLeft,o.current=h.scrollLeft,l.current=0)},c=a=>
1{if(!f.current)return;const h=w.current;if(!h)return;a.preventDefault();const b=a.pageX-h.offsetLeft-N.current;l.current=Math.abs(b),h.scrollLeft=o.current-b},p=()=>{f.current=!1},j=a=>{l.current>5&&a.stopPropagation()};return e.jsxs("div",{className:"overflow-hidden rounded-lg border border-gray-200",children:[e.jsxs("div",{className:"flex items-center gap-3 bg-gray-800 px-4 py-3",children:[s.logo_url&&e.jsx("img",{src:`/storage/${s.logo_url}`,alt:s.full_name,className:"h-7 max-w-20 object-contain"}),e.jsx("span",{className:"text-sm font-semibold text-white",children:s.full_name})]}),e.jsx("div",{ref:w,className:"flex cursor-grab gap-2 overflow-x-auto bg-gray-100 p-2 select-none active:cursor-grabbing",onMouseDown:t,onMouseMove:c,onMouseUp:p,onMouseLeave:p,onClickCapture:j,children:r.length===0?e.jsx("p",{className:"px-2 py-4 text-sm text-gray-400",children:"No listings available."}):r.map((a,h)=>{const y=a.iconic_image_url||a.image_url,b=x&&h===n,$=i.length>0&&(a.title.toLowerCase().includes(i)||(a.episode_title||"").toLowerCase().includes(i)),_=i.length>0&&!$;return e.jsxs("button",{ref:b?v:void 0,type:"button",onClick:()=>g==null?void 0:g(a),className:`relative h-28 w-36 flex-none overflow-hidden rounded text-left transition-opacity ${_?"opacity-40":""} ${$?"ring-2 ring-emerald-400":""} ${b?"ring-2 ring-yellow-400":""} ${y?"":"bg-gray-200"}`,style:y?{backgroundImage:`linear-gradient(rgba(0,0,0,0.45), rgba(0,0,0,0.7)), url(${y})`,backgroundSize:"cover",backgroundPosition:"center"}:void 0,children:[b&&e.jsx("span",{className:"absolute top-1.5 right-1.5 rounded bg-yellow-400 px-1 py-0.5 text-[10px] font-bold text-black",children:"NOW"}),e.jsxs("div",{className:"absolute inset-0 flex flex-col justify-between p-2",children:[e.jsx("span",{className:`font-mono text-xs font-bold ${y?"text-gray-300":"text-gray-500"}`,children:W(a.start_time)}),e.jsxs("div",{children:[e.jsx("p",{className:`text-xs leading-tight font-semibold ${y?"text-white":"text-gray-800"}`,children:a.title}),a.episode_title&&e.jsx("p",{className:`mt-0.5 text-xs leading-tight ${y?"text-gray-300":"text-gray-500"}`,children:a.episode_title})]})]})]},h)})})]})},oe=({channels:s,listingsByChannel:r,nowMilitary:n,highlightCurrentTime:x=!0,searchQuery:i="",onListingClick:g})=>{const w=i.trim().toLowerCase(),v=F(n);return e.jsx("div",{className:"space-y-3",children:s.map(f=>{const N=(r[f.id]||[]).sort((l,t)=>l.start_time-t.start_time),o=N.reduce((l,t,c)=>F(t.start_time)<=v?c:l,-1);return e.jsx(ne,{channel:f,listings:N,activeIndex:o,highlightCurrentTime:x,normalizedQuery:w,onListingClick:g},f.id)})})},le=({channels:s,listingsByChannel:r,nowMilitary:n,highlightCurrentTime:x=!0,searchQuery:i="",onListingClick:g})=>{const w=m.useRef(null),[v,f]=m.useState(i),o=se(),l=m.useMemo(()=>{let t=0,c=Number.POSITIVE_INFINITY;return o.forEach((p,j)=>{const a=Math.abs(H(p)-n);a<c&&(c=a,t=j)}),t},[o,n]);return m.useEffect(()=>{const t=w.current;if(!t)return;const c=200,p=180,j=c+l*p-t.clientWidth/2+p/2;t.scrollLeft=Math.max(0,j)},[l]),m.useEffect(()=>{var $;const t=w.current,c=v.trim().toLowerCase();if(!t||c.length===0)return;const p=Array.from(t.querySelectorAll('[data-show-match="true"]'));if(p.length===0)return;const j=t.scrollLeft,a=j+t.clientWidth;if(p.some(_=>{const d=_.offsetLeft,D=d+_.offsetWidth;return d>=j&&D<=a}))return;const y=($=p.map(_=>{const d=Number.parseInt(_.dataset.slotIdx||"0",10);return{match:_,distance:Math.abs(d-l)}}).sort((_,d)=>_.distance-d.distance)[0])==null?void 0:$.match;if(!y)return;const b=y.offsetLeft-t.clientWidth/2+y.offsetWidth/2;t.scrollTo({left:Math.max(0,b),behavior:"smooth"})},[v,l]),m.useEffect(()=>{const t=window.setTimeout(()=>{f(i)},3e3);return()=>{window.clearTimeout(t)}},[i]),e.jsxs("div",{className:"rounded bg-white p-4",children:[e.jsx("div",{className:"md:hidden",children:e.jsx(oe,{channels:s,listingsByChannel:r,nowMilitary:n,highlightCurrentTime:x,searchQuery:i,onListingClick:g})}),e.jsxs("div",{className:"hidden gap-2 md:flex",children:[e.jsxs("div",{className:"w-[200px] shrink-0",children:[e.jsx("div",{className:"mb-2 h-8.5"}),s.map(t=>e.jsx("div",{className:"mb-2 flex h-40.5 flex-col items-center justify-center gap-2 border-y border-gray-700 bg-gray-800 p-3 text-white",children:t.logo_url?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:`/storage/${t.logo_url}`,alt:t.full_name,className:"max-h-12 max-w-full object-contain"}),e.jsx("span",{className:"text-center text-xs font-semibold",children:t.full_name})]}):e.jsx("span",{className:"text-center text-xs font-semibold",children:t.full_name})},`label-${t.id}`))]}),e.jsx("div",{ref:w,className:"overflow-x-auto",tabIndex:0,role:"region","aria-label":"TV schedule grid, scrollable",children:e.jsxs("div",{children:[e.jsx("div",{className:"grid min-w-max gap-2",style:{gridTemplateColumns:`repeat(${o.length}, 180px)`},children:o.map((t,c)=>e.jsx("div",{className:`mb-2 flex min-w-[120px] items-center justify-center border-b-2 p-2 text-center font-mono text-xs font-bold ${x&&c===l?"border-gray-300 bg-yellow-200 text-black":"border-gray-300 bg-gray-100 text-gray-700"}`,children:t},`time-${c}`))}),s.map(t=>e.jsx(ae,{channelId:t.id,visibleTimeSlots:o,currentSlotIndex:l,highlightCurrentTime:x,listingsByChannel:r,searchQuery:i,onListingClick:g},t.id))]})})]})]})},ce=({startDate:s,onDateChange:r,currentPSTDate:n,todayPSTDate:x,availableDates:i=[],isSearchOpen:g=!1,onToggleSearch:w,searchToggleButtonRef:v})=>{const N=(()=>{var R,L,k;const d=x??n;if(d){const[C,A,E]=d.split("-").map(Number);return new Date(C,A-1,E)}const D=new Date,u=new Intl.DateTimeFormat("en-US",{timeZone:"America/Los_Angeles",year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(D),S=parseInt(((R=u.find(C=>C.type==="year"))==null?void 0:R.value)||"0"),M=parseInt(((L=u.find(C=>C.type==="month"))==null?void 0:L.value)||"0")-1,I=parseInt(((k=u.find(C=>C.type==="day"))==null?void 0:k.value)||"0");return new Date(S,M,I)})(),o=P(N,7),l=V(N,21),t=d=>{if(!d)return null;const D=d.match(/^(\d{4})(\d{2})(\d{2})$/);if(D){const[,S,M,I]=D;return new Date(Number(S),Number(M)-1,Number(I))}const T=d.match(/^(\d{4})-(\d{2})-(\d{2})/);if(T){const[,S,M,I]=T;return new Date(Number(S),Number(M)-1,Number(I))}const u=new Date(d);return Number.isNaN(u.getTime())?null:new Date(u.getFullYear(),u.getMonth(),u.getDate())},c=i.map(d=>t(d)).filter(d=>d!==null).filter(d=>d>=o&&d<=l),p=new Set(c.map(d=>{const D=d.getFullYear(),T=String(d.getMonth()+1).padStart(2,"0"),u=String(d.getDate()).padStart(2,"0");return`${D}-${T}-${u}`})),j=d=>{const D=d.getFullYear(),T=String(d.getMonth()+1).padStart(2,"0"),u=String(d.getDate()).padStart(2,"0");return`${D}-${T}-${u}`},a=d=>p.has(j(d)),h=s?P(s,1):null,y=s?V(s,1):null,b=h!==null&&a(h),$=y!==null&&a(y),_=d=>`inline-flex items-center gap-2 rounded-md border px-4 py-2 text-sm font-medium transition-colors ${d?"border-gray-700 bg-gray-800 text-white hover:bg-gray-700 cursor-pointer":"border-gray-200 bg-gray-100 text-gray-400 cursor-not-allowed"}`;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-2 flex flex-col items-center gap-4 md:flex-row md:items-start md:justify-between",children:[e.jsxs("h2",{className:"text-center text-xl font-semibold md:text-left",children:["TV Schedule for"," ",s?s.toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",weekday:"long"}):n||"Loading..."]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{ref:v,type:"button",onClick:w,"aria-label":"Toggle show search","aria-expanded":g,"aria-controls":"schedule-show-search-panel",className:"inline-flex h-10 w-10 items-center justify-center rounded-md border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 focus-visible:ring-2 focus-visible:ring-blue-700 focus-visible:ring-offset-2 focus-visible:outline-none",children:e.jsxs("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[e.jsx("circle",{cx:"11",cy:"11",r:"7"}),e.jsx("path",{d:"M20 20l-3.5-3.5"})]})}),e.jsx(Q,{showIcon:!0,selected:s,onChange:r,enableTabLoop:!1,includeDates:c.length>0?c:void 0,filterDate:a,minDate:o,maxDate:l,todayButton:"Today",placeholderText:"Select date"})]})]}),e.jsxs("div",{className:"mb-6 flex justify-center gap-3 md:justify-end",children:[e.jsxs("button",{type:"button",onClick:()=>b&&r(h),disabled:!b,"aria-label":"Previous day",className:_(b),children:[e.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:e.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Previous Day"]}),e.jsxs("button",{type:"button",onClick:()=>$&&r(y),disabled:!$,"aria-label":"Next day",className:_($),children:["Next Day",e.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:e.jsx("path",{d:"M9 18l6-6-6-6"})})]})]})]})},ie=(s,r,n=[])=>{const[x,i]=m.useState(!1),g=()=>{var a,h,y;if(r){const[b,$,_]=r.split("-").map(Number);return new Date(b,$-1,_)}const o=new Date,t=new Intl.DateTimeFormat("en-US",{timeZone:"America/Los_Angeles",year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(o),c=parseInt(((a=t.find(b=>b.type==="year"))==null?void 0:a.value)||"0"),p=parseInt(((h=t.find(b=>b.type==="month"))==null?void 0:h.value)||"0")-1,j=parseInt(((y=t.find(b=>b.type==="day"))==null?void 0:y.value)||"0");return new Date(c,p,j)},[w,v]=m.useState(g());m.useEffect(()=>{if(r){const[o,l,t]=r.split("-").map(Number),c=new Date(o,l-1,t);v(c)}},[r]);const f=m.useMemo(()=>!s||!Array.isArray(s)?{}:s.reduce((o,l)=>{const t=l.television_channel_id;return o[t]||(o[t]=[]),o[t].push(l),o},{}),[s]),N=m.useCallback(o=>
1{if(v(o),o){const l=o.getFullYear(),t=String(o.getMonth()+1).padStart(2,"0"),c=String(o.getDate()).padStart(2,"0"),p=`${l}-${t}-${c}`;console.log("Date changed to PST:",p),K.get("/tv/schedule",{date:p},{preserveState:!0,preserveScroll:!0,only:["listings","currentDate","currentTime","availableDates","debugInfo","navigation","emergencyAlert"],onError:j=>{console.error("Error loading listings for",p,j)}})}},[]);return{showEarlier:x,setShowEarlier:i,startDate:w,listingsByChannel:f,availableDates:n,handleDateChange:N}},de=2500;function ye(s){const[r,n]=m.useState(""),[x,i]=m.useState(!1),[g,w]=m.useState(!1),[v,f]=m.useState(null);m.useEffect(()=>(window.__oldSchedule=()=>w(u=>!u),()=>{delete window.__oldSchedule}),[]);const N=m.useRef(null),o=m.useRef(""),l=m.useCallback(u=>{const S=u.trim();!S||o.current===S||(window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"search",search_term:S,search_area:"tv_schedule",schedule_date:s.currentDate}),o.current=S)},[s.currentDate]),{startDate:t,listingsByChannel:c,availableDates:p,handleDateChange:j}=ie(s.listings,s.currentDate,s.availableDates||[]),a=()=>{var L,k;const u=new Date,M=new Intl.DateTimeFormat("en-US",{timeZone:"America/Los_Angeles",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(u),I=parseInt(((L=M.find(C=>C.type==="hour"))==null?void 0:L.value)||"0",10),R=parseInt(((k=M.find(C=>C.type==="minute"))==null?void 0:k.value)||"0",10);return I*100+R},[h,y]=m.useState(()=>{if(s.currentTime){const[u,S]=s.currentTime.split(":").map(Number);return u*100+S}return a()});m.useEffect(()=>{y(a());const u=window.setInterval(()=>{y(a())},3e4);return()=>{window.clearInterval(u)}},[]),m.useEffect(()=>{const u=r.trim();if(!u){o.current="";return}const S=window.setTimeout(()=>{l(u)},de);return()=>{window.clearTimeout(S)}},[r,l]);const b=()=>{var k,C,A;const u=new Date,M=new Intl.DateTimeFormat("en-US",{timeZone:"America/Los_Angeles",year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(u),I=((k=M.find(E=>E.type==="year"))==null?void 0:k.value)??"0000",R=((C=M.find(E=>E.type==="month"))==null?void 0:C.value)??"00",L=((A=M.find(E=>E.type==="day"))==null?void 0:A.value)??"00";return`${I}-${R}-${L}`},$=s.currentDate,_=b(),d=$===_,D=r.trim().toLowerCase(),T=D.length>0&&!s.listings.some(u=>{const S=(u.title||"").toLowerCase(),M=(u.episode_title||"").toLowerCase();return S.includes(D)||M.includes(D)});return e.jsxs(q,{title:"KVCR TV Schedule",pageType:"CollectionPage",description:"View the KVCR television schedule, including show times, listings by channel, and date-based browsing.",breadcrumbs:z([{name:"TV Schedule",url:"/tv/schedule"}]),children:[e.jsxs(Y,{children:[e.jsx("meta",{name:"description",content:"View the TV schedule for KVCR, including show times and program details."}),e.jsx("meta",{name:"keywords",content:"KVCR, TV schedule, television, program guide, show times"})]}),e.jsxs("div",{className:"schedule-page",children:[e.jsx(Z,{title:"KVCR TV Schedule"}),e.jsxs("div",{className:"container mx-auto p-5",children:[e.jsx("div",{className:"mb-4 flex justify-end",children:e.jsx("button",{onClick:()=>w(u=>!u),className:"text-sm text-gray-500 underline hover:text-gray-700",children:g?"Use new schedule":"Use old schedule"})}),!g&&e.jsxs(e.Fragment,{children:[e.jsx(ce,{startDate:t,onDateChange:j,currentPSTDate:s.currentDate,todayPSTDate:s.todayDate,availableDates:p,isSearchOpen:x,onToggleSearch:()=>i(u=>!u),searchToggleButtonRef:N}),x&&e.jsxs("div",{id:"schedule-show-search-panel",className:"mb-6 max-w-xl",role:"region","aria-label":"Schedule show search",children:[e.jsx("label",{htmlFor:"schedule-show-search",className:"mb-1 block text-sm font-medium text-gray-900",children:"Search shows"}),e.jsx("input",{id:"schedule-show-search",type:"search",value:r,onChange:u=>n(u.target.value),onBlur:()=>l(r),onKeyDown:u=>{u.key==="Enter"&&l(r),u.key==="Escape"&&(u.preventDefault(),i(!1),requestAnimationFrame(()=>{var S;(S=N.current)==null||S.focus()}))},placeholder:"Type a show title",className:"w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 focus:border-blue-700 focus:ring-2 focus:ring-blue-700 focus:outline-none","aria-describedby":"schedule-show-search-help",autoFocus:!0}),e.jsx("p",{id:"schedule-show-search-help",className:"mt-1 text-sm text-gray-600",children:"Matching shows are highlighted. Non-matching shows are dimmed."}),T&&e.jsxs("p",{className:"mt-2 text-sm text-gray-700",role:"status","aria-live":"polite",children:["No results found in this days listings."," ",e.jsx(O,{href:`${G("search")}?q=${encodeURIComponent(r.trim())}#program-listings`,onClick:()=>l(r),className:"font-medium text-blue-700 underline hover:text-blue-900",children:"Click here to search for more airings of this show"})]})]}),s.listings.length===0&&e.jsx("div",{className:"mb-6 rounded border border-gray-200 bg-white p-4 text-center text-gray-600",children:"No listings available, check back later."}),s.listings.length>0&&e.jsx("div",{className:"mb-8",children:e.jsx(le,{channels:s.channels||[],listingsByChannel:c,nowMilitary:h,highlightCurrentTime:d,searchQuery:r,onListingClick:f})}),v&&e.jsx(ee,{listing:v,onClose:()=>f(null)})]}),g&&e.jsx("iframe",{src:"/tv/schedule/pbs-widget",style:{width:"100%",border:"none",minHeight:"800px"},title:"TV Schedule"})]})]})]})}export{ye 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.