import{b as M,w as T,g as d,i as n,u as s,a as u,j as a,q as r,p as f,k as C,F as S,G as B,T as I,J as P,E as D,D as L}from"./vue-Cm77DuTi.js";import{u as N}from"./widget-jbnupkVY.js";import{M as V}from"./MkMarquee-C6oz-io9.js";import{M as j}from"./MkContainer-CNBcUt5w.js";import{Q as q,_ as E}from"./app-QjDgb7aF.js";import{s as F}from"./shuffle-BgiUUhZ3.js";import"./charts-3gEHPHRq.js";import"./media-DuCIZ-3n.js";const H={class:"ekmkgxbk"},G={key:1,class:"feed"},J={class:"item"},Q=["href","title"],g="rssTicker",R=M({__name:"rss-ticker",props:{widget:{}},emits:["updateProps"],setup(b,{expose:_,emit:v}){const w={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}},l=b,y=v,{widgetProps:t,configure:i}=N(g,w,l,y),p=u([]),c=u(!0);let m=u(0);const h=()=>{fetch(`/api/fetch-rss?url=${t.url}`,{}).then(k=>{k.json().then(e=>{t.shuffle&&F(e.items),p.value=e.items,c.value=!1,m.value++})})};return T(()=>t.url,h),q(h,Math.max(1e4,t.refreshIntervalSec*1e3),{immediate:!0,afterMounted:!0}),_({name:g,configure:i,id:l.widget?l.widget.id:null}),(k,e)=>{const x=D("MkLoading");return a(),d(j,{naked:s(t).transparent,"show-header":s(t).showHeader,class:"mkw-rss-ticker"},{header:n(()=>[...e[1]||(e[1]=[r("i",{class:"ph-rss ph-bold ph-lg"},null,-1),P("RSS",-1)])]),func:n(()=>[r("button",{class:"_button",onClick:e[0]||(e[0]=(...o)=>s(i)&&s(i)(...o))},[...e[2]||(e[2]=[r("i",{class:"ph-gear-six ph-bold ph-lg"},null,-1)])])]),default:n(()=>[r("div",H,[c.value?(a(),d(x,{key:0})):(a(),f("div",G,[C(I,{name:"change",mode:"default"},{default:n(()=>[(a(),d(V,{key:s(m),duration:s(t).duration,reverse:s(t).reverse},{default:n(()=>[(a(!0),f(S,null,B(p.value,o=>(a(),f("span",J,[r("a",{class:"link",href:o.link,rel:"nofollow noopener",target:"_blank",title:o.title},L(o.title),9,Q),e[3]||(e[3]=r("span",{class:"divider"},null,-1))]))),256))]),_:1},8,["duration","reverse"]))]),_:1})]))])]),_:1},8,["naked","show-header"])}}}),Y=E(R,[["__scopeId","data-v-f3c5f263"]]);export{Y as default};
//# sourceMappingURL=rss-ticker-BNhWPmyw.js.map
