import{i as D,g as G,r,j as s,R as a,C as n,d as H}from"./index-9600e7d5.js";import{M as B,a as K}from"./index.esm-46ec59e2.js";import{h as J}from"./index-db93435d.js";import{d as L}from"./dateKhmerFormat-8553e5bc.js";import{h as O}from"./handleErrorMessage-588dcd74.js";import{s as Q}from"./setWebPageTitle-364a3db0.js";import{I as W}from"./ImageComponent-85a8e7ec.js";const U="/assets/us-c70ba1cb.svg",V="/assets/kh-ec1e0984.svg";function ls(){var d,o,m,h,g,j,x,u,p,f,b,k,N,y,w,I,C,F,v,R,E,M,A,P;const{t:i}=D(),{data:e,loading:_,error:X,refetch:$}=G("biography",{},[]);console.log("data: ",e),r.useState("");const[t,q]=r.useState("kh");Q(i("history")),r.useEffect(()=>{window.scrollTo(0,0)},[]),console.log("lang: ",t);async function c(l){var T;if(t!==l){let z={key:l};await H.patch(`/biography/increase-count/${(T=e[0])==null?void 0:T._id}`,z).then(S=>{$()}).catch(S=>{O(S)})}q(l)}return e.length>0?s.jsx(a,{className:"w-100",justify:"center",children:_===!0?null:s.jsxs("div",{className:"layout-max-width",children:[s.jsxs(a,{className:"mt-15",justify:"end",align:"middle",children:[s.jsx(n,{children:i("bio-lang")}),s.jsx(n,{children:s.jsx(a,{align:"middle",children:s.jsx("img",{className:"cursor-pointer",src:V,width:30,height:18,onClick:()=>c("kh")})})}),s.jsx(n,{children:s.jsx(a,{align:"middle",children:s.jsx("img",{className:"cursor-pointer",src:U,width:30,height:18,onClick:()=>c("en")})})})]}),t==="kh"?(o=(d=e[0])==null?void 0:d.kh)!=null&&o.backgroundImageId?s.jsx(a,{className:"mt-20 mb-20 background-image",children:s.jsx(W,{item:(h=(m=e[0])==null?void 0:m.kh)==null?void 0:h.backgroundImageId,objectFit:"contain",type:"background-image"})}):null:(j=(g=e[0])==null?void 0:g.en)!=null&&j.backgroundImageId?s.jsx(a,{className:"mt-20 mb-20 background-image",children:s.jsx(W,{item:(u=(x=e[0])==null?void 0:x.en)==null?void 0:u.backgroundImageId,objectFit:"contain",type:"background-image"})}):null,s.jsx(a,{className:"t-primary fs-16 fw-bold",children:t==="kh"?s.jsx("p",{children:(f=(p=e[0])==null?void 0:p.kh)==null?void 0:f.title}):s.jsx("p",{children:(k=(b=e[0])==null?void 0:b.en)==null?void 0:k.title})}),s.jsx(a,{gutter:20,className:"mb-30",children:t==="kh"?s.jsxs(s.Fragment,{children:[s.jsx(n,{children:s.jsxs(a,{align:"middle",className:"fs-12 t-gray",children:[s.jsx(B,{}),s.jsx("span",{className:"ml-5",children:L((y=(N=e[0])==null?void 0:N.kh)==null?void 0:y.updatedAt)})]})}),s.jsx(n,{children:s.jsxs(a,{align:"middle",className:"fs-12 t-gray",children:[s.jsx(K,{}),s.jsx("span",{className:"ml-5",children:(I=(w=e[0])==null?void 0:w.kh)==null?void 0:I.viewCount})]})})]}):s.jsxs(s.Fragment,{children:[s.jsx(n,{children:s.jsxs(a,{align:"middle",className:"fs-12 t-gray",children:[s.jsx(B,{}),s.jsx("span",{className:"ml-5",children:L((F=(C=e[0])==null?void 0:C.en)==null?void 0:F.updatedAt)})]})}),s.jsx(n,{children:s.jsxs(a,{align:"middle",className:"fs-12 t-gray",children:[s.jsx(K,{}),s.jsx("span",{className:"ml-5",children:(R=(v=e[0])==null?void 0:v.en)==null?void 0:R.viewCount})]})})]})}),s.jsx(a,{justify:"start",children:J(t==="kh"?(M=(E=e[0])==null?void 0:E.kh)==null?void 0:M.content:(P=(A=e[0])==null?void 0:A.en)==null?void 0:P.content)})]})}):null}export{ls as default};