import{c as R}from"./index.a576332b.js";import y from"./index.09006401.js";import I from"./index.3dab1da5.js";import{m as o,s as C}from"./header.69d2067f.js";import{d as T,u as k,k as w,l as t,m as L,aB as M,a as j}from"./vendor.cd162bf7.js";import{g as B,m as O}from"./music.2b301688.js";import{u as q,S as A}from"./hooks.9d08351a.js";/* empty css               *//* empty css               */import"./index.a64b1b02.js";/* empty css              *//* empty css               */import"./index.a9c80450.js";import"./item.3ab561a9.js";/* empty css               */import"./favorite.cb69f4f9.js";import"./select-tag.2e1a0f9d.js";/* empty css                *//* empty css                *//* empty css                */import"./index.926ca9c5.js";import"./select-subject.22f886db.js";import"./item.6f8e93af.js";import"./music-icon.c20abf48.js";import"./init-user-icon.6387573f.js";import"./index.bf04a798.js";/* empty css              */import"./code-down-load.47d90056.js";import"./logo.bcac726b.js";import"./browser.ebb85846.js";import"./icon_teacher.cb128c00.js";import"./index.module.da27480e.js";import"./orderStatus.86d72629.js";import"./index.339fc024.js";/* empty css               */var pe=T({name:"MusicSearch",emits:["confirm"],setup(){localStorage.setItem("behaviorId",B());const b=k();w();const f=t(b.query.keyword||""),a=t(b.query.tagids||""),m=t(),g=t(!1),i=R("music-search",[]),r=t("songe"),S=q(A.SEARCH);m.value=S.id;const p=e=>{var s,n;f.value=e;const c=i.value.indexOf(e);c>-1&&i.value.splice(c,1),e&&(i.value.unshift(e),i.value.length=Math.min(i.value.length,5)),(n=(s=(r.value==="album"?u:d).value).onSearch)==null||n.call(s,e)},v=e=>{var s,n;const c=Object.values(e).flat().filter(Boolean).join(",");a.value=c,(n=(s=(r.value==="album"?u:d).value).onComfirm)==null||n.call(s,e),g.value=!1},h=e=>{var l,s;m.value=e.id,(s=(l=(r.value==="album"?u:d).value).onComfirmSubject)==null||s.call(l,e)},u=t(null),d=t(null),x=e=>{r.value=e};return L(()=>{o.on("changeTab",x),o.on("search",p),o.on("confirm",v),o.on("confirmSubject",h)}),M(()=>{o.off("changeTab",x),o.off("search",p),o.off("confirm",v),o.off("confirmSubject",h)}),()=>j("div",{class:C.search},[r.value==="album"?j(y,{hideSearch:!0,ref:u,defauleParams:{search:f.value,tagids:a.value,albumTagIds:a.value,subjectIds:m.value}},null):j(I,{hideSearch:!0,ref:d,onItemClick:e=>{O(e)},defauleParams:{search:f.value,tagids:a.value,musicTagIds:a.value,subjectIds:m.value}},null)])}});export{pe as default};
