import{j as a}from"./query-vendor-CZu0EHPe.js";import{r as n}from"./react-vendor-0bvDbF03.js";import{bj as b,m as i,R as V}from"./index-BAKm2Xxi.js";import{u as I}from"./i18n-vendor-Bg2yf_Zw.js";import"./supabase-vendor-CNV44oIa.js";import"./helmet-vendor-NlTFkN97.js";const y=()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(hover: none) and (pointer: coarse)").matches,N="https://cdn.storysparkle.org/landing_assets/professional-narration-alex.mp4",k="https://cdn.storysparkle.org/landing_assets/professional-narration-elsa.mp4",S="https://cdn.storysparkle.org/landing_assets/professional-narration-jeff.mp4",c=[{src:N,alt:"Alex saying 'Listen to stories...'"},{src:k,alt:"Elsa saying '...from wonderful friends...'"},{src:S,alt:"Jeff saying '...and pronounce better!'"}],_=()=>{const d=n.useRef(null),f=b(d,{amount:.4}),{t:p}=I("landing"),[r,x]=n.useState(0),[m,w]=n.useState(!1),[l,v]=n.useState(!1),g=n.useRef(!1),u=n.useRef(!1);n.useEffect(()=>{u.current=y()},[]);const o=[n.useRef(null),n.useRef(null),n.useRef(null)];n.useEffect(()=>{c.forEach(t=>{const e=document.createElement("link");e.rel="preload",e.as="video",e.href=t.src,document.head.appendChild(e)})},[]),n.useEffect(()=>{const t=()=>{g.current=!0,o.forEach(s=>{s.current&&(s.current.muted=!1)})},e=u.current?["pointerdown","touchstart"]:["scroll","mousemove","pointerdown"];return e.forEach(s=>window.addEventListener(s,t,{once:!0,passive:!0})),()=>{e.forEach(s=>window.removeEventListener(s,t))}},[]);const E=t=>{t<c.length-1?x(t+1):v(!0)},h=n.useRef([!1,!1,!1]);n.useEffect(()=>{const t=y();u.current=t,o.forEach(e=>{e.current&&(e.current.muted=t)})},[]),n.useEffect(()=>{if(l)return;o.forEach((e,s)=>{s!==r&&e.current&&e.current.pause()});const t=o[r].current;if(t)if(f&&m){const e=()=>t.play().catch(()=>{});if(h.current[r]||t.readyState>=4)e();else{const s=()=>{h.current[r]=!0,e()};t.addEventListener("canplaythrough",s,{once:!0});const R=setTimeout(s,3e3);return()=>{t.removeEventListener("canplaythrough",s),clearTimeout(R)}}}else o.forEach(e=>e.current?.pause())},[f,r,m,l]);const j=t=>{t===c.length-1&&w(!0)};return a.jsxs("section",{ref:d,className:"min-h-screen flex flex-col items-center justify-center py-16 pb-24 overflow-hidden",style:{background:"#F3E8FF"},children:[a.jsx("div",{className:"container mx-auto px-6 text-center mb-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(i.h2,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.6},className:"section-header text-[22px] lg:text-[32px]",children:p("narration.heading")}),a.jsx(i.h3,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.6,delay:.2},className:"section-subtext text-sm lg:text-xl text-center max-w-4xl mx-auto",children:p("narration.subtext")})]})}),a.jsx("div",{className:"flex flex-row gap-6 md:gap-10 justify-center items-end px-4",children:c.map((t,e)=>a.jsxs(i.div,{initial:{y:100,opacity:0},whileInView:{y:0,opacity:1},viewport:{once:!0,amount:.2},transition:{duration:.6,delay:e*.3,ease:"easeOut"},onAnimationComplete:()=>j(e),className:"relative",children:[a.jsx(i.div,{className:"absolute inset-0 rounded-2xl pointer-events-none",animate:{boxShadow:r===e&&!l?"0 0 40px 15px rgba(168, 85, 247, 0.35)":"0 0 0px 0px rgba(168, 85, 247, 0)"},transition:{duration:.4}}),a.jsx("video",{ref:o[e],src:t.src,muted:!0,playsInline:!0,"webkit-playsinline":"true",preload:"auto",onEnded:()=>E(e),className:"w-32 sm:w-40 md:w-48 lg:w-56 rounded-2xl shadow-lg object-cover",style:{aspectRatio:"9/16"},"aria-label":t.alt})]},e))}),a.jsx(i.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.6,delay:.25},className:"mt-8 flex justify-center",children:a.jsx(V,{})})]})};export{_ as default};
//# sourceMappingURL=ProfessionalNarrationSection-F8QTHac5.js.map