import{b7 as Q,u as U,Q as I,r as _,p as B,O as X,bM as Y,aY as o,aT as e,a$ as n,bc as A,b9 as i,N as r,a_ as u,bg as E,bh as R,b0 as y,bN as j,c as q,ba as W,bd as G,aX as H}from"./index-xnhGKCfe.js";import{c as J}from"./currency-DTUBf2lI.js";const K={class:"tab-popup-wrap"},Z={key:0,class:"tab-bar"},tt=["onClick"],ot={class:"popup_img"},et={key:0,class:"otherBtn"},at={key:1,class:"tab-bar"},nt=["onClick"],st={class:"tab-popup-footer"},ct=Q({__name:"TabPopup",props:{popups:{},tabPosition:{},zIndex:{},dontShowAgain:{type:Boolean}},emits:["close","action","update:dontShowAgain"],setup(s,{emit:$}){const p=s,S=$,{t:x}=U(),l=_(0),b=q(()=>p.popups[l.value]||p.popups[0]);I(()=>p.popups.length,t=>{l.value>=t&&(l.value=0)});function P(t,c){var C,f,d;return((f=(C=t.popupInfo)==null?void 0:C.tag)==null?void 0:f.trim())||((d=t.title)==null?void 0:d.trim())||String(c+1)}const v=_(null),T=_([]),k=_(!1),w=_(!1);function z(t,c){T.value[c]=t}function g(){const t=v.value;if(!t){k.value=!1,w.value=!1;return}k.value=t.scrollLeft>1,w.value=t.scrollLeft+t.clientWidth<t.scrollWidth-1}function L(){g()}function N(){const t=v.value;t&&t.scrollBy({left:-t.clientWidth*.6,behavior:"smooth"})}function V(){const t=v.value;t&&t.scrollBy({left:t.clientWidth*.6,behavior:"smooth"})}I(l,t=>{B(()=>{const c=T.value[t];c&&typeof c.scrollIntoView=="function"&&c.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"}),g()})}),I(()=>p.popups.length,()=>B(g)),X(()=>B(g));function D(t){l.value=t}function M(){S("action",b.value)}function F(){S("close")}function O(){S("update:dontShowAgain",!p.dontShowAgain)}return(t,c)=>{var f,d;const C=Y("lazy");return e(),o("div",{class:"tab-popup-mask",style:G({zIndex:s.zIndex})},[n("div",K,[n("div",{class:A(["tab-popup-card",{"tabs-top":s.tabPosition==="top"}])},[s.tabPosition==="top"?(e(),o("div",Z,[k.value?(e(),o("div",{key:0,class:"tab-arrow tab-arrow--left",onClick:N},[r(u,{name:"icon_lt",iconClass:"tab-arrow__icon"})])):i("",!0),n("div",{ref_key:"tabBarEl",ref:v,class:"tab-items",onScrollPassive:L},[(e(!0),o(E,null,R(s.popups,(m,a)=>(e(),o("div",{key:m.id,ref_for:!0,ref:h=>z(h,a),class:A(["tab-item",{active:a===l.value}]),onClick:h=>D(a)},y(P(m,a)),11,tt))),128))],544),w.value?(e(),o("div",{key:1,class:"tab-arrow tab-arrow--right",onClick:V},[r(u,{name:"icon_rt",iconClass:"tab-arrow__icon"})])):i("",!0)])):i("",!0),n("div",{class:"tab-popup-image",onClick:M},[j(n("img",ot,null,512),[[C,((f=b.value.popupInfo)==null?void 0:f.cover)||b.value.imageUrl]]),(d=b.value.popupInfo)!=null&&d.bonusAmount?(e(),o("div",et,y(W(J)(b.value.popupInfo.bonusAmount)),1)):i("",!0)]),s.tabPosition==="bottom"?(e(),o("div",at,[k.value?(e(),o("div",{key:0,class:"tab-arrow tab-arrow--left",onClick:N},[r(u,{name:"icon_lt",iconClass:"tab-arrow__icon"})])):i("",!0),n("div",{ref_key:"tabBarEl",ref:v,class:"tab-items",onScrollPassive:L},[(e(!0),o(E,null,R(s.popups,(m,a)=>(e(),o("div",{key:m.id,ref_for:!0,ref:h=>z(h,a),class:A(["tab-item",{active:a===l.value}]),onClick:h=>D(a)},y(P(m,a)),11,nt))),128))],544),w.value?(e(),o("div",{key:1,class:"tab-arrow tab-arrow--right",onClick:V},[r(u,{name:"icon_rt",iconClass:"tab-arrow__icon"})])):i("",!0)])):i("",!0)],2),n("div",st,[n("div",{class:"dont-show-again",onClick:O},[r(u,{name:s.dontShowAgain?"check_icon":"uncheck_icon",iconClass:"check-svg"},null,8,["name"]),n("span",null,y(W(x)("t833")),1)]),r(u,{name:"icon_close03",iconClass:"tab-close-btn",onClick:F})])])],4)}}}),rt=H(ct,[["__scopeId","data-v-c524a0d3"]]);export{rt as default};
