import{b as I,a as c,w as S,D as T,h as t,i as u,j as l,K as C,u as a,z as s,t as p,l as B,F as P,G as D,E as L,T as N,I as V,J as j}from"./vue-y3KLWBaS.js";import{u as E}from"./widget-qjKd4HCd.js";import{M as F}from"./MkMarquee-aUfIJ8Oe.js";import{M as H}from"./MkContainer-6laePfDX.js";import{Q as q,n as z}from"./app-JmgyQoR0.js";import{s as G}from"./shuffle-SQ0_zvAE.js";const f=o=>(V("data-v-7afb5c6a"),o=o(),j(),o),J=f(()=>a("i",{class:"ph-rss ph-bold ph-lg"},null,-1)),K=f(()=>a("i",{class:"ph-gear-six ph-bold ph-lg"},null,-1)),Q=[K],R={class:"ekmkgxbk"},W={key:1,class:"feed"},$={class:"item"},A=["href","title"],O=f(()=>a("span",{class:"divider"},null,-1)),b="rssTicker",U=I({__name:"rss-ticker",props:{widget:{}},emits:["updateProps"],setup(o,{expose:v,emit:w}){const y={url:{type:"string",default:"http://feeds.afpbb.com/rss/afpbb/afpbbnews"},shuffle:{type:"boolean",default:!0},refreshIntervalSec:{type:"number",default:60},duration:{type:"range",default:70,step:1,min:5,max:200},reverse:{type:"boolean",default:!1},showHeader:{type:"boolean",default:!1},transparent:{type:"boolean",default:!1}},i=o,x=w,{widgetProps:e,configure:d}=E(b,y,i,x),h=c([]),m=c(!0);let _=c(0);const k=()=>{fetch(`/api/fetch-rss?url=${e.url}`,{}).then(g=>{g.json().then(r=>{e.shuffle&&G(r.items),h.value=r.items,m.value=!1,_.value++})})};return S(()=>e.url,k),q(k,Math.max(1e4,e.refreshIntervalSec*1e3),{immediate:!0,afterMounted:!0}),v({name:b,configure:d,id:i.widget?i.widget.id:null}),(g,r)=>{const M=T("MkLoading");return t(),u(H,{naked:s(e).transparent,"show-header":s(e).showHeader,class:"mkw-rss-ticker"},{header:l(()=>[J,C("RSS")]),func:l(()=>[a("button",{class:"_button",onClick:r[0]||(r[0]=(...n)=>s(d)&&s(d)(...n))},Q)]),default:l(()=>[a("div",R,[m.value?(t(),u(M,{key:0})):(t(),p("div",W,[B(N,{name:"change",mode:"default"},{default:l(()=>[(t(),u(F,{key:_.value,duration:s(e).duration,reverse:s(e).reverse},{default:l(()=>[(t(!0),p(P,null,D(h.value,n=>(t(),p("span",$,[a("a",{class:"link",href:n.link,rel:"nofollow noopener",target:"_blank",title:n.title},L(n.title),9,A),O]))),256))]),_:1},8,["duration","reverse"]))]),_:1})]))])]),_:1},8,["naked","show-header"])}}}),ae=z(U,[["__scopeId","data-v-7afb5c6a"]]);export{ae as default};
