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