import{j as e}from"./query-vendor-CZu0EHPe.js";import{r as t}from"./react-vendor-0bvDbF03.js";import{u as U}from"./useIOSAudioContext-DtqQj9l7.js";import{C as Q}from"./chevron-left-fpaShOu2.js";import{C as ee,A as te,m as _,bn as G,bo as ne}from"./index-BAKm2Xxi.js";import{u as se}from"./use-mobile-BN2Z-RJr.js";import{u as re}from"./i18n-vendor-Bg2yf_Zw.js";import"./supabase-vendor-CNV44oIa.js";import"./helmet-vendor-NlTFkN97.js";const ae=()=>{const{getContext:l}=U(),m=t.useRef(0);return t.useCallback(()=>{const s=Date.now();if(!(s-m.current<80)){m.current=s;try{const r=l();if(!r)return;const i=r.createOscillator(),y=r.createGain();i.connect(y),y.connect(r.destination),i.type="sine",i.frequency.setValueAtTime(600,r.currentTime),i.frequency.exponentialRampToValueAtTime(300,r.currentTime+.05),y.gain.setValueAtTime(.08,r.currentTime),y.gain.exponentialRampToValueAtTime(.01,r.currentTime+.05),i.start(r.currentTime),i.stop(r.currentTime+.05)}catch{}}},[l])},oe=({resistance:l=50,onInteraction:m,images:x,textFaces:s,labels:r=["Library","Medieval Town","Space","Farm"],isActive:i=!1,onRotationChange:y,hideArrows:D=!1,size:W,targetFace:k})=>{const g=t.useRef(null),O=t.useRef(null),B=t.useRef(null),X=ae(),{unlockOn:I}=U();t.useEffect(()=>I(g.current,["pointerdown","touchstart","mouseenter"]),[I]);const o=t.useRef(0),u=t.useRef(0),j=t.useRef(!1),E=t.useRef(0),L=t.useRef(0),N=t.useRef(!1),$=t.useRef(0),b=t.useRef(!1),a=t.useRef(null),c=t.useRef(!1),[T,R]=t.useState(0),d=W??140,Z=d*.06,S=t.useCallback(()=>.995-l/100*.095,[l]);t.useEffect(()=>{i&&!c.current&&!N.current&&(b.current=!0,a.current=null,c.current=!0)},[i]);const A=t.useRef(void 0);t.useEffect(()=>{if(k===void 0||k===A.current)return;A.current=k,b.current=!1;const p=[0,90,180,270][k],f=(o.current%360+360)%360;let w=p-f;w>180&&(w-=360),w<-180&&(w+=360);const F=o.current+w-o.current;u.current=F*.08},[k]);const v=n=>{g.current&&(b.current=!1,j.current=!0,u.current=0,E.current=n.clientX,g.current.setPointerCapture(n.pointerId),g.current.style.cursor="grabbing",N.current||(N.current=!0,m?.()))},C=n=>{if(!j.current)return;const p=n.clientX-E.current;E.current=n.clientX;const f=.3;o.current+=p*f,u.current=p*f},M=()=>{j.current=!1,g.current&&(g.current.style.cursor="grab")},z=n=>{b.current=!1,u.current=n==="left"?-8:8,N.current||(N.current=!0,m?.())};t.useEffect(()=>{let n;const p=f=>{if(L.current=f,b.current){a.current||(a.current=f);const Y=f-a.current,V=1500;if(Y<V){const q=Y/V;o.current=Math.sin(q*Math.PI)*25}else b.current=!1,o.current=0}else if(!j.current){if(Math.abs(u.current)<.5){const K=(Math.round(o.current/90)*90-o.current)*.05;u.current+=K,u.current*=.85}else{const V=S()*.95;u.current*=V}o.current+=u.current,Math.abs(u.current)<.001&&Math.abs(o.current%90)<.1&&(u.current=0,o.current=Math.round(o.current/90)*90)}let w=(o.current%360+360)%360;const F=Math.round(w/90)%4;F!==$.current&&(N.current&&!b.current&&X(),$.current=F),F!==T&&R(F),y?.(o.current),O.current&&(O.current.style.transform=`rotateY(${o.current}deg)`),n=requestAnimationFrame(p)};return n=requestAnimationFrame(p),()=>cancelAnimationFrame(n)},[S]);const P=n=>s?.[n]?e.jsx("div",{className:"w-full h-full flex items-center justify-center p-2 overflow-hidden",children:s[n]}):x?.[n]?e.jsx("img",{src:x[n],alt:r[n],className:"w-full h-full object-cover pointer-events-none"}):e.jsx("div",{className:"w-full h-full bg-slate-700"});return e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsxs("div",{ref:B,className:"relative overflow-visible mb-12",style:{width:d*2,height:d*2,perspective:"1000px"},children:[e.jsx("div",{ref:g,onPointerDown:v,onPointerMove:C,onPointerUp:M,onPointerLeave:M,onPointerCancel:M,className:"absolute cursor-grab active:cursor-grabbing touch-none z-10",style:{inset:-Z}}),e.jsxs("div",{ref:O,className:"w-full h-full relative pointer-events-none",style:{transformStyle:"preserve-3d"},children:[e.jsx("div",{className:"absolute inset-0 overflow-hidden rounded-lg pointer-events-none",style:{transform:`translateZ(${d}px)`,backfaceVisibility:"hidden",backgroundColor:s?"rgba(255,255,255,0.15)":void 0},children:P(0)}),e.jsx("div",{className:"absolute inset-0 overflow-hidden rounded-lg pointer-events-none",style:{transform:`rotateY(180deg) translateZ(${d}px)`,backfaceVisibility:"hidden",backgroundColor:s?"rgba(255,255,255,0.15)":void 0},children:P(2)}),e.jsx("div",{className:"absolute inset-0 overflow-hidden rounded-lg pointer-events-none",style:{transform:`rotateY(90deg) translateZ(${d}px)`,backfaceVisibility:"hidden",backgroundColor:s?"rgba(255,255,255,0.15)":void 0},children:P(1)}),e.jsx("div",{className:"absolute inset-0 overflow-hidden rounded-lg pointer-events-none",style:{transform:`rotateY(-90deg) translateZ(${d}px)`,backfaceVisibility:"hidden",backgroundColor:s?"rgba(255,255,255,0.15)":void 0},children:P(3)}),e.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{transform:`rotateX(90deg) translateZ(${d}px)`,backfaceVisibility:"hidden",backgroundColor:s?"rgba(255,255,255,0.08)":void 0},children:!s&&e.jsx("div",{className:"w-full h-full bg-slate-800"})}),e.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{transform:`rotateX(-90deg) translateZ(${d}px)`,backfaceVisibility:"hidden",backgroundColor:s?"rgba(255,255,255,0.08)":void 0},children:!s&&e.jsx("div",{className:"w-full h-full bg-slate-800"})})]}),e.jsx("div",{className:"absolute -bottom-8 left-1/2 -translate-x-1/2 w-3/4 h-6 bg-black/20 blur-xl rounded-full pointer-events-none"})]}),!D&&e.jsxs("div",{className:"flex items-center gap-8 relative z-20",children:[e.jsx("button",{onClick:()=>z("left"),className:"p-3 rounded-full bg-card/80 border border-border hover:bg-muted transition-colors shadow-md","data-lumi-interactive":!0,children:e.jsx(Q,{className:"w-6 h-6"})}),e.jsx("button",{onClick:()=>z("right"),className:"p-3 rounded-full bg-card/80 border border-border hover:bg-muted transition-colors shadow-md","data-lumi-interactive":!0,children:e.jsx(ee,{className:"w-6 h-6"})})]})]})},ie=({labels:l,activeIndex:m,onSelect:x})=>e.jsx("div",{className:"flex items-center justify-center gap-4 sm:gap-5",children:l.map((s,r)=>{const i=m===r;return e.jsxs("button",{onClick:()=>x(r),className:"relative flex flex-col items-center focus:outline-none group","aria-label":s,children:[e.jsx(te,{mode:"wait",children:i&&e.jsx(_.span,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.25},className:"absolute -top-5 text-[10px] sm:text-xs font-medium text-white whitespace-nowrap",children:s},`label-${r}`)}),e.jsx(_.div,{layout:!0,className:"rounded-full",animate:{width:i?28:10,height:10,backgroundColor:i?"rgba(255,255,255,1)":"rgba(255,255,255,0.3)"},transition:{type:"spring",stiffness:500,damping:30,mass:.8},style:{borderRadius:5}})]},s)})}),ce=["https://cdn.storysparkle.org/landing_assets/Mini_5%20WEBP.webp","https://cdn.storysparkle.org/landing_assets/Mini_8%20WEBP.webp","https://cdn.storysparkle.org/landing_assets/Mini_12%20WEBP.webp","https://cdn.storysparkle.org/landing_assets/Mini_15%20WEBP.webp"],H=[{r:202,g:122,b:24},{r:192,g:63,b:70},{r:163,g:173,b:101},{r:229,g:130,b:68}],h="text-amber-200 font-semibold",le=[e.jsxs("p",{className:"italic text-[13px] sm:text-sm lg:text-base leading-relaxed",children:['"Mia ',e.jsx("span",{className:h,children:"sees"})," a small dragon.",e.jsx("br",{}),"It is ",e.jsx("span",{className:h,children:"cold"}),".",e.jsx("br",{}),"She ",e.jsx("span",{className:h,children:"gives"}),' it bread."']},"early"),e.jsxs("p",{className:"italic text-[12px] sm:text-[13px] lg:text-sm leading-relaxed",children:['"Mia ',e.jsx("span",{className:h,children:"finds"})," a small dragon outside her home.",e.jsx("br",{}),"It looks ",e.jsx("span",{className:h,children:"cold"}),", so she ",e.jsx("span",{className:h,children:"gives"}),' it bread and water."']},"developing"),e.jsxs("p",{className:"italic text-[11px] sm:text-[12px] lg:text-[13px] leading-relaxed",children:['"Mia ',e.jsx("span",{className:h,children:"discovers"})," a tiny dragon at her doorstep. It looks"," ",e.jsx("span",{className:h,children:"cold and hungry"}),", so she ",e.jsx("span",{className:h,children:"brings"}),' it bread, water, and a warm blanket."']},"independent"),e.jsxs("p",{className:"italic text-[10px] sm:text-[11px] lg:text-[12px] leading-relaxed",children:['"When Mia ',e.jsx("span",{className:h,children:"discovers"})," a teeny-weeny dragon shivering at her doorstep, she gently ",e.jsx("span",{className:h,children:"offers"}),' it bread, water, and a warm blanket, waiting patiently until it feels safe enough to enter."']},"confident")],ue=l=>le.map((m,x)=>e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-white text-center px-3",children:[m,e.jsx("p",{className:"mt-2 text-[9px] sm:text-[10px] lg:text-xs text-white/60 font-medium tracking-wide",children:l[x]})]},x)),ye=()=>{const{t:l}=re("landing"),m=se(),[x,s]=t.useState(!1),[r,i]=t.useState("rgb(241, 183, 59)"),[y,D]=t.useState([1,0,0,0]),[W,k]=t.useState([1,.85,.85,.85]),[g,O]=t.useState(0),[B,X]=t.useState(void 0),I=t.useRef(null),[o,u]=t.useState(!1),j=l("checkText.levels",{returnObjects:!0}),E=l("checkText.captions",{returnObjects:!0}),L=ue(E),N=t.useCallback(a=>{const c=(a%360+360)%360,T=c/90,R=[0,3,2,1],d=Math.floor(T)%4,Z=(d+1)%4,S=R[d],A=R[Z],v=T-Math.floor(T),C=H[S],M=H[A],z=Math.round(C.r+(M.r-C.r)*v),P=Math.round(C.g+(M.g-C.g)*v),n=Math.round(C.b+(M.b-C.b)*v);i(`rgb(${z}, ${P}, ${n})`);const p=[0,0,0,0],f=[.85,.85,.85,.85];p[S]=1-v,p[A]=v,f[S]=1-v*.15,f[A]=.85+v*.15,D(p),k(f);const w=Math.round(c/90)%4;O(R[w])},[]),$=t.useCallback(a=>{X(a)},[]);t.useEffect(()=>{const a=new IntersectionObserver(([c])=>u(c.isIntersecting),{threshold:.3});return I.current&&a.observe(I.current),()=>a.disconnect()},[]);const b=t.useMemo(()=>{if(typeof window>"u")return 130;const a=window.innerWidth,c=window.innerHeight,T=a>=768&&c>a,R=a>=1024&&!(a===1024&&c>a);return T||R?130:85},[m]);return e.jsxs("section",{ref:I,className:"relative min-h-0 flex flex-col items-center justify-between py-10 lg:py-24 ipad-portrait:!min-h-screen ipad-portrait:!py-24 overflow-hidden",style:{backgroundColor:r},children:[e.jsx("div",{className:"absolute top-0 left-0 w-full z-30 pointer-events-none rotate-180",children:e.jsx(G,{topColor:"transparent",bottomColor:"#FCE7F3",variant:7})}),e.jsx("div",{className:"absolute bottom-0 left-0 w-full z-30 pointer-events-none",children:e.jsx(G,{topColor:"transparent",bottomColor:"#F0FDF4",variant:1})}),e.jsx(_.div,{initial:{y:-30,opacity:0},whileInView:{y:0,opacity:1},viewport:{once:!0},transition:{delay:.3,duration:.5},className:"text-center w-full px-6 z-10",children:e.jsx("h2",{className:"section-header text-white drop-shadow-lg whitespace-nowrap text-[22px] sm:text-[32px] lg:text-4xl ipad-portrait:!text-[22px]",children:l("checkText.heading")})}),e.jsxs("div",{className:"w-full max-w-5xl mx-auto px-6 flex flex-col lg:flex-row ipad-portrait:!flex-col items-center justify-center gap-4 lg:gap-12 z-10 mt-4 lg:mt-2",children:[e.jsxs(_.div,{initial:{y:-500,opacity:0},animate:o?{y:0,opacity:1}:{y:-500,opacity:0},transition:{type:"spring",stiffness:200,damping:20,delay:.3},onAnimationComplete:()=>{o&&s(!0)},className:"flex flex-col items-center lg:w-[55%] ipad-portrait:!w-full",children:[e.jsx(oe,{onInteraction:()=>{},textFaces:L,labels:j,isActive:x,onRotationChange:N,targetFace:B,hideArrows:!0,size:b}),e.jsx(ie,{labels:j,activeIndex:g,onSelect:$})]}),e.jsx("div",{className:"relative w-40 h-40 sm:w-64 sm:h-64 lg:w-[50%] lg:h-96",children:ce.map((a,c)=>e.jsx("img",{src:a,alt:`${j[c]}`,className:"absolute inset-0 w-full h-full object-contain transition-all duration-300 ease-out rounded-2xl",style:{opacity:y[c],transform:`scale(${W[c]})`}},c))})]}),e.jsxs(_.div,{initial:{y:30,opacity:0},whileInView:{y:0,opacity:1},viewport:{once:!0},transition:{delay:.5,duration:.5},className:"text-center max-w-lg px-6 z-10 flex flex-col items-center gap-4 mt-4 lg:mt-0",children:[e.jsx("h3",{className:"section-subtext text-white/90 drop-shadow-md text-sm sm:text-base",children:l("checkText.subtext")}),e.jsx(ne,{})]})]})};export{ye as default};
//# sourceMappingURL=CheckTextSection-BNaVBfLZ.js.map