import{_ as $,A as k,H as S,i as H,r as d,o as p,c as m,d as r,w as c,e as B,a as s,t as n,j as h,v as b,k as L}from"./index.js";import{G as f,a as E,c as g}from"./GroupByList.js";import{C as I}from"./ContentWithHeading.js";import{C as A}from"./ControlDropdown.js";import{I as D}from"./IndexButtonList.js";import{L as N}from"./ListAlbums.js";import{T as U}from"./TabsMusic.js";import"./CoverArtwork.js";import"./ModalDialogAlbum.js";const _={load(t){return B.library_albums("music")},set(t,e){t.albums_list=new f(e.data)}},V={name:"PageAlbums",components:{ContentWithHeading:I,ControlDropdown:A,IndexButtonList:D,ListAlbums:N,TabsMusic:U},beforeRouteEnter(t,e,i){_.load(t).then(u=>{i(a=>_.set(a,u))})},beforeRouteUpdate(t,e,i){if(!this.albums_list.isEmpty()){i();return}const u=this;_.load(t).then(a=>{_.set(u,a),i()})},data(){return{albums_list:new f,groupby_options:[{id:1,name:this.$t("page.albums.sort-by.name"),options:E("name_sort",!0)},{id:2,name:this.$t("page.albums.sort-by.recently-added"),options:g("time_added",{direction:"desc"})},{id:3,name:this.$t("page.albums.sort-by.recently-released"),options:g("date_released",{direction:"desc"})}]}},computed:{albums(){const t=this.groupby_options.find(e=>e.id===this.selected_groupby_option_id);return this.albums_list.group(t.options,[e=>!this.hide_singles||e.track_count>2,e=>!this.hide_spotify||e.data_kind!=="spotify"]),this.albums_list},selected_groupby_option_id:{get(){return this.$store.state.albums_sort},set(t){this.$store.commit(k,t)}},spotify_enabled(){return this.$store.state.spotify.webapi_token_valid},hide_singles:{get(){return this.$store.state.hide_singles},set(t){this.$store.commit(S,t)}},hide_spotify:{get(){return this.$store.state.hide_spotify},set(t){this.$store.commit(H,t)}}}},T={class:"fd-page-with-tabs"},G={class:"columns"},M={class:"column"},O=["textContent"],P={class:"field"},R={class:"control"},j=["textContent"],Y=["textContent"],F={key:0,class:"field"},W={class:"control"},q=["textContent"],z=["textContent"],J={class:"column"},K=["textContent"],Q=["textContent"],X=["textContent"];function Z(t,e,i,u,a,o){const y=d("tabs-music"),C=d("index-button-list"),x=d("control-dropdown"),w=d("list-albums"),v=d("content-with-heading");return p(),m("div",T,[r(y),r(v,null,{options:c(()=>[r(C,{index:o.albums.indexList},null,8,["index"]),s("div",G,[s("div",M,[s("p",{class:"heading mb-5",textContent:n(t.$t("page.albums.filter"))},null,8,O),s("div",P,[s("div",R,[h(s("input",{id:"switchHideSingles","onUpdate:modelValue":e[0]||(e[0]=l=>o.hide_singles=l),type:"checkbox",class:"switch is-rounded"},null,512),[[b,o.hide_singles]]),s("label",{for:"switchHideSingles",textContent:n(t.$t("page.albums.hide-singles"))},null,8,j)]),s("p",{class:"help",textContent:n(t.$t("page.albums.hide-singles-help"))},null,8,Y)]),o.spotify_enabled?(p(),m("div",F,[s("div",W,[h(s("input",{id:"switchHideSpotify","onUpdate:modelValue":e[1]||(e[1]=l=>o.hide_spotify=l),type:"checkbox",class:"switch is-rounded"},null,512),[[b,o.hide_spotify]]),s("label",{for:"switchHideSpotify",textContent:n(t.$t("page.albums.hide-spotify"))},null,8,q)]),s("p",{class:"help",textContent:n(t.$t("page.albums.hide-spotify-help"))},null,8,z)])):L("",!0)]),s("div",J,[s("p",{class:"heading mb-5",textContent:n(t.$t("page.albums.sort-by.title"))},null,8,K),r(x,{value:o.selected_groupby_option_id,"onUpdate:value":e[2]||(e[2]=l=>o.selected_groupby_option_id=l),options:a.groupby_options},null,8,["value","options"])])])]),"heading-left":c(()=>[s("p",{class:"title is-4",textContent:n(t.$t("page.albums.title"))},null,8,Q),s("p",{class:"heading",textContent:n(t.$t("page.albums.count",{count:o.albums.count}))},null,8,X)]),"heading-right":c(()=>[]),content:c(()=>[r(w,{albums:o.albums},null,8,["albums"])]),_:1})])}const rt=$(V,[["render",Z]]);export{rt as default};