import{d as y,Q as C,S as T,V as a,W as k,bk as x,j as v}from"./ResizeObserver.es.62ab429c.js";import{d as L}from"./index.a6e5e68b.js";import M from"./index.9d793e23.js";import q from"./index.c4d12794.js";import{m as o,s as w}from"./header.a5bf6aec.js";import{g as O}from"./music.56762674.js";import{b as V,S as A}from"./hooks.3b599d36.js";import"./index.00698f4b.js";import"./use-tab-status.a98984d2.js";import"./index.b0c6821a.js";import"./index.3d6f6bcd.js";import"./index.ffd89e39.js";import"./use-id.1bbe472d.js";import"./use-refs.259e72cb.js";import"./index.002d8e53.js";import"./index.d7a13e47.js";import"./index.82be4917.js";import"./select-subject.3a445c69.js";import"./index.0eba5ce9.js";import"./index.281d2be5.js";import"./index.2a571689.js";import"./index.021584f9.js";import"./icon-xin.df8ab2d7.js";import"./index.786e83cc.js";import"./index.1db64c88.js";import"./select-tag.bdc20ffa.js";import"./index.2745b15c.js";import"./index.9a52dc9a.js";import"./index.926ca9c5.js";import"./index.5d843ffa.js";import"./index.df4cff80.js";import"./icon_uploader.9f387137.js";import"./icon_album.fa329df6.js";import"./icon_album_active.ce98b2a8.js";import"./icon_exquisite.69e33c80.js";import"./icon_music_active.3b316ab8.js";import"./icon-play.bc9e7aab.js";var ge=y({name:"MusicSearch",emits:["confirm"],setup(){localStorage.setItem("behaviorId",O());const p=C(),j=T(),d=a(p.query.keyword||""),r=a(p.query.tagids||""),c=a(),R=a(!1),i=L("music-search",[]),s=a("songe"),I=V(A.SEARCH);c.value=I.id;const b=e=>{var t,u;d.value=e;const m=i.value.indexOf(e);m>-1&&i.value.splice(m,1),e&&(i.value.unshift(e),i.value.length=Math.min(i.value.length,5)),(u=(t=(s.value==="album"?n:l).value).onSearch)==null||u.call(t,e)},h=e=>{var t,u;const m=Object.values(e).flat().filter(Boolean).join(",");r.value=m,(u=(t=(s.value==="album"?n:l).value).onComfirm)==null||u.call(t,e),R.value=!1},g=e=>{var f,t;c.value=e.id,(t=(f=(s.value==="album"?n:l).value).onComfirmSubject)==null||t.call(f,e)},n=a(null),l=a(null),S=e=>{s.value=e};return k(()=>{o.on("changeTab",S),o.on("search",b),o.on("confirm",h),o.on("confirmSubject",g)}),x(()=>{o.off("changeTab",S),o.off("search",b),o.off("confirm",h),o.off("confirmSubject",g)}),()=>v("div",{class:w.search},[s.value==="album"?v(M,{hideSearch:!0,ref:n,defauleParams:{search:d.value,tagids:r.value,albumTagIds:r.value,subjectIds:c.value}},null):v(q,{hideSearch:!0,ref:l,onItemClick:e=>{j.push({path:"/music-detail",query:{id:e.id,albumId:p.params.id}})},defauleParams:{search:d.value,tagids:r.value,musicTagIds:r.value,subjectIds:c.value}},null)])}});export{ge as default};
