1import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n}from"./framework-DJH1pfSr.js";import{t as r}from"./utils-DXalBF5w.js";import{t as i}from"./createLucideIcon-BRWvWrMn.js";import{t as a}from"./chevron-left-DCfW_DIl.js";import{t as o}from"./chevron-right-DPOXR4xf.js";import{t as s}from"./loader-circle-Cxy4jRlv.js";import{t as c}from"./search-CaA5mzVh.js";import{t as l}from"./sparkles-DoLysNxV.js";import{n as u,r as d,s as f,t as p}from"./dialog-BXYUZ81c.js";import{n as m}from"./series-card-C26Wm8ZK.js";var h=i(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),g=e(t(),1),_=n(),v={placeholder:`Search Anime`,ariaLabel:`Search anime watch orders`,buttonLabel:`Find order`,franchiseHeading:`Franchises`,orderHeading:`Watch orders`,emptyState:`No published match yet. Try Fate, Monogatari, Gundam, Demon Slayer, or Attack on Titan.`};function y({labels:e=v,variant:t=`header`,className:n}){let i={...v,...e},y=(0,g.useRef)(null),[b,x]=(0,g.useState)(!1),[S,C]=(0,g.useState)(``),[w,T]=(0,g.useState)(``),[E,D]=(0,g.useState)([]),[O,k]=(0,g.useState)(1),[A,j]=(0,g.useState)(1),[M,N]=(0,g.useState)(0),[P,F]=(0,g.useState)(!1),[I,L]=(0,g.useState)(``),R=S.trim(),z=E.length>0;(0,g.useEffect)(()=>{if(!b)return;let e=new AbortController,t=window.setTimeout(async()=>{F(!0),L(``);try{let t=new URLSearchParams({page:String(O),pageSize:`10`});R&&t.set(`q`,R);let n=await fetch(`/api/anime/search?${t}`,{signal:e.signal}),r=await n.json();if(!n.ok||r.code!==0)throw Error(r.message||`Search failed`);D(r.data?.franchises||[]),N(r.data?.total||0),j(r.data?.totalPages||1)}catch(t){if(e.signal.aborted)return;D([]),N(0),j(1),L(t instanceof Error?t.message:`Search failed`)}finally{e.signal.aborted||F(!1)}},R?220:0);return()=>{window.clearTimeout(t),e.abort()}},[b,O,R]),(0,g.useEffect)(()=>{k(1)},[R]),(0,g.useEffect)(()=>{if(!b)return;let e=window.setTimeout(()=>y.current?.focus(),80);return()=>window.clearTimeout(e)},[b]);function B(){T(S.trim()),x(!0)}function V(e){e?.preventDefault(),T(R),k(1)}return(0,_.jsxs)(_.Fragment,{children:[t===`hero`?(0,_.jsx)(`form`,{className:r(`relative`,n),onSubmit:e=>{e.preventDefault(),B()},children:(0,_.jsxs)(`label`,{className:`flex min-h-13 items-center gap-3 overflow-hidden rounded-[18px] border border-white/[0.09] bg-[#111722]/88 pl-4 shadow-[0_20px_58px_rgba(0,0,0,0.35)] ring-1 ring-white/[0.035] backdrop-blur focus-within:border-[#ff5a54]/65 focus-within:shadow-[0_22px_64px_rgba(255,68,68,0.18)]`,children:[(0,_.jsx)(`input`,{value:S,onChange:e=>C(e.target.value),className:`min-w-0 flex-1 bg-transparent py-3 pl-1 text-[14px] font-semibold text-white outline-none placeholder:text-white/38`,placeholder:i.placeholder,"aria-label":i.ariaLabel}),(0,_.jsx)(`button`,{type:`submit`,className:`aio-action-glow m-1 grid min-h-11 w-11 place-items-center rounded-[14px] bg-[#d92822] text-white transition-colors hover:bg-[#c8201b]`,"aria-label":i.buttonLabel,children:(0,_.jsx)(c,{className:`size-[18px]`})})]})}):(0,_.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),B()},className:r(`hidden h-11 w-full max-w-[330px] items-center overflow-hidden rounded-full border border-white/[0.08] bg-white/[0.06] shadow-inner shadow-black/20 backdrop-blur md:flex`,n),children:[(0,_.jsx)(`input`,{value:S,onChange:e=>C(e.target.value),"aria-label":i.ariaLabel,className:`min-w-0 flex-1 bg-transparent px-4 text-[13px] font-semibold text-white outline-none placeholder:text-white/42`,placeholder:i.placeholder}),(0,_.jsx)(`button`,{type:`submit`,className:`m-1 grid h-9 w-10 place-items-center rounded-full bg-[#d92822] text-white shadow-[0_10px_24px_rgba(217,40,34,0.24)]`,"aria-label":i.buttonLabel,children:(0,_.jsx)(h,{className:`size-4`})})]}),(0,_.jsx)(p,{open:b,onOpenChange:x,children:(0,_.jsxs)(d,{className:`max-h-[min(780px,calc(100vh-2rem))] gap-0 overflow-visible rounded-[22px] border border-white/[0.09] bg-[#0e141f] p-0 text-white shadow-[0_34px_120px_rgba(0,0,0,0.68)] ring-1 ring-white/[0.045] sm:max-w-3xl`,showCloseButton:!1,children:[(0,_.jsx)(f,{className:`sr-only`,children:`Search anime watch orders`}),(0,_.jsxs)(u,{className:`absolute -top-5 -right-5 z-20 grid size-10 place-items-center rounded-full border border-[#ff5a54]/45 bg-[#171d28]/95 text-white/82 shadow-[0_14px_34px_rgba(0,0,0,0.42)] backdrop-blur transition hover:border-[#ff5a54]/70 hover:bg-[#ff4444]/16 hover:text-white`,children:[(0,_.jsx)(`span`,{className:`text-[24px] leading-none font-light`,children:`Ã`}),(0,_.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),(0,_.jsxs)(`div`,{className:`overflow-hidden rounded-[22px]`,children:[(0,_.jsx)(`div`,{className:`border-b border-white/[0.07] bg-[radial-gradient(circle_at_12%_0%,rgba(255,68,68,0.13),transparent_300px),#151b26] px-4 py-5 sm:px-5`,children:(0,_.jsxs)(`form`,{onSubmit:V,className:`grid gap-2 sm:grid-cols-[minmax(0,1fr)_52px]`,children:[(0,_.jsxs)(`label`,{className:`flex h-12 items-center gap-3 rounded-[15p
1x] border border-white/[0.09] bg-[#0c1119]/92 px-3 shadow-inner shadow-black/25 focus-within:border-[#ff5a54]/70`,children:[(0,_.jsx)(c,{className:`size-4 shrink-0 text-[#ff5a54]`,strokeWidth:2.1}),(0,_.jsx)(`input`,{ref:y,value:S,onChange:e=>C(e.target.value),className:`min-w-0 flex-1 bg-transparent text-[15px] font-semibold text-white outline-none placeholder:text-white/34`,placeholder:i.placeholder,"aria-label":i.ariaLabel})]}),(0,_.jsx)(`button`,{type:`submit`,className:`aio-action-glow grid h-12 place-items-center rounded-[15px] bg-[#d92822] text-white transition hover:bg-[#c8201b]`,"aria-label":i.buttonLabel,children:P?(0,_.jsx)(s,{className:`size-4 animate-spin`}):(0,_.jsx)(c,{className:`size-5`,strokeWidth:2.2})})]})}),(0,_.jsxs)(`div`,{className:`max-h-[560px] overflow-y-auto px-3 py-3 sm:px-4 sm:py-4`,children:[(0,_.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3 px-0.5 text-[12px] text-white/44`,children:[(0,_.jsx)(`span`,{children:R?`Results for "${w||R}"`:`Published starting points`}),P?(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[#ffb1ad]`,children:[(0,_.jsx)(s,{className:`size-3 animate-spin`}),`Searching`]}):null]}),I?(0,_.jsx)(`div`,{className:`rounded-[14px] border border-[#ff4444]/25 bg-[#ff4444]/10 px-4 py-3 text-sm text-[#ffb1ad]`,children:I}):null,!I&&!P&&!z?(0,_.jsx)(`div`,{className:`grid min-h-[180px] place-items-center rounded-[18px] border border-white/[0.08] bg-white/[0.035] p-6 text-center`,children:(0,_.jsxs)(`div`,{children:[(0,_.jsx)(l,{className:`mx-auto
1size-7 text-[#ff5a54]`}),(0,_.jsx)(`p`,{className:`mt-3 text-sm font-bold text-white/72`,children:i.emptyState})]})}):null,z?(0,_.jsx)(`div`,{className:`space-y-3`,children:E.map(e=>(0,_.jsx)(m,{series:e},e.id))}):null]}),A>1?(0,_.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-white/[0.07] bg-[#151b26] px-4 py-3 text-xs font-bold text-white/56 sm:px-5`,children:[(0,_.jsxs)(`span`,{children:[`Page `,O,` of `,A,` / `,M,` results`]}),(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`button`,{type:`button`,onClick:()=>k(e=>Math.max(1,e-1)),disabled:O<=1,className:`grid size-8 place-items-center rounded-full border border-white/10 text-white transition hover:border-[#ff4444]/45 disabled:pointer-events-none disabled:opacity-35`,"aria-label":`Previous search results`,children:(0,_.jsx)(a,{className:`size-4`})}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>k(e=>Math.min(A,e+1)),disabled:O>=A,className:`grid size-8 place-items-center rounded-full border border-white/10 text-white transition hover:border-[#ff4444]/45 disabled:pointer-events-none disabled:opacity-35`,"aria-label":`Next search results`,children:(0,_.jsx)(o,{className:`size-4`})})]})]}):null]})]})})]})}export{y as AnimeSearchDialog};
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.