PageSourceSearch

https://gunzito.app/assets/Minhas-CchH_hYn.js

js gunzito.app collected 2026-10-04 23:44:14 UTC 14,720 bytes, 1 lines download raw bytes

1import{g as H,j as e,T as V,r,b as c,L as se,P as $,H as te,f as ae,D as le,q as ie,l as re,s as ne,v as oe,w as ce}from"./index-DdG4Nupj.js";import{m as de}from"./inboxMilestones-pIVLvSDZ.js";import{M as xe}from"./MusicCard-C4EZEPBy.js";import{P as me}from"./PageHeader-B0p-yXpn.js";import{E as M,P as pe}from"./PlaylistCard-Bk3FayAG.js";import{D as he,P as be}from"./DownloadButton-BFUolrUn.js";import{P as ue}from"./PullToRefresh-BplbOaBB.js";import{A as fe}from"./AuthGate-DbIP4AA_.js";import{L as je}from"./LazyImage-CzTfhM5t.js";import{i as ye}from"./upcoming-jw5vQHK8.js";import{L as ge}from"./list-plus-BCCaXVjZ.js";import"./arrow-left-BVnlRxMv.js";import"./search-IEkXToFY.js";import"./music-D_9thUQK.js";import"./check-edDZGl4P.js";import"./loader-circle-L6dVC0Z8.js";import"./graduation-cap-yU0VDANi.js";function ke({song:t,rhythm:m,onRemove:f}){const{playSong:h}=H(),g={id:t.id,title:t.title,slug:t.slug,main_artist_name:t.main_artist_name,artist_names:t.artist_names||[],cover_url:t.cover_url,lyrics:t.lyrics,rhythm_id:t.rhythm_id,duration_seconds:t.duration_seconds};return e.jsxs("div",{onClick:()=>h(g),className:"relative bg-white border-[4px] border-black shadow-[8px_8px_0px_#000] hover:translate-x-[2px] hover:translate-y-[2px] hover:shadow-[6px_6px_0px_#000] transition-all cursor-pointer",children:[e.jsxs("div",{className:"relative aspect-square overflow-hidden border-b-[4px] border-black",children:[t.cover_url?e.jsx(je,{src:t.cover_url,alt:t.title,className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full bg-app-bg flex items-center justify-center",children:e.jsx("span",{className:"text-4xl",children:"🎵"})}),e.jsx("button",{onClick:v=>{v.stopPropagation(),f(t.id)},className:"absolute top-1 right-1 w-[36px] h-[36px] rounded-full flex items-center justify-center",style:{backgroundColor:"rgba(0,0,0,0.5)"},"aria-label":"Remover download",children:e.jsx(V,{size:16,color:"#FF006E",strokeWidth:2.5})})]}),e.jsxs("div",{className:"p-2 md:p-3",children:[e.jsx("p",{className:"font-black text-black leading-tight truncate text-xs",children:t.title}),e.jsx("div",{className:"flex items-center justify-between mt-1.5",children:m&&e.jsx("span",{className:"text-[10px] font-black px-1.5 py-0.5 border-[2px] border-black",style:{color:m.color||"#000"},children:m.name})})]})]})}const T=t=>(t||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"");function ve({songs:t,rhythmsMap:m,likedIds:f,onLike:h,onAddQueue:g,playAll:v}){const[b,L]=r.useState(new Set),[_,P]=r.useState(!0),[u,j]=r.useState(!1);r.useEffect(()=>{S()},[]);const S=async()=>{try{const l=await c.auth.me();if(!l)return;const i=await c.entities.PlayHistory.filter({user_email:l.email},"",500);L(new Set(i.map(p=>p.song_id)))}catch{}P(!1)},y=r.useMemo(()=>(t||[]).filter(l=>l.is_active!==!1&&!ye(l)),[t]),w=r.useMemo(()=>{const l=[...y].sort((n,d)=>T(n.title).localeCompare(T(d.title),"pt-BR",{sensitivity:"base"})),i=u?l.filter(n=>!b.has(n.id)):l,p={};return i.forEach(n=>{var E;let d=((E=T(n.title)[0])==null?void 0:E.toUpperCase())||"#";/[A-Z]/.test(d)||(d="#"),(p[d]=p[d]||[]).push(n)}),Object.keys(p).sort().map(n=>({letter:n,items:p[n]}))},[y,b,u]),C=r.useMemo(()=>y.filter(l=>b.has(l.id)).length,[y,b]),N=l=>{const i=document.getElementById(`az-section-${l}`);i&&i.scrollIntoView({behavior:"smooth",block:"start"})};return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-3 flex-wrap",children:[e.jsx("span",{className:"font-black text-xs text-foreground/60",children:_?"Carregando…":`${C} de ${y.length} ouvidas`}),e.jsx("button",{onClick:()=>j(l=>!l),className:`px-3 py-1.5 border-[3px] border-black font-black text-xs hover:translate-x-[1px] hover:translate-y-[1px] transition-all min-h-[36px] ${u?"bg-app-pink text-white":"bg-white text-black"}`,children:u?"● SÓ NÃO OUVIDAS":"○ SÓ NÃO OUVIDAS"})]}),e.jsx("div",{className:"sticky top-[60px] z-10 -mx-1 px-1 py-1.5 bg-app-bg border-y-[3px] border-foreground mb-2 overflow-x-auto no-scrollbar",children:e.jsx("div",{className:"flex gap-1 min-w-max",children:w.map(l=>e.jsx("button",{onClick:()=>N(l.letter),className:"flex-shrink-0 w-7 h-7 flex items-center justify-center border-[2px] border-black font-black text-xs bg-white hover:bg-app-header hover:text-white transition-colors",children:l.letter},l.letter))})}),_?e.jsx("div",{className:"space-y-2",children:[1,2,3,4,5].map(l=>e.jsx("div",{className:"h-14 bg-white border-[3px] border-black animate-pulse"},l))}):w.length===0?e.jsx("div",{className:"text-center py-10 border-[4px] border-black bg-white",children:e.jsx("p",{className:"font-black text-sm text-black/40",children:u?"Você já ouviu tudo! 🎉":"Nenhuma música"})}
1):e.jsx("div",{className:"divide-y-[2px] divide-black/10 bg-white border-[4px] border-black",children:w.map(l=>e.jsxs("div",{children:[e.jsx("div",{id:`az-section-${l.letter}`,className:"px-3 py-1.5 bg-black text-white font-black text-sm sticky top-[104px]",style:{scrollMarginTop:"104px"},children:l.letter}),l.items.map(i=>{const p=b.has(i.id),n=m[i.rhythm_id],d=f.has(i.id);return e.jsxs("div",{className:"flex items-center gap-2 px-2 py-2 min-h-[52px]",children:[e.jsxs(se,{to:`/player/${i.slug||""}`,className:"flex items-center gap-2 flex-1 min-w-0",children:[e.jsx("div",{className:"w-10 h-10 flex-shrink-0 border-[2px] border-black overflow-hidden bg-app-bg",children:i.cover_url?e.jsx("img",{src:i.cover_url,alt:"",className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-lg",children:"🎵"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[!p&&e.jsx("span",{className:"w-2 h-2 rounded-full bg-app-pink flex-shrink-0",title:"Ainda não ouvida"}),e.jsx("span",{className:"font-black text-sm text-black truncate",children:i.title})]}),n&&e.jsx("span",{className:"inline-block mt-0.5 px-1.5 py-0.5 border-[2px] border-black font-black text-[10px]",style:{color:n.color||"#000"},children:n.name})]})]}),e.jsx("button",{onClick:()=>v([i]),className:"flex-shrink-0 w-9 h-9 flex items-center justify-center border-[2px] border-black bg-app-green hover:translate-x-[1px] hover:translate-y-[1px] transition-all","aria-label":"Tocar",children:e.jsx($,{size:16,fill:"#000",color:"#000"})}),e.jsx("button",{onClick:()=>h(i),className:"flex-shrink-0 w-9 h-9 flex items-center justify-center border-[2px] border-black bg-white hover:translate-x-[1px] hover:translate-y-[1px] transition-all","aria-label":"Curtir",children:e.jsx(te,{size:16,fill:d?"#FF006E":"none",color:d?"#FF006E":"#000"})}),e.jsx("button",{onClick:()=>g(i),className:"flex-shrink-0 w-9 h-9 flex items-center justify-center border-[2px] border-black bg-white hover:translate-x-[1px] hover:translate-y-[1px] transition-all","aria-label":"Adicionar à fila",children:e.jsx(ge,{size:16,color:"#000",strokeWidth:2.5})}),e.jsx(he,{song:i,rhythm:n,variant:"row"})]},i.id)})]},l.letter))})]})}function De(){const[t,m]=r.useState(()=>{const s=new URLSearchParams(window.location.search).get("tab");return["curtidas","playlists","baixadas","az"].includes(s)?s:"curtidas"}),[f,h]=r.useState([]),[g,v]=r.useState([]),[b,L]=r.useState([]),[_,P]=r.useState([]),[u,j]=r.useState(new Set),[S,y]=r.useState(!0),[w,C]=r.useState(!1),[N,l]=r.useState({mobile:3,tablet:4,desktop:6}),[i,p]=r.useState(null),[n,d]=r.useState([]),[E,W]=r.useState(0),[Q,D]=r.useState(!1),{addToQueue:B,playAll:z}=H(),U=ae();r.useEffect(()=>{c.auth.isAuthenticated().then(p)},[]),r.useEffect(()=>{i&&O()},[i]);const O=async()=>{try{const s=await c.auth.me();if(!s)return;const[x,a,o,Y,J]=await Promise.all([c.entities.LikedSong.filter({user_email:s.email}),c.entities.Playlist.filter({user_email:s.email,is_active:!0}),c.entities.Song.list("",500),c.entities.Rhythm.list(),c.entities.SiteConfig.list("",100).catch(()=>[])]);h(o.filter(k=>x.some(ee=>ee.song_id===k.id))),v(a),L(o),P(Y),j(new Set(x.map(k=>k.song_id)));const A={};J.forEach(k=>{A[k.config_key]=parseInt(k.config_value)}),l({mobile:A.layout_mobile_cols||3,tablet:A.layout_tablet_cols||4,desktop:A.layout_desktop_cols||6})}catch{}y(!1)},I=async()=>{D(!0);try{const[s,x]=await Promise.all([re(),ne()]);d(s.sort((a,o)=>(o.savedAt||0)-(a.savedAt||0))),W(x)}catch{}D(!1)};r.useEffect(()=>{t==="baixadas"&&I()},[t]);const Z=async s=>{await oe(s),I()},G=async()=>{confirm("Remover todas as músicas baixadas?")&&(await ce(),I())},K=s=>s?s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(0)} KB`:`${(s/1024/1024).toFixed(1)} MB`:"0 B",q=async s=>{const x=await c.auth.me().catch(()=>null);x&&(u.has(s.id)?(j(a=>{const o=new Set(a);return o.delete(s.id),o}),h(a=>a.filter(o=>o.id!==s.id)),c.entities.LikedSong.filter({user_email:x.email,song_id:s.id}).then(a=>{a.length>0&&c.entities.LikedSong.delete(a[0].id)}).catch(()=>{j(a=>new Set([...a,s.id])),h(a=>a.find(o=>o.id===s.id)?a:[...a,s])})):(j(a=>new Set([...a,s.id])),h(a=>a.find(o=>o.id===s.id)?a:[...a,s]),c.entities.LikedSong.create({user_email:x.email,song_id:s.id}).then(()=>de("likes")).catch(()=>{j(a=>
1{const o=new Set(a);return o.delete(s.id),o}),h(a=>a.filter(o=>o.id!==s.id))})))},X=async s=>{try{const x=await c.auth.me();if(!x)return;const a=await c.entities.Playlist.create({name:s,user_email:x.email,song_ids:[],is_active:!0});O(),a!=null&&a.id&&U(`/minhas/playlist/${a.id}?add=true`)}catch{}},R={};_.forEach(s=>{R[s.id]=s});const F=`grid grid-cols-${N.mobile} md:grid-cols-${N.tablet} lg:grid-cols-${N.desktop} gap-3 md:gap-4`;return i===null?null:i?e.jsx(ue,{onRefresh:O,children:e.jsxs("div",{className:"min-h-screen bg-app-bg",children:[e.jsx(me,{}),e.jsxs("div",{className:"px-3 md:px-6 py-4",children:[e.jsxs("div",{className:"flex border-[4px] border-black bg-black mb-6",children:[e.jsx("button",{onClick:()=>m("curtidas"),className:`flex-1 py-3 font-black text-sm text-center transition-colors min-h-[44px] ${t==="curtidas"?"bg-app-header text-white":"bg-black text-white"}`,children:"Curtidas"}),e.jsx("div",{className:"w-[3px] bg-app-bg"}),e.jsx("button",{onClick:()=>m("playlists"),className:"flex-1 py-3 font-black text-sm text-center transition-colors min-h-[44px]",style:{backgroundColor:t==="playlists"?"#00F5FF":"#000",color:t==="playlists"?"#000":"#FFF"},children:"Playlists"}),e.jsx("div",{className:"w-[3px] bg-app-bg"}),e.jsx("button",{onClick:()=>m("baixadas"),className:"flex-1 py-3 font-black text-sm text-center transition-colors min-h-[44px]",style:{backgroundColor:t==="baixadas"?"#39FF14":"#000",color:t==="baixadas"?"#000":"#FFF"},children:"Baixadas"}),e.jsx("div",{className:"w-[3px] bg-app-bg"}),e.jsx("button",{onClick:()=>m("az"),className:"flex-1 py-3 font-black text-sm text-center transition-colors min-h-[44px]",style:{backgroundColor:t==="az"?"#FFD400":"#000",color:t==="az"?"#000":"#FFF"},children:"A–Z"})]}),t==="curtidas"&&e.jsx(e.Fragment,{children:S?e.jsx("div",{className:F,children:[1,2,3,4].map(s=>e.jsxs("div",{className:"bg-white border-[4px] border-black animate-pulse",children:[e.jsx("div",{className:"aspect-square bg-[#E5E5E5] border-b-[4px] border-black"}),e.jsxs("div",{className:"p-2 space-y-2",children:[e.jsx("div",{className:"h-3 bg-[#E5E5E5] w-3/4"}),e.jsx("div",{className:"h-2 bg-[#E5E5E5] w-1/2"})]})]},s))}):f.length===0?e.jsx(M,{message:"Nenhuma música curtida ainda"}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>z(f.filter(s=>s.is_active!==!1)),className:"w-full py-3 border-[4px] border-black font-black text-base mb-4 hover:translate-x-[2px] hover:translate-y-[2px] transition-all min-h-[44px] shadow-[6px_6px_0px_#000] bg-app-header text-white",children:[e.jsx($,{size:18,className:"inline mr-2",fill:"#FFF"}),"TOCAR CURTIDAS"]}),e.jsx("div",{className:F,children:f.map(s=>e.jsx(xe,{song:s,rhythm:R[s.rhythm_id],onLike:q,onAddQueue:B,isLiked:!0},s.id))})]})}),t==="baixadas"&&e.jsx(e.Fragment,{children:Q?e.jsx("div",{className:F,children:[1,2,3].map(s=>e.jsxs("div",{className:"bg-white border-[4px] border-black animate-pulse",children:[e.jsx("div",{className:"aspect-square bg-[#E5E5E5] border-b-[4px] border-black"}),e.jsxs("div",{className:"p-2 space-y-2",children:[e.jsx("div",{className:"h-3 bg-[#E5E5E5] w-3/4"}),e.jsx("div",{className:"h-2 bg-[#E5E5E5] w-1/2"})]})]},s))}):n.length===0?e.jsx(M,{message:"Nenhuma música baixada. Toque no ícone de download em qualquer música para ouvir offline."}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>z(n),className:"w-full py-3 border-[4px] border-black font-black text-base mb-4 hover:translate-x-[2px] hover:translate-y-[2px] transition-all min-h-[44px] shadow-[6px_6px_0px_#000] bg-app-header text-white",children:[e.jsx($,{size:18,className:"inline mr-2",fill:"#FFF"}),"TOCAR BAIXADAS"]}),e.jsx("div",{className:F,children:n.map(s=>e.jsx(ke,{song:s,rhythm:s.rhythm_name?{name:s.rhythm_name,color:s.rhythm_color}:null,onRemove:Z},s.id))}),e.jsxs("div",{className:"mt-4 flex items-center gap-2 border-[4px] border-black bg-white p-3",children:[e.jsx(le,{size:18,strokeWidth:3,color:"#000"}),e.jsxs("span",{className:"font-black text-xs text-black",children:["ARMAZENAMENTO: ",K(E)]})]}),e.jsxs("button",{onClick:G,className:"w-full mt-2 flex items-center justify-center gap-1 py-2.5 border-[4px] border-black font-black text-sm bg-app-pink text-white hover:translate-x-[2px] hover:translate-y-[2px] transition-all min-h-[44px] shadow-[4px_4px_0px_#000]",children:[e.jsx(V,{size:16,strokeWidth:2.5})," LIMPAR TUDO"]})]})}),t==="az"&&e.jsx(ve,{songs:b,rhythmsMap:R,likedIds:u,onLike:q,onAddQueue:B,playAll:z}),t==="playlists"&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>C(!0),className:"w-full py-3 border-[4px] border-black font-black text-base mb-4 hover:translate-x-[2px] hover:translate-y-[2px] transition-all min-h-[44px] shadow-[6px_6px_0px_#000]",style:{backgroundColor:"#39FF14",color:"#000"},children:[e.jsx(ie,{size:20,className:"inline mr-2"}),"CRIAR PLAYLIST"]}),S?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:[1,2,3].map(s=>e.jsxs("div",{className:"flex bg-white border-[4px] border-black animate-pulse",children:[e.jsx("div",{className:"w-16 h-16 flex-shrink-0 bg-[#E5E5E5] border-r-[4px] border-black"}),e.jsxs("div",{className:"flex-1 p-2.5 space-y-2",children:[e.jsx("div",{className:"h-3 bg-[#E5E5E5] w-3/4"}),e.jsx("div",{className:"h-2 bg-[#E5E5E5] w-1/2"})]})]},s))}):g.length===0?e.jsx(M,{message:"Nenhuma playlist ainda"}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:g.map(s=>e.jsx(pe,{playlist:s,songs:b,onClick:()=>U(`/minhas/playlist/${s.id}`)},s.id))})]})]}),e.jsx(be,{isOpen:w,onClose:()=>C(!1),onCreate:X})]})}):e.jsx(fe,{pageKey:"minhas"})}export{De as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.