System.register(["./index-legacy-BiCnHnDr.js","./mustache-legacy-B5bDMn3J.js","./containers-legacy-DlhFG1K3.js","./_plugin-vue_export-helper-legacy-BVIICed7.js"],function(t,e){"use strict";var o,n,a,l,d,i,r,c,s,u,v,p,h,g,y,m,w,f,x,b,C,S,T,$,_;return{setters:[t=>{o=t.u,n=t.r,a=t.a,l=t.c,d=t.n,i=t.o,r=t.b,c=t.d,s=t.w,u=t.e,v=t.v,p=t.f,h=t.g,g=t.h,y=t.k,m=t.l,w=t.i,f=t.p,x=t.q,b=t.s,C=t.x},t=>{S=t.m},t=>{T=t.l,$=t.a},t=>{_=t._}],execute:function(){var e=document.createElement("style");e.textContent='@charset "UTF-8";.container[data-v-46c5d163]{position:absolute;overflow:hidden}.content[data-v-46c5d163]{width:100%;height:100%;color:#000}.content[data-v-46c5d163] *{color:inherit}.content.original[data-v-46c5d163]{display:block;margin:auto}.content.stretch[data-v-46c5d163]{width:100%;height:100%}.content.crop[data-v-46c5d163]{width:100%;height:100%;overflow:hidden}\n/*$vite$:1*/',document.head.appendChild(e);const I=["innerHTML"];t("default",_({__name:"TemplateContainer",props:{id:String,layoutId:String,partner:String,code:String},setup(t){o();const e="https://display24.ru",_=n(!1);let j=null;const D=t;let k=a({id:null,displayCode:null,layoutId:null,content:null,templateString:"",html:""});const M=l(()=>{var t,e,o,n,a,l,i,r,c;return{top:k.top+"px",left:k.left+"px",width:k.width+"px",height:k.height+"px",backgroundColor:d(null===(t=k.background)||void 0===t?void 0:t.color)||"#000",zIndex:k.zIndex||0,borderColor:(null===(e=k.border)||void 0===e?void 0:e.color)||"#fff",borderStyle:(null===(o=k.border)||void 0===o?void 0:o.style)||"solid",borderWidth:((null===(n=k.border)||void 0===n?void 0:n.width)||0)+"px",borderRadius:(null===(a=k.border)||void 0===a?void 0:a.radius)+"px",boxShadow:`${null===(l=k.shadow)||void 0===l?void 0:l.x}px ${null===(i=k.shadow)||void 0===i?void 0:i.y}px ${null===(r=k.shadow)||void 0===r?void 0:r.b}px ${null===(c=k.shadow)||void 0===c?void 0:c.color}`}}),F=l(()=>{if(!k.content)return"";switch(k.content.mediaMode){case 1:return"stretch";case 2:return"crop";default:return"original"}});async function L(){var t;const e=["Понедельник","Вторник","Среда","Четверг","Пятница","Суббота","Воскресенье"][((new Date).getDay()+6)%7],o=function(){const t=new Date;return`${String(t.getDate()).padStart(2,"0")}.${String(t.getMonth()+1).padStart(2,"0")}.${t.getFullYear()}`}(),n=D.code;k.templateString=(null===(t=k.content)||void 0===t?void 0:t.code)||"";const a=S.render(k.templateString,{todayDate:o,todayWeekday:e,displayCode:n});k.html!=a&&(k.html=a.length?a:'<div style="display: flex; justify-content: center; align-items: center; width: 100vw; height: 100vh; color: #fff; background-color: #000;">No template data</div>')}return i(async()=>{k.id=D.id,k.displayCode=D.code,k.layoutId=D.layoutId,await T(k,e,"TemplateContainer (layouts)"),await $(k,_,e,"TemplateContainer (schedule)"),await async function(){var t;const o=null===(t=k.content)||void 0===t?void 0:t.id;try{const t=(await f.get(`${e}/api/v1/player/templates/${o}?v=`+Date.now(),{headers:{"Content-Type":"application/json"},timeout:5e3})).data;if(!t||"object"!=typeof t||!0!==t.online)throw new Error("OFFLINE_OR_HTML_STUB_200");if(200==(null==t?void 0:t.code)){var n;const e=(null===(n=t.data)||void 0===n?void 0:n[0])||{};k.content.code=x(null==e?void 0:e.code),b("templates",o,e).then(t=>t&&console.info("TemplateContainer (templates): Сохранение данных в кэш")).catch(console.error)}else console.warn("TemplateContainer (templates): Нет данных")}catch(a){let t=await C("templates",o)||{};return t?(k.content.code=x(null==t?void 0:t.code),console.warn("TemplateContainer (templates): Данные загружены из кэша"),!0):(console.error("TemplateContainer (templates): Нет данных в кэше"),!1)}}(),await L(),j=setInterval(()=>{_.value=r(null==k?void 0:k.scheduleData),L()},1e3)}),c(()=>{j&&clearInterval(j)}),s(()=>k.scheduleData,t=>{_.value=r(t)}),(t,e)=>{var o;return u((h(),p("div",{class:"container",style:w(M.value)},[g("",!0),null!==(o=y(k).content)&&void 0!==o&&o.code?(h(),p("div",{key:1,class:m(["content",F.value]),innerHTML:y(k).html},null,10,I)):g("",!0)],4)),[[v,_.value]])}}},[["__scopeId","data-v-46c5d163"]]))}}});
