!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},l=(new e.Error).stack;l&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[l]="925cbef8-5566-4989-a097-032e7cc31dd3",e._sentryDebugIdIdentifier="sentry-dbid-925cbef8-5566-4989-a097-032e7cc31dd3")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7665],{87665:(e,l,t)=>{t.d(l,{Z:()=>u});var s=t(57437),n=t(97183),i=t(16871),r=t(17090),a=t(9450),c=t(2265),o=t(47086);function d(e){var l,t,i;let{attachments:a,showNavigation:d}=e,[u,x]=(0,c.useState)(0);function h(e){console.log("inside handleIndex = ",e,a.length,a),e>-1&&e<a.length&&(console.log("inside handleIndex if"),x(()=>e))}return(0,c.useEffect)(()=>{x(0)},[a]),(0,s.jsxs)("div",{className:"flex items-center justify-center w-full",children:[d?(0,s.jsx)("div",{className:"w-6",children:u>0?(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-6 h-6 cursor-pointer",onClick:()=>h(u-1),children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5 8.25 12l7.5-7.5"})}):null}):null,(0,s.jsx)("div",{className:"w-full flex justify-center items-center",children:a[u]?(0,s.jsx)(o.Z,{mediaUrl:a[u].type===r.AttachmentType.IMAGE?"".concat((0,n.h6)(null===(l=a[u])||void 0===l?void 0:l.path)):"".concat("https://data.livesports.ai").concat(null===(t=a[u])||void 0===t?void 0:t.path),mediaType:null===(i=a[u])||void 0===i?void 0:i.type,setOpenPlayMedia:!1,inline:!0,onComplete:function(){d||h(u+1)}}):null}),d?(0,s.jsx)("div",{className:"w-6",children:u<a.length-1?(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-6 h-6 cursor-pointer",onClick:()=>h(u+1),children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m8.25 4.5 7.5 7.5-7.5 7.5"})}):null}):null]})}function u(e){var l,t,c,o,u,x,h;let{announcement:f,setOpenViewAnnouncement:m}=e,{user:v}=(0,i.a)();return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"fixed inset-0 z-10 overflow-y-auto",children:[(0,s.jsx)("div",{className:"fixed inset-0 w-full h-full bg-black opacity-40",children:"\xa0"}),(0,s.jsx)("div",{className:"flex items-center min-h-screen px-4 py-8",children:(0,s.jsx)("div",{className:"relative w-full max-w-lg mx-auto bg-gray-900 rounded-md shadow-lg mt-14",children:(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center bg-gray-700 h-12 px-3 rounded-t",children:[(0,s.jsx)("h4",{className:"text-lg font-medium text-white",children:"Announcement Detail"}),(0,s.jsx)("div",{children:(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"#ffffff",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-6 h-6 cursor-pointer text-red-600",onClick:()=>m(!1),children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),(0,s.jsx)("div",{className:"text-center sm:text-left max-h-screen overflow-y-scroll text-white",style:{maxHeight:"calc(100vh - 200px)"},children:(0,s.jsx)("div",{children:(0,s.jsxs)("div",{className:"w-full flex flex-wrap",children:[(0,s.jsx)("div",{className:"w-full py-4 px-2 flex flex-col text-xl font-bold items-start",children:(0,s.jsx)("p",{children:null==f?void 0:f.title})}),(0,s.jsxs)("div",{className:"w-full py-4 px-2 flex items-start justify-between italic",children:[(0,s.jsx)("p",{children:null==f?void 0:null===(l=f.club)||void 0===l?void 0:l.name}),(0,s.jsx)("p",{children:a.ou.fromISO(null==f?void 0:null===(t=f.createdAt)||void 0===t?void 0:t.toString(),{zone:"utc"}).toLocal().toRelative()})]}),(0,s.jsx)("div",{className:"w-full py-4 px-2 flex flex-col items-start whitespace-pre-line",children:function(e){if(!e)return(0,s.jsx)("div",{});{let l=e.replace(/(https?:\/\/[^\s]+)/g,'<a class="announcement-description-link" href="$1" target="_blank">$1</a>').replace(/([\w.-]+@[a-zA-Z_-]+?(?:\.[a-zA-Z]{2,6})+)/g,'<a class="announcement-description-link" href="mailto:$1">$1</a>');return(0,s.jsx)("div",{dangerouslySetInnerHTML:{__html:l}})}}(null==f?void 0:f.description)}),(null==f?void 0:null===(c=f.attachments)||void 0===c?void 0:c.length)>0?(0,s.jsx)(d,{attachments:null==f?void 0:f.attachments,showNavigation:!0}):null,(null==v?void 0:v.role)===r.Role.COACH&&(0,s.jsxs)("div",{className:"flex flex-col",children:[(null==f?void 0:f.author)?(0,s.jsx)("div",{className:"w-full py-4 px-2 flex flex-col items-start",children:(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("img",{alt:"profile",className:"h-10 w-10 rounded-full",src:(0,n.h6)(null==f?void 0:null===(o=f.author)||void 0===o?void 0:o.profileImage)}),(0,s.jsx)("p",{className:"pl-2",children:"".concat(null==f?void 0:null===(u=f.author)||void 0===u?void 0:u.firstName," ").concat(null==f?void 0:null===(x=f.author)||void 0===x?void 0:x.lastName)})]})}):(0,s.jsx)("div",{className:"w-full py-4 px-2 flex flex-col items-start",children:(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("img",{alt:"thumbnail",className:"h-10 w-10 rounded-full",src:"/thumbnail.png"}),(0,s.jsx)("p",{className:"pl-2",children:"Live Sports AI"})]})}),(0,s.jsxs)("div",{className:"w-full py-4 px-2 flex items-start",children:[(0,s.jsx)("h1",{className:"mr-1",children:"Expires On:"}),(0,s.jsx)("p",{children:a.ou.fromISO(null==f?void 0:null===(h=f.expiresAt)||void 0===h?void 0:h.toString(),{zone:"utc"}).toLocal().toLocaleString(a.ou.DATE_MED_WITH_WEEKDAY)})]})]})]})})}),(0,s.jsx)("div",{className:"flex justify-end bg-gray-700 items-center h-12 px-3 rounded-b",children:"\xa0"})]})})})]})})}},47086:(e,l,t)=>{t.d(l,{Z:()=>r});var s=t(57437),n=t(17090),i=t(2265);function r(e){let{mediaUrl:l,mediaType:t,setOpenPlayMedia:r,inline:a,onComplete:c,videoPlayerStyle:o,imageStyle:d,fullScreen:u}=e,x=(0,i.useRef)(null),h=(0,i.useRef)(null);function f(){return(0,s.jsxs)("div",{className:"".concat(u?"w-full flex items-center justify-center":""),children:[l&&t===n.AttachmentType.VIDEO&&(0,s.jsx)("video",{src:l,muted:!0,ref:x,autoPlay:!0,controls:!0,style:o||{height:"350px"}}),l&&t===n.AttachmentType.AUDIO&&(0,s.jsx)("audio",{src:l,autoPlay:!0,ref:h,controls:!0}),l&&t===n.AttachmentType.IMAGE&&(0,s.jsx)("img",{src:l,alt:"Attachment",className:"w-auto ".concat(d?"":"max-h-[350px]"),style:d||{}})]})}return i.useEffect(()=>{if(t===n.AttachmentType.VIDEO){let e=()=>{console.log("Video has ended"),c&&(console.log("inside if of play media"),c())},l=x.current;return l&&(l.addEventListener("ended",e),l.play().catch(e=>{console.error("Error attempting to play the video:",e)})),()=>{l&&l.removeEventListener("ended",e)}}if(t===n.AttachmentType.AUDIO){let e=()=>{console.log("Audio has ended"),c&&(console.log("inside if of play media"),c())},l=h.current;return l&&l.addEventListener("ended",e),()=>{l&&l.removeEventListener("ended",e)}}t===n.AttachmentType.IMAGE&&setTimeout(()=>{c&&c()},1e4)},[l,t]),(0,s.jsx)(s.Fragment,{children:a?(0,s.jsx)("div",{className:"text-center sm:text-left",children:(0,s.jsx)("div",{className:"".concat(u?"":"h-96 w-full"," flex justify-center items-center"),children:f()})}):(0,s.jsxs)("div",{className:"fixed inset-0 z-10 overflow-y-auto",children:[(0,s.jsx)("div",{className:"fixed inset-0 w-full h-full bg-black opacity-40",children:"\xa0"}),(0,s.jsx)("div",{className:"flex items-center min-h-screen px-4 py-8",children:(0,s.jsx)("div",{className:"relative w-full max-w-lg mx-auto bg-gray-900 rounded-md shadow-lg mt-14",children:(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center bg-gray-700 h-12 px-3 rounded-t",children:[(0,s.jsx)("h4",{className:"text-lg font-medium text-white",children:"".concat(t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()," Player")}),(0,s.jsx)("div",{children:(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"#ffffff",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-6 h-6 cursor-pointer text-red-600",onClick:()=>r(!1),children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),(0,s.jsx)("div",{className:"text-center sm:text-left",children:(0,s.jsx)("div",{className:"h-96 w-full max-h-screen overflow-y-scroll flex justify-center items-center",style:{maxHeight:"calc(100vh - 200px)"},children:f()})})]})})})]})})}}}]);