System.register(["./index-legacy-kPmrjNKx.js","./_plugin-vue_export-helper-legacy-BVIICed7.js"],function(e,t){"use strict";var o,n,a,l,i,r,d,s,u,c,v,h,p,y,g,f,b,w,m;return{setters:[e=>{o=e.r,n=e.a,a=e.c,l=e.n,i=e.o,r=e.b,d=e.d,s=e.w,u=e.e,c=e.v,v=e.f,h=e.g,p=e.l,y=e.h,g=e.i,f=e.s,b=e.j,w=e.x},e=>{m=e._}],execute:function(){var t=document.createElement("style");t.textContent=".container[data-v-b9fa847b]{position:absolute}.content-image[data-v-b9fa847b]{max-width:100%;max-height:100%;object-fit:contain}.info[data-v-b9fa847b]{padding:20px;position:absolute;top:20px;left:20px;right:20px;background-color:rgba(0,0,0,.4);font-size:80%;border-radius:5px}\n/*$vite$:1*/",document.head.appendChild(t);const x=["src","alt"];e("default",m({__name:"ImageContainer",props:{id:String,layoutId:String,partner:String},setup(e){const t="https://display24.ru",m=o(null),I=o(!1);let O=null;const S=e,j=n({id:null,layoutId:null,content:null}),C=a(()=>{var e,t,o,n,a,i,r,d,s;return{top:j.top+"px",left:j.left+"px",width:j.width+"px",height:j.height+"px",backgroundColor:l(null===(e=j.background)||void 0===e?void 0:e.color)||"#000",zIndex:j.zIndex||0,borderColor:(null===(t=j.border)||void 0===t?void 0:t.color)||"#fff",borderStyle:(null===(o=j.border)||void 0===o?void 0:o.style)||"solid",borderWidth:((null===(n=j.border)||void 0===n?void 0:n.width)||0)+"px",borderRadius:(null===(a=j.border)||void 0===a?void 0:a.radius)+"px",boxShadow:`${null===(i=j.shadow)||void 0===i?void 0:i.x}px ${null===(r=j.shadow)||void 0===r?void 0:r.y}px ${null===(d=j.shadow)||void 0===d?void 0:d.b}px ${null===(s=j.shadow)||void 0===s?void 0:s.color}`}}),_=e=>{switch(e){case 1:return{objectFit:"fill",width:"100%",height:"100%"};case 2:return{objectFit:"cover",width:"100%",height:"100%"};default:return{objectFit:"none"}}};return i(async()=>{var e;j.id=S.id,j.layoutId=S.layoutId,await async function(){try{const n=(await g.get(`${t}/api/v1/player/layouts/${j.layoutId}?v=`+Date.now(),{headers:{"Content-Type":"application/json"},timeout:5e3})).data;if(!n||"object"!=typeof n||!0!==n.online)throw new Error("OFFLINE_OR_HTML_STUB_200");if(200==(null==n?void 0:n.code)){var e,o;let t=(null===(e=n.data)||void 0===e?void 0:e[0])||{};t=JSON.parse(JSON.stringify(t));let a=null===(o=t)||void 0===o?void 0:o.content.find(e=>e.id==j.id);a&&Object.assign(j,a),f("layouts",j.layoutId,t).then(e=>e&&console.info("ImageContainer (layouts): Сохранение данных в кэш")).catch(console.error)}else console.warn("ImageContainer (layouts): Нет данных")}catch(a){let e=await b("layouts",j.layoutId)||{};if(e=JSON.parse(JSON.stringify(e)),e){var n;let t=null===(n=e)||void 0===n?void 0:n.content.find(e=>e.id==j.id);return t&&Object.assign(j,t),console.warn("ImageContainer (layouts): Данные загружены из кэша"),!0}return console.error("ImageContainer (layouts): Нет данных в кэше."),!1}}(),await async function(){if(j.schedule)try{const n=(await g.get(`${t}/api/v1/player/schedules/${j.schedule}?v=`+Date.now(),{headers:{"Content-Type":"application/json"},timeout:5e3})).data;if(!n||"object"!=typeof n||!0!==n.online)throw new Error("OFFLINE_OR_HTML_STUB_200");if(200==(null==n?void 0:n.code)){var e,o;let t=(null===(e=n.data)||void 0===e?void 0:e[0])||{};t=JSON.parse(JSON.stringify(t));let a=(null===(o=t)||void 0===o?void 0:o.content)||null;Object.assign(j,{scheduleData:a}),I.value=r(null==j?void 0:j.scheduleData),f("schedule",j.schedule,t).then(e=>e&&console.info("ImageContainer (schedules): Сохранение данных в кэш")).catch(console.error)}else console.warn("ImageContainer (schedules): Нет данных")}catch(a){let e=await b("schedule",j.schedule)||{};if(e=JSON.parse(JSON.stringify(e)),e){var n;let t=(null===(n=e)||void 0===n?void 0:n.content)||null;return Object.assign(j,{scheduleData:t}),I.value=r(null==j?void 0:j.scheduleData),console.warn("ImageContainer (schedules): Данные загружены из кэша"),!0}return console.error("ImageContainer (schedules): Нет данных в кэше"),!1}}(),null!==(e=j.content)&&void 0!==e&&e.filename&&(m.value=await(async(e,t)=>{const o=`https://cdn.display24.ru/partners/${S.partner}/${e}`;return await w(o,t)})(j.content.filename,j.content.type)),O=setInterval(()=>{I.value=r(null==j?void 0:j.scheduleData)},1e3)}),d(()=>{O&&clearInterval(O)}),s(()=>j.scheduleData,e=>{I.value=r(e)}),(e,t)=>{var o,n;return u((h(),v("div",{class:"container",style:y(C.value)},[m.value?(h(),v("img",{key:0,src:m.value,alt:null===(o=j.content)||void 0===o?void 0:o.name,class:"content-image",style:y(_(null===(n=j.content)||void 0===n?void 0:n.mediaMode))},null,12,x)):p("",!0)],4)),[[c,I.value]])}}},[["__scopeId","data-v-b9fa847b"]]))}}});
