import{n as o,M as l,U as c,a as d,m as n}from"./index-DDNMzpZj.js";import{G as u,a as p,b as f,c as m,L as _,C as v,d as h}from"./LikeButton-DcDWMLsp.js";import{D as g}from"./Dropdown-Cks-nQIq.js";import{p as x}from"./mixins-CpCP8hE3.js";import"./BoxSummon-B3nklIl7.js";import"./DataFilter-CJCQVhjM.js";import"./StarsLine-CReD_mDq.js";import"./StatInput-BU1s-zba.js";import"./icon_pring-bV6Un94l.js";import"./raids-h8ynLJMQ.js";import"./Checkbox-Dc2UYqO9.js";const w={model:{prop:"show",event:"close"},components:{LikeButton:_,Modal:l,GroupClass:m,GroupCharacters:f,GroupSummons:p,GroupWeapons:u},props:{show:{type:Boolean,required:!0},teamId:{type:Number,required:!0}},data(){return{loading:!0}},methods:{close(){this.$emit("close",!1)}},computed:{...n({party_name:a=>a.party_builder.party_name,description:a=>a.party_builder.description,video:a=>a.party_builder.video_id}),...d(["getActionsText"]),videoURL(){return this.video?"https://www.youtube.com/watch?v="+this.video:null}},watch:{teamId(){this.teamId>0&&(this.loading=!0,this.axios.get("/party/load/"+this.teamId).then(a=>{let t=c.getPartyResponse(a);t.party_mode=this.$MODE.ReadOnly,this.$store.dispatch("loadParty",t),this.loading=!1}).catch(a=>this.$store.dispatch("addAxiosErrorMessage",a)))}}};var C=function(){var t=this,e=t._self._c;return e("modal",{attrs:{show:t.show,large:!0},on:{close:function(s){return t.close()}},scopedSlots:t._u([{key:"header",fn:function(){return[t.loading?t._e():e("div",{staticClass:"columns-2 md:columns-3 grow"},[e("h3",{staticClass:"w-1/2 truncate hidden md:block md:w-32 lg:w-64 xl:w-96",attrs:{title:t.party_name}},[t._v(t._s(t.party_name))]),e("a",{staticClass:"text-center",attrs:{href:"/builder?p="+t.teamId}},[t._v("Open in Party Builder")]),e("like-button",{attrs:{teamId:t.teamId}})],1)]},proxy:!0}])},[t.loading?e("div",{staticClass:"text-center"},[t._v(" Loading... ")]):e("div",{staticClass:"flex flex-col justify-center items-center flex-wrap gap-2"},[e("div",{staticClass:"flex flex-row justify-center items-start flex-wrap gap-2"},[e("group-class"),e("group-characters",{attrs:{showLevel:!1,showRing:!0}}),e("group-summons",{attrs:{showLevel:!1}})],1),e("div",{staticClass:"flex flex-row flex-wrap justify-center items-start gap-2"},[e("group-weapons",{attrs:{showLevel:!1,showArcarum:!0}}),e("span",{staticClass:"flex flex-col w-full self-stretch md:w-128"},[t.video?e("h3",[t._v("YouTube video:")]):t._e(),t.video?e("a",{attrs:{href:t.videoURL,target:"_blank"}},[t._v(t._s(t.videoURL))]):t._e(),t.description?e("h3",[t._v("Description")]):t._e(),t.description?e("textarea",{directives:[{name:"model",rawName:"v-model",value:t.description,expression:"description"}],staticClass:"self-stretch h-full w-full md:w-128 appearance-none text-primary bg-primary",attrs:{readonly:""},domProps:{value:t.description},on:{input:function(s){s.target.composing||(t.description=s.target.value)}}}):t._e(),t.getActionsText?e("h3",[t._v("Actions")]):t._e(),t.getActionsText?e("textarea",{directives:[{name:"model",rawName:"v-model",value:t.getActionsText,expression:"getActionsText"}],staticClass:"self-stretch h-full w-full md:w-128 appearance-none text-primary bg-primary",attrs:{readonly:""},domProps:{value:t.getActionsText},on:{input:function(s){s.target.composing||(t.getActionsText=s.target.value)}}}):t._e()])],1)])])},y=[],b=o(w,C,y,!1,null,null);const T=b.exports,P={namespaced:!0,state(){return{teams:[],params:{c:-1,e:-1,t:-1,o:-1}}},actions:{fetchTeams({state:a,dispatch:t},e={}){let s=!1;if(Object.entries(a.params).forEach(([r,i])=>{e.hasOwnProperty(r)?e[r]!==i&&(a.params[r]=e[r],s=!0):i!==-1&&(a.params[r]=-1,s=!0)}),a.teams.length===0||s)return this.axios.get("/teams/list",{params:e}).then(r=>a.teams=r.data).catch(r=>t("addAxiosErrorMessage",r,{root:!0}))}}},U=x("teams",P),k={components:{ContentCategories:v,Dropdown:g,ModalTeamPreview:T},mixins:[U],head:{title:"Granblue.Party - Public Teams",desc:"Browse public teams made by fellow players",image:"https://www.granblue.party/img/card_index.jpg",keywords:"Granblue Fantasy, GBF, Party, Teams, Public teams, Grid, Share"},data(){return{loading:!0,now:this.getUTCnow(),show_preview:!1,preview_id:0,content_filter:-1,element_filter:-1,age_filter:-1,sort_filter:-1,index:0}},methods:{getUTCnow(){const a=new Date;return Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds())},getPrintableDate(a){const t=new Date(this.now-parseInt(a,10)*1e3);return t.toUTCString()>1970?"A year ago":t.getUTCMonth()===1?"One month ago":t.getUTCMonth()>1?t.getUTCMonth()+" months ago":t.getUTCDate()===2?"One day ago":t.getUTCDate()>2?t.getUTCDate()-1+" days ago":t.getUTCHours()===1?"One hour ago":t.getUTCHours()>1?t.getUTCHours()+" hours ago":t.getUTCMinutes()>1?t.getUTCMinutes()+" minutes ago":"Right now"},getElementName(a){switch(a){case 0:return"Fire";case 1:return"Wind";case 2:return"Earth";case 3:return"Water";case 4:return"Light";case 5:return"Dark";case 6:return"Any"}return""},fetchTeams(){this.loading=!0,this.index=0;const a={};this.content_filter>=0&&(a.c=this.content_filter),this.element_filter>=0&&(a.e=this.element_filter),this.age_filter>=0&&(a.t=this.age_filter),this.sort_filter>=0&&(a.o=this.sort_filter),this.$store.dispatch("teams/fetchTeams",a).then(t=>this.loading=!1)},clearFilters(){this.content_filter=-1,this.element_filter=-1,this.age_filter=-1,this.sort_filter=-1,this.fetchTeams()},previewTeam(a){this.preview_id=a,this.show_preview=!0}},computed:{...n("teams",["teams"]),slice_size(){return 12},content(){return Object.fromEntries(h.flatMap(a=>a.content.map(t=>[t.id,t.name])))},getTeams(){return this.teams.slice(this.index*this.slice_size,this.index*this.slice_size+this.slice_size)}},serverPrefetch(){return this.$store.dispatch("teams/fetchTeams")},async mounted(){await this.$store.dispatch("teams/fetchTeams").then(a=>{this.loading=!1})}};var M=function(){var t=this,e=t._self._c;return e("div",{staticClass:"flex flex-col flex-wrap gap-4 items-center"},[e("h1",[t._v("Public Teams")]),e("div",{staticClass:"flex flex-row flex-wrap items-end gap-2"},[e("label",{staticClass:"flex flex-col"},[e("span",{staticClass:"text-sm"},[t._v("Content")]),e("content-categories",{attrs:{all:!0,showPrivateCategories:!1},model:{value:t.content_filter,callback:function(s){t.content_filter=t._n(s)},expression:"content_filter"}})],1),e("label",{staticClass:"flex flex-col"},[e("span",{staticClass:"text-sm"},[t._v("Element")]),e("dropdown",{model:{value:t.element_filter,callback:function(s){t.element_filter=t._n(s)},expression:"element_filter"}},[e("option",{domProps:{value:-1}},[t._v("--- All ---")]),e("option",{domProps:{value:0}},[t._v("Fire")]),e("option",{domProps:{value:1}},[t._v("Wind")]),e("option",{domProps:{value:2}},[t._v("Earth")]),e("option",{domProps:{value:3}},[t._v("Water")]),e("option",{domProps:{value:4}},[t._v("Light")]),e("option",{domProps:{value:5}},[t._v("Dark")])])],1),e("label",{staticClass:"flex flex-col"},[e("span",{staticClass:"text-sm"},[t._v("Age")]),e("dropdown",{model:{value:t.age_filter,callback:function(s){t.age_filter=t._n(s)},expression:"age_filter"}},[e("option",{domProps:{value:-1}},[t._v("All time")]),e("option",{domProps:{value:1}},[t._v("Today")]),e("option",{domProps:{value:30}},[t._v("This month")]),e("option",{domProps:{value:90}},[t._v("Last 3 months")]),e("option",{domProps:{value:365}},[t._v("This year")])])],1),e("label",{staticClass:"flex flex-col"},[e("span",{staticClass:"text-sm"},[t._v("Sort by")]),e("dropdown",{model:{value:t.sort_filter,callback:function(s){t.sort_filter=t._n(s)},expression:"sort_filter"}},[e("option",{domProps:{value:-1}},[t._v("Date")]),e("option",{domProps:{value:1}},[t._v("Popularity")])])],1),e("button",{staticClass:"btn btn-blue",on:{click:function(s){return t.fetchTeams()}}},[t._v("Filter")]),e("button",{staticClass:"btn btn-red",on:{click:function(s){return t.clearFilters()}}},[t._v("Reset")])]),t.loading===!0?e("div",[t._v(" Loading... ")]):t.teams.length>0?e("div",{staticClass:"flex flex-col gap-y-4 items-center"},[e("nav",{attrs:{role:"navigation","aria-label":"pagination"}},[e("ul",{staticClass:"flex flex-row flex-wrap"},t._l(Math.ceil(t.teams.length/t.slice_size),function(s){return e("li",{key:s},[e("a",{staticClass:"text-primary mr-2 py-1 px-2 rounded",class:t.index===s-1?"bg-tertiary cursor-default text-link-hover":"bg-secondary cursor-pointer",on:{click:function(r){t.index=s-1}}},[t._v(t._s(s))])])}),0)]),e("div",{staticClass:"flex flex-row flex-wrap gap-4 justify-center"},t._l(t.getTeams,function(s,r){return e("div",{key:r,staticClass:"flex flex-col bg-tertiary p-1 gap-y-1"},[e("div",{staticClass:"flex flex-row justify-center px-1 relative"},[e("div",{staticClass:"absolute left-0 text-sm"},[e("img",{staticClass:"align-text-top",attrs:{height:"18",width:"18",src:"/img/e_"+t.getElementName(s.e).toLowerCase()+".png"}}),t._v(" "+t._s(t.getElementName(s.e))+" ")]),e("div",{staticClass:"font-semibold text-center w-36 sm:w-72 truncate",attrs:{title:s.n}},[t._v(t._s(s.n)+" ")]),e("div",{staticClass:"flex flex-row absolute right-1 gap-x-4"},[s.yt?e("div",[e("fa-icon",{staticClass:"text-lg",attrs:{icon:["fab","youtube"],title:"Contains a YouTube video"}})],1):t._e(),s.desc?e("div",[e("fa-icon",{staticClass:"text-lg",attrs:{icon:["fas","file-lines"],title:"Contains a description"}})],1):t._e(),e("div",{class:s.l>=1?"":"opacity-70",attrs:{title:"Likes"}},[e("fa-icon",{staticClass:"text-lg",attrs:{icon:["fas","heart"]}}),t._v(" "+t._s(s.l)+" ")],1)])]),e("div",{staticClass:"grid grid-cols-3 px-1"},[e("div",{staticClass:"flex items-center justify-start text-xs md:text-sm w-32 truncate"},[e("fa-icon",{staticClass:"pr-1",attrs:{icon:["fas","user"]}}),t._v(t._s(s.u))],1),e("span",{staticClass:"flex flex-row shrink justify-center"},[e("div",{staticClass:"tag bg-secondary truncate",attrs:{title:t.content[s.c]}},[t._v(t._s(t.content[s.c]))])]),e("div",{staticClass:"flex items-center justify-end text-xs md:text-sm truncate"},[e("fa-icon",{staticClass:"pr-1",attrs:{icon:["fas","clock"]}}),t._v(t._s(t.getPrintableDate(s.d)))],1)]),e("div",{staticClass:"cursor-pointer",on:{click:function(i){return t.previewTeam(s.id)}}},[e("img",{staticClass:"object-cover object-top",staticStyle:{"aspect-ratio":"596 / 314"},attrs:{src:"/previews/party/party_"+s.id+"."+s.d+".jpg",width:"596",height:"336"}})])])}),0),e("nav",{attrs:{role:"navigation","aria-label":"pagination"}},[e("ul",{staticClass:"flex flex-row flex-wrap"},t._l(Math.ceil(t.teams.length/t.slice_size),function(s){return e("li",{key:s},[e("a",{staticClass:"text-primary mr-2 py-1 px-2 rounded cursor-pointer",class:t.index===s-1?"bg-tertiary":"bg-secondary",on:{click:function(r){t.index=s-1}}},[t._v(t._s(s))])])}),0)])]):e("div",[t._v(" No results ")]),e("modal-team-preview",{attrs:{teamId:t.preview_id},model:{value:t.show_preview,callback:function(s){t.show_preview=s},expression:"show_preview"}})],1)},A=[],D=o(k,M,A,!1,null,null);const N=D.exports;export{N as default};