import{u as D}from"./widget-jbnupkVY.js";import{Q as P,d as C,b as g,W as A,_ as L}from"./app-QjDgb7aF.js";import{b as N,c as S,p as u,q as c,u as l,D as v,H as h,t as V,a as n,j as f}from"./vue-Cm77DuTi.js";import"./charts-3gEHPHRq.js";import"./media-DuCIZ-3n.js";const W={key:0},j={key:1},_="slideshow",q=N({__name:"slideshow",props:{widget:{}},emits:["updateProps"],setup(y,{expose:k,emit:I}){const w={height:{type:"number",default:300},folderId:{type:"string",default:null,hidden:!0}},i=y,b=I,{widgetProps:t,configure:x,save:B}=D(_,w,i,b),s=n([]),r=n(!0),o=n(),a=n(),m=()=>{if(s.value.length===0)return;const e=Math.floor(Math.random()*s.value.length),d=`url(${s.value[e].url})`;a.value.style.backgroundImage=d,a.value.classList.add("anime"),window.setTimeout(()=>{o.value!=null&&(o.value.style.backgroundImage=d,a.value.classList.remove("anime"))},1e3)},p=()=>{r.value=!0,C("drive/files",{folderId:t.folderId,type:"image/*",limit:100}).then(e=>{s.value=e,r.value=!1,o.value.style.backgroundImage="",a.value.style.backgroundImage="",m()})},M=()=>{A(!1).then(e=>{e!=null&&(t.folderId=e.id,B(),p())})};return P(m,1e4,{immediate:!1,afterMounted:!0}),S(()=>{t.folderId!=null&&p()}),k({name:_,configure:x,id:i.widget?i.widget.id:null}),(e,d)=>(f(),u("div",{class:"kvausudm _panel mkw-slideshow",style:V({height:l(t).height+"px"})},[c("div",{onClick:M},[l(t).folderId==null?(f(),u("p",W,v(l(g).ts.folder),1)):h("",!0),l(t).folderId!=null&&s.value.length===0&&!r.value?(f(),u("p",j,v(l(g).t("no-image")),1)):h("",!0),c("div",{ref_key:"slideA",ref:o,class:"slide a"},null,512),c("div",{ref_key:"slideB",ref:a,class:"slide b"},null,512)])],4))}}),T=L(q,[["__scopeId","data-v-ef7827ff"]]);export{T as default};
//# sourceMappingURL=slideshow-BrtGCs3F.js.map
