import{c as R}from"./index.8eb24852.js";import y from"./index.d4df9908.js";import I from"./index.ac7baa89.js";import{m as o,s as C}from"./header.51d73977.js";import{d as T,u as k,k as w,l as a,m as L,aB as M,a as j}from"./vendor.3506a68e.js";import{g as B,m as O}from"./music.a79cce2e.js";import{u as q,S as A}from"./hooks.6a14d51f.js";/* empty css               *//* empty css               */import"./index.2d1e9e4b.js";/* empty css              *//* empty css               */import"./index.9e4b607f.js";import"./item.51fda0e4.js";/* empty css               */import"./select-tag.7d9fa315.js";/* empty css                *//* empty css                *//* empty css                */import"./index.926ca9c5.js";import"./select-subject.b88285dd.js";import"./index.module.1588db22.js";import"./index.187da406.js";/* empty css               */import"./index.be471456.js";/* empty css              */import"./code-down-load.328a30fb.js";import"./logo.bcac726b.js";import"./browser.ebb85846.js";import"./icon_teacher.cb128c00.js";import"./music-icon.c20abf48.js";import"./orderStatus.81f9c36b.js";import"./index.339fc024.js";/* empty css               */var be=T({name:"MusicSearch",emits:["confirm"],setup(){localStorage.setItem("behaviorId",B());const b=k();w();const f=a(b.query.keyword||""),t=a(b.query.tagids||""),u=a(),g=a(!1),i=R("music-search",[]),r=a("songe"),S=q(A.SEARCH);u.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"?m:d).value).onSearch)==null||n.call(s,e)},v=e=>{var s,n;const c=Object.values(e).flat().filter(Boolean).join(",");t.value=c,(n=(s=(r.value==="album"?m:d).value).onComfirm)==null||n.call(s,e),g.value=!1},x=e=>{var l,s;u.value=e.id,(s=(l=(r.value==="album"?m:d).value).onComfirmSubject)==null||s.call(l,e)},m=a(null),d=a(null),h=e=>{r.value=e};return L(()=>{o.on("changeTab",h),o.on("search",p),o.on("confirm",v),o.on("confirmSubject",x)}),M(()=>{o.off("changeTab",h),o.off("search",p),o.off("confirm",v),o.off("confirmSubject",x)}),()=>j("div",{class:C.search},[r.value==="album"?j(y,{hideSearch:!0,ref:m,defauleParams:{search:f.value,tagids:t.value,albumTagIds:t.value,subjectIds:u.value}},null):j(I,{hideSearch:!0,ref:d,onItemClick:e=>{O(e)},defauleParams:{search:f.value,tagids:t.value,musicTagIds:t.value,subjectIds:u.value}},null)])}});export{be as default};
