import{r as x,a as C,c as k,n as B,o as O,b as i,d as m,w as D,e as N,v as j,f as I,g as J,h as $,i as f,s as w,j as S}from"./index-DNcc_XYj.js";import{_ as L}from"./_plugin-vue_export-helper-DlAUqK2U.js";const T={__name:"BlankContainer",props:{id:String,layoutId:String,partner:String},setup(b){const u="https://display24.ru",r=x(!1);let c=null;const d=b;let e=C({id:null,layoutId:null,schedule:null});const g=k(()=>{var n,l,t,a,o,s,h,p,y;return{top:e.top+"px",left:e.left+"px",width:e.width+"px",height:e.height+"px",backgroundColor:B((n=e.background)==null?void 0:n.color)||"#000",zIndex:e.zIndex||0,borderColor:((l=e.border)==null?void 0:l.color)||"#fff",borderStyle:((t=e.border)==null?void 0:t.style)||"solid",borderWidth:(((a=e.border)==null?void 0:a.width)||0)+"px",borderRadius:((o=e.border)==null?void 0:o.radius)+"px",boxShadow:"".concat((s=e.shadow)==null?void 0:s.x,"px ").concat((h=e.shadow)==null?void 0:h.y,"px ").concat((p=e.shadow)==null?void 0:p.b,"px ").concat((y=e.shadow)==null?void 0:y.color)}});async function v(){var n;try{const t=(await f.get("".concat(u,"/api/v1/player/layouts/").concat(e.layoutId,"?v=")+Date.now(),{headers:{"Content-Type":"application/json"},timeout:5e3})).data;if(!t||typeof t!="object"||t.online!==!0)throw new Error("OFFLINE_OR_HTML_STUB_200");if((t==null?void 0:t.code)==200){let a=((n=t.data)==null?void 0:n[0])||{};a=JSON.parse(JSON.stringify(a));let o=a==null?void 0:a.content.find(s=>s.id==e.id);o&&Object.assign(e,o),w("layouts",e.layoutId,a).then(s=>s&&console.info("BlankContainer (layouts): Сохранение данных в кэш")).catch(console.error)}else console.warn("BlankContainer (layouts): Нет данных")}catch(l){let t=await S("layouts",e.layoutId)||{};if(t=JSON.parse(JSON.stringify(t)),t){let a=t==null?void 0:t.content.find(o=>o.id==e.id);return a&&Object.assign(e,a),console.warn("BlankContainer (layouts): Данные загружены из кэша"),!0}else return console.error("BlankContainer (layouts): Нет данных в кэше."),!1}}async function _(){var n;if(e.schedule)try{const t=(await f.get("".concat(u,"/api/v1/player/schedules/").concat(e.schedule,"?v=")+Date.now(),{headers:{"Content-Type":"application/json"},timeout:5e3})).data;if(!t||typeof t!="object"||t.online!==!0)throw new Error("OFFLINE_OR_HTML_STUB_200");if((t==null?void 0:t.code)==200){let a=((n=t.data)==null?void 0:n[0])||{};a=JSON.parse(JSON.stringify(a));let o=(a==null?void 0:a.content)||null;Object.assign(e,{scheduleData:o}),r.value=i(e==null?void 0:e.scheduleData),w("schedule",e.schedule,a).then(s=>s&&console.info("BlankContainer (schedules): Сохранение данных в кэш")).catch(console.error)}else console.warn("BlankContainer (schedules): Нет данных")}catch(l){let t=await S("schedule",e.schedule)||{};if(t=JSON.parse(JSON.stringify(t)),t){let a=(t==null?void 0:t.content)||null;return Object.assign(e,{scheduleData:a}),r.value=i(e==null?void 0:e.scheduleData),console.warn("BlankContainer (schedules): Данные загружены из кэша"),!0}else return console.error("BlankContainer (schedules): Нет данных в кэше"),!1}}return O(async()=>{e.id=d.id,e.layoutId=d.layoutId,await v(),await _(),c=setInterval(()=>{r.value=i(e==null?void 0:e.scheduleData)},1e3)}),m(()=>{c&&clearInterval(c)}),D(()=>e.scheduleData,n=>{r.value=i(n)}),(n,l)=>N((J(),I("div",{class:"container",style:$(g.value)},null,4)),[[j,r.value]])}},z=L(T,[["__scopeId","data-v-fd167a09"]]);export{z as default};
