"use strict";(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[3891],{63891(e,t,a){a.r(t),a.d(t,{default:()=>m}),a(43617),a(81975),a(93991);var l=a(36418),o=a(14778),s=a(85406),n=a(14696),r=a(14891),i=a(37266);const c=({content:e})=>{const t=(0,o.useIntl)(),a=(0,l.useRef)(null),[s,n]=(0,l.useState)(!1),[r,c]=(0,l.useState)(!1),d=()=>{n(!0),a.current?.play()};return l.createElement("div",{className:"preview-modal-content"},e.skuLabel&&e.skuLabel.defaultMessage&&l.createElement("div",{className:"preview-modal-content__sku-label"},l.createElement(i.A,{className:"preview-modal-content__sku-label-logo"}),l.createElement("span",null,t.formatMessage(e.skuLabel))),l.createElement("h2",{className:"preview-modal-content__title"},t.formatMessage(e.title)),l.createElement("div",{className:"preview-modal-content__subtitle"},t.formatMessage(e.subtitle)),e.videoUrl&&l.createElement("div",{className:"preview-modal-content__media-container"},e.videoUrl?e.videoUrl.endsWith(".mp4")||e.videoUrl.endsWith(".webm")||e.videoUrl.endsWith(".mov")?l.createElement("div",{className:"custom-video-wrapper",onMouseEnter:()=>s&&c(!0),onMouseLeave:()=>c(!1)},l.createElement("video",{ref:a,src:e.videoUrl,poster:e.videoPoster,controls:s&&r,loop:!0,"data-testid":"video-element",onClick:()=>{s||d()},onPause:()=>{n(!1)},onPlay:()=>n(!0)},l.createElement("track",{kind:"captions"})),!s&&l.createElement("button",{className:"custom-play-button",onClick:d,"aria-label":t.formatMessage({id:"cloud_preview_modal.play_video",defaultMessage:"Play video"})},l.createElement("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none"},l.createElement("circle",{cx:"24",cy:"24",r:"24",fill:"rgba(255,255,255,0.9)"}),l.createElement("polygon",{points:"20,16 34,24 20,32",fill:"#1e3a8a"})))):(e.videoUrl.endsWith(".jpg")||e.videoUrl.endsWith(".jpeg")||e.videoUrl.endsWith(".png")||e.videoUrl.endsWith(".gif")||e.videoUrl.endsWith(".webp"),l.createElement("img",{src:e.videoUrl,alt:t.formatMessage(e.title)})):null))};var d=a(35561);const m=({show:e,onClose:t,contentData:a})=>{const i=(0,o.useIntl)(),[m,u]=(0,l.useState)(0),v=a||d.j.filter(e=>"mission-ops"===e.useCase),p=(0,l.useCallback)(()=>{u(e=>Math.max(0,e-1))},[]),g=(0,l.useCallback)(()=>{u(e=>Math.min(v.length-1,e+1))},[v.length]),_=(0,l.useCallback)(()=>{t()},[t]),w=0===m,f=m===v.length-1;if(0===v.length)return null;const h=l.createElement("div",{className:"preview-modal-controller__footer"},l.createElement("div",{className:"preview-modal-controller__pagination"},l.createElement("div",{className:"preview-modal-controller__pagination-dots","data-testid":"pagination-dots"},v.map((e,t)=>l.createElement("div",{key:`dot-${t}`,className:"preview-modal-controller__dot "+(t===m?"preview-modal-controller__dot--active":"")}))),l.createElement("span",{className:"preview-modal-controller__page-counter"},m+1,"/",v.length)),l.createElement("div",{className:"preview-modal-controller__navigation-buttons"},w&&l.createElement(r.Button,{emphasis:"quaternary",onClick:_},i.formatMessage({id:"cloud_preview_modal.skip",defaultMessage:"Skip for now"})),!w&&l.createElement(r.Button,{emphasis:"tertiary",onClick:p},l.createElement(s.ArrowLeftIcon,{size:18}),i.formatMessage({id:"cloud_preview_modal.previous",defaultMessage:"Previous"})),l.createElement(r.Button,{emphasis:"primary",onClick:f?t:g},f?i.formatMessage({id:"cloud_preview_modal.done",defaultMessage:"Finish"}):l.createElement(l.Fragment,null,i.formatMessage({id:"cloud_preview_modal.next",defaultMessage:"Next"}),l.createElement(s.ArrowRightIcon,{size:18})))));return l.createElement(n.zW,{show:e,onHide:t,compassDesign:!0,enforceFocus:!0,ariaLabel:i.formatMessage({id:"cloud_preview_modal.aria_label",defaultMessage:"Cloud Preview Introduction"}),showHeader:!0,showCloseButton:!0,bodyPadding:!0,footerContent:h,className:"preview-modal-controller"},l.createElement(c,{content:v[m]}))}}}]);
//# sourceMappingURL=3891.d757ee6a596945e91425.js.map