import{d as S,V as i,aq as C,$ as x,as as R,U as T,ao as O,h as V,a as o,S as I,u as b,G as K,H as _,z as M,x as U,R as z,P as y}from"./vendor.405ecf9c.js";/* empty css *//* empty css *//* empty css *//* empty css */import{C as N}from"./index.96f38933.js";import{c as P}from"./index.126c459c.js";import{c as B}from"./index.926ca9c5.js";import{S as H}from"./select-tag.f029be18.js";import{g as $}from"./music.cbaa0b8d.js";import{S as q}from"./select-subject.9edc1e45.js";function A(t){return{all:t=t||new Map,on:function(n,s){var a=t.get(n);a?a.push(s):t.set(n,[s])},off:function(n,s){var a=t.get(n);a&&(s?a.splice(a.indexOf(s)>>>0,1):t.set(n,[]))},emit:function(n,s){var a=t.get(n);a&&a.slice().map(function(l){l(s)}),(a=t.get("*"))&&a.slice().map(function(l){l(n,s)})}}}const D="_search_ngdof_1",F="_sticky_ngdof_9",G="_title_ngdof_15",L="_keywords_ngdof_21",W="_content_ngdof_28",E="_searchKeyword_ngdof_38",J="_remove_ngdof_46",Q="_label_ngdof_49";var u={search:D,sticky:F,title:G,keywords:L,content:W,searchKeyword:E,remove:J,label:Q};function X(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!U(t)}const m=A(),w=i();var Y=S({name:"MusicSearchHeader",setup(){const t=i();localStorage.setItem("behaviorId",$());const n=C(),s=x(),a=i(""),l=i(""),v=i(""),h=i(!1),r=P("music-search",[]),f=i("songe");R(()=>{var e,d;if(s.path==="/music-songbook/search"){l.value="",v.value="",a.value="",f.value="songe";try{(d=(e=w.value)==null?void 0:e.resetTags)==null||d.call(e)}catch(p){console.log(p)}}return!0}),T(f,e=>{m.emit("changeTab",e)});const g=e=>{l.value=e;const d=r.value.indexOf(e);d>-1&&r.value.splice(d,1),e&&(r.value.unshift(e),r.value.length=Math.min(r.value.length,5)),m.emit("search",e)},j=(e,d="")=>{const p=Object.values(e).flat().filter(Boolean).join(",");v.value=p,m.emit("confirm",e),h.value=!1},k=e=>{c.name=e.name,c.id=e.id,m.emit("confirmSubject",c.id),c.show=!1};O(()=>{});const c=V({show:!1,name:"\u5168\u90E8",id:""});return()=>o("div",{class:u.search},[o(I,{class:u.sticky},{default:()=>[o(N,{modelValue:l.value,showAction:!0,ref:t,onSearch:g,onFilter:()=>h.value=!0,filterDot:!!v.value,onClick:()=>{s.path==="/music-songbook"&&n.push({path:"/music-songbook/search"})}},{left:()=>o("div",{class:u.label,onClick:()=>c.show=!0},[c.name,o(b,{classPrefix:"iconfont",name:"down",size:12,color:"#333"},null)])}),s.path==="/music-songbook/search"&&o(K,{color:"var(--van-primary)",background:"transparent",lineWidth:20,shrink:!0,active:f.value,"onUpdate:active":e=>f.value=e,onChange:e=>f.value=e},{default:()=>[o(_,{title:"\u5355\u66F2",name:"songe"},null),o(_,{title:"\u4E13\u8F91",name:"album"},null)]})]}),r.value.length>0&&s.path==="/music-songbook/search"&&o("div",{class:B(u.keywords,"van-hairline--bottom")},[o("div",{class:u.content},[r.value.map(e=>o(M,{round:!0,class:u.searchKeyword,key:e,onClick:()=>g(e)},X(e)?e:{default:()=>[e]}))]),o(b,{class:u.remove,name:"delete-o",onClick:()=>r.value=[]},null)]),o(z,null,null),o(y,{show:h.value,round:!0,closeable:!0,position:"bottom",style:{height:"60%"},teleport:"body","onUpdate:show":e=>h.value=e},{default:()=>[o(H,{ref:w,onConfirm:j,onCancel:()=>{}},null)]}),o(y,{show:c.show,position:"bottom",round:!0,closeable:!0,"safe-area-inset-bottom":!0,onClose:()=>c.show=!1,onClosed:()=>c.show=!1},{default:()=>[o(q,{isReset:!0,onComfirm:k},null)]})])}}),ue=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",mitter:m,default:Y});export{ue as h,m,u as s};