react-instagram-stories 1.0.3 → 1.0.5
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/README.md +170 -259
- package/dist/index.cjs +9 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -5
- package/dist/index.d.ts +24 -5
- package/dist/index.js +9 -8
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
package/dist/index.cjs
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
'use strict';var E=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 E__default=/*#__PURE__*/_interopDefault(E);var ae=E.memo(({avatarUrl:e,username:r,hasUnreadStories:o=false,onClick:n})=>{let[l,i]=E.useState(false),[a,c]=E.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})]})});ae.displayName="Avatar";var q=90,Se=3,X=E.memo(({users:e,onAvatarClick:r})=>{let o=E.useRef(null),[n,l]=E.useState(0),[i,a]=E.useState(0),c=E.useCallback(()=>{o.current&&l(o.current.scrollLeft);},[]);E.useEffect(()=>{let u=()=>{o.current&&a(o.current.clientWidth);};return u(),window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u);}},[]);let{startIndex:t,endIndex:m}=E__default.default.useMemo(()=>{let u=Math.floor(n/q),g=Math.ceil(i/q);return {startIndex:Math.max(0,u-Se),endIndex:Math.min(e.length,u+g+Se)}},[n,i,e.length]),d=e.length*q,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*q}px`,width:`${q}px`},role:"listitem",children:jsxRuntime.jsx(ae,{avatarUrl:u.avatarUrl,username:u.username,hasUnreadStories:u.hasUnreadStories,onClick:()=>r(g)})},u.id))})})});X.displayName="AvatarList";var Ie=({duration:e,onComplete:r,autoStart:o=true})=>{let[n,l]=E.useState(0),[i,a]=E.useState(!o),[c,t]=E.useState(e),m=E.useRef(null),d=E.useRef(0),s=E.useRef(null),u=E.useRef(),g=E.useCallback(()=>{if(!m.current||i)return;let _=Date.now()-m.current+d.current,R=Math.min(_/c,1);if(l(R),R>=1){r?.();return}s.current=requestAnimationFrame(u.current);},[c,i,r]);u.current=g;let f=E.useCallback(()=>{i||(m.current&&(d.current+=Date.now()-m.current),a(true),s.current&&(cancelAnimationFrame(s.current),s.current=null));},[i]),v=E.useCallback(()=>{i&&(m.current=Date.now(),a(false));},[i]),S=E.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);},[]),T=E.useCallback(_=>{t(_);},[]);return E.useEffect(()=>(i||(m.current=Date.now(),s.current=requestAnimationFrame(u.current)),()=>{s.current&&cancelAnimationFrame(s.current);}),[i]),E.useEffect(()=>()=>{s.current&&cancelAnimationFrame(s.current);},[]),{progress:n,isPaused:i,pause:f,resume:v,reset:S,setDuration:T}};var Ce=({onLeft:e,onRight:r,onSpace:o,onEscape:n,enabled:l=true})=>{E.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 Ee=e=>{let r=E.useRef(null),o=E.useRef(null);return E.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 Pe=()=>{let[e,r]=E.useState(!document.hidden);return E.useEffect(()=>{let o=()=>{r(!document.hidden);};return document.addEventListener("visibilitychange",o),()=>{document.removeEventListener("visibilitychange",o);}},[]),e};var Le=()=>{let e=E.useRef({}),r=E.useRef(new Set),o=E.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=E.useCallback(t=>new Promise((m,d)=>{if(e.current[t]){m();return}if(r.current.has(t)){let v=setInterval(()=>{(e.current[t]||!r.current.has(t))&&(clearInterval(v),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),f(),m();},g=()=>{r.current.delete(t),f(),d(new Error(`Failed to load video: ${t}`));},f=()=>{s.removeEventListener("canplaythrough",u),s.removeEventListener("error",g),s.src="";};s.addEventListener("canplaythrough",u),s.addEventListener("error",g),s.src=t,s.load();}),[]),l=E.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=E.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=E.useCallback(t=>e.current[t]||false,[]),c=E.useCallback(()=>{e.current={},r.current.clear();},[]);return E.useEffect(()=>()=>{c();},[c]),{preloadImage:o,preloadVideo:n,preloadStoryItem:l,preloadMultiple:i,isPreloaded:a,clearCache:c}};var le=E.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})`}})})});le.displayName="ProgressBar";var ce=E.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(le,{progress:l<r?1:l===r?o:0,isActive:l===r},l))}));ce.displayName="StoryProgressBars";var de=E.memo(({item:e,isActive:r,isPaused:o,onDurationDetected:n,onLoadError:l,onBufferingChange:i,controls:a})=>{let c=E.useRef(null),[t,m]=E.useState(false),[d,s]=E.useState(true);E.useEffect(()=>{if(e.type!=="video"||!c.current||!r)return;let f=c.current;(async()=>{try{o?f.pause():await f.play();}catch(S){console.warn("Video play failed:",S);}})();},[e.type,r,o]),E.useEffect(()=>{if(e.type!=="video"||!c.current)return;let f=c.current,v=()=>{f.duration&&isFinite(f.duration)&&n?.(f.duration*1e3);},S=()=>{s(false);};return f.addEventListener("loadedmetadata",v),f.addEventListener("canplay",S),f.readyState>=1&&v(),f.readyState>=3&&S(),()=>{f.removeEventListener("loadedmetadata",v),f.removeEventListener("canplay",S);}},[e.type,n]),E.useEffect(()=>{if(e.type!=="video"||!c.current||!r)return;let f=c.current,v=()=>{i?.(true);},S=()=>{i?.(false);},T=()=>{i?.(true);};return f.addEventListener("waiting",v),f.addEventListener("playing",S),f.addEventListener("stalled",T),()=>{f.removeEventListener("waiting",v),f.removeEventListener("playing",S),f.removeEventListener("stalled",T);}},[e.type,r,i]),E.useEffect(()=>{if(e.type!=="video"||!c.current||!r)return;let f=c.current,v,S=()=>{f.duration&&isFinite(f.duration),v=requestAnimationFrame(S);};return v=requestAnimationFrame(S),()=>{cancelAnimationFrame(v);}},[e.type,r]);let u=E.useCallback(()=>{m(true),s(false),l?.();},[l]),g=E.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 f=e.component;return jsxRuntime.jsx("div",{className:"story-item story-item-component",children:jsxRuntime.jsx(f,{...a})});default:return null}});de.displayName="StoryItem";var A=5e3,ee=E__default.default.memo(({users:e,initialUserIndex:r,initialStoryIndex:o,isOpen:n,onClose:l,onStoryChange:i})=>{let[a,c]=E.useState(r),[t,m]=E.useState(o??0),[d,s]=E.useState(false);E.useEffect(()=>{c(r);},[r]),E.useEffect(()=>{m(o??0);},[o]);let[u,g]=E.useState(false),[f,v]=E.useState(null),[S,T]=E.useState(false),[_,R]=E.useState(false),me=E.useRef(null),fe=E.useRef(null),ye=E.useRef(0),ge=E.useRef(A),te=E.useRef(false),b=e[a],U=b?.stories[t],B=b?.stories.length||0;E.useEffect(()=>{ge.current=U?.duration||A;},[U?.duration]);let _e=Ee(n),re=Pe(),{preloadStoryItem:oe}=Le(),N=E.useCallback(()=>s(true),[]),z=E.useCallback(()=>s(false),[]),ve=E.useRef(),x=Ie({duration:ge.current||A,onComplete:()=>ve.current?.(),autoStart:false}),He=E.useCallback(y=>{y?x.pause():d||x.resume();},[x,d]);E.useEffect(()=>{let y=U?.duration||A;x.setDuration(y);},[x,U?.duration]);let k=E.useCallback(()=>{if(b)if(t<B-1){let y=t+1,I=b.stories[y]?.duration||A;m(y),x.setDuration(I),x.reset();}else a<e.length-1?(R(true),setTimeout(()=>{g(true),v("left"),setTimeout(()=>{let y=a+1,O=e[y].stories[0]?.duration||A;c(y),m(0),g(false),v(null),R(false),x.setDuration(O),x.reset();},150);},1e3)):l();},[b,t,B,a,e,x,l]),H=E.useCallback(()=>{if(b)if(t>0){let y=t-1,I=b.stories[y]?.duration||A;m(y),x.setDuration(I),x.reset();}else a>0&&(R(true),setTimeout(()=>{g(true),v("right"),setTimeout(()=>{let y=a-1,w=e[y],I=w.stories.length-1,he=w.stories[I]?.duration||A;c(y),m(I),g(false),v(null),R(false),x.setDuration(he),x.reset();},150);},1e3));},[b,t,a,e,x]),ne=E.useCallback(()=>{window.scrollTo(0,ye.current),l();},[l]);E.useEffect(()=>{ve.current=k;},[k]);let Oe=E.useMemo(()=>({pause:N,resume:z,next:k,prev:H,setDuration:y=>fe.current?.setDuration(y)}),[N,z,k,H]),Ke=E.useCallback(y=>{let w=y.target;if(w.closest(".story-viewer-close")||w.closest("button")||w.closest("input")||w.closest("select")||w.closest("textarea"))return;let I=me.current;if(!I)return;let O=I.getBoundingClientRect();y.clientX-O.left<O.width/2?H():k();},[H,k]),J=E.useRef(null),se=E.useRef(false),qe=E.useCallback(y=>{se.current=false,J.current={x:y.clientX,y:y.clientY},N();},[N]),Xe=E.useCallback(y=>{if(!J.current)return;let w=y.clientX-J.current.x,I=y.clientY-J.current.y;(Math.abs(w)>10||Math.abs(I)>10)&&(se.current=true);},[]);Ce({onLeft:H,onRight:k,onSpace:()=>d?z():N(),onEscape:ne,enabled:n}),E.useEffect(()=>{re?re&&!d&&z():N();},[re,N,z,d]),E.useEffect(()=>{if(!n||!b)return;let y=[];t<B-1&&y.push(b.stories[t+1]),t>0&&y.push(b.stories[t-1]),a<e.length-1&&y.push(e[a+1].stories[0]),a>0&&y.push(e[a-1].stories[0]);let w=y.slice(0,3).map(I=>oe(I).catch(()=>{}));Promise.all(w);},[n,b,a,t,B,e,oe]),E.useEffect(()=>(n&&!te.current?(te.current=true,T(true),U&&oe(U),setTimeout(()=>{T(false),ye.current=window.scrollY,document.body.style.overflow="hidden",x.resume();},1500)):n||(te.current=false,document.body.style.overflow="",T(false),R(false)),()=>{document.body.style.overflow="";}),[n,x]),E.useEffect(()=>{i&&n&&i(a,t);},[a,t,i,n]);let Ye=E.useCallback(()=>{console.warn("Story item failed to load, skipping..."),setTimeout(k,500);},[k]);if(!n||!b||!U)return null;let je=jsxRuntime.jsxs("div",{ref:me,className:"story-viewer",role:"dialog","aria-modal":"true","aria-label":`Stories by ${b?.username||"user"}`,"aria-describedby":"story-viewer-description",children:[jsxRuntime.jsx("div",{className:"story-viewer-overlay",onClick:ne}),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 ",B," by"," ",b?.username]}),jsxRuntime.jsxs("div",{ref:_e,className:`story-viewer-content ${u?`story-viewer-transitioning story-viewer-transition-${f}`:""}`,onClick:Ke,onPointerDown:qe,onPointerMove:Xe,onMouseEnter:N,onMouseLeave:z,children:[jsxRuntime.jsxs("div",{className:"story-viewer-header",children:[jsxRuntime.jsx(ce,{total:B,currentIndex:t,progress:x.progress}),jsxRuntime.jsxs("div",{className:"story-viewer-user-info",children:[jsxRuntime.jsx("img",{src:b.avatarUrl,alt:`${b.username} avatar`,className:"story-viewer-avatar"}),jsxRuntime.jsx("span",{className:"story-viewer-username",children:b.username})]}),jsxRuntime.jsx("button",{className:"story-viewer-close",onClick:ne,"aria-label":"Close story viewer",type:"button",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"story-viewer-items",children:S||_?jsxRuntime.jsx("div",{className:"story-item-loader",children:jsxRuntime.jsx("div",{className:"story-item-spinner"})}):jsxRuntime.jsx(de,{item:U,isActive:true,isPaused:d||se.current,onDurationDetected:y=>fe.current?.setDuration(y),onLoadError:Ye,onBufferingChange:He,controls:Oe})}),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(je,document.body)});function Ae(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 Be=({users:e,closeNavigateTo:r="/"})=>{let{storyId:o}=reactRouterDom.useParams(),n=reactRouterDom.useNavigate(),[l,i]=E.useState({isOpen:false,userIndex:0,storyIndex:0}),a=E.useRef(0);E.useEffect(()=>{if(o){let d=Ae(e,o);d&&i({isOpen:true,userIndex:d.userIndex,storyIndex:d.storyIndex});}},[o,e]);let c=E.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=E.useCallback(()=>{i({isOpen:false,userIndex:0,storyIndex:0}),requestAnimationFrame(()=>{window.scrollTo(0,a.current);}),n(r,{replace:true});},[n,r]),m=E.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(X,{users:e,onAvatarClick:c}),jsxRuntime.jsx(ee,{users:e,initialUserIndex:l.userIndex,initialStoryIndex:l.storyIndex,isOpen:l.isOpen,onClose:t,onStoryChange:m})]})};var $e=({pause:e,resume:r,next:o})=>{let[n,l]=E__default.default.useState(null),[i,a]=E__default.default.useState([42,28,18,12]);E__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!"]})]})},Ve=({pause:e,resume:r,next:o})=>{let[n,l]=E__default.default.useState(false),[i,a]=E__default.default.useState(null),c=2;E__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,f="rgba(255,255,255,0.2)";return n&&(u?f="rgba(34, 197, 94, 0.6)":g&&(f="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:f,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."})]})},wt=()=>{let[e,r]=E__default.default.useState({days:12,hours:8,minutes:45,seconds:30});E__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"})]})},It=()=>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"})]})]}),We=({pause:e,resume:r,next:o})=>{let[n,l]=E__default.default.useState(5),[i,a]=E__default.default.useState(false);E__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)"]})]})]})},j=["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"],ze=["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"],W=["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"],pe=[{id:"user-travel",username:"Travel",avatarUrl:W[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}
|
|
1
|
+
'use strict';var U=require('react'),jsxRuntime=require('react/jsx-runtime'),reactDom=require('react-dom');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var U__default=/*#__PURE__*/_interopDefault(U);var me=U.memo(({avatarUrl:e,username:t,hasUnreadStories:r=false,onClick:o})=>{let[u,l]=U.useState(false),[a,i]=U.useState(false);return jsxRuntime.jsxs("button",{className:`story-avatar ${r?"story-avatar-unread":"story-avatar-read"}`,onClick:o,"aria-label":`View ${t}'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:t.charAt(0).toUpperCase()}):jsxRuntime.jsx("img",{src:e,alt:t,className:`story-avatar-image ${u?"story-avatar-image-loaded":""}`,loading:"lazy",onLoad:()=>l(true),onError:()=>i(true)})})}),jsxRuntime.jsx("span",{className:"story-avatar-username",children:t})]})});me.displayName="Avatar";var q=90,Ee=3,X=U.memo(({users:e,onAvatarClick:t})=>{let r=U.useRef(null),[o,u]=U.useState(0),[l,a]=U.useState(0),i=U.useCallback(()=>{r.current&&u(r.current.scrollLeft);},[]);U.useEffect(()=>{let d=()=>{r.current&&a(r.current.clientWidth);};return d(),window.addEventListener("resize",d),()=>{window.removeEventListener("resize",d);}},[]);let{startIndex:n,endIndex:f}=U__default.default.useMemo(()=>{let d=Math.floor(o/q),g=Math.ceil(l/q);return {startIndex:Math.max(0,d-Ee),endIndex:Math.min(e.length,d+g+Ee)}},[o,l,e.length]),y=e.length*q,s=e.slice(n,f).map((d,g)=>({user:d,index:n+g}));return jsxRuntime.jsx("div",{ref:r,className:"story-avatar-list",onScroll:i,role:"list","aria-label":"Stories",children:jsxRuntime.jsx("div",{className:"story-avatar-list-inner",style:{width:`${y}px`,position:"relative"},children:s.map(({user:d,index:g})=>jsxRuntime.jsx("div",{className:"story-avatar-item",style:{position:"absolute",left:`${g*q}px`,width:`${q}px`},role:"listitem",children:jsxRuntime.jsx(me,{avatarUrl:d.avatarUrl,username:d.username,hasUnreadStories:d.hasUnreadStories,onClick:()=>t(g)})},d.id))})})});X.displayName="AvatarList";var Ue=({duration:e,onComplete:t,autoStart:r=true})=>{let[o,u]=U.useState(0),[l,a]=U.useState(!r),[i,n]=U.useState(e),f=U.useRef(null),y=U.useRef(0),s=U.useRef(null),d=U.useRef(),g=U.useCallback(()=>{if(!f.current||l)return;let R=Date.now()-f.current+y.current,_=Math.min(R/i,1);if(u(_),_>=1){t?.();return}s.current=requestAnimationFrame(d.current);},[i,l,t]);d.current=g;let c=U.useCallback(()=>{l||(f.current&&(y.current+=Date.now()-f.current),a(true),s.current&&(cancelAnimationFrame(s.current),s.current=null));},[l]),I=U.useCallback(()=>{l&&(f.current=Date.now(),a(false));},[l]),h=U.useCallback(()=>{s.current&&(cancelAnimationFrame(s.current),s.current=null),f.current=Date.now(),y.current=0,u(0),a(false),s.current=requestAnimationFrame(d.current);},[]),L=U.useCallback(R=>{n(R);},[]);return U.useEffect(()=>(l||(f.current=Date.now(),s.current=requestAnimationFrame(d.current)),()=>{s.current&&cancelAnimationFrame(s.current);}),[l]),U.useEffect(()=>()=>{s.current&&cancelAnimationFrame(s.current);},[]),{progress:o,isPaused:l,pause:c,resume:I,reset:h,setDuration:L}};var Le=({onLeft:e,onRight:t,onSpace:r,onEscape:o,enabled:u=true})=>{U.useEffect(()=>{if(!u)return;let l=a=>{switch(a.key){case "ArrowLeft":a.preventDefault(),e?.();break;case "ArrowRight":a.preventDefault(),t?.();break;case " ":a.preventDefault(),r?.();break;case "Escape":a.preventDefault(),o?.();break}};return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l);}},[e,t,r,o,u]);};var ke=e=>{let t=U.useRef(null),r=U.useRef(null);return U.useEffect(()=>{if(!e||!t.current)return;r.current=document.activeElement;let o=t.current,u=o.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),l=u[0],a=u[u.length-1];l?.focus();let i=n=>{n.key==="Tab"&&(n.shiftKey?document.activeElement===l&&(n.preventDefault(),a?.focus()):document.activeElement===a&&(n.preventDefault(),l?.focus()));};return o.addEventListener("keydown",i),()=>{o.removeEventListener("keydown",i),r.current?.focus();}},[e]),t};var Te=()=>{let[e,t]=U.useState(!document.hidden);return U.useEffect(()=>{let r=()=>{t(!document.hidden);};return document.addEventListener("visibilitychange",r),()=>{document.removeEventListener("visibilitychange",r);}},[]),e};var De=()=>{let e=U.useRef({}),t=U.useRef(new Set),r=U.useCallback(n=>new Promise((f,y)=>{if(e.current[n]){f();return}if(t.current.has(n)){let d=setInterval(()=>{(e.current[n]||!t.current.has(n))&&(clearInterval(d),f());},100);return}t.current.add(n);let s=new Image;s.onload=()=>{e.current[n]=true,t.current.delete(n),f();},s.onerror=()=>{t.current.delete(n),y(new Error(`Failed to load image: ${n}`));},s.src=n;}),[]),o=U.useCallback(n=>new Promise((f,y)=>{if(e.current[n]){f();return}if(t.current.has(n)){let I=setInterval(()=>{(e.current[n]||!t.current.has(n))&&(clearInterval(I),f());},100);return}t.current.add(n);let s=document.createElement("video");s.preload="auto";let d=()=>{e.current[n]=true,t.current.delete(n),c(),f();},g=()=>{t.current.delete(n),c(),y(new Error(`Failed to load video: ${n}`));},c=()=>{s.removeEventListener("canplaythrough",d),s.removeEventListener("error",g),s.src="";};s.addEventListener("canplaythrough",d),s.addEventListener("error",g),s.src=n,s.load();}),[]),u=U.useCallback(async n=>{try{n.type==="image"&&"src"in n?await r(n.src):n.type==="video"&&"src"in n&&await o(n.src);}catch(f){console.warn("Failed to preload story item:",f);}},[r,o]),l=U.useCallback(async n=>{let y=[];for(let s=0;s<n.length;s+=3)y.push(n.slice(s,s+3));for(let s of y)await Promise.allSettled(s.map(u));},[u]),a=U.useCallback(n=>e.current[n]||false,[]),i=U.useCallback(()=>{e.current={},t.current.clear();},[]);return U.useEffect(()=>()=>{i();},[i]),{preloadImage:r,preloadVideo:o,preloadStoryItem:u,preloadMultiple:l,isPreloaded:a,clearCache:i}};function Ae(){let[e,t]=U.useState(()=>new URLSearchParams(window.location.search));U.useEffect(()=>{let o=()=>{t(new URLSearchParams(window.location.search));};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[]);let r=U.useCallback((o,u={})=>{let l=typeof o=="function"?o(new URLSearchParams(window.location.search)):o,a=new URLSearchParams(l).toString(),i=a?`${window.location.pathname}?${a}`:window.location.pathname;u.replace?window.history.replaceState({},"",i):window.history.pushState({},"",i),t(new URLSearchParams(a));},[]);return [e,r]}function ye(e,t){let r=new URLSearchParams(e).toString(),o=r?`${window.location.pathname}?${r}`:window.location.pathname;t?.replace?window.history.replaceState({},"",o):window.history.pushState({},"",o),window.dispatchEvent(new PopStateEvent("popstate"));}function It(e){let t=window.location.pathname;e?.replace?window.history.replaceState({},"",t):window.history.pushState({},"",t),window.dispatchEvent(new PopStateEvent("popstate"));}function Me(e,t){let r=parseInt(t,10);return !isNaN(r)&&r>=0&&r<e.length?r:e.findIndex(o=>o.id===t)}function Be(e,t){let r=parseInt(t,10);return !isNaN(r)&&r>=0&&r<e.stories.length?r:e.stories.findIndex(o=>o.id===t)}var he=U.memo(({progress:e,isActive:t})=>{let r=Math.round(e*100);return jsxRuntime.jsx("div",{className:"story-progress-bar",role:"progressbar","aria-valuenow":t?r:e===1?100:0,"aria-valuemin":0,"aria-valuemax":100,"aria-label":`Story progress: ${r}%`,children:jsxRuntime.jsx("div",{className:"story-progress-bar-fill",style:{transform:`scaleX(${t?e:e===1?1:0})`}})})});he.displayName="ProgressBar";var ge=U.memo(({total:e,currentIndex:t,progress:r})=>jsxRuntime.jsx("div",{className:"story-progress-bars-container",children:Array.from({length:e}).map((o,u)=>jsxRuntime.jsx(he,{progress:u<t?1:u===t?r:0,isActive:u===t},u))}));ge.displayName="StoryProgressBars";var ve=U.memo(({item:e,isActive:t,isPaused:r,onDurationDetected:o,onLoadError:u,onBufferingChange:l,controls:a})=>{let i=U.useRef(null),[n,f]=U.useState(false),[y,s]=U.useState(true);U.useEffect(()=>{if(e.type!=="video"||!i.current||!t)return;let c=i.current;(async()=>{try{r?c.pause():await c.play();}catch(h){console.warn("Video play failed:",h);}})();},[e.type,t,r]),U.useEffect(()=>{if(e.type!=="video"||!i.current)return;let c=i.current,I=()=>{c.duration&&isFinite(c.duration)&&o?.(c.duration*1e3);},h=()=>{s(false);};return c.addEventListener("loadedmetadata",I),c.addEventListener("canplay",h),c.readyState>=1&&I(),c.readyState>=3&&h(),()=>{c.removeEventListener("loadedmetadata",I),c.removeEventListener("canplay",h);}},[e.type,o]),U.useEffect(()=>{if(e.type!=="video"||!i.current||!t)return;let c=i.current,I=()=>{l?.(true);},h=()=>{l?.(false);},L=()=>{l?.(true);};return c.addEventListener("waiting",I),c.addEventListener("playing",h),c.addEventListener("stalled",L),()=>{c.removeEventListener("waiting",I),c.removeEventListener("playing",h),c.removeEventListener("stalled",L);}},[e.type,t,l]),U.useEffect(()=>{if(e.type!=="video"||!i.current||!t)return;let c=i.current,I,h=()=>{c.duration&&isFinite(c.duration),I=requestAnimationFrame(h);};return I=requestAnimationFrame(h),()=>{cancelAnimationFrame(I);}},[e.type,t]);let d=U.useCallback(()=>{f(true),s(false),u?.();},[u]),g=U.useCallback(()=>{s(false);},[]);if(n)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:[y&&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:d,onLoad:g,draggable:false,style:{opacity:y?0:1}})]});case "video":return jsxRuntime.jsxs("div",{className:"story-item story-item-video",children:[y&&jsxRuntime.jsx("div",{className:"story-item-loader",children:jsxRuntime.jsx("div",{className:"story-item-spinner"})}),jsxRuntime.jsx("video",{ref:i,src:e.src,playsInline:true,loop:false,onError:d,preload:"auto",style:{opacity:y?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 c=e.component;return jsxRuntime.jsx("div",{className:"story-item story-item-component",children:jsxRuntime.jsx(c,{...a})});default:return null}});ve.displayName="StoryItem";var M=5e3,ne=U__default.default.memo(({users:e,initialUserIndex:t,initialStoryIndex:r,isOpen:o,onClose:u,onStoryChange:l})=>{let a=o===void 0,[i,n]=Ae(),f=U.useMemo(()=>{if(!a||e.length===0)return null;let p=new URLSearchParams(window.location.search),x=p.get("user"),w=p.get("story");if(!x)return null;let P=Me(e,x);if(P===-1)return null;let ee=e[P],pe=w?Be(ee,w):0;return {userIndex:P,storyIndex:pe===-1?0:pe}},[a,i,e]);U.useEffect(()=>{a&&i.get("user")&&e.length>0&&!f&&process.env.NODE_ENV==="development"&&console.warn(`[react-instagram-stories] User not found: "${i.get("user")}"
|
|
2
|
+
Available user IDs: ${e.map(p=>p.id).join(", ")}`);},[a,i,e,f]);let y=a?f?.userIndex??0:t??0,s=a?f?.storyIndex??0:r??0,d=a?f!==null:o??false,g=U.useCallback(()=>{a?n({},{replace:true}):u&&u();},[a,n,u]),[c,I]=U.useState(y),[h,L]=U.useState(s),[R,_]=U.useState(false);U.useEffect(()=>{I(y);},[y]),U.useEffect(()=>{L(s);},[s]);let[je,J]=U.useState(false),[Je,G]=U.useState(null),[Ge,se]=U.useState(false),[Ze,H]=U.useState(false),xe=U.useRef(null),we=U.useRef(0),Se=U.useRef(M),ae=U.useRef(false),ie=U.useRef(true),b=e[c],k=b?.stories[h],$=b?.stories.length||0;U.useEffect(()=>{Se.current=k?.duration||M;},[k?.duration]);let et=ke(d),le=Te(),{preloadStoryItem:ce}=De(),D=U.useCallback(()=>_(true),[]),z=U.useCallback(()=>_(false),[]),Ie=U.useRef(),v=Ue({duration:Se.current||M,onComplete:()=>Ie.current?.(),autoStart:false}),tt=U.useCallback(p=>{p?v.pause():R||v.resume();},[v,R]);U.useEffect(()=>{let p=k?.duration||M;v.setDuration(p);},[v,k?.duration]);let N=U.useCallback(()=>{if(b)if(h<$-1){let p=h+1,w=b.stories[p]?.duration||M;L(p),v.setDuration(w),v.reset();}else c<e.length-1?(H(true),setTimeout(()=>{J(true),G("left"),setTimeout(()=>{let p=c+1,P=e[p].stories[0]?.duration||M;I(p),L(0),J(false),G(null),H(false),v.setDuration(P),v.reset();},150);},1e3)):g();},[b,h,$,c,e,v,g]),Q=U.useCallback(()=>{if(b)if(h>0){let p=h-1,w=b.stories[p]?.duration||M;L(p),v.setDuration(w),v.reset();}else c>0&&(H(true),setTimeout(()=>{J(true),G("right"),setTimeout(()=>{let p=c-1,x=e[p],w=x.stories.length-1,ee=x.stories[w]?.duration||M;I(p),L(w),J(false),G(null),H(false),v.setDuration(ee),v.reset();},150);},1e3));},[b,h,c,e,v]),de=U.useCallback(()=>{window.scrollTo(0,we.current),g();},[g]);U.useEffect(()=>{Ie.current=N;},[N]);let rt=U.useMemo(()=>({pause:D,resume:z,next:N,prev:Q,setDuration:p=>v.setDuration(p)}),[D,z,N,Q,v]),ot=U.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=xe.current;if(!w)return;let P=w.getBoundingClientRect();p.clientX-P.left<P.width/2?Q():N();},[Q,N]),Z=U.useRef(null),ue=U.useRef(false),nt=U.useCallback(p=>{ue.current=false,Z.current={x:p.clientX,y:p.clientY},D();},[D]),st=U.useCallback(p=>{if(!Z.current)return;let x=p.clientX-Z.current.x,w=p.clientY-Z.current.y;(Math.abs(x)>10||Math.abs(w)>10)&&(ue.current=true);},[]);Le({onLeft:Q,onRight:N,onSpace:()=>R?z():D(),onEscape:de,enabled:d}),U.useEffect(()=>{le?le&&!R&&z():D();},[le,D,z,R]),U.useEffect(()=>{if(!d||!b)return;let p=[];h<$-1&&p.push(b.stories[h+1]),h>0&&p.push(b.stories[h-1]),c<e.length-1&&p.push(e[c+1].stories[0]),c>0&&p.push(e[c-1].stories[0]);let x=p.slice(0,3).map(w=>ce(w).catch(()=>{}));Promise.all(x);},[d,b,c,h,$,e,ce]),U.useEffect(()=>(d&&!ae.current?(ae.current=true,se(true),k&&ce(k),setTimeout(()=>{se(false),we.current=window.scrollY,document.body.style.overflow="hidden",v.resume();},1500)):d||(ae.current=false,ie.current=true,document.body.style.overflow="",se(false),H(false)),()=>{document.body.style.overflow="";}),[d,v]),U.useEffect(()=>{if(d){if(ie.current){ie.current=false,l&&l(c,h);return}if(a&&b&&k){let p=i.get("user"),x=i.get("story"),w=b.id,P=k.id;(p!==w||x!==P)&&n({user:w,story:P},{replace:true});}l&&l(c,h);}},[c,h,l,d,a,i,n]);let at=U.useCallback(()=>{console.warn("Story item failed to load, skipping..."),setTimeout(N,500);},[N]);if(!d||!b||!k)return null;let it=jsxRuntime.jsxs("div",{ref:xe,className:"story-viewer",role:"dialog","aria-modal":"true","aria-label":`Stories by ${b?.username||"user"}`,"aria-describedby":"story-viewer-description",children:[jsxRuntime.jsx("div",{className:"story-viewer-overlay",onClick:de}),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 ",h+1," of ",$," by"," ",b?.username]}),jsxRuntime.jsxs("div",{ref:et,className:`story-viewer-content ${je?`story-viewer-transitioning story-viewer-transition-${Je}`:""}`,onClick:ot,onPointerDown:nt,onPointerMove:st,onMouseEnter:D,onMouseLeave:z,children:[jsxRuntime.jsxs("div",{className:"story-viewer-header",children:[jsxRuntime.jsx(ge,{total:$,currentIndex:h,progress:v.progress}),jsxRuntime.jsxs("div",{className:"story-viewer-user-info",children:[jsxRuntime.jsx("img",{src:b.avatarUrl,alt:`${b.username} avatar`,className:"story-viewer-avatar"}),jsxRuntime.jsx("span",{className:"story-viewer-username",children:b.username})]}),jsxRuntime.jsx("button",{className:"story-viewer-close",onClick:de,"aria-label":"Close story viewer",type:"button",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"story-viewer-items",children:Ge||Ze?jsxRuntime.jsx("div",{className:"story-item-loader",children:jsxRuntime.jsx("div",{className:"story-item-spinner"})}):jsxRuntime.jsx(ve,{item:k,isActive:true,isPaused:R||ue.current,onDurationDetected:p=>v.setDuration(p),onLoadError:at,onBufferingChange:tt,controls:rt})}),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(it,document.body)});var Qe=({users:e})=>{let t=U.useCallback(r=>{let o=e[r];o&&o.stories.length>0&&ye({user:o.id,story:o.stories[0].id});},[e]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(X,{users:e,onAvatarClick:t}),jsxRuntime.jsx(ne,{users:e})]})};var qe=({pause:e,resume:t,next:r})=>{let[o,u]=U__default.default.useState(null),[l,a]=U__default.default.useState([42,28,18,12]);U__default.default.useEffect(()=>(e(),()=>t()),[e,t]);let i=y=>{u(y);let s=[...l];s[y]+=1,a(s),setTimeout(()=>{t(),r();},2e3);},n=l.reduce((y,s)=>y+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((y,s)=>{let d=Math.round(l[s]/n*100),g=o===s;return jsxRuntime.jsxs("button",{onClick:()=>o===null&&i(s),disabled:o!==null,style:{width:"100%",padding:"16px 20px",margin:"8px 0",border:"none",borderRadius:"12px",background:o!==null?`linear-gradient(90deg, rgba(255,255,255,0.4) ${d}%, rgba(255,255,255,0.15) ${d}%)`:"rgba(255,255,255,0.2)",color:"white",fontSize:"16px",fontWeight:"600",cursor:o===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 ",y]}),o!==null&&jsxRuntime.jsxs("span",{children:[d,"%"]})]},s)})}),o!==null&&jsxRuntime.jsxs("p",{style:{color:"rgba(255,255,255,0.8)",marginTop:"20px",fontSize:"14px"},children:[n," votes \u2022 Thanks for voting!"]})]})},Xe=({pause:e,resume:t,next:r})=>{let[o,u]=U__default.default.useState(false),[l,a]=U__default.default.useState(null),i=2;U__default.default.useEffect(()=>(e(),()=>t()),[e,t]);let n=y=>{a(y),u(true),setTimeout(()=>{t(),r();},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((y,s)=>{let d=s===i,g=l===s,c="rgba(255,255,255,0.2)";return o&&(d?c="rgba(34, 197, 94, 0.6)":g&&(c="rgba(239, 68, 68, 0.6)")),jsxRuntime.jsxs("button",{onClick:()=>!o&&n(s),disabled:o,style:{width:"100%",padding:"16px 20px",margin:"8px 0",border:"none",borderRadius:"12px",background:c,color:"white",fontSize:"16px",fontWeight:"600",cursor:o?"default":"pointer",transition:"all 0.3s ease",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsxRuntime.jsx("span",{children:y}),o&&d&&jsxRuntime.jsx("span",{children:"\u2713"}),o&&g&&!d&&jsxRuntime.jsx("span",{children:"\u2717"})]},s)})}),o&&jsxRuntime.jsx("p",{style:{color:"white",marginTop:"20px",fontSize:"16px",fontWeight:"bold"},children:l===i?"\u{1F389} Correct!":"\u274C Wrong! Jupiter is the largest."})]})},Nt=()=>{let[e,t]=U__default.default.useState({days:12,hours:8,minutes:45,seconds:30});U__default.default.useEffect(()=>{let o=setInterval(()=>{t(u=>{let{days:l,hours:a,minutes:i,seconds:n}=u;return n--,n<0&&(n=59,i--),i<0&&(i=59,a--),a<0&&(a=23,l--),{days:l,hours:a,minutes:i,seconds:n}});},1e3);return ()=>clearInterval(o)},[]);let r=({value:o,label:u})=>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(o).padStart(2,"0")})}),jsxRuntime.jsx("div",{style:{color:"rgba(255,255,255,0.8)",fontSize:"12px",marginTop:"8px",textTransform:"uppercase"},children:u})]});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(r,{value:e.days,label:"Days"}),jsxRuntime.jsx(r,{value:e.hours,label:"Hours"}),jsxRuntime.jsx(r,{value:e.minutes,label:"Mins"}),jsxRuntime.jsx(r,{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"})]})},Dt=()=>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"})]})]}),Ye=({pause:e,resume:t,next:r})=>{let[o,u]=U__default.default.useState(5),[l,a]=U__default.default.useState(false);U__default.default.useEffect(()=>(e(),()=>t()),[e,t]);let i=()=>{a(true),setTimeout(()=>{t(),r();},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}"][o-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?"}),l?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:o,onChange:f=>u(parseInt(f.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:i,style:{padding:"14px 50px",background:"white",border:"none",borderRadius:"30px",color:"#11998e",fontSize:"16px",fontWeight:"bold",cursor:"pointer"},children:["Submit (",o,"/10)"]})]})]})},j=["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"],Ke=["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"],be=[{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
|
|
|
3
|
-
Swipe to explore more destinations \u2192`,backgroundColor:"#FF6B6B",textColor:"#FFFFFF",duration:4e3},{id:"travel-4",type:"video",src:j[0],duration:15e3}]},{id:"user-polls",username:"Interactive",avatarUrl:
|
|
4
|
+
Swipe to explore more destinations \u2192`,backgroundColor:"#FF6B6B",textColor:"#FFFFFF",duration:4e3},{id:"travel-4",type:"video",src:j[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
|
|
|
5
|
-
Interactive stories ahead \u2192`,backgroundColor:"#667eea",textColor:"#FFFFFF",duration:3e3},{id:"poll-1",type:"custom_component",component
|
|
6
|
+
Interactive stories ahead \u2192`,backgroundColor:"#667eea",textColor:"#FFFFFF",duration:3e3},{id:"poll-1",type:"custom_component",component:qe,duration:3e4},{id:"quiz-1",type:"custom_component",component:Xe,duration:3e4},{id:"slider-1",type:"custom_component",component:Ye,duration:3e4}]},{id:"user-product",username:"Shop",avatarUrl:O[2],hasUnreadStories:true,stories:[{id:"product-1",type:"custom_component",component:Dt,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
|
|
|
7
8
|
50% OFF
|
|
8
9
|
|
|
9
|
-
Use code: STORY50`,backgroundColor:"#000000",textColor:"#FFFFFF",duration:5e3}]},{id:"user-launch",username:"Events",avatarUrl:
|
|
10
|
+
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:Nt,duration:1e4},{id:"launch-2",type:"text",text:`Mark your calendars! \u{1F4C5}
|
|
10
11
|
|
|
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:
|
|
12
|
+
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:j[1],duration:15e3},{id:"video-2",type:"video",src:j[2],duration:15e3},{id:"video-3",type:"text",text:`More videos coming soon! \u{1F3AC}
|
|
12
13
|
|
|
13
|
-
Stay tuned \u2192`,backgroundColor:"#4ECDC4",textColor:"#FFFFFF",duration:3e3}]},{id:"user-lifestyle",username:"Lifestyle",avatarUrl:
|
|
14
|
+
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
|
|
|
15
|
-
Nature heals everything`,backgroundColor:"#45B7D1",textColor:"#FFFFFF",duration:4e3}]}],
|
|
16
|
+
Nature heals everything`,backgroundColor:"#45B7D1",textColor:"#FFFFFF",duration:4e3}]}],At=(e=50)=>{let t=[...be];for(let r=be.length;r<e;r++){let o=Math.random()>.3,u=Math.floor(Math.random()*5)+2;t.push({id:`user-${r}`,username:`User ${r}`,avatarUrl:`https://i.pravatar.cc/150?img=${r%70}`,hasUnreadStories:o,stories:Array.from({length:u},(l,a)=>{let i=Math.random();if(i<.5)return {id:`story-${r}-${a}`,type:"image",src:Ke[Math.floor(Math.random()*Ke.length)],duration:5e3,alt:`Story from User ${r}`};if(i<.7)return {id:`story-${r}-${a}`,type:"video",src:j[Math.floor(Math.random()*j.length)],duration:15e3};if(i<.9){let f=["#FF6B6B","#4ECDC4","#45B7D1","#FFA07A","#98D8C8","#667eea","#764ba2"];return {id:`story-${r}-${a}`,type:"text",text:`Hello from User ${r}! \u{1F44B}
|
|
16
17
|
|
|
17
|
-
This is story ${a+1}`,backgroundColor:
|
|
18
|
+
This is story ${a+1}`,backgroundColor:f[Math.floor(Math.random()*f.length)],textColor:"#FFFFFF",duration:4e3}}let n=[qe,Xe,Ye];return {id:`story-${r}-${a}`,type:"custom_component",component:n[Math.floor(Math.random()*n.length)],duration:3e4}})});}return t};exports.AvatarList=X;exports.Stories=Qe;exports.StoryViewer=ne;exports.clearQueryParams=It;exports.demoUsers=be;exports.generateDemoUsers=At;exports.navigateWithParams=ye;//# sourceMappingURL=index.cjs.map
|
|
18
19
|
//# sourceMappingURL=index.cjs.map
|