import{d as y,O as C,P as T,S as a,U as x,bC as L,j as v}from"./index.4f40e5e1.js";import{d as M}from"./index.10256463.js";import O from"./index.d15f9d92.js";import k from"./index.d01c3bae.js";import{m as o,s as q}from"./header.59d81cd9.js";import{g as w}from"./music.90e10e91.js";import{a as P,S as A}from"./hooks.eddecfbf.js";import"./index.ec6e6a47.js";import"./use-tab-status.122f9fa5.js";import"./index.54ea2849.js";import"./index.39d21790.js";import"./index.c9ba21fe.js";import"./use-id.d72892eb.js";import"./use-refs.29c07da0.js";import"./index.9cb1152c.js";import"./index.c4fa4795.js";import"./index.8e0ac410.js";import"./select-subject.a61f7d02.js";import"./index.ff0c0b1f.js";import"./index.3066f4e5.js";import"./index.9d505f65.js";import"./index.97fec1a5.js";import"./icon-xin.a2c1df9b.js";import"./index.41aa1fc7.js";import"./index.4b5981fc.js";import"./select-tag.94ace61d.js";import"./index.ccdfba8f.js";import"./index.d4a74c0c.js";import"./index.926ca9c5.js";import"./index.8e60c20a.js";import"./index.bd8a8ffa.js";import"./icon_uploader.0991da14.js";import"./icon_album.8720f897.js";import"./icon_album_active.29797940.js";import"./icon_exquisite.33049cce.js";import"./icon_music_active.1b7b0778.js";import"./icon-play.bc9e7aab.js";var ge=y({name:"MusicSearch",emits:["confirm"],setup(){localStorage.setItem("behaviorId",w());const p=C(),j=T(),d=a(p.query.keyword||""),r=a(p.query.tagids||""),c=a(),R=a(!1),i=M("music-search",[]),s=a("songe"),I=P(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 x(()=>{o.on("changeTab",S),o.on("search",b),o.on("confirm",h),o.on("confirmSubject",g)}),L(()=>{o.off("changeTab",S),o.off("search",b),o.off("confirm",h),o.off("confirmSubject",g)}),()=>v("div",{class:q.search},[s.value==="album"?v(O,{hideSearch:!0,ref:n,defauleParams:{search:d.value,tagids:r.value,albumTagIds:r.value,subjectIds:c.value}},null):v(k,{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};
