import{c as y}from"./index.fce7f544.js";import C from"./index.2bc158ce.js";import T from"./index.24eca19f.js";import{m as o,s as L}from"./header.cb9d1e35.js";import{d as M,L as x,M as O,O as a,P as k,bz as q,i as v}from"./index.afa1b71c.js";import{g as w}from"./music.9b0ac3f4.js";import{a as P,S as A}from"./hooks.ea9ec317.js";import"./index.db3b0e47.js";import"./index.90f19895.js";import"./use-tab-status.7451baf9.js";import"./index.7c0d35f2.js";import"./index.0daa711a.js";import"./use-id.237d90a3.js";import"./use-refs.fee02e7b.js";import"./index.09943e1e.js";import"./index.8fb41b14.js";import"./index.dd9b166a.js";import"./select-subject.fb5b00b2.js";import"./index.30fb9a6a.js";import"./index.bed38478.js";import"./index.2a4aa690.js";import"./index.637c8eb4.js";import"./icon-xin.ff5e2464.js";import"./select-tag.5ef46951.js";import"./index.42378eb4.js";import"./index.4b8ed396.js";import"./index.926ca9c5.js";import"./index.bcdad04b.js";import"./index.module.7b815a85.js";import"./index.e8a66baf.js";import"./icon_uploader.2c2d880e.js";import"./icon_exquisite.f7a49149.js";import"./icon_album_active.17cb3c18.js";import"./icon_music_active.f91f6fcc.js";import"./index.ceb58f38.js";import"./index.61a5e45f.js";import"./use-height.f6c2abd5.js";import"./index.570461cd.js";var Se=M({name:"MusicSearch",emits:["confirm"],setup(){localStorage.setItem("behaviorId",w());const p=x(),j=O(),d=a(p.query.keyword||""),i=a(p.query.tagids||""),c=a(),R=a(!1),r=y("music-search",[]),s=a("songe"),I=P(A.SEARCH);c.value=I.id;const b=e=>{var t,u;d.value=e;const m=r.value.indexOf(e);m>-1&&r.value.splice(m,1),e&&(r.value.unshift(e),r.value.length=Math.min(r.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(",");i.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)}),q(()=>{o.off("changeTab",S),o.off("search",b),o.off("confirm",h),o.off("confirmSubject",g)}),()=>v("div",{class:L.search},[s.value==="album"?v(C,{hideSearch:!0,ref:n,defauleParams:{search:d.value,tagids:i.value,albumTagIds:i.value,subjectIds:c.value}},null):v(T,{hideSearch:!0,ref:l,onItemClick:e=>{j.push({path:"/music-detail",query:{id:e.id,albumId:p.params.id}})},defauleParams:{search:d.value,tagids:i.value,musicTagIds:i.value,subjectIds:c.value}},null)])}});export{Se as default};
