1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1335],{1335:(e,t,s)=>{s.r(t),s.d(t,{HeaderSearch:()=>h});var a=s(54568),r=s(7620),l=s(97066),n=s(27541),i=s(69686),c=s(92026),o=s(63192),u=s(69236),d=s(78622);function m(e){let{imageUrl:t,label:s,rounded:r="rounded-[var(--radius-md)]",showPlayOverlay:l=!1}=e,n=t?(0,a.jsx)(i.default,{src:t,alt:s,width:48,height:48,className:"object-cover ".concat(r)}):(0,a.jsx)("div",{className:"flex h-12 w-12 items-center justify-center bg-[var(--hover)] text-[var(--accent)] ".concat(r),children:(0,a.jsx)(d.c1,{className:"h-5 w-5"})});return l?(0,a.jsxs)("div",{className:"group/thumb relative flex-shrink-0",children:[n,(0,a.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-black/60 opacity-0 transition-opacity duration-150 group-hover/thumb:opacity-100 ".concat(r),children:(0,a.jsx)(d.jG,{className:"h-5 w-5 text-white",weight:"fill"})})]}):n}function x(e){let{title:t,children:s}=e;return(0,a.jsxs)("div",{className:"border-t border-[var(--border)] px-2 py-2.5 first:border-t-0",children:[(0,a.jsx)("div",{className:"px-2 py-1 text-xs font-semibold uppercase tracking-wider text-[var(--muted)]",children:t}),(0,a.jsx)("div",{className:"space-y-1",children:s})]})}function h(e){let{enabled:t=!0}=e,s=(0,n.useRouter)(),i=(0,l.c)("header.search"),[h,v]=(0,r.useState)(!1),[p,b]=(0,r.useState)(""),[f,j]=(0,r.useState)({tracks:[],artists:[],albums:[],playlists:[]}),[y,g]=(0,r.useState)(!1),w=(0,r.useRef)(null),N=(0,u.Y2)(f.tracks);(0,r.useEffect)(()=>{if(t)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e);function e(e){w.current&&!w.current.contains(e.target)&&v(!1)}},[t]),(0,r.useEffect)(()=>{if(!t){g(!1),j({tracks:[],artists:[],albums:[],playlists:[]});return}let e=p.trim();if(!e)return void j({tracks:[],artists:[],albums:[],playlists:[]});let s=new AbortController,a=window.setTimeout(async()=>{g(!0);try{let t=await (0,o.Ho)(e,s.signal);s.signal.aborted||j({tracks:t.tracks.slice(0,4),artists:t.artists.slice(0,3),albums:t.albums.slice(0,3),playlists:t.playlists.slice(0,3)})}catch(e){s.signal.aborted||j({tracks:[],artists:[],albums:[],playlists:[]})}finally{s.signal.aborted||g(!1)}},300);return()=>{s.abort(),window.clearTimeout(a)}},[t,p]),(0,r.useEffect)(()=>{if(!t)return;let e=e=>{"Escape"===e.key&&v(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t]);let k=N.length>0||f.artists.length>0||f.albums.length>0||f.playlists.length>0,C=e=>{null==e||e.preventDefault();let t=p.trim();t&&(v(!1),s.push("/search?q=".concat(encodeURIComponent(t))))};return t?(0,a.jsx)("div",{className:"min-w-0 flex-1 flex justify-center",ref:w,children:(0,a.jsxs)("form",{onSubmit:C,className:"relative w-full max-w-[700px]",children:[(0,a.jsx)("button",{type:"submit",className:"absolute left-1 top-1/2 flex h-9 w-9 -translate-y-1/2 items-center justify-center rounded-[var(--radius-sm)] text-[var(--muted)] transition-colors hover:bg-[var(--hover)] hover:text-[var(--foreground)]","aria-label":i("ariaLabel"),title:i("ariaLabel"),children:(0,a.jsx)(d.eS,{className:"h-4 w-4"})}),(0,a.jsx)("input",{type:"text",value:p,onChange:e=>b(e.target.value),onFocus:()=>v(!0),"aria-label":i("inputAriaLabel"),placeholder:i("placeholder"),className:"header-search-input h-11 w-full rounded-full border-0 bg-[var(--surface-tertiary)] pl-11 pr-4 text-base md:text-sm text-[var(--foreground)] placeholder:text-[var(--muted)] focus:outline-none"}),h&&p.trim()&&(0,a.jsx)("div",{className:"header-search-popover absolute left-0 right-0 top-[calc(100%+8px)] z-[80] max-h-96 overflow-y-auto rounded-[var(--radius-md)] border border-[var(--border)] bg-[var(--surface)] py-1.5 shadow-[var(--shadow-overlay)]",children:y?(0,a.jsx)("div",{className:"px-4 py-6 text-sm text-[var(--muted)]",children:i("loading")}):k?(0,a.jsxs)(a.Fragment,{children:[N.length>0&&(0,a.jsx)(x,{title:i("sectionTracks"),children:N.map(e=>{var t;return(0,a.jsxs)("button",{type:"button",onClick:()=>{v(!1),s.push("/track/".concat(e.id))},className:"flex h-12 w-full items-center gap-3 rounded-panel px-3 text-left transition-colors duration-150 hover:bg-[var(--surface-secondary)] focus-visible:bg-[var(--hover)]",children:[(0,a.jsx)(m,{imageUrl:(0,c.kj)(e,"small"),label:e.title,showPlayOverlay:!0}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"truncate text-sm text-[var(--foreground)]",children:e.title}),(0,a.jsx)("p",{className:"truncate text-xs text-[var(--muted)]",children:(null==(t=e.artist)?void 0:t.name)||i("unknownArtist")})]})]},e.id)})}),f.artists.length>0&&(0,a.jsx)(x,{title:i("sectionArtists"),children:f.artists.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>{v(!1),s.push("/artist/".concat(e.id))},className:"flex h-12 w-full items-center gap-3 rounded-panel px-3 text-left transition-colors duration-150 hover:bg-[var(--surface-secondary)] focus-visible:bg-[var(--hover)]",children:[(0,a.jsx)(m,{imageUrl:e.avatarUrl,label:e.name,rounded:"rounded-full"}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"truncate text-sm text-[var(--foreground)]",children:e.name}),(0,a.jsx)("p",{className:"truncate text-xs text-[var(--muted)]",children:i("artistFallback")})]})]},e.id))}),f.albums.length>0&&(0,a.jsx)(x,{title:i("sectionAlbums"),children:f.albums.map(e=>{var t;return(0,a.jsxs)("button",{type:"button",onClick:()=>{v(!1),s.push("/album/".concat(e.id))},className:"flex h-12 w-full items-center gap-3 rounded-panel px-3 text-left transition-colors duration-150 hover:bg-[var(--surface-secondary)] focus-visible:bg-[var(--hover)]",children:[(0,a.jsx)(m,{imageUrl:(0,c.kj)(e,"small"),label:e.title,showPlayOverlay:!0}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"truncate text-sm text-[var(--foreground)]",children:e.title}),(0,a.jsx)("p",{className:"truncate text-xs text-[var(--muted)]",children:(null==(t=e.artist)?void 0:t.name)||i("unknownArtist")})]})]},e.id)})}),f.playlists.length>0&&(0,a.jsx)(x,{title:i("sectionPlaylists"),children:f.playlists.map(e=>{var t;return(0,a.jsxs)("button",{type:"button",onClick:()=>{v(!1),s.push("/playlist/".concat(e.id))},className:"flex h-12 w-full items-center gap-3 rounded-panel px-3 text-left transition-colors duration-150 hover:bg-[var(--surface-secondary)] focus-visible:bg-[var(--hover)]",children:[(0,a.jsx)(m,{label:e.title}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"truncate text-sm text-[var(--foreground)]",children:e.title}),(0,a.jsx)("p",{className:"truncate text-xs text-[var(--muted)]",children:(null==(t=e.owner)?void 0:t.name)||i("playlistFallback")})]})]},e.id)})}),(0,a.jsx)("div",{className:"border-t border-[var(--border)] px-4 py-2.5",children:(0,a.jsxs)("button",{type:"button",onClick:()=>C(),className:"flex w-full items-center justify-between text-sm font-medium text-[var(--accent)] transition-colors hover:text-[var(--accent-hover)]",children:[(0,a.jsx)("span",{children:i("viewAll")}),(0,a.jsx)(d.K3,{className:"h-4 w-4"})]})})]}):(0,a.jsx)("div",{className:"px-4 py-6 text-sm text-[var(--muted)]",children:i("empty")})})]})}):(0,a.jsx)("div",{className:"min-w-0 flex-1"})}}}]);
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.