;(function(){function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}var __vite_style__=document.createElement('style');__vite_style__.innerHTML="._search_ngdof_1{--van-cell-background-color: transparent;--van-cell-font-size: .42667rem;--van-cell-text-color: #333;--van-cell-value-color: #999;--van-cell-icon-size: .26667rem;--base-bg: #f6f8f9}._search_ngdof_1 ._sticky_ngdof_9 .van-sticky--fixed{box-shadow:.26667rem .26667rem .26667rem var(--box-shadow-color)}._search_ngdof_1 ._sticky_ngdof_9>div{background-color:var(--base-bg)}._search_ngdof_1 ._title_ngdof_15{padding-top:.42667rem}._search_ngdof_1 ._title_ngdof_15 .van-cell__value{font-size:.32rem}._search_ngdof_1 ._keywords_ngdof_21{margin-top:.26667rem;padding:0 .37333rem .26667rem;display:flex;align-items:center}._search_ngdof_1 ._keywords_ngdof_21 ._content_ngdof_28::-webkit-scrollbar{display:none}._search_ngdof_1 ._keywords_ngdof_21 ._content_ngdof_28{flex:1;overflow:hidden;overflow-x:auto;display:flex}._search_ngdof_1 ._keywords_ngdof_21 ._content_ngdof_28 ._searchKeyword_ngdof_38{--van-tag-default-color: white;--van-tag-text-color: #333;font-size:.37333rem;padding:.10667rem .26667rem;margin-right:.13333rem;word-break:keep-all}._search_ngdof_1 ._keywords_ngdof_21 ._remove_ngdof_46{font-size:.42667rem}._search_ngdof_1 ._label_ngdof_49{margin-right:.21333rem;font-size:.37333rem}._search_ngdof_1 ._label_ngdof_49 .van-list__loading,._search_ngdof_1 ._label_ngdof_49 .van-list__finished-text,._search_ngdof_1 ._label_ngdof_49 .van-list__error-text{width:100%}._search_ngdof_1 ._label_ngdof_49 .iconfont-down{margin-left:.10667rem}\n";document.head.appendChild(__vite_style__);System.register(['./vendor-legacy.09f20d09.js','./index-legacy.f25f109a3.js','./index-legacy.f25f109a10.js','./index-legacy.637f3556.js','./index-legacy.637f35562.js','./index-legacy.f72eae88.js','./index-legacy.2d78ae68.js','./index-legacy.6e10cd37.js','./select-tag-legacy.4972aa0d.js','./music-legacy.6d4924e4.js','./select-subject-legacy.1290af03.js','./hooks-legacy.b91b3b59.js','./index-legacy.595c24c3.js'],function(exports){'use strict';var defineComponent,ref,useRouter,useRoute,onBeforeRouteUpdate,watch,onMounted,reactive,createVNode,Sticky,Icon,Tabs,Tab,Tag,isVNode,RouterView,Popup,ColSearch,useLocalStorage,classNames,SelectTag,getRandomKey,SelectSubject,useSubjectId,SubjectEnum,state;return{setters:[function(module){defineComponent=module.d;ref=module.l;useRouter=module.k;useRoute=module.u;onBeforeRouteUpdate=module.aC;watch=module._;onMounted=module.m;reactive=module.h;createVNode=module.a;Sticky=module.S;Icon=module.K;Tabs=module.v;Tab=module.w;Tag=module.U;isVNode=module.x;RouterView=module.R;Popup=module.P;},function(){},function(){},function(){},function(){},function(module){ColSearch=module.C;},function(module){useLocalStorage=module.c;},function(module){classNames=module.c;},function(module){SelectTag=module.S;},function(module){getRandomKey=module.g;},function(module){SelectSubject=module.S;},function(module){useSubjectId=module.u;SubjectEnum=module.S;},function(module){state=module.s;}],execute:function execute(){var _Object$freeze;function mitt(n){return{all:n=n||new Map(),on:function on(t,e){var i=n.get(t);i?i.push(e):n.set(t,[e]);},off:function off(t,e){var i=n.get(t);i&&(e?i.splice(i.indexOf(e)>>>0,1):n.set(t,[]));},emit:function emit(t,e){var i=n.get(t);i&&i.slice().map(function(n){n(e);}),(i=n.get("*"))&&i.slice().map(function(n){n(t,e);});}};}var search="_search_ngdof_1";var sticky="_sticky_ngdof_9";var title="_title_ngdof_15";var keywords="_keywords_ngdof_21";var content="_content_ngdof_28";var searchKeyword="_searchKeyword_ngdof_38";var remove="_remove_ngdof_46";var label="_label_ngdof_49";var styles=exports('s',{search:search,sticky:sticky,title:title,keywords:keywords,content:content,searchKeyword:searchKeyword,remove:remove,label:label});function _isSlot(s){return typeof s==='function'||Object.prototype.toString.call(s)==='[object Object]'&&!isVNode(s);}var mitter=exports('m',mitt());var selectTagRef=ref();var header=defineComponent({name:'MusicSearchHeader',setup:function setup(){var subjects=useSubjectId(SubjectEnum.SEARCH);// 判断是否已有数据
if(!subjects.id){var users=state.user.data;var subjectId=users.subjectId?Number(users.subjectId.split(',')[0]):'';var subjectName=users.subjectName?users.subjectName.split(',')[0]:'';if(subjectId){useSubjectId(SubjectEnum.SEARCH,JSON.stringify({id:subjectId,name:subjectName}),'set');}}var searchInputRef=ref();localStorage.setItem('behaviorId',getRandomKey());var router=useRouter();var route=useRoute();var keyword=ref('');var tagids=ref('');var tagVisibility=ref(false);var words=useLocalStorage('music-search',[]);var activeTab=ref('songe');onBeforeRouteUpdate(function(){var getSubject=useSubjectId(SubjectEnum.SEARCH);subject.name=getSubject.name||'全部声部';subject.id=getSubject.id;if(route.path==='/music-songbook/search'){keyword.value='';tagids.value='';activeTab.value='songe';try{var _selectTagRef$value,_selectTagRef$value$r;(_selectTagRef$value=selectTagRef.value)===null||_selectTagRef$value===void 0?void 0:(_selectTagRef$value$r=_selectTagRef$value.resetTags)===null||_selectTagRef$value$r===void 0?void 0:_selectTagRef$value$r.call(_selectTagRef$value);}catch(error){console.log(error);}}return true;});watch(activeTab,function(val){mitter.emit('changeTab',val);});var onSearch=function onSearch(val){keyword.value=val;var indexOf=words.value.indexOf(val);if(indexOf>-1){words.value.splice(indexOf,1);}if(val){words.value.unshift(val);words.value.length=Math.min(words.value.length,5);}mitter.emit('search',val);};var onComfirm=function onComfirm(tags){var name=arguments.length>1&&arguments[1]!==undefined?arguments[1]:'';var data=Object.values(tags).flat().filter(Boolean).join(',');tagids.value=data;mitter.emit('confirm',tags);tagVisibility.value=false;};var onComfirmSubject=function onComfirmSubject(item){// console.log('onSort', item)
subject.name=item.name;subject.id=item.id;useSubjectId(SubjectEnum.SEARCH,JSON.stringify({id:item.id,name:item.name}),'set');mitter.emit('confirmSubject',subject);subject.show=false;};onMounted(function(){});var getSubject=useSubjectId(SubjectEnum.SEARCH);var subject=reactive({show:false,name:getSubject.name||'全部声部',id:getSubject.id||''});return function(){return createVNode("div",{"class":styles.search},[createVNode(Sticky,{"class":styles.sticky},{default:function _default(){return[createVNode(ColSearch,{"modelValue":keyword.value,"showAction":true,"ref":searchInputRef,"onSearch":onSearch,"onFilter":function onFilter(){return tagVisibility.value=true;},"filterDot":!!tagids.value,"onClick":function onClick(){if(route.path==='/music-songbook'){router.push({path:'/music-songbook/search'});}}},{left:function left(){return createVNode("div",{"class":styles.label,"onClick":function onClick(){return subject.show=true;}},[subject.name,createVNode(Icon,{"classPrefix":"iconfont","name":"down","size":12,"color":"#333"},null)]);}}),route.path==='/music-songbook/search'&&createVNode(Tabs,{"color":"var(--van-primary)","background":"transparent","lineWidth":20,"shrink":true,"active":activeTab.value,"onUpdate:active":function onUpdateActive($event){return activeTab.value=$event;},"onChange":function onChange(val){return activeTab.value=val;}},{default:function _default(){return[createVNode(Tab,{"title":"单曲","name":"songe"},null),createVNode(Tab,{"title":"专辑","name":"album"},null)];}})];}}),words.value.length>0&&route.path==='/music-songbook/search'&&createVNode("div",{"class":classNames(styles.keywords,'van-hairline--bottom')},[createVNode("div",{"class":styles.content},[words.value.map(function(item){return createVNode(Tag,{"round":true,"class":styles.searchKeyword,"key":item,"onClick":function onClick(){return onSearch(item);}},_isSlot(item)?item:{default:function _default(){return[item];}});})]),createVNode(Icon,{"class":styles.remove,"name":"delete-o","onClick":function onClick(){return words.value=[];}},null)]),createVNode(RouterView,null,null),createVNode(Popup,{"show":tagVisibility.value,"round":true,"closeable":true,"position":"bottom","style":{height:'60%'},"teleport":"body","onUpdate:show":function onUpdateShow(val){return tagVisibility.value=val;}},{default:function _default(){return[createVNode(SelectTag,{"ref":selectTagRef,"onConfirm":onComfirm,"onCancel":function onCancel(){}},null)];}}),createVNode(Popup,{"show":subject.show,"position":"bottom","round":true,"closeable":true,"safe-area-inset-bottom":true,"onClose":function onClose(){return subject.show=false;},"onClosed":function onClosed(){return subject.show=false;}},{default:function _default(){return[createVNode(SelectSubject,{"isReset":true,"searchParams":subject,"onComfirm":onComfirmSubject},null)];}})]);};}});var header$1=/*#__PURE__*/Object.freeze((_Object$freeze={__proto__:null},_defineProperty(_Object$freeze,Symbol.toStringTag,'Module'),_defineProperty(_Object$freeze,"mitter",mitter),_defineProperty(_Object$freeze,'default',header),_Object$freeze));exports('h',header$1);}};});})();
