1import T from"./DmZjewwm.js";import S from"./DO2IcI8N.js";import b from"./C9yiaWcE.js";import F from"./DqDqJnzb.js";import M from"./3tuqe9SF.js";import{_ as j,j as g,w as f,T as z,L as _,B as y,J as P,o as n,a as s,v as A,b as d,c as p,F as x,x as G,t as l,e as v}from"./C_VzGqEg.js";import{f as L}from"./DWYbxXkk.js";import{a as w}from"./BhyboY_X.js";import{u}from"./BgWJYXWU.js";import"./DtfDc6gd.js";import"./D21fCrkA.js";import"./YpzxG479.js";import"./B3oeGQO5.js";import"./hAYur2Bi.js";import"./DvnYjAKn.js";import"./Q_y7I8tW.js";import"./DUMQntVJ.js";import"./SLKFLf4j.js";import"./C-9dbQSY.js";import"./C4fTG6EF.js";import"./CIfc6IQW.js";import"./BSy4JHtP.js";import"./DKeVZpFc.js";import"./DY4SgOtO.js";import"./BA3S9Qb4.js";import"./CkEu89z3.js";import"./B3iim-KL.js";import"./BXUykJ2C.js";import"./Chyz3EDp.js";import"./2h_uk5DF.js";import"./8JGrCZUO.js";import"./Bw2cPcki.js";import"./BDmGCnhJ.js";import"./BuQBOjcE.js";import"./s3_Otaqs.js";import"./B-yGqZyG.js";import"./LfmN3RZR.js";import"./CY0PcdZl.js";import"./ZwuLzPRm.js";import"./BjYxkQw3.js";import"./Dj2vd1FS.js";import"./Cz7YsKok.js";import"./B0hBdtTj.js";import"./CqXCemgF.js";import"./DLPSkQwF.js";import"./BEsDnUJP.js";import"./BXbTEqmD.js";import"./JB-VHAAP.js";import"./C1G0POQs.js";import"./Bc1rArTd.js";import"./alWqIy3s.js";import"./Crr0GwaG.js";import"./XKaySTwn.js";import"./CtcVRfPe.js";import"./BmVA1Fhd.js";import"./B5UfoBF-.js";import"./C9R0TS7U.js";import"./BXGXhy4c.js";import"./BFCiwhB7.js";import"./aOjMXEfI.js";import"./BoBHCbwg.js";import"./GmToSYe4.js";import"./qd73kTeZ.js";import"./Bqsy2Yht.js";import"./B8KuNCeR.js";import"./CEvt6g13.js";import"./C7KChRbo.js";import"./CsxoMG-j.js";import"./cCsmyXn7.js";import"./pvNInfal.js";import"./DNtRt3-K.js";import"./CTtN8_V5.js";import"./C-UI_2aN.js";import"./JR_dtwf4.js";import"./DL61D00e.js";import"./NnXrcQGe.js";import"./BrEk0DBG.js";import"./CTf3eFxt.js";import"./BJ8DeCX5.js";import"./BVIQdDd4.js";const R={name:"FreeGamesSearchModal",components:{RecommendationCard:F,IconClose:S,IconAdd:M,Button:b},mixins:[L],data(){return{ArcadeService:P,gamesByCategory:[],rowsFound:0,pagesCount:0,loadingGames:!1,results:this.$t("freeGames.results"),result:this.$t("freeGames.result"),wordIn:this.$t("freeGames.in"),noResults:this.$t("freeGames.noResults"),loadMore:this.$t("freeGames.loadMore"),searchPerformed:!1,lastSearchInput:"",canLoadMore:!1,games:[]}},computed:{...y(w,["providerById"]),...y(u,["globalGames","modalSearchData"]),noGamesFound(){return this.searchPerformed&&this.games.length===0},searchInput:{get(){return this.modalSearchData?.searchInput},set(t){this.setModalSearchInput(t)}}},watch:{globalGames:{immediate:!0,handler(t){this.games=t,this.formatGamesByType(this.games)}}},created(){this.getProviders()},methods:{..._(w,["getProviders"]),..._(u,["setModalSearchInput"]),closeModal(){this.closeModalSearch()},getFilteredGames(t=!0){t&&(this.options.pageNumber=1,this.games=[]),this.loadingGames=!0;const e={...this.currentFilters,pageSize:this.options.pageSize,pageNumber:this.options.pageNumber};this.getGames(t,e)},async loadMoreGames(){this.loadingGames=!0,this.options.pageNumber+=1;const t={...this.currentFilters,pageNumber:this.options.pageNumber,pageSize:this.options.pageSize},e=await this.ArcadeService.getGamesByCondition(t);if(e){const a=e.results||[];this.games=this.games.concat(a),this.rowsFound=e.rowsFound||0,this.pagesCount=e.pagesCount||0,this.formatGamesByType(this.games),this.canLoadMore=this.games.length<this.rowsFound,this.loadingGames=!1}},async getGames(t=!0,e=null){this.loadingGames=!0;const a=e||{...this.currentFilters,pageSize:this.options.pageSize,pageNumber:this.options.pageNumber};this.$emit("get-games",a);const o=await this.ArcadeService.getGamesByCondition(a);if(this.searchPerformed=!0,o){const r=o.results||[];t?this.games=r:this.games=this.games.concat(r),this.rowsFound=o.rowsFound||0,this.pagesCount=o.pagesCount||0,this.formatGamesByType(this.games),this.canLoadMore=this.games.length<this.rowsFound,this.loadingGames=!1}},formatGamesByType(t){const e=[...new Set(t.map(o=>o.gameType?o.gameType.name:void 0).filter(o=>o!==void 0))],a={};e.forEach(o=>{a[o]=[]}),t.forEach(o=>{e.includes(o.gameType.name)&&a[o.gameType.name].push(o)}),this.gamesByCategory=a},getGameProvider(t){return this.providerById(t)},closeModalSearch(){u().closeModalSearch()}}},V={class:"overflow-hidden background-1 rounded-xl relative border-sm color-stroke-3 w-[calc(100%-32px)] xl:w-auto"},D={class:"modal-height xl:w-[1181px] md:h-[675px] overflow-auto background-flyout backdrop-blur-md"},E={class:"flex flex-col"},H={class:"sticky top-0 z-10 pl-md pt-md pr-xs lg:pt-lg lg:p-lg lg:pr-md flex items-center background-flyout backdrop-blur-md"},J={class:"w-full"},O={class:"overflow-y-auto flex-1 px-md lg:px-lg"},U={key:0},q={class:"flex items-center justify-between"},K={class:"flex justify-start text-xs md:text-sm text-foreground-3"},Q={class:"flex justify-end text-xs md:text-sm text-foreground-3"},W={class:""},X={key:1,class:"flex justify-center py-md"},Y={class:"text-foreground-1"},Z={key:2,class:"flex items-center justify-center text-xs md:text-sm text-foreground-3 py-sm"};function $(t,e,a,o,r,i){const C=T,k=S,B=b,I=F,N=M;return n(),g(z,{name:"modal"},{default:f(()=>[s("div",{class:"fixed inset-0 w-full h-full z-[70] overlay-ui-dark-2 flex justify-center items-center",onClick:e[2]||(e[2]=A((...m)=>i.closeModal&&i.closeModal(...m),["self"]))},[s("div",V,[s("div",D,[s("div",E,[s("div",H,[s("div",J,[d(C,{modelValue:i.searchInput,"onUpdate:modelValue":e[0]||(e[0]=m=>i.searchInput=m),type:"search",variant:"SearchRoundedPill",onHandleFilter:t.updateGameNameFilters},null,8,["modelValue","onHandleFilter"])]),d(B,{variant:"mute",size:"LG",icon:"","icon-only":"",disabled:!1,onClick:i.closeModal},{"icon-only":f(()=>[d(k,{"color-class":"currentColor",width:"16",height:"16"})]),_:1},8,["onClick"])]),s("div",O,[i.noGamesFound?v("",!0):(n(),p("div",U,[(n(!0),p(x,null,G(r.gamesByCategory,(m,h)=>(n(),p("div",{key:h,class:"py-lg lg:first:pt-0"},[s("div",q,[s("p",K,l(m.length)+" "+l(m.length===1?r.result:r.results),1),s("p",Q,l(r.wordIn)+" "+l(h),1)]),s("div",W,[(n(!0),p(x,null,G(m,c=>(n(),g(I,{key:c.id,game:c,provider:i.getGameProvider(c.providerId)},null,8,["game","provider"]))),128))])]))),128))])),r.canLoadMore?(n(),p("div",X,[s("button",{class:"flex justify-center items-center gap-xs",onClick:e[1]||(e[1]=(...m)=>i.loadMoreGames&&i.loadMoreGames(...m))},[s("span",null,[d(N,{class:"text-foreground-1"}
1)]),s("span",Y,l(r.loadMore),1)])])):i.noGamesFound?(n(),p("div",Z,l(r.noResults),1)):v("",!0)])])])])])]),_:1})}const Mt=Object.assign(j(R,[["render",$],["__scopeId","data-v-5ea8eab6"]]),{__name:"FreeGamesSearchModal"});export{Mt as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.