react-instagram-stories 0.0.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,18 @@
1
+ 'use strict';var T=require('react'),reactRouterDom=require('react-router-dom'),jsxRuntime=require('react/jsx-runtime'),reactDom=require('react-dom');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var T__default=/*#__PURE__*/_interopDefault(T);var ie=T.memo(({avatarUrl:e,username:r,hasUnreadStories:o=false,onClick:n})=>{let[l,i]=T.useState(false),[a,c]=T.useState(false);return jsxRuntime.jsxs("button",{className:`story-avatar ${o?"story-avatar-unread":"story-avatar-read"}`,onClick:n,"aria-label":`View ${r}'s story`,children:[jsxRuntime.jsx("div",{className:"story-avatar-ring",children:jsxRuntime.jsx("div",{className:"story-avatar-image-wrapper",children:a?jsxRuntime.jsx("div",{className:"story-avatar-placeholder",children:r.charAt(0).toUpperCase()}):jsxRuntime.jsx("img",{src:e,alt:r,className:`story-avatar-image ${l?"story-avatar-image-loaded":""}`,loading:"lazy",onLoad:()=>i(true),onError:()=>c(true)})})}),jsxRuntime.jsx("span",{className:"story-avatar-username",children:r})]})});ie.displayName="Avatar";var J=90,we=3,le=T.memo(({users:e,onAvatarClick:r})=>{let o=T.useRef(null),[n,l]=T.useState(0),[i,a]=T.useState(0),c=T.useCallback(()=>{o.current&&l(o.current.scrollLeft);},[]);T.useEffect(()=>{let u=()=>{o.current&&a(o.current.clientWidth);};return u(),window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u);}},[]);let{startIndex:t,endIndex:m}=T__default.default.useMemo(()=>{let u=Math.floor(n/J),g=Math.ceil(i/J);return {startIndex:Math.max(0,u-we),endIndex:Math.min(e.length,u+g+we)}},[n,i,e.length]),d=e.length*J,s=e.slice(t,m).map((u,g)=>({user:u,index:t+g}));return jsxRuntime.jsx("div",{ref:o,className:"story-avatar-list",onScroll:c,role:"list","aria-label":"Stories",children:jsxRuntime.jsx("div",{className:"story-avatar-list-inner",style:{width:`${d}px`,position:"relative"},children:s.map(({user:u,index:g})=>jsxRuntime.jsx("div",{className:"story-avatar-item",style:{position:"absolute",left:`${g*J}px`,width:`${J}px`},role:"listitem",children:jsxRuntime.jsx(ie,{avatarUrl:u.avatarUrl,username:u.username,hasUnreadStories:u.hasUnreadStories,onClick:()=>r(g)})},u.id))})})});le.displayName="AvatarList";var Ce=({duration:e,onComplete:r,autoStart:o=true})=>{let[n,l]=T.useState(0),[i,a]=T.useState(!o),[c,t]=T.useState(e),m=T.useRef(null),d=T.useRef(0),s=T.useRef(null),u=T.useRef(),g=T.useCallback(()=>{if(!m.current||i)return;let X=Date.now()-m.current+d.current,C=Math.min(X/c,1);if(l(C),C>=1){r?.();return}s.current=requestAnimationFrame(u.current);},[c,i,r]);u.current=g;let y=T.useCallback(()=>{i||(m.current&&(d.current+=Date.now()-m.current),a(true),s.current&&(cancelAnimationFrame(s.current),s.current=null));},[i]),h=T.useCallback(()=>{i&&(m.current=Date.now(),a(false));},[i]),I=T.useCallback(()=>{s.current&&(cancelAnimationFrame(s.current),s.current=null),m.current=Date.now(),d.current=0,l(0),a(false),s.current=requestAnimationFrame(u.current);},[]),L=T.useCallback(X=>{t(X);},[]);return T.useEffect(()=>(i||(m.current=Date.now(),s.current=requestAnimationFrame(u.current)),()=>{s.current&&cancelAnimationFrame(s.current);}),[i]),T.useEffect(()=>()=>{s.current&&cancelAnimationFrame(s.current);},[]),{progress:n,isPaused:i,pause:y,resume:h,reset:I,setDuration:L}};var Ee=({onLeft:e,onRight:r,onSpace:o,onEscape:n,enabled:l=true})=>{T.useEffect(()=>{if(!l)return;let i=a=>{switch(a.key){case "ArrowLeft":a.preventDefault(),e?.();break;case "ArrowRight":a.preventDefault(),r?.();break;case " ":a.preventDefault(),o?.();break;case "Escape":a.preventDefault(),n?.();break}};return window.addEventListener("keydown",i),()=>{window.removeEventListener("keydown",i);}},[e,r,o,n,l]);};var Pe=e=>{let r=T.useRef(null),o=T.useRef(null);return T.useEffect(()=>{if(!e||!r.current)return;o.current=document.activeElement;let n=r.current,l=n.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),i=l[0],a=l[l.length-1];i?.focus();let c=t=>{t.key==="Tab"&&(t.shiftKey?document.activeElement===i&&(t.preventDefault(),a?.focus()):document.activeElement===a&&(t.preventDefault(),i?.focus()));};return n.addEventListener("keydown",c),()=>{n.removeEventListener("keydown",c),o.current?.focus();}},[e]),r};var Te=()=>{let[e,r]=T.useState(!document.hidden);return T.useEffect(()=>{let o=()=>{r(!document.hidden);};return document.addEventListener("visibilitychange",o),()=>{document.removeEventListener("visibilitychange",o);}},[]),e};var Re=()=>{let e=T.useRef({}),r=T.useRef(new Set),o=T.useCallback(t=>new Promise((m,d)=>{if(e.current[t]){m();return}if(r.current.has(t)){let u=setInterval(()=>{(e.current[t]||!r.current.has(t))&&(clearInterval(u),m());},100);return}r.current.add(t);let s=new Image;s.onload=()=>{e.current[t]=true,r.current.delete(t),m();},s.onerror=()=>{r.current.delete(t),d(new Error(`Failed to load image: ${t}`));},s.src=t;}),[]),n=T.useCallback(t=>new Promise((m,d)=>{if(e.current[t]){m();return}if(r.current.has(t)){let h=setInterval(()=>{(e.current[t]||!r.current.has(t))&&(clearInterval(h),m());},100);return}r.current.add(t);let s=document.createElement("video");s.preload="auto";let u=()=>{e.current[t]=true,r.current.delete(t),y(),m();},g=()=>{r.current.delete(t),y(),d(new Error(`Failed to load video: ${t}`));},y=()=>{s.removeEventListener("canplaythrough",u),s.removeEventListener("error",g),s.src="";};s.addEventListener("canplaythrough",u),s.addEventListener("error",g),s.src=t,s.load();}),[]),l=T.useCallback(async t=>{try{t.type==="image"&&"src"in t?await o(t.src):t.type==="video"&&"src"in t&&await n(t.src);}catch(m){console.warn("Failed to preload story item:",m);}},[o,n]),i=T.useCallback(async t=>{let d=[];for(let s=0;s<t.length;s+=3)d.push(t.slice(s,s+3));for(let s of d)await Promise.allSettled(s.map(l));},[l]),a=T.useCallback(t=>e.current[t]||false,[]),c=T.useCallback(()=>{e.current={},r.current.clear();},[]);return T.useEffect(()=>()=>{c();},[c]),{preloadImage:o,preloadVideo:n,preloadStoryItem:l,preloadMultiple:i,isPreloaded:a,clearCache:c}};var de=T.memo(({progress:e,isActive:r})=>{let o=Math.round(e*100);return jsxRuntime.jsx("div",{className:"story-progress-bar",role:"progressbar","aria-valuenow":r?o:e===1?100:0,"aria-valuemin":0,"aria-valuemax":100,"aria-label":`Story progress: ${o}%`,children:jsxRuntime.jsx("div",{className:"story-progress-bar-fill",style:{transform:`scaleX(${r?e:e===1?1:0})`}})})});de.displayName="ProgressBar";var ue=T.memo(({total:e,currentIndex:r,progress:o})=>jsxRuntime.jsx("div",{className:"story-progress-bars-container",children:Array.from({length:e}).map((n,l)=>jsxRuntime.jsx(de,{progress:l<r?1:l===r?o:0,isActive:l===r},l))}));ue.displayName="StoryProgressBars";var pe=T.memo(({item:e,isActive:r,isPaused:o,onDurationDetected:n,onLoadError:l,onBufferingChange:i,controls:a})=>{let c=T.useRef(null),[t,m]=T.useState(false),[d,s]=T.useState(true);T.useEffect(()=>{if(e.type!=="video"||!c.current||!r)return;let y=c.current;(async()=>{try{o?y.pause():await y.play();}catch(I){console.warn("Video play failed:",I);}})();},[e.type,r,o]),T.useEffect(()=>{if(e.type!=="video"||!c.current)return;let y=c.current,h=()=>{y.duration&&isFinite(y.duration)&&n?.(y.duration*1e3);},I=()=>{s(false);};return y.addEventListener("loadedmetadata",h),y.addEventListener("canplay",I),y.readyState>=1&&h(),y.readyState>=3&&I(),()=>{y.removeEventListener("loadedmetadata",h),y.removeEventListener("canplay",I);}},[e.type,n]),T.useEffect(()=>{if(e.type!=="video"||!c.current||!r)return;let y=c.current,h=()=>{i?.(true);},I=()=>{i?.(false);},L=()=>{i?.(true);};return y.addEventListener("waiting",h),y.addEventListener("playing",I),y.addEventListener("stalled",L),()=>{y.removeEventListener("waiting",h),y.removeEventListener("playing",I),y.removeEventListener("stalled",L);}},[e.type,r,i]),T.useEffect(()=>{if(e.type!=="video"||!c.current||!r)return;let y=c.current,h,I=()=>{y.duration&&isFinite(y.duration),h=requestAnimationFrame(I);};return h=requestAnimationFrame(I),()=>{cancelAnimationFrame(h);}},[e.type,r]);let u=T.useCallback(()=>{m(true),s(false),l?.();},[l]),g=T.useCallback(()=>{s(false);},[]);if(t)return jsxRuntime.jsx("div",{className:"story-item story-item-error",children:jsxRuntime.jsx("div",{className:"story-item-error-message",children:"Failed to load content"})});switch(e.type){case "image":return jsxRuntime.jsxs("div",{className:"story-item story-item-image",children:[d&&jsxRuntime.jsx("div",{className:"story-item-loader",children:jsxRuntime.jsx("div",{className:"story-item-spinner"})}),jsxRuntime.jsx("img",{src:e.src,alt:e.alt||"Story image",onError:u,onLoad:g,draggable:false,style:{opacity:d?0:1}})]});case "video":return jsxRuntime.jsxs("div",{className:"story-item story-item-video",children:[d&&jsxRuntime.jsx("div",{className:"story-item-loader",children:jsxRuntime.jsx("div",{className:"story-item-spinner"})}),jsxRuntime.jsx("video",{ref:c,src:e.src,playsInline:true,loop:false,onError:u,preload:"auto",style:{opacity:d?0:1}})]});case "text":return jsxRuntime.jsx("div",{className:"story-item story-item-text",style:{backgroundColor:e.backgroundColor||"#000",color:e.textColor||"#fff"},children:jsxRuntime.jsx("div",{className:"story-item-text-content",children:e.text})});case "custom_component":let y=e.component;return jsxRuntime.jsx("div",{className:"story-item story-item-component",children:jsxRuntime.jsx(y,{...a})});default:return null}});pe.displayName="StoryItem";var B=5e3,ht=60,Ae=T__default.default.memo(({users:e,initialUserIndex:r,initialStoryIndex:o,isOpen:n,onClose:l,onStoryChange:i})=>{let[a,c]=T.useState(r),[t,m]=T.useState(o??0),[d,s]=T.useState(false);T.useEffect(()=>{c(r);},[r]),T.useEffect(()=>{m(o??0);},[o]);let[u,g]=T.useState(false),[y,h]=T.useState(null),[I,L]=T.useState(false),[X,C]=T.useState(false),ye=T.useRef(null),ge=T.useRef(null),he=T.useRef(0),ve=T.useRef(B),re=T.useRef(false),S=e[a],U=S?.stories[t],V=S?.stories.length||0;T.useEffect(()=>{ve.current=U?.duration||B;},[U?.duration]);let Oe=Pe(n),oe=Te(),{preloadStoryItem:ne}=Re(),N=T.useCallback(()=>s(true),[]),D=T.useCallback(()=>s(false),[]),be=T.useRef(),v=Ce({duration:ve.current||B,onComplete:()=>be.current?.(),autoStart:false}),Xe=T.useCallback(p=>{p?v.pause():d||v.resume();},[v,d]);T.useEffect(()=>{let p=U?.duration||B;v.setDuration(p);},[v,U?.duration]);let k=T.useCallback(()=>{if(S)if(t<V-1){let p=t+1,w=S.stories[p]?.duration||B;m(p),v.setDuration(w),v.reset();}else a<e.length-1?(C(true),setTimeout(()=>{g(true),h("left"),setTimeout(()=>{let p=a+1,z=e[p].stories[0]?.duration||B;c(p),m(0),g(false),h(null),C(false),v.setDuration(z),v.reset();},150);},1e3)):l();},[S,t,V,a,e,v,l]),Y=T.useCallback(()=>{if(S)if(t>0){let p=t-1,w=S.stories[p]?.duration||B;m(p),v.setDuration(w),v.reset();}else a>0&&(C(true),setTimeout(()=>{g(true),h("right"),setTimeout(()=>{let p=a-1,x=e[p],w=x.stories.length-1,ae=x.stories[w]?.duration||B;c(p),m(w),g(false),h(null),C(false),v.setDuration(ae),v.reset();},150);},1e3));},[S,t,a,e,v]),K=T.useCallback(()=>{window.scrollTo(0,he.current),l();},[l]);T.useEffect(()=>{be.current=k;},[k]);let Ye=T.useMemo(()=>({pause:N,resume:D,next:k,prev:Y,setDuration:p=>ge.current?.setDuration(p)}),[N,D,k,Y]),se=T.useCallback(p=>{let x=p.target;if(x.closest(".story-viewer-close")||x.closest("button")||x.closest("input")||x.closest("select")||x.closest("textarea"))return;let w=ye.current;if(!w)return;let z=w.getBoundingClientRect();p.clientX-z.left<z.width/2?Y():k();},[Y,k]),M=T.useRef(null),q=T.useRef(false),Ke=T.useCallback(p=>{q.current=false,M.current={x:p.clientX,y:p.clientY},N();},[N]),qe=T.useCallback(p=>{if(!M.current)return;let x=p.clientX-M.current.x,w=p.clientY-M.current.y;(Math.abs(x)>10||Math.abs(w)>10)&&(q.current=true);},[]),je=T.useCallback(p=>{if(!M.current)return;let x=p.clientX-M.current.x,w=p.clientY-M.current.y,z=Math.abs(x)>ht;if(Math.abs(w)>80&&w>0)K();else if(z)x>0&&a>0?(C(true),setTimeout(()=>{g(true),h("right"),setTimeout(()=>{c(W=>W-1),m(e[a-1].stories.length-1),g(false),h(null),C(false),v.reset();},150);},1e3)):x<0&&a<e.length-1&&(C(true),setTimeout(()=>{g(true),h("left"),setTimeout(()=>{c(W=>W+1),m(0),g(false),h(null),C(false),v.reset();},150);},1e3));else if(!q.current){let W={...p,target:p.target,currentTarget:p.currentTarget,clientX:p.clientX,clientY:p.clientY};se(W);}M.current=null,q.current=false,D();},[a,e.length,K,v,D,se]);Ee({onLeft:Y,onRight:k,onSpace:()=>d?D():N(),onEscape:K,enabled:n}),T.useEffect(()=>{oe?oe&&!d&&D():N();},[oe,N,D,d]),T.useEffect(()=>{if(!n||!S)return;let p=[];t<V-1&&p.push(S.stories[t+1]),t>0&&p.push(S.stories[t-1]),a<e.length-1&&p.push(e[a+1].stories[0]),a>0&&p.push(e[a-1].stories[0]);let x=p.slice(0,3).map(w=>ne(w).catch(()=>{}));Promise.all(x);},[n,S,a,t,V,e,ne]),T.useEffect(()=>(n&&!re.current?(re.current=true,L(true),U&&ne(U),setTimeout(()=>{L(false),he.current=window.scrollY,document.body.style.overflow="hidden",v.resume();},1500)):n||(re.current=false,document.body.style.overflow="",L(false),C(false)),()=>{document.body.style.overflow="";}),[n,v]),T.useEffect(()=>{i&&n&&i(a,t);},[a,t,i,n]);let Je=T.useCallback(()=>{console.warn("Story item failed to load, skipping..."),setTimeout(k,500);},[k]);if(!n||!S||!U)return null;let Qe=jsxRuntime.jsxs("div",{ref:ye,className:"story-viewer",role:"dialog","aria-modal":"true","aria-label":`Stories by ${S?.username||"user"}`,"aria-describedby":"story-viewer-description",children:[jsxRuntime.jsx("div",{className:"story-viewer-overlay",onClick:K}),jsxRuntime.jsx("div",{id:"story-viewer-description",className:"sr-only",children:"Instagram-style stories viewer. Tap left side to go to previous story, right side to go to next story. Swipe left or right to navigate between users. Press Escape to close."}),jsxRuntime.jsxs("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:["Viewing story ",t+1," of ",V," by"," ",S?.username]}),jsxRuntime.jsxs("div",{ref:Oe,className:`story-viewer-content ${u?`story-viewer-transitioning story-viewer-transition-${y}`:""}`,onClick:se,onPointerDown:Ke,onPointerMove:qe,onPointerUp:je,onMouseEnter:N,onMouseLeave:D,children:[jsxRuntime.jsxs("div",{className:"story-viewer-header",children:[jsxRuntime.jsx(ue,{total:V,currentIndex:t,progress:v.progress}),jsxRuntime.jsxs("div",{className:"story-viewer-user-info",children:[jsxRuntime.jsx("img",{src:S.avatarUrl,alt:`${S.username} avatar`,className:"story-viewer-avatar"}),jsxRuntime.jsx("span",{className:"story-viewer-username",children:S.username})]}),jsxRuntime.jsx("button",{className:"story-viewer-close",onClick:K,"aria-label":"Close story viewer",type:"button",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"story-viewer-items",children:I||X?jsxRuntime.jsx("div",{className:"story-item-loader",children:jsxRuntime.jsx("div",{className:"story-item-spinner"})}):jsxRuntime.jsx(pe,{item:U,isActive:true,isPaused:d||q.current,onDurationDetected:p=>ge.current?.setDuration(p),onLoadError:Je,onBufferingChange:Xe,controls:Ye})}),jsxRuntime.jsxs("div",{className:"story-viewer-nav-hints",children:[jsxRuntime.jsx("div",{className:"story-viewer-nav-hint story-viewer-nav-hint-left"}),jsxRuntime.jsx("div",{className:"story-viewer-nav-hint story-viewer-nav-hint-right"})]})]})]});return reactDom.createPortal(Qe,document.body)});function Be(e,r){for(let o=0;o<e.length;o++){let l=e[o].stories.findIndex(i=>i.id===r);if(l!==-1)return {userIndex:o,storyIndex:l}}return null}var $e=({users:e,closeNavigateTo:r="/"})=>{let{storyId:o}=reactRouterDom.useParams(),n=reactRouterDom.useNavigate(),[l,i]=T.useState({isOpen:false,userIndex:0,storyIndex:0}),a=T.useRef(0);T.useEffect(()=>{if(o){let d=Be(e,o);d&&i({isOpen:true,userIndex:d.userIndex,storyIndex:d.storyIndex});}},[o,e]);let c=T.useCallback(d=>{a.current=window.scrollY,i({isOpen:true,userIndex:d,storyIndex:0});let s=e[d];if(s&&s.stories.length>0){let u=s.stories[0].id;n(`/story/${u}`,{replace:true});}},[e,n]),t=T.useCallback(()=>{i({isOpen:false,userIndex:0,storyIndex:0}),requestAnimationFrame(()=>{window.scrollTo(0,a.current);}),n(r,{replace:true});},[n,r]),m=T.useCallback((d,s)=>{let u=e[d];if(u&&u.stories[s]){let g=u.stories[s].id;n(`/story/${g}`,{replace:true});}},[e,n]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(le,{users:e,onAvatarClick:c}),jsxRuntime.jsx(Ae,{users:e,initialUserIndex:l.userIndex,initialStoryIndex:l.storyIndex,isOpen:l.isOpen,onClose:t,onStoryChange:m})]})};var We=({pause:e,resume:r,next:o})=>{let[n,l]=T__default.default.useState(null),[i,a]=T__default.default.useState([42,28,18,12]);T__default.default.useEffect(()=>(e(),()=>r()),[e,r]);let c=d=>{l(d);let s=[...i];s[d]+=1,a(s),setTimeout(()=>{r(),o();},2e3);},t=i.reduce((d,s)=>d+s,0);return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:"20px",width:"100%",background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)"},children:[jsxRuntime.jsx("h2",{style:{color:"white",marginBottom:"10px",fontSize:"28px",fontWeight:"bold"},children:"Poll"}),jsxRuntime.jsx("p",{style:{color:"rgba(255,255,255,0.9)",marginBottom:"30px",fontSize:"18px"},children:"What's your favorite framework?"}),jsxRuntime.jsx("div",{style:{width:"100%"},children:["React","Vue","Angular","Svelte"].map((d,s)=>{let u=Math.round(i[s]/t*100),g=n===s;return jsxRuntime.jsxs("button",{onClick:()=>n===null&&c(s),disabled:n!==null,style:{width:"100%",padding:"16px 20px",margin:"8px 0",border:"none",borderRadius:"12px",background:n!==null?`linear-gradient(90deg, rgba(255,255,255,0.4) ${u}%, rgba(255,255,255,0.15) ${u}%)`:"rgba(255,255,255,0.2)",color:"white",fontSize:"16px",fontWeight:"600",cursor:n===null?"pointer":"default",transition:"all 0.3s ease",display:"flex",justifyContent:"space-between",alignItems:"center",backdropFilter:"blur(10px)"},children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[g&&"\u2713 ",d]}),n!==null&&jsxRuntime.jsxs("span",{children:[u,"%"]})]},s)})}),n!==null&&jsxRuntime.jsxs("p",{style:{color:"rgba(255,255,255,0.8)",marginTop:"20px",fontSize:"14px"},children:[t," votes \u2022 Thanks for voting!"]})]})},He=({pause:e,resume:r,next:o})=>{let[n,l]=T__default.default.useState(false),[i,a]=T__default.default.useState(null),c=2;T__default.default.useEffect(()=>(e(),()=>r()),[e,r]);let t=d=>{a(d),l(true),setTimeout(()=>{r(),o();},2500);};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:"20px",width:"100%",background:"linear-gradient(135deg, #f093fb 0%, #f5576c 100%)"},children:[jsxRuntime.jsx("div",{style:{fontSize:"48px",marginBottom:"20px",animation:"bounce 1s infinite"},children:"\u{1FA90}"}),jsxRuntime.jsx("h2",{style:{color:"white",marginBottom:"10px",fontSize:"24px",fontWeight:"bold",textAlign:"center"},children:"Quiz Time!"}),jsxRuntime.jsx("p",{style:{color:"rgba(255,255,255,0.9)",marginBottom:"30px",fontSize:"18px",textAlign:"center"},children:"Which is the largest planet in our solar system?"}),jsxRuntime.jsx("div",{style:{width:"100%"},children:["Mars","Venus","Jupiter","Saturn"].map((d,s)=>{let u=s===c,g=i===s,y="rgba(255,255,255,0.2)";return n&&(u?y="rgba(34, 197, 94, 0.6)":g&&(y="rgba(239, 68, 68, 0.6)")),jsxRuntime.jsxs("button",{onClick:()=>!n&&t(s),disabled:n,style:{width:"100%",padding:"16px 20px",margin:"8px 0",border:"none",borderRadius:"12px",background:y,color:"white",fontSize:"16px",fontWeight:"600",cursor:n?"default":"pointer",transition:"all 0.3s ease",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsxRuntime.jsx("span",{children:d}),n&&u&&jsxRuntime.jsx("span",{children:"\u2713"}),n&&g&&!u&&jsxRuntime.jsx("span",{children:"\u2717"})]},s)})}),n&&jsxRuntime.jsx("p",{style:{color:"white",marginTop:"20px",fontSize:"16px",fontWeight:"bold"},children:i===c?"\u{1F389} Correct!":"\u274C Wrong! Jupiter is the largest."})]})},Et=()=>{let[e,r]=T__default.default.useState({days:12,hours:8,minutes:45,seconds:30});T__default.default.useEffect(()=>{let n=setInterval(()=>{r(l=>{let{days:i,hours:a,minutes:c,seconds:t}=l;return t--,t<0&&(t=59,c--),c<0&&(c=59,a--),a<0&&(a=23,i--),{days:i,hours:a,minutes:c,seconds:t}});},1e3);return ()=>clearInterval(n)},[]);let o=({value:n,label:l})=>jsxRuntime.jsxs("div",{style:{textAlign:"center"},children:[jsxRuntime.jsx("div",{style:{background:"rgba(255,255,255,0.2)",backdropFilter:"blur(10px)",borderRadius:"12px",padding:"15px 20px",minWidth:"70px"},children:jsxRuntime.jsx("div",{style:{fontSize:"32px",fontWeight:"bold",color:"white"},children:String(n).padStart(2,"0")})}),jsxRuntime.jsx("div",{style:{color:"rgba(255,255,255,0.8)",fontSize:"12px",marginTop:"8px",textTransform:"uppercase"},children:l})]});return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:"20px",width:"100%",background:"linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%)"},children:[jsxRuntime.jsx("div",{style:{fontSize:"48px",marginBottom:"15px"},children:"\u{1F680}"}),jsxRuntime.jsx("h2",{style:{color:"white",marginBottom:"8px",fontSize:"24px",fontWeight:"bold"},children:"Product Launch"}),jsxRuntime.jsx("p",{style:{color:"rgba(255,255,255,0.7)",marginBottom:"30px",fontSize:"14px"},children:"Something amazing is coming..."}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"12px",marginBottom:"30px"},children:[jsxRuntime.jsx(o,{value:e.days,label:"Days"}),jsxRuntime.jsx(o,{value:e.hours,label:"Hours"}),jsxRuntime.jsx(o,{value:e.minutes,label:"Mins"}),jsxRuntime.jsx(o,{value:e.seconds,label:"Secs"})]}),jsxRuntime.jsx("button",{style:{padding:"14px 40px",background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",border:"none",borderRadius:"30px",color:"white",fontSize:"16px",fontWeight:"bold",cursor:"pointer"},children:"Notify Me"})]})},Ft=()=>jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"linear-gradient(180deg, #1a1a2e 0%, #16213e 100%)",position:"relative",overflow:"hidden"},children:[jsxRuntime.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:"20px"},children:jsxRuntime.jsx("img",{src:"https://images.unsplash.com/photo-1523275335684-37898b6baf30?w=400&h=400&fit=crop",alt:"Product",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"20px",boxShadow:"0 20px 60px rgba(0,0,0,0.5)"}})}),jsxRuntime.jsxs("div",{style:{padding:"30px",background:"linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.8) 100%)"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"10px"},children:[jsxRuntime.jsx("span",{style:{background:"#ef4444",color:"white",padding:"4px 10px",borderRadius:"20px",fontSize:"12px",fontWeight:"bold"},children:"NEW"}),jsxRuntime.jsx("span",{style:{color:"rgba(255,255,255,0.6)",fontSize:"12px"},children:"Limited Edition"})]}),jsxRuntime.jsx("h2",{style:{color:"white",fontSize:"24px",fontWeight:"bold",marginBottom:"8px"},children:"Premium Watch Collection"}),jsxRuntime.jsx("p",{style:{color:"rgba(255,255,255,0.7)",fontSize:"14px",marginBottom:"15px"},children:"Elegant design meets modern technology"}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"15px"},children:[jsxRuntime.jsx("span",{style:{color:"white",fontSize:"28px",fontWeight:"bold"},children:"$299"}),jsxRuntime.jsx("span",{style:{color:"rgba(255,255,255,0.5)",fontSize:"18px",textDecoration:"line-through"},children:"$399"})]}),jsxRuntime.jsx("button",{style:{width:"100%",marginTop:"20px",padding:"16px",background:"white",border:"none",borderRadius:"12px",color:"#1a1a2e",fontSize:"16px",fontWeight:"bold",cursor:"pointer"},children:"Shop Now \u2192"})]})]}),_e=({pause:e,resume:r,next:o})=>{let[n,l]=T__default.default.useState(5),[i,a]=T__default.default.useState(false);T__default.default.useEffect(()=>(e(),()=>r()),[e,r]);let c=()=>{a(true),setTimeout(()=>{r(),o();},1500);};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:"20px",width:"100%",background:"linear-gradient(135deg, #11998e 0%, #38ef7d 100%)"},children:[jsxRuntime.jsx("div",{style:{fontSize:"80px",marginBottom:"20px",transition:"all 0.3s"},children:["\u{1F622}","\u{1F615}","\u{1F610}","\u{1F642}","\u{1F60A}","\u{1F603}","\u{1F604}","\u{1F601}","\u{1F929}","\u{1F973}"][n-1]}),jsxRuntime.jsx("h2",{style:{color:"white",marginBottom:"10px",fontSize:"24px",fontWeight:"bold"},children:"Rate Your Experience"}),jsxRuntime.jsx("p",{style:{color:"rgba(255,255,255,0.9)",marginBottom:"30px",fontSize:"16px"},children:"How was your visit today?"}),i?jsxRuntime.jsxs("div",{style:{textAlign:"center"},children:[jsxRuntime.jsx("div",{style:{fontSize:"48px",marginBottom:"10px"},children:"\u{1F389}"}),jsxRuntime.jsx("p",{style:{color:"white",fontSize:"18px",fontWeight:"bold"},children:"Thanks for your feedback!"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{style:{width:"100%",marginBottom:"20px"},children:[jsxRuntime.jsx("input",{type:"range",min:"1",max:"10",value:n,onChange:m=>l(parseInt(m.target.value)),style:{width:"100%",height:"8px",borderRadius:"4px",appearance:"none",background:"rgba(255,255,255,0.3)",cursor:"pointer"}}),jsxRuntime.jsxs("div",{style:{display:"flex",justifyContent:"space-between",color:"rgba(255,255,255,0.7)",fontSize:"12px",marginTop:"8px"},children:[jsxRuntime.jsx("span",{children:"1"}),jsxRuntime.jsx("span",{children:"10"})]})]}),jsxRuntime.jsxs("button",{onClick:c,style:{padding:"14px 50px",background:"white",border:"none",borderRadius:"30px",color:"#11998e",fontSize:"16px",fontWeight:"bold",cursor:"pointer"},children:["Submit (",n,"/10)"]})]})]})},G=["https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4","https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerEscapes.mp4","https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4"],Ve=["https://images.unsplash.com/photo-1682687220742-aba13b6e50ba?w=1080&h=1920&fit=crop","https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=1080&h=1920&fit=crop","https://images.unsplash.com/photo-1469474968028-56623f02e42e?w=1080&h=1920&fit=crop","https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=1080&h=1920&fit=crop","https://images.unsplash.com/photo-1472214103451-9374bd1c798e?w=1080&h=1920&fit=crop","https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=1080&h=1920&fit=crop","https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=1080&h=1920&fit=crop","https://images.unsplash.com/photo-1517841905240-472988babdf9?w=1080&h=1920&fit=crop"],O=["https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=150&h=150&fit=crop","https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=150&h=150&fit=crop","https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=150&h=150&fit=crop","https://images.unsplash.com/photo-1517841905240-472988babdf9?w=150&h=150&fit=crop","https://images.unsplash.com/photo-1539571696357-5a69c17a67c6?w=150&h=150&fit=crop","https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=150&h=150&fit=crop"],fe=[{id:"user-travel",username:"Travel",avatarUrl:O[0],hasUnreadStories:true,stories:[{id:"travel-1",type:"image",src:"https://images.unsplash.com/photo-1682687220742-aba13b6e50ba?w=1080&h=1920&fit=crop",duration:5e3,alt:"Beautiful mountain landscape"},{id:"travel-2",type:"image",src:"https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=1080&h=1920&fit=crop",duration:5e3,alt:"Scenic ocean view"},{id:"travel-3",type:"text",text:`Adventure awaits! \u{1F30D}
2
+
3
+ Swipe to explore more destinations \u2192`,backgroundColor:"#FF6B6B",textColor:"#FFFFFF",duration:4e3},{id:"travel-4",type:"video",src:G[0],duration:15e3}]},{id:"user-polls",username:"Interactive",avatarUrl:O[1],hasUnreadStories:true,stories:[{id:"poll-intro",type:"text",text:`Let's have some fun! \u{1F3AE}
4
+
5
+ Interactive stories ahead \u2192`,backgroundColor:"#667eea",textColor:"#FFFFFF",duration:3e3},{id:"poll-1",type:"custom_component",component:We,duration:3e4},{id:"quiz-1",type:"custom_component",component:He,duration:3e4},{id:"slider-1",type:"custom_component",component:_e,duration:3e4}]},{id:"user-product",username:"Shop",avatarUrl:O[2],hasUnreadStories:true,stories:[{id:"product-1",type:"custom_component",component:Ft,duration:8e3},{id:"product-2",type:"image",src:"https://images.unsplash.com/photo-1523275335684-37898b6baf30?w=1080&h=1920&fit=crop",duration:5e3,alt:"Product showcase"},{id:"product-3",type:"text",text:`Limited Time Offer! \u{1F525}
6
+
7
+ 50% OFF
8
+
9
+ Use code: STORY50`,backgroundColor:"#000000",textColor:"#FFFFFF",duration:5e3}]},{id:"user-launch",username:"Events",avatarUrl:O[3],hasUnreadStories:true,stories:[{id:"launch-1",type:"custom_component",component:Et,duration:1e4},{id:"launch-2",type:"text",text:`Mark your calendars! \u{1F4C5}
10
+
11
+ Big announcement coming soon...`,backgroundColor:"#302b63",textColor:"#FFFFFF",duration:4e3},{id:"launch-3",type:"image",src:"https://images.unsplash.com/photo-1492684223066-81342ee5ff30?w=1080&h=1920&fit=crop",duration:5e3,alt:"Event teaser"}]},{id:"user-video",username:"Videos",avatarUrl:O[4],hasUnreadStories:true,stories:[{id:"video-1",type:"video",src:G[1],duration:15e3},{id:"video-2",type:"video",src:G[2],duration:15e3},{id:"video-3",type:"text",text:`More videos coming soon! \u{1F3AC}
12
+
13
+ Stay tuned \u2192`,backgroundColor:"#4ECDC4",textColor:"#FFFFFF",duration:3e3}]},{id:"user-lifestyle",username:"Lifestyle",avatarUrl:O[5],hasUnreadStories:false,stories:[{id:"lifestyle-1",type:"image",src:"https://images.unsplash.com/photo-1469474968028-56623f02e42e?w=1080&h=1920&fit=crop",duration:5e3,alt:"Nature scene"},{id:"lifestyle-2",type:"image",src:"https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=1080&h=1920&fit=crop",duration:5e3,alt:"Peaceful landscape"},{id:"lifestyle-3",type:"text",text:`Find your peace \u{1F9D8}
14
+
15
+ Nature heals everything`,backgroundColor:"#45B7D1",textColor:"#FFFFFF",duration:4e3}]}],Pt=(e=50)=>{let r=[...fe];for(let o=fe.length;o<e;o++){let n=Math.random()>.3,l=Math.floor(Math.random()*5)+2;r.push({id:`user-${o}`,username:`User ${o}`,avatarUrl:`https://i.pravatar.cc/150?img=${o%70}`,hasUnreadStories:n,stories:Array.from({length:l},(i,a)=>{let c=Math.random();if(c<.5)return {id:`story-${o}-${a}`,type:"image",src:Ve[Math.floor(Math.random()*Ve.length)],duration:5e3,alt:`Story from User ${o}`};if(c<.7)return {id:`story-${o}-${a}`,type:"video",src:G[Math.floor(Math.random()*G.length)],duration:15e3};if(c<.9){let m=["#FF6B6B","#4ECDC4","#45B7D1","#FFA07A","#98D8C8","#667eea","#764ba2"];return {id:`story-${o}-${a}`,type:"text",text:`Hello from User ${o}! \u{1F44B}
16
+
17
+ This is story ${a+1}`,backgroundColor:m[Math.floor(Math.random()*m.length)],textColor:"#FFFFFF",duration:4e3}}let t=[We,He,_e];return {id:`story-${o}-${a}`,type:"custom_component",component:t[Math.floor(Math.random()*t.length)],duration:3e4}})});}return r};exports.Stories=$e;exports.demoUsers=fe;exports.generateDemoUsers=Pt;//# sourceMappingURL=index.cjs.map
18
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/Avatar.tsx","../src/components/AvatarList.tsx","../src/hooks/useTimer.ts","../src/hooks/useKeyboard.ts","../src/hooks/useFocusTrap.ts","../src/hooks/usePageVisibility.ts","../src/hooks/usePreloader.ts","../src/components/ProgressBar.tsx","../src/components/StoryProgressBars.tsx","../src/components/StoryItem.tsx","../src/components/StoryViewer.tsx","../src/utils/storyHelpers.ts","../src/components/Stories.tsx","../src/utils/demoData.tsx"],"names":["Avatar","memo","avatarUrl","username","hasUnreadStories","onClick","imageLoaded","setImageLoaded","useState","imageError","setImageError","jsxs","jsx","AVATAR_WIDTH","OVERSCAN_COUNT","AvatarList","users","onAvatarClick","containerRef","useRef","scrollLeft","setScrollLeft","containerWidth","setContainerWidth","handleScroll","useCallback","useEffect","updateWidth","startIndex","endIndex","React","start","visibleCount","totalWidth","virtualItems","user","idx","index","useTimer","duration","onComplete","autoStart","progress","setProgress","isPaused","setIsPaused","currentDuration","setCurrentDuration","startTimeRef","accumulatedTimeRef","rafRef","updateProgressRef","updateProgress","elapsed","newProgress","pause","resume","reset","setDuration","ms","useKeyboard","onLeft","onRight","onSpace","onEscape","enabled","handleKeyDown","e","useFocusTrap","previousFocusRef","container","focusableElements","firstFocusable","lastFocusable","handleTabKey","usePageVisibility","isVisible","setIsVisible","handleVisibilityChange","usePreloader","cacheRef","loadingRef","preloadImage","src","resolve","reject","checkInterval","img","preloadVideo","video","handleCanPlay","cleanup","handleError","preloadStoryItem","item","error","preloadMultiple","items","chunks","i","chunk","isPreloaded","clearCache","ProgressBar","isActive","progressPercent","StoryProgressBars","total","currentIndex","_","StoryItem","onDurationDetected","onLoadError","onBufferingChange","controls","videoRef","hasError","setHasError","isLoading","setIsLoading","handleLoadedMetadata","handleWaiting","handlePlaying","handleStalled","rafId","syncProgress","handleImageLoad","Component","DEFAULT_DURATION","SWIPE_THRESHOLD","StoryViewer","initialUserIndex","initialStoryIndex","isOpen","onClose","onStoryChange","currentUserIndex","setCurrentUserIndex","currentStoryIndex","setCurrentStoryIndex","isTransitioning","setIsTransitioning","transitionDirection","setTransitionDirection","isUserLoading","setIsUserLoading","timerRef","scrollPositionRef","currentDurationRef","hasStartedLoadingRef","currentUser","currentStory","totalStories","focusTrapRef","isPageVisible","handlePause","handleResume","handleNextRef","timer","handleBufferingChange","buffering","handleNext","nextIndex","nextUserIndex","handlePrevious","prevIndex","prevUserIndex","prevUser","lastStoryIndex","handleClose","storyControls","useMemo","handleTap","event","target","rect","touchStartRef","isDraggingRef","handlePointerDown","handlePointerMove","deltaX","deltaY","handlePointerUp","isHorizontalSwipe","prev","mouseEvent","itemsToPreload","preloadPromises","handleLoadError","content","createPortal","findStoryIndices","storyId","userIndex","storyIndex","story","Stories","closeNavigateTo","useParams","navigate","useNavigate","viewerState","setViewerState","indices","handleAvatarClick","firstStoryId","handleCloseViewer","handleStoryChange","Fragment","PollComponent","next","selected","setSelected","votes","setVotes","handleVote","option","newVotes","a","b","percentage","isSelected","QuizComponent","answered","setAnswered","correctAnswer","handleAnswer","isCorrect","bgColor","CountdownComponent","timeLeft","setTimeLeft","days","hours","minutes","seconds","TimeBox","value","label","ProductShowcaseComponent","SliderComponent","setValue","submitted","setSubmitted","handleSubmit","sampleVideos","sampleImages","avatarImages","demoUsers","generateDemoUsers","count","hasUnread","storyCount","storyIdx","typeRandom","backgrounds","components"],"mappings":"qQASO,IAAMA,EAAAA,CAASC,OACpB,CAAC,CAAE,SAAA,CAAAC,CAAAA,CAAW,SAAAC,C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IAAMC,CAAAA,CAAa,CAAC/C,EAAAA,CAAea,EAAAA,CAAekB,EAAe,CAAA,CACjE,OAAO,CACL,EAAA,CAAI,CAAA,MAAA,EAAS7I,CAAC,CAAA,CAAA,EAAI0J,CAAQ,CAAA,CAAA,CAC1B,IAAA,CAAM,kBAAA,CACN,SAAA,CAAWG,CAAAA,CAAW,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,MAAA,EAAO,CAAIA,CAAAA,CAAW,MAAM,CAAC,CAAA,CACnE,QAAA,CAAU,GACZ,CACF,CAAC,CACH,CAAC,EACH,CAEA,OAAOhP,CACT","file":"index.cjs","sourcesContent":["import { memo, useState } from 'react';\n\ninterface AvatarProps {\n avatarUrl: string;\n username: string;\n hasUnreadStories?: boolean;\n onClick: () => void;\n}\n\nexport const Avatar = memo<AvatarProps>(\n ({ avatarUrl, username, hasUnreadStories = false, onClick }) => {\n const [imageLoaded, setImageLoaded] = useState(false);\n const [imageError, setImageError] = useState(false);\n\n return (\n <button\n className={`story-avatar ${hasUnreadStories ? 'story-avatar-unread' : 'story-avatar-read'}`}\n onClick={onClick}\n aria-label={`View ${username}'s story`}\n >\n <div className=\"story-avatar-ring\">\n <div className=\"story-avatar-image-wrapper\">\n {!imageError ? (\n <img\n src={avatarUrl}\n alt={username}\n className={`story-avatar-image ${imageLoaded ? 'story-avatar-image-loaded' : ''}`}\n loading=\"lazy\"\n onLoad={() => setImageLoaded(true)}\n onError={() => setImageError(true)}\n />\n ) : (\n <div className=\"story-avatar-placeholder\">\n {username.charAt(0).toUpperCase()}\n </div>\n )}\n </div>\n </div>\n <span className=\"story-avatar-username\">{username}</span>\n </button>\n );\n }\n);\n\nAvatar.displayName = 'Avatar';\n","import React, { useRef, useEffect, useState, useCallback, memo } from 'react';\nimport { User } from '../types';\nimport { Avatar } from './Avatar';\n\ninterface AvatarListProps {\n users: User[];\n onAvatarClick: (userIndex: number) => void;\n}\n\nconst AVATAR_WIDTH = 90; // Approximate width including margin\nconst OVERSCAN_COUNT = 3; // Render extra items outside viewport\n\nexport const AvatarList = memo<AvatarListProps>(({ users, onAvatarClick }) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const [scrollLeft, setScrollLeft] = useState(0);\n const [containerWidth, setContainerWidth] = useState(0);\n\n // Update scroll position\n const handleScroll = useCallback(() => {\n if (containerRef.current) {\n setScrollLeft(containerRef.current.scrollLeft);\n }\n }, []);\n\n // Update container width on resize\n useEffect(() => {\n const updateWidth = () => {\n if (containerRef.current) {\n setContainerWidth(containerRef.current.clientWidth);\n }\n };\n\n updateWidth();\n window.addEventListener('resize', updateWidth);\n\n return () => {\n window.removeEventListener('resize', updateWidth);\n };\n }, []);\n\n // Calculate visible range\n const { startIndex, endIndex } = React.useMemo(() => {\n const start = Math.floor(scrollLeft / AVATAR_WIDTH);\n const visibleCount = Math.ceil(containerWidth / AVATAR_WIDTH);\n \n return {\n startIndex: Math.max(0, start - OVERSCAN_COUNT),\n endIndex: Math.min(users.length, start + visibleCount + OVERSCAN_COUNT),\n };\n }, [scrollLeft, containerWidth, users.length]);\n\n // Calculate total width\n const totalWidth = users.length * AVATAR_WIDTH;\n\n // Virtual items to render\n const virtualItems = users.slice(startIndex, endIndex).map((user, idx) => ({\n user,\n index: startIndex + idx,\n }));\n\n return (\n <div\n ref={containerRef}\n className=\"story-avatar-list\"\n onScroll={handleScroll}\n role=\"list\"\n aria-label=\"Stories\"\n >\n <div\n className=\"story-avatar-list-inner\"\n style={{\n width: `${totalWidth}px`,\n position: 'relative',\n }}\n >\n {virtualItems.map(({ user, index }) => (\n <div\n key={user.id}\n className=\"story-avatar-item\"\n style={{\n position: 'absolute',\n left: `${index * AVATAR_WIDTH}px`,\n width: `${AVATAR_WIDTH}px`,\n }}\n role=\"listitem\"\n >\n <Avatar\n avatarUrl={user.avatarUrl}\n username={user.username}\n hasUnreadStories={user.hasUnreadStories}\n onClick={() => onAvatarClick(index)}\n />\n </div>\n ))}\n </div>\n </div>\n );\n});\n\nAvatarList.displayName = 'AvatarList';\n","import { useEffect, useRef, useState, useCallback } from \"react\";\n\nexport interface UseTimerOptions {\n duration: number;\n onComplete?: () => void;\n autoStart?: boolean;\n}\n\nexport interface UseTimerReturn {\n progress: number; // 0 to 1\n isPaused: boolean;\n pause: () => void;\n resume: () => void;\n reset: () => void;\n setDuration: (ms: number) => void;\n}\n\nexport const useTimer = ({\n duration,\n onComplete,\n autoStart = true,\n}: UseTimerOptions): UseTimerReturn => {\n const [progress, setProgress] = useState(0);\n const [isPaused, setIsPaused] = useState(!autoStart);\n const [currentDuration, setCurrentDuration] = useState(duration);\n\n const startTimeRef = useRef<number | null>(null);\n const accumulatedTimeRef = useRef(0);\n const rafRef = useRef<number | null>(null);\n const updateProgressRef = useRef<() => void>();\n\n const updateProgress = useCallback(() => {\n if (!startTimeRef.current || isPaused) return;\n\n const elapsed =\n Date.now() - startTimeRef.current + accumulatedTimeRef.current;\n const newProgress = Math.min(elapsed / currentDuration, 1);\n\n setProgress(newProgress);\n\n if (newProgress >= 1) {\n onComplete?.();\n return;\n }\n\n rafRef.current = requestAnimationFrame(updateProgressRef.current!);\n }, [currentDuration, isPaused, onComplete]);\n\n // Keep the ref updated with the latest function\n updateProgressRef.current = updateProgress;\n\n const pause = useCallback(() => {\n if (isPaused) return;\n\n if (startTimeRef.current) {\n accumulatedTimeRef.current += Date.now() - startTimeRef.current;\n }\n\n setIsPaused(true);\n\n if (rafRef.current) {\n cancelAnimationFrame(rafRef.current);\n rafRef.current = null;\n }\n }, [isPaused]);\n\n const resume = useCallback(() => {\n if (!isPaused) return;\n\n startTimeRef.current = Date.now();\n setIsPaused(false);\n }, [isPaused]);\n\n const reset = useCallback(() => {\n // Cancel any existing animation frame\n if (rafRef.current) {\n cancelAnimationFrame(rafRef.current);\n rafRef.current = null;\n }\n\n startTimeRef.current = Date.now();\n accumulatedTimeRef.current = 0;\n setProgress(0);\n setIsPaused(false);\n\n // Force start animation frame\n rafRef.current = requestAnimationFrame(updateProgressRef.current!);\n }, []);\n\n const setDuration = useCallback((ms: number) => {\n setCurrentDuration(ms);\n }, []);\n\n // Start/restart animation loop when paused state changes\n useEffect(() => {\n if (!isPaused) {\n startTimeRef.current = Date.now();\n rafRef.current = requestAnimationFrame(updateProgressRef.current!);\n }\n\n return () => {\n if (rafRef.current) {\n cancelAnimationFrame(rafRef.current);\n }\n };\n }, [isPaused]);\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n if (rafRef.current) {\n cancelAnimationFrame(rafRef.current);\n }\n };\n }, []);\n\n return {\n progress,\n isPaused,\n pause,\n resume,\n reset,\n setDuration,\n };\n};\n","import { useEffect } from 'react';\n\nexport interface UseKeyboardOptions {\n onLeft?: () => void;\n onRight?: () => void;\n onSpace?: () => void;\n onEscape?: () => void;\n enabled?: boolean;\n}\n\nexport const useKeyboard = ({\n onLeft,\n onRight,\n onSpace,\n onEscape,\n enabled = true,\n}: UseKeyboardOptions) => {\n useEffect(() => {\n if (!enabled) return;\n\n const handleKeyDown = (e: KeyboardEvent) => {\n switch (e.key) {\n case 'ArrowLeft':\n e.preventDefault();\n onLeft?.();\n break;\n case 'ArrowRight':\n e.preventDefault();\n onRight?.();\n break;\n case ' ':\n e.preventDefault();\n onSpace?.();\n break;\n case 'Escape':\n e.preventDefault();\n onEscape?.();\n break;\n }\n };\n\n window.addEventListener('keydown', handleKeyDown);\n\n return () => {\n window.removeEventListener('keydown', handleKeyDown);\n };\n }, [onLeft, onRight, onSpace, onEscape, enabled]);\n};\n","import { useEffect, useRef } from 'react';\n\nexport const useFocusTrap = (enabled: boolean) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const previousFocusRef = useRef<HTMLElement | null>(null);\n\n useEffect(() => {\n if (!enabled || !containerRef.current) return;\n\n // Store the currently focused element\n previousFocusRef.current = document.activeElement as HTMLElement;\n\n const container = containerRef.current;\n const focusableElements = container.querySelectorAll<HTMLElement>(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\n );\n\n const firstFocusable = focusableElements[0];\n const lastFocusable = focusableElements[focusableElements.length - 1];\n\n // Focus first element\n firstFocusable?.focus();\n\n const handleTabKey = (e: KeyboardEvent) => {\n if (e.key !== 'Tab') return;\n\n if (e.shiftKey) {\n if (document.activeElement === firstFocusable) {\n e.preventDefault();\n lastFocusable?.focus();\n }\n } else {\n if (document.activeElement === lastFocusable) {\n e.preventDefault();\n firstFocusable?.focus();\n }\n }\n };\n\n container.addEventListener('keydown', handleTabKey);\n\n return () => {\n container.removeEventListener('keydown', handleTabKey);\n \n // Restore focus to the previously focused element\n previousFocusRef.current?.focus();\n };\n }, [enabled]);\n\n return containerRef;\n};\n","import { useEffect, useState } from 'react';\n\nexport const usePageVisibility = () => {\n const [isVisible, setIsVisible] = useState(!document.hidden);\n\n useEffect(() => {\n const handleVisibilityChange = () => {\n setIsVisible(!document.hidden);\n };\n\n document.addEventListener('visibilitychange', handleVisibilityChange);\n\n return () => {\n document.removeEventListener('visibilitychange', handleVisibilityChange);\n };\n }, []);\n\n return isVisible;\n};\n","import { useEffect, useRef, useCallback } from 'react';\nimport { StoryItem } from '../types';\n\ninterface PreloadCache {\n [key: string]: boolean;\n}\n\nexport const usePreloader = () => {\n const cacheRef = useRef<PreloadCache>({});\n const loadingRef = useRef<Set<string>>(new Set());\n\n const preloadImage = useCallback((src: string): Promise<void> => {\n return new Promise((resolve, reject) => {\n if (cacheRef.current[src]) {\n resolve();\n return;\n }\n\n if (loadingRef.current.has(src)) {\n // Already loading, wait for it\n const checkInterval = setInterval(() => {\n if (cacheRef.current[src] || !loadingRef.current.has(src)) {\n clearInterval(checkInterval);\n resolve();\n }\n }, 100);\n return;\n }\n\n loadingRef.current.add(src);\n\n const img = new Image();\n img.onload = () => {\n cacheRef.current[src] = true;\n loadingRef.current.delete(src);\n resolve();\n };\n img.onerror = () => {\n loadingRef.current.delete(src);\n reject(new Error(`Failed to load image: ${src}`));\n };\n img.src = src;\n });\n }, []);\n\n const preloadVideo = useCallback((src: string): Promise<void> => {\n return new Promise((resolve, reject) => {\n if (cacheRef.current[src]) {\n resolve();\n return;\n }\n\n if (loadingRef.current.has(src)) {\n const checkInterval = setInterval(() => {\n if (cacheRef.current[src] || !loadingRef.current.has(src)) {\n clearInterval(checkInterval);\n resolve();\n }\n }, 100);\n return;\n }\n\n loadingRef.current.add(src);\n\n const video = document.createElement('video');\n video.preload = 'auto';\n \n const handleCanPlay = () => {\n cacheRef.current[src] = true;\n loadingRef.current.delete(src);\n cleanup();\n resolve();\n };\n\n const handleError = () => {\n loadingRef.current.delete(src);\n cleanup();\n reject(new Error(`Failed to load video: ${src}`));\n };\n\n const cleanup = () => {\n video.removeEventListener('canplaythrough', handleCanPlay);\n video.removeEventListener('error', handleError);\n video.src = '';\n };\n\n video.addEventListener('canplaythrough', handleCanPlay);\n video.addEventListener('error', handleError);\n video.src = src;\n video.load();\n });\n }, []);\n\n const preloadStoryItem = useCallback(async (item: StoryItem): Promise<void> => {\n try {\n if (item.type === 'image' && 'src' in item) {\n await preloadImage(item.src);\n } else if (item.type === 'video' && 'src' in item) {\n await preloadVideo(item.src);\n }\n // Text and component types don't need preloading\n } catch (error) {\n console.warn('Failed to preload story item:', error);\n }\n }, [preloadImage, preloadVideo]);\n\n const preloadMultiple = useCallback(async (items: StoryItem[]): Promise<void> => {\n // Preload in parallel but limit concurrent loads\n const CONCURRENT_LIMIT = 3;\n const chunks: StoryItem[][] = [];\n \n for (let i = 0; i < items.length; i += CONCURRENT_LIMIT) {\n chunks.push(items.slice(i, i + CONCURRENT_LIMIT));\n }\n\n for (const chunk of chunks) {\n await Promise.allSettled(chunk.map(preloadStoryItem));\n }\n }, [preloadStoryItem]);\n\n const isPreloaded = useCallback((src: string): boolean => {\n return cacheRef.current[src] || false;\n }, []);\n\n const clearCache = useCallback(() => {\n cacheRef.current = {};\n loadingRef.current.clear();\n }, []);\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n clearCache();\n };\n }, [clearCache]);\n\n return {\n preloadImage,\n preloadVideo,\n preloadStoryItem,\n preloadMultiple,\n isPreloaded,\n clearCache,\n };\n};\n","import { memo } from \"react\";\n\ninterface ProgressBarProps {\n progress: number; // 0 to 1\n isActive: boolean;\n}\n\nexport const ProgressBar = memo<ProgressBarProps>(({ progress, isActive }) => {\n const progressPercent = Math.round(progress * 100);\n\n return (\n <div\n className=\"story-progress-bar\"\n role=\"progressbar\"\n aria-valuenow={isActive ? progressPercent : progress === 1 ? 100 : 0}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-label={`Story progress: ${progressPercent}%`}\n >\n <div\n className=\"story-progress-bar-fill\"\n style={{\n transform: `scaleX(${isActive ? progress : progress === 1 ? 1 : 0})`,\n }}\n />\n </div>\n );\n});\n\nProgressBar.displayName = \"ProgressBar\";\n","import { memo } from \"react\";\nimport { ProgressBar } from \"./ProgressBar\";\n\ninterface StoryProgressBarsProps {\n total: number;\n currentIndex: number;\n progress: number;\n}\n\nexport const StoryProgressBars = memo<StoryProgressBarsProps>(\n ({ total, currentIndex, progress }) => {\n return (\n <div className=\"story-progress-bars-container\">\n {Array.from({ length: total }).map((_, index) => (\n <ProgressBar\n key={index}\n progress={\n index < currentIndex ? 1 : index === currentIndex ? progress : 0\n }\n isActive={index === currentIndex}\n />\n ))}\n </div>\n );\n }\n);\n\nStoryProgressBars.displayName = \"StoryProgressBars\";\n","import { memo, useEffect, useRef, useState, useCallback } from \"react\";\nimport { StoryItem as StoryItemType, StoryItemControls } from \"../types\";\n\ninterface StoryItemProps {\n item: StoryItemType;\n isActive: boolean;\n isPaused: boolean;\n onDurationDetected?: (duration: number) => void;\n onLoadError?: () => void;\n onBufferingChange?: (isBuffering: boolean) => void;\n controls: StoryItemControls;\n}\n\nexport const StoryItem = memo<StoryItemProps>(\n ({ item, isActive, isPaused, onDurationDetected, onLoadError, onBufferingChange, controls }) => {\n const videoRef = useRef<HTMLVideoElement>(null);\n const [hasError, setHasError] = useState(false);\n const [isLoading, setIsLoading] = useState(true);\n\n // Handle video playback\n useEffect(() => {\n if (item.type !== \"video\" || !videoRef.current || !isActive) return;\n\n const video = videoRef.current;\n\n const playVideo = async () => {\n try {\n if (isPaused) {\n video.pause();\n } else {\n await video.play();\n }\n } catch (error) {\n console.warn(\"Video play failed:\", error);\n }\n };\n\n playVideo();\n }, [item.type, isActive, isPaused]);\n\n // Detect video duration\n useEffect(() => {\n if (item.type !== \"video\" || !videoRef.current) return;\n\n const video = videoRef.current;\n\n const handleLoadedMetadata = () => {\n if (video.duration && isFinite(video.duration)) {\n onDurationDetected?.(video.duration * 1000);\n }\n };\n\n const handleCanPlay = () => {\n setIsLoading(false);\n };\n\n video.addEventListener(\"loadedmetadata\", handleLoadedMetadata);\n video.addEventListener(\"canplay\", handleCanPlay);\n\n // Check if metadata already loaded\n if (video.readyState >= 1) {\n handleLoadedMetadata();\n }\n\n // Check if can play\n if (video.readyState >= 3) {\n handleCanPlay();\n }\n\n return () => {\n video.removeEventListener(\"loadedmetadata\", handleLoadedMetadata);\n video.removeEventListener(\"canplay\", handleCanPlay);\n };\n }, [item.type, onDurationDetected]);\n\n // Handle video buffering states\n useEffect(() => {\n if (item.type !== \"video\" || !videoRef.current || !isActive) return;\n\n const video = videoRef.current;\n\n const handleWaiting = () => {\n // Video is buffering\n onBufferingChange?.(true);\n };\n\n const handlePlaying = () => {\n // Video resumed after buffering\n onBufferingChange?.(false);\n };\n\n const handleStalled = () => {\n // Video stalled due to network issues\n onBufferingChange?.(true);\n };\n\n video.addEventListener(\"waiting\", handleWaiting);\n video.addEventListener(\"playing\", handlePlaying);\n video.addEventListener(\"stalled\", handleStalled);\n\n return () => {\n video.removeEventListener(\"waiting\", handleWaiting);\n video.removeEventListener(\"playing\", handlePlaying);\n video.removeEventListener(\"stalled\", handleStalled);\n };\n }, [item.type, isActive, onBufferingChange]);\n\n // Sync video progress with timer for more accurate progress bar\n useEffect(() => {\n if (item.type !== \"video\" || !videoRef.current || !isActive) return;\n\n const video = videoRef.current;\n let rafId: number;\n\n const syncProgress = () => {\n if (video.duration && isFinite(video.duration)) {\n // This allows the progress bar to sync with video playhead\n // The timer in StoryViewer will handle the actual progress\n }\n rafId = requestAnimationFrame(syncProgress);\n };\n\n rafId = requestAnimationFrame(syncProgress);\n\n return () => {\n cancelAnimationFrame(rafId);\n };\n }, [item.type, isActive]);\n\n const handleError = useCallback(() => {\n setHasError(true);\n setIsLoading(false);\n onLoadError?.();\n }, [onLoadError]);\n\n const handleImageLoad = useCallback(() => {\n setIsLoading(false);\n }, []);\n\n if (hasError) {\n return (\n <div className=\"story-item story-item-error\">\n <div className=\"story-item-error-message\">Failed to load content</div>\n </div>\n );\n }\n\n switch (item.type) {\n case \"image\":\n return (\n <div className=\"story-item story-item-image\">\n {isLoading && (\n <div className=\"story-item-loader\">\n <div className=\"story-item-spinner\"></div>\n </div>\n )}\n <img\n src={item.src}\n alt={item.alt || \"Story image\"}\n onError={handleError}\n onLoad={handleImageLoad}\n draggable={false}\n style={{ opacity: isLoading ? 0 : 1 }}\n />\n </div>\n );\n\n case \"video\":\n return (\n <div className=\"story-item story-item-video\">\n {isLoading && (\n <div className=\"story-item-loader\">\n <div className=\"story-item-spinner\"></div>\n </div>\n )}\n <video\n ref={videoRef}\n src={item.src}\n playsInline\n loop={false}\n onError={handleError}\n preload=\"auto\"\n style={{ opacity: isLoading ? 0 : 1 }}\n />\n </div>\n );\n\n case \"text\":\n return (\n <div\n className=\"story-item story-item-text\"\n style={{\n backgroundColor: item.backgroundColor || \"#000\",\n color: item.textColor || \"#fff\",\n }}\n >\n <div className=\"story-item-text-content\">{item.text}</div>\n </div>\n );\n\n case \"custom_component\":\n const Component = item.component;\n return (\n <div className=\"story-item story-item-component\">\n <Component {...controls} />\n </div>\n );\n\n default:\n return null;\n }\n }\n);\n\nStoryItem.displayName = \"StoryItem\";\n","import React, {\n useState,\n useEffect,\n useCallback,\n useRef,\n useMemo,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { User, StoryItem as StoryItemType, StoryItemControls } from \"../types\";\nimport { useTimer } from \"../hooks/useTimer\";\nimport { useKeyboard } from \"../hooks/useKeyboard\";\nimport { useFocusTrap } from \"../hooks/useFocusTrap\";\nimport { usePageVisibility } from \"../hooks/usePageVisibility\";\nimport { usePreloader } from \"../hooks/usePreloader\";\nimport { StoryProgressBars } from \"./StoryProgressBars\";\nimport { StoryItem } from \"./StoryItem\";\n\ninterface StoryViewerProps {\n users: User[];\n initialUserIndex: number;\n initialStoryIndex?: number;\n isOpen: boolean;\n onClose: () => void;\n onStoryChange?: (userIndex: number, storyIndex: number) => void;\n}\n\nconst DEFAULT_DURATION = 5000;\nconst SWIPE_THRESHOLD = 60; // pixels\n\nexport const StoryViewer: React.FC<StoryViewerProps> = React.memo(\n ({ users, initialUserIndex, initialStoryIndex, isOpen, onClose, onStoryChange }) => {\n // State\n const [currentUserIndex, setCurrentUserIndex] = useState(initialUserIndex);\n const [currentStoryIndex, setCurrentStoryIndex] = useState(initialStoryIndex ?? 0);\n const [isPaused, setIsPaused] = useState(false);\n\n // Update indices when initial props change\n useEffect(() => {\n setCurrentUserIndex(initialUserIndex);\n }, [initialUserIndex]);\n\n useEffect(() => {\n setCurrentStoryIndex(initialStoryIndex ?? 0);\n }, [initialStoryIndex]);\n const [isTransitioning, setIsTransitioning] = useState(false);\n const [transitionDirection, setTransitionDirection] = useState<\n \"left\" | \"right\" | null\n >(null);\n const [isLoading, setIsLoading] = useState(false);\n const [isUserLoading, setIsUserLoading] = useState(false);\n\n // Refs\n const containerRef = useRef<HTMLDivElement>(null);\n const timerRef = useRef<any>(null);\n const scrollPositionRef = useRef(0);\n const currentDurationRef = useRef(DEFAULT_DURATION);\n const hasStartedLoadingRef = useRef(false);\n\n // Current data\n const currentUser = users[currentUserIndex];\n const currentStory = currentUser?.stories[currentStoryIndex];\n const totalStories = currentUser?.stories.length || 0;\n\n // Update duration ref when story changes\n useEffect(() => {\n currentDurationRef.current = currentStory?.duration || DEFAULT_DURATION;\n }, [currentStory?.duration]);\n\n // Hooks\n const focusTrapRef = useFocusTrap(isOpen);\n const isPageVisible = usePageVisibility();\n const { preloadStoryItem } = usePreloader();\n\n // Pause/Resume\n const handlePause = useCallback(() => setIsPaused(true), []);\n const handleResume = useCallback(() => setIsPaused(false), []);\n\n // Placeholder for handleNext - will be defined after timer\n const handleNextRef = useRef<() => void>();\n\n const timer = useTimer({\n duration: currentDurationRef.current || DEFAULT_DURATION,\n onComplete: () => handleNextRef.current?.(),\n autoStart: false,\n });\n\n // Handle video buffering\n const handleBufferingChange = useCallback((buffering: boolean) => {\n if (buffering) {\n timer.pause();\n } else if (!isPaused) {\n // Only resume if not manually paused\n timer.resume();\n }\n }, [timer, isPaused]);\n\n // Update timer duration when story changes\n useEffect(() => {\n const duration = currentStory?.duration || DEFAULT_DURATION;\n timer.setDuration(duration);\n }, [timer, currentStory?.duration]);\n\n // Navigation functions\n const handleNext = useCallback(() => {\n if (!currentUser) return;\n\n if (currentStoryIndex < totalStories - 1) {\n const nextIndex = currentStoryIndex + 1;\n const nextStory = currentUser.stories[nextIndex];\n const duration = nextStory?.duration || DEFAULT_DURATION;\n\n setCurrentStoryIndex(nextIndex);\n timer.setDuration(duration);\n timer.reset();\n } else if (currentUserIndex < users.length - 1) {\n // Show loading for next user\n setIsUserLoading(true);\n setTimeout(() => {\n // Transition to next user with slide animation\n setIsTransitioning(true);\n setTransitionDirection(\"left\");\n setTimeout(() => {\n const nextUserIndex = currentUserIndex + 1;\n const nextUser = users[nextUserIndex];\n const firstStory = nextUser.stories[0];\n const duration = firstStory?.duration || DEFAULT_DURATION;\n\n setCurrentUserIndex(nextUserIndex);\n setCurrentStoryIndex(0);\n setIsTransitioning(false);\n setTransitionDirection(null);\n setIsUserLoading(false); // Hide loading after indices are updated\n\n timer.setDuration(duration);\n timer.reset();\n }, 150); // Match CSS transition duration\n }, 1000); // Simulate 1s loading for user data\n } else {\n onClose();\n }\n }, [\n currentUser,\n currentStoryIndex,\n totalStories,\n currentUserIndex,\n users,\n timer,\n onClose,\n ]);\n\n const handlePrevious = useCallback(() => {\n if (!currentUser) return;\n\n if (currentStoryIndex > 0) {\n const prevIndex = currentStoryIndex - 1;\n const prevStory = currentUser.stories[prevIndex];\n const duration = prevStory?.duration || DEFAULT_DURATION;\n\n setCurrentStoryIndex(prevIndex);\n timer.setDuration(duration);\n timer.reset();\n } else if (currentUserIndex > 0) {\n // Show loading for previous user\n setIsUserLoading(true);\n setTimeout(() => {\n // Transition to previous user with slide animation\n setIsTransitioning(true);\n setTransitionDirection(\"right\");\n setTimeout(() => {\n const prevUserIndex = currentUserIndex - 1;\n const prevUser = users[prevUserIndex];\n const lastStoryIndex = prevUser.stories.length - 1;\n const lastStory = prevUser.stories[lastStoryIndex];\n const duration = lastStory?.duration || DEFAULT_DURATION;\n\n setCurrentUserIndex(prevUserIndex);\n setCurrentStoryIndex(lastStoryIndex);\n setIsTransitioning(false);\n setTransitionDirection(null);\n setIsUserLoading(false); // Hide loading after indices are updated\n\n timer.setDuration(duration);\n timer.reset();\n }, 150); // Match CSS transition duration\n }, 1000); // Simulate 1s loading for user data\n }\n }, [currentUser, currentStoryIndex, currentUserIndex, users, timer]);\n\n const handleClose = useCallback(() => {\n // Restore scroll position\n window.scrollTo(0, scrollPositionRef.current);\n onClose();\n }, [onClose]);\n\n // Update the ref when handleNext changes\n useEffect(() => {\n handleNextRef.current = handleNext;\n }, [handleNext]);\n\n // Story controls for custom components\n const storyControls: StoryItemControls = useMemo(\n () => ({\n pause: handlePause,\n resume: handleResume,\n next: handleNext,\n prev: handlePrevious,\n setDuration: (ms: number) => timerRef.current?.setDuration(ms),\n }),\n [handlePause, handleResume, handleNext, handlePrevious]\n );\n\n // Handle taps for story navigation\n const handleTap = useCallback(\n (event: React.MouseEvent) => {\n // Don't handle taps on interactive elements\n const target = event.target as HTMLElement;\n if (\n target.closest(\".story-viewer-close\") ||\n target.closest(\"button\") ||\n target.closest(\"input\") ||\n target.closest(\"select\") ||\n target.closest(\"textarea\")\n ) {\n return;\n }\n\n const container = containerRef.current;\n if (!container) return;\n\n const rect = container.getBoundingClientRect();\n const relativeX = event.clientX - rect.left;\n const isLeftSide = relativeX < rect.width / 2;\n\n if (isLeftSide) {\n handlePrevious();\n } else {\n handleNext();\n }\n },\n [handlePrevious, handleNext]\n );\n\n // Touch/mouse gesture handling\n const touchStartRef = useRef<{ x: number; y: number } | null>(null);\n const isDraggingRef = useRef(false);\n\n const handlePointerDown = useCallback(\n (event: React.PointerEvent) => {\n isDraggingRef.current = false;\n touchStartRef.current = {\n x: event.clientX,\n y: event.clientY,\n };\n handlePause();\n },\n [handlePause]\n );\n\n const handlePointerMove = useCallback((event: React.PointerEvent) => {\n if (!touchStartRef.current) return;\n\n const deltaX = event.clientX - touchStartRef.current.x;\n const deltaY = event.clientY - touchStartRef.current.y;\n\n // Check if this is a drag (moved more than 10px)\n if (Math.abs(deltaX) > 10 || Math.abs(deltaY) > 10) {\n isDraggingRef.current = true;\n }\n }, []);\n\n const handlePointerUp = useCallback(\n (event: React.PointerEvent) => {\n if (!touchStartRef.current) return;\n\n const deltaX = event.clientX - touchStartRef.current.x;\n const deltaY = event.clientY - touchStartRef.current.y;\n\n // Check for swipe gestures\n const isHorizontalSwipe = Math.abs(deltaX) > SWIPE_THRESHOLD;\n const isVerticalSwipe = Math.abs(deltaY) > 80;\n\n if (isVerticalSwipe && deltaY > 0) {\n // Swipe down - close\n handleClose();\n } else if (isHorizontalSwipe) {\n // Horizontal swipe - navigate users with loading\n if (deltaX > 0 && currentUserIndex > 0) {\n // Swipe right - previous user\n setIsUserLoading(true);\n setTimeout(() => {\n setIsTransitioning(true);\n setTransitionDirection(\"right\");\n setTimeout(() => {\n setCurrentUserIndex((prev) => prev - 1);\n setCurrentStoryIndex(\n users[currentUserIndex - 1].stories.length - 1\n );\n setIsTransitioning(false);\n setTransitionDirection(null);\n setIsUserLoading(false); // Hide loading after indices are updated\n timer.reset();\n }, 150);\n }, 1000);\n } else if (deltaX < 0 && currentUserIndex < users.length - 1) {\n // Swipe left - next user\n setIsUserLoading(true);\n setTimeout(() => {\n setIsTransitioning(true);\n setTransitionDirection(\"left\");\n setTimeout(() => {\n setCurrentUserIndex((prev) => prev + 1);\n setCurrentStoryIndex(0);\n setIsTransitioning(false);\n setTransitionDirection(null);\n setIsUserLoading(false); // Hide loading after indices are updated\n timer.reset();\n }, 150);\n }, 1000);\n }\n } else if (!isDraggingRef.current) {\n // This was a tap, not a drag\n // Convert pointer event to mouse event for handleTap\n const mouseEvent = {\n ...event,\n target: event.target,\n currentTarget: event.currentTarget,\n clientX: event.clientX,\n clientY: event.clientY,\n } as React.MouseEvent;\n handleTap(mouseEvent);\n }\n\n // Reset\n touchStartRef.current = null;\n isDraggingRef.current = false;\n handleResume();\n },\n [\n currentUserIndex,\n users.length,\n handleClose,\n timer,\n handleResume,\n handleTap,\n ]\n );\n\n // Keyboard support\n useKeyboard({\n onLeft: handlePrevious,\n onRight: handleNext,\n onSpace: () => (isPaused ? handleResume() : handlePause()),\n onEscape: handleClose,\n enabled: isOpen,\n });\n\n // Pause on page visibility change\n useEffect(() => {\n if (!isPageVisible) {\n handlePause();\n } else if (isPageVisible && !isPaused) {\n handleResume();\n }\n }, [isPageVisible, handlePause, handleResume, isPaused]);\n\n // Preload adjacent stories\n useEffect(() => {\n if (!isOpen || !currentUser) return;\n\n const itemsToPreload: StoryItemType[] = [];\n\n // Current user's adjacent stories\n if (currentStoryIndex < totalStories - 1) {\n itemsToPreload.push(currentUser.stories[currentStoryIndex + 1]);\n }\n if (currentStoryIndex > 0) {\n itemsToPreload.push(currentUser.stories[currentStoryIndex - 1]);\n }\n\n // Adjacent users' first stories\n if (currentUserIndex < users.length - 1) {\n itemsToPreload.push(users[currentUserIndex + 1].stories[0]);\n }\n if (currentUserIndex > 0) {\n itemsToPreload.push(users[currentUserIndex - 1].stories[0]);\n }\n\n // Limit concurrent preloads\n const preloadPromises = itemsToPreload\n .slice(0, 3)\n .map((item) => preloadStoryItem(item).catch(() => {}));\n\n Promise.all(preloadPromises);\n }, [\n isOpen,\n currentUser,\n currentUserIndex,\n currentStoryIndex,\n totalStories,\n users,\n preloadStoryItem,\n ]);\n\n // Handle initial loading when opening story viewer\n useEffect(() => {\n if (isOpen && !hasStartedLoadingRef.current) {\n hasStartedLoadingRef.current = true;\n setIsLoading(true);\n // Preload current story\n if (currentStory) {\n preloadStoryItem(currentStory);\n }\n // Simulate API call to fetch user stories\n setTimeout(() => {\n setIsLoading(false);\n scrollPositionRef.current = window.scrollY;\n document.body.style.overflow = \"hidden\";\n // Start timer when opening story viewer\n timer.resume();\n }, 1500); // Simulate 1.5s loading time\n } else if (!isOpen) {\n hasStartedLoadingRef.current = false;\n document.body.style.overflow = \"\";\n setIsLoading(false);\n setIsUserLoading(false);\n }\n\n return () => {\n document.body.style.overflow = \"\";\n };\n }, [isOpen, timer]);\n\n // Notify parent of story changes\n useEffect(() => {\n if (onStoryChange && isOpen) {\n onStoryChange(currentUserIndex, currentStoryIndex);\n }\n }, [currentUserIndex, currentStoryIndex, onStoryChange, isOpen]);\n\n // Handle load errors\n const handleLoadError = useCallback(() => {\n console.warn(\"Story item failed to load, skipping...\");\n setTimeout(handleNext, 500);\n }, [handleNext]);\n\n // Early return\n if (!isOpen) {\n return null;\n }\n\n if (!currentUser || !currentStory) {\n return null;\n }\n\n const content = (\n <div\n ref={containerRef}\n className=\"story-viewer\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={`Stories by ${currentUser?.username || \"user\"}`}\n aria-describedby=\"story-viewer-description\"\n >\n <div className=\"story-viewer-overlay\" onClick={handleClose} />\n\n {/* Hidden description for screen readers */}\n <div id=\"story-viewer-description\" className=\"sr-only\">\n Instagram-style stories viewer. Tap left side to go to previous story,\n right side to go to next story. Swipe left or right to navigate\n between users. Press Escape to close.\n </div>\n\n {/* Live region for announcements */}\n <div aria-live=\"polite\" aria-atomic=\"true\" className=\"sr-only\">\n Viewing story {currentStoryIndex + 1} of {totalStories} by{\" \"}\n {currentUser?.username}\n </div>\n\n <div\n ref={focusTrapRef}\n className={`story-viewer-content ${\n isTransitioning\n ? `story-viewer-transitioning story-viewer-transition-${transitionDirection}`\n : \"\"\n }`}\n onClick={handleTap}\n onPointerDown={handlePointerDown}\n onPointerMove={handlePointerMove}\n onPointerUp={handlePointerUp}\n onMouseEnter={handlePause}\n onMouseLeave={handleResume}\n >\n <div className=\"story-viewer-header\">\n <StoryProgressBars\n total={totalStories}\n currentIndex={currentStoryIndex}\n progress={timer.progress}\n />\n\n <div className=\"story-viewer-user-info\">\n <img\n src={currentUser.avatarUrl}\n alt={`${currentUser.username} avatar`}\n className=\"story-viewer-avatar\"\n />\n <span className=\"story-viewer-username\">\n {currentUser.username}\n </span>\n </div>\n\n <button\n className=\"story-viewer-close\"\n onClick={handleClose}\n aria-label=\"Close story viewer\"\n type=\"button\"\n >\n ×\n </button>\n </div>\n\n <div className=\"story-viewer-items\">\n {isLoading || isUserLoading ? (\n <div className=\"story-item-loader\">\n <div className=\"story-item-spinner\" />\n </div>\n ) : (\n <StoryItem\n item={currentStory}\n isActive={true}\n isPaused={isPaused || isDraggingRef.current}\n onDurationDetected={(duration) =>\n timerRef.current?.setDuration(duration)\n }\n onLoadError={handleLoadError}\n onBufferingChange={handleBufferingChange}\n controls={storyControls}\n />\n )}\n </div>\n\n <div className=\"story-viewer-nav-hints\">\n <div className=\"story-viewer-nav-hint story-viewer-nav-hint-left\" />\n <div className=\"story-viewer-nav-hint story-viewer-nav-hint-right\" />\n </div>\n </div>\n </div>\n );\n\n return createPortal(content, document.body);\n }\n);\n","import { User } from '../types';\n\nexport interface StoryIndices {\n userIndex: number;\n storyIndex: number;\n}\n\n/**\n * Finds the user index and story index for a given story ID\n * @param users - Array of users\n * @param storyId - The story ID to find\n * @returns Object with userIndex and storyIndex, or null if not found\n */\nexport function findStoryIndices(users: User[], storyId: string): StoryIndices | null {\n for (let userIndex = 0; userIndex < users.length; userIndex++) {\n const user = users[userIndex];\n const storyIndex = user.stories.findIndex(story => story.id === storyId);\n if (storyIndex !== -1) {\n return { userIndex, storyIndex };\n }\n }\n return null;\n}\n\n/**\n * Gets the story ID for given user and story indices\n * @param users - Array of users\n * @param userIndex - Index of the user\n * @param storyIndex - Index of the story\n * @returns The story ID, or null if indices are invalid\n */\nexport function getStoryId(users: User[], userIndex: number, storyIndex: number): string | null {\n const user = users[userIndex];\n if (!user) return null;\n const story = user.stories[storyIndex];\n return story ? story.id : null;\n}","import React, { useState, useCallback, useRef, useEffect } from 'react';\nimport { useParams, useNavigate } from 'react-router-dom';\nimport { User } from '../types';\nimport { AvatarList } from './AvatarList';\nimport { StoryViewer } from './StoryViewer';\nimport { findStoryIndices } from '../utils/storyHelpers';\n\ninterface StoriesProps {\n users: User[];\n closeNavigateTo?: string;\n}\n\nexport const Stories: React.FC<StoriesProps> = ({ users, closeNavigateTo = '/' }) => {\n const { storyId } = useParams<{ storyId?: string }>();\n const navigate = useNavigate();\n\n const [viewerState, setViewerState] = useState<{\n isOpen: boolean;\n userIndex: number;\n storyIndex: number;\n }>({\n isOpen: false,\n userIndex: 0,\n storyIndex: 0,\n });\n\n const scrollPositionRef = useRef(0);\n\n // Handle initial story from URL\n useEffect(() => {\n if (storyId) {\n const indices = findStoryIndices(users, storyId);\n if (indices) {\n setViewerState({\n isOpen: true,\n userIndex: indices.userIndex,\n storyIndex: indices.storyIndex,\n });\n }\n }\n }, [storyId, users]);\n\n const handleAvatarClick = useCallback((userIndex: number) => {\n // Save scroll position\n scrollPositionRef.current = window.scrollY;\n\n setViewerState({\n isOpen: true,\n userIndex,\n storyIndex: 0,\n });\n\n // Update URL with first story ID of the user\n const user = users[userIndex];\n if (user && user.stories.length > 0) {\n const firstStoryId = user.stories[0].id;\n navigate(`/story/${firstStoryId}`, { replace: true });\n }\n }, [users, navigate]);\n\n const handleCloseViewer = useCallback(() => {\n setViewerState({\n isOpen: false,\n userIndex: 0,\n storyIndex: 0,\n });\n\n // Restore scroll position\n requestAnimationFrame(() => {\n window.scrollTo(0, scrollPositionRef.current);\n });\n\n // Clear URL\n navigate(closeNavigateTo, { replace: true });\n }, [navigate, closeNavigateTo]);\n\n const handleStoryChange = useCallback((userIndex: number, storyIndex: number) => {\n const user = users[userIndex];\n if (user && user.stories[storyIndex]) {\n const storyId = user.stories[storyIndex].id;\n navigate(`/story/${storyId}`, { replace: true });\n }\n }, [users, navigate]);\n\n return (\n <>\n <AvatarList users={users} onAvatarClick={handleAvatarClick} />\n\n <StoryViewer\n users={users}\n initialUserIndex={viewerState.userIndex}\n initialStoryIndex={viewerState.storyIndex}\n isOpen={viewerState.isOpen}\n onClose={handleCloseViewer}\n onStoryChange={handleStoryChange}\n />\n </>\n );\n};\n","import { User, StoryItemControls } from \"../types\";\nimport React from \"react\";\n\n// ============================================\n// CUSTOM STORY COMPONENTS\n// ============================================\n\n// Interactive Poll Component\nexport const PollComponent: React.FC<StoryItemControls> = ({\n pause,\n resume,\n next,\n}) => {\n const [selected, setSelected] = React.useState<number | null>(null);\n const [votes, setVotes] = React.useState([42, 28, 18, 12]);\n\n React.useEffect(() => {\n pause();\n return () => resume();\n }, [pause, resume]);\n\n const handleVote = (option: number) => {\n setSelected(option);\n const newVotes = [...votes];\n newVotes[option] += 1;\n setVotes(newVotes);\n setTimeout(() => {\n resume();\n next();\n }, 2000);\n };\n\n const total = votes.reduce((a, b) => a + b, 0);\n const options = [\"React\", \"Vue\", \"Angular\", \"Svelte\"];\n\n return (\n <div\n style={{\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n justifyContent: \"center\",\n height: \"100%\",\n padding: \"20px\",\n width: \"100%\",\n background: \"linear-gradient(135deg, #667eea 0%, #764ba2 100%)\",\n }}\n >\n <h2 style={{ color: \"white\", marginBottom: \"10px\", fontSize: \"28px\", fontWeight: \"bold\" }}>\n Poll\n </h2>\n <p style={{ color: \"rgba(255,255,255,0.9)\", marginBottom: \"30px\", fontSize: \"18px\" }}>\n What's your favorite framework?\n </p>\n\n <div style={{ width: \"100%\" }}>\n {options.map((option, idx) => {\n const percentage = Math.round((votes[idx] / total) * 100);\n const isSelected = selected === idx;\n\n return (\n <button\n key={idx}\n onClick={() => selected === null && handleVote(idx)}\n disabled={selected !== null}\n style={{\n width: \"100%\",\n padding: \"16px 20px\",\n margin: \"8px 0\",\n border: \"none\",\n borderRadius: \"12px\",\n background: selected !== null\n ? `linear-gradient(90deg, rgba(255,255,255,0.4) ${percentage}%, rgba(255,255,255,0.15) ${percentage}%)`\n : \"rgba(255,255,255,0.2)\",\n color: \"white\",\n fontSize: \"16px\",\n fontWeight: \"600\",\n cursor: selected === null ? \"pointer\" : \"default\",\n transition: \"all 0.3s ease\",\n display: \"flex\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n backdropFilter: \"blur(10px)\",\n }}\n >\n <span style={{ display: \"flex\", alignItems: \"center\", gap: \"10px\" }}>\n {isSelected && \"✓ \"}\n {option}\n </span>\n {selected !== null && <span>{percentage}%</span>}\n </button>\n );\n })}\n </div>\n\n {selected !== null && (\n <p style={{ color: \"rgba(255,255,255,0.8)\", marginTop: \"20px\", fontSize: \"14px\" }}>\n {total} votes • Thanks for voting!\n </p>\n )}\n </div>\n );\n};\n\n// Quiz Component\nexport const QuizComponent: React.FC<StoryItemControls> = ({\n pause,\n resume,\n next,\n}) => {\n const [answered, setAnswered] = React.useState(false);\n const [selected, setSelected] = React.useState<number | null>(null);\n const correctAnswer = 2;\n\n React.useEffect(() => {\n pause();\n return () => resume();\n }, [pause, resume]);\n\n const handleAnswer = (idx: number) => {\n setSelected(idx);\n setAnswered(true);\n setTimeout(() => {\n resume();\n next();\n }, 2500);\n };\n\n const options = [\"Mars\", \"Venus\", \"Jupiter\", \"Saturn\"];\n\n return (\n <div\n style={{\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n justifyContent: \"center\",\n height: \"100%\",\n padding: \"20px\",\n width: \"100%\",\n background: \"linear-gradient(135deg, #f093fb 0%, #f5576c 100%)\",\n }}\n >\n <div style={{\n fontSize: \"48px\",\n marginBottom: \"20px\",\n animation: \"bounce 1s infinite\"\n }}>\n 🪐\n </div>\n <h2 style={{ color: \"white\", marginBottom: \"10px\", fontSize: \"24px\", fontWeight: \"bold\", textAlign: \"center\" }}>\n Quiz Time!\n </h2>\n <p style={{ color: \"rgba(255,255,255,0.9)\", marginBottom: \"30px\", fontSize: \"18px\", textAlign: \"center\" }}>\n Which is the largest planet in our solar system?\n </p>\n\n <div style={{ width: \"100%\" }}>\n {options.map((option, idx) => {\n const isCorrect = idx === correctAnswer;\n const isSelected = selected === idx;\n\n let bgColor = \"rgba(255,255,255,0.2)\";\n if (answered) {\n if (isCorrect) bgColor = \"rgba(34, 197, 94, 0.6)\";\n else if (isSelected) bgColor = \"rgba(239, 68, 68, 0.6)\";\n }\n\n return (\n <button\n key={idx}\n onClick={() => !answered && handleAnswer(idx)}\n disabled={answered}\n style={{\n width: \"100%\",\n padding: \"16px 20px\",\n margin: \"8px 0\",\n border: \"none\",\n borderRadius: \"12px\",\n background: bgColor,\n color: \"white\",\n fontSize: \"16px\",\n fontWeight: \"600\",\n cursor: answered ? \"default\" : \"pointer\",\n transition: \"all 0.3s ease\",\n display: \"flex\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n }}\n >\n <span>{option}</span>\n {answered && isCorrect && <span>✓</span>}\n {answered && isSelected && !isCorrect && <span>✗</span>}\n </button>\n );\n })}\n </div>\n\n {answered && (\n <p style={{\n color: \"white\",\n marginTop: \"20px\",\n fontSize: \"16px\",\n fontWeight: \"bold\"\n }}>\n {selected === correctAnswer ? \"🎉 Correct!\" : \"❌ Wrong! Jupiter is the largest.\"}\n </p>\n )}\n </div>\n );\n};\n\n// Countdown/Announcement Component\nexport const CountdownComponent: React.FC<StoryItemControls> = () => {\n const [timeLeft, setTimeLeft] = React.useState({\n days: 12,\n hours: 8,\n minutes: 45,\n seconds: 30,\n });\n\n React.useEffect(() => {\n const timer = setInterval(() => {\n setTimeLeft((prev) => {\n let { days, hours, minutes, seconds } = prev;\n seconds--;\n if (seconds < 0) {\n seconds = 59;\n minutes--;\n }\n if (minutes < 0) {\n minutes = 59;\n hours--;\n }\n if (hours < 0) {\n hours = 23;\n days--;\n }\n return { days, hours, minutes, seconds };\n });\n }, 1000);\n\n return () => clearInterval(timer);\n }, []);\n\n const TimeBox = ({ value, label }: { value: number; label: string }) => (\n <div style={{ textAlign: \"center\" }}>\n <div\n style={{\n background: \"rgba(255,255,255,0.2)\",\n backdropFilter: \"blur(10px)\",\n borderRadius: \"12px\",\n padding: \"15px 20px\",\n minWidth: \"70px\",\n }}\n >\n <div style={{ fontSize: \"32px\", fontWeight: \"bold\", color: \"white\" }}>\n {String(value).padStart(2, \"0\")}\n </div>\n </div>\n <div style={{ color: \"rgba(255,255,255,0.8)\", fontSize: \"12px\", marginTop: \"8px\", textTransform: \"uppercase\" }}>\n {label}\n </div>\n </div>\n );\n\n return (\n <div\n style={{\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n justifyContent: \"center\",\n height: \"100%\",\n padding: \"20px\",\n width: \"100%\",\n background: \"linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%)\",\n }}\n >\n <div style={{ fontSize: \"48px\", marginBottom: \"15px\" }}>🚀</div>\n <h2 style={{ color: \"white\", marginBottom: \"8px\", fontSize: \"24px\", fontWeight: \"bold\" }}>\n Product Launch\n </h2>\n <p style={{ color: \"rgba(255,255,255,0.7)\", marginBottom: \"30px\", fontSize: \"14px\" }}>\n Something amazing is coming...\n </p>\n\n <div style={{ display: \"flex\", gap: \"12px\", marginBottom: \"30px\" }}>\n <TimeBox value={timeLeft.days} label=\"Days\" />\n <TimeBox value={timeLeft.hours} label=\"Hours\" />\n <TimeBox value={timeLeft.minutes} label=\"Mins\" />\n <TimeBox value={timeLeft.seconds} label=\"Secs\" />\n </div>\n\n <button\n style={{\n padding: \"14px 40px\",\n background: \"linear-gradient(135deg, #667eea 0%, #764ba2 100%)\",\n border: \"none\",\n borderRadius: \"30px\",\n color: \"white\",\n fontSize: \"16px\",\n fontWeight: \"bold\",\n cursor: \"pointer\",\n }}\n >\n Notify Me\n </button>\n </div>\n );\n};\n\n// Product Showcase Component\nexport const ProductShowcaseComponent: React.FC<StoryItemControls> = () => {\n return (\n <div\n style={{\n display: \"flex\",\n flexDirection: \"column\",\n height: \"100%\",\n background: \"linear-gradient(180deg, #1a1a2e 0%, #16213e 100%)\",\n position: \"relative\",\n overflow: \"hidden\",\n }}\n >\n {/* Product Image */}\n <div style={{ flex: 1, display: \"flex\", alignItems: \"center\", justifyContent: \"center\", padding: \"20px\" }}>\n <img\n src=\"https://images.unsplash.com/photo-1523275335684-37898b6baf30?w=400&h=400&fit=crop\"\n alt=\"Product\"\n style={{\n width: \"100%\",\n height: \"100%\",\n objectFit: \"cover\",\n borderRadius: \"20px\",\n boxShadow: \"0 20px 60px rgba(0,0,0,0.5)\",\n }}\n />\n </div>\n\n {/* Product Info */}\n <div\n style={{\n padding: \"30px\",\n background: \"linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.8) 100%)\",\n }}\n >\n <div style={{ display: \"flex\", alignItems: \"center\", gap: \"8px\", marginBottom: \"10px\" }}>\n <span style={{ background: \"#ef4444\", color: \"white\", padding: \"4px 10px\", borderRadius: \"20px\", fontSize: \"12px\", fontWeight: \"bold\" }}>\n NEW\n </span>\n <span style={{ color: \"rgba(255,255,255,0.6)\", fontSize: \"12px\" }}>Limited Edition</span>\n </div>\n <h2 style={{ color: \"white\", fontSize: \"24px\", fontWeight: \"bold\", marginBottom: \"8px\" }}>\n Premium Watch Collection\n </h2>\n <p style={{ color: \"rgba(255,255,255,0.7)\", fontSize: \"14px\", marginBottom: \"15px\" }}>\n Elegant design meets modern technology\n </p>\n <div style={{ display: \"flex\", alignItems: \"center\", gap: \"15px\" }}>\n <span style={{ color: \"white\", fontSize: \"28px\", fontWeight: \"bold\" }}>$299</span>\n <span style={{ color: \"rgba(255,255,255,0.5)\", fontSize: \"18px\", textDecoration: \"line-through\" }}>$399</span>\n </div>\n <button\n style={{\n width: \"100%\",\n marginTop: \"20px\",\n padding: \"16px\",\n background: \"white\",\n border: \"none\",\n borderRadius: \"12px\",\n color: \"#1a1a2e\",\n fontSize: \"16px\",\n fontWeight: \"bold\",\n cursor: \"pointer\",\n }}\n >\n Shop Now →\n </button>\n </div>\n </div>\n );\n};\n\n// Slider/Rating Component\nexport const SliderComponent: React.FC<StoryItemControls> = ({\n pause,\n resume,\n next,\n}) => {\n const [value, setValue] = React.useState(5);\n const [submitted, setSubmitted] = React.useState(false);\n\n React.useEffect(() => {\n pause();\n return () => resume();\n }, [pause, resume]);\n\n const handleSubmit = () => {\n setSubmitted(true);\n setTimeout(() => {\n resume();\n next();\n }, 1500);\n };\n\n const emojis = [\"😢\", \"😕\", \"😐\", \"🙂\", \"😊\", \"😃\", \"😄\", \"😁\", \"🤩\", \"🥳\"];\n\n return (\n <div\n style={{\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n justifyContent: \"center\",\n height: \"100%\",\n padding: \"20px\",\n width: \"100%\",\n background: \"linear-gradient(135deg, #11998e 0%, #38ef7d 100%)\",\n }}\n >\n <div style={{ fontSize: \"80px\", marginBottom: \"20px\", transition: \"all 0.3s\" }}>\n {emojis[value - 1]}\n </div>\n\n <h2 style={{ color: \"white\", marginBottom: \"10px\", fontSize: \"24px\", fontWeight: \"bold\" }}>\n Rate Your Experience\n </h2>\n <p style={{ color: \"rgba(255,255,255,0.9)\", marginBottom: \"30px\", fontSize: \"16px\" }}>\n How was your visit today?\n </p>\n\n {!submitted ? (\n <>\n <div style={{ width: \"100%\", marginBottom: \"20px\" }}>\n <input\n type=\"range\"\n min=\"1\"\n max=\"10\"\n value={value}\n onChange={(e) => setValue(parseInt(e.target.value))}\n style={{\n width: \"100%\",\n height: \"8px\",\n borderRadius: \"4px\",\n appearance: \"none\",\n background: \"rgba(255,255,255,0.3)\",\n cursor: \"pointer\",\n }}\n />\n <div style={{ display: \"flex\", justifyContent: \"space-between\", color: \"rgba(255,255,255,0.7)\", fontSize: \"12px\", marginTop: \"8px\" }}>\n <span>1</span>\n <span>10</span>\n </div>\n </div>\n\n <button\n onClick={handleSubmit}\n style={{\n padding: \"14px 50px\",\n background: \"white\",\n border: \"none\",\n borderRadius: \"30px\",\n color: \"#11998e\",\n fontSize: \"16px\",\n fontWeight: \"bold\",\n cursor: \"pointer\",\n }}\n >\n Submit ({value}/10)\n </button>\n </>\n ) : (\n <div style={{ textAlign: \"center\" }}>\n <div style={{ fontSize: \"48px\", marginBottom: \"10px\" }}>🎉</div>\n <p style={{ color: \"white\", fontSize: \"18px\", fontWeight: \"bold\" }}>\n Thanks for your feedback!\n </p>\n </div>\n )}\n </div>\n );\n};\n\n// ============================================\n// DEMO DATA\n// ============================================\n\n// Sample working video URLs\nconst sampleVideos = [\n \"https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4\",\n \"https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerEscapes.mp4\",\n \"https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4\",\n];\n\n// Sample working image URLs from Unsplash\nconst sampleImages = [\n \"https://images.unsplash.com/photo-1682687220742-aba13b6e50ba?w=1080&h=1920&fit=crop\",\n \"https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=1080&h=1920&fit=crop\",\n \"https://images.unsplash.com/photo-1469474968028-56623f02e42e?w=1080&h=1920&fit=crop\",\n \"https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=1080&h=1920&fit=crop\",\n \"https://images.unsplash.com/photo-1472214103451-9374bd1c798e?w=1080&h=1920&fit=crop\",\n \"https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=1080&h=1920&fit=crop\",\n \"https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=1080&h=1920&fit=crop\",\n \"https://images.unsplash.com/photo-1517841905240-472988babdf9?w=1080&h=1920&fit=crop\",\n];\n\n// Avatar URLs\nconst avatarImages = [\n \"https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=150&h=150&fit=crop\",\n \"https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=150&h=150&fit=crop\",\n \"https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=150&h=150&fit=crop\",\n \"https://images.unsplash.com/photo-1517841905240-472988babdf9?w=150&h=150&fit=crop\",\n \"https://images.unsplash.com/photo-1539571696357-5a69c17a67c6?w=150&h=150&fit=crop\",\n \"https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=150&h=150&fit=crop\",\n];\n\n// Main demo users with diverse story types\nexport const demoUsers: User[] = [\n {\n id: \"user-travel\",\n username: \"Travel\",\n avatarUrl: avatarImages[0],\n hasUnreadStories: true,\n stories: [\n {\n id: \"travel-1\",\n type: \"image\",\n src: \"https://images.unsplash.com/photo-1682687220742-aba13b6e50ba?w=1080&h=1920&fit=crop\",\n duration: 5000,\n alt: \"Beautiful mountain landscape\",\n },\n {\n id: \"travel-2\",\n type: \"image\",\n src: \"https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=1080&h=1920&fit=crop\",\n duration: 5000,\n alt: \"Scenic ocean view\",\n },\n {\n id: \"travel-3\",\n type: \"text\",\n text: \"Adventure awaits! 🌍\\n\\nSwipe to explore more destinations →\",\n backgroundColor: \"#FF6B6B\",\n textColor: \"#FFFFFF\",\n duration: 4000,\n },\n {\n id: \"travel-4\",\n type: \"video\",\n src: sampleVideos[0],\n duration: 15000,\n },\n ],\n },\n {\n id: \"user-polls\",\n username: \"Interactive\",\n avatarUrl: avatarImages[1],\n hasUnreadStories: true,\n stories: [\n {\n id: \"poll-intro\",\n type: \"text\",\n text: \"Let's have some fun! 🎮\\n\\nInteractive stories ahead →\",\n backgroundColor: \"#667eea\",\n textColor: \"#FFFFFF\",\n duration: 3000,\n },\n {\n id: \"poll-1\",\n type: \"custom_component\",\n component: PollComponent,\n duration: 30000,\n },\n {\n id: \"quiz-1\",\n type: \"custom_component\",\n component: QuizComponent,\n duration: 30000,\n },\n {\n id: \"slider-1\",\n type: \"custom_component\",\n component: SliderComponent,\n duration: 30000,\n },\n ],\n },\n {\n id: \"user-product\",\n username: \"Shop\",\n avatarUrl: avatarImages[2],\n hasUnreadStories: true,\n stories: [\n {\n id: \"product-1\",\n type: \"custom_component\",\n component: ProductShowcaseComponent,\n duration: 8000,\n },\n {\n id: \"product-2\",\n type: \"image\",\n src: \"https://images.unsplash.com/photo-1523275335684-37898b6baf30?w=1080&h=1920&fit=crop\",\n duration: 5000,\n alt: \"Product showcase\",\n },\n {\n id: \"product-3\",\n type: \"text\",\n text: \"Limited Time Offer! 🔥\\n\\n50% OFF\\n\\nUse code: STORY50\",\n backgroundColor: \"#000000\",\n textColor: \"#FFFFFF\",\n duration: 5000,\n },\n ],\n },\n {\n id: \"user-launch\",\n username: \"Events\",\n avatarUrl: avatarImages[3],\n hasUnreadStories: true,\n stories: [\n {\n id: \"launch-1\",\n type: \"custom_component\",\n component: CountdownComponent,\n duration: 10000,\n },\n {\n id: \"launch-2\",\n type: \"text\",\n text: \"Mark your calendars! 📅\\n\\nBig announcement coming soon...\",\n backgroundColor: \"#302b63\",\n textColor: \"#FFFFFF\",\n duration: 4000,\n },\n {\n id: \"launch-3\",\n type: \"image\",\n src: \"https://images.unsplash.com/photo-1492684223066-81342ee5ff30?w=1080&h=1920&fit=crop\",\n duration: 5000,\n alt: \"Event teaser\",\n },\n ],\n },\n {\n id: \"user-video\",\n username: \"Videos\",\n avatarUrl: avatarImages[4],\n hasUnreadStories: true,\n stories: [\n {\n id: \"video-1\",\n type: \"video\",\n src: sampleVideos[1],\n duration: 15000,\n },\n {\n id: \"video-2\",\n type: \"video\",\n src: sampleVideos[2],\n duration: 15000,\n },\n {\n id: \"video-3\",\n type: \"text\",\n text: \"More videos coming soon! 🎬\\n\\nStay tuned →\",\n backgroundColor: \"#4ECDC4\",\n textColor: \"#FFFFFF\",\n duration: 3000,\n },\n ],\n },\n {\n id: \"user-lifestyle\",\n username: \"Lifestyle\",\n avatarUrl: avatarImages[5],\n hasUnreadStories: false,\n stories: [\n {\n id: \"lifestyle-1\",\n type: \"image\",\n src: \"https://images.unsplash.com/photo-1469474968028-56623f02e42e?w=1080&h=1920&fit=crop\",\n duration: 5000,\n alt: \"Nature scene\",\n },\n {\n id: \"lifestyle-2\",\n type: \"image\",\n src: \"https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=1080&h=1920&fit=crop\",\n duration: 5000,\n alt: \"Peaceful landscape\",\n },\n {\n id: \"lifestyle-3\",\n type: \"text\",\n text: \"Find your peace 🧘\\n\\nNature heals everything\",\n backgroundColor: \"#45B7D1\",\n textColor: \"#FFFFFF\",\n duration: 4000,\n },\n ],\n },\n];\n\n// Generate demo users for performance testing\nexport const generateDemoUsers = (count: number = 50): User[] => {\n const users: User[] = [...demoUsers];\n\n for (let i = demoUsers.length; i < count; i++) {\n const hasUnread = Math.random() > 0.3;\n const storyCount = Math.floor(Math.random() * 5) + 2;\n\n users.push({\n id: `user-${i}`,\n username: `User ${i}`,\n avatarUrl: `https://i.pravatar.cc/150?img=${i % 70}`,\n hasUnreadStories: hasUnread,\n stories: Array.from({ length: storyCount }, (_, storyIdx) => {\n const typeRandom = Math.random();\n\n // 50% images, 20% videos, 20% text, 10% custom\n if (typeRandom < 0.5) {\n return {\n id: `story-${i}-${storyIdx}`,\n type: \"image\" as const,\n src: sampleImages[Math.floor(Math.random() * sampleImages.length)],\n duration: 5000,\n alt: `Story from User ${i}`,\n };\n }\n\n if (typeRandom < 0.7) {\n return {\n id: `story-${i}-${storyIdx}`,\n type: \"video\" as const,\n src: sampleVideos[Math.floor(Math.random() * sampleVideos.length)],\n duration: 15000,\n };\n }\n\n if (typeRandom < 0.9) {\n const backgrounds = [\"#FF6B6B\", \"#4ECDC4\", \"#45B7D1\", \"#FFA07A\", \"#98D8C8\", \"#667eea\", \"#764ba2\"];\n return {\n id: `story-${i}-${storyIdx}`,\n type: \"text\" as const,\n text: `Hello from User ${i}! 👋\\n\\nThis is story ${storyIdx + 1}`,\n backgroundColor: backgrounds[Math.floor(Math.random() * backgrounds.length)],\n textColor: \"#FFFFFF\",\n duration: 4000,\n };\n }\n\n // Custom component\n const components = [PollComponent, QuizComponent, SliderComponent];\n return {\n id: `story-${i}-${storyIdx}`,\n type: \"custom_component\" as const,\n component: components[Math.floor(Math.random() * components.length)],\n duration: 30000,\n };\n }),\n });\n }\n\n return users;\n};\n"]}
@@ -0,0 +1,62 @@
1
+ import React, { ComponentType } from 'react';
2
+
3
+ type StoryItemType = 'image' | 'video' | 'text' | 'custom_component';
4
+ interface StoryItemMetadata {
5
+ [key: string]: any;
6
+ }
7
+ interface StoryItemControls {
8
+ pause: () => void;
9
+ resume: () => void;
10
+ next: () => void;
11
+ prev: () => void;
12
+ setDuration: (ms: number) => void;
13
+ }
14
+ interface BaseStoryItem {
15
+ id: string;
16
+ type: StoryItemType;
17
+ duration?: number;
18
+ metadata?: StoryItemMetadata;
19
+ alt?: string;
20
+ caption?: string;
21
+ }
22
+ interface ImageStoryItem extends BaseStoryItem {
23
+ type: 'image';
24
+ src: string;
25
+ duration?: number;
26
+ }
27
+ interface VideoStoryItem extends BaseStoryItem {
28
+ type: 'video';
29
+ src: string;
30
+ duration?: number;
31
+ }
32
+ interface TextStoryItem extends BaseStoryItem {
33
+ type: 'text';
34
+ text: string;
35
+ backgroundColor?: string;
36
+ textColor?: string;
37
+ duration?: number;
38
+ }
39
+ interface CustomComponentStoryItem extends BaseStoryItem {
40
+ type: 'custom_component';
41
+ component: ComponentType<StoryItemControls>;
42
+ duration?: number;
43
+ }
44
+ type StoryItem = ImageStoryItem | VideoStoryItem | TextStoryItem | CustomComponentStoryItem;
45
+ interface User {
46
+ id: string;
47
+ username: string;
48
+ avatarUrl: string;
49
+ stories: StoryItem[];
50
+ hasUnreadStories?: boolean;
51
+ }
52
+
53
+ interface StoriesProps {
54
+ users: User[];
55
+ closeNavigateTo?: string;
56
+ }
57
+ declare const Stories: React.FC<StoriesProps>;
58
+
59
+ declare const demoUsers: User[];
60
+ declare const generateDemoUsers: (count?: number) => User[];
61
+
62
+ export { Stories, type StoryItem, type StoryItemControls, type User, demoUsers, generateDemoUsers };
@@ -0,0 +1,62 @@
1
+ import React, { ComponentType } from 'react';
2
+
3
+ type StoryItemType = 'image' | 'video' | 'text' | 'custom_component';
4
+ interface StoryItemMetadata {
5
+ [key: string]: any;
6
+ }
7
+ interface StoryItemControls {
8
+ pause: () => void;
9
+ resume: () => void;
10
+ next: () => void;
11
+ prev: () => void;
12
+ setDuration: (ms: number) => void;
13
+ }
14
+ interface BaseStoryItem {
15
+ id: string;
16
+ type: StoryItemType;
17
+ duration?: number;
18
+ metadata?: StoryItemMetadata;
19
+ alt?: string;
20
+ caption?: string;
21
+ }
22
+ interface ImageStoryItem extends BaseStoryItem {
23
+ type: 'image';
24
+ src: string;
25
+ duration?: number;
26
+ }
27
+ interface VideoStoryItem extends BaseStoryItem {
28
+ type: 'video';
29
+ src: string;
30
+ duration?: number;
31
+ }
32
+ interface TextStoryItem extends BaseStoryItem {
33
+ type: 'text';
34
+ text: string;
35
+ backgroundColor?: string;
36
+ textColor?: string;
37
+ duration?: number;
38
+ }
39
+ interface CustomComponentStoryItem extends BaseStoryItem {
40
+ type: 'custom_component';
41
+ component: ComponentType<StoryItemControls>;
42
+ duration?: number;
43
+ }
44
+ type StoryItem = ImageStoryItem | VideoStoryItem | TextStoryItem | CustomComponentStoryItem;
45
+ interface User {
46
+ id: string;
47
+ username: string;
48
+ avatarUrl: string;
49
+ stories: StoryItem[];
50
+ hasUnreadStories?: boolean;
51
+ }
52
+
53
+ interface StoriesProps {
54
+ users: User[];
55
+ closeNavigateTo?: string;
56
+ }
57
+ declare const Stories: React.FC<StoriesProps>;
58
+
59
+ declare const demoUsers: User[];
60
+ declare const generateDemoUsers: (count?: number) => User[];
61
+
62
+ export { Stories, type StoryItem, type StoryItemControls, type User, demoUsers, generateDemoUsers };