import{G as Q,r as l,R as W,T as Z,$ as U,aU as X,aV as Y,C as ee,H as I,az as ae,I as v,Q as A,au as p,at as w,J as s,K as L,M as b,N as n,P as _,ao as h,aw as B,aE as te,O as f,an as se}from"./common.modules-af1f85b9.js";import{i as ne,A as le,aF as oe,aG as ie,_ as ue}from"./page-activity-ActivityDetail-f7c58355.js";import{F as ce,a as re}from"./page-home-AllGames-e4490e91.js";import"./page-turntable-assets-d6267459.js";import"./native/index-2c2af617.js";import"./en-8dc3e88f.js";const ve={class:"onlineGames__container"},me=["placeholder"],de={class:"onlineGames__container-list"},_e=["onClick"],pe={key:1},fe={class:"onlineGames__container-list miniGames"},ye=["onClick"],ge=Q({__name:"index",setup(ke){const G=l(!1),M=W(),E=Z(),{onItemClick:$,getAllGame:j,homeState:R}=ne(),S=l(),m=l(0),y=l([]),d=l(0);U(m,a=>{const e=o.value[a];x.value=[],d.value=0,e&&D(e.slotsTypeID)});const r=l(!1);U(r,a=>{a?setTimeout(()=>{V.value.focus()},0):g.value=""});const g=l("");X(g,a=>{if(u.value)if(u.value.key==="fish"||u.value.key==="flash")o.value=o.value.filter(e=>e.gameNameEn.toLowerCase().includes(a)),a.length===0&&(o.value=sessionStorage.getItem("slotGamesList")?JSON.parse(sessionStorage.getItem("slotGamesList")):null);else{const e=o.value[m.value];D(e.slotsTypeID,a)}},{debounce:300});const V=l(null),u=l(),o=l([]),x=l([]),q=Y(x,a=>r.value?a.gameNameEn.toLowerCase().includes(g.value.toLowerCase()):a.customGameType===d.value);function H(a){return a?a.split(/(?=[A-Z])/).join(" "):""}function K(){M.go(-1)}function O(a){r.value=a}const P=()=>!G.value;async function D(a,e=""){if(!G.value){G.value=!0;try{const c=await le(oe({type:a,gameNameEn:e}));if(c){if(x.value=c.data.gameLists||[],y.value=c.data.gameCustomTypeLists||[],!y.value.length)return;d.value=y.value[0].customGameType}}catch{}finally{G.value=!1}}}return ee(async()=>{const a=E.query.game,e=E.query.vendorCode,c=sessionStorage.getItem("gameType")?JSON.parse(sessionStorage.getItem("gameType")):null;await j(),u.value=a||c,R.allGameList[u.value]&&(o.value=R.allGameList[u.value]);const T=JSON.parse(sessionStorage.getItem("clickedItem"));if(T||e){const N=o.value.findIndex(k=>e?k.vendorCode===e:k.slotsTypeID===T.slotsTypeID);m.value=N!==-1?N:0}S.value&&S.value.scrollTo(m.value);const C=o.value[m.value];C&&await D(C.slotsTypeID)}),(a,e)=>{var F,z;const c=I("svg-icon"),T=I("NavBar"),C=I("van-tab"),N=I("van-tabs"),k=ae("lazy");return n(),v("div",ve,[A(T,{class:"white","left-arrow":"",onClickLeft:K},{center:p(()=>{var t;return[s("span",{class:h({active:r.value})},_((t=u.value)==null?void 0:t.title)+_(a.$t("game")),3),B(s("input",{type:"text",placeholder:a.$t("searchGame"),class:h({active:r.value}),"onUpdate:modelValue":e[0]||(e[0]=i=>g.value=i),ref_key:"searchBarRef",ref:V},null,10,me),[[te,g.value]])]}),right:p(()=>[A(c,{name:"SearchTrx",onClick:e[1]||(e[1]=t=>O(!0)),class:h({active:r.value})},null,8,["class"]),s("span",{class:h({active:r.value}),onClick:e[2]||(e[2]=t=>O(!1))},_(a.$t("cancel")),3)]),_:1}),((F=u.value)==null?void 0:F.key)!=="fish"&&((z=u.value)==null?void 0:z.key)!=="flash"?(n(),w(N,{key:0,class:"onlineGames__container-tabBar",active:m.value,"onUpdate:active":e[4]||(e[4]=t=>m.value=t),type:"card",sticky:!0,"offset-top":46,ref_key:"tabsRef",ref:S,"before-change":P},{default:p(()=>[(n(!0),v(L,null,b(o.value,(t,i)=>(n(),w(C,{key:i},{title:p(()=>[A(c,{name:t.slotsName,class:"gameIcon"},null,8,["name"]),s("span",null,_(f(ie)(t.slotsName)),1)]),_:2},1024))),128)),!r.value||y.value.length===0?(n(),w(f(ce),{key:0,modelValue:d.value,"onUpdate:modelValue":e[3]||(e[3]=t=>d.value=t),lineWidth:0},{default:p(()=>[(n(!0),v(L,null,b(y.value,(t,i)=>(n(),w(f(re),{name:i,key:i,class:h([{activeClassName:d.value===t.customGameType}]),onClick:J=>d.value=t.customGameType},{default:p(()=>[s("span",null,_(t.customGameTypeName),1)]),_:2},1032,["name","class","onClick"]))),128))]),_:1},8,["modelValue"])):se("v-if",!0),s("div",de,[(n(!0),v(L,null,b(f(q),(t,i)=>(n(),v("div",{class:"onlineGames__container-list__item",key:i,onClick:J=>f($)(t)},[B(s("img",null,null,512),[[k,t.img]]),s("div",null,[s("span",null,_(H(t.gameNameEn)),1)])],8,_e))),128))])]),_:1},8,["active"])):(n(),v("div",pe,[s("div",fe,[(n(!0),v(L,null,b(o.value,(t,i)=>(n(),v("div",{class:"onlineGames__container-list__item",key:i,onClick:J=>f($)(t)},[B(s("img",null,null,512),[[k,t.img]]),s("div",null,[s("span",null,_(t.gameNameEn),1)])],8,ye))),128))])]))])}}});const we=ue(ge,[["__scopeId","data-v-0ffc3892"],["__file","/usr/local/jenkins-prod/workspace/ar031-india-in999/src/views/home/AllOnlineGames/index.vue"]]);export{we as default};
