import{u as k,r as u,a as M,G as N,w as h,c as $,n as z,o as D,b as x,d as B,e as F,v as O,f as w,g as b,h as P,i as S,l as R,E as V}from"./index-DmCbOAxb.js";import{e as r}from"./artplayer-ueyOVO3X.js";import{l as L,a as U}from"./containers-B-x1Py5x.js";import{_ as j}from"./_plugin-vue_export-helper-DlAUqK2U.js";const A={__name:"VideoContainer",props:{id:String,layoutId:String,partner:String,code:String},setup(_){const I=k();r.CONTEXTMENU=!1,r.NOTICE_TIME=0,r.CONTROL_HIDE_TIME=0,r.RECONNECT_TIME_MAX=10;const p="https://display24.ru",s=u(!1);let c=null;const i=_,e=M({id:null,displayCode:null,layoutId:null}),l=u(null),d=u(N(32));h(()=>I.mute,a=>{l.value&&(l.value.muted=a)});const C=$(()=>{var a,t,o,n,f,y,v,m,g;return{top:e.top+"px",left:e.left+"px",width:e.width+"px",height:e.height+"px",backgroundColor:z((a=e.background)==null?void 0:a.color)||"#000",zIndex:e.zIndex||0,borderColor:((t=e.border)==null?void 0:t.color)||"#fff",borderStyle:((o=e.border)==null?void 0:o.style)||"solid",borderWidth:(((n=e.border)==null?void 0:n.width)||0)+"px",borderRadius:((f=e.border)==null?void 0:f.radius)+"px",boxShadow:"".concat((y=e.shadow)==null?void 0:y.x,"px ").concat((v=e.shadow)==null?void 0:v.y,"px ").concat((m=e.shadow)==null?void 0:m.b,"px ").concat((g=e.shadow)==null?void 0:g.color)}}),E=a=>{var t,o;switch(a){case 1:return{objectFit:"fill",width:e.width+"px",height:e.height+"px"};case 2:return{objectFit:"cover",width:"100%",height:"100%"};default:return{objectFit:"none",width:((t=e.content)==null?void 0:t.width)+"px",height:((o=e.content)==null?void 0:o.height)+"px"}}};async function T(a){const t="https://cdn.display24.ru/partners/".concat(i.partner,"/").concat(a);return await V(t)}return D(async()=>{e.id=i.id,e.displayCode=i.code,e.layoutId=i.layoutId,await L(e,p,"VideoContainer (layouts)"),await U(e,s,p,"VideoContainer (schedule)"),c=setInterval(()=>{s.value=x(e==null?void 0:e.scheduleData)},1e3)}),h(()=>e.content,async a=>{if(!(a!=null&&a.filename))return;const t=document.querySelector(".video-"+d.value);if(t){const o=await T(a.filename);l.value&&l.value.destroy(!0),l.value=new r({container:t,url:o,poster:"/poster.png",autoSize:!0,miniProgressBar:!1,loop:!0,muted:!1,autoplay:!1,aspectRatio:!0,controls:[],volume:1,playsInline:!0,isLive:!1,mutex:!1,setting:!1,preload:"auto",clickToPlay:!1,show:!1,icons:{state:""},state:!1}),l.value&&l.value.play().catch(n=>{console.warn("Автозапуск заблокирован/ошибка",n)})}else console.error("Контейнер для плеера не найден")}),B(()=>{c&&clearInterval(c),l.value&&l.value.destroy(!1)}),h(()=>e.scheduleData,a=>{s.value=x(a)}),(a,t)=>{var o;return F((b(),w("div",{class:"container",style:S(C.value)},[P("",!0),(b(),w("div",{class:R("video-"+d.value),style:S(E((o=e.content)==null?void 0:o.mediaMode)),key:d.value},null,6))],4)),[[O,s.value]])}}},K=j(A,[["__scopeId","data-v-74f453a4"]]);export{K as default};
