PageSourceSearch

https://sourcelibrary.org/_next/static/immutable/chunks/3xh7i9tmh-1pb.js

js sourcelibrary.org collected 2026-09-24 19:54:09 UTC 82,917 bytes, 4 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="01a0af5b-08ab-79d3-9faa-392d7d7fb210")}catch(e){}}();(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,690454,e=>{"use strict";var t=e.i(843476),s=e.i(500932),a=e.i(271645),r=e.i(846696),l=e.i(522016),o=e.i(657688),n=e.i(555436),i=e.i(173998),c=e.i(778917),d=e.i(687130),u=e.i(37727),m=e.i(531278),x=e.i(865960),g=e.i(284614),h=e.i(346897),p=e.i(341240),b=e.i(810980),f=e.i(763639),j=e.i(373375),y=e.i(463059),v=e.i(899602),w=e.i(735501),k=e.i(664659),N=e.i(707866),_=e.i(618566),S=e.i(100930);let $=["Hermes","Paracelsus","Kabbalah","rasayana","Ficino"],C={en:{numberLocale:"en-US",searchPlaceholder:"Search books, concepts, people, images...",searchFailed:"Search failed. Please try again.",sortRelevance:"Relevance",sortYearNewest:"Year (newest)",sortYearOldest:"Year (oldest)",sortTitleAz:"Title A-Z",browseRecentTranslation:"Recently translated",browseRecent:"Recently added",browseOldestFirst:"Oldest first",browseNewestFirst:"Newest first",browseTitleAsc:"Title A-Z",browseTitleDesc:"Title Z-A",tabAll:"All",tabBooks:"Books",tabIndex:"Index",tabImages:"Images",indexAllTypes:"All Types",indexConcepts:"Concepts",indexPeople:"People",indexPlaces:"Places",indexQuotes:"Quotes",indexKeywords:"Keywords",indexVocabulary:"Vocabulary",filters:"Filters",clear:"Clear",clearAll:"Clear all",done:"Done",filterLanguage:"Language",filterSubject:"Subject",filterCollection:"Collection",filterLibrary:"Library",filterPublishedAfter:"Published after",filterPublishedBefore:"Published before",allLanguages:"All Languages",allCategories:"All Categories",allCollections:"All Collections",allLibraries:"All Libraries",yearFromPlaceholder:"e.g., 1500",yearToPlaceholder:"e.g., 1700",hasTranslation:"Has translation",firstTranslation:"First translation",hasDoi:"Has DOI",signInHeading:"Sign in to keep searching",signInBody:"You’ve used your free searches for now. Sign in — it’s free — to keep exploring over 10,000 primary sources.",signInCta:"Sign in — free",show:"Show",perPage:"per page",showingRange:(e,t)=>`(showing ${e}–${t})`,imagesCount:e=>`${e} images`,booksCount:e=>`${e} books`,inCollection:"in",browseFullCatalog:"Browse Full Catalog",allBooks:"All books",andNMore:e=>`+${e}
1 more`,noImagesFound:"No images found",noImagesBody:"Try searching for a subject, figure, or symbol.",somethingWentWrong:"Something went wrong",couldNotLoadLibrary:"We couldn’t load the library right now.",tryAgain:"Try again",noBooksFound:"No books found",adjustFilters:"Try adjusting your filters.",noResultsFound:"No results found",didYouMean:"Did you mean",corpusBlurb:"Over 10,000 primary sources spanning alchemy, Hermetica, Kabbalah, natural philosophy, Sanskrit rasayana, Chinese classics, Arabic philosophy, and more.",browseAllBooks:"Browse all books",kindReadingRoom:"Reading room",kindLibrary:"Library partner",kindCollection:"Collection",illustrations:"Illustrations",seeAllImages:"See all images",semanticDegraded:"Related results couldn’t be loaded just now — you may be seeing fewer matches than we hold. Try again in a moment.",weakMatchTitle:e=>`No strong matches for “${e}”`,weakMatchBody:"Nothing in the library matches all of your search words. The results below match only part of your search.",conceptualMatches:"Conceptual matches",textMatches:"Text matches",seeAllResults:e=>`See all ${e} results`,passages:"Passages",searchingPageContent:"Searching page content...",catalogMatches:"Catalog matches",works:e=>1===e?"work":"works",searchingCatalog:"Searching catalog...",openAllCatalogueMatches:e=>`Open all ${e} catalogue matches`,relatedFromAi:"Related results from AI-expanded search:",relatedInLibrary:"Related in the Library",foundBooksAndPages:(e,t)=>`Found ${e} books & pages for “${t}”`,foundIndexEntries:(e,t)=>`Found ${e} index entries for “${t}”`,foundImages:(e,t)=>`Found ${e} images for “${t}”`,askLibrarian:"Ask the Librarian",askLibrarianBody:e=>`Want deeper analysis? The Librarian will search across ${e}, cross-reference sources, and build a research notebook you can export.`,askLibrarianScopeResults:e=>`these ${e} results`,askLibrarianScopeCollection:"the collection",editedByAbbrev:"ed.",pageAbbrev:e=>`p. ${e}`,pagesCount:e=>`${e} pages`,translatedCount:e=>`${e} translated`,workEditionsLink:e=>`${e} editions & copies of this work`,findPassages:"Find passages",hidePassages:"Hide passages",searchingEllipsis:"Searching...",searchingPages:"Searching pages...",noMatchingPassages:"No matching passages found in this book.",untitled:"(untitled)",imageFromBook:e=>`from ${e}`,digitized:"Digitized",catalogOnly:"Catalog only",collectionBooks:e=>`${e} books`,illustrationFromCollection:e=>`Illustration from ${e}`,previous:"Previous",next:"Next",pageXofY:(e,t)=>`Page ${e} of ${t}`,imagesEnglishNote:""},es:{numberLocale:"es-ES",searchPlaceholder:"Busca libros, conceptos, personas, imágenes...",searchFailed:"La búsqueda ha fallado. Vuelve a intentarlo.",sortRelevance:"Relevancia",sortYearNewest:"Año (más reciente)",sortYearOldest:"Año (más antiguo)",sortTitleAz:"Título A-Z",browseRecentTranslation:"Traducidos recientemente",browseRecent:"Añadidos recientemente",browseOldestFirst:"Más antiguos primero",browseNewestFirst:"Más recientes primero",browseTitleAsc:"Título A-Z",browseTitleDesc:"Título Z-A",tabAll:"Todo",tabBooks:"Libros",tabIndex:"Índice",tabImages:"Imágenes",indexAllTypes:"Todos los tipos",indexConcepts:"Conceptos",indexPeople:"Personas",indexPlaces:"Lugares",indexQuotes:"Citas",indexKeywords:"Palabras clave",indexVocabulary:"Vocabulario",filters:"Filtros",clear:"Borrar",clearAll:"Borrar todo",done:"Listo",filterLanguage:"Idioma",filterSubject:"Materia",filterCollection:"Colección",filterLibrary:"Biblioteca",filterPublishedAfter:"Publicado después de",filterPublishedBefore:"Publicado antes de",allLanguages:"Todos los idiomas",allCategories:"Todas las materias",allCollections:"Todas las colecciones",allLibraries:"Todas las bibliotecas",yearFromPlaceholder:"p. ej., 1500",yearToPlaceholder:"p. ej., 1700",hasTranslation:"Con traducción",firstTranslation:"Primera traducción",hasDoi:"Con DOI",signInHeading:"Inicia sesión para seguir buscando",signInBody:"Has agotado tus búsquedas gratuitas por ahora. Inicia sesión — es gratis — para seguir explorando más de 10.000 fuentes primarias.",signInCta:"Inicia sesión — es gratis",show:"Mostrar",perPage:"por página",showingRange:(e,t)=>
1`(mostrando ${e}–${t})`,imagesCount:e=>`${e} im\xe1genes`,booksCount:e=>`${e} libros`,inCollection:"en",browseFullCatalog:"Ver el catálogo completo",allBooks:"Todos los libros",andNMore:e=>`+${e} m\xe1s`,noImagesFound:"No se han encontrado imágenes",noImagesBody:"Prueba a buscar un tema, una figura o un símbolo.",somethingWentWrong:"Algo ha ido mal",couldNotLoadLibrary:"No hemos podido cargar la biblioteca en este momento.",tryAgain:"Volver a intentarlo",noBooksFound:"No se han encontrado libros",adjustFilters:"Prueba a ajustar los filtros.",noResultsFound:"No se han encontrado resultados",didYouMean:"¿Quisiste decir",corpusBlurb:"Más de 10.000 fuentes primarias: alquimia, hermetismo, cábala, filosofía natural, rasayana sánscrito, clásicos chinos, filosofía árabe y mucho más.",browseAllBooks:"Ver todos los libros",kindReadingRoom:"Sala de lectura",kindLibrary:"Biblioteca asociada",kindCollection:"Colección",illustrations:"Ilustraciones",seeAllImages:"Ver todas las imágenes",semanticDegraded:"No se han podido cargar los resultados relacionados — puede que veas menos coincidencias de las que tenemos. Inténtalo de nuevo en un momento.",weakMatchTitle:e=>`No hay coincidencias exactas para \xab${e}\xbb`,weakMatchBody:"Nada en la biblioteca coincide con todas las palabras de tu búsqueda. Los resultados siguientes coinciden solo con una parte.",conceptualMatches:"Coincidencias conceptuales",textMatches:"Coincidencias en el texto",seeAllResults:e=>`Ver los ${e} resultados`,passages:"Pasajes",searchingPageContent:"Buscando en el texto de las páginas...",catalogMatches:"Coincidencias en el catálogo",works:e=>1===e?"obra":"obras",searchingCatalog:"Buscando en el catálogo...",openAllCatalogueMatches:e=>`Ver las ${e} coincidencias del cat\xe1logo`,relatedFromAi:"Resultados relacionados de la búsqueda ampliada con IA:",relatedInLibrary:"Relacionado en la biblioteca",foundBooksAndPages:(e,t)=>`${e} libros y p\xe1ginas para \xab${t}\xbb`,foundIndexEntries:(e,t)=>`${e} entradas del \xedndice para \xab${t}\xbb`,foundImages:(e,t)=>`${e} im\xe1genes para \xab${t}\xbb`,askLibrarian:"Pregunta a la fuente",askLibrarianBody:e=>`\xbfQuieres un an\xe1lisis m\xe1s profundo? El Bibliotecario buscar\xe1 en ${e}, contrastar\xe1 las fuentes y armar\xe1 un cuaderno de investigaci\xf3n que podr\xe1s exportar.`,askLibrarianScopeResults:e=>`estos ${e} resultados`,askLibrarianScopeCollection:"la colección",editedByAbbrev:"ed.",pageAbbrev:e=>`p. ${e}`,pagesCount:e=>`${e} p\xe1ginas`,translatedCount:e=>`${e} traducidas`,workEditionsLink:e=>`${e} ediciones y ejemplares de esta obra`,findPassages:"Buscar pasajes",hidePassages:"Ocultar pasajes",searchingEllipsis:"Buscando...",searchingPages:"Buscando en las páginas...",noMatchingPassages:"No se han encontrado pasajes coincidentes en este libro.",untitled:"(sin título)",imageFromBook:e=>`de ${e}`,digitized:"Digitalizado",catalogOnly:"Solo en catálogo",collectionBooks:e=>`${e} libros`,illustrationFromCollection:e=>`Ilustraci\xf3n de ${e}`,previous:"Anterior",next:"Siguiente",pageXofY:(e,t)=>`P\xe1gina ${e} de ${t}`,imagesEnglishNote:"Las descripciones de las ilustraciones están indexadas en inglés, así que la búsqueda de imágenes usa palabras inglesas. Las imágenes se pueden explorar en cualquier idioma."}},L={en:["alchemy",...$],es:["alquimia",...$]},I=new Set(["print","painting","drawing","object","sculpture","fresco","photograph","manuscript","manuscript-illumination","map","emblem","illustration","document","ritual-object"]);var B=e.i(765607),T=e.i(250309),P=e.i(984769),R=e.i(968673),A=e.i(130508);e.i(497608);var q=e.i(594800),E=e.i(113385),F=e.i(825142),M=e.i(140531),z=e.i(993582),U=e.i(956460),O=e.i(218415);let D=[],K=e=>e.toLowerCase().trim().replace(/\s+/g," "),Y=e=>K(e).replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");function H(e){return e.normalize("NFKC").toLowerCase().replace(/[ʻʼ‘’']/g,"").normalize("NFD").replace(/\p{M}/gu,"")}var V=e.i(929718),W=e.i(943942),Q=e.i(793456);function Z(){return(0,W.useWebMCPTools)(X),null}function X(){return[{name:"search_library",description:'Search the Source Library catalogue of historical primary sources (alchemy, Hermetica, Kabbalah, early modern science, and more) by title, author, or full-text content. Returns the top-ranked matches with links — not an exhaustive list, so it cannot answer "how many" or "show me all" questions.',inputSchema:{type:"object",properties:{query:{type:"string",description:"What to search for — a title, author, topic, or phrase."}},required:["query"]},annotations:{readOnlyHint:!0},execute:G}]}async function G(e){let t=String(e.query||"").trim();if(!t)return(0,Q.textResult)("Provide a non-empty query.");let s=await fetch(`/api/search?q=${encodeURIComponent(t)}&limit=10`);if(!s.ok)return(0,Q.textResult)(`Search failed (HTTP ${s.status}). Try again shortly.`);let a=await s.json(),r=a.results||[];if(!r.length)return(0,Q.textResult)(`No results for "${t}".`);let l=window.location.origin,o=r.slice(0,10).map(e=>
1{let t=e.display_title||e.title||e.book_title||"Untitled",s=e.author||e.book_author,a=e.slug||e.id,r=a?` — ${l}/book/${a}`:"",o=[s,e.published].filter(Boolean).join(", ");return`- ${t}${o?` (${o})`:""}${r}`});return(0,Q.textResult)(`${a.total??r.length} result(s) for "${t}":
2${o.join("\n")}`)}var J=e.i(616),ee=e.i(305866),et=e.i(434573),es=e.i(975157),ea=e.i(550033),er=e.i(163035),el=e.i(541262);let eo=[20,48,96],en=[{value:"",labelKey:"indexAllTypes",icon:n.Search},{value:"concept",labelKey:"indexConcepts",icon:p.Lightbulb},{value:"person",labelKey:"indexPeople",icon:g.User},{value:"place",labelKey:"indexPlaces",icon:h.MapPin},{value:"quote",labelKey:"indexQuotes",icon:x.Quote},{value:"keyword",labelKey:"indexKeywords",icon:b.BookOpen},{value:"vocabulary",labelKey:"indexVocabulary",icon:f.Languages}];function ei(e){return e.replace(/<[^>]+>/g,"").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/original:\s*\*[^*]*\*/g,"").replace(/<-|->|#{1,6}\s*/g,"").replace(/\|[\s:_-]+\|/g," ").replace(/\|/g," ").replace(/\s+/g," ").trim()}function ec(e){let a,r,o,n,i,c=(0,s.c)(11),{group:d}=e,u=C[(0,S.useLocale)()],m=(0,S.useLocalePath)();return c[0]!==d.href||c[1]!==m?(a=m(d.href),c[0]=d.href,c[1]=m,c[2]=a):a=c[2],c[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)(N.Library,{className:"w-3.5 h-3.5","aria-hidden":!0}),c[3]=r):r=c[3],c[4]!==d.editions||c[5]!==u?(o=u.workEditionsLink(d.editions),c[4]=d.editions,c[5]=u,c[6]=o):o=c[6],c[7]===Symbol.for("react.memo_cache_sentinel")?(n=(0,t.jsx)(y.ChevronRight,{className:"w-3 h-3"}),c[7]=n):n=c[7],c[8]!==a||c[9]!==o?(i=(0,t.jsx)("div",{className:"px-4 pb-3 -mt-1",children:(0,t.jsxs)(l.default,{href:a,className:"inline-flex items-center gap-1 text-xs text-accent-gold-dark hover:text-accent-gold font-medium transition-colors",children:[r,o,n]})}),c[8]=a,c[9]=o,c[10]=i):i=c[10],i}function ed({result:e,query:s,tenant:r,autoPassages:n,mobileCompact:d}){let u,g=(0,S.useLocale)(),h=C[g],p=(0,S.useLocalePath)(),b=(0,es.getBookThumbnailUrl)({thumbnail:e.thumbnail,thumbnail_blob:e.thumbnail_blob}),f=ei(e.snippet||e.summary||""),[j,y]=(0,a.useState)(!1),[v,w]=(0,a.useState)(null),[N,_]=(0,a.useState)(!1),[$,L]=(0,a.useState)(!1),I=p(`/book/${e.slug||e.book_id}`),B=(0,a.useRef)(!1),T=(0,a.useCallback)(async()=>{if(!v){_(!0),L(!0);try{let t=await fetch(`/api/books/${e.book_id}/search?q=${encodeURIComponent(s)}&lang=${g}`);if(!t.ok)throw Error("Search failed");let a=((await t.json()).results||[]).slice(0,5).map(e=>{let t=e.matches?.find(e=>"translation"===e.field)||e.matches?.[0];return{pageNumber:e.pageNumber,snippet:ei(t?.snippet||""),field:t?.field||"ocr"}}).filter(e=>e.snippet.length>20);w(a)}catch{w([])}finally{_(!1)}}},[e.book_id,s,v,g]),P=window.innerWidth<640;(0,a.useEffect)(()=>{n&&!B.current&&e.translated_count&&e.translated_count>0&&!P&&(B.current=!0,T())},[n,e.translated_count,T]);let R=(0,a.useCallback)(async e=>{(e.preventDefault(),e.stopPropagation(),v)?L(!$):T()},[v,$,T]),A=p("page"===e.type?(0,U.tenantBookUrl)({slug:e.slug,id:e.book_id},r)+`/page-number/${e.page_number}`:(0,U.tenantBookUrl)({slug:e.slug,id:e.book_id},r));return(0,t.jsxs)("div",{className:"bg-white rounded-xl border border-border-light hover:border-accent-rust/30 hover:shadow-md transition-all",children:[(0,t.jsx)(l.default,{href:A,className:`block ${d?"p-3 sm:p-4":"p-4"}`,children:(0,t.jsxs)("div",{className:"flex items-start gap-3 sm:gap-4",children:[b&&!j?(0,t.jsx)(o.default,{src:b,alt:"",width:60,height:84,className:`rounded shadow-sm flex-shrink-0 object-cover ${d?"w-[44px] h-[62px] sm:w-[60px] sm:h-[84px]":""}`,onError:()=>y(!0),unoptimized:!0}):(0,t.jsx)("div",{className:`rounded bg-warm flex items-center justify-center flex-shrink-0 ${d?"w-[44px] h-[62px] sm:w-[60px] sm:h-[84px]":"w-[60px] h-[84px]"}`,children:(0,t.jsx)(i.Book,{className:"w-6 h-6 text-border-medium"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsxs)("h3",{className:"text-lg font-medium text-primary line-clamp-2 font-serif leading-snug",children:[(0,t.jsx)(V.default,{text:e.display_title||e.title,query:s}),"page"===e.type&&(0,t.jsx)("span",{className:"text-muted font-normal text-sm ml-2",children:h.pageAbbrev(e.page_number)})]}),(0,t.jsxs)("p",{className:"text-sm text-secondary mt-0.5",children:["editor"===(u=(0,ea.getEffectiveByline)(e)).role?(0,t.jsxs)(t.Fragment,{children:[h.editedByAbbrev," ",(0,t.jsx)(V.default,{text:u.editor,query:s})]}):(0,t.jsx)(V.default,{text:e.author,query:s})," · ",e.published]})]}),e.has_doi&&e.doi&&(0,t.jsxs)("a",{href:`https://doi.org/${e.doi}`,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"flex items-center gap-1 px-2 py-1 bg-accent-sage/15 text-accent-sage-dark rounded text-xs font-medium hover:bg-accent-sage/25 flex-shrink-0",children:["DOI ",(0,t.jsx)(c.ExternalLink,{className:"w-3 h-3"})]})]}),f?(0,t.jsx)("p",{className:`mt-1.5 text-sm text-secondary font-body leading-relaxed ${d?"line-clamp-1 sm:line-clamp-2":"line-clamp-2"}`,children:(0,t.jsx)(V.default,{text:f,query:s})}):e.categories&&e.categories.length>0?(0,t.jsx)("div",{className:"mt-1.5 flex flex-wrap gap-1",children:e.categories.slice(0,d?2:4).map(e=>(0,t.jsx)("span",{className:"text-xs px-2 py-0.5 bg-warm text-muted rounded-full",children:e},e))}):null,(0,t.jsxs)("div",{className:"mt-1.5 flex items-center gap-3 text-xs text-muted",children:["book"===e.type&&e.page_count&&(0,t.jsxs)("span",{children:[h.pagesCount(e.page_count),e.translated_count?` \xb7 ${h.translatedCount(e.translated_count)}`:""]}),"book"===e.type&&e.translated_count&&e.translated_count>0&&(0,t.jsx)("button",{onClick:R,className:"text-accent-rust hover:text-accent-rust-dark font-medium transition-colors",children:N?(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)(m.Loader2,{className:"w-3 h-3 animate-spin"})," ",h.searchingEllipsis]}):$?(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)(k.ChevronDown,{className:"w-3 h-3 rotate-180 transition-transform"})," ",h.hidePassages]}):(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)(x.Quote,{className:"w-3 h-3"})," ",h.findPassages]})})]})]})]})}),e.work_group&&(0,t.jsx)(ec,{group:e.work_group}),$&&(0,t.jsx)("div",{className:"px-4 pb-4 -mt-1",children:N?(0,t.jsx)("div",{className:"text-xs text-muted py-2",children:h.searchingPages}):v&&v.length>0?(0,t.jsx)("div",{className:"space-y-2 border-t border-border-light pt-3",children:v.map((e,a)=>(0,t.jsxs)(l.default,{href:`${I}/page-number/${e.pageNumber}`,className:"block text-sm py-1.5 px-3 rounded-lg hover:bg-warm transition-colors group",children:[(0,t.jsx)("span",{className:"text-muted text-xs font-medium mr-2",children:h.pageAbbrev(e.pageNumber)}),(0,t.jsxs)("span",{className:"text-secondary italic font-body",children:["“",(0,t.jsx)(V.default,{text:e.snippet.slice(0,200),query:s}),e.snippet.length>200?"...":"","”"]})]},a))}):v?(0,t.jsx)("p",{className:"text-xs text-muted py-2 border-t border-border-light pt-3",children:h.noMatchingPassages}):null})]})}function eu(e){let r,n,i,c,d,u,m,x,g,h,p,b,f=(0,s.c)(33),{col:j}=e,y=C[(0,S.useLocale)()],v=(0,S.useLocalePath)(),[w,k]=(0,a.useState)(!1),[N,_]=(0,a.useState)(null);f[0]!==j.slug?(r=()=>{let e=e=>{let t=e.detail;t?.slug===j.slug&&(_(t),k(!1))};return window.addEventListener(el.COVER_EVENT,e),()=>window.removeEventListener(el.COVER_EVENT,e)},n=[j.slug],f[0]=j.slug,f[1]=r,f[2]=n):(r=f[1],n=f[2]),(0,a.useEffect)(r,n);let $=N?N.url:j.hero_image,L=N?N.framing:j.card_framing,I=`/collections/${j.slug}`;return f[3]!==v||f[4]!==I?(i=v(I),f[3]=v,f[4]=I,f[5]=i):i=f[5],f[6]!==j.name||f[7]!==L||f[8]!==w||f[9]!==$||f[10]!==y?(c=$&&!w?(0,t.jsx)("div",{className:"absolute inset-0 overflow-hidden transition-transform duration-500 ease-out group-hover:scale-105",children:(0,t.jsx)(o.default,{src:$,alt:y.illustrationFromCollection(j.name),fill:!0,sizes:"(max-width: 640px) 50vw, 33vw",className:"object-cover",style:(0,el.cardFramingStyle)(L),unoptimized:!0,onError:()=>k(!0)})}):(0,t.jsx)("div",{className:"absolute inset-0 bg-warm"}),f[6]=j.name,f[7]=L,f[8]=w,f[9]=$,f[10]=y,f[11]=c):c=f[11],f[12]===Symbol.for("react.memo_cache_sentinel")?(d=(0,t.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-[rgba(26,22,18,0.85)] via-[rgba(26,22,18,0.35)] to-transparent"}),f[12]=d):d=f[12],f[13]!==j.book_count||f[14]!==y?(u=y.collectionBooks(j.book_count.toLocaleStr
2ing(y.numberLocale)),f[13]=j.book_count,f[14]=y,f[15]=u):u=f[15],f[16]!==u?(m=(0,t.jsx)("p",{className:"text-white/50 text-[11px] mb-1",children:u}),f[16]=u,f[17]=m):m=f[17],f[18]!==j.name?(x=(0,t.jsx)("h3",{className:"font-serif text-sm sm:text-base text-white font-semibold leading-tight line-clamp-2 group-hover:text-accent-gold transition-colors",children:j.name}),f[18]=j.name,f[19]=x):x=f[19],f[20]!==m||f[21]!==x?(g=(0,t.jsxs)("div",{className:"absolute inset-0 flex flex-col justify-end p-3",children:[m,x]}),f[20]=m,f[21]=x,f[22]=g):g=f[22],f[23]!==g||f[24]!==i||f[25]!==c?(h=(0,t.jsxs)(l.default,{href:i,className:"group relative block overflow-hidden rounded-lg aspect-square",children:[c,d,g]}),f[23]=g,f[24]=i,f[25]=c,f[26]=h):h=f[26],f[27]!==j.name||f[28]!==j.slug?(p=(0,t.jsx)(er.default,{slug:j.slug,name:j.name}),f[27]=j.name,f[28]=j.slug,f[29]=p):p=f[29],f[30]!==h||f[31]!==p?(b=(0,t.jsxs)("div",{className:"relative group",children:[h,p]}),f[30]=h,f[31]=p,f[32]=b):b=f[32],b}function em(e){let r,n,c,d,u,m,x,g,h,p,b,f,j,y=(0,s.c)(38),{result:v}=e,w=C[(0,S.useLocale)()],k=(0,S.useLocalePath)();y[0]!==v.thumbnail||y[1]!==v.thumbnail_blob?(r=(0,es.getBookThumbnailUrl)({thumbnail:v.thumbnail,thumbnail_blob:v.thumbnail_blob}),y[0]=v.thumbnail,y[1]=v.thumbnail_blob,y[2]=r):r=y[2];let N=r,[_,$]=(0,a.useState)(!1),L=`/book/${v.slug||v.book_id}`;y[3]!==k||y[4]!==L?(n=k(L),y[3]=k,y[4]=L,y[5]=n):n=y[5],y[6]!==N||y[7]!==_?(c=N&&!_?(0,t.jsx)(o.default,{src:N,alt:"",width:60,height:84,className:"rounded shadow-sm flex-shrink-0 object-cover w-[44px] h-[62px] sm:w-[60px] sm:h-[84px]",unoptimized:!0,onError:()=>$(!0)}):(0,t.jsx)("div",{className:"w-[44px] h-[62px] sm:w-[60px] sm:h-[84px] rounded bg-warm flex items-center justify-center flex-shrink-0",children:(0,t.jsx)(i.Book,{className:"w-6 h-6 text-border-medium"})}),y[6]=N,y[7]=_,y[8]=c):c=y[8],y[9]!==v.title?(d=(0,t.jsx)("h3",{className:"font-serif text-primary font-medium leading-snug",children:v.title}),y[9]=v.title,y[10]=d):d=y[10];e:{let e;y[11]!==v.author||y[12]!==v.editor?(e=(0,ea.getEffectiveByline)({author:v.author,editor:v.editor}),y[11]=v.author,y[12]=v.editor,y[13]=e):e=y[13];let t=e;if("editor"===t.role){u=`${w.editedByAbbrev} ${t.editor}`;break e}u=v.author||""}let I=v.year?` \xb7 ${v.year}`:"",B=v.language?` \xb7 ${v.language}`:"";return y[14]!==u||y[15]!==I||y[16]!==B?(m=(0,t.jsxs)("p",{className:"text-sm text-muted mt-0.5",children:[u,I,B]}),y[14]=u,y[15]=I,y[16]=B,y[17]=m):m=y[17],y[18]!==v.summary_snippet?(x=v.summary_snippet&&(0,t.jsx)("p",{className:"text-sm text-secondary mt-1.5 line-clamp-1 sm:line-clamp-2",children:v.summary_snippet}),y[18]=v.summary_snippet,y[19]=x):x=y[19],y[20]!==v.relevance_hint?(g=v.relevance_hint&&(0,t.jsx)("p",{className:"text-xs text-violet-500 mt-1",children:v.relevance_hint}),y[20]=v.relevance_hint,y[21]=g):g=y[21],y[22]!==x||y[23]!==g||y[24]!==d||y[25]!==m?(h=(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[d,m,x,g]}),y[22]=x,y[23]=g,y[24]=d,y[25]=m,y[26]=h):h=y[26],y[27]!==h||y[28]!==c?(p=(0,t.jsxs)("div",{className:"flex items-start gap-3 sm:gap-4",children:[c,h]}),y[27]=h,y[28]=c,y[29]=p):p=y[29],y[30]!==p||y[31]!==n?(b=(0,t.jsx)(l.default,{href:n,className:"block p-3 sm:p-4",children:p}),y[30]=p,y[31]=n,y[32]=b):b=y[32],y[33]!==v.work_group?(f=v.work_group&&(0,t.jsx)(ec,{group:v.work_group}),y[33]=v.work_group,y[34]=f):f=y[34],y[35]!==b||y[36]!==f?(j=(0,t.jsxs)("div",{className:"bg-white rounded-xl border border-border-light hover:border-accent-rust/30 hover:shadow-md transition-all",children:[b,f]}),y[35]=b,y[36]=f,y[37]=j):j=y[37],j}function ex(e){let r,n,c,d,u,m,x,g,h,p,b=(0,s.c)(35),{result:f,tenant:j}=e,y=C[(0,S.useLocale)()],v=(0,S.useLocalePath)();b[0]!==f.thumbnail||b[1]!==f.thumbnail_blob?(r=(0,es.getBookThumbnailUrl)({thumbnail:f.thumbnail,thumbnail_blob:f.thumbnail_blob}),b[0]=f.thumbnail,b[1]=f.thumbnail_blob,b[2]=r):r=b[2];let w=r,k=f.snippet||f.summary,[N,_]=(0,a.useState)(!1);b[3]!==v||b[4]!==f.book_id||b[5]!==f.page_number||b[6]!==f.slug||b[7]!==f.type||b[8]!==j?(n=v("page"===f.type?(0,U.tenantBookUrl)({slug:f.slug,id:f.book_id}
2,j)+`/page-number/${f.page_number}`:(0,U.tenantBookUrl)({slug:f.slug,id:f.book_id},j)),b[3]=v,b[4]=f.book_id,b[5]=f.page_number,b[6]=f.slug,b[7]=f.type,b[8]=j,b[9]=n):n=b[9],b[10]!==w||b[11]!==N?(c=w&&!N?(0,t.jsx)(o.default,{src:w,alt:"",width:48,height:68,className:"rounded shadow-sm flex-shrink-0 object-cover",unoptimized:!0,onError:()=>_(!0)}):(0,t.jsx)("div",{className:"w-[48px] h-[68px] rounded bg-warm-hover flex items-center justify-center flex-shrink-0",children:(0,t.jsx)(i.Book,{className:"w-5 h-5 text-border-medium"})}),b[10]=w,b[11]=N,b[12]=c):c=b[12];let $=f.display_title||f.title;b[13]!==$?(d=(0,t.jsx)("h3",{className:"font-serif font-medium text-primary text-sm leading-tight line-clamp-1",children:$}),b[13]=$,b[14]=d):d=b[14];e:{let e;b[15]!==f?(e=(0,ea.getEffectiveByline)(f),b[15]=f,b[16]=e):e=b[16];let t=e;if("editor"===t.role){u=`${y.editedByAbbrev} ${t.editor}`;break e}u=f.author||""}let L=f.published?`, ${f.published}`:"";return b[17]!==f.page_number||b[18]!==f.type||b[19]!==y?(m="page"===f.type&&f.page_number&&(0,t.jsxs)("span",{children:[" · ",y.pageAbbrev(f.page_number)]}),b[17]=f.page_number,b[18]=f.type,b[19]=y,b[20]=m):m=b[20],b[21]!==u||b[22]!==L||b[23]!==m?(x=(0,t.jsxs)("p",{className:"text-xs text-muted mt-0.5",children:[u,L,m]}),b[21]=u,b[22]=L,b[23]=m,b[24]=x):x=b[24],b[25]!==k?(g=k&&(0,t.jsx)("p",{className:"text-xs text-secondary mt-1 line-clamp-2",children:k}),b[25]=k,b[26]=g):g=b[26],b[27]!==x||b[28]!==g||b[29]!==d?(h=(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[d,x,g]}),b[27]=x,b[28]=g,b[29]=d,b[30]=h):h=b[30],b[31]!==h||b[32]!==n||b[33]!==c?(p=(0,t.jsxs)(l.default,{href:n,className:"flex items-start gap-3 p-3 bg-warm rounded-lg hover:bg-warm-hover transition-colors",children:[c,h]}),b[31]=h,b[32]=n,b[33]=c,b[34]=p):p=b[34],p}function eg(e){let a,r,o,n,i,c,d,u,m=(0,s.c)(33),{result:x,query:g,tenant:h}=e,p=C[(0,S.useLocale)()],b=(0,S.useLocalePath)();if(m[0]!==x.type||m[1]!==p){var f;let e;f=x.type,a=(e=en.find(e=>e.value===f)?.labelKey)?p[e]:f,m[0]=x.type,m[1]=p,m[2]=a}else a=m[2];let j=a,y="quote"===x.type;m[3]!==y||m[4]!==b||m[5]!==x.book_id||m[6]!==x.book_slug||m[7]!==x.pages||m[8]!==x.quote_page||m[9]!==h?(r=b(y&&x.quote_page?(0,U.tenantBookUrl)({slug:x.book_slug,id:x.book_id},h)+`/guide?page=${x.quote_page}`:x.pages&&x.pages.length>0?(0,U.tenantBookUrl)({slug:x.book_slug,id:x.book_id},h)+`/guide?page=${x.pages[0]}`:(0,U.tenantBookUrl)({slug:x.book_slug,id:x.book_id},h)),m[3]=y,m[4]=b,m[5]=x.book_id,m[6]=x.book_slug,m[7]=x.pages,m[8]=x.quote_page,m[9]=h,m[10]=r):r=m[10];let v=r,w=`text-xs px-2 py-0.5 rounded-full ${(J.SEARCH_TYPE_STYLES[x.type]??J.SEARCH_TYPE_STYLES.keyword).badge}`;return m[11]!==w||m[12]!==j?(o=(0,t.jsx)("span",{className:w,children:j}),m[11]=w,m[12]=j,m[13]=o):o=m[13],m[14]!==y||m[15]!==g||m[16]!==x.quote_significance||m[17]!==x.quote_text||m[18]!==x.term?(n=y?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("blockquote",{className:"font-serif text-lg text-primary italic border-l-2 border-accent-gold/40 pl-3 my-2",children:["“",(0,t.jsx)(V.default,{text:x.quote_text||"",query:g}),"”"]}),x.quote_significance&&(0,t.jsx)("p",{className:"text-sm text-secondary mt-1",children:(0,t.jsx)(V.default,{text:x.quote_significance,query:g})})]}):(0,t.jsx)("h3",{className:"text-lg font-medium text-primary mt-1 font-serif",children:(0,t.jsx)(V.default,{text:x.term,query:g})}),m[14]=y,m[15]=g,m[16]=x.quote_significance,m[17]=x.quote_text,m[18]=x.term,m[19]=n):n=m[19],m[20]!==x.pages?(i=x.pages&&x.pages.length>0&&(0,t.jsxs)("span",{className:"ml-1",children:["· p. ",x.pages.slice(0,3).join(", "),x.pages.length>3&&` +${x.pages.length-3}`]}),m[20]=x.pages,m[21]=i):i=m[21],m[22]!==x.book_author||m[23]!==x.book_title||m[24]!==i?(c=(0,t.jsxs)("p",{className:"text-sm text-muted mt-1.5",children:[x.book_title," · ",x.book_author,i]}),m[22]=x.book_author,m[23]=x.book_title,m[24]=i,m[25]=c):c=m[25],m[26]!==o||m[27]!==n||m[28]!==c?(d=(0,t.jsxs)("div",{className:"min-w-0",children:[o,n,c]}),m[26]=o,m[27]=n,m[28]=c,m[29]=d):d=m[29],m[30]!==v||m[31]!==d?(u=(0,t.jsx)(l.default,{href:v,className:"block bg-white rounded-xl border border-border-light p-4 hover:border-accent-violet/30 hover:shadow-md transition-all",children:d}),m[30]=v,m[31]=d,m[32]=u):u=m[32],u}function eh(e){let r,n,i,c,d,u,m,x,g,h,p=(0,s.c)(37),{item:b,query:f,large:j,tenant:y}=e,[v,k]=(0,a.useState)(!1),N=C[(0,S.useLocale)()],_=b.aiTerm?`related \xb7 ${b.aiTerm}`:b.visualMatch?"visual match":null,$=!0===b.isArtwork||"artwork"===b.source;if(p[0]!==$||p[1]!==b.artworkType||p[2]!==b.type){let e;r=$?(e=(b.artworkType||b.type||"").trim().toLowerCase())&&I.has(e)?e.replace(/-/g," "):"artwork":null,p[0]=$,p[1]=b.artworkType,p[2]=b.type,p[3]=r}else r=p[3];let L=r;p[4]!==$||p[5]!==b.author||p[6]!==b.bookTitle||p[7]!==b.holder||p[8]!==N?(n=$?b.holder||b.author||null:b.bookTitle?N.imageFromBook(b.bookTitle):null,p[4]=$,p[5]=b.author,p[6]=b.bookTitle,p[7]=b.holder,p[8]=N,p[9]=n):n=p[9];let B=n,T=!$&&b.pageNumber>0?`p. ${b.pageNumber}`:null,P=b.thumbnailUrl||b.extractedUrl||b.imageUrl,R=y?`/${y}/gallery/image/${b.pageId}-${b.detectionIndex}`:`/gallery/image/${b.pageId}-${b.detectionIndex}`,A=b.link||(b.artworkSlug?`/artwork/${b.artworkSlug}`:null),q=$&&A?A:R,E=`relative bg-warm ${j?"aspect-[3/4]":"aspect-square"}`;return p[10]!==P||p[11]!==v||p[12]!==b.description||p[13]!==j?(i=!v&&P?(0,t.jsx)(o.default,{src:P,alt:b.description,fill:!0,className:"object-cover group-hover:scale-105 transition-transform duration-300",sizes:j?"(max-width: 640px) 50vw, (max-width: 1024px) 25vw, 20vw":"(max-width: 640px) 50vw, 16vw",onError:()=>k(!0),unoptimized:!0}):(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,t.jsx)(w.ImageIcon,{className:"w-8 h-8 text-border-medium"})}),p[10]=P,p[11]=v,p[12]=b.description,p[13]=j,p[14]=i):i=p[14],p[15]!==_||p[16]!==L?(c=(_||L)&&(0,t.jsxs)("div",{className:"absolute top-1.5 left-1.5 flex flex-col items-start gap-1",children:[L&&(0,t.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-black/55 text-[10px] leading-tight text-white/90 backdrop-blur-sm",children:L}),_&&(0,t.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-black/55 text-[10px] leading-tight text-white/90 backdrop-blur-sm",children:_})]}),p[15]=_,p[16]=L,p[17]=c):c=p[17],p[18]!==E||p[19]!==i||p[20]!==c?(d=(0,t.jsxs)("div",{className:E,
2children:[i,c]}),p[18]=E,p[19]=i,p[20]=c,p[21]=d):d=p[21],p[22]!==b.description||p[23]!==f?(u=f?(0,t.jsx)(V.default,{text:b.description,query:f}):b.description,p[22]=b.description,p[23]=f,p[24]=u):u=p[24],p[25]!==u?(m=(0,t.jsx)("p",{className:"text-sm text-secondary line-clamp-2 mb-1",children:u}),p[25]=u,p[26]=m):m=p[26],p[27]!==T||p[28]!==B?(x=B&&(0,t.jsxs)("p",{className:"text-xs text-muted flex items-baseline gap-1",children:[(0,t.jsx)("span",{className:"truncate",children:B}),T&&(0,t.jsxs)("span",{className:"shrink-0",children:["· ",T]})]}),p[27]=T,p[28]=B,p[29]=x):x=p[29],p[30]!==x||p[31]!==m?(g=(0,t.jsxs)("div",{className:"p-2.5",children:[m,x]}),p[30]=x,p[31]=m,p[32]=g):g=p[32],p[33]!==g||p[34]!==q||p[35]!==d?(h=(0,t.jsxs)(l.default,{href:q,className:"group block bg-white rounded-lg border border-border-light overflow-hidden hover:border-accent-gold/30 hover:shadow-md transition-all",children:[d,g]}),p[33]=g,p[34]=q,p[35]=d,p[36]=h):h=p[36],h}function ep(e){let r,n,c,d,u,m,x,g,h,p,b,f,j=(0,s.c)(44),{work:y,query:v,tenant:w,digitizedAlsoInBooks:k}=e,N=C[(0,S.useLocale)()],_=(0,S.useLocalePath)(),$=y.title||y.full_title||y.parallel_title||y.uniform_title||N.untitled,L=y.author||y.variant_author;j[0]!==L||j[1]!==y.place||j[2]!==y.year?(r=[L,y.year,y.place].filter(Boolean),j[0]=L,j[1]=y.place,j[2]=y.year,j[3]=r):r=j[3];let I=r.join(" · "),B=!!y.sl_book_id,T=y.ubn||y.uuid;j[4]!==T||j[5]!==B||j[6]!==_||j[7]!==w||j[8]!==y.sl_book_id||j[9]!==y.sl_book_slug?(n=_(B&&y.sl_book_id?(0,U.tenantBookUrl)({id:y.sl_book_id,slug:y.sl_book_slug||y.sl_book_id},w):`/catalog/${encodeURIComponent(T||"")}`),j[4]=T,j[5]=B,j[6]=_,j[7]=w,j[8]=y.sl_book_id,j[9]=y.sl_book_slug,j[10]=n):n=j[10];let P=n,[R,A]=(0,a.useState)(!1),q=`block bg-white rounded-lg border border-border-light hover:border-accent-gold/40 hover:shadow-sm transition-all ${k?"p-2.5":"p-3 sm:p-4"}`;j[11]!==k||j[12]!==R||j[13]!==y.thumbnail?(c=y.thumbnail&&!R?(0,t.jsx)(o.default,{src:y.thumbnail,alt:"",width:48,height:68,className:`rounded shadow-sm flex-shrink-0 object-cover ${k?"w-[36px] h-[50px]":"w-[48px] h-[68px]"}`,onError:()=>A(!0),unoptimized:!0}):(0,t.jsx)("div",{className:`rounded bg-warm flex items-center justify-center flex-shrink-0 ${k?"w-[36px] h-[50px]":"w-[48px] h-[68px]"}`,children:(0,t.jsx)(i.Book,{className:"w-5 h-5 text-border-medium"})}),j[11]=k,j[12]=R,j[13]=y.thumbnail,j[14]=c):c=j[14];let E=`font-medium text-primary leading-snug ${k?"text-sm":"text-base"}`;j[15]!==v||j[16]!==$?(d=v?(0,t.jsx)(V.default,{text:$,query:v}):$,j[15]=v,j[16]=$,j[17]=d):d=j[17],j[18]!==E||j[19]!==d?(u=(0,t.jsx)("h3",{className:E,children:d}),j[18]=E,j[19]=d,j[20]=u):u=j[20];let F=`flex-shrink-0 inline-flex items-center px-1.5 py-0.5 rounded-full text-[10px] font-medium uppercase tracking-wide ${B?"bg-accent-rust/10 text-accent-rust":"bg-cream border border-border-light text-muted"}
2`,M=B?N.digitized:N.catalogOnly;return j[21]!==F||j[22]!==M?(m=(0,t.jsx)("span",{className:F,children:M}),j[21]=F,j[22]=M,j[23]=m):m=j[23],j[24]!==m||j[25]!==u?(x=(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[u,m]}),j[24]=m,j[25]=u,j[26]=x):x=j[26],j[27]!==k||j[28]!==I?(g=I&&(0,t.jsx)("p",{className:`text-muted mt-0.5 ${k?"text-xs":"text-sm"}`,children:I}),j[27]=k,j[28]=I,j[29]=g):g=j[29],j[30]!==k||j[31]!==y.shelf_mark?(h=y.shelf_mark&&!k&&(0,t.jsx)("p",{className:"text-xs text-muted/80 mt-0.5 font-mono",children:y.shelf_mark}),j[30]=k,j[31]=y.shelf_mark,j[32]=h):h=j[32],j[33]!==x||j[34]!==g||j[35]!==h?(p=(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[x,g,h]}),j[33]=x,j[34]=g,j[35]=h,j[36]=p):p=j[36],j[37]!==p||j[38]!==c?(b=(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[c,p]}),j[37]=p,j[38]=c,j[39]=b):b=j[39],j[40]!==P||j[41]!==b||j[42]!==q?(f=(0,t.jsx)(l.default,{href:P,className:q,children:b}),j[40]=P,j[41]=b,j[42]=q,j[43]=f):f=j[43],f}function eb(e){let a,r,l,o,n,i,c,d,u,m=(0,s.c)(29),{total:x,offset:g,setOffset:h,loading:p,pageSize:b}=e,f=C[(0,S.useLocale)()];if(x<=b||p)return null;m[0]!==g||m[1]!==b||m[2]!==h?(a=()=>{h(Math.max(0,g-b)),window.scrollTo(0,0)},m[0]=g,m[1]=b,m[2]=h,m[3]=a):a=m[3];let v=0===g;m[4]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)(j.ChevronLeft,{className:"w-4 h-4"}),m[4]=r):r=m[4],m[5]!==f.previous||m[6]!==a||m[7]!==v?(l=(0,t.jsxs)("button",{onClick:a,disabled:v,className:"flex items-center gap-1.5 px-4 py-2 text-sm font-medium rounded-lg border border-border-medium text-secondary transition-colors disabled:opacity-40 disabled:cursor-not-allowed hover:bg-warm",children:[r," ",f.previous]}),m[5]=f.previous,m[6]=a,m[7]=v,m[8]=l):l=m[8],m[9]!==g||m[10]!==b||m[11]!==f||m[12]!==x?(o=f.pageXofY((Math.floor(g/b)+1).toLocaleString(f.numberLocale),Math.ceil(x/b).toLocaleString(f.numberLocale)),m[9]=g,m[10]=b,m[11]=f,m[12]=x,m[13]=o):o=m[13],m[14]!==o?(n=(0,t.jsx)("span",{className:"text-sm text-muted",children:o}),m[14]=o,m[15]=n):n=m[15],m[16]!==g||m[17]!==b||m[18]!==h?(i=()=>{h(g+b),window.scrollTo(0,0)},m[16]=g,m[17]=b,m[18]=h,m[19]=i):i=m[19];let w=g+b>=x;return m[20]===Symbol.for("react.memo_cache_sentinel")?(c=(0,t.jsx)(y.ChevronRight,{className:"w-4 h-4"}),m[20]=c):c=m[20],m[21]!==f.next||m[22]!==i||m[23]!==w?(d=(0,t.jsxs)("button",{onClick:i,disabled:w,className:"flex items-center gap-1.5 px-4 py-2 text-sm font-medium rounded-lg border border-border-medium text-secondary transition-colors disabled:opacity-40 disabled:cursor-not-allowed hover:bg-warm",children:[f.next," ",c]}),m[21]=f.next,m[22]=i,m[23]=w,m[24]=d):d=m[24],m[25]!==d||m[26]!==l||m[27]!==n?(u=(0,t.jsxs)("div",{className:"flex items-center justify-center gap-4 mt-8 pt-6 border-t border-border-light",children:[l,n,d]}),m[25]=d,m[26]=l,m[27]=n,m[28]=u):u=m[28],u}e.s(["default",0,function({defaultLibrary:e,forceEmbedded:s=!1,lang:o}={}){let c,g,h,b,f,j,N,$,I,U,V,W,Q,X,G=(0,_.useRouter)(),{tenant:J}=(0,_.useParams)(),es=(0,_.useSearchParams)(),ea=(0,_.usePathname)(),er=(0,P.useEmbed)(),el=s||er,ei=(0,S.useLocale)(),ec=o??ei,ef=C[ec],ej=(0,S.useLocalePath)(),ey="en"!==ec,ev=ey?"books":"unified",ew=ey?ec:void 0,ek=es.get("mode")||ev,eN=ey&&("unified"===ek||"index"===ek)?"books":ek,[e_,eS]=(0,a.useState)(es.get("q")||""),[e$,eC]=(0,a.useState)(eN),[eL,eI]=(0,a.useState)(!1),[eB,eT]=(0,a.useState)(!1),[eP,eR]=(0,a.useState)([]),[eA,eq]=(0,a.useState)(0),[eE,eF]=(0,a.useState)([]),[eM,ez]=(0,a.useState)(0),[eU,eO]=(0,a.useState)([]),[eD,eK]=(0,a.useState)(0),[eY,eH]=(0,a.useState)([]),[eV,eW]=(0,a.useState)([]),[eQ,eZ]=(0,a.useState)(!1),[eX,eG]=(0,a.useState)(!1),[eJ,e0]=(0,a.useState)(null),[e1,e2]=(0,a.useState)([]),[e3,e4]=(0,a.useState)(!1),[e5,e6]=(0,a.useState)([]),[e8,e7]=(0,a.useState)(0),[e9,te]=(0,a.useState)(!1),tt=(0,a.useRef)(!1),ts=(0,a.useRef)([]),[ta,tr]=(0,a.useState)(new Set(["books","semantic"])),[tl,to]=(0,a.useState)(parseInt(es.get("offset")||"0")),[tn,ti]=(0,a.useState)(es.get("type")||""),[tc,td]=(0,a.useState)(es.get("sort")||"relevance"),tu=!!(es.get("language")||es.get("category")||es.get("collection")||es.get("date_from")||es.get("date_to")||es.get("has_doi")||es.get("has_translation")||es.get("first_translation")||es.get("library")),[tm,tx]=(0,a.useState)(tu),[tg,th]=(0,a.useState)(es.get("language")||""),[tp,tb]=(0,a.useState)(es.get("category")||""),[tf,tj]=(0,a.useState)(es.get("collection")||""),[ty,tv]=(0,a.useState)(es.get("date_from")||""),[tw,tk]=(0,a.useState)(es.get("date_to")||""),[tN,t_]=(0,a.useState)("true"===es.get("has_doi")),[tS,t$]=(0,a.useState)("true"===es.get("has_translation")),[tC,tL]=(0,a.useState)("true"===es.get("first_translation")),[tI,tB]=(0,a.useState)(es.get("library")||e||""),[tT,tP]=(0,a.useState)([{value:"",label:ef.allLanguages}]),[tR,tA]=(0,a.useState)([{value:"",label:ef.allCategories}]),[tq,tE]=(0,a.useState)([]),[tF,tM]=(0,a.useState)(parseInt(es.get("per_page")||"")||20),[tz,tU]=(0,a.useState)([]),[tO,tD]=(0,a.useState)(0),[tK,tY]=(0,a.useState)(!1),[tH,tV]=(0,a.useState)(!1),[tW,tQ]=(0,a.useState)(es.get("sort")||"recent-translation"),[tZ,tX]=(0,a.useState)(!1),[tG,tJ]=(0,a.useState)([]),[t0,t1]=(0,a.useState)(0),[t2,t3]=(0,a.useState)(!1),[t4,t5]=(0,a.useState)(null),[t6,t8]=(0,a.useState)(""),[t7,t9]=(0,a.useState)([]),[se,st]=(0,a.useState)([]),[ss,sa]=(0,a.useState)([]),[sr,sl]=(0,a.useState)(!1),[so,sn]=(0,a.useState)("books_first"),si=(0,a.useRef)(!1),sc=(0,a.useRef)(null),sd=(0,a.useRef)({query:"",ranking:null,results:[],view:"all",total:0});(0,a.useEffect)(()=>{function e(e){let t=e.target?.closest?.('a[href*="/book/"]');if(!t)return;let s=sd.current;if(!s.query)return;let a=t.getAttribute("href")||"",r=a.match(/\/book\/([^/?#]+)\/page-number\/(\d+)/),l=a.match(/\/book\/([^/?#]+)/),o=(r?.[1]||l?.[1]||"").toLowerCase();if(!o)return;let n=s.results.findIndex(e=>(e.slug||"").toLowerCase()===o||(e.book_id||"").toLowerCase()===o),i={query:s.query,ranking:s.ranking,slug:o,page_number:r?Number(r[2]):void 0,rank:n>=0?n+1:void 0,view:s.view,total:s.total};try{let e=JSON.stringify(i);navigator.sendBeacon?navigator.sendBeacon("/api/search/click",new Blob([e],{type:"application/json"})):fetch("/api/search/click",{method:"POST",headers:{"Content-Type":"application/json"},body:e,keepalive:!0})}catch{}}return document.addEventListener("click",e,!0),()=>document.removeEventListener("click",e,!0)},[]),(0,a.useEffect)(()=>{z.utils.languages().then(e=>{e.languages&&tP([{value:"",label:ef.allLanguages},...e.languages.map(e=>({value:e.code,label:`${e.name} (${e.book_count})`}))])}).catch(()=>{}),F.categories.list().then(e=>{e.categories&&tA([{value:"",label:ef.allCategories},...e.categories.filter(e=>e.book_count>0).map(e=>({value:e.id,label:`${e.icon?e.icon+" ":""}${e.name} (${e.book_count})`,icon:e.icon}))])}).catch(()=>{}),M.collections.list().then(e=>{e.collections&&tE(e.collections)}).catch(()=>{})},[ef]);let su=(0,a.useRef)(t6),sm=(0,a.useRef)(se),sx=(0,a.useRef)(e_);su.current=t6,sm.current=se,sx.current=e_;let sg=(0,a.useCallback)((e,t=!1)=>
2{if(sc.current?.(),t){let e=su.current,t=sm.current,s=sx.current;t9(a=>[...a,...e?[{query:s,text:e,terms:t}]:[]]),t8(""),st([])}else t8(""),st([]),sa([]),t9([]),sn("books_first"),si.current=!1;if(tt.current=!1,ts.current=[],ey||!e||e.length<3)return;sl(!0);let s="";sc.current=q.search.aiExpandStream(e,e=>{t8(s+=e)},async t=>{let s=e.toLowerCase(),a=t.filter(e=>e.toLowerCase()!==s);if(st(a),0===a.length)return;let r=new Set(eP.map(e=>e.book_id)),l=new Set,o=[];for(let e of a)try{for(let t of(await q.search.search(e,{limit:3})).results||[]){if(r.has(t.book_id))continue;let e=t.book_id+("page"===t.type?`-p${t.page_number}`:"");l.has(e)||(l.add(e),o.push(t))}sa([...o].slice(0,8))}catch{}},()=>sl(!1),e=>{si.current||"images_first"!==e&&"books_first"!==e&&"not_in_collection"!==e||(sn(e),si.current=!0)},async e=>{if(!e||0===e.length)return;let t=new Set(eU.map(e=>`${e.pageId}-${e.detectionIndex}`)),s=[],a=e.slice(0,3);for(let[e,r]of(await Promise.allSettled(a.map(e=>E.gallery.list({query:e,limit:4,maxPerBook:1})))).entries())if("fulfilled"===r.status)for(let l of r.value.items||[]){let r=`${l.pageId}-${l.detectionIndex}`;t.has(r)||(t.add(r),s.push({...l,aiTerm:a[e]}))}s.length>0&&(tt.current?(eO(e=>[...e,...s]),eK(e=>e+s.length)):ts.current=[...ts.current,...s])})},[eP,ey]),sh=(0,a.useCallback)(async(e,t=e$,s=0)=>
2{if(!e||e.length<2){eR([]),eq(0),eF([]),ez(0),eH([]),eO([]),eK(0),e6([]),e7(0),e0(null);return}eI(!0),eT(!1);try{if("unified"===t){let t=`unified:${e}:${tg}:${tp}:${tS}:${tC}:${tI}:${ty}:${tw}`,s=sb.current.get(t);if(s&&Date.now()-s.ts<sf){eR(s.books),eq(s.bookTotal),eF(s.index),ez(s.indexTotal),eO(s.images),eK(s.imageTotal),e0(s.matchQuality??null),eI(!1);return}try{let s=await q.search.unified(e,{limit:5,galleryLimit:6,filters:{language:tg||void 0,category:tp||void 0,has_translation:tS?"true":void 0,first_translation:tC?"true":void 0,library:tI||void 0,date_from:ty||void 0,date_to:tw||void 0}}),a=s.books?.results||[],r=s.books?.total||0,l=(s.index?.results||[]).slice(0,5),o=s.index?.total||0;sd.current={query:e,ranking:s.books?.ranking||null,results:a,view:"all",total:r};let n=s.gallery?.results||[],i=(s.visual?.results||[]).map(e=>({...e,visualMatch:!0})),c=s.artworks?.results||[],d=new Set,u=[...n,...i],m=[];for(let e of u){if(d.has(e.id))continue;d.add(e.id);let t=(e.id||"").split("-"),s=parseInt(t.pop()||"0"),a=t.join("-");m.push({pageId:a,bookId:e.bookId||"",pageNumber:"number"==typeof e.pageNumber?e.pageNumber:0,detectionIndex:s,imageUrl:e.imageUrl||"",thumbnailUrl:e.imageUrl||"",bookTitle:e.bookTitle||"",author:"",description:e.description||"",type:e.type,visualMatch:e.visualMatch||void 0})}let x=0;for(let e of c){if(x>=8)break;let t=`artwork-${e.book_id}`;d.has(t)||(d.add(t),x++,m.push({pageId:e.book_id,bookId:e.book_id,pageNumber:0,detectionIndex:0,imageUrl:e.thumbnail_url||"",thumbnailUrl:e.thumbnail_url||"",bookTitle:e.display_title||e.title||"",author:e.author||"",description:e.display_title||e.title||"",type:e.genre||"artwork",isArtwork:!0,artworkSlug:e.slug||null,artworkType:e.resource_type||e.genre||null,holder:e.holder||null}))}let g=(s.gallery?.total||0)+(s.visual?.total||0)+c.length;eR(a),eq(r),eF(l),ez(o);let h=ts.current;if(h.length>0){let e=new Set(m.map(e=>`${e.pageId}-${e.detectionIndex}`)),t=h.filter(t=>!e.has(`${t.pageId}-${t.detectionIndex}`));eO([...m,...t]),eK(g+t.length),ts.current=[]}else eO(m),eK(g);tt.current=!0,eH(s.collections?.results||[]);let p="weak"===s.match_quality||"strong"===s.match_quality?s.match_quality:null;if(e0(p),si.current=!0,sb.current.set(t,{ts:Date.now(),books:a,bookTotal:r,index:l,indexTotal:o,images:m,imageTotal:g,matchQuality:p}),sb.current.size>50){let e=[...sb.current.entries()].sort((e,t)=>e[1].ts-t[1].ts)[0];e&&sb.current.delete(e[0])}}catch(t){let e=t instanceof Error?t.message:String(t);if(t?.code==="SIGNIN_REQUIRED"){eT(!0),eR([]),eq(0),eF([]),ez(0),eO([]),eK(0),e0(null),eH([]),eW([]),eG(!1),sc.current?.(),sa([]),t8(""),sl(!1),eI(!1);return}(0,A.reportError)({message:`Unified search failed: ${e}`,source:"search_query"})}eZ(!0),eG(!1);let a=new URLSearchParams({q:e,limit:"8"});if(tg&&a.set("language",tg),ty&&a.set("year_min",ty),tw&&a.set("year_max",tw),fetch(`/api/search/semantic?${a.toString()}`).then(e=>{if(!e.ok)throw Error(`semantic ${e.status}`);return e.json()}).then(e=>{let t=new Set(eP.map(e=>e.id||e.book_id)),s=(e.results||[]).filter(e=>!t.has(e.book_id));eW(s)}).catch(()=>{eW([]),eG(!0)}).finally(()=>eZ(!1)),"bph"===J&&(te(!0),fetch(`/api/catalog/bph?q=${encodeURIComponent(e)}&limit=8`).then(e=>e.json()).then(e=>{e6(e.works||[]),e7(e.total||0)}).catch(()=>{e6([]),e7(0)}).finally(()=>te(!1))),/^".*"$/.test(e.trim())){let t=e.trim().slice(1,-1);e4(!0),Promise.all([q.search.search(t,{limit:15,search_content:"true"}),q.search.search(e,{limit:10,search_content:"true"}).catch(()=>({results:[]}))]).then(([e,t])=>{let s=e.results||[],a=new Set((t.results||[]).map(e=>e.id)),r=s.filter(e=>"page"===e.type).sort((e,t)=>{let s=+!!a.has(e.id);return!!a.has(t.id)-s});if(e2(r),0===eP.length){let e=s.filter(e=>"book"===e.type);e.length>0&&(eR(e),eq(e.length))}}).catch(()=>e2([])).finally(()=>e4(!1))}else e2([])}else if("books"===t){let t=await q.search.search(e,{lang:ew,language:tg||void 0,category:tp||void 0,date_from:ty||void 0,date_to:tw||void 0,has_doi:tN?"true":void 0,has_translation:tS?"true":void 0,first_translation:tC?"true":void 0,library:tI||void 0,sort:"relevance"!==tc?tc:void 0,offset:s>
20?s:void 0,limit:tF,search_content:"true"});eR(t.results||[]),eq(t.total||0),sd.current={query:e,ranking:t.ranking||null,results:t.results||[],view:"books",total:t.total||0}}else if("index"===t){let t=await q.search.index(e,{type:tn||void 0,dateFrom:ty||void 0,dateTo:tw||void 0});eF(t.results||[]),ez(t.total||0)}else if("images"===t){let t=await E.gallery.list({query:e,limit:tF,offset:s,yearFrom:ty&&parseInt(ty,10)||void 0,yearTo:tw&&parseInt(tw,10)||void 0}),a=t.items||[],r=ts.current;if(r.length>0){let e=new Set(a.map(e=>`${e.pageId}-${e.detectionIndex}`)),s=r.filter(t=>!e.has(`${t.pageId}-${t.detectionIndex}`));eO([...a,...s]),eK((t.total||0)+s.length),ts.current=[]}else eO(a),eK(t.total||0);tt.current=!0}}catch(e){console.error("Search error:",e),r.toast.error(ef.searchFailed)}finally{eI(!1)}},[e$,tn,tg,tp,ty,tw,tN,tS,tC,tI,tc,tF,ew,ef]),sp=(0,a.useCallback)((e,t,s=0)=>{let a=new URLSearchParams;e&&a.set("q",e),t!==ev&&a.set("mode",t),"index"===t&&tn&&a.set("type",tn),tg&&a.set("language",tg),tp&&a.set("category",tp),tf&&a.set("collection",tf),ty&&a.set("date_from",ty),tw&&a.set("date_to",tw),tN&&a.set("has_doi","true"),tS&&a.set("has_translation","true"),tC&&a.set("first_translation","true"),tI&&a.set("library",tI),e&&"relevance"!==tc&&a.set("sort",tc),e||"recent-translation"===tW||a.set("sort",tW),s>0&&a.set("offset",s.toString()),20!==tF&&a.set("per_page",tF.toString());let r=ea&&ea.endsWith("/search")?ea:J?`/${J}/search`:"/search";G.replace(`${r}?${a.toString()}`,{scroll:!1})},[G,ea,J,ev,tn,tg,tp,tf,ty,tw,tN,tS,tC,tI,tc,tW,tF]),sb=(0,a.useRef)(new Map),sf=6e4,sj=(0,R.useDebouncedCallback)(e=>{to(0),sh(e,e$,0),sp(e,e$,0)},450),sy=(0,a.useRef)("");(0,a.useEffect)(()=>{e_.length>=2&&(sh(e_,e$,tl),sp(e_,e$,tl),sy.current!==e_&&(sy.current=e_,sg(e_)))},[e$,tn,tg,tp,ty,tw,tN,tS,tC,tI,tc,tl,sh,sp]);let sv=(0,a.useCallback)(e=>{eS(e),to(0),sh(e,e$,0),sp(e,e$,0),sg(e,!0),sy.current=e},[e$,sh,sp,sg]),sw=(0,a.useMemo)(()=>el||ey?null:function(e,t={}){let s=K(e);if(s.length<2)return null;let a=Y(e);for(let e of D)if(e.aliases.some(e=>K(e)===s||Y(e)===a)){let{aliases:t,...s}=e;return s}for(let e of t.collections||[])if(Y(e.slug||"")===a||K(e.name||"")===s||Y(e.name||"")===a)return{title:e.name,description:e.subtitle||e.description||`Browse the ${e.name} collection.`,href:`/collections/${e.slug}`,kind:"collection"};for(let e of Object.values(O.LIBRARY_PARTNERS))if(Y(e.slug)===a||K(e.name)===s||K(e.shortName)===s||Y(e.name)===a)return{title:e.name,description:e.description,href:`/libraries/${e.slug}`,kind:"library"};return null}(e_,{collections:tq}),[el,ey,e_,tq]),sk=!e_||e_.length<2,sN=(0,a.useRef)(!1),s_=(0,a.useCallback)(async()=>{if(!sN.current&&0===tl&&!tg&&!tp&&!tf&&!tI&&"recent-translation"===tW){let e=window.__BROWSE_PREFETCH,t=window.__BROWSE_PREFETCH_TS,s=tC?"first_translation":tS?"has_translation":null;if(s&&e?.[s]&&t&&Date.now()-t<3e5){sN.current=!0,tU(e[s].books||[]),tD(e[s].total||0);return}}tY(!0),tV(!1);try{let e=await q.search.browse({language:tg||void 0,category:tp||void 0,collection:tf||void 0,library:tI||void 0,sort:tW,limit:tF,skip:tl,first_translation:tC||void 0,has_translation:tS||void 0});tU(e.books||[]),tD(e.total||0)}catch(e){tU([]),tD(0),tV(!0),(0,A.reportError)({message:`Browse API failed: ${e instanceof Error?e.message:String(e)}`,source:"search_browse"})}finally{tY(!1)}},[tg,tp,tf,tI,tW,tl,tC,tS,tF]);(0,a.useEffect)(()=>{sk&&"images"!==e$&&(s_(),sp("",e$,tl))},[sk,tg,tp,tf,tI,tW,tl,tC,tS,e$]);let sS=(0,a.useCallback)(async()=>{t3(!0);try{let e=await E.gallery.list({limit:tF,offset:tl,maxPerBook:2});tJ(e.items||[]),t1(e.total||0)}catch{tJ([]),t1(0)}finally{t3(!1)}},[tl,tF]);(0,a.useEffect)(()=>{sk&&"images"===e$&&(sS(),sp("","images",tl))},[sk,e$,tl,tF]);let s$=eA+eM+eD,sC=!eB&&e_.length>=2&&!eL&&!eQ&&!eX&&!e3&&!e9&&0===s$&&0===eV.length&&0===e1.length&&0===e5.length;(0,a.useEffect)(()=>{if(!sC||e_.length<3)return void t5(null);let e=!1;return q.search.suggest(e_).then(t=>{e||t5(t.suggestions?.[0]||null)}).catch(()=>{e||t5(null)}),()=>{e=!0}},[sC,e_]);let sL=e=>{eC(e),to(0)},sI=()=>{th(""),tb(""),tj(""),tv(""),tk(""),t_(!1),t$(!1),tL(!1),tB(e||""),td("relevance"),tQ("recent-translation"),to(0)},sB=tg||tp||tf||ty||tw||tN||tS||tC||tI&&tI!==e||"relevance"!==tc;return(0,t.jsxs)("div",{className:"bg-cream",lang:ec,children:[!el&&(0,t.jsx)(Z,{}),!el&&(0,t.jsx)(T.default,{variant:"light"}),(0,t.jsx)("div",{className:"bg-white border-b border-border-light sticky top-0 z-30",children:(0,t.jsxs)("div",{className:"max-w-[var(--container-wide)] mx-auto px-6 md:px-12 py-4",children:[(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3",children:[(0,t.jsxs)("div",{className:"flex-1 relative",children:[(0,t.jsx)(n.Search,{className:"absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-muted"}),(0,t.jsx)("input",{type:"text",value:e_,onChange:e=>{var t;eS(t=e.target.value),t.length>=2&&to(0),sc.current?.(),t8(""),st([]),sa([]),sl(!1),sy.current="",sj(t)},onKeyDown:e=>{"Enter"===e.key&&e_.length>=3&&(sy.current=e_,sg(e_))},placeholder:ef.searchPlaceholder,className:"w-full pl-12 pr-4 py-3 border border-border-medium rounded-xl bg-cream/50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-accent-rust/30 focus:border-accent-rust/40 text-lg text-primary font-body",autoFocus:!0}),eL&&(0,t.jsx)(m.Loader2,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-5 h-5 text-muted animate-spin"})]}),!sk&&"unified"!==e$&&(0,t.jsxs)("div",{className:"relative flex-shrink-0",children:[(0,t.jsx)(v.ArrowUpDown,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted pointer-events-none"}),(0,t.jsxs)("select",{value:tc,onChange:e=>{td(e.target.value),to(0)},className:"w-full sm:w-auto pl-9 pr-3 py-3 border border-border-medium rounded-xl text-sm text-secondary bg-white focus:outline-none focus:ring-2 focus:ring-accent-rust/30 appearance-none cursor-pointer",children:[(0,t.jsx)("option",{value:"relevance",children:ef.sortRelevance}),(0,t.jsx)("option",{value:"date_desc",children:ef.sortYearNewest}),(0,t.jsx)("option",{value:"date_asc",children:ef.sortYearOldest}),(0,t.jsx)("option",{value:"title",children:ef.sortTitleAz})]})]}),sk&&(0,t.jsxs)("div",{className:"relative flex-shrink-0",children:[(0,t.jsx)(v.ArrowUpDown,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted pointer-events-none"}),(0,t.jsxs)("select",{value:tW,onChange:e=>{tQ(e.target.value),to(0)},className:"w-full sm:w-auto pl-9 pr-3 py-3 border border-border-medium rounded-xl text-sm text-secondary bg-white focus:outline-none focus:ring-2 focus:ring-accent-rust/30 appearance-none cursor-pointer",children:[(0,t.jsx)("option",{value:"recent-translation",children:ef.browseRecentTranslation}),(0,t.jsx)("option",{value:"recent",children:ef.browseRecent}),(0,t.jsx)("option",{value:"date_desc",children:ef.browseOldestFirst}),(0,t.jsx)("option",{value:"date_asc",children:ef.browseNewestFirst}),(0,t.jsx)("option",{value:"title-asc",children:ef.browseTitleAsc}),(0,t.jsx)("option",{value:"title-desc",children:ef.browseTitleDesc})]})]})]}),(0,t.jsx)("div",{className:"mt-3 flex gap-1 border-b border-border-light -mx-4 px-4",children:(sk?[{mode:ev,label:ef.tabBooks,icon:i.Book},{mode:"images",label:ef.tabImages,icon:w.ImageIcon}]:ey?[{mode:"books",label:ef.tabBooks,icon:i.Book},{mode:"images",label:ef.tabImages,icon:w.ImageIcon}]:[{mode:"unified",label:ef.tabAll,icon:n.Search},{mode:"books",label:ef.tabBooks,icon:i.Book},{mode:"index",label:ef.tabIndex,icon:p.Lightbulb},{mode:"images",label:ef.tabImages,icon:w.ImageIcon}]).map(({mode:e,label:s,icon:a})=>(0,t.jsxs)("button",{onClick:()=>{eC(e),to(0)},className:`flex items-center gap-1.5 px-4 py-2.5 text-sm font-medium border-b-2 transition-colors ${e$===e?"border-accent-rust text-accent-rust":"border-transparent text-muted hover:text-secondary hover:border-border-medium"}`,children:[(0,t.jsx)(a,{className:"w-4 h-4"}),s,!sk&&"books"===e&&eA>0&&(ey||"unified"!==e$)&&(0,t.jsxs)("span",{className:"text-xs text-muted",children:["(",eA.toLocaleStr
2ing(ef.numberLocale),")"]}),!sk&&"index"===e&&eM>0&&"unified"!==e$&&(0,t.jsxs)("span",{className:"text-xs text-muted",children:["(",eM.toLocaleString(ef.numberLocale),")"]}),!sk&&"images"===e&&eD>0&&(ey||"unified"!==e$)&&(0,t.jsxs)("span",{className:"text-xs text-muted",children:["(",eD.toLocaleString(ef.numberLocale),")"]})]},e))}),"index"===e$&&(0,t.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:en.map(e=>{let s=e.icon;return(0,t.jsxs)("button",{onClick:()=>{ti(e.value),to(0)},className:`px-3 py-1.5 rounded-lg text-sm flex items-center gap-1.5 transition-colors ${tn===e.value?"bg-accent-violet/12 text-accent-violet border border-accent-violet/30":"bg-warm text-secondary border border-transparent hover:bg-border-light"}`,children:[(0,t.jsx)(s,{className:"w-3.5 h-3.5"}),ef[e.labelKey]]},e.value)})}),(0,t.jsx)("div",{className:"mt-3 flex items-center gap-3",children:(0,t.jsxs)("button",{onClick:()=>tx(!tm),className:"flex items-center gap-2 text-sm text-muted hover:text-secondary transition-colors",children:[(0,t.jsx)(k.ChevronDown,{className:`w-4 h-4 transition-transform ${tm?"":"-rotate-90"}`}),(0,t.jsx)(d.Filter,{className:"w-3.5 h-3.5"}),ef.filters,sB&&(0,t.jsx)("span",{className:"w-1.5 h-1.5 bg-accent-rust roun
2ded-full"})]})}),tm&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"md:hidden fixed inset-0 bg-black/30 z-40",onClick:()=>tx(!1)}),(0,t.jsxs)("div",{className:"md:hidden fixed bottom-0 left-0 right-0 z-50 bg-white rounded-t-2xl shadow-2xl max-h-[70vh] overflow-y-auto animate-in slide-in-from-bottom duration-200",children:[(0,t.jsxs)("div",{className:"sticky top-0 bg-white border-b border-border-light px-4 py-3 flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-primary",children:ef.filters}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[sB&&(0,t.jsxs)("button",{onClick:sI,className:"text-sm text-muted hover:text-primary flex items-center gap-1",children:[(0,t.jsx)(u.X,{className:"w-3.5 h-3.5"})," ",ef.clear]}),(0,t.jsx)("button",{onClick:()=>tx(!1),className:"text-sm font-medium text-accent-rust",children:ef.done})]})]}),(0,t.jsxs)("div",{className:"p-4 grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm text-secondary mb-1",children:ef.filterLanguage}),(0,t.jsx)("select",{value:tg,onChange:e=>th(e.target.value),className:"w-full px-3 py-2 border border-border-medium rounded-lg bg-white text-sm focus:outline-none focus:ring-2 focus:ring-accent-rust/30",children:tT.map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm text-secondary mb-1",children:ef.filterSubject}),(0,t.jsx)("select",{value:tp,onChange:e=>tb(e.target.value),className:"w-full px-3 py-2 border border-border-medium rounded-lg bg-white text-sm focus:outline-none focus:ring-2 focus:ring-accent-rust/30",children:tR.map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm text-secondary mb-1",children:ef.filterCollection}),(0,t.jsxs)("select",{value:tf,onChange:e=>{tj(e.target.value),to(0)},className:"w-full px-3 py-2 border border-border-medium rounded-lg bg-white text-sm focus:outline-none focus:ring-2 focus:ring-accent-rust/30",children:[(0,t.jsx)("option",{value:"",children:ef.allCollections}),tq.map(e=>(0,t.jsxs)("option",{value:e.slug,children:[(0,B.localizedCollection)(e,ec).name," (",e.book_count.toLocaleString(ef.numberLocale),")"]},e.slug))]})]}),!e&&!el&&(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm text-secondary mb-1",children:ef.filterLibrary}),(0,t.jsxs)("select",{value:tI,onChange:e=>tB(e.target.value),className:"w-full px-3 py-2 border border-border-medium rounded-lg bg-white text-sm focus:outline-none focus:ring-2 focus:ring-accent-rust/30",children:[(0,t.jsx)("option",{value:"",children:ef.allLibraries}),Object.values(O.LIBRARY_PARTNERS).map(e=>(0,t.jsx)("option",{value:e.providerKey,children:e.name},e.providerKey))]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm text-secondary mb-1",children:ef.filterPublishedAfter}),(0,t.jsx)("input",{type:"text",value:ty,onChange:e=>tv(e.target.value),placeholder:ef.yearFromPlaceholder,className:"w-full px-3 py-2 border border-border-medium rounded-lg bg-white text-sm focus:outline-none focus:ring-2 focus:ring-accent-rust/30"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm text-secondary mb-1",children:ef.filterPublishedBefore}),(0,t.jsx)("input",{type:"text",value:tw,onChange:e=>tk(e.target.value),placeholder:ef.yearToPlaceholder,className:"w-full px-3 py-2 border border-border-medium rounded-lg bg-white text-sm focus:outline-none focus:ring-2 focus:ring-accent-rust/30"})]}),(0,t.jsxs)("div",{className:"col-span-2 flex flex-wrap gap-x-6 gap-y-2",children:[(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm text-secondary cursor-pointer",children:[(0,t.jsx)("input",{type:"checkbox",checked:tS,onChange:e=>t$(e.target.checked),className:"rounded border-border-medium text-accent-rust focus:ring-accent-rust/30"})," ",ef.hasTranslation]}),(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm text-secondary cursor-pointer",children:[(0,t.jsx)("input",{type:"checkbox",checked:tC,onChange:e=>tL(e.target.checked),className:"rounded border-border-medium text-accent-gold focus:ring-accent-gold/30"})," ",ef.firstTranslation]}),(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm text-secondary cursor-pointer",children:[(0,t.jsx)("input",{type:"checkbox",checked:tN,onChange:e=>t_(e.target.checked),className:"rounded border-border-medium text-accent-rust focus:ring-accent-rust/30"})," ",ef.hasDoi]})]})]})]}),(0,t.jsxs)("div",{className:"hidden md:block mt-3 p-4 bg-warm rounded-xl border border-border-light relative z-20",children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-3",children:sB&&(0,t.jsxs)("button",{onClick:sI,className:"text-sm text-muted hover:text-primary flex items-center gap-1 ml-auto",children:[(0,t.jsx)(u.X,{className:"w-4 h-4"})," ",ef.clearAll]})}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm text-secondary mb-1",children:ef.filterLanguage}),(0,t.jsx)("select",{value:tg,onChange:e=>th(e.target.value),className:"w-full px-3 py-2 border border-border-medium rounded-lg bg-white text-sm focus:outline-none focus:ring-2 focus:ring-accent-rust/30",children:tT.map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm text-secondary mb-1",children:ef.filterSubject}),(0,t.jsx)("select",{value:tp,onChange:e=>tb(e.target.value),className:"w-full px-3 py-2 border border-border-medium rounded-lg bg-white text-sm focus:outline-none focus:ring-2 focus:ring-accent-rust/30",children:tR.map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm text-secondary mb-1",children:ef.filterCollection}),(0,t.jsxs)("select",{value:tf,onChange:e=>{tj(e.target.value),to(0)},className:"w-full px-3 py-2 border border-border-medium rounded-lg bg-white text-sm focus:outline-none focus:ring-2 focus:ring-accent-rust/30",children:[(0,t.jsx)("option",{value:"",children:ef.allCollections}),tq.map(e=>(0,t.jsxs)("option",{value:e.slug,children:[(0,B.localizedCollection)(e,ec).name," 
2(",e.book_count.toLocaleString(ef.numberLocale),")"]},e.slug))]})]}),!e&&!el&&(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm text-secondary mb-1",children:ef.filterLibrary}),(0,t.jsxs)("select",{value:tI,onChange:e=>tB(e.target.value),className:"w-full px-3 py-2 border border-border-medium rounded-lg bg-white text-sm focus:outline-none focus:ring-2 focus:ring-accent-rust/30",children:[(0,t.jsx)("option",{value:"",children:ef.allLibraries}),Object.values(O.LIBRARY_PARTNERS).map(e=>(0,t.jsx)("option",{value:e.providerKey,children:e.name},e.providerKey))]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm text-secondary mb-1",children:ef.filterPublishedAfter}),(0,t.jsx)("input",{type:"text",value:ty,onChange:e=>tv(e.target.value),placeholder:ef.yearFromPlaceholder,className:"w-full px-3 py-2 border border-border-medium rounded-lg bg-white text-sm focus:outline-none focus:ring-2 focus:ring-accent-rust/30"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm text-secondary mb-1",children:ef.filterPublishedBefore}),(0,t.jsx)("input",{type:"text",value:tw,onChange:e=>tk(e.target.value),placeholder:ef.yearToPlaceholder,className:"w-full px-3 py-2 border border-border-medium rounded-lg bg-white text-sm focus:outline-none focus:ring-2 focus:ring-accent-rust/30"})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-2 justify-end",children:[(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm text-secondary cursor-pointer",children:[(0,t.jsx)("input",{type:"checkbox",checked:tS,onChange:e=>t$(e.target.checked),className:"rounded border-border-medium text-accent-rust focus:ring-accent-rust/30"})," ",ef.hasTranslation]}),(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm text-secondary cursor-pointer",children:[(0,t.jsx)("input",{type:"checkbox",checked:tC,onChange:e=>tL(e.target.checked),className:"rounded border-border-medium text-accent-gold focus:ring-accent-gold/30"})," ",ef.firstTranslation]}),(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm text-secondary cursor-pointer",children:[(0,t.jsx)("input",{type:"checkbox",checked:tN,onChange:e=>t_(e.target.checked),className:"rounded border-border-medium text-accent-rust focus:ring-accent-rust/30"})," ",ef.hasDoi]})]})]})]})]})]})}),(0,t.jsxs)("main",{className:"max-w-[var(--container-wide)] mx-auto px-6 md:px-12 py-8",children:[eB&&(0,t.jsxs)("div",{className:"text-center py-16 max-w-lg mx-auto",children:[(0,t.jsx)(n.Search,{className:"w-16 h-16 text-border-medium mx-auto mb-4"}),(0,t.jsx)("h2",{className:"text-2xl font-serif font-medium text-primary mb-2",children:ef.signInHeading}),(0,t.jsx)("p",{className:"text-secondary mb-6",children:ef.signInBody}),(0,t.jsx)(l.default,{href:`${ej("/auth/signin")}?callbackUrl=${ej("/search")}&reason=limit`,className:"inline-block px-6 py-3 rounded-xl bg-accent-rust text-white font-medium hover:bg-accent-rust/90 transition-colors",children:ef.signInCta})]}),sk&&"images"===e$&&(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"mb-4 flex items-center justify-between flex-wrap gap-2",children:[!t2&&t0>0&&(0,t.jsxs)("div",{className:"text-muted",children:[ef.imagesCount(t0.toLocaleString(ef.numberLocale)),t0>tF&&(0,t.jsx)("span",{className:"ml-2 text-faint",children:ef.showingRange(tl+1,Math.min(tl+tF,t0))})]}),(0,t.jsx)("div",{className:"flex items-center gap-4",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted",children:[(0,t.jsx)("span",{children:ef.show}),(0,t.jsx)("select",{value:tF,onChange:e=>{tM(Number(e.target.value)),to(0)},className:"px-2 py-1 border border-border-medium rounded-md bg-white text-sm focus:outline-none focus:ring-2 focus:ring-accent-rust/30",children:eo.map(e=>(0,t.jsx)("option",{value:e,children:e},e))}),(0,t.jsx)("span",{children:ef.perPage})]})})]}),t2&&(0,t.jsx)("div",{className:"py-8",children:(0,t.jsx)(ee.BookLoader,{size:"xs"})}),!t2&&tG.length>0&&(0,t.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4",children:tG.map((e,s)=>(0,t.jsx)(eh,{item:e,query:"",large:!0,tenant:J},`${e.pageId}-${e.detectionIndex}-${s}`))}),!t2&&0===tG.length&&(0,t.jsxs)("div",{className:"text-center py-16",children:[(0,t.jsx)(w.ImageIcon,{className:"w-16 h-16 text-border-medium mx-auto mb-4"}),(0,t.jsx)("h2",{className:"text-2xl font-serif font-medium text-primary mb-2",children:ef.noImagesFound}),(0,t.jsx)("p",{className:"text-base text-muted",children:ef.noImagesBo
2dy})]}),(0,t.jsx)(eb,{total:t0,offset:tl,setOffset:to,loading:t2,pageSize:tF})]}),sk&&"images"!==e$&&(0,t.jsxs)("div",{children:[!el&&tq.length>0&&(tZ||tq.slice(0,6),c=tq.length>6,(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 mb-6",children:[(0,t.jsxs)("button",{onClick:()=>{tj(""),to(0)},className:`px-4 py-2 rounded-full text-sm font-medium transition-colors ${!tf?"bg-accent-rust text-white":"bg-warm text-secondary hover:bg-accent-rust/10 hover:text-accent-rust border border-border-light"}`,children:[ef.allBooks,!tf&&tO>0&&(0,t.jsxs)("span",{className:"ml-1.5 text-white/80",children:["(",tO.toLocaleString(ef.numberLocale),")"]})]}),tq.map((e,s)=>(0,t.jsxs)("button",{onClick:()=>{tj(e.slug),to(0)},className:`px-4 py-2 rounded-full text-sm font-medium transition-colors ${!tZ&&s>=6?"hidden sm:inline-flex":""} ${tf===e.slug?"bg-accent-rust text-white":"bg-warm text-secondary hover:bg-accent-rust/10 hover:text-accent-rust border border-border-light"}`,children:[(0,B.localizedCollection)(e,ec).name,(0,t.jsxs)("span",{className:`ml-1.5 ${tf===e.slug?"text-white/80":"text-muted"}`,children:["(",e.book_count.toLocaleString(ef.numberLocale),")"]})]},e.slug)),c&&!tZ&&(0,t.jsx)("button",{onClick:()=>tX(!0),className:"sm:hidden px-4 py-2 rounded-full text-sm font-medium bg-warm text-muted border border-border-light hover:text-secondary transition-colors",children:ef.andNMore(tq.length-6)})]})),!tK&&tO>0&&(0,t.jsxs)("div",{className:"mb-4 flex items-center justify-between flex-wrap gap-2",children:[(0,t.jsxs)("div",{className:"text-muted",children:[ef.booksCount(tO.toLocaleString(ef.numberLocale)),tf&&tq.find(e=>e.slug===tf)&&(0,t.jsxs)("span",{children:[" ",ef.inCollection," ",(0,t.jsx)("span",{className:"font-medium text-primary",children:(0,B.localizedCollection)(tq.find(e=>e.slug===tf),ec).name})]}),tO>tF&&(0,t.jsx)("span",{className:"ml-2 text-faint",children:ef.showingRange(tl+1,Math.min(tl+tF,tO))})]}),(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted",children:[(0,t.jsx)("span",{children:ef.show}),(0,t.jsx)("select",{value:tF,onChange:e=>{tM(Number(e.target.value)),to(0)},className:"px-2 py-1 border border-border-medium rounded-md bg-white text-sm focus:outline-none focus:ring-2 focus:ring-accent-rust/30",children:eo.map(e=>(0,t.jsx)("option",{value:e,children:e},e))}),(0,t.jsx)("span",{children:ef.perPage})]}),(0,t.jsx)(l.default,{href:ej("/catalog"),className:"text-sm text-accent-rust hover:underline",children:ef.browseFullCatalog})]})]}),tK&&(0,t.jsx)("div",{className:"py-8",children:(0,t.jsx)(ee.BookLoader,{size:"xs"})}),!tK&&tz.length>0&&(0,t.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4",children:tz.map((e,s)=>(0,t.jsx)(et.default,{book:e,priority:s<5,lang:ec},e.id))}),!tK&&tH&&(0,t.jsxs)("div",{className:"text-center py-16",children:[(0,t.jsx)(i.Book,{className:"w-16 h-16 text-border-medium mx-auto mb-4"}),(0,t.jsx)("h2",{className:"text-2xl font-serif font-medium text-primary mb-2",children:ef.somethingWentWrong}),(0,t.jsx)("p",{className:"text-base text-muted mb-4",children:ef.couldNotLoadLibrary}),(0,t.jsx)("button",{onClick:()=>s_(),className:"px-4 py-2 text-sm bg-primary text-white rounded-md hover:bg-primary/90 transition-colors",children:ef.tryAgain})]}),!tK&&!tH&&0===tz.length&&0===tO&&(0,t.jsxs)("div",{className:"text-center py-16",children:[(0,t.jsx)(i.Book,{className:"w-16 h-16 text-border-medium mx-auto mb-4"}),(0,t.jsx)("h2",{className:"text-2xl font-serif font-medium text-primary mb-2",children:ef.noBooksFound}),(0,t.jsx)("p",{className:"text-base text-muted",children:ef.adjustFilters})]}),(0,t.jsx)(eb,{total:tO,offset:tl,setOffset:to,loading:tK,pageSize:tF})]}),sw&&e_.length>=2&&(0,t.jsxs)(l.default,{href:sw.href,className:"group flex items-center gap-3 mb-6 px-4 py-3 bg-warm rounded-lg border border-border-light hover:border-accent-rust/40 transition-colors",children:[(0,t.jsx)("span",{className:"text-2xl shrink-0","aria-hidden":!0,children:sw.icon||"📚"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"text-xs uppercase tracking-wide text-muted",children:"reading-room"===sw.kind?ef.kindReadingRoom:"library"===sw.kind?ef.kindLibrary:ef.kindCollection}),(0,t.jsxs)("div",{className:"font-serif font-medium text-primary group-hover:text-accent-rust transition-colors",children:[sw.title," ",(0,t.jsx)("span",{"aria-hidden":!0,
2children:"→"})]}),(0,t.jsx)("p",{className:"text-sm text-muted line-clamp-2",children:sw.description})]})]}),e_.length>=2&&eL&&"unified"===e$&&(0,t.jsx)("div",{className:"py-8",children:(0,t.jsx)(ee.BookLoader,{size:"xs"})}),e_.length>=3&&(sr||t6)&&("unified"!==e$||eL)&&(0,t.jsxs)("div",{className:"mb-6 px-4 py-3 bg-warm rounded-lg border border-border-light",children:[(0,t.jsx)("p",{className:"text-sm text-secondary italic leading-relaxed",dangerouslySetInnerHTML:{__html:t6.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\*([^*]+)\*/g,"<em>$1</em>")+(sr?'<span class="inline-block w-1.5 h-4 bg-accent-rust/40 animate-pulse ml-0.5 align-text-bottom"></span>':"")}}),se.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5 mt-2",children:se.map(e=>(0,t.jsx)("button",{onClick:()=>sv(e),className:"px-2.5 py-1 bg-white/60 text-secondary text-xs rounded-full hover:bg-accent-rust/10 hover:text-accent-rust transition-colors",children:e},e))})]}),sC&&!sr&&0===ss.length&&(0,t.jsxs)("div",{className:"text-center py-16 max-w-lg mx-auto",children:[(0,t.jsx)(n.Search,{className:"w-16 h-16 text-border-medium mx-auto mb-4"}),(0,t.jsx)("h2",{className:"text-2xl font-serif font-medium text-primary mb-2",children:ef.noResultsFound}),t4&&(0,t.jsxs)("p",{className:"text-secondary mb-6",children:[ef.didYouMean," ",(0,t.jsx)("button",{onClick:()=>{eS(t4),to(0),sh(t4,e$,0),sp(t4,e$,0)},className:"font-semibold text-accent-rust hover:text-accent-rust/80 underline underline-offset-2",children:t4}),"?"]}),(0,t.jsx)("p",{className:"text-muted mb-6",children:ef.corpusBlurb}),(0,t.jsxs)("div",{className:"flex flex-wrap justify-center gap-2",children:[L[ec].map(e=>(0,t.jsx)("button",{onClick:()=>{eS(e),to(0),sh(e,e$,0),sp(e,e$,0)},className:"px-3 py-1.5 bg-warm text-secondary text-sm rounded-full hover:bg-accent-rust/10 hover:text-accent-rust transition-colors",children:e},e)),(0,t.jsx)("button",{onClick:()=>{eS(""),to(0)},className:"px-3 py-1.5 bg-warm text-secondary text-sm rounded-full hover:bg-accent-rust/10 hover:text-accent-rust transition-colors",children:ef.browseAllBooks})]})]}),sC&&ss.length>0&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("p",{className:"text-sm text-muted",children:ef.relatedFromAi}),ss.map(e=>(0,t.jsx)(ex,{result:e,tenant:J},e.id))]}),!eB&&"unified"===e$&&!eL&&e_.length>=2&&(s$>0||eV.length>0||eQ||e1.length>0||e3||e5.length>0||e9)&&(g=new Set(eP.map(e=>e.id||e.book_id)),h=new Set(eP.map(e=>e.work_id).filter(Boolean)),b=eV.filter(e=>!g.has(e.book_id)&&!(e.work_id&&h.has(e.work_id))),f=eP.length>0&&b.length>0,j=e_.length>=3&&(sr||t6||t7.length>0)&&(0,t.jsxs)("div",{className:"px-4 py-3 bg-warm/60 rounded-lg border border-border-light space-y-2",children:[t7.map((e,s)=>(0,t.jsxs)("div",{className:"text-sm text-secondary/70 italic leading-relaxed border-b border-border-light pb-2",children:[(0,t.jsxs)("span",{className:"text-xs text-muted not-italic font-medium",children:[e.query,":"]})," ",(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:e.text.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\*([^*]+)\*/g,"<em>$1</em>")}})]},s)),(sr||t6)&&(0,t.jsx)("p",{className:"text-sm text-secondary italic leading-relaxed",dangerouslySetInnerHTML:{__html:t6.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\*([^*]+)\*/g,"<em>$1</em>")+(sr?'<span class="inline-block w-1.5 h-4 bg-accent-rust/40 animate-pulse ml-0.5 align-text-bottom"></span>':"")}}),se.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:se.map(e=>(0,t.jsx)("button",{onClick:()=>sv(e),className:"px-2.5 py-1 bg-white/60 text-secondary text-xs rounded-full hover:bg-accent-rust/10 hover:text-accent-rust transition-colors",children:e},e))})]}),N=eU.length>0&&(0,t.jsxs)(t.Fragment,{children:["images_first"!==so&&(0,t.jsxs)("h2",{className:"text-xs font-medium text-muted uppercase tracking-wide flex items-center gap-2 mt-4",children:[(0,t.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-gold"}),ef.illustrations]}),(0,t.jsx)("div",{className:`grid gap-3 ${"images_first"===so?"grid-cols-2 sm:grid-cols-3 md:grid-cols-4":"grid-cols-2 sm:grid-cols-4 md:grid-cols-6"}`,children:eU.slice(0,"images_first"===so?8:6).map((e,s)=>(0,t.jsx)(eh,{item:e,query:e_,large:"images_first"===so},`${e.pageId}-${e.detectionIndex}-${s}`))}),eD>6&&(0,t.jsxs)("button",{onClick:()=>sL("images"),className:"text-sm text-accent-gold-dark hover:text-accent-gold font-medium transition-colors flex items-center gap-1",children:[ef.seeAllImages," ",(0,t.jsx)(y.ChevronRight,{className:"w-3.5 h-3.5"})]})]}),$=(0,t.jsxs)(t.Fragment,{children:[eX&&!eQ&&(0,t.jsx)("p",{className:"text-xs text-muted italic mt-2",children:ef.semanticDegraded}
2),f&&(0,t.jsxs)("h2",{className:"text-xs font-medium text-muted uppercase tracking-wide flex items-center gap-2 mt-4",children:[(0,t.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-violet-400"}),ef.conceptualMatches]}),b.map(e=>(0,t.jsx)(em,{result:e,query:e_},e.book_id)),f&&(0,t.jsxs)("h2",{className:"text-xs font-medium text-muted uppercase tracking-wide flex items-center gap-2 mt-4",children:[(0,t.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-rust"}),ef.textMatches]}),eP.slice(0,5).map((e,s)=>(0,t.jsx)(ed,{result:e,query:e_,tenant:J,autoPassages:0===s,mobileCompact:!0},e.id)),eA>5&&(0,t.jsxs)("button",{onClick:()=>sL("books"),className:"text-sm text-accent-rust hover:text-accent-rust-dark font-medium transition-colors flex items-center gap-1",children:[ef.seeAllResults(eA.toLocaleString(ef.numberLocale))," ",(0,t.jsx)(y.ChevronRight,{className:"w-3.5 h-3.5"})]})]}),I=(e1.length>0||e3)&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("h2",{className:"text-xs font-medium text-muted uppercase tracking-wide flex items-center gap-2 mt-6",children:[(0,t.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-sage"}),ef.passages]}),e3?(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted py-3",children:[(0,t.jsx)(m.Loader2,{className:"w-4 h-4 animate-spin"}),ef.searchingPageContent]}):e1.map((e,s)=>(0,t.jsx)(ed,{result:e,query:e_,tenant:J,autoPassages:0===s,mobileCompact:!0},e.id))]}),U=!el&&eY.length>0&&(0,t.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:eY.map(e=>(0,t.jsx)(eu,{col:e},e.slug))}),V=new Set(eP.map(e=>e.id||e.book_id).filter(Boolean)),W=(e5.length>0||e9)&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("h2",{className:"text-xs font-medium text-muted uppercase tracking-wide flex items-center gap-2 mt-6",children:[(0,t.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-gold"}),ef.catalogMatches,e8>0&&(0,t.jsxs)("span",{className:"ml-1 text-muted/70 normal-case",children:["· ",e8.toLocaleString(ef.numberLocale)," ",ef.works(e8)]})]}),e9?(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted py-3",children:[(0,t.jsx)(m.Loader2,{className:"w-4 h-4 animate-spin"}),ef.searchingCatalog]}):(0,t.jsxs)(t.Fragment,{children:[e5.slice(0,5).map(e=>(0,t.jsx)(ep,{work:e,query:e_,tenant:J,digitizedAlsoInBooks:!!e.sl_book_id&&V.has(e.sl_book_id)},e.ubn||e.uuid)),e8>5&&(0,t.jsxs)(l.default,{href:`${ej("/catalog")}?cq=${encodeURIComponent(e_)}`,className:"text-sm text-accent-gold-dark hover:text-accent-gold font-medium transition-colors flex items-center gap-1",children:[ef.openAllCatalogueMatches(e8.toLocaleString(ef.numberLocale))," ",(0,t.jsx)(y.ChevronRight,{className:"w-3.5 h-3.5"})]})]})]}),Q="strong"===function(e,t){let s=[...new Set(H(e).match(/[\p{L}\p{N}]+/gu)??[])];if(s.length<2||0===t.length)return null;for(let e of t){if(!e)continue;let t=H(e);if(s.every(e=>t.includes(e)))return"strong"}return"weak"}(e_,e1.map(e=>[e.title,e.display_title,e.author,e.snippet].filter(Boolean).join(" "))),X="weak"===eJ&&!e3&&!Q&&(0,t.jsxs)("div",{className:"px-4 py-3 rounded-lg border border-border-light bg-warm/60",children:[(0,t.jsx)("p",{className:"text-sm font-medium text-primary",children:ef.weakMatchTitle(e_)}),(0,t.jsx)("p",{className:"text-sm text-secondary mt-0.5",children:ef.weakMatchBody})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[X,I,U,j,"images_first"===so?(0,t.jsxs)(t.Fragment,{children:[N,$,W]}):(0,t.jsxs)(t.Fragment,{children:[$,W,N]})]})),"books"===e$&&e_.length>=2&&(0,t.jsxs)(t.Fragment,{children:[!eL&&(0,t.jsxs)("div",{className:"mb-6 flex items-center justify-between flex-wrap gap-2",children:[(0,t.jsxs)("div",{className:"text-muted",children:[ef.foundBooksAndPages(eA.toLocaleString(ef.numberLocale),e_),eA>tF&&(0,t.jsx)("span",{className:"ml-2 text-faint",children:ef.showingRange(tl+1,Math.min(tl+tF,eA))})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted",children:[(0,t.jsx)("span",{children:ef.show}),(0,t.jsx)("select",{value:tF,onChange:e=>{tM(Number(e.target.value)),to(0)},className:"px-2 py-1 border border-border-medium rounded-md bg-white text-sm focus:outline-none focus:ring-2 focus:ring-accent-rust/30",children:eo.map(e=>(0,t.jsx)("option",{value:e,children:e},e))}),(0,t.jsx)("span",{children:ef.perPage})]})]}),eL&&(0,t.jsx)("div",{className:"py-4",children:(0,t.jsx)(ee.BookLoader,{size:"xs"})}),(0,t.jsx)("div",{className:"space-y-3",children:eP.map(e=>(0,t.jsx)(ed,{result:e,query:e_,tenant:J},e.id))}),(0,t.jsx)(eb,{total:eA,offset:tl,setOffset:to,loading:eL,pageSize:tF})]}),"index"===e$&&e_.length>=2&&(0,t.jsxs)(t.Fragment,{children:[!eL&&(0,t.jsx)("div",{className:"mb-6 text-muted",children:ef.foundIndexEntries(eM.toLocaleStr
2ing(ef.numberLocale),e_)}),eL&&(0,t.jsx)("div",{className:"py-4",children:(0,t.jsx)(ee.BookLoader,{size:"xs"})}),(0,t.jsx)("div",{className:"space-y-3",children:eE.map((e,s)=>(0,t.jsx)(eg,{result:e,query:e_,tenant:J},`${e.book_id}-${e.type}-${s}`))})]}),"images"===e$&&e_.length>=2&&(0,t.jsxs)(t.Fragment,{children:[ey&&ef.imagesEnglishNote&&(0,t.jsx)("p",{className:"mb-4 px-4 py-3 bg-warm rounded-lg border border-border-light text-sm text-secondary",children:ef.imagesEnglishNote}),!eL&&(0,t.jsx)("div",{className:"mb-6 flex items-center justify-between flex-wrap gap-2",children:(0,t.jsxs)("div",{className:"text-muted",children:[ef.foundImages(eD.toLocaleString(ef.numberLocale),e_),eD>tF&&(0,t.jsx)("span",{className:"ml-2 text-faint",children:ef.showingRange(tl+1,Math.min(tl+tF,eD))})]})}),eL&&(0,t.jsx)("div",{className:"py-4",children:(0,t.jsx)(ee.BookLoader,{size:"xs"})}),(0,t.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4",children:eU.map((e,s)=>(0,t.jsx)(eh,{item:e,query:e_,large:!0,tenant:J},`${e.pageId}-${e.detectionIndex}-${s}`))}),(0,t.jsx)(eb,{total:eD,offset:tl,setOffset:to,loading:eL,pageSize:tF})]}),!sC&&!eL&&e_.length>=3&&e$===ev&&(0,t.jsx)("section",{className:"mt-8 pt-6 border-t border-border-light",children:(0,t.jsx)(l.default,{href:`${ej("/librarian")}?q=${encodeURIComponent(e_)}`,className:"block p-6 rounded-xl bg-gradient-to-br from-[#2c1810] to-[#1a1612] text-white hover:from-[#3a2218] hover:to-[#2c1810] transition-all group",children:(0,t.jsxs)("div",{className:"flex items-start gap-4",children:[(0,t.jsx)("div",{className:"w-10 h-10 rounded-full bg-white/10 flex items-center justify-center flex-shrink-0 group-hover:bg-white/15 transition-colors",children:(0,t.jsx)(x.Quote,{className:"w-5 h-5 text-[#c9a86c]"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"font-serif text-lg font-medium text-white",children:ef.askLibrarian}),(0,t.jsx)("p",{className:"text-sm text-white/60 mt-1 font-body leading-relaxed",children:ef.askLibrarianBody(eA>0?ef.askLibrarianScopeResults(eA.toLocaleString(ef.numberLocale)):ef.askLibrarianScopeCollection)})]})]})})}),!eB&&!sC&&!eL&&e_.length>=3&&!sr&&ss.length>0&&(0,t.jsxs)("section",{className:"mt-12 pt-8 border-t border-border-light",children:[(0,t.jsx)("h2",{className:"text-sm font-medium text-muted uppercase tracking-wide mb-4",children:ef.relatedInLibrary}),(0,t.jsx)("div",{className:"space-y-3",children:ss.map(e=>(0,t.jsx)(ex,{result:e,tenant:J},e.id))})]})]})]})}],690454)}]);
3
4//# chunkId=01a0af5b-08ab-79d3-9faa-392d7d7fb210

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.