import{u as P}from"./widget-qjKd4HCd.js";import{Q as C,i as p,f as D,W as z,n as A}from"./app-JmgyQoR0.js";import{b as E,a as n,e as L,h as u,t as c,u as f,z as l,E as h,H as v,y as N}from"./vue-y3KLWBaS.js";const S={key:0},V={key:1},_="slideshow",W=E({__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:s,configure:x,save:B}=P(_,w,i,b),t=n([]),r=n(!0),o=n(),a=n(),m=()=>{if(t.value.length===0)return;const e=Math.floor(Math.random()*t.value.length),d=`url(${t.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)},g=()=>{r.value=!0,D("drive/files",{folderId:s.folderId,type:"image/*",limit:100}).then(e=>{t.value=e,r.value=!1,o.value.style.backgroundImage="",a.value.style.backgroundImage="",m()})},M=()=>{z(!1).then(e=>{e!=null&&(s.folderId=e.id,B(),g())})};return C(m,1e4,{immediate:!1,afterMounted:!0}),L(()=>{s.folderId!=null&&g()}),k({name:_,configure:x,id:i.widget?i.widget.id:null}),(e,d)=>(u(),c("div",{class:"kvausudm _panel mkw-slideshow",style:N({height:l(s).height+"px"})},[f("div",{onClick:M},[l(s).folderId==null?(u(),c("p",S,h(l(p).ts.folder),1)):v("",!0),l(s).folderId!=null&&t.value.length===0&&!r.value?(u(),c("p",V,h(l(p).t("no-image")),1)):v("",!0),f("div",{ref_key:"slideA",ref:o,class:"slide a"},null,512),f("div",{ref_key:"slideB",ref:a,class:"slide b"},null,512)])],4))}}),T=A(W,[["__scopeId","data-v-ef7827ff"]]);export{T as default};
