PageSourceSearch

https://solana.stream/_next/static/chunks/2414.5dd9401461d18ed6.js

js solana.stream collected 2026-10-08 12:44:18 UTC 13,514 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2414,9771],{32414:(e,t,r)=>{r.r(t),r.d(t,{Notifications:()=>v});var s=r(95155),a=r(12115),n=r(31856),i=r(75889),c=r(6095),o=r(27499),l=r(33870),d=r(20063),m=r(85935),u=r(12037),h=r(21966),x=r(39390),p=r(24728);function f(e){if(e)return"object"==typeof e&&null!==e&&"toDate"in e&&"function"==typeof e.toDate?e.toDate():new Date(e)}let R=[u.Dc.STREAMER_LIVE,u.Dc.GIFT_SUBSCRIPTION,u.Dc.GIFT_PLATFORM_PASS,u.Dc.AIRDROP,u.Dc.SUBSCRIPTION_EXPIRING,u.Dc.PLATFORM_PASS_EXPIRING,u.Dc.LADDER_AD_FREE_REWARD,u.Dc.COLLECTION_GRIND_REWARD,u.Dc.REFERRAL_PAYOUT];function D(e){return e?Math.ceil((e.getTime()-Date.now())/864e5):0}function N(e){if(!0===e.isDismissed)return!1;if(e.type===u.Dc.SUBSCRIPTION_EXPIRING||e.type===u.Dc.PLATFORM_PASS_EXPIRING){let t=D(e.expirationDate);if(t>7||t<0)return!1}return!0}function I(e){return!e.isRead&&N(e)}var b=r(58352),g=r(59511),E=r(59771),y=r(13488),A=r(16595),_=r(28836);let v=e=>{let{userId:t,showText:r=!0}=e,{notifications:v,dismissNotification:S,markAsRead:P,markAllAsRead:j,dismissAllNotifications:w,unreadCount:F}=(e=>{let[t,r]=(0,a.useState)({notifications:[],unreadCount:0,isLoading:!0,error:null}),s=(0,a.useRef)([]),n=(0,a.useRef)(!0);(0,a.useEffect)(()=>{if(!e)return;n.current=!0;let t=(0,x.P)((0,x.rJ)(h.db,"notifications"),(0,x._M)("userId","==",e),(0,x._M)("type","in",[...R]),(0,x._M)("isDismissed","==",!1),(0,x.My)("timestamp","desc"),(0,x.AB)(50)),a=(0,x.aQ)(t,e=>{let t=e.docs.map(e=>(function(e,t){var r;let s={id:e,...t,timestamp:null!=(r=f(t.timestamp))?r:new Date,expirationDate:f(t.expirationDate)};return(s.type===u.Dc.SUBSCRIPTION_EXPIRING||s.type===u.Dc.PLATFORM_PASS_EXPIRING)&&s.expirationDate&&(s.daysRemaining=Math.max(0,D(s.expirationDate))),s})(e.id,e.data())).filter(N);if(s.current=t,n.current)n.current=!1;else for(let t of e.docChanges()){if("added"!==t.type)continue;let e=t.doc.data();if(e.type===u.Dc.GIFT_SUBSCRIPTION){let t="string"==typeof e.streamerId?e.streamerId:void 0;window.dispatchEvent(new CustomEvent(p.CR,{detail:t?{streamerId:t}:void 0}))}else e.type===u.Dc.GIFT_PLATFORM_PASS&&window.dispatchEvent(new CustomEvent(p._C))}r({notifications:t,unreadCount:t.filter(I).length,isLoading:!1,error:null})},e=>{r(t=>({...t,isLoading:!1,error:e.message}))});return()=>a()},[e]);let i=e=>{s.current=e,r(t=>({...t,notifications:e,unreadCount:e.filter(I).length}))},c=async e=>{let t=s.current,r=t.find(t=>t.id===e);if(r&&!r.isRead){i(t.map(t=>t.id===e?{...t,isRead:!0}:t));try{await (0,x.mZ)((0,x.H9)(h.db,"notifications",e),{isRead:!0,readAt:(0,x.O5)()})}catch(e){i(t),console.error("Failed to mark notification as read:",e)}}},o=async()=>{let e=s.current.filter(I);if(0!==e.length)try{for(let t=0;t<e.length;t+=500){let r=e.slice(t,t+500),s=(0,x.wP)(h.db);r.forEach(e=>{s.update((0,x.H9)(h.db,"notifications",e.id),{isRead:!0,readAt:(0,x.O5)()})}),await s.commit()}}catch(e){console.error("Failed to mark all notifications as read:",e)}},l=async e=>{let t=s.current;if(t.some(t=>t.id===e)){i(t.filter(t=>t.id!==e));try{await (0,x.mZ)((0,x.H9)(h.db,"notifications",e),{isDismissed:!0,dismissedAt:(0,x.O5)()})}catch(e){i(t),console.error("Failed to dismiss notification:",e)}}},d=async()=>{let e=s.current.filter(N);if(0!==e.length)try{for(let t=0;t<e.length;t+=500){let r=e.slice(t,t+500),s=(0,x.wP)(h.db);r.forEach(e=>{s.update((0,x.H9)(h.db,"notifications",e.id),{isDismissed:!0,dismissedAt:(0,x.O5)()})}),await s.commit()}}catch(e){console.error("Failed to dismiss all notifications:",e)}};return{...t,markAsRead:c,markAllAsRead:o,dismissNotification:l,dismissAllNotifications:d}})(t),[T,O]=(0,a.useState)(!1),{isSm:C}=(0,c.A)(),L=(0,d.useRouter)(),k=e=>{if(e.isRead||P(e.id),e.type===u.Dc.STREAMER_LIVE){(0,m.ID)(),L.push("/".concat(e.streamerName));return}if(e.type===u.Dc.PLATFORM_PASS_EXPIRING)return void window.dispatchEvent(new CustomEvent(p._$));e.type===u.Dc.AIRDROP&&((0,m.ID)(),L.push("/".concat(e.streamerName)))},M=(e,t)=>{e.preventDefault(),e.stopPropagation(),S(t)},G=e=>e?e.length>=32&&/^[A-Za-z0-9]+$/.test(e)?"".concat(e.slice(0,4),"...").concat(e.slice(-4)):e:"Unknown";return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("button",{onClick:()=>{(0,g.z5)(F),O(!0)},className:"cursor-pointer transition-colors hover:bg-theme-menu-hover-bg rounded-full relative ".concat(r?"flex gap-2 items-center transition-transform duration-200 hover:scale-110":"p-2"),children:[(0,s.jsx)(o.X,{}),r&&(0,s.jsx)("p",{className:"text-theme-text-primary text-sm",children:"Notifications"}),F>0&&(0,s.jsx)("span",{className:"absolute bg-theme-error text-white text-xs rounded-full h-4 flex items-center justify-center ".concat(F>9?"w-6 px-1":"w-4"," ").concat("top-1 right-0"),children:F>9?"9+":F})]}),(0,s.jsx)(n.cj,{open:T,onOpenChange:O,children:(0,s.jsx)(n.h,{className:(0,i.QP)("lg:w-[425px] w-full lg:!max-w-[425px] !h-[calc(100dvh-64px-var(--safe-top
1))] !inset-y-auto !top-[calc(64px+var(--safe-top))] !bottom-0 !z-[9998] flex flex-col [&>button]:z-50 [&>button]:!ring-0 [&>button]:!ring-offset-0 [&>button]:!bg-transparent [&>button]:focus:!ring-0 [&>button]:focus:!ring-offset-0 !bg-[var(--theme-surface,#1a1a1a)] !border-[var(--theme-border,#232B30)]",C&&"!border-l-0"),children:(0,s.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-6",children:[(0,s.jsxs)(n.Fm,{className:"shrink-0 pr-8",children:[(0,s.jsx)(n.qp,{className:"text-[var(--theme-text-primary,white)]",children:"Notifications"}),v.length>0&&(0,s.jsxs)("div",{className:"flex justify-between items-center mt-2",children:[(0,s.jsxs)("span",{className:"text-sm text-[var(--theme-text-muted,#9ca3af)] font-medium",children:["Recent (",F,")"]}),(0,s.jsxs)("div",{className:"flex gap-3",children:[F>0&&(0,s.jsx)("button",{type:"button",onClick:j,className:"text-sm text-[var(--theme-primary,#6366f1)] hover:opacity-80 transition-colors font-medium",children:"Read All"}),(0,s.jsx)("button",{type:"button",onClick:w,className:"text-sm text-[var(--theme-text-muted,#9ca3af)] hover:text-[var(--theme-text-secondary,#d1d5db)] transition-colors font-medium",children:"Clear All"})]})]})]}),(0,s.jsx)("div",{className:"flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto scrollbar-none",children:0===v.length?(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(0,s.jsx)("div",{className:"mb-4",children:(0,s.jsx)(o.X,{})}),(0,s.jsx)("h3",{className:"text-lg font-medium text-[var(--theme-text-secondary,#d1d5db)] mb-2",children:"No notifications yet"}),(0,s.jsx)("p",{className:"text-[var(--theme-text-muted,#6b7280)] text-sm",children:"You'll see updates about streams, subscriptions, and gifts here"})]}):v.map(e=>(0,s.jsxs)("div",{className:(0,i.QP)("flex items-start rounded-lg border transition-all",e.isRead?"bg-[var(--theme-bg-secondary,#374151)]/30 border-[var(--theme-border,#374151)]":"bg-[var(--theme-primary,#6366f1)]/10 border-[var(--theme-primary,#6366f1)]",e.type===u.Dc.STREAMER_LIVE&&"hover:shadow-lg"),children:[(0,s.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>k(e),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),k(e))},className:(0,i.QP)("min-w-0 flex-1 cursor-pointer px-4 py-3",e.isRead?"hover:bg-[var(--theme-bg-secondary,#374151)]/40":"hover:bg-[var(--theme-primary,#6366f1)]/20"),children:[(0,s.jsxs)("div",{className:"mb-2 overflow-hidden",children:[(0,s.jsx)("h4",{className:"text-[var(--theme-text-primary,white)] font-medium mb-1 overflow-hidden",children:(e=>{switch(e.type){case u.Dc.STREAMER_LIVE:return(0,s.jsxs)("div",{className:"flex items-center gap-1 flex-wrap",children:[(0,s.jsx)("span",{className:"text-theme-accent-text hover:opacity-80 transition-colors max-w-[180px] truncate inline-block",title:e.streamerName,children:G(e.streamerName)}),(0,s.jsx)("span",{className:"whitespace-nowrap",children:"is now live!"}),(0,s.jsx)("span",{className:"text-red-500",children:"\uD83D\uDD34"})]});case u.Dc.SUBSCRIPTION_EXPIRING:return(0,s.jsx)("div",{children:"Your subscription expires soon!"});case u.Dc.PLATFORM_PASS_EXPIRING:return(0,s.jsx)("div",{children:"Your Ad-Free Pass expires soon!"});case u.Dc.GIFT_SUBSCRIPTION:return(0,s.jsxs)("div",{className:"truncate",children:[G(e.gifterUsername)," gifted you a sub!"]});case u.Dc.GIFT_PLATFORM_PASS:return(0,s.jsxs)("div",{className:"truncate",children:[G(e.gifterUsername)," gifted you Ad-Free!"]});case u.Dc.SEASON_ENDING:return(0,s.jsxs)("div",{children:["Season ",e.seasonId," ends in ",e.daysRemaining," days!"]});case u.Dc.NEW_SEASON:return(0,s.jsxs)("div",{children:["Season ",e.seasonId," has begun! \uD83C\uDFAF"]});case u.Dc.AIRDROP:return(0,s.jsxs)("div",{className:"flex items-center gap-1 flex-wrap",children:[(0,s.jsx)("span",{className:"text-theme-accent-text hover:opacity-80 transition-colors max-w-[180px] truncate inline-block",title:e.streamerName,children:G(e.streamerName)}),(0,s.jsxs)("span",{className:"whitespace-nowrap",children:["sent you ",(0,E.N)(e.amount,e.token)," "]}),(e=>{switch(e){case u.UM.SOL:return(0,s.jsx)(y.W,{className:"size-4",size:16});case u.UM.USDC:return(0,s.jsx)(A.$,{className:"size-4",size:16});case u.UM.BONK:return(0,s.jsx)(_.o,{className:"size-4",size:16});default:return(0,s.jsx)(A.$,{className:"size-4",size:16})}})(e.token)]});case u.Dc.LADDER_AD_FREE_REWARD:case u.Dc.COLLECTION_GRIND_REWARD:return(0,s.jsx)("div",{children:"Ad-Free Pass unlocked"});case u.Dc.REFERRAL_PAYOUT:return(0,s.jsxs)("div",{children:["You earned $",
1Number(e.amountUsdc||0).toFixed(2)," from referrals"]});default:return null}})(e)}),(0,s.jsx)("p",{className:"text-[var(--theme-text-secondary,#d1d5db)] text-sm overflow-hidden",children:(e=>{switch(e.type){case u.Dc.STREAMER_LIVE:return(0,s.jsx)(s.Fragment,{children:"Come hang out and join the fun now."});case u.Dc.SUBSCRIPTION_EXPIRING:return(0,s.jsxs)("span",{className:"block truncate",children:[G(e.streamerName)," subscription ends in"," ",e.daysRemaining," days"]});case u.Dc.PLATFORM_PASS_EXPIRING:return(0,s.jsxs)("span",{className:"block truncate",children:["Ad-Free Pass ends in ",e.daysRemaining," days"]});case u.Dc.GIFT_SUBSCRIPTION:return(0,s.jsxs)("span",{className:"block truncate",children:["You have a"," ",e.subscriptionTier?e.subscriptionTier.replace(/([A-Z])/g," $1").toLowerCase():"1 month"," ","sub to ",G(e.streamerName)]});case u.Dc.GIFT_PLATFORM_PASS:return(0,s.jsxs)("span",{className:"block truncate",children:["You have a"," ",e.passTier?e.passTier.replace(/([A-Z])/g," $1").toLowerCase().trim():"1 month"," ","Ad-Free Pass"]});case u.Dc.SEASON_ENDING:return(0,s.jsxs)(s.Fragment,{children:["Current rank: ",e.currentRankName,". Keep climbing!"]});case u.Dc.NEW_SEASON:return(0,s.jsx)(s.Fragment,{children:e.lastSeasonRank?"Last season: ".concat(e.lastSeasonRank.rankName," • $").concat(e.lastSeasonRank.totalContributed.toFixed(2)):"Join the competition and climb the ranks!"});case u.Dc.AIRDROP:return(0,s.jsx)(s.Fragment,{children:"Thanks for the love. This one's for you!"});case u.Dc.LADDER_AD_FREE_REWARD:case u.Dc.COLLECTION_GRIND_REWARD:return(0,s.jsx)("span",{className:"block truncate",children:e.message});case u.Dc.REFERRAL_PAYOUT:return(0,s.jsx)("span",{className:"block truncate",children:e.message||"Paid daily in USDC to your wallet."});default:return null}})(e)})]}),(0,s.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,s.jsx)("span",{className:"text-xs text-[var(--theme-text-muted,#6b7280)]",children:(0,b.m)(e.timestamp).replace("about ","About ")}),(0,s.jsxs)("span",{className:"text-xs px-2 py-1 rounded-full font-medium ".concat(e.type===u.Dc.STREAMER_LIVE?"bg-theme-error-bg text-theme-error":e.type===u.Dc.SUBSCRIPTION_EXPIRING||e.type===u.Dc.PLATFORM_PASS_EXPIRING?"bg-theme-warning-bg text-theme-warning":e.type===u.Dc.AIRDROP?"bg-theme-success-bg text-theme-success":"bg-theme-accent-surface text-theme-accent-text"),children:[e.type===u.Dc.STREAMER_LIVE&&"following",e.type===u.Dc.SUBSCRIPTION_EXPIRING&&"subscription",e.type===u.Dc.PLATFORM_PASS_EXPIRING&&"ad-free pass",e.type===u.Dc.GIFT_SUBSCRIPTION&&"gifted sub",e.type===u.Dc.GIFT_PLATFORM_PASS&&"gifted ad-free",e.type===u.Dc.AIRDROP&&"airdrop",e.type===u.Dc.LADDER_AD_FREE_REWARD&&"ranking prize",e.type===u.Dc.COLLECTION_GRIND_REWARD&&"collection reward",e.type===u.Dc.REFERRAL_PAYOUT&&"referral"]})]})]}),(0,s.jsx)("button",{type:"button","aria-label":"Clear notification",onPointerDown:t=>M(t,e.id),onClick:t=>M(t,e.id),className:"mr-2 mt-2 shrink-0 flex h-8 w-8 items-center justify-center rounded-full border border-[var(--theme-border)] bg-[var(--theme-surface)] hover:opacity-80 transition-colors pointer-events-auto",children:(0,s.jsx)(l.A,{color:"var(--theme-text-muted)",size:"16px"})})]},e.id))})]})})})]})}},59771:(e,t,r)=>{r.d(t,{N:()=>i,ZV:()=>n,nc:()=>c,wO:()=>a});var s=r(54116);function a(e,t){if(0===e)return 0;let r=Math.pow(10,t-Math.ceil(Math.log10(e))),s=Math.round(e*r)/r;return e>20?new Intl.NumberFormat("en-US",{minimumFractionDigits:t,maximumFractionDigits:t}).format(e):s.toFixed(t)}let n=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(null==e)return"0";let r="string"==typeof e?parseFloat(e):e;if(isNaN(r))return"0";try{return r.toLocaleString("en-US",{minimumFractionDigits:t,maximumFractionDigits:t})}catch(e){return console.error("Error formatting number:",e),"0"}},i=(e,t)=>{if(null==e)return"0";let r="string"==typeof e?parseFloat(e):e;return isNaN(r)?"0":(0,s.vv)(r,t)},c=e=>e.replace(/^@/,"").normalize("NFD").trim().replace(/[^a-zA-Z0-9._]/g,"_")}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.