PageSourceSearch

https://sourcelibrary.org/_next/static/immutable/chunks/1_ywlywef3n_y.js

js sourcelibrary.org collected 2026-10-02 06:13:01 UTC 90,649 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:{};e._posthogReleaseId=e._posthogReleaseId||"01a0f8b9-201b-0000-80f4-9b19f9727857";var n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="587755f5-bc31-598e-b1cb-c5d001f192ef")}catch(e){}}();(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,690454,e=>{"use strict";var t=e.i(843476),a=e.i(500932),s=e.i(271645),r=e.i(846696),l=e.i(522016),o=e.i(657688),i=e.i(555436),n=e.i(173998),c=e.i(778917),d=e.i(687130),u=e.i(37727),m=e.i(531278),h=e.i(865960),g=e.i(284614),x=e.i(346897),p=e.i(341240),b=e.i(810980),f=e.i(763639),y=e.i(373375),j=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 C=["Hermes","Paracelsus","Kabbalah","rasayana","Ficino"],$={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",kindFeature:"Tool",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",fromTheSite:"From the site",sitePageType:e=>"blog"===e?"Essay":"collection"===e?"Collection":"feature"===e?"Tool":"Page",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",kindFeature:"Herramienta",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",fromTheSite:"En el sitio",sitePageType:e=>"blog"===e?"Ensayo":"collection"===e?"Colección":"feature"===e?"Herramienta":"Página",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",...C],es:["alquimia",...C]},I=new Set(["print","painting","drawing","object","sculpture","fresco","photograph","manuscript","manuscript-illumination","map","emblem","illustration","document","ritual-object"]);var T=e.i(765607),B=e.i(250309),P=e.i(984769),R=e.i(968673),A=e.i(130508);e.i(497608);var E=e.i(594800),q=e.i(113385),F=e.i(825142),M=e.i(140531),z=e.i(993582),U=e.i(956460),O=e.i(218415),D=e.i(214638);let K=[],H=e=>e.toLowerCase().trim().replace(/\s+/g," "),Y=e=>H(e).replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");function W(e){return e.normalize("NFKC").toLowerCase().replace(/[ʻʼ‘’']/g,"").normalize("NFD").replace(/\p{M}/gu,"")}var V=e.i(929718),Q=e.i(943942),Z=e.i(793456);function G(){return(0,Q.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:J}]}async function J(e){let t=String(e.query||"").trim();if(!t)return(0,Z.textResult)("Provide a non-empty query.");let a=await fetch(`/api/search?q=${encodeURIComponent(t)}&limit=10`);if(!a.ok)return(0,Z.textResult)(`Search failed (HTTP ${a.status}). Try again shortly.`);let s=await a.json(),r=s.results||[];if(!r.length)return(0,Z.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",a=e.author||e.book_author,s=e.slug||e.id,r=s?` — ${l}/book/${s}`:"",o=[a,e.published].filter(Boolean).join(", ");return`- ${t}${o?` (${o})`:""}${r}`});return(0,Z.textResult)(`${s.total??r.length} result(s) for "${t}":
2${o.join("\n")}`)}var ee=e.i(616),et=e.i(305866),ea=e.i(434573),es=e.i(975157),er=e.i(550033),el=e.i(163035),eo=e.i(541262);let ei=[20,48,96],en=[{value:"",labelKey:"indexAllTypes",icon:i.Search},{value:"concept",labelKey:"indexConcepts",icon:p.Lightbulb},{value:"person",labelKey:"indexPeople",icon:g.User},{value:"place",labelKey:"indexPlaces",icon:x.MapPin},{value:"quote",labelKey:"indexQuotes",icon:h.Quote},{value:"keyword",labelKey:"indexKeywords",icon:b.BookOpen},{value:"vocabulary",labelKey:"indexVocabulary",icon:f.Languages}];function ec(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 ed(e){let s,r,o,i,n,c=(0,a.c)(11),{group:d}=e,u=$[(0,S.useLocale)()],m=(0,S.useLocalePath)();return c[0]!==d.href||c[1]!==m?(s=m(d.href),c[0]=d.href,c[1]=m,c[2]=s):s=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")?(i=(0,t.jsx)(j.ChevronRight,{className:"w-3 h-3"}),c[7]=i):i=c[7],c[8]!==s||c[9]!==o?(n=(0,t.jsx)("div",{className:"px-4 pb-3 -mt-1",children:(0,t.jsxs)(l.default,{href:s,className:"inline-flex items-center gap-1 text-xs text-accent-gold-dark hover:text-accent-gold font-medium transition-colors",children:[r,o,i]})}),c[8]=s,c[9]=o,c[10]=n):n=c[10],n}function eu({result:e,query:a,tenant:r,autoPassages:i,mobileCompact:d}){let u,g=(0,S.useLocale)(),x=$[g],p=(0,S.useLocalePath)(),b=(0,es.getBookThumbnailUrl)({thumbnail:e.thumbnail,thumbnail_blob:e.thumbnail_blob}),f=ec(e.snippet||e.summary||""),[y,j]=(0,s.useState)(!1),[v,w]=(0,s.useState)(null),[N,_]=(0,s.useState)(!1),[C,L]=(0,s.useState)(!1),I=p(`/book/${e.slug||e.book_id}`),T=(0,s.useRef)(!1),B=(0,s.useCallback)(async()=>{if(!v){_(!0),L(!0);try{let t=await fetch(`/api/books/${e.book_id}/search?q=${encodeURIComponent(a)}&lang=${g}`);if(!t.ok)throw Error("Search failed");let s=((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:ec(t?.snippet||""),field:t?.field||"ocr"}}).filter(e=>e.snippet.length>20);w(s)}catch{w([])}finally{_(!1)}}},[e.book_id,a,v,g]),P=window.innerWidth<640;(0,s.useEffect)(()=>{i&&!T.current&&e.translated_count&&e.translated_count>0&&!P&&(T.current=!0,B())},[i,e.translated_count,B]);let R=(0,s.useCallback)(async e=>{(e.preventDefault(),e.stopPropagation(),v)?L(!C):B()},[v,C,B]),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&&!y?(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:()=>j(!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)(n.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:a}),"page"===e.type&&(0,t.jsx)("span",{className:"text-muted font-normal text-sm ml-2",children:x.pageAbbrev(e.page_number)})]}),(0,t.jsxs)("p",{className:"text-sm text-secondary mt-0.5",children:["editor"===(u=(0,er.getEffectiveByline)(e)).role?(0,t.jsxs)(t.Fragment,{children:[x.editedByAbbrev," ",(0,t.jsx)(V.default,{text:u.editor,query:a})]}):(0,t.jsx)(V.default,{text:e.author,query:a})," · ",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:a})}):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:[x.pagesCount(e.page_count),e.translated_count?` \xb7 ${x.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"})," ",x.searchingEllipsis]}):C?(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"})," ",x.hidePassages]}):(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)(h.Quote,{className:"w-3 h-3"})," ",x.findPassages]})})]})]})]})}),e.work_group&&(0,t.jsx)(ed,{group:e.work_group}),C&&(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:x.searchingPages}):v&&v.length>0?(0,t.jsx)("div",{className:"space-y-2 border-t border-border-light pt-3",children:v.map((e,s)=>(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:x.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:a}),e.snippet.length>200?"...":"","”"]})]},s))}):v?(0,t.jsx)("p",{className:"text-xs text-muted py-2 border-t border-border-light pt-3",children:x.noMatchingPassages}):null})]})}function em(e){let r,i,n,c,d,u,m,h,g,x,p,b,f=(0,a.c)(33),{col:y}=e,j=$[(0,S.useLocale)()],v=(0,S.useLocalePath)(),[w,k]=(0,s.use
2State)(!1),[N,_]=(0,s.useState)(null);f[0]!==y.slug?(r=()=>{let e=e=>{let t=e.detail;t?.slug===y.slug&&(_(t),k(!1))};return window.addEventListener(eo.COVER_EVENT,e),()=>window.removeEventListener(eo.COVER_EVENT,e)},i=[y.slug],f[0]=y.slug,f[1]=r,f[2]=i):(r=f[1],i=f[2]),(0,s.useEffect)(r,i);let C=N?N.url:y.hero_image,L=N?N.framing:y.card_framing,I=`/collections/${y.slug}`;return f[3]!==v||f[4]!==I?(n=v(I),f[3]=v,f[4]=I,f[5]=n):n=f[5],f[6]!==y.name||f[7]!==L||f[8]!==w||f[9]!==C||f[10]!==j?(c=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:C,alt:j.illustrationFromCollection(y.name),fill:!0,sizes:"(max-width: 640px) 50vw, 33vw",className:"object-cover",style:(0,eo.cardFramingStyle)(L),unoptimized:!0,onError:()=>k(!0)})}):(0,t.jsx)("div",{className:"absolute inset-0 bg-warm"}),f[6]=y.name,f[7]=L,f[8]=w,f[9]=C,f[10]=j,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]!==y.book_count||f[14]!==j?(u=j.collectionBooks(y.book_count.toLocaleString(j.numberLocale)),f[13]=y.book_count,f[14]=j,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]!==y.name?(h=(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:y.name}),f[18]=y.name,f[19]=h):h=f[19],f[20]!==m||f[21]!==h?(g=(0,t.jsxs)("div",{className:"absolute inset-0 flex flex-col justify-end p-3",children:[m,h]}),f[20]=m,f[21]=h,f[22]=g):g=f[22],f[23]!==g||f[24]!==n||f[25]!==c?(x=(0,t.jsxs)(l.default,{href:n,className:"group relative block overflow-hidden rounded-lg aspect-square",children:[c,d,g]}),f[23]=g,f[24]=n,f[25]=c,f[26]=x):x=f[26],f[27]!==y.name||f[28]!==y.slug?(p=(0,t.jsx)(el.default,{slug:y.slug,name:y.name}),f[27]=y.name,f[28]=y.slug,f[29]=p):p=f[29],f[30]!==x||f[31]!==p?(b=(0,t.jsxs)("div",{className:"relative group",children:[x,p]}),f[30]=x,f[31]=p,f[32]=b):b=f[32],b}function eh(e){let r,i,c,d,u,m,h,g,x,p,b,f,y,j=(0,a.c)(38),{result:v}=e,w=$[(0,S.useLocale)()],k=(0,S.useLocalePath)();j[0]!==v.thumbnail||j[1]!==v.thumbnail_blob?(r=(0,es.getBookThumbnailUrl)({thumbnail:v.thumbnail,thumbnail_blob:v.thumbnail_blob}),j[0]=v.thumbnail,j[1]=v.thumbnail_blob,j[2]=r):r=j[2];let N=r,[_,C]=(0,s.useState)(!1),L=`/book/${v.slug||v.book_id}`;j[3]!==k||j[4]!==L?(i=k(L),j[3]=k,j[4]=L,j[5]=i):i=j[5],j[6]!==N||j[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:()=>C(!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)(n.Book,{className:"w-6 h-6 text-border-medium"})}),j[6]=N,j[7]=_,j[8]=c):c=j[8],j[9]!==v.title?(d=(0,t.jsx)("h3",{className:"font-serif text-primary font-medium leading-snug",children:v.title}),j[9]=v.title,j[10]=d):d=j[10];e:{let e;j[11]!==v.author||j[12]!==v.editor?(e=(0,er.getEffectiveByline)({author:v.author,editor:v.editor}),j[11]=v.author,j[12]=v.editor,j[13]=e):e=j[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}`:"",T=v.language?` \xb7 ${v.language}`:"";return j[14]!==u||j[15]!==I||j[16]!==T?(m=(0,t.jsxs)("p",{className:"text-sm text-muted mt-0.5",children:[u,I,T]}),j[14]=u,j[15]=I,j[16]=T,j[17]=m):m=j[17],j[18]!==v.summary_snippet?(h=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}),j[18]=v.summary_snippet,j[19]=h):h=j[19],j[20]!==v.relevance_hint?(g=v.relevance_hint&&(0,t.jsx)("p",{className:"text-xs text-violet-500 mt-1",children:v.relevance_hint}),j[20]=v.relevance_hint,j[21]=g):g=j[21],j[22]!==h||j[23]!==g||j[24]!==d||j[25]!==m?(x=(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[d,m,h,g]}),j[22]=h,j[23]=g,j[24]=d,j[25]=m,j[26]=x):x=j[26],j[27]!==x||j[28]!==c?(p=(0,t.jsxs)("div",{className:"flex items-start gap-3 sm:gap-4",children:[c,x]}),j[27]=x,j[28]=c,j[29]=p):p=j[29],j[30]!==p||j[31]!==i?(b=(0,t.jsx)(l.default,{href:i,className:"block p-3 sm:p-4",children:p}
2),j[30]=p,j[31]=i,j[32]=b):b=j[32],j[33]!==v.work_group?(f=v.work_group&&(0,t.jsx)(ed,{group:v.work_group}),j[33]=v.work_group,j[34]=f):f=j[34],j[35]!==b||j[36]!==f?(y=(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]}),j[35]=b,j[36]=f,j[37]=y):y=j[37],y}function eg(e){let r,i,c,d,u,m,h,g,x,p,b=(0,a.c)(35),{result:f,tenant:y}=e,j=$[(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,s.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]!==y?(i=v("page"===f.type?(0,U.tenantBookUrl)({slug:f.slug,id:f.book_id},y)+`/page-number/${f.page_number}`:(0,U.tenantBookUrl)({slug:f.slug,id:f.book_id},y)),b[3]=v,b[4]=f.book_id,b[5]=f.page_number,b[6]=f.slug,b[7]=f.type,b[8]=y,b[9]=i):i=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)(n.Book,{className:"w-5 h-5 text-border-medium"})}),b[10]=w,b[11]=N,b[12]=c):c=b[12];let C=f.display_title||f.title;b[13]!==C?(d=(0,t.jsx)("h3",{className:"font-serif font-medium text-primary text-sm leading-tight line-clamp-1",children:C}),b[13]=C,b[14]=d):d=b[14];e:{let e;b[15]!==f?(e=(0,er.getEffectiveByline)(f),b[15]=f,b[16]=e):e=b[16];let t=e;if("editor"===t.role){u=`${j.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]!==j?(m="page"===f.type&&f.page_number&&(0,t.jsxs)("span",{children:[" · ",j.pageAbbrev(f.page_number)]}),b[17]=f.page_number,b[18]=f.type,b[19]=j,b[20]=m):m=b[20],b[21]!==u||b[22]!==L||b[23]!==m?(h=(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]=h):h=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]!==h||b[28]!==g||b[29]!==d?(x=(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[d,h,g]}),b[27]=h,b[28]=g,b[29]=d,b[30]=x):x=b[30],b[31]!==x||b[32]!==i||b[33]!==c?(p=(0,t.jsxs)(l.default,{href:i,className:"flex items-start gap-3 p-3 bg-warm rounded-lg hover:bg-warm-hover transition-colors",children:[c,x]}),b[31]=x,b[32]=i,b[33]=c,b[34]=p):p=b[34],p}function ex(e){let s,r,o,i,n,c,d,u,m=(0,a.c)(33),{result:h,query:g,tenant:x}=e,p=$[(0,S.useLocale)()],b=(0,S.useLocalePath)();if(m[0]!==h.type||m[1]!==p){var f;let e;f=h.type,s=(e=en.find(e=>e.value===f)?.labelKey)?p[e]:f,m[0]=h.type,m[1]=p,m[2]=s}else s=m[2];let y=s,j="quote"===h.type;m[3]!==j||m[4]!==b||m[5]!==h.book_id||m[6]!==h.book_slug||m[7]!==h.pages||m[8]!==h.quote_page||m[9]!==x?(r=b(j&&h.quote_page?(0,U.tenantBookUrl)({slug:h.book_slug,id:h.book_id},x)+`/guide?page=${h.quote_page}`:h.pages&&h.pages.length>0?(0,U.tenantBookUrl)({slug:h.book_slug,id:h.book_id},x)+`/guide?page=${h.pages[0]}`:(0,U.tenantBookUrl)({slug:h.book_slug,id:h.book_id},x)),m[3]=j,m[4]=b,m[5]=h.book_id,m[6]=h.book_slug,m[7]=h.pages,m[8]=h.quote_page,m[9]=x,m[10]=r):r=m[10];let v=r,w=`text-xs px-2 py-0.5 rounded-full ${(ee.SEARCH_TYPE_STYLES[h.type]??ee.SEARCH_TYPE_STYLES.keyword).badge}`;return m[11]!==w||m[12]!==y?(o=(0,t.jsx)("span",{className:w,children:y}),m[11]=w,m[12]=y,m[13]=o):o=m[13],m[14]!==j||m[15]!==g||m[16]!==h.quote_significance||m[17]!==h.quote_text||m[18]!==h.term?(i=j?(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:h.quote_text||"",query:g}),"”"]}),h.quote_significance&&(0,t.jsx)("p",{className:"text-sm text-secondary mt-1",children:(0,t.jsx)(V.default,{text:h.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:h.term,query:g})}),m[14]=j,m[15]=g,m[16]=h.quote_significance,m[17]=h.quote_text,m[18]=h.term,m[19]=i):i=m[19],m[20]!==h.pages?(n=h.pages&&h.pages.length>0&&(0,t.jsxs)("span",{className:"ml-1",children:["· p. ",h.pages.slice(0,3).join(", "),h.pages.length>3&&` +${h.pages.length-3}`]}),m[20]=h.pages,m[21]=n):n=m[21],m[22]!==h.book_author||m[23]!==h.book_title||m[24]!==n?(c=(0,t.jsxs)("p",{className:"text-sm text-muted mt-1.5",children:[h.book_title," · ",h.book_author,n]}),m[22]=h.book_author,m[23]=h.book_title,m[24]=n,m[25]=c):c=m[25],m[26]!==o||m[27]!==i||m[28]!==c?(d=(0,t.jsxs)("div",{className:"min-w-0",children:[o,i,c]}),m[26]=o,m[27]=i,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 ep(e){let r,i,n,c,d,u,m,h,g,x,p=(0,a.c)(37),{item:b,query:f,large:y,tenant:j}
2=e,[v,k]=(0,s.useState)(!1),N=$[(0,S.useLocale)()],_=b.aiTerm?`related \xb7 ${b.aiTerm}`:b.visualMatch?"visual match":null,C=!0===b.isArtwork||"artwork"===b.source;if(p[0]!==C||p[1]!==b.artworkType||p[2]!==b.type){let e;r=C?(e=(b.artworkType||b.type||"").trim().toLowerCase())&&I.has(e)?e.replace(/-/g," "):"artwork":null,p[0]=C,p[1]=b.artworkType,p[2]=b.type,p[3]=r}else r=p[3];let L=r;p[4]!==C||p[5]!==b.author||p[6]!==b.bookTitle||p[7]!==b.holder||p[8]!==N?(i=C?b.holder||b.author||null:b.bookTitle?N.imageFromBook(b.bookTitle):null,p[4]=C,p[5]=b.author,p[6]=b.bookTitle,p[7]=b.holder,p[8]=N,p[9]=i):i=p[9];let T=i,B=!C&&b.pageNumber>0?`p. ${b.pageNumber}`:null,P=b.thumbnailUrl||b.extractedUrl||b.imageUrl,R=j?`/${j}/gallery/image/${b.pageId}-${b.detectionIndex}`:`/gallery/image/${b.pageId}-${b.detectionIndex}`,A=b.link||(b.artworkSlug?`/artwork/${b.artworkSlug}`:null),E=C&&A?A:R,q=`relative bg-warm ${y?"aspect-[3/4]":"aspect-square"}`;return p[10]!==P||p[11]!==v||p[12]!==b.description||p[13]!==y?(n=!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:y?"(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]=y,p[14]=n):n=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]!==q||p[19]!==n||p[20]!==c?(d=(0,t.jsxs)("div",{className:q,children:[n,c]}),p[18]=q,p[19]=n,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]!==B||p[28]!==T?(h=T&&(0,t.jsxs)("p",{className:"text-xs text-muted flex items-baseline gap-1",children:[(0,t.jsx)("span",{className:"truncate",children:T}),B&&(0,t.jsxs)("span",{className:"shrink-0",children:["· ",B]})]}),p[27]=B,p[28]=T,p[29]=h):h=p[29],p[30]!==h||p[31]!==m?(g=(0,t.jsxs)("div",{className:"p-2.5",children:[m,h]}),p[30]=h,p[31]=m,p[32]=g):g=p[32],p[33]!==g||p[34]!==E||p[35]!==d?(x=(0,t.jsxs)(l.default,{href:E,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]=E,p[35]=d,p[36]=x):x=p[36],x}function eb(e){let r,i,c,d,u,m,h,g,x,p,b,f,y=(0,a.c)(44),{work:j,query:v,tenant:w,digitizedAlsoInBooks:k}=e,N=$[(0,S.useLocale)()],_=(0,S.useLocalePath)(),C=j.title||j.full_title||j.parallel_title||j.uniform_title||N.untitled,L=j.author||j.variant_author;y[0]!==L||y[1]!==j.place||y[2]!==j.year?(r=[L,j.year,j.place].filter(Boolean),y[0]=L,y[1]=j.place,y[2]=j.year,y[3]=r):r=y[3];let I=r.join(" · "),T=!!j.sl_book_id,B=j.ubn||j.uuid;y[4]!==B||y[5]!==T||y[6]!==_||y[7]!==w||y[8]!==j.sl_book_id||y[9]!==j.sl_book_slug?(i=_(T&&j.sl_book_id?(0,U.tenantBookUrl)({id:j.sl_book_id,slug:j.sl_book_slug||j.sl_book_id},w):`/catalog/${encodeURIComponent(B||"")}`),y[4]=B,y[5]=T,y[6]=_,y[7]=w,y[8]=j.sl_book_id,y[9]=j.sl_book_slug,y[10]=i):i=y[10];let P=i,[R,A]=(0,s.useState)(!1),E=`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"}`;y[11]!==k||y[12]!==R||y[13]!==j.thumbnail?(c=j.thumbnail&&!R?(0,t.jsx)(o.default,{src:j.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)(n.Book,{className:"w-5 h-5 text-border-medium"})}),y[11]=k,y[12]=R,y[13]=j.thumbnail,y[14]=c):c=y[14];let q=`font-medium text-primary leading-snug ${k?"text-sm":"text-base"}`;y[15]!==v||y[16]!==C?(d=v?(0,t.jsx)(V.default,{text:C,query:v}):C,y[15]=v,y[16]=C,y[17]=d):d=y[17],y[18]!==q||y[19]!==d?(u=(0,t.jsx)("h3",{className:q,children:d}),y[18]=q,y[19]=d,y[20]=u):u=y[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 ${T?"bg-accent-rust/10 text-accent-rust":"bg-cream border border-border-light text-muted"}
2`,M=T?N.digitized:N.catalogOnly;return y[21]!==F||y[22]!==M?(m=(0,t.jsx)("span",{className:F,children:M}),y[21]=F,y[22]=M,y[23]=m):m=y[23],y[24]!==m||y[25]!==u?(h=(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[u,m]}),y[24]=m,y[25]=u,y[26]=h):h=y[26],y[27]!==k||y[28]!==I?(g=I&&(0,t.jsx)("p",{className:`text-muted mt-0.5 ${k?"text-xs":"text-sm"}`,children:I}),y[27]=k,y[28]=I,y[29]=g):g=y[29],y[30]!==k||y[31]!==j.shelf_mark?(x=j.shelf_mark&&!k&&(0,t.jsx)("p",{className:"text-xs text-muted/80 mt-0.5 font-mono",children:j.shelf_mark}),y[30]=k,y[31]=j.shelf_mark,y[32]=x):x=y[32],y[33]!==h||y[34]!==g||y[35]!==x?(p=(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[h,g,x]}),y[33]=h,y[34]=g,y[35]=x,y[36]=p):p=y[36],y[37]!==p||y[38]!==c?(b=(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[c,p]}),y[37]=p,y[38]=c,y[39]=b):b=y[39],y[40]!==P||y[41]!==b||y[42]!==E?(f=(0,t.jsx)(l.default,{href:P,className:E,children:b}),y[40]=P,y[41]=b,y[42]=E,y[43]=f):f=y[43],f}function ef(e){let s,r,l,o,i,n,c,d,u,m=(0,a.c)(29),{total:h,offset:g,setOffset:x,loading:p,pageSize:b}=e,f=$[(0,S.useLocale)()];if(h<=b||p)return null;m[0]!==g||m[1]!==b||m[2]!==x?(s=()=>{x(Math.max(0,g-b)),window.scrollTo(0,0)},m[0]=g,m[1]=b,m[2]=x,m[3]=s):s=m[3];let v=0===g;m[4]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)(y.ChevronLeft,{className:"w-4 h-4"}),m[4]=r):r=m[4],m[5]!==f.previous||m[6]!==s||m[7]!==v?(l=(0,t.jsxs)("button",{onClick:s,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]=s,m[7]=v,m[8]=l):l=m[8],m[9]!==g||m[10]!==b||m[11]!==f||m[12]!==h?(o=f.pageXofY((Math.floor(g/b)+1).toLocaleString(f.numberLocale),Math.ceil(h/b).toLocaleString(f.numberLocale)),m[9]=g,m[10]=b,m[11]=f,m[12]=h,m[13]=o):o=m[13],m[14]!==o?(i=(0,t.jsx)("span",{className:"text-sm text-muted",children:o}),m[14]=o,m[15]=i):i=m[15],m[16]!==g||m[17]!==b||m[18]!==x?(n=()=>{x(g+b),window.scrollTo(0,0)},m[16]=g,m[17]=b,m[18]=x,m[19]=n):n=m[19];let w=g+b>=h;return m[20]===Symbol.for("react.memo_cache_sentinel")?(c=(0,t.jsx)(j.ChevronRight,{className:"w-4 h-4"}),m[20]=c):c=m[20],m[21]!==f.next||m[22]!==n||m[23]!==w?(d=(0,t.jsxs)("button",{onClick:n,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]=n,m[23]=w,m[24]=d):d=m[24],m[25]!==d||m[26]!==l||m[27]!==i?(u=(0,t.jsxs)("div",{className:"flex items-center justify-center gap-4 mt-8 pt-6 border-t border-border-light",children:[l,i,d]}),m[25]=d,m[26]=l,m[27]=i,m[28]=u):u=m[28],u}e.s(["default",0,function({defaultLibrary:e,forceEmbedded:a=!1,lang:o}={}){let c,g,x,b,f,y,N,C,I,U,V,Q,Z,X,J,ee,es=(0,_.useRouter)(),{tenant:er}=(0,_.useParams)(),el=(0,_.useSearchParams)(),eo=(0,_.usePathname)(),ec=(0,P.useEmbed)(),ed=a||ec,ey=(0,S.useLocale)(),ej=o??ey,ev=$[ej],ew=(0,S.useLocalePath)(),ek="en"!==ej,eN=ek?"books":"unified",e_=ek?ej:void 0,eS=el.get("mode")||eN,eC=ek&&("unified"===eS||"index"===eS)?"books":eS,[e$,eL]=(0,s.useState)(el.get("q")||""),[eI,eT]=(0,s.useState)(eC),[eB,eP]=(0,s.useState)(!1),[eR,eA]=(0,s.useState)(!1),[eE,eq]=(0,s.useState)([]),[eF,eM]=(0,s.useState)(0),[ez,eU]=(0,s.useState)([]),[eO,eD]=(0,s.useState)(0),[eK,eH]=(0,s.use
2State)([]),[eY,eW]=(0,s.useState)(0),[eV,eQ]=(0,s.useState)([]),[eZ,eG]=(0,s.useState)([]),[eX,eJ]=(0,s.useState)([]),[e0,e1]=(0,s.useState)(!1),[e2,e3]=(0,s.useState)(!1),[e4,e5]=(0,s.useState)(null),[e6,e8]=(0,s.useState)([]),[e7,e9]=(0,s.useState)(!1),[te,tt]=(0,s.useState)([]),[ta,ts]=(0,s.useState)(0),[tr,tl]=(0,s.useState)(!1),to=(0,s.useRef)(!1),ti=(0,s.useRef)([]),[tn,tc]=(0,s.useState)(new Set(["books","semantic"])),[td,tu]=(0,s.useState)(parseInt(el.get("offset")||"0")),[tm,th]=(0,s.useState)(el.get("type")||""),[tg,tx]=(0,s.useState)(el.get("sort")||"relevance"),tp=!!(el.get("language")||el.get("category")||el.get("collection")||el.get("date_from")||el.get("date_to")||el.get("has_doi")||el.get("has_translation")||el.get("first_translation")||el.get("library")),[tb,tf]=(0,s.useState)(tp),[ty,tj]=(0,s.useState)(el.get("language")||""),[tv,tw]=(0,s.useState)(el.get("category")||""),[tk,tN]=(0,s.useState)(el.get("collection")||""),[t_,tS]=(0,s.useState)(el.get("date_from")||""),[tC,t$]=(0,s.useState)(el.get("date_to")||""),[tL,tI]=(0,s.use
2State)("true"===el.get("has_doi")),[tT,tB]=(0,s.useState)("true"===el.get("has_translation")),[tP,tR]=(0,s.useState)("true"===el.get("first_translation")),[tA,tE]=(0,s.useState)(el.get("library")||e||""),[tq,tF]=(0,s.useState)([{value:"",label:ev.allLanguages}]),[tM,tz]=(0,s.useState)([{value:"",label:ev.allCategories}]),[tU,tO]=(0,s.useState)([]),[tD,tK]=(0,s.useState)(parseInt(el.get("per_page")||"")||20),[tH,tY]=(0,s.useState)([]),[tW,tV]=(0,s.useState)(0),[tQ,tZ]=(0,s.useState)(!1),[tG,tX]=(0,s.useState)(!1),[tJ,t0]=(0,s.useState)(el.get("sort")||"recent-translation"),[t1,t2]=(0,s.useState)(!1),[t3,t4]=(0,s.useState)([]),[t5,t6]=(0,s.useState)(0),[t8,t7]=(0,s.useState)(!1),[t9,ae]=(0,s.useState)(null),[at,aa]=(0,s.useState)(""),[as,ar]=(0,s.useState)([]),[al,ao]=(0,s.useState)([]),[ai,an]=(0,s.useState)([]),[ac,ad]=(0,s.useState)(!1),[au,am]=(0,s.useState)("books_first"),ah=(0,s.useRef)(!1),ag=(0,s.useRef)(null),ax=(0,s.useRef)({query:"",ranking:null,results:[],view:"all",total:0});(0,s.useEffect)(()=>{function e(e){let t=e.target?.closest?.('a[href*="/book/"]');if(!t)return;let a=ax.current;if(!a.query)return;let s=t.getAttribute("href")||"",r=s.match(/\/book\/([^/?#]+)\/page-number\/(\d+)/),l=s.match(/\/book\/([^/?#]+)/),o=(r?.[1]||l?.[1]||"").toLowerCase();if(!o)return;let i=a.results.findIndex(e=>(e.slug||"").toLowerCase()===o||(e.book_id||"").toLowerCase()===o),n={query:a.query,ranking:a.ranking,slug:o,page_number:r?Number(r[2]):void 0,rank:i>=0?i+1:void 0,view:a.view,total:a.total};try{let e=JSON.stringify(n);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,s.useEffect)(()=>{z.utils.languages().then(e=>{e.languages&&tF([{value:"",label:ev.allLanguages},...e.languages.map(e=>({value:e.code,label:`${e.name} (${e.book_count})`}))])}).catch(()=>{}),F.categories.list().then(e=>{e.categories&&tz([{value:"",label:ev.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&&tO(e.collections)}).catch(()=>{})},[ev]);let ap=(0,s.useRef)(at),ab=(0,s.useRef)(al),af=(0,s.useRef)(e$);ap.current=at,ab.current=al,af.current=e$;let ay=(0,s.useCallback)((e,t=!1)=>{if(ag.current?.(),t){let e=ap.current,t=ab.current,a=af.current;ar(s=>[...s,...e?[{query:a,text:e,terms:t}]:[]]),aa(""),ao([])}else aa(""),ao([]),an([]),ar([]),am("books_first"),ah.current=!1;if(to.current=!1,ti.current=[],ek||!e||e.length<3)return;ad(!0);let a="";ag.current=E.search.aiExpandStream(e,e=>{aa(a+=e)},async t=>{let a=e.toLowerCase(),s=t.filter(e=>e.toLowerCase()!==a);if(ao(s),0===s.length)return;let r=new Set(eE.map(e=>e.book_id)),l=new Set,o=[];for(let e of s)try{for(let t of(await E.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))}an([...o].slice(0,8))}catch{}},()=>ad(!1),e=>{ah.current||"images_first"!==e&&"books_first"!==e&&"not_in_collection"!==e||(am(e),ah.current=!0)},async e=>{if(!e||0===e.length)return;let t=new Set(eK.map(e=>`${e.pageId}-${e.detectionIndex}`)),a=[],s=e.slice(0,3);for(let[e,r]of(await Promise.allSettled(s.map(e=>q.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),a.push({...l,aiTerm:s[e]}))}a.length>0&&(to.current?(eH(e=>[...e,...a]),eW(e=>e+a.length)):ti.current=[...ti.current,...a])})},[eE,ek]),aj=(0,s.useCallback)(async(e,t=eI,a=0)=>{if(!e||e.length<2){eq([]),eM(0),eU([]),eD(0),eG([]),eQ([]),eH([]),eW(0),tt([]),ts(0),e5(null);return}eP(!0),eA(!1);try{if("unified"===t){let t=`unified:${e}:${ty}:${tv}:${tT}:${tP}:${tA}:${t_}:${tC}`,a=aw.current.get(t);if(a&&Date.now()-a.ts<ak){eq(a.books),eM(a.bookTotal),eU(a.index),eD(a.indexTotal),eH(a.images),eW(a.imageTotal),e5(a.matchQuality??null),eQ(a.site??[]),eP(!1);return}try{let a=await E.search.unified(e,{limit:5,galleryLimit:6,filters:{language:ty||void 0,category:tv||void 0,has_translation:tT?"true":void 0,first_translation:tP?"true":void 0,library:tA||void 0,date_from:t_||void 0,date_to:tC||void 0}}),s=a.books?.results||[],r=a.books?.total||0,l=(a.index?.results||[]).slice(0,5),o=a.index?.total||0;ax.current={query:e,ranking:a.books?.ranking||null,results:s,view:"all",total:r};let i=a.gallery?.results||[],n=(a.visual?.results||[]).map(e=>({...e,visualMatch:!0})),c=a.artworks?.results||[],d=new Set,u=[...i,...n],m=[];for(let e of u){if(d.has(e.id))continue;d.add(e.id);let t=(e.id||"").split("-"),a=parseInt(t.pop()||"0"),s=t.join("-");m.push({pageId:s,bookId:e.bookId||"",pageNumber:"number"==typeof e.pageNumber?e.pageNumber:0,detectionIndex:a,imageUrl:e.imageUrl||"",thumbnailUrl:e.imageUrl||"",bookTitle:e.bookTitle||"",author:"",description:e.description||"",type:e.type,visualMatch:e.visualMatch||void 0})}let h=0;for(let e of c){if(h>=8)break;let t=`artwork-${e.book_id}`;d.has(t)||(d.add(t),h++,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=(a.gallery?.total||0)+(a.visual?.total||0)+c.length;eq(s),eM(r),eU(l),eD(o);let x=ti.current;if(x.length>0){let e=new Set(m.map(e=>`${e.pageId}-${e.detectionIndex}`)),t=x.filter(t=>!e.has(`${t.pageId}-${t.detectionIndex}`));eH([...m,...t]),eW(g+t.length),ti.current=[]}else eH(m),eW(g);to.current=!0,eG(a.collections?.results||[]),eQ(a.site?.results||[]);let p="weak"===a.match_quality||"strong"===a.match_quality?a.match_quality:null;if(e5(p),ah.current=!0,aw.current.set(t,{ts:Date.now(),books:s,bookTotal:r,index:l,indexTotal:o,images:m,imageTotal:g,matchQuality:p,site:a.site?.results||[]}),aw.current.size>50){let e=[...aw.current.entries()].sort((e,t)=>
2e[1].ts-t[1].ts)[0];e&&aw.current.delete(e[0])}}catch(t){let e=t instanceof Error?t.message:String(t);if(t?.code==="SIGNIN_REQUIRED"){eA(!0),eq([]),eM(0),eU([]),eD(0),eH([]),eW(0),e5(null),eG([]),eQ([]),eJ([]),e3(!1),ag.current?.(),an([]),aa(""),ad(!1),eP(!1);return}(0,A.reportError)({message:`Unified search failed: ${e}`,source:"search_query"})}e1(!0),e3(!1);let s=new URLSearchParams({q:e,limit:"8"});if(ty&&s.set("language",ty),t_&&s.set("year_min",t_),tC&&s.set("year_max",tC),fetch(`/api/search/semantic?${s.toString()}`).then(e=>{if(!e.ok)throw Error(`semantic ${e.status}`);return e.json()}).then(e=>{let t=new Set(eE.map(e=>e.id||e.book_id)),a=(e.results||[]).filter(e=>!t.has(e.book_id));eJ(a)}).catch(()=>{eJ([]),e3(!0)}).finally(()=>e1(!1)),"bph"===er&&(tl(!0),fetch(`/api/catalog/bph?q=${encodeURIComponent(e)}&limit=8`).then(e=>e.json()).then(e=>{tt(e.works||[]),ts(e.total||0)}).catch(()=>{tt([]),ts(0)}).finally(()=>tl(!1))),/^".*"$/.test(e.trim())){let t=e.trim().slice(1,-1);e9(!0),Promise.all([E.search.search(t,{limit:15,search_content:"true"}),E.search.search(e,{limit:10,search_content:"true"}).catch(()=>({results:[]}))]).then(([e,t])=>{let a=e.results||[],s=new Set((t.results||[]).map(e=>e.id)),r=a.filter(e=>"page"===e.type).sort((e,t)=>{let a=+!!s.has(e.id);return!!s.has(t.id)-a});if(e8(r),0===eE.length){let e=a.filter(e=>"book"===e.type);e.length>0&&(eq(e),eM(e.length))}}).catch(()=>e8([])).finally(()=>e9(!1))}else e8([])}else if("books"===t){let t=await E.search.search(e,{lang:e_,language:ty||void 0,category:tv||void 0,date_from:t_||void 0,date_to:tC||void 0,has_doi:tL?"true":void 0,has_translation:tT?"true":void 0,first_translation:tP?"true":void 0,library:tA||void 0,sort:"relevance"!==tg?tg:void 0,offset:a>0?a:void 0,limit:tD,search_content:"true"});eq(t.results||[]),eM(t.total||0),ax.current={query:e,ranking:t.ranking||null,results:t.results||[],view:"books",total:t.total||0}}else if("index"===t){let t=await E.search.index(e,{type:tm||void 0,dateFrom:t_||void 0,dateTo:tC||void 0});eU(t.results||[]),eD(t.total||0)}else if("images"===t){let t=await q.gallery.list({query:e,limit:tD,offset:a,yearFrom:t_&&parseInt(t_,10)||void 0,yearTo:tC&&parseInt(tC,10)||void 0}),s=t.items||[],r=ti.current;if(r.length>0){let e=new Set(s.map(e=>`${e.pageId}-${e.detectionIndex}`)),a=r.filter(t=>!e.has(`${t.pageId}-${t.detectionIndex}`));eH([...s,...a]),eW((t.total||0)+a.length),ti.current=[]}else eH(s),eW(t.total||0);to.current=!0}}catch(e){console.error("Search error:",e),r.toast.error(ev.searchFailed)}finally{eP(!1)}},[eI,tm,ty,tv,t_,tC,tL,tT,tP,tA,tg,tD,e_,ev]),av=(0,s.useCallback)((e,t,a=0)=>{let s=new URLSearchParams;e&&s.set("q",e),t!==eN&&s.set("mode",t),"index"===t&&tm&&s.set("type",tm),ty&&s.set("language",ty),tv&&s.set("category",tv),tk&&s.set("collection",tk),t_&&s.set("date_from",t_),tC&&s.set("date_to",tC),tL&&s.set("has_doi","true"),tT&&s.set("has_translation","true"),tP&&s.set("first_translation","true"),tA&&s.set("library",tA),e&&"relevance"!==tg&&s.set("sort",tg),e||"recent-translation"===tJ||s.set("sort",tJ),a>0&&s.set("offset",a.toString()),20!==tD&&s.set("per_page",tD.toString());let r=eo&&eo.endsWith("/search")?eo:er?`/${er}/search`:"/search";es.replace(`${r}?${s.toString()}`,{scroll:!1})},[es,eo,er,eN,tm,ty,tv,tk,t_,tC,tL,tT,tP,tA,tg,tJ,tD]),aw=(0,s.useRef)(new Map),ak=6e4,aN=(0,R.useDebouncedCallback)(e=>{tu(0),aj(e,eI,0),av(e,eI,0)},450),a_=(0,s.useRef)("");(0,s.useEffect)(()=>{e$.length>=2&&(aj(e$,eI,td),av(e$,eI,td),a_.current!==e$&&(a_.current=e$,ay(e$)))},[eI,tm,ty,tv,t_,tC,tL,tT,tP,tA,tg,td,aj,av]);let aS=(0,s.useCallback)(e=>{eL(e),tu(0),aj(e,eI,0),av(e,eI,0),ay(e,!0),a_.current=e},[eI,aj,av,ay]),aC=(0,s.useMemo)(()=>ed||ek?null:function(e,t={}){let a=H(e);if(a.length<2)return null;let s=Y(e);for(let e of K)if(e.aliases.some(e=>H(e)===a||Y(e)===s)){let{aliases:t,...a}=e;return a}for(let e of t.collections||[])if(Y(e.slug||"")===s||H(e.name||"")===a||Y(e.name||"")===s)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)===s||H(e.name)===a||H(e.shortName)===a||Y(e.name)===s)return{title:e.name,description:e.description,href:`/libraries/${e.slug}`,kind:"library"};for(let e of D.default)if(e.aliases.some(e=>
2H(e)===a||Y(e)===s))return{title:e.title,description:e.description,href:e.href,kind:"feature"};return null}(e$,{collections:tU}),[ed,ek,e$,tU]),a$=!e$||e$.length<2,aL=(0,s.useRef)(!1),aI=(0,s.useCallback)(async()=>{if(!aL.current&&0===td&&!ty&&!tv&&!tk&&!tA&&"recent-translation"===tJ){let e=window.__BROWSE_PREFETCH,t=window.__BROWSE_PREFETCH_TS,a=tP?"first_translation":tT?"has_translation":null;if(a&&e?.[a]&&t&&Date.now()-t<3e5){aL.current=!0,tY(e[a].books||[]),tV(e[a].total||0);return}}tZ(!0),tX(!1);try{let e=await E.search.browse({language:ty||void 0,category:tv||void 0,collection:tk||void 0,library:tA||void 0,sort:tJ,limit:tD,skip:td,first_translation:tP||void 0,has_translation:tT||void 0});tY(e.books||[]),tV(e.total||0)}catch(e){tY([]),tV(0),tX(!0),(0,A.reportError)({message:`Browse API failed: ${e instanceof Error?e.message:String(e)}`,source:"search_browse"})}finally{tZ(!1)}},[ty,tv,tk,tA,tJ,td,tP,tT,tD]);(0,s.useEffect)(()=>{a$&&"images"!==eI&&(aI(),av("",eI,td))},[a$,ty,tv,tk,tA,tJ,td,tP,tT,eI]);let aT=(0,s.useCallback)(async()=>{t7(!0);try{let e=await q.gallery.list({limit:tD,offset:td,maxPerBook:2});t4(e.items||[]),t6(e.total||0)}catch{t4([]),t6(0)}finally{t7(!1)}},[td,tD]);(0,s.useEffect)(()=>{a$&&"images"===eI&&(aT(),av("","images",td))},[a$,eI,td,tD]);let aB=eF+eO+eY,aP=!eR&&e$.length>=2&&!eB&&!e0&&!e2&&!e7&&!tr&&0===aB&&0===eX.length&&0===e6.length&&0===te.length;(0,s.useEffect)(()=>{if(!aP||e$.length<3)return void ae(null);let e=!1;return E.search.suggest(e$).then(t=>{e||ae(t.suggestions?.[0]||null)}).catch(()=>{e||ae(null)}),()=>{e=!0}},[aP,e$]);let aR=e=>{eT(e),tu(0)},aA=()=>{tj(""),tw(""),tN(""),tS(""),t$(""),tI(!1),tB(!1),tR(!1),tE(e||""),tx("relevance"),t0("recent-translation"),tu(0)},aE=ty||tv||tk||t_||tC||tL||tT||tP||tA&&tA!==e||"relevance"!==tg;return(0,t.jsxs)("div",{className:"bg-cream",lang:ej,children:[!ed&&(0,t.jsx)(G,{}),!ed&&(0,t.jsx)(B.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)(i.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;eL(t=e.target.value),t.length>=2&&tu(0),ag.current?.(),aa(""),ao([]),an([]),ad(!1),a_.current="",aN(t)},onKeyDown:e=>{"Enter"===e.key&&e$.length>=3&&(a_.current=e$,ay(e$))},placeholder:ev.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}),eB&&(0,t.jsx)(m.Loader2,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-5 h-5 text-muted animate-spin"})]}),!a$&&"unified"!==eI&&(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:tg,onChange:e=>{tx(e.target.value),tu(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:ev.sortRelevance}),(0,t.jsx)("option",{value:"date_desc",children:ev.sortYearNewest}),(0,t.jsx)("option",{value:"date_asc",children:ev.sortYearOldest}),(0,t.jsx)("option",{value:"title",children:ev.sortTitleAz})]})]}),a$&&(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:tJ,onChange:e=>{t0(e.target.value),tu(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:ev.browseRecentTranslation}),(0,t.jsx)("option",{value:"recent",children:ev.browseRecent}),(0,t.jsx)("option",{value:"date_desc",children:ev.browseOldestFirst}),(0,t.jsx)("option",{value:"date_asc",children:ev.browseNewestFirst}),(0,t.jsx)("option",{value:"title-asc",children:ev.browseTitleAsc}),(0,t.jsx)("option",{value:"title-desc",children:ev.browseTitleDesc})]})]})]}),(0,t.jsx)("div",{className:"mt-3 flex gap-1 border-b border-border-light -mx-4 px-4",children:(a$?[{mode:eN,label:ev.tabBooks,icon:n.Book},{mode:"images",label:ev.tabImages,icon:w.ImageIcon}]:ek?[{mode:"books",label:ev.tabBooks,icon:n.Book},{mode:"images",label:ev.tabImages,icon:w.ImageIcon}]:[{mode:"unified",label:ev.tabAll,icon:i.Search},{mode:"books",label:ev.tabBooks,icon:n.Book},{mode:"index",label:ev.tabIndex,icon:p.Lightbulb},{mode:"images",label:ev.tabImages,icon:w.ImageIcon}]).map(({mode:e,label:a,icon:s})=>(0,t.jsxs)("button",{onClick:()=>{eT(e),tu(0)},className:`flex items-center gap-1.5 px-4 py-2.5 text-sm font-medium border-b-2 transition-colors ${eI===e?"border-accent-rust text-accent-rust":"border-transparent text-muted hover:text-secondary hover:border-border-medium"}`,children:[(0,t.jsx)(s,{className:"w-4 h-4"}),a,!a$&&"books"===e&&eF>0&&(ek||"unified"!==eI)&&(0,t.jsxs)("span",{className:"text-xs text-muted",children:["(",eF.toLocaleStr
2ing(ev.numberLocale),")"]}),!a$&&"index"===e&&eO>0&&"unified"!==eI&&(0,t.jsxs)("span",{className:"text-xs text-muted",children:["(",eO.toLocaleString(ev.numberLocale),")"]}),!a$&&"images"===e&&eY>0&&(ek||"unified"!==eI)&&(0,t.jsxs)("span",{className:"text-xs text-muted",children:["(",eY.toLocaleString(ev.numberLocale),")"]})]},e))}),"index"===eI&&(0,t.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:en.map(e=>{let a=e.icon;return(0,t.jsxs)("button",{onClick:()=>{th(e.value),tu(0)},className:`px-3 py-1.5 rounded-lg text-sm flex items-center gap-1.5 transition-colors ${tm===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)(a,{className:"w-3.5 h-3.5"}),ev[e.labelKey]]},e.value)})}),(0,t.jsx)("div",{className:"mt-3 flex items-center gap-3",children:(0,t.jsxs)("button",{onClick:()=>tf(!tb),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 ${tb?"":"-rotate-90"}`}),(0,t.jsx)(d.Filter,{className:"w-3.5 h-3.5"}),ev.filters,aE&&(0,t.jsx)("span",{className:"w-1.5 h-1.5 bg-accent-rust roun
2ded-full"})]})}),tb&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"md:hidden fixed inset-0 bg-black/30 z-40",onClick:()=>tf(!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:ev.filters}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[aE&&(0,t.jsxs)("button",{onClick:aA,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"})," ",ev.clear]}),(0,t.jsx)("button",{onClick:()=>tf(!1),className:"text-sm font-medium text-accent-rust",children:ev.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:ev.filterLanguage}),(0,t.jsx)("select",{value:ty,onChange:e=>tj(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:tq.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:ev.filterSubject}),(0,t.jsx)("select",{value:tv,onChange:e=>tw(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:tM.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:ev.filterCollection}),(0,t.jsxs)("select",{value:tk,onChange:e=>{tN(e.target.value),tu(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:ev.allCollections}),tU.map(e=>(0,t.jsxs)("option",{value:e.slug,children:[(0,T.localizedCollection)(e,ej).name," (",e.book_count.toLocaleString(ev.numberLocale),")"]},e.slug))]})]}),!e&&!ed&&(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm text-secondary mb-1",children:ev.filterLibrary}),(0,t.jsxs)("select",{value:tA,onChange:e=>tE(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:ev.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:ev.filterPublishedAfter}),(0,t.jsx)("input",{type:"text",value:t_,onChange:e=>tS(e.target.value),placeholder:ev.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:ev.filterPublishedBefore}),(0,t.jsx)("input",{type:"text",value:tC,onChange:e=>t$(e.target.value),placeholder:ev.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:tT,onChange:e=>tB(e.target.checked),className:"rounded border-border-medium text-accent-rust focus:ring-accent-rust/30"})," ",ev.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:tP,onChange:e=>tR(e.target.checked),className:"rounded border-border-medium text-accent-gold focus:ring-accent-gold/30"})," ",ev.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:tL,onChange:e=>tI(e.target.checked),className:"rounded border-border-medium text-accent-rust focus:ring-accent-rust/30"})," ",ev.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:aE&&(0,t.jsxs)("button",{onClick:aA,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"})," ",ev.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:ev.filterLanguage}),(0,t.jsx)("select",{value:ty,onChange:e=>tj(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:tq.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:ev.filterSubject}),(0,t.jsx)("select",{value:tv,onChange:e=>tw(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:tM.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:ev.filterCollection}),(0,t.jsxs)("select",{value:tk,onChange:e=>{tN(e.target.value),tu(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:ev.allCollections}),tU.map(e=>(0,t.jsxs)("option",{value:e.slug,children:[(0,T.localizedCollection)(e,ej).name," 
2(",e.book_count.toLocaleString(ev.numberLocale),")"]},e.slug))]})]}),!e&&!ed&&(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm text-secondary mb-1",children:ev.filterLibrary}),(0,t.jsxs)("select",{value:tA,onChange:e=>tE(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:ev.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:ev.filterPublishedAfter}),(0,t.jsx)("input",{type:"text",value:t_,onChange:e=>tS(e.target.value),placeholder:ev.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:ev.filterPublishedBefore}),(0,t.jsx)("input",{type:"text",value:tC,onChange:e=>t$(e.target.value),placeholder:ev.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:tT,onChange:e=>tB(e.target.checked),className:"rounded border-border-medium text-accent-rust focus:ring-accent-rust/30"})," ",ev.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:tP,onChange:e=>tR(e.target.checked),className:"rounded border-border-medium text-accent-gold focus:ring-accent-gold/30"})," ",ev.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:tL,onChange:e=>tI(e.target.checked),className:"rounded border-border-medium text-accent-rust focus:ring-accent-rust/30"})," ",ev.hasDoi]})]})]})]})]})]})}),(0,t.jsxs)("main",{className:"max-w-[var(--container-wide)] mx-auto px-6 md:px-12 py-8",children:[eR&&(0,t.jsxs)("div",{className:"text-center py-16 max-w-lg mx-auto",children:[(0,t.jsx)(i.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:ev.signInHeading}),(0,t.jsx)("p",{className:"text-secondary mb-6",children:ev.signInBody}),(0,t.jsx)(l.default,{href:`${ew("/auth/signin")}?callbackUrl=${ew("/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:ev.signInCta})]}),a$&&"images"===eI&&(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"mb-4 flex items-center justify-between flex-wrap gap-2",children:[!t8&&t5>0&&(0,t.jsxs)("div",{className:"text-muted",children:[ev.imagesCount(t5.toLocaleString(ev.numberLocale)),t5>tD&&(0,t.jsx)("span",{className:"ml-2 text-faint",children:ev.showingRange(td+1,Math.min(td+tD,t5))})]}),(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:ev.show}),(0,t.jsx)("select",{value:tD,onChange:e=>{tK(Number(e.target.value)),tu(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:ei.map(e=>(0,t.jsx)("option",{value:e,children:e},e))}),(0,t.jsx)("span",{children:ev.perPage})]})})]}),t8&&(0,t.jsx)("div",{className:"py-8",children:(0,t.jsx)(et.BookLoader,{size:"xs"})}),!t8&&t3.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:t3.map((e,a)=>(0,t.jsx)(ep,{item:e,query:"",large:!0,tenant:er},`${e.pageId}-${e.detectionIndex}-${a}`))}),!t8&&0===t3.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:ev.noImagesFound}),(0,t.jsx)("p",{className:"text-base text-muted",children:ev.noImagesBo
2dy})]}),(0,t.jsx)(ef,{total:t5,offset:td,setOffset:tu,loading:t8,pageSize:tD})]}),a$&&"images"!==eI&&(0,t.jsxs)("div",{children:[!ed&&tU.length>0&&(t1||tU.slice(0,6),c=tU.length>6,(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 mb-6",children:[(0,t.jsxs)("button",{onClick:()=>{tN(""),tu(0)},className:`px-4 py-2 rounded-full text-sm font-medium transition-colors ${!tk?"bg-accent-rust text-white":"bg-warm text-secondary hover:bg-accent-rust/10 hover:text-accent-rust border border-border-light"}`,children:[ev.allBooks,!tk&&tW>0&&(0,t.jsxs)("span",{className:"ml-1.5 text-white/80",children:["(",tW.toLocaleString(ev.numberLocale),")"]})]}),tU.map((e,a)=>(0,t.jsxs)("button",{onClick:()=>{tN(e.slug),tu(0)},className:`px-4 py-2 rounded-full text-sm font-medium transition-colors ${!t1&&a>=6?"hidden sm:inline-flex":""} ${tk===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,T.localizedCollection)(e,ej).name,(0,t.jsxs)("span",{className:`ml-1.5 ${tk===e.slug?"text-white/80":"text-muted"}`,children:["(",e.book_count.toLocaleString(ev.numberLocale),")"]})]},e.slug)),c&&!t1&&(0,t.jsx)("button",{onClick:()=>t2(!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:ev.andNMore(tU.length-6)})]})),!tQ&&tW>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:[ev.booksCount(tW.toLocaleString(ev.numberLocale)),tk&&tU.find(e=>e.slug===tk)&&(0,t.jsxs)("span",{children:[" ",ev.inCollection," ",(0,t.jsx)("span",{className:"font-medium text-primary",children:(0,T.localizedCollection)(tU.find(e=>e.slug===tk),ej).name})]}),tW>tD&&(0,t.jsx)("span",{className:"ml-2 text-faint",children:ev.showingRange(td+1,Math.min(td+tD,tW))})]}),(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:ev.show}),(0,t.jsx)("select",{value:tD,onChange:e=>{tK(Number(e.target.value)),tu(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:ei.map(e=>(0,t.jsx)("option",{value:e,children:e},e))}),(0,t.jsx)("span",{children:ev.perPage})]}),(0,t.jsx)(l.default,{href:ew("/catalog"),className:"text-sm text-accent-rust hover:underline",children:ev.browseFullCatalog})]})]}),tQ&&(0,t.jsx)("div",{className:"py-8",children:(0,t.jsx)(et.BookLoader,{size:"xs"})}),!tQ&&tH.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:tH.map((e,a)=>(0,t.jsx)(ea.default,{book:e,priority:a<5,lang:ej},e.id))}),!tQ&&tG&&(0,t.jsxs)("div",{className:"text-center py-16",children:[(0,t.jsx)(n.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:ev.somethingWentWrong}),(0,t.jsx)("p",{className:"text-base text-muted mb-4",children:ev.couldNotLoadLibrary}),(0,t.jsx)("button",{onClick:()=>aI(),className:"px-4 py-2 text-sm bg-primary text-white rounded-md hover:bg-primary/90 transition-colors",children:ev.tryAgain})]}),!tQ&&!tG&&0===tH.length&&0===tW&&(0,t.jsxs)("div",{className:"text-center py-16",children:[(0,t.jsx)(n.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:ev.noBooksFound}),(0,t.jsx)("p",{className:"text-base text-muted",children:ev.adjustFilters})]}),(0,t.jsx)(ef,{total:tW,offset:td,setOffset:tu,loading:tQ,pageSize:tD})]}),aC&&e$.length>=2&&(0,t.jsxs)(l.default,{href:aC.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:aC.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"===aC.kind?ev.kindReadingRoom:"library"===aC.kind?ev.kindLibrary:"feature"===aC.kind?ev.kindFeature:ev.kindCollection}),(0,t.jsxs)("div",{className:"font-serif font-medium text-primary group-hover:text-accent-rust transition-colors",children:[aC.title," ",(0,t.jsx)("span",{"aria-hidden":!0,
2children:"→"})]}),(0,t.jsx)("p",{className:"text-sm text-muted line-clamp-2",children:aC.description})]})]}),e$.length>=2&&eB&&"unified"===eI&&(0,t.jsx)("div",{className:"py-8",children:(0,t.jsx)(et.BookLoader,{size:"xs"})}),e$.length>=3&&(ac||at)&&("unified"!==eI||eB)&&(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:at.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\*([^*]+)\*/g,"<em>$1</em>")+(ac?'<span class="inline-block w-1.5 h-4 bg-accent-rust/40 animate-pulse ml-0.5 align-text-bottom"></span>':"")}}),al.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5 mt-2",children:al.map(e=>(0,t.jsx)("button",{onClick:()=>aS(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))})]}),aP&&!ac&&0===ai.length&&(0,t.jsxs)("div",{className:"text-center py-16 max-w-lg mx-auto",children:[(0,t.jsx)(i.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:ev.noResultsFound}),t9&&(0,t.jsxs)("p",{className:"text-secondary mb-6",children:[ev.didYouMean," ",(0,t.jsx)("button",{onClick:()=>{eL(t9),tu(0),aj(t9,eI,0),av(t9,eI,0)},className:"font-semibold text-accent-rust hover:text-accent-rust/80 underline underline-offset-2",children:t9}),"?"]}),(0,t.jsx)("p",{className:"text-muted mb-6",children:ev.corpusBlurb}),(0,t.jsxs)("div",{className:"flex flex-wrap justify-center gap-2",children:[L[ej].map(e=>(0,t.jsx)("button",{onClick:()=>{eL(e),tu(0),aj(e,eI,0),av(e,eI,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:()=>{eL(""),tu(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:ev.browseAllBooks})]})]}),aP&&ai.length>0&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("p",{className:"text-sm text-muted",children:ev.relatedFromAi}),ai.map(e=>(0,t.jsx)(eg,{result:e,tenant:er},e.id))]}),!eR&&"unified"===eI&&!eB&&e$.length>=2&&(aB>0||eX.length>0||e0||e6.length>0||e7||te.length>0||tr)&&(g=new Set(eE.map(e=>e.id||e.book_id)),x=new Set(eE.map(e=>e.work_id).filter(Boolean)),b=eX.filter(e=>!g.has(e.book_id)&&!(e.work_id&&x.has(e.work_id))),f=eE.length>0&&b.length>0,y=e$.length>=3&&(ac||at||as.length>0)&&(0,t.jsxs)("div",{className:"px-4 py-3 bg-warm/60 rounded-lg border border-border-light space-y-2",children:[as.map((e,a)=>(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>")}})]},a)),(ac||at)&&(0,t.jsx)("p",{className:"text-sm text-secondary italic leading-relaxed",dangerouslySetInnerHTML:{__html:at.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\*([^*]+)\*/g,"<em>$1</em>")+(ac?'<span class="inline-block w-1.5 h-4 bg-accent-rust/40 animate-pulse ml-0.5 align-text-bottom"></span>':"")}}),al.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:al.map(e=>(0,t.jsx)("button",{onClick:()=>aS(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=eK.length>0&&(0,t.jsxs)(t.Fragment,{children:["images_first"!==au&&(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"}),ev.illustrations]}),(0,t.jsx)("div",{className:`grid gap-3 ${"images_first"===au?"grid-cols-2 sm:grid-cols-3 md:grid-cols-4":"grid-cols-2 sm:grid-cols-4 md:grid-cols-6"}`,children:eK.slice(0,"images_first"===au?8:6).map((e,a)=>(0,t.jsx)(ep,{item:e,query:e$,large:"images_first"===au},`${e.pageId}-${e.detectionIndex}-${a}`))}),eY>6&&(0,t.jsxs)("button",{onClick:()=>aR("images"),className:"text-sm text-accent-gold-dark hover:text-accent-gold font-medium transition-colors flex items-center gap-1",children:[ev.seeAllImages," ",(0,t.jsx)(j.ChevronRight,{className:"w-3.5 h-3.5"})]})]}),C=(0,t.jsxs)(t.Fragment,{children:[e2&&!e0&&(0,t.jsx)("p",{className:"text-xs text-muted italic mt-2",children:ev.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"}),ev.conceptualMatches]}),b.map(e=>(0,t.jsx)(eh,{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"}),ev.textMatches]}),eE.slice(0,5).map((e,a)=>(0,t.jsx)(eu,{result:e,query:e$,tenant:er,autoPassages:0===a,mobileCompact:!0},e.id)),eF>5&&(0,t.jsxs)("button",{onClick:()=>aR("books"),className:"text-sm text-accent-rust hover:text-accent-rust-dark font-medium transition-colors flex items-center gap-1",children:[ev.seeAllResults(eF.toLocaleString(ev.numberLocale))," ",(0,t.jsx)(j.ChevronRight,{className:"w-3.5 h-3.5"})]})]}),I=(e6.length>0||e7)&&(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"}),ev.passages]}),e7?(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"}),ev.searchingPageContent]}):e6.map((e,a)=>(0,t.jsx)(eu,{result:e,query:e$,tenant:er,autoPassages:0===a,mobileCompact:!0},e.id))]}),U=!ed&&eZ.length>0&&(0,t.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:eZ.map(e=>(0,t.jsx)(em,{col:e},e.slug))}),V=eV.filter(e=>e.url!==aC?.href),Q=!ed&&!ek&&V.length>0&&(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-2",children:[(0,t.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-gold"}),ev.fromTheSite]}),(0,t.jsx)("ul",{className:"space-y-2",children:V.map(e=>(0,t.jsx)("li",{children:(0,t.jsxs)(l.default,{href:e.url,className:"block px-4 py-3 bg-white rounded-xl border border-border-light hover:border-accent-rust/30 hover:shadow-md transition-all",children:[(0,t.jsx)("span",{className:"text-[11px] uppercase tracking-wide text-muted",children:ev.sitePageType(e.page_type)}),(0,t.jsx)("span",{className:"block text-lg font-medium text-primary font-serif leading-snug line-clamp-2",children:e.title}),(0,t.jsx)("span",{className:"block text-sm text-secondary line-clamp-2 mt-0.5",children:e.snippet})]})},e.url))})]}),Z=new Set(eE.map(e=>e.id||e.book_id).filter(Boolean)),X=(te.length>0||tr)&&(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"}),ev.catalogMatches,ta>0&&(0,t.jsxs)("span",{className:"ml-1 text-muted/70 normal-case",children:["· ",ta.toLocaleString(ev.numberLocale)," ",ev.works(ta)]})]}),tr?(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"}),ev.searchingCatalog]}):(0,t.jsxs)(t.Fragment,{children:[te.slice(0,5).map(e=>(0,t.jsx)(eb,{work:e,query:e$,tenant:er,digitizedAlsoInBooks:!!e.sl_book_id&&Z.has(e.sl_book_id)},e.ubn||e.uuid)),ta>5&&(0,t.jsxs)(l.default,{href:`${ew("/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:[ev.openAllCatalogueMatches(ta.toLocaleString(ev.numberLocale))," ",(0,t.jsx)(j.ChevronRight,{className:"w-3.5 h-3.5"})]})]})]}),J="strong"===function(e,t){let a=[...new Set(W(e).match(/[\p{L}\p{N}]+/gu)??[])];if(a.length<2||0===t.length)return null;for(let e of t){if(!e)continue;let t=W(e);if(a.every(e=>t.includes(e)))return"strong"}return"weak"}(e$,e6.map(e=>[e.title,e.display_title,e.author,e.snippet].filter(Boolean).join(" "))),ee="weak"===e4&&!e7&&!J&&!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:ev.weakMatchTitle(e$)}),(0,t.jsx)("p",{className:"text-sm text-secondary mt-0.5",children:ev.weakMatchBody})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[ee,I,U,Q,y,"images_first"===au?(0,t.jsxs)(t.Fragment,{children:[N,C,X]}):(0,t.jsxs)(t.Fragment,{children:[C,X,N]})]})),"books"===eI&&e$.length>=2&&(0,t.jsxs)(t.Fragment,{children:[!eB&&(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:[ev.foundBooksAndPages(eF.toLocaleStr
2ing(ev.numberLocale),e$),eF>tD&&(0,t.jsx)("span",{className:"ml-2 text-faint",children:ev.showingRange(td+1,Math.min(td+tD,eF))})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted",children:[(0,t.jsx)("span",{children:ev.show}),(0,t.jsx)("select",{value:tD,onChange:e=>{tK(Number(e.target.value)),tu(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:ei.map(e=>(0,t.jsx)("option",{value:e,children:e},e))}),(0,t.jsx)("span",{children:ev.perPage})]})]}),eB&&(0,t.jsx)("div",{className:"py-4",children:(0,t.jsx)(et.BookLoader,{size:"xs"})}),(0,t.jsx)("div",{className:"space-y-3",children:eE.map(e=>(0,t.jsx)(eu,{result:e,query:e$,tenant:er},e.id))}),(0,t.jsx)(ef,{total:eF,offset:td,setOffset:tu,loading:eB,pageSize:tD})]}),"index"===eI&&e$.length>=2&&(0,t.jsxs)(t.Fragment,{children:[!eB&&(0,t.jsx)("div",{className:"mb-6 text-muted",children:ev.foundIndexEntries(eO.toLocaleString(ev.numberLocale),e$)}),eB&&(0,t.jsx)("div",{className:"py-4",children:(0,t.jsx)(et.BookLoader,{size:"xs"})}),(0,t.jsx)("div",{className:"space-y-3",children:ez.map((e,a)=>(0,t.jsx)(ex,{result:e,query:e$,tenant:er},`${e.book_id}-${e.type}-${a}`))})]}),"images"===eI&&e$.length>=2&&(0,t.jsxs)(t.Fragment,{children:[ek&&ev.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:ev.imagesEnglishNote}),!eB&&(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:[ev.foundImages(eY.toLocaleString(ev.numberLocale),e$),eY>tD&&(0,t.jsx)("span",{className:"ml-2 text-faint",children:ev.showingRange(td+1,Math.min(td+tD,eY))})]})}),eB&&(0,t.jsx)("div",{className:"py-4",children:(0,t.jsx)(et.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:eK.map((e,a)=>(0,t.jsx)(ep,{item:e,query:e$,large:!0,tenant:er},`${e.pageId}-${e.detectionIndex}-${a}`))}),(0,t.jsx)(ef,{total:eY,offset:td,setOffset:tu,loading:eB,pageSize:tD})]}),!aP&&!eB&&e$.length>=3&&eI===eN&&(0,t.jsx)("section",{className:"mt-8 pt-6 border-t border-border-light",children:(0,t.jsx)(l.default,{href:`${ew("/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)(h.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:ev.askLibrarian}),(0,t.jsx)("p",{className:"text-sm text-white/60 mt-1 font-body leading-relaxed",children:ev.askLibrarianBody(eF>0?ev.askLibrarianScopeResults(eF.toLocaleString(ev.numberLocale)):ev.askLibrarianScopeCollection)})]})]})})}),!eR&&!aP&&!eB&&e$.length>=3&&!ac&&ai.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:ev.relatedInLibrary}),(0,t.jsx)("div",{className:"space-y-3",children:ai.map(e=>(0,t.jsx)(eg,{result:e,tenant:er},e.id))})]})]})]})}],690454)},214638,(e,t,a)=>{t.exports=[{href:"/identify",title:"Identify an Artwork",description:"Photograph any print or engraving — on a museum wall or the open page of an old book — and find the original in Source Library, with the book it belongs to.",aliases:["identify","identify artwork","identify an artwork","identify image","reverse image search","image lookup","find this engraving"]},{href:"/ngrams",title:"Ngram Viewer",description:"Chart how words and phrases rise and fall across five centuries of primary sources — alchemy, Hermetica, Kabbalah, and early science — then click through to the pages themselves.",aliases:["ngram","ngrams","ngram viewer","n-gram","word frequency","word trends"]},{href:"/librarian",title:"The Librarian",description:"Ask the Librarian about any text in the collection. Alchemy, Hermetica, Kabbalah, astrology, natural philosophy — thousands of rare books, many translated into English for the first time.",aliases:["librarian","the librarian","ask the librarian","ai librarian"]},{href:"/explore",title:"Explore",description:"Interactive visualizations of 12,500+ people, places, and concepts from the Western esoteric tradition. Century heatmaps, era highlights, and data source breakdowns.",aliases:["explore","visualizations","heatmap"]},{href:"/explore/map",title:"Map",description:"Interactive map of 10,000+ books plotted by publication city, author birthplace, and the heartland of each text’s tradition.",aliases:["book map","explore map","map of books"]},{href:"/gallery",title:"Image Gallery",description:"Browse illustrations, engravings, woodcuts, alchemical emblems, and diagrams extracted from rare historical texts — searchable by subject, technique, and period.",aliases:["gallery","image gallery"]},{href:"/encyclopedia",title:"Encyclopedia",description:"Explore people, places, and concepts from historical texts. Discover connections between alchemists, philosophers, and esoteric ideas across the collection.",aliases:["encyclopedia","people places concepts"]},{href:"/rithmomachia",title:"Rithmomachia — Play the Battle of Numbers",description:"Play Rithmomachia, the medieval mathematical board game. Capture opponents through arithmetic — addition, subtraction, multiplication, and division. Win by creating Pythagorean harmonie
2s.",aliases:["rithmomachia","battle of numbers","board game"]},{href:"/catalog",title:"Catalogue",description:"Browse the complete Source Library catalogue — thousands of translated primary sources in alchemy, philosophy, theology, and the esoteric traditions.",aliases:["catalog","catalogue"]},{href:"/census",title:"Translation Census",description:"A living record of which pre-modern European texts have been translated into English. Validated estimate: ~85% of all early-modern print — and ~93% of Renaissance-composed Latin — has never been Englished.",aliases:["census","translation census"]},{href:"/topics",title:"Browse by Topic",description:"Explore historical texts across six dimensions: tradition, domain, form, cultural sphere, era, and epistemic mode. Filter and combine to find exactly what you're looking for.",aliases:["topics","browse by topic"]},{href:"/languages",title:"Languages",description:"Browse Source Library by language — Latin, German, French, Greek, Hebrew, Arabic, and 30+ more languages spanning 5,000 years of human thought.",aliases:["languages","browse by language"]},{href:"/data",title:"The Collection",description:"Live data on the Source Library collection: books, languages, centuries, topics, and source institutions.",aliases:["collection data","collection statistics"]},{href:"/dataset",title:"Dataset",description:"Structured parallel-text training data from 19,000+ historical texts in 200+ languages. Page-aligned OCR, English translations, and scholarly metadata.",aliases:["dataset","training data","parallel text"]},{href:"/volunteers",title:"Welcome, volunteers",description:"You've been invited to help curate Source Library. A few seconds per item, no signup needed.",aliases:["volunteer","volunteers","help curate"]},{href:"/tablets",title:"Cuneiform Tablet Corpus",description:"107 cuneiform tablets from CDLI with photos, metadata, and scholarly ATF transliterations.",aliases:["tablets","cuneiform tablets","cdli"]},{href:"/research",title:"Research",description:"A working library is also an instrument. The questions we are trying to answer with it: whether machines read historical pages or recite them, what makes a scan readable, how much has never been translated, and what a first translation actually is.",aliases:["research questions","research program"]},{href:"/podcast",title:"Source Library Deep Dive — Podcast",description:"AI-generated scholarly podcasts exploring rare books from the 15th-18th centuries. Alchemy, Hermetica, Kabbalah, and the Western esoteric tradition — grounded in primary sources.",aliases:["podcast","deep dive"]},{href:"/works",title:"Works",description:"Works held in several editions across several centuries — the same text as manuscript, early printing, and modern edition, each one readable page by page.",aliases:["works index"]},{href:"/browse",title:"Browse",description:"Browse the Source Library collection alphabetically by title, author, or publication year.",aliases:["browse","browse books","a-z","all books"]},{href:"/curated",title:"Curated Collections",description:"Thematic exhibitions across the library, stories that cut across traditions and centuries.",aliases:["curated","exhibitions","curated collections"]},{href:"/hieroglyphs",title:"Hieroglyph OCR Eval",description:"Side-by-side evaluation of Gemini AI hieroglyphic OCR against Budge's Egyptian Reading Book (1896).",aliases:["hieroglyphs","hieroglyph ocr"]},{href:"/developers",title:"Developers",description:"Open API over 15,000+ rare pre-modern texts translated to English — theology, philosophy, history, science, mysticism, literature. No auth required — call /api/mcp from curl, the browser, or any MCP client. 15 research tools, REST endpoints, CLI.",aliases:["developers","api","mcp","mcp server"]}]}]);
3
4//# chunkId=587755f5-bc31-598e-b1cb-c5d001f192ef

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.