1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-bfwsc3iZ.js","assets/index-DkQDlebz.js","assets/index-DaudWJCg.css","assets/usePageTitle-Z0gKLov9.js","assets/ListingContainer-BhGE6QAY.js","assets/useStrapiCollectionQuery-JF0urMk0.js"])))=>i.map(i=>d[i]); 2import{a5 as z,u as O,K as U,b as l,as as H,at as x,au as V,av as X,j as e,aw as Y,N as m,R as h,Q as u,ag as $,O as q,P as _,ax as Q,a4 as W,aq as J}from"./index-DkQDlebz.js";import{g as Z}from"./download-3iu9862u.js";import{B as ee}from"./Breadcrumbs-BcHCbGia.js";import{u as ae}from"./useOrders-CMYFzKDG.js";import{u as te}from"./usePageTitle-Z0gKLov9.js";import{u as E}from"./useStrapiCollectionQuery-JF0urMk0.js";import{f as B,I as se,B as ie}from"./index-DhDOx2-G.js";import{L as le}from"./ListingContainer-BhGE6QAY.js";import{b as re}from"./library-thumbnail-bg-C4sCZitf.js";import{L as ne}from"./LibraryWelcome-B9VFYQqV.js";import{R as oe}from"./RelatedBooksCarousel-DZH47PDP.js";import"./index.esm-BDMHoV4S.js";import"./payment-BkuucC4A.js";import"./CustomDialog-BWZ8QCSf.js";import"./CloseIcon-BgZT8xql.js";import"./useCarousel-BwfTOPNG.js";import"./chevron-right-D_pJZIg1.js";const ce=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],pe=z("loader-circle",ce),de=W.lazy(()=>J(()=>import("./index-bfwsc3iZ.js"),__vite__mapDeps([0,1,2,3,4,5])));function Le(){const{t:s}=O(),{locale:i,pathname:A,navigate:L,getLocalizedPath:D}=U(),[T,r]=l.useState(!1),g=H(t=>t.open),[f,b]=l.useState(!1);l.useEffect(()=>{const t=x();r(!!t);const p=()=>{const d=x();r(!!d)};return window.addEventListener("storage",p),()=>window.removeEventListener("storage",p)},[]);const C=A.split("/").pop()||"",y=decodeURIComponent(C),{data:S,isFetching:K}=E(["danh-sach-sachs","detail"],"danh-sach-sachs",{locale:i,populate:{hinhAnh:!0,tacGiaLienKet:{populate:["hinhAnhTacGia"]},danhMucLienKet:"*"},sort:"publishedAt:desc",pagination:{limit:1},filters:{duongDan:{$containsi:y}}}),a=S?.data[0],{isPurchased:n,isLoading:P}=ae(a?.id),{data:j}=E(["danh-sach-sachs","related"],"danh-sach-sachs",{locale:i,populate:{hinhAnh:!0},sort:"publishedAt:desc",pagination:{limit:1},filters:{duongDan:{$notContainsi:y}}}),k=j?j.data:[],M=a?.title||"",F=te(M),{data:G}=V(a?.id),w=X(),o=G?.isFavorited||!1,c=w.isPending,v=async t=>{if(t.stopPropagation(),t.preventDefault(),!x()){alert(s("pages.library.detail.bookmark-warning"));return}try{await w.mutateAsync(a.id)}catch(d){console.error("Error toggling favorite:",d)}},N=l.useMemo(()=>e.jsxs("button",{className:m("font-normal w-fit px-[15px] py-[8px] rounded-full flex items-center justify-center gap-1","bg-white hover:bg-[#E5E5E5] transition-all duration-300 border-primary hover:border-primary outline-none w-fit h-[40px]"),onClick:v,children:[e.jsxs("div",{className:"h-[24px] flex items-center justify-center mt-[2px]",children:[c&&e.jsx("div",{className:"animate-spin",children:e.jsx(pe,{size:16})}),!c&&e.jsx(Y,{size:16,color:"#034A7F",fill:o?"#034A7F":"none"})]}),e.jsx("span",{className:"h-[24px]",children:s(o?"pages.library.detail.bookmark-added":"pages.library.detail.bookmark")})]}),[o,c,v]),I=async()=>{try{if(!a?.id)return;const t=await Z(a.id);window.open(t,"_blank")}catch(t){console.error("Failed to open physical book preview",t),alert(s("pages.library.detail.preview-unavailable")||"Hiá»n chưa có ná»i dung Äá»c thá» cho sách nà y.")}};if(!K&&!a)return e.jsx(de,{});if(!a)return null;const R=()=>{b(!0)};return e.jsxs(le,{customThumbnailUrl:re,customTitleComponent:e.jsx(ne,{}),titleAlignment:"center",customTitleClassname:"absolute bottom-0 right-0 left-0 w-full flex items-center justify-center h-full w-full",customHeight:"h-[50vh]",children:[e.jsx("title",{children:F}),e.jsxs("div",{className:"max-w-[1440px] w-full grid grid-cols-12 gap-[24px] laptop:gap-x-[44px] laptop:gap-y-[60px] px-[20px] md:px-[30px] laptop:px-[50px]",children:[e.jsx("div",{className:"col-span-12 flex items-center justify-between",children:e.jsx(ee,{paths:[{translateKey:"pages.home.title",routeKey:h.HOME},{translateKey:"header.menu.thuVien.title",routeKey:h.LIBRARY},{translateKey:"header.menu.thuVien.thuVienDienTu"}]})}),e.jsxs("div",{className:"col-span-12 grid grid-cols-12 gap-[24px] laptop:gap-x-[44px] laptop:gap-y-[100px]",children:[e.jsx("div",{className:"col-span-12 md:col-span-5 laptop:col-span-5 h-fit flex items-center justify-center",children:e.jsx("img",{src:u(a.hin
2hAnh,"medium"),alt:a.tieuDe,className:"w-full h-auto md:w-auto md:h-[600px] object-contain"})}),e.jsxs("div",{className:"col-span-12 md:col-span-7 flex flex-col gap-[20px] md:gap-[40px]",children:[e.jsxs("div",{className:"flex flex-col gap-[16px]",children:[(a.sachNoiBat||a.moiRaMat)&&e.jsxs("div",{className:"flex items-center gap-[12px]",children:[a.sachNoiBat&&e.jsx("span",{className:"px-[16px] py-[6px] bg-[#E5E5E5] text-dark rounded-full text-[14px] font-medium",children:s("pages.library.detail.featured")||"Ná»i báºt"}),a.moiRaMat&&e.jsx("span",{className:"px-[16px] py-[6px] bg-[#E5E5E5] text-dark rounded-full text-[14px] font-medium",children:s("pages.library.detail.new-release")||"Má»i ra mắt"})]}),e.jsx("div",{className:"flex items-start gap-4",children:e.jsx("h1",{className:"text-[30px] md:text-[36px] font-medium text-dark flex-1",children:a.tieuDe})}),e.jsxs("div",{className:"flex flex-col gap-[8px] text-[16px] text-dark",children:[a.tacGiaLienKet&&a.tacGiaLienKet.length>0&&e.jsxs("p",{children:[e.jsxs("span",{className:"font-medium",children:[s("pages.library.detail.written-by"),":"," "]}),a.tacGiaLienKet.map(t=>t.tenTacGia).join(", ")]}),a.nhaXuatBan&&e.jsxs("p",{children:[e.jsxs("span",{className:"font-medium",children:[s("pages.library.detail.publisher")||"Nhà xuất bản",":"," "]}),a.nhaXuatBan]}),a.ngayXuatBan&&e.jsxs("p",{children:[e.jsxs("span",{className:"font-medium",children:[s("pages.library.detail.publish-date")||"Ngà y xuất bản",":"," "]}),$(new Date(a.ngayXuatBan),"dd/MM/yyyy")]}),a.loaiSach&&e.jsxs("p",{children:[e.jsxs("span",{className:"font-medium",children:[s("pages.library.detail.book-type")||"Loại sách",":"," "]}),s("pages.library.search.results.types."+a.loaiSach)||a.loaiSach]}),a.danhMucLienKet?.length>0&&e.jsxs("p",{children:[e.jsxs("span",{className:"font-medium",children:[s("pages.library.detail.category")||"Danh mục",":"," "]}),a.danhMucLienKet?.map(t=>t.tenDanhMuc).join(", ")]})]})]}),e.jsxs("div",{className:"flex flex-col gap-[24px] mb-[20px]",children:[a.loaiSach==="Sách Äiá»n tá»"&&Number(a.gia)!==0&&e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("button",{className:m("font-normal w-fit px-[15px] py-[8px] rounded-full flex items-center justify-center gap-2","bg-gradient-to-r from-[#AED2E8] to-primary hover:from-[#9BC9E0] hover:to-[#023E6A] transition-all duration-300 border-none outline-none w-fit h-[40px]"),onClick:()=>{n?L(`${D(h.MEMBER)}?tab=books-purchased`):T?g("buyBook"):R()},disabled:P,children:[n&&e.jsx("span",{className:"text-[16px] md:text-[22px] leading-[15px] text-white",children:s("pages.library.detail.purchased")}),!n&&e.jsxs(e.Fragment,{children:[a.giaNiemYet&&e.jsx("span",{className:"text-[16px] md:text-[22px] leading-[15px] text-[#E5E5E5] line-through",children:B(a.giaNiemYet,i)}),e.jsxs("span",{className:"text-[16px] md:text-[22px] leading-[15px] text-white",children:[s("pages.library.search.results.types.Sách Äiá»n tá»")," ",s("pages.library.detail.priced")," ",B(a.gia,i)]})]})]}),N]}),a.loaiSach==="Sách váºt lý"&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("button",{className:m("font-normal w-fit px-[15px] py-[8px] rounded-full flex items-center justify-center gap-2","bg-gradient-to-r from-[#AED2E8] to-primary hover:from-[#9BC9E0] hover:to-[#023E6A] transition-all duration-300 border-none outline-none w-fit h-[40px]"),onClick:I,children:e.jsx("span",{className:"text-[16px] md:text-[22px] leading-[15px] text-white",children:s("pages.library.detail.get-book")})}),N]}),e.jsxs("div",{className:"flex items-center gap-2 text-[14px] text-dark ",children:[e.jsx("div",{className:"w-[18px] h-[18px] flex items-center justify-center",children:e.jsx(se,{size:18,color:"#034A7F"})}),e.jsx("p",{className:"text-primary text-[16px]",children:s("pages.library.search.results.physical-books")})]})]})]}),a.tacGiaLienKet&&a.tacGiaLienKet.length>0&&e.jsxs("div",{className:"bg-[#E5E5E5] p-[30px] rounded-[10px] flex flex-col laptop:flex-row items-start gap-[20px]",children:[e.jsx("h4",{className:"font-medium text-[24px] min-w-[150px] text-dark",children:s("pages.library.detail.about-authors")}),e.jsxs("div",{className:"flex flex-col gap-[30px] flex-1 text-dark",children:[e.jsx("div",{className:"flex flex-wrap items-start gap-[20px]",children:a.tacGiaLienKet.map(t=>e.jsxs("div",{className:"flex flex-col gap-[16px] max-w-[100px]",children:[e.jsx("img",{src:u(t.hinhAnhTacGia,"small"),alt:t.tenTacGia,className:"w-[100px] h-[100px] aspect-square rounded-[10px] object-cover"}),e.jsx("p",{className:"text-[18px] text-center font-normal",children:t.tenTacGia})]},t.tenTacGia))}),e.jsx("div",{className:"flex flex-col gap-[16px]",children:a.tacGiaLienKet.map(t=>e.jsx("p",{className:"text-[16px]",children:t.thongTinTacGia},t.name))})]})]}
2),a.tomTat&&e.jsxs("div",{className:"border border-[#E5E5E5] p-[20px] md:p-[30px] laptop:p-[40px] rounded-[16px] flex flex-col gap-[18px] laptop:gap-[24px]",children:[e.jsx("h4",{className:"text-[24px] md:text-[30px] text-dark font-medium",children:s("pages.library.detail.summary")}),e.jsx("div",{className:"text-[16px] md:text-[18px] text-dark font-normal break-words [&_*]:break-words [&_*]:word-break-break-word [&_p]:mb-4 [&_p:last-child]:mb-0 [&_p]:w-full [&_h1]:text-[24px] [&_h1]:font-semibold [&_h1]:mb-4 [&_h1]:w-full [&_h1]:break-words [&_h2]:text-[22px] [&_h2]:font-semibold [&_h2]:mb-4 [&_h2]:w-full [&_h2]:break-words [&_h3]:text-[20px] [&_h3]:font-semibold [&_h3]:mb-4 [&_h3]:w-full [&_h3]:break-words [&_ul]:list-disc [&_ul]:ml-6 [&_ul]:mb-4 [&_ul]:w-full [&_ol]:list-decimal [&_ol]:ml-6 [&_ol]:mb-4 [&_ol]:w-full [&_li]:mb-2 [&_li]:break-words [&_strong]:font-semibold [&_em]:italic [&_a]:text-primary [&_a]:underline [&_a:hover]:text-[#023E6A] [&_div]:w-full [&_div]:break-words [&_span]:break-words",style:{wordBreak:"break-word",overflowWrap:"break-word"},dangerouslySetInnerHTML:{__html:q.sanitize(a.tomTat)}})]})]})]}),k.length>0&&e.jsxs("div",{className:"col-span-12 flex flex-col gap-[30px]",children:[e.jsx("h3",{className:"text-[30px] md:text-[36px] laptop:text-[42px] font-medium text-primary",children:s("pages.library.detail.related-books")}),e.jsx(oe,{items:k.map(t=>({hinhAnhThumbnail:u(t.hinhAnh,"small"),tieuDe:t.tieuDe,duongDan:t.duongDan})),actionButtonConfig:{prev:{icon:e.jsx(_,{direction:"left",color:"#034A7F",size:40})},next:{icon:e.jsx(_,{direction:"right",color:"#034A7F",size:40})}}})]})]}),a&&a.id&&e.jsx(ie,{bookId:a.id,bookTitle:a.tieuDe,bookPrice:a.gia,bookImage:a.hinhAnh}),f&&e.jsx(Q,{isOpen:f,onClose:()=>b(!1),callback:()=>{r(!0),g("buyBook")}})]})}export{Le as LibraryDetailPage,Le as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.