"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[3307,1391],{1391:function(e,t,s){s.r(t),s.d(t,{default:function(){return d}});var o=s(641),a=s(33);const r={class:"date-time"},i=["textContent"],h=["textContent"];function n(e,t,s,n,u,m){return(0,o.uX)(),(0,o.CE)("div",r,[m._showDate?((0,o.uX)(),(0,o.CE)("div",{key:0,class:"date",textContent:(0,a.v_)(e.formatDate(e.now))},null,8,i)):(0,o.Q3)("",!0),m._showTime?((0,o.uX)(),(0,o.CE)("div",{key:1,class:"time",textContent:(0,a.v_)(e.formatTime(e.now,m._showSeconds))},null,8,h)):(0,o.Q3)("",!0)])}var u=s(2002),m={name:"DateTime",mixins:[u.A],props:{showDate:{required:!1,default:!0},showTime:{required:!1,default:!0},showSeconds:{required:!1,default:!0}},computed:{_showTime(){return this.parseBoolean(this.showTime)},_showDate(){return this.parseBoolean(this.showDate)},_showSeconds(){return this.parseBoolean(this.showSeconds)}},data:function(){return{now:new Date}},methods:{refreshTime(){this.now=new Date}},mounted:function(){this.refreshTime(),setInterval(this.refreshTime,1e3)}},c=s(6262);const l=(0,c.A)(m,[["render",n],["__scopeId","data-v-ca42eb9c"]]);var d=l},5688:function(e,t,s){s.r(t),s.d(t,{default:function(){return v}});var o=s(641),a=s(33);const r={class:"image-carousel"},i={ref:"background",class:"background"},h=["src"],n={key:1,class:"row info-container"},u={class:"col-6 weather-container"},m={key:0},c={class:"col-6 date-time-container"};function l(e,t,s,l,d,w){const g=(0,o.g2)("Loading"),f=(0,o.g2)("Weather"),p=(0,o.g2)("DateTime");return(0,o.uX)(),(0,o.CE)("div",r,[d.images.length?(0,o.Q3)("",!0):((0,o.uX)(),(0,o.Wv)(g,{key:0})),(0,o.Lk)("div",i,null,512),(0,o.Lk)("img",{ref:"img",src:w.imgURL,alt:"Your carousel images",style:(0,a.Tr)({display:d.images.length?"block":"none"})},null,12,h),w._showDate||w._showTime?((0,o.uX)(),(0,o.CE)("div",n,[(0,o.Lk)("div",u,[w._showWeather?((0,o.uX)(),(0,o.Wv)(f,{key:1,"show-icon":w._showWeatherIcon,"show-summary":w._showWeatherSummary,"show-temperature":w._showTemperature,"icon-color":s.weatherIconColor,"icon-size":s.weatherIconSize,animate:w._animateWeatherIcon},null,8,["show-icon","show-summary","show-temperature","icon-color","icon-size","animate"])):((0,o.uX)(),(0,o.CE)("span",m," "))]),(0,o.Lk)("div",c,[w._showTime||w._showDate?((0,o.uX)(),(0,o.Wv)(p,{key:0,"show-date":w._showDate,"show-time":w._showTime,"show-seconds":w._showSeconds},null,8,["show-date","show-time","show-seconds"])):(0,o.Q3)("",!0)])])):(0,o.Q3)("",!0)])}var d=s(2002),w=s(9828),g=s(1391),f=s(5188),p={name:"ImageCarousel",components:{Weather:f["default"],DateTime:g["default"],Loading:w.A},mixins:[d.A],props:{imgDir:{type:String,required:!0},refreshSeconds:{type:Number,default:15},showDate:{default:!1},showTime:{default:!1},showSeconds:{default:!1},showWeather:{default:!1},showTemperature:{default:!0},showWeatherIcon:{default:!0},showWeatherSummary:{default:!0},weatherIconColor:{type:String,default:"white"},weatherIconSize:{type:Number,default:70},animateWeatherIcon:{default:!0}},data(){return{images:[],currentImage:void 0,loading:!1}},computed:{imgURL(){let e=8008;return"backend.http"in this.$root.config&&"port"in this.$root.config["backend.http"]&&(e=this.$root.config["backend.http"].port),"//"+window.location.hostname+":"+e+this.currentImage},_showDate(){return this.parseBoolean(this.showDate)},_showTime(){return this.parseBoolean(this.showTime)},_showSeconds(){return this.parseBoolean(this.showSeconds)},_showTemperature(){return this.parseBoolean(this.showTemperature)},_showWeather(){return this.parseBoolean(this.showWeather)},_showWeatherIcon(){return this.parseBoolean(this.showWeatherIcon)},_showWeatherSummary(){return this.parseBoolean(this.showWeatherSummary)},_animateWeatherIcon(){return this.parseBoolean(this.animateWeatherIcon)}},methods:{async refresh(){if(!this.images.length){this.loading=!0;try{this.images=await this.request("utils.search_web_directory",{directory:this.imgDir,extensions:[".jpg",".jpeg",".png"]}),this.shuffleImages()}finally{this.loading=!1}}this.images.length&&(this.currentImage=this.images.pop())},onNewImage(){if(this.$refs.img&&(this.$refs.background.style["background-image"]="url("+this.imgURL+")",this.$refs.img.style.width="auto",this.$refs.img.width>this.$refs.img.height)){const e=this.$refs.img.width/this.$refs.img.height;e>=4/3&&e<=16/9?this.$refs.img.style.width="100%":e<=4/3&&(this.$refs.img.style.height="100%")}},shuffleImages(){for(let e=this.images.length-1;e>0;e--){let t=Math.floor(Math.random()*(e+1)),s=this.images[e];this.images[e]=this.images[t],this.images[t]=s}}},mounted(){this.$refs.img.addEventListener("load",this.onNewImage),this.$refs.img.addEventListener("error",this.refresh),this.refresh(),setInterval(this.refresh,Math.round(1e3*this.refreshSeconds))}},_=s(6262);const y=(0,_.A)(p,[["render",l],["__scopeId","data-v-7b09a273"]]);var v=y}}]);
//# sourceMappingURL=3307.457ad5ac.js.map