import{d as f,V as c,a as e,I as n,B as l,u as v,z as m,x as d}from"./vendor.a0144ce9.js";/* empty css               *//* empty css                */import{c as p}from"./index.926ca9c5.js";import{M as g,I}from"./init-user-icon.d5c3c464.js";import{F as h}from"./favorite.9bdf4305.js";import{r as b}from"./index.3d95a92c.js";var j="./assets/favorited.3ea1df17.svg";const y="_item_1i1ve_1",F="_header_1i1ve_8",x="_mate_1i1ve_14",N="_icon_1i1ve_19",V="_info_1i1ve_23",T="_btn_1i1ve_38",w="_vip_1i1ve_46",E="_free_1i1ve_50",L="_charge_1i1ve_54",M="_footer_1i1ve_58",O="_user_1i1ve_63",P="_userIcon_1i1ve_69",S="_favorite_1i1ve_77",A="_tags_1i1ve_80";var s={item:y,header:F,mate:x,icon:N,info:V,btn:T,vip:w,free:E,charge:L,footer:M,user:O,userIcon:P,favorite:S,tags:A};function B(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!d(t)}const C={CHARGE:"\u70B9\u64AD",FREE:"\u514D\u8D39",VIP:"VIP"};var K=f({name:"MusicItem",props:{data:{type:Object,default:{}},onClick:{type:Function}},emits:["favorite"],setup({onClick:t,data:o},{emit:u}){const r=c(o.favorite),i=c(!1),_=async a=>{a.stopPropagation(),i.value=!0;try{await b.post("/api-student/music/sheet/favorite/"+o.id),r.value=!r.value}catch{}i.value=!1,u("favorite")};return()=>e("div",{class:s.item,onClick:()=>{t==null||t(o)}},[e("header",{class:s.header},[e("div",{class:s.mate},[e(n,{src:g,round:!0,class:s.icon},null),e("div",{class:s.info},[e("h4",{class:"van-multi-ellipsis--l2"},[o.musicSheetName]),e("p",null,[o.composer])])]),e("div",{class:s.buttons},[e(l,{class:p(s.btn,s[o.chargeType.toLocaleLowerCase()])},{default:()=>[C[o.chargeType],e(v,{name:"arrow"},null)]})])]),e("footer",{class:s.footer},[e("div",{class:s.user},[e(n,{round:!0,src:o.addUserAvatar||I,class:s.userIcon},null),e("p",null,[o.addName]),e("div",{class:s.tags},[(o.subjectNames||"").split(",").map(a=>e(m,null,B(a)?a:{default:()=>[a]}))])]),e("div",{class:s.icons},[e(l,{style:{border:"none"},onClick:_,loading:i.value},{default:()=>[e(v,{class:s.favorite,name:r.value?j:h},null)]})])])])}});export{j as F,K as I};
